Merge branch 'main' into feature/document-type-sorting
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { createImportMap } from "../importmap/index.js";
|
||||
import { writeFileSync, rmSync } from "fs";
|
||||
import { packageJsonName, packageJsonVersion } from "../package/index.js";
|
||||
|
||||
const srcDir = './dist-cms';
|
||||
const outputModuleList = `${srcDir}/umbraco-package.json`;
|
||||
const importmap = createImportMap({ rootDir: '/umbraco/backoffice', additionalImports: {} });
|
||||
|
||||
const umbracoPackageJson = {
|
||||
name: packageJsonName,
|
||||
version: packageJsonVersion,
|
||||
extensions: [],
|
||||
importmap
|
||||
};
|
||||
|
||||
try {
|
||||
rmSync(outputModuleList, { force: true });
|
||||
writeFileSync(outputModuleList, JSON.stringify(umbracoPackageJson));
|
||||
console.log(`Wrote manifest to ${outputModuleList}`);
|
||||
} catch (e) {
|
||||
console.error(`Failed to write manifest to ${outputModuleList}`, e);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -12,7 +12,9 @@ export const createImportMap = (args) => {
|
||||
const moduleName = key.replace(/^\.\//, '');
|
||||
|
||||
// replace ./dist-cms with src and remove /index.js
|
||||
const modulePath = value.replace(/^\.\/dist-cms/, args.rootDir).replace('.js', '.ts');
|
||||
let modulePath = value;
|
||||
if (typeof args.rootDir !== 'undefined') modulePath = modulePath.replace(/^\.\/dist-cms/, args.rootDir);
|
||||
if (args.replaceModuleExtensions) modulePath = modulePath.replace('.js', '.ts');
|
||||
console.log('replacing', value, 'with', modulePath)
|
||||
const importAlias = `${packageJsonName}/${moduleName}`;
|
||||
|
||||
|
||||
@@ -3,4 +3,5 @@ import { readFileSync } from 'fs';
|
||||
export const packageJsonPath = 'package.json';
|
||||
export const packageJsonData = JSON.parse(readFileSync(packageJsonPath).toString());
|
||||
export const packageJsonName = packageJsonData.name;
|
||||
export const packageJsonVersion = packageJsonData.version;
|
||||
export const packageJsonExports = packageJsonData.exports;
|
||||
|
||||
@@ -42,6 +42,7 @@ const importmap = createImportMap({
|
||||
additionalImports: {
|
||||
'@umbraco-cms/internal/test-utils': './utils/test-utils.ts',
|
||||
},
|
||||
replaceModuleExtensions: true,
|
||||
});
|
||||
|
||||
const paths = {};
|
||||
|
||||
1586
src/Umbraco.Web.UI.Client/package-lock.json
generated
1586
src/Umbraco.Web.UI.Client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@umbraco-cms/backoffice",
|
||||
"license": "MIT",
|
||||
"version": "14.0.0--preview006",
|
||||
"version": "14.0.0--preview007",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": null,
|
||||
@@ -115,7 +115,7 @@
|
||||
"build:for:cms": "npm run build && node ./devops/build/copy-to-cms.js",
|
||||
"build:for:static": "vite build",
|
||||
"build:vite": "tsc && vite build --mode staging",
|
||||
"build": "tsc --project ./src/tsconfig.build.json && rollup -c ./src/rollup.config.js && npm run package:validate",
|
||||
"build": "tsc --project ./src/tsconfig.build.json && rollup -c ./src/rollup.config.js && npm run package:validate && npm run generate:manifest",
|
||||
"check": "npm run lint:errors && npm run compile && npm run build-storybook && npm run generate:jsonschema:dist",
|
||||
"compile": "tsc",
|
||||
"dev": "vite",
|
||||
@@ -143,6 +143,7 @@
|
||||
"wc-analyze:vscode": "wca **/*.element.ts --format vscode --outFile dist-cms/vscode-html-custom-data.json",
|
||||
"wc-analyze": "wca **/*.element.ts --outFile dist-cms/custom-elements.json",
|
||||
"generate:tsconfig": "node ./devops/tsconfig/index.js",
|
||||
"generate:manifest": "node ./devops/build/create-umbraco-package.js",
|
||||
"package:validate": "node ./devops/package/validate-exports.js"
|
||||
},
|
||||
"engines": {
|
||||
@@ -153,17 +154,17 @@
|
||||
"@openid/appauth": "^1.3.1",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"@umbraco-ui/uui": "1.7.0-rc.0",
|
||||
"@umbraco-ui/uui-css": "1.7.0-rc.0",
|
||||
"dompurify": "^3.0.6",
|
||||
"element-internals-polyfill": "^1.3.9",
|
||||
"@umbraco-ui/uui": "1.7.1",
|
||||
"@umbraco-ui/uui-css": "1.7.0",
|
||||
"dompurify": "^3.0.8",
|
||||
"element-internals-polyfill": "^1.3.10",
|
||||
"lit": "^3.1.2",
|
||||
"lodash-es": "4.17.21",
|
||||
"marked": "^11.1.1",
|
||||
"monaco-editor": "^0.45.0",
|
||||
"marked": "^12.0.0",
|
||||
"monaco-editor": "^0.46.0",
|
||||
"rxjs": "^7.8.1",
|
||||
"tinymce": "^6.8.2",
|
||||
"tinymce-i18n": "^23.12.4",
|
||||
"tinymce": "^6.8.3",
|
||||
"tinymce-i18n": "^24.1.29",
|
||||
"uuid": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -175,13 +176,13 @@
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-replace": "^5.0.5",
|
||||
"@storybook/addon-a11y": "7.6.7",
|
||||
"@storybook/addon-actions": "7.6.7",
|
||||
"@storybook/addon-essentials": "7.6.7",
|
||||
"@storybook/addon-links": "7.6.7",
|
||||
"@storybook/addon-a11y": "^7.6.15",
|
||||
"@storybook/addon-actions": "^7.6.15",
|
||||
"@storybook/addon-essentials": "^7.6.15",
|
||||
"@storybook/addon-links": "^7.6.15",
|
||||
"@storybook/mdx2-csf": "^1.1.0",
|
||||
"@storybook/web-components": "7.6.7",
|
||||
"@storybook/web-components-vite": "7.6.7",
|
||||
"@storybook/web-components": "^7.6.15",
|
||||
"@storybook/web-components-vite": "^7.6.15",
|
||||
"@types/chai": "^4.3.5",
|
||||
"@types/lodash-es": "^4.17.8",
|
||||
"@types/mocha": "^10.0.1",
|
||||
@@ -216,14 +217,14 @@
|
||||
"rollup-plugin-esbuild": "^6.1.0",
|
||||
"rollup-plugin-import-css": "^3.4.0",
|
||||
"rollup-plugin-web-worker-loader": "^1.6.1",
|
||||
"storybook": "7.6.7",
|
||||
"storybook": "^7.6.15",
|
||||
"tiny-glob": "^0.2.9",
|
||||
"tsc-alias": "^1.8.8",
|
||||
"typescript": "^5.3.3",
|
||||
"typescript-json-schema": "^0.62.0",
|
||||
"vite": "^5.0.11",
|
||||
"vite": "^5.1.1",
|
||||
"vite-plugin-static-copy": "^1.0.1",
|
||||
"vite-tsconfig-paths": "^4.2.3",
|
||||
"vite-tsconfig-paths": "^4.3.1",
|
||||
"web-component-analyzer": "^2.0.0"
|
||||
},
|
||||
"msw": {
|
||||
|
||||
@@ -22,11 +22,14 @@ export type { AvailableMemberTypeCompositionResponseModel } from './models/Avail
|
||||
export type { ChangePasswordUserRequestModel } from './models/ChangePasswordUserRequestModel';
|
||||
export { CompositionTypeModel } from './models/CompositionTypeModel';
|
||||
export type { ConsentLevelPresentationModel } from './models/ConsentLevelPresentationModel';
|
||||
export type { ContentCollectionResponseModelBaseDocumentValueModelDocumentVariantResponseModel } from './models/ContentCollectionResponseModelBaseDocumentValueModelDocumentVariantResponseModel';
|
||||
export type { ContentCollectionResponseModelBaseMediaValueModelMediaVariantResponseModel } from './models/ContentCollectionResponseModelBaseMediaValueModelMediaVariantResponseModel';
|
||||
export type { ContentForDocumentResponseModel } from './models/ContentForDocumentResponseModel';
|
||||
export type { ContentForMediaResponseModel } from './models/ContentForMediaResponseModel';
|
||||
export type { ContentForMemberResponseModel } from './models/ContentForMemberResponseModel';
|
||||
export type { ContentTreeItemResponseModel } from './models/ContentTreeItemResponseModel';
|
||||
export type { ContentTypeCleanupBaseModel } from './models/ContentTypeCleanupBaseModel';
|
||||
export type { ContentTypeCollectionReferenceResponseModelBaseModel } from './models/ContentTypeCollectionReferenceResponseModelBaseModel';
|
||||
export type { ContentTypeCompositionRequestModelBaseModel } from './models/ContentTypeCompositionRequestModelBaseModel';
|
||||
export type { ContentTypeCompositionResponseModelBaseModel } from './models/ContentTypeCompositionResponseModelBaseModel';
|
||||
export type { ContentTypeForDocumentTypeResponseModel } from './models/ContentTypeForDocumentTypeResponseModel';
|
||||
@@ -99,6 +102,7 @@ export { DirectionModel } from './models/DirectionModel';
|
||||
export type { DisableUserRequestModel } from './models/DisableUserRequestModel';
|
||||
export type { DocumentBlueprintResponseModel } from './models/DocumentBlueprintResponseModel';
|
||||
export type { DocumentBlueprintTreeItemResponseModel } from './models/DocumentBlueprintTreeItemResponseModel';
|
||||
export type { DocumentCollectionResponseModel } from './models/DocumentCollectionResponseModel';
|
||||
export type { DocumentConfigurationResponseModel } from './models/DocumentConfigurationResponseModel';
|
||||
export type { DocumentItemResponseModel } from './models/DocumentItemResponseModel';
|
||||
export type { DocumentNotificationResponseModel } from './models/DocumentNotificationResponseModel';
|
||||
@@ -106,6 +110,7 @@ export type { DocumentRecycleBinItemResponseModel } from './models/DocumentRecyc
|
||||
export type { DocumentResponseModel } from './models/DocumentResponseModel';
|
||||
export type { DocumentTreeItemResponseModel } from './models/DocumentTreeItemResponseModel';
|
||||
export type { DocumentTypeCleanupModel } from './models/DocumentTypeCleanupModel';
|
||||
export type { DocumentTypeCollectionReferenceResponseModel } from './models/DocumentTypeCollectionReferenceResponseModel';
|
||||
export type { DocumentTypeCompositionModel } from './models/DocumentTypeCompositionModel';
|
||||
export type { DocumentTypeCompositionRequestModel } from './models/DocumentTypeCompositionRequestModel';
|
||||
export type { DocumentTypeCompositionResponseModel } from './models/DocumentTypeCompositionResponseModel';
|
||||
@@ -179,11 +184,13 @@ export { LogLevelModel } from './models/LogLevelModel';
|
||||
export type { LogMessagePropertyPresentationModel } from './models/LogMessagePropertyPresentationModel';
|
||||
export type { LogMessageResponseModel } from './models/LogMessageResponseModel';
|
||||
export type { LogTemplateResponseModel } from './models/LogTemplateResponseModel';
|
||||
export type { MediaCollectionResponseModel } from './models/MediaCollectionResponseModel';
|
||||
export type { MediaConfigurationResponseModel } from './models/MediaConfigurationResponseModel';
|
||||
export type { MediaItemResponseModel } from './models/MediaItemResponseModel';
|
||||
export type { MediaRecycleBinItemResponseModel } from './models/MediaRecycleBinItemResponseModel';
|
||||
export type { MediaResponseModel } from './models/MediaResponseModel';
|
||||
export type { MediaTreeItemResponseModel } from './models/MediaTreeItemResponseModel';
|
||||
export type { MediaTypeCollectionReferenceResponseModel } from './models/MediaTypeCollectionReferenceResponseModel';
|
||||
export type { MediaTypeCompositionModel } from './models/MediaTypeCompositionModel';
|
||||
export type { MediaTypeCompositionRequestModel } from './models/MediaTypeCompositionRequestModel';
|
||||
export type { MediaTypeCompositionResponseModel } from './models/MediaTypeCompositionResponseModel';
|
||||
@@ -241,6 +248,7 @@ export type { PagedCultureReponseModel } from './models/PagedCultureReponseModel
|
||||
export type { PagedDataTypeTreeItemResponseModel } from './models/PagedDataTypeTreeItemResponseModel';
|
||||
export type { PagedDictionaryOverviewResponseModel } from './models/PagedDictionaryOverviewResponseModel';
|
||||
export type { PagedDocumentBlueprintTreeItemResponseModel } from './models/PagedDocumentBlueprintTreeItemResponseModel';
|
||||
export type { PagedDocumentCollectionResponseModel } from './models/PagedDocumentCollectionResponseModel';
|
||||
export type { PagedDocumentRecycleBinItemResponseModel } from './models/PagedDocumentRecycleBinItemResponseModel';
|
||||
export type { PagedDocumentTreeItemResponseModel } from './models/PagedDocumentTreeItemResponseModel';
|
||||
export type { PagedDocumentTypeTreeItemResponseModel } from './models/PagedDocumentTypeTreeItemResponseModel';
|
||||
@@ -252,6 +260,7 @@ export type { PagedLanguageResponseModel } from './models/PagedLanguageResponseM
|
||||
export type { PagedLoggerResponseModel } from './models/PagedLoggerResponseModel';
|
||||
export type { PagedLogMessageResponseModel } from './models/PagedLogMessageResponseModel';
|
||||
export type { PagedLogTemplateResponseModel } from './models/PagedLogTemplateResponseModel';
|
||||
export type { PagedMediaCollectionResponseModel } from './models/PagedMediaCollectionResponseModel';
|
||||
export type { PagedMediaRecycleBinItemResponseModel } from './models/PagedMediaRecycleBinItemResponseModel';
|
||||
export type { PagedMediaTreeItemResponseModel } from './models/PagedMediaTreeItemResponseModel';
|
||||
export type { PagedMediaTypeTreeItemResponseModel } from './models/PagedMediaTypeTreeItemResponseModel';
|
||||
@@ -349,7 +358,6 @@ export type { TemplateQueryResultItemPresentationModel } from './models/Template
|
||||
export type { TemplateQueryResultResponseModel } from './models/TemplateQueryResultResponseModel';
|
||||
export type { TemplateQuerySettingsResponseModel } from './models/TemplateQuerySettingsResponseModel';
|
||||
export type { TemplateResponseModel } from './models/TemplateResponseModel';
|
||||
export type { TemplateScaffoldResponseModel } from './models/TemplateScaffoldResponseModel';
|
||||
export type { TemporaryFileResponseModel } from './models/TemporaryFileResponseModel';
|
||||
export type { TourStatusModel } from './models/TourStatusModel';
|
||||
export type { TreeItemPresentationModel } from './models/TreeItemPresentationModel';
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/* generated using openapi-typescript-codegen -- do no edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { DocumentValueModel } from './DocumentValueModel';
|
||||
import type { DocumentVariantResponseModel } from './DocumentVariantResponseModel';
|
||||
|
||||
export type ContentCollectionResponseModelBaseDocumentValueModelDocumentVariantResponseModel = {
|
||||
values: Array<DocumentValueModel>;
|
||||
variants: Array<DocumentVariantResponseModel>;
|
||||
id: string;
|
||||
creator?: string | null;
|
||||
sortOrder: number;
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
/* generated using openapi-typescript-codegen -- do no edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { MediaValueModel } from './MediaValueModel';
|
||||
import type { MediaVariantResponseModel } from './MediaVariantResponseModel';
|
||||
|
||||
export type ContentCollectionResponseModelBaseMediaValueModelMediaVariantResponseModel = {
|
||||
values: Array<MediaValueModel>;
|
||||
variants: Array<MediaVariantResponseModel>;
|
||||
id: string;
|
||||
creator?: string | null;
|
||||
sortOrder: number;
|
||||
};
|
||||
@@ -3,7 +3,8 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
export type TemplateScaffoldResponseModel = {
|
||||
content: string;
|
||||
export type ContentTypeCollectionReferenceResponseModelBaseModel = {
|
||||
id: string;
|
||||
alias: string;
|
||||
icon: string;
|
||||
};
|
||||
|
||||
12
src/Umbraco.Web.UI.Client/src/external/backend-api/src/models/DocumentCollectionResponseModel.ts
vendored
Normal file
12
src/Umbraco.Web.UI.Client/src/external/backend-api/src/models/DocumentCollectionResponseModel.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/* generated using openapi-typescript-codegen -- do no edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { ContentCollectionResponseModelBaseDocumentValueModelDocumentVariantResponseModel } from './ContentCollectionResponseModelBaseDocumentValueModelDocumentVariantResponseModel';
|
||||
import type { DocumentTypeCollectionReferenceResponseModel } from './DocumentTypeCollectionReferenceResponseModel';
|
||||
|
||||
export type DocumentCollectionResponseModel = (ContentCollectionResponseModelBaseDocumentValueModelDocumentVariantResponseModel & {
|
||||
documentType: DocumentTypeCollectionReferenceResponseModel;
|
||||
updater?: string | null;
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
/* generated using openapi-typescript-codegen -- do no edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { ContentTypeCollectionReferenceResponseModelBaseModel } from './ContentTypeCollectionReferenceResponseModelBaseModel';
|
||||
|
||||
export type DocumentTypeCollectionReferenceResponseModel = ContentTypeCollectionReferenceResponseModelBaseModel;
|
||||
11
src/Umbraco.Web.UI.Client/src/external/backend-api/src/models/MediaCollectionResponseModel.ts
vendored
Normal file
11
src/Umbraco.Web.UI.Client/src/external/backend-api/src/models/MediaCollectionResponseModel.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/* generated using openapi-typescript-codegen -- do no edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { ContentCollectionResponseModelBaseMediaValueModelMediaVariantResponseModel } from './ContentCollectionResponseModelBaseMediaValueModelMediaVariantResponseModel';
|
||||
import type { MediaTypeCollectionReferenceResponseModel } from './MediaTypeCollectionReferenceResponseModel';
|
||||
|
||||
export type MediaCollectionResponseModel = (ContentCollectionResponseModelBaseMediaValueModelMediaVariantResponseModel & {
|
||||
mediaType: MediaTypeCollectionReferenceResponseModel;
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
/* generated using openapi-typescript-codegen -- do no edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { ContentTypeCollectionReferenceResponseModelBaseModel } from './ContentTypeCollectionReferenceResponseModelBaseModel';
|
||||
|
||||
export type MediaTypeCollectionReferenceResponseModel = ContentTypeCollectionReferenceResponseModelBaseModel;
|
||||
@@ -0,0 +1,11 @@
|
||||
/* generated using openapi-typescript-codegen -- do no edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { DocumentCollectionResponseModel } from './DocumentCollectionResponseModel';
|
||||
|
||||
export type PagedDocumentCollectionResponseModel = {
|
||||
total: number;
|
||||
items: Array<DocumentCollectionResponseModel>;
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
/* generated using openapi-typescript-codegen -- do no edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { MediaCollectionResponseModel } from './MediaCollectionResponseModel';
|
||||
|
||||
export type PagedMediaCollectionResponseModel = {
|
||||
total: number;
|
||||
items: Array<MediaCollectionResponseModel>;
|
||||
};
|
||||
@@ -4,12 +4,14 @@
|
||||
/* eslint-disable */
|
||||
import type { CopyDocumentRequestModel } from '../models/CopyDocumentRequestModel';
|
||||
import type { CreateDocumentRequestModel } from '../models/CreateDocumentRequestModel';
|
||||
import type { DirectionModel } from '../models/DirectionModel';
|
||||
import type { DocumentConfigurationResponseModel } from '../models/DocumentConfigurationResponseModel';
|
||||
import type { DocumentItemResponseModel } from '../models/DocumentItemResponseModel';
|
||||
import type { DocumentNotificationResponseModel } from '../models/DocumentNotificationResponseModel';
|
||||
import type { DocumentResponseModel } from '../models/DocumentResponseModel';
|
||||
import type { DomainsResponseModel } from '../models/DomainsResponseModel';
|
||||
import type { MoveDocumentRequestModel } from '../models/MoveDocumentRequestModel';
|
||||
import type { PagedDocumentCollectionResponseModel } from '../models/PagedDocumentCollectionResponseModel';
|
||||
import type { PagedDocumentRecycleBinItemResponseModel } from '../models/PagedDocumentRecycleBinItemResponseModel';
|
||||
import type { PagedDocumentTreeItemResponseModel } from '../models/PagedDocumentTreeItemResponseModel';
|
||||
import type { PublicAccessRequestModel } from '../models/PublicAccessRequestModel';
|
||||
@@ -27,15 +29,61 @@ import { request as __request } from '../core/request';
|
||||
|
||||
export class DocumentResource {
|
||||
|
||||
/**
|
||||
* @returns PagedDocumentCollectionResponseModel Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getCollectionDocumentById({
|
||||
id,
|
||||
dataTypeId,
|
||||
orderBy = 'updateDate',
|
||||
orderCulture,
|
||||
orderDirection,
|
||||
filter,
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
id: string,
|
||||
dataTypeId?: string,
|
||||
orderBy?: string,
|
||||
orderCulture?: string,
|
||||
orderDirection?: DirectionModel,
|
||||
filter?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedDocumentCollectionResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/collection/document/{id}',
|
||||
path: {
|
||||
'id': id,
|
||||
},
|
||||
query: {
|
||||
'dataTypeId': dataTypeId,
|
||||
'orderBy': orderBy,
|
||||
'orderCulture': orderCulture,
|
||||
'orderDirection': orderDirection,
|
||||
'filter': filter,
|
||||
'skip': skip,
|
||||
'take': take,
|
||||
},
|
||||
errors: {
|
||||
400: `Bad Request`,
|
||||
401: `The resource is protected and requires an authentication token`,
|
||||
404: `Not Found`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns string Created
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static postDocument({
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateDocumentRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateDocumentRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
url: '/umbraco/management/api/v1/document',
|
||||
@@ -56,10 +104,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getDocumentById({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<DocumentResponseModel> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<DocumentResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/document/{id}',
|
||||
@@ -79,10 +127,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static deleteDocumentById({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'DELETE',
|
||||
url: '/umbraco/management/api/v1/document/{id}',
|
||||
@@ -103,12 +151,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentById({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}',
|
||||
@@ -131,12 +179,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static postDocumentByIdCopy({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: CopyDocumentRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: CopyDocumentRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
url: '/umbraco/management/api/v1/document/{id}/copy',
|
||||
@@ -159,10 +207,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getDocumentByIdDomains({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<DomainsResponseModel> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<DomainsResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/document/{id}/domains',
|
||||
@@ -181,12 +229,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentByIdDomains({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateDomainsRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateDomainsRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}/domains',
|
||||
@@ -206,12 +254,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentByIdMove({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: MoveDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: MoveDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}/move',
|
||||
@@ -233,10 +281,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentByIdMoveToRecycleBin({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}/move-to-recycle-bin',
|
||||
@@ -257,10 +305,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getDocumentByIdNotifications({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<Array<DocumentNotificationResponseModel>> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<Array<DocumentNotificationResponseModel>> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/document/{id}/notifications',
|
||||
@@ -280,12 +328,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentByIdNotifications({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateDocumentNotificationsRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateDocumentNotificationsRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}/notifications',
|
||||
@@ -306,12 +354,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static postDocumentByIdPublicAccess({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: PublicAccessRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: PublicAccessRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
url: '/umbraco/management/api/v1/document/{id}/public-access',
|
||||
@@ -334,10 +382,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static deleteDocumentByIdPublicAccess({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'DELETE',
|
||||
url: '/umbraco/management/api/v1/document/{id}/public-access',
|
||||
@@ -353,14 +401,14 @@ export class DocumentResource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns void
|
||||
* @returns void
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getDocumentByIdPublicAccess({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<void> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<void> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/document/{id}/public-access',
|
||||
@@ -380,12 +428,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentByIdPublicAccess({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: PublicAccessRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: PublicAccessRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}/public-access',
|
||||
@@ -407,12 +455,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentByIdPublish({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: (PublishDocumentRequestModel | PublishDocumentWithDescendantsRequestModel),
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: (PublishDocumentRequestModel | PublishDocumentWithDescendantsRequestModel),
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}/publish',
|
||||
@@ -435,12 +483,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentByIdPublishWithDescendants({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: PublishDocumentWithDescendantsRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: PublishDocumentWithDescendantsRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}/publish-with-descendants',
|
||||
@@ -463,12 +511,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentByIdUnpublish({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UnpublishDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UnpublishDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}/unpublish',
|
||||
@@ -491,12 +539,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentByIdValidate({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/{id}/validate',
|
||||
@@ -533,10 +581,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putDocumentSort({
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: SortingRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: SortingRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/document/sort',
|
||||
@@ -556,10 +604,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static postDocumentValidate({
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateDocumentRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
url: '/umbraco/management/api/v1/document/validate',
|
||||
@@ -579,10 +627,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getItemDocument({
|
||||
id,
|
||||
}: {
|
||||
id?: Array<string>,
|
||||
}): CancelablePromise<Array<DocumentItemResponseModel>> {
|
||||
id,
|
||||
}: {
|
||||
id?: Array<string>,
|
||||
}): CancelablePromise<Array<DocumentItemResponseModel>> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/item/document',
|
||||
@@ -616,10 +664,10 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static deleteRecycleBinDocumentById({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'DELETE',
|
||||
url: '/umbraco/management/api/v1/recycle-bin/document/{id}',
|
||||
@@ -640,14 +688,14 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getRecycleBinDocumentChildren({
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedDocumentRecycleBinItemResponseModel> {
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedDocumentRecycleBinItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/recycle-bin/document/children',
|
||||
@@ -667,12 +715,12 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getRecycleBinDocumentRoot({
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedDocumentRecycleBinItemResponseModel> {
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedDocumentRecycleBinItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/recycle-bin/document/root',
|
||||
@@ -691,16 +739,16 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getTreeDocumentChildren({
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
dataTypeId,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
dataTypeId?: string,
|
||||
}): CancelablePromise<PagedDocumentTreeItemResponseModel> {
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
dataTypeId,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
dataTypeId?: string,
|
||||
}): CancelablePromise<PagedDocumentTreeItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/tree/document/children',
|
||||
@@ -721,14 +769,14 @@ export class DocumentResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getTreeDocumentRoot({
|
||||
skip,
|
||||
take = 100,
|
||||
dataTypeId,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
dataTypeId?: string,
|
||||
}): CancelablePromise<PagedDocumentTreeItemResponseModel> {
|
||||
skip,
|
||||
take = 100,
|
||||
dataTypeId,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
dataTypeId?: string,
|
||||
}): CancelablePromise<PagedDocumentTreeItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/tree/document/root',
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
import type { CreateMediaRequestModel } from '../models/CreateMediaRequestModel';
|
||||
import type { DirectionModel } from '../models/DirectionModel';
|
||||
import type { MediaConfigurationResponseModel } from '../models/MediaConfigurationResponseModel';
|
||||
import type { MediaItemResponseModel } from '../models/MediaItemResponseModel';
|
||||
import type { MediaResponseModel } from '../models/MediaResponseModel';
|
||||
import type { MoveMediaRequestModel } from '../models/MoveMediaRequestModel';
|
||||
import type { PagedMediaCollectionResponseModel } from '../models/PagedMediaCollectionResponseModel';
|
||||
import type { PagedMediaRecycleBinItemResponseModel } from '../models/PagedMediaRecycleBinItemResponseModel';
|
||||
import type { PagedMediaTreeItemResponseModel } from '../models/PagedMediaTreeItemResponseModel';
|
||||
import type { SortingRequestModel } from '../models/SortingRequestModel';
|
||||
@@ -18,15 +20,56 @@ import { request as __request } from '../core/request';
|
||||
|
||||
export class MediaResource {
|
||||
|
||||
/**
|
||||
* @returns PagedMediaCollectionResponseModel Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getCollectionMedia({
|
||||
id,
|
||||
dataTypeId,
|
||||
orderBy = 'updateDate',
|
||||
orderDirection,
|
||||
filter,
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
id?: string,
|
||||
dataTypeId?: string,
|
||||
orderBy?: string,
|
||||
orderDirection?: DirectionModel,
|
||||
filter?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedMediaCollectionResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/collection/media',
|
||||
query: {
|
||||
'id': id,
|
||||
'dataTypeId': dataTypeId,
|
||||
'orderBy': orderBy,
|
||||
'orderDirection': orderDirection,
|
||||
'filter': filter,
|
||||
'skip': skip,
|
||||
'take': take,
|
||||
},
|
||||
errors: {
|
||||
400: `Bad Request`,
|
||||
401: `The resource is protected and requires an authentication token`,
|
||||
404: `Not Found`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getItemMedia({
|
||||
id,
|
||||
}: {
|
||||
id?: Array<string>,
|
||||
}): CancelablePromise<Array<MediaItemResponseModel>> {
|
||||
id,
|
||||
}: {
|
||||
id?: Array<string>,
|
||||
}): CancelablePromise<Array<MediaItemResponseModel>> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/item/media',
|
||||
@@ -44,10 +87,10 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static postMedia({
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateMediaRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateMediaRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
url: '/umbraco/management/api/v1/media',
|
||||
@@ -68,10 +111,10 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getMediaById({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<MediaResponseModel> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<MediaResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/media/{id}',
|
||||
@@ -86,17 +129,41 @@ export class MediaResource {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static deleteMediaById({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'DELETE',
|
||||
url: '/umbraco/management/api/v1/media/{id}',
|
||||
path: {
|
||||
'id': id,
|
||||
},
|
||||
errors: {
|
||||
400: `Bad Request`,
|
||||
401: `The resource is protected and requires an authentication token`,
|
||||
403: `The authenticated user do not have access to this resource`,
|
||||
404: `Not Found`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putMediaById({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateMediaRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateMediaRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/media/{id}',
|
||||
@@ -119,12 +186,12 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putMediaByIdMove({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: MoveMediaRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: MoveMediaRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/media/{id}/move',
|
||||
@@ -146,10 +213,10 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putMediaByIdMoveToRecycleBin({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/media/{id}/move-to-recycle-bin',
|
||||
@@ -170,12 +237,12 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putMediaByIdValidate({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateMediaRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateMediaRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/media/{id}/validate',
|
||||
@@ -212,10 +279,10 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putMediaSort({
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: SortingRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: SortingRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/media/sort',
|
||||
@@ -235,10 +302,10 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static postMediaValidate({
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateMediaRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateMediaRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
url: '/umbraco/management/api/v1/media/validate',
|
||||
@@ -269,19 +336,43 @@ export class MediaResource {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static deleteRecycleBinMediaById({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'DELETE',
|
||||
url: '/umbraco/management/api/v1/recycle-bin/media/{id}',
|
||||
path: {
|
||||
'id': id,
|
||||
},
|
||||
errors: {
|
||||
400: `Bad Request`,
|
||||
401: `The resource is protected and requires an authentication token`,
|
||||
403: `The authenticated user do not have access to this resource`,
|
||||
404: `Not Found`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns PagedMediaRecycleBinItemResponseModel Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getRecycleBinMediaChildren({
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedMediaRecycleBinItemResponseModel> {
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedMediaRecycleBinItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/recycle-bin/media/children',
|
||||
@@ -301,12 +392,12 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getRecycleBinMediaRoot({
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedMediaRecycleBinItemResponseModel> {
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedMediaRecycleBinItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/recycle-bin/media/root',
|
||||
@@ -325,16 +416,16 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getTreeMediaChildren({
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
dataTypeId,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
dataTypeId?: string,
|
||||
}): CancelablePromise<PagedMediaTreeItemResponseModel> {
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
dataTypeId,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
dataTypeId?: string,
|
||||
}): CancelablePromise<PagedMediaTreeItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/tree/media/children',
|
||||
@@ -355,14 +446,14 @@ export class MediaResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getTreeMediaRoot({
|
||||
skip,
|
||||
take = 100,
|
||||
dataTypeId,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
dataTypeId?: string,
|
||||
}): CancelablePromise<PagedMediaTreeItemResponseModel> {
|
||||
skip,
|
||||
take = 100,
|
||||
dataTypeId,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
dataTypeId?: string,
|
||||
}): CancelablePromise<PagedMediaTreeItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/tree/media/root',
|
||||
|
||||
@@ -10,7 +10,6 @@ import type { TemplateQueryExecuteModel } from '../models/TemplateQueryExecuteMo
|
||||
import type { TemplateQueryResultResponseModel } from '../models/TemplateQueryResultResponseModel';
|
||||
import type { TemplateQuerySettingsResponseModel } from '../models/TemplateQuerySettingsResponseModel';
|
||||
import type { TemplateResponseModel } from '../models/TemplateResponseModel';
|
||||
import type { TemplateScaffoldResponseModel } from '../models/TemplateScaffoldResponseModel';
|
||||
import type { UpdateTemplateRequestModel } from '../models/UpdateTemplateRequestModel';
|
||||
|
||||
import type { CancelablePromise } from '../core/CancelablePromise';
|
||||
@@ -24,10 +23,10 @@ export class TemplateResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getItemTemplate({
|
||||
id,
|
||||
}: {
|
||||
id?: Array<string>,
|
||||
}): CancelablePromise<Array<TemplateItemResponseModel>> {
|
||||
id,
|
||||
}: {
|
||||
id?: Array<string>,
|
||||
}): CancelablePromise<Array<TemplateItemResponseModel>> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/item/template',
|
||||
@@ -45,10 +44,10 @@ export class TemplateResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static postTemplate({
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateTemplateRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: CreateTemplateRequestModel,
|
||||
}): CancelablePromise<string> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
url: '/umbraco/management/api/v1/template',
|
||||
@@ -68,10 +67,10 @@ export class TemplateResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getTemplateById({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<TemplateResponseModel> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<TemplateResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/template/{id}',
|
||||
@@ -90,10 +89,10 @@ export class TemplateResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static deleteTemplateById({
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
}: {
|
||||
id: string,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'DELETE',
|
||||
url: '/umbraco/management/api/v1/template/{id}',
|
||||
@@ -113,12 +112,12 @@ export class TemplateResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static putTemplateById({
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateTemplateRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
id,
|
||||
requestBody,
|
||||
}: {
|
||||
id: string,
|
||||
requestBody?: UpdateTemplateRequestModel,
|
||||
}): CancelablePromise<any> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
url: '/umbraco/management/api/v1/template/{id}',
|
||||
@@ -154,10 +153,10 @@ export class TemplateResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static postTemplateQueryExecute({
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: TemplateQueryExecuteModel,
|
||||
}): CancelablePromise<TemplateQueryResultResponseModel> {
|
||||
requestBody,
|
||||
}: {
|
||||
requestBody?: TemplateQueryExecuteModel,
|
||||
}): CancelablePromise<TemplateQueryResultResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
url: '/umbraco/management/api/v1/template/query/execute',
|
||||
@@ -183,41 +182,19 @@ export class TemplateResource {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getTemplateScaffold({
|
||||
masterTemplateId,
|
||||
}: {
|
||||
masterTemplateId?: string,
|
||||
}): CancelablePromise<TemplateScaffoldResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/template/scaffold',
|
||||
query: {
|
||||
'masterTemplateId': masterTemplateId,
|
||||
},
|
||||
errors: {
|
||||
401: `The resource is protected and requires an authentication token`,
|
||||
404: `Not Found`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns PagedNamedEntityTreeItemResponseModel Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getTreeTemplateChildren({
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedNamedEntityTreeItemResponseModel> {
|
||||
parentId,
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
parentId?: string,
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedNamedEntityTreeItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/tree/template/children',
|
||||
@@ -237,12 +214,12 @@ export class TemplateResource {
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getTreeTemplateRoot({
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedNamedEntityTreeItemResponseModel> {
|
||||
skip,
|
||||
take = 100,
|
||||
}: {
|
||||
skip?: number,
|
||||
take?: number,
|
||||
}): CancelablePromise<PagedNamedEntityTreeItemResponseModel> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/umbraco/management/api/v1/tree/template/root',
|
||||
|
||||
@@ -25,7 +25,8 @@ export class UmbContextConsumerController<BaseType = unknown, ResultType extends
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
this.#host.removeController(this);
|
||||
this.#host?.removeController(this);
|
||||
(this.#host as any) = undefined;
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,5 +169,6 @@ export class UmbContextConsumer<BaseType = unknown, ResultType extends BaseType
|
||||
this.#promise = undefined;
|
||||
this.#promiseResolver = undefined;
|
||||
this.#instance = undefined;
|
||||
this.#discriminator = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ export class UmbContextProviderController<
|
||||
public destroy() {
|
||||
if (this.#host) {
|
||||
this.#host.removeController(this);
|
||||
(this.#host as any) = undefined;
|
||||
}
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import type {
|
||||
UmbContextRequestEvent} from '../consume/context-request.event.js';
|
||||
import {
|
||||
UMB_CONTENT_REQUEST_EVENT_TYPE,
|
||||
UMB_DEBUG_CONTEXT_EVENT_TYPE,
|
||||
} from '../consume/context-request.event.js';
|
||||
import type { UmbContextRequestEvent } from '../consume/context-request.event.js';
|
||||
import { UMB_CONTENT_REQUEST_EVENT_TYPE, UMB_DEBUG_CONTEXT_EVENT_TYPE } from '../consume/context-request.event.js';
|
||||
import type { UmbContextToken } from '../token/context-token.js';
|
||||
import {
|
||||
UmbContextProvideEventImplementation,
|
||||
@@ -92,7 +88,7 @@ export class UmbContextProvider<BaseType = unknown, ResultType extends BaseType
|
||||
//window.dispatchEvent(new UmbContextUnprovidedEventImplementation(this._contextAlias, this.#instance));
|
||||
|
||||
// Stop listen to our debug event 'umb:debug-contexts'
|
||||
this.#eventTarget.removeEventListener(UMB_DEBUG_CONTEXT_EVENT_TYPE, this._handleDebugContextRequest);
|
||||
this.#eventTarget?.removeEventListener(UMB_DEBUG_CONTEXT_EVENT_TYPE, this._handleDebugContextRequest);
|
||||
}
|
||||
|
||||
private _handleDebugContextRequest = (event: any) => {
|
||||
@@ -110,8 +106,10 @@ export class UmbContextProvider<BaseType = unknown, ResultType extends BaseType
|
||||
};
|
||||
|
||||
destroy(): void {
|
||||
this.hostDisconnected();
|
||||
// We want to call a destroy method on the instance, if it has one.
|
||||
(this.#instance as any)?.destroy?.();
|
||||
this.#instance = undefined;
|
||||
(this.#eventTarget as any) = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ export declare class UmbControllerHostElement extends HTMLElement implements Umb
|
||||
removeControllerByAlias(alias: UmbControllerAlias): void;
|
||||
removeController(controller: UmbController): void;
|
||||
getHostElement(): Element;
|
||||
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -113,9 +113,18 @@ export const UmbControllerHostMixin = <T extends ClassConstructor>(superClass: T
|
||||
|
||||
destroy() {
|
||||
let ctrl: UmbController | undefined;
|
||||
//let prev = null;
|
||||
// Note: A very important way of doing this loop, as foreach will skip over the next item if the current item is removed.
|
||||
while ((ctrl = this.#controllers[0])) {
|
||||
ctrl.destroy();
|
||||
/*
|
||||
//This code can help debug if there is some controller that does not destroy properly: (When a controller is destroyed it should remove it self)
|
||||
if (ctrl === prev) {
|
||||
console.log('WUPS, we have a controller that does not destroy it self');
|
||||
debugger;
|
||||
}
|
||||
prev = ctrl;
|
||||
*/
|
||||
}
|
||||
this.#controllers.length = 0;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,11 @@ export const UmbElementMixin = <T extends HTMLElementConstructor>(superClass: T)
|
||||
): UmbContextConsumerController<BaseType, ResultType> {
|
||||
return new UmbContextConsumerController(this, alias, callback);
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
super.destroy();
|
||||
(this.localize as any) = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return UmbElementMixinClass as unknown as HTMLElementConstructor<UmbElement> & T;
|
||||
|
||||
@@ -7,11 +7,8 @@ import type {
|
||||
} from '../types/index.js';
|
||||
import { UmbExtensionRegistry } from '../registry/extension.registry.js';
|
||||
import type { UmbExtensionCondition } from '../condition/extension-condition.interface.js';
|
||||
import type {
|
||||
UmbControllerHostElement} from '../../controller-api/controller-host-element.mixin.js';
|
||||
import {
|
||||
UmbControllerHostElementMixin,
|
||||
} from '../../controller-api/controller-host-element.mixin.js';
|
||||
import type { UmbControllerHostElement } from '../../controller-api/controller-host-element.mixin.js';
|
||||
import { UmbControllerHostElementMixin } from '../../controller-api/controller-host-element.mixin.js';
|
||||
import { UmbBaseExtensionInitializer } from './index.js';
|
||||
import { UmbBaseController } from '@umbraco-cms/backoffice/class-api';
|
||||
import { customElement, html } from '@umbraco-cms/backoffice/external/lit';
|
||||
@@ -75,7 +72,7 @@ describe('UmbBaseExtensionController', () => {
|
||||
|
||||
extensionRegistry.register(manifest);
|
||||
});
|
||||
|
||||
/*
|
||||
it('permits when there is no conditions', (done) => {
|
||||
const extensionController = new UmbTestExtensionController(
|
||||
hostElement,
|
||||
@@ -85,7 +82,6 @@ describe('UmbBaseExtensionController', () => {
|
||||
expect(extensionController.permitted).to.be.true;
|
||||
if (extensionController.permitted) {
|
||||
expect(extensionController?.manifest?.alias).to.eq('Umb.Test.Section.1');
|
||||
|
||||
// Also verifying that the promise gets resolved.
|
||||
extensionController.asPromise().then(() => {
|
||||
done();
|
||||
@@ -94,6 +90,7 @@ describe('UmbBaseExtensionController', () => {
|
||||
},
|
||||
);
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
describe('Manifest with empty conditions', () => {
|
||||
@@ -114,7 +111,8 @@ describe('UmbBaseExtensionController', () => {
|
||||
extensionRegistry.register(manifest);
|
||||
});
|
||||
|
||||
it('permits when there is no conditions', (done) => {
|
||||
/*
|
||||
it('permits when there is empty conditions', (done) => {
|
||||
const extensionController = new UmbTestExtensionController(
|
||||
hostElement,
|
||||
extensionRegistry,
|
||||
@@ -132,6 +130,7 @@ describe('UmbBaseExtensionController', () => {
|
||||
},
|
||||
);
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
describe('Manifest with valid conditions', () => {
|
||||
@@ -162,11 +161,13 @@ describe('UmbBaseExtensionController', () => {
|
||||
});
|
||||
|
||||
it('does permit when having a valid condition', async () => {
|
||||
let isDone = false;
|
||||
const extensionController = new UmbTestExtensionController(
|
||||
hostElement,
|
||||
extensionRegistry,
|
||||
'Umb.Test.Section.1',
|
||||
(isPermitted) => {
|
||||
if (isDone) return;
|
||||
// No relevant for this test.
|
||||
expect(isPermitted).to.be.true;
|
||||
},
|
||||
@@ -181,6 +182,7 @@ describe('UmbBaseExtensionController', () => {
|
||||
|
||||
expect(extensionController?.manifest?.alias).to.eq('Umb.Test.Section.1');
|
||||
expect(extensionController?.permitted).to.be.true;
|
||||
isDone = true;
|
||||
});
|
||||
|
||||
it('does not resolve promise when conditions does not exist.', () => {
|
||||
|
||||
@@ -74,7 +74,7 @@ export abstract class UmbBaseExtensionInitializer<
|
||||
protected _init() {
|
||||
this.#manifestObserver = this.observe(
|
||||
this.#extensionRegistry.byAlias<ManifestType>(this.#alias),
|
||||
async (extensionManifest) => {
|
||||
(extensionManifest) => {
|
||||
this.#clearPermittedState();
|
||||
this.#manifest = extensionManifest;
|
||||
if (extensionManifest) {
|
||||
@@ -102,14 +102,15 @@ export abstract class UmbBaseExtensionInitializer<
|
||||
}
|
||||
|
||||
#cleanConditions() {
|
||||
if (this.#conditionControllers.length === 0) return;
|
||||
if (this.#conditionControllers === undefined || this.#conditionControllers.length === 0) return;
|
||||
this.#conditionControllers.forEach((controller) => controller.destroy());
|
||||
this.#conditionControllers = [];
|
||||
this.removeControllerByAlias('_observeConditions');
|
||||
}
|
||||
|
||||
#gotManifest() {
|
||||
const conditionConfigs = this.#manifest?.conditions ?? [];
|
||||
if (!this.#manifest) return;
|
||||
const conditionConfigs = this.#manifest.conditions ?? [];
|
||||
|
||||
// As conditionConfigs might have been configured as something else than an array, then we ignorer them.
|
||||
if (conditionConfigs.length === 0) {
|
||||
@@ -162,7 +163,8 @@ export abstract class UmbBaseExtensionInitializer<
|
||||
};
|
||||
|
||||
#gotCondition = async (conditionManifest: ManifestCondition) => {
|
||||
const conditionConfigs = this.#manifest?.conditions ?? [];
|
||||
if (!this.#manifest) return;
|
||||
const conditionConfigs = this.#manifest.conditions ?? [];
|
||||
//
|
||||
// Get just the conditions that uses this condition alias:
|
||||
const configsOfThisType = conditionConfigs.filter(
|
||||
@@ -237,11 +239,14 @@ export abstract class UmbBaseExtensionInitializer<
|
||||
|
||||
this._isConditionsPositive = isPositive;
|
||||
|
||||
if (isPositive) {
|
||||
if (isPositive === true) {
|
||||
if (this.#isPermitted !== true) {
|
||||
const newPermission = await this._conditionsAreGood();
|
||||
// Only set new permission if we are still positive, otherwise it means that we have been destroyed in the mean time.
|
||||
if (newPermission === false) {
|
||||
if (newPermission === false || this._isConditionsPositive === false) {
|
||||
console.warn(
|
||||
'If this happens then please inform Niels Lyngsø on CMS Team. We are still investigating wether this is a situation we should handle. Ref. No.: 1.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
// We update the oldValue as this point, cause in this way we are sure its the value at this point, when doing async code someone else might have changed the state in the mean time.
|
||||
@@ -250,11 +255,21 @@ export abstract class UmbBaseExtensionInitializer<
|
||||
}
|
||||
} else if (this.#isPermitted !== false) {
|
||||
// Clean up:
|
||||
this.#isPermitted = false;
|
||||
await this._conditionsAreBad();
|
||||
|
||||
// Only continue if we are still negative, otherwise it means that something changed in the mean time.
|
||||
if (this._isConditionsPositive === true) {
|
||||
console.warn(
|
||||
'If this happens then please inform Niels Lyngsø on CMS Team. We are still investigating wether this is a situation we should handle. Ref. No.: 2.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
// We update the oldValue as this point, cause in this way we are sure its the value at this point, when doing async code someone else might have changed the state in the mean time.
|
||||
oldValue = this.#isPermitted ?? false;
|
||||
this.#isPermitted = false;
|
||||
}
|
||||
if (oldValue !== this.#isPermitted && this.#isPermitted !== undefined) {
|
||||
if (this.#isPermitted) {
|
||||
if (this.#isPermitted === true) {
|
||||
this.#promiseResolvers.forEach((x) => x());
|
||||
this.#promiseResolvers = [];
|
||||
}
|
||||
@@ -275,17 +290,17 @@ export abstract class UmbBaseExtensionInitializer<
|
||||
super.hostConnected();
|
||||
//this.#onConditionsChangedCallback();
|
||||
}
|
||||
*/
|
||||
|
||||
public hostDisconnected(): void {
|
||||
super.hostDisconnected();
|
||||
this._runtimePositive = false;
|
||||
this._isConditionsPositive = false;
|
||||
if (this.#isPermitted === true) {
|
||||
this.#isPermitted = false;
|
||||
this._conditionsAreBad();
|
||||
this.#isPermitted = false;
|
||||
this.#onPermissionChanged?.(false, this as any);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#clearPermittedState() {
|
||||
if (this.#isPermitted === true) {
|
||||
@@ -297,6 +312,7 @@ export abstract class UmbBaseExtensionInitializer<
|
||||
|
||||
public destroy(): void {
|
||||
if (!this.#extensionRegistry) return;
|
||||
this.#manifest = undefined;
|
||||
this.#promiseResolvers = [];
|
||||
this.#clearPermittedState(); // This fires the callback as not permitted, if it was permitted before.
|
||||
this.#isPermitted = undefined;
|
||||
@@ -306,6 +322,6 @@ export abstract class UmbBaseExtensionInitializer<
|
||||
this.#onPermissionChanged = undefined;
|
||||
(this.#extensionRegistry as any) = undefined;
|
||||
super.destroy();
|
||||
// Destroy the conditions controllers, are begin destroyed cause they are controllers.
|
||||
// Destroy the conditions controllers, they are begin destroyed cause they are controllers...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ import { expect, fixture } from '@open-wc/testing';
|
||||
import { UmbExtensionRegistry } from '../registry/extension.registry.js';
|
||||
import type { ManifestCondition, ManifestWithDynamicConditions, UmbConditionConfigBase } from '../types/index.js';
|
||||
import type { UmbExtensionCondition } from '../condition/extension-condition.interface.js';
|
||||
import type { PermittedControllerType} from './index.js';
|
||||
import type { PermittedControllerType } from './index.js';
|
||||
import { UmbBaseExtensionInitializer, UmbBaseExtensionsInitializer } from './index.js';
|
||||
import { UmbBaseController } from '@umbraco-cms/backoffice/class-api';
|
||||
import type { UmbControllerHost} from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbControllerHostElementMixin } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { customElement, html } from '@umbraco-cms/backoffice/external/lit';
|
||||
|
||||
@@ -92,11 +92,13 @@ describe('UmbBaseExtensionsController', () => {
|
||||
type: 'extension-type',
|
||||
name: 'test-extension-a',
|
||||
alias: 'Umb.Test.Extension.A',
|
||||
weight: 100,
|
||||
};
|
||||
const manifestB = {
|
||||
type: 'extension-type',
|
||||
name: 'test-extension-b',
|
||||
alias: 'Umb.Test.Extension.B',
|
||||
weight: 10,
|
||||
};
|
||||
testExtensionRegistry.register(manifestA);
|
||||
testExtensionRegistry.register(manifestB);
|
||||
@@ -117,12 +119,9 @@ describe('UmbBaseExtensionsController', () => {
|
||||
(permitted) => {
|
||||
count++;
|
||||
if (count === 1) {
|
||||
// First callback gives just one. We need to make a feature to gather changes to only reply after a computation cycle if we like to avoid this.
|
||||
expect(permitted.length).to.eq(1);
|
||||
} else if (count === 2) {
|
||||
expect(permitted.length).to.eq(2);
|
||||
extensionController.destroy();
|
||||
} else if (count === 3) {
|
||||
} else if (count === 2) {
|
||||
done();
|
||||
}
|
||||
},
|
||||
@@ -134,6 +133,7 @@ describe('UmbBaseExtensionsController', () => {
|
||||
type: 'extension-type-extra',
|
||||
name: 'test-extension-extra',
|
||||
alias: 'Umb.Test.Extension.Extra',
|
||||
weight: 0,
|
||||
};
|
||||
testExtensionRegistry.register(manifestExtra);
|
||||
|
||||
@@ -146,18 +146,13 @@ describe('UmbBaseExtensionsController', () => {
|
||||
(permitted) => {
|
||||
count++;
|
||||
if (count === 1) {
|
||||
// First callback gives just one. We need to make a feature to gather changes to only reply after a computation cycle if we like to avoid this.
|
||||
expect(permitted.length).to.eq(1);
|
||||
} else if (count === 2) {
|
||||
expect(permitted.length).to.eq(2);
|
||||
} else if (count === 3) {
|
||||
expect(permitted.length).to.eq(3);
|
||||
expect(permitted[0].alias).to.eq('Umb.Test.Extension.A');
|
||||
expect(permitted[1].alias).to.eq('Umb.Test.Extension.B');
|
||||
expect(permitted[2].alias).to.eq('Umb.Test.Extension.Extra');
|
||||
|
||||
extensionController.destroy();
|
||||
} else if (count === 4) {
|
||||
} else if (count === 2) {
|
||||
// Cause we destroyed there will be a last call to reset permitted controllers:
|
||||
expect(permitted.length).to.eq(0);
|
||||
done();
|
||||
@@ -202,17 +197,13 @@ describe('UmbBaseExtensionsController', () => {
|
||||
(permitted) => {
|
||||
count++;
|
||||
if (count === 1) {
|
||||
// First callback gives just one. We need to make a feature to gather changes to only reply after a computation cycle if we like to avoid this.
|
||||
expect(permitted.length).to.eq(1);
|
||||
expect(permitted[0].alias).to.eq('Umb.Test.Extension.A');
|
||||
} else if (count === 2) {
|
||||
// Still just equal one, as the second one overwrites the first one.
|
||||
expect(permitted.length).to.eq(1);
|
||||
expect(permitted[0].alias).to.eq('Umb.Test.Extension.B');
|
||||
|
||||
// lets remove the overwriting extension to see the original coming back.
|
||||
testExtensionRegistry.unregister('Umb.Test.Extension.B');
|
||||
} else if (count === 3) {
|
||||
} else if (count === 2) {
|
||||
expect(permitted.length).to.eq(1);
|
||||
expect(permitted[0].alias).to.eq('Umb.Test.Extension.A');
|
||||
done();
|
||||
@@ -272,25 +263,21 @@ describe('UmbBaseExtensionsController', () => {
|
||||
(permitted) => {
|
||||
count++;
|
||||
if (count === 1) {
|
||||
// First callback gives just one. We need to make a feature to gather changes to only reply after a computation cycle if we like to avoid this.
|
||||
expect(permitted.length).to.eq(1);
|
||||
expect(permitted[0].alias).to.eq('Umb.Test.Extension.A');
|
||||
} else if (count === 2) {
|
||||
// Still just equal one, as the second one overwrites the first one.
|
||||
expect(permitted.length).to.eq(1);
|
||||
expect(permitted[0].alias).to.eq('Umb.Test.Extension.B');
|
||||
|
||||
// lets remove the overwriting extension to see the original coming back.
|
||||
testExtensionRegistry.unregister('Umb.Test.Extension.B');
|
||||
} else if (count === 3) {
|
||||
} else if (count === 2) {
|
||||
expect(permitted.length).to.eq(1);
|
||||
expect(permitted[0].alias).to.eq('Umb.Test.Extension.A');
|
||||
extensionController.destroy();
|
||||
} else if (count === 4) {
|
||||
} else if (count === 3) {
|
||||
// Expect that destroy will only result in one last callback with no permitted controllers.
|
||||
expect(permitted.length).to.eq(0);
|
||||
Promise.resolve().then(() => done()); // This wrap is to enable the test to detect if more callbacks are fired.
|
||||
} else if (count === 5) {
|
||||
} else if (count === 4) {
|
||||
// This should not happen, we do only want one last callback when destroyed.
|
||||
expect(false).to.eq(true);
|
||||
}
|
||||
|
||||
@@ -33,11 +33,13 @@ export abstract class UmbBaseExtensionsInitializer<
|
||||
#filter: undefined | null | ((manifest: ManifestType) => boolean);
|
||||
#onChange?: (permittedManifests: Array<MyPermittedControllerType>) => void;
|
||||
protected _extensions: Array<ControllerType> = [];
|
||||
private _permittedExts: Array<MyPermittedControllerType> = [];
|
||||
#permittedExts: Array<MyPermittedControllerType> = [];
|
||||
#exposedPermittedExts: Array<MyPermittedControllerType> = [];
|
||||
#changeDebounce?: number;
|
||||
|
||||
asPromise(): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
this._permittedExts.length > 0 ? resolve() : this.#promiseResolvers.push(resolve);
|
||||
this.#permittedExts.length > 0 ? resolve() : this.#promiseResolvers.push(resolve);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -47,8 +49,9 @@ export abstract class UmbBaseExtensionsInitializer<
|
||||
type: ManifestTypeName | Array<ManifestTypeName>,
|
||||
filter: undefined | null | ((manifest: ManifestType) => boolean),
|
||||
onChange?: (permittedManifests: Array<MyPermittedControllerType>) => void,
|
||||
controllerAlias?: string,
|
||||
) {
|
||||
super(host, 'extensionsInitializer_' + (Array.isArray(type) ? type.join('_') : type));
|
||||
super(host, controllerAlias ?? 'extensionsInitializer_' + (Array.isArray(type) ? type.join('_') : type));
|
||||
this.#extensionRegistry = extensionRegistry;
|
||||
this.#type = type;
|
||||
this.#filter = filter;
|
||||
@@ -72,6 +75,7 @@ export abstract class UmbBaseExtensionsInitializer<
|
||||
});
|
||||
this._extensions.length = 0;
|
||||
// _permittedExts should have been cleared via the destroy callbacks.
|
||||
this.#permittedExts.length = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,45 +107,56 @@ export abstract class UmbBaseExtensionsInitializer<
|
||||
|
||||
protected _extensionChanged = (isPermitted: boolean, controller: ControllerType) => {
|
||||
let hasChanged = false;
|
||||
const existingIndex = this._permittedExts.indexOf(controller as unknown as MyPermittedControllerType);
|
||||
// This might be called after this is destroyed, so we need to check if the _permittedExts is still available:
|
||||
const existingIndex = this.#permittedExts?.indexOf(controller as unknown as MyPermittedControllerType);
|
||||
if (isPermitted) {
|
||||
if (existingIndex === -1) {
|
||||
this._permittedExts.push(controller as unknown as MyPermittedControllerType);
|
||||
this.#permittedExts.push(controller as unknown as MyPermittedControllerType);
|
||||
hasChanged = true;
|
||||
}
|
||||
} else {
|
||||
if (existingIndex !== -1) {
|
||||
this._permittedExts.splice(existingIndex, 1);
|
||||
if (existingIndex >= 0) {
|
||||
this.#permittedExts.splice(existingIndex, 1);
|
||||
hasChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasChanged) {
|
||||
// The final list of permitted extensions to be displayed, this will be stripped from extensions that are overwritten by another extension and sorted accordingly.
|
||||
const exposedPermittedExts = [...this._permittedExts];
|
||||
|
||||
// Removal of overwritten extensions:
|
||||
this._permittedExts.forEach((extCtrl) => {
|
||||
// Check if it overwrites another extension:
|
||||
// if so, look up the extension it overwrites, and remove it from the list. and check that for if it overwrites another extension and so on.
|
||||
if (extCtrl.overwrites.length > 0) {
|
||||
extCtrl.overwrites.forEach((overwrite) => {
|
||||
this.#removeOverwrittenExtensions(exposedPermittedExts, overwrite);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Sorting:
|
||||
exposedPermittedExts.sort((a, b) => b.weight - a.weight);
|
||||
|
||||
if (exposedPermittedExts.length > 0) {
|
||||
this.#promiseResolvers.forEach((x) => x());
|
||||
this.#promiseResolvers = [];
|
||||
if (!this.#changeDebounce) {
|
||||
this.#changeDebounce = requestAnimationFrame(this.#notifyChange);
|
||||
}
|
||||
this.#onChange?.(exposedPermittedExts);
|
||||
}
|
||||
};
|
||||
|
||||
#notifyChange = () => {
|
||||
this.#changeDebounce = undefined;
|
||||
|
||||
// The final list of permitted extensions to be displayed, this will be stripped from extensions that are overwritten by another extension and sorted accordingly.
|
||||
this.#exposedPermittedExts = [...this.#permittedExts];
|
||||
|
||||
// Removal of overwritten extensions:
|
||||
this.#permittedExts.forEach((extCtrl) => {
|
||||
// Check if it overwrites another extension:
|
||||
// if so, look up the extension it overwrites, and remove it from the list. and check that for if it overwrites another extension and so on.
|
||||
if (extCtrl.overwrites.length > 0) {
|
||||
extCtrl.overwrites.forEach((overwrite) => {
|
||||
this.#removeOverwrittenExtensions(this.#exposedPermittedExts, overwrite);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Sorting:
|
||||
this.#exposedPermittedExts.sort((a, b) => b.weight - a.weight);
|
||||
|
||||
if (this.#exposedPermittedExts.length > 0) {
|
||||
this.#promiseResolvers.forEach((x) => x());
|
||||
this.#promiseResolvers = [];
|
||||
}
|
||||
|
||||
// Collect change calls.
|
||||
this.#onChange?.(this.#exposedPermittedExts);
|
||||
};
|
||||
|
||||
#removeOverwrittenExtensions(list: Array<MyPermittedControllerType>, alias: string) {
|
||||
const index = list.findIndex((a) => a.alias === alias);
|
||||
if (index !== -1) {
|
||||
@@ -157,16 +172,30 @@ export abstract class UmbBaseExtensionsInitializer<
|
||||
}
|
||||
}
|
||||
|
||||
hostDisconnected(): void {
|
||||
super.hostDisconnected();
|
||||
if (this.#changeDebounce) {
|
||||
this.#notifyChange();
|
||||
}
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
// The this.#extensionRegistry is an indication of wether this is already destroyed.
|
||||
if (!this.#extensionRegistry) return;
|
||||
|
||||
const oldPermittedExtsLength = this._permittedExts.length;
|
||||
this._extensions.length = 0;
|
||||
this._permittedExts.length = 0;
|
||||
if (oldPermittedExtsLength > 0) {
|
||||
this.#onChange?.(this._permittedExts);
|
||||
const oldPermittedExtsLength = this.#exposedPermittedExts.length;
|
||||
(this._extensions as any) = undefined;
|
||||
(this.#permittedExts as any) = undefined;
|
||||
this.#exposedPermittedExts.length = 0;
|
||||
if (this.#changeDebounce) {
|
||||
cancelAnimationFrame(this.#changeDebounce);
|
||||
this.#changeDebounce = undefined;
|
||||
}
|
||||
if (oldPermittedExtsLength > 0) {
|
||||
this.#onChange?.(this.#exposedPermittedExts);
|
||||
}
|
||||
this.#promiseResolvers.length = 0;
|
||||
this.#filter = undefined;
|
||||
this.#onChange = undefined;
|
||||
(this.#extensionRegistry as any) = undefined;
|
||||
super.destroy();
|
||||
|
||||
@@ -115,4 +115,9 @@ export class UmbExtensionApiInitializer<
|
||||
this.#api = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
this.#constructorArguments = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,4 +105,9 @@ export class UmbExtensionElementInitializer<
|
||||
this.#component = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
this.#properties = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +59,9 @@ export class UmbExtensionsApiInitializer<
|
||||
constructorArguments: Array<unknown> | undefined,
|
||||
filter?: undefined | null | ((manifest: ManifestTypeAsApi) => boolean),
|
||||
onChange?: (permittedManifests: Array<MyPermittedControllerType>) => void,
|
||||
controllerAlias?: string,
|
||||
) {
|
||||
super(host, extensionRegistry, type, filter, onChange);
|
||||
super(host, extensionRegistry, type, filter, onChange, controllerAlias);
|
||||
this.#extensionRegistry = extensionRegistry;
|
||||
this.#constructorArgs = constructorArguments;
|
||||
this._init();
|
||||
@@ -77,4 +78,10 @@ export class UmbExtensionsApiInitializer<
|
||||
|
||||
return extController;
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
this.#constructorArgs = undefined;
|
||||
(this.#extensionRegistry as any) = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,10 @@ export class UmbExtensionsElementInitializer<
|
||||
type: ManifestTypeName | Array<ManifestTypeName>,
|
||||
filter: undefined | null | ((manifest: ManifestType) => boolean),
|
||||
onChange: (permittedManifests: Array<MyPermittedControllerType>) => void,
|
||||
controllerAlias?: string,
|
||||
defaultElement?: string,
|
||||
) {
|
||||
super(host, extensionRegistry, type, filter, onChange);
|
||||
super(host, extensionRegistry, type, filter, onChange, controllerAlias);
|
||||
this.#extensionRegistry = extensionRegistry;
|
||||
this.#defaultElement = defaultElement;
|
||||
this._init();
|
||||
@@ -65,4 +66,10 @@ export class UmbExtensionsElementInitializer<
|
||||
|
||||
return extController;
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
this.#props = undefined;
|
||||
(this.#extensionRegistry as any) = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,9 @@ export class UmbExtensionsManifestInitializer<
|
||||
type: ManifestTypeName | Array<ManifestTypeName>,
|
||||
filter: null | ((manifest: ManifestType) => boolean),
|
||||
onChange: (permittedManifests: Array<MyPermittedControllerType>) => void,
|
||||
controllerAlias?: string,
|
||||
) {
|
||||
super(host, extensionRegistry, type, filter, onChange);
|
||||
super(host, extensionRegistry, type, filter, onChange, controllerAlias);
|
||||
this.#extensionRegistry = extensionRegistry;
|
||||
this._init();
|
||||
}
|
||||
@@ -45,4 +46,9 @@ export class UmbExtensionsManifestInitializer<
|
||||
this._extensionChanged,
|
||||
) as ControllerType;
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
(this.#extensionRegistry as any) = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export class UmbLocalizationController<LocalizationSetType extends UmbLocalizati
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
this.#host.removeController(this);
|
||||
this.#host?.removeController(this);
|
||||
this.#hostEl = undefined as any;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ export class UmbObserverController<T = unknown> extends UmbObserver<T> implement
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
this.#host?.removeController(this);
|
||||
(this.#host as any) = undefined;
|
||||
super.destroy();
|
||||
this.#host.removeController(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,9 @@ export class UmbObserver<T> {
|
||||
}
|
||||
|
||||
hostDisconnected() {
|
||||
// No cause then it cant re-connect, if the same element just was moved in DOM.
|
||||
//this.#subscription.unsubscribe();
|
||||
// No cause then it cant re-connect, if the same element just was moved in DOM. [NL]
|
||||
// I do not agree with my self anymore ^^. I think we should unsubscribe here, to help garbage collector and prevent unforeseen side effects of observations continuing while element are out of the DOM. [NL]
|
||||
this.#subscription?.unsubscribe();
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
|
||||
@@ -244,4 +244,10 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
|
||||
this.setValue(partialUpdateFrozenArray(this.getValue(), entry, (x) => unique === this.getUniqueMethod!(x)));
|
||||
return this;
|
||||
}
|
||||
|
||||
destroy() {
|
||||
super.destroy();
|
||||
this.#sortMethod = undefined;
|
||||
(this.getUniqueMethod as any) = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,8 @@ export class UmbBasicState<T> {
|
||||
* @description - Destroys this state and completes all observations made to it.
|
||||
*/
|
||||
public destroy(): void {
|
||||
this._subject.complete();
|
||||
this._subject?.complete();
|
||||
(this._subject as any) = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +68,7 @@ export class UmbBasicState<T> {
|
||||
* // myState.value is equal 'Goodnight'.
|
||||
*/
|
||||
setValue(data: T): void {
|
||||
if (data !== this._subject.getValue()) {
|
||||
if (this._subject && data !== this._subject.getValue()) {
|
||||
this._subject.next(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ export class UmbClassState<T extends UmbClassStateData | undefined> extends UmbB
|
||||
* @description - Set the data of this state, if data is different than current this will trigger observations to update.
|
||||
*/
|
||||
setValue(data: T): void {
|
||||
if (!this._subject) return;
|
||||
const oldValue = this._subject.getValue();
|
||||
|
||||
if (data && oldValue?.equal(data)) return;
|
||||
|
||||
@@ -30,6 +30,7 @@ export class UmbDeepState<T> extends UmbBasicState<T> {
|
||||
* @description - Set the data of this state, if data is different than current this will trigger observations to update.
|
||||
*/
|
||||
setValue(data: T): void {
|
||||
if (!this._subject) return;
|
||||
const frozenData = deepFreeze(data);
|
||||
// Only update data if its different than current data.
|
||||
if (!naiveObjectComparison(frozenData, this._subject.getValue())) {
|
||||
|
||||
@@ -705,7 +705,40 @@ export const data: Array<UmbMockDataTypeModel> = [
|
||||
editorUiAlias: 'Umb.PropertyEditorUi.CollectionView',
|
||||
hasChildren: false,
|
||||
isFolder: false,
|
||||
values: [],
|
||||
values: [
|
||||
{ alias: 'pageSize', value: 2 },
|
||||
{ alias: 'orderDirection', value: 'desc' },
|
||||
{
|
||||
alias: 'includeProperties',
|
||||
value: [
|
||||
{ alias: 'sortOrder', header: 'Sort order', isSystem: true, nameTemplate: '' },
|
||||
{ alias: 'updateDate', header: 'Last edited', isSystem: true },
|
||||
{ alias: 'owner', header: 'Created by', isSystem: true },
|
||||
],
|
||||
},
|
||||
{ alias: 'orderBy', value: 'updateDate' },
|
||||
{
|
||||
alias: 'bulkActionPermissions',
|
||||
value: {
|
||||
allowBulkPublish: true,
|
||||
allowBulkUnpublish: false,
|
||||
allowBulkCopy: true,
|
||||
allowBulkMove: false,
|
||||
allowBulkDelete: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
alias: 'layouts',
|
||||
value: [
|
||||
{ icon: 'icon-grid', isSystem: true, name: 'Grid', path: '', selected: true },
|
||||
{ icon: 'icon-list', isSystem: true, name: 'Table', path: '', selected: true },
|
||||
],
|
||||
},
|
||||
{ alias: 'icon', value: 'icon-layers' },
|
||||
{ alias: 'tabName', value: 'Children' },
|
||||
{ alias: 'showContentFirst', value: true },
|
||||
{ alias: 'useInfiniteEditor', value: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Icon Picker',
|
||||
|
||||
@@ -685,7 +685,7 @@ export const data: Array<UmbMockDocumentTypeModel> = [
|
||||
alias: 'blogPost',
|
||||
name: 'All property editors document type',
|
||||
description: null,
|
||||
icon: 'umb:item-arrangement',
|
||||
icon: 'icon-eco',
|
||||
allowedAsRoot: true,
|
||||
variesByCulture: true,
|
||||
variesBySegment: false,
|
||||
@@ -714,6 +714,26 @@ export const data: Array<UmbMockDocumentTypeModel> = [
|
||||
labelOnTop: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: '7',
|
||||
container: { id: 'all-properties-group-key' },
|
||||
alias: 'listView',
|
||||
name: 'List View',
|
||||
description: '',
|
||||
dataType: { id: 'dt-collectionView' },
|
||||
variesByCulture: false,
|
||||
variesBySegment: false,
|
||||
sortOrder: 1,
|
||||
validation: {
|
||||
mandatory: false,
|
||||
mandatoryMessage: null,
|
||||
regEx: null,
|
||||
regExMessage: null,
|
||||
},
|
||||
appearance: {
|
||||
labelOnTop: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
containers: [
|
||||
{
|
||||
@@ -724,7 +744,10 @@ export const data: Array<UmbMockDocumentTypeModel> = [
|
||||
sortOrder: 0,
|
||||
},
|
||||
],
|
||||
allowedDocumentTypes: [{ documentType: { id: 'simple-document-type-id' }, sortOrder: 0 }],
|
||||
allowedDocumentTypes: [
|
||||
{ documentType: { id: 'simple-document-type-id' }, sortOrder: 0 },
|
||||
{ documentType: { id: '29643452-cff9-47f2-98cd-7de4b6807681' }, sortOrder: 1 },
|
||||
],
|
||||
compositions: [],
|
||||
cleanup: {
|
||||
preventCleanup: false,
|
||||
|
||||
@@ -695,7 +695,7 @@ export const data: Array<UmbMockDocumentModel> = [
|
||||
documentType: {
|
||||
id: 'simple-document-type-id',
|
||||
icon: 'icon-document',
|
||||
hasListView: false,
|
||||
hasListView: true,
|
||||
},
|
||||
hasChildren: false,
|
||||
noAccess: false,
|
||||
@@ -719,6 +719,12 @@ export const data: Array<UmbMockDocumentModel> = [
|
||||
segment: null,
|
||||
value: null,
|
||||
},
|
||||
{
|
||||
alias: 'listView',
|
||||
culture: null,
|
||||
segment: null,
|
||||
value: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -119,6 +119,7 @@ export class UmbBlockTypeWorkspaceContext<BlockTypeData extends UmbBlockTypeWith
|
||||
|
||||
public destroy(): void {
|
||||
this.#data.destroy();
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,6 @@ export default UmbCollectionActionButtonElement;
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-collection-action': UmbCollectionActionButtonElement;
|
||||
'umb-collection-action-button': UmbCollectionActionButtonElement;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { UmbCollectionBulkActionPermissions } from './types.js';
|
||||
import { UMB_DEFAULT_COLLECTION_CONTEXT } from './default/collection-default.context.js';
|
||||
import { UmbBaseController } from '@umbraco-cms/backoffice/class-api';
|
||||
import type {
|
||||
ManifestCondition,
|
||||
UmbConditionConfigBase,
|
||||
UmbConditionControllerArguments,
|
||||
UmbExtensionCondition,
|
||||
} from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
export class UmbCollectionBulkActionPermissionCondition extends UmbBaseController implements UmbExtensionCondition {
|
||||
config: CollectionBulkActionPermissionConditionConfig;
|
||||
permitted = false;
|
||||
#onChange: () => void;
|
||||
|
||||
constructor(args: UmbConditionControllerArguments<CollectionBulkActionPermissionConditionConfig>) {
|
||||
super(args.host);
|
||||
this.config = args.config;
|
||||
this.#onChange = args.onChange;
|
||||
|
||||
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (context) => {
|
||||
const allowedActions = context.getConfig().allowedEntityBulkActions;
|
||||
this.permitted = allowedActions ? this.config.match(allowedActions) : false;
|
||||
this.#onChange();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export type CollectionBulkActionPermissionConditionConfig = UmbConditionConfigBase<
|
||||
typeof UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION
|
||||
> & {
|
||||
match: (permissions: UmbCollectionBulkActionPermissions) => boolean;
|
||||
};
|
||||
|
||||
export const UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION = 'Umb.Condition.CollectionBulkActionPermission';
|
||||
|
||||
export const manifest: ManifestCondition = {
|
||||
type: 'condition',
|
||||
name: 'Collection Bulk Action Permission Condition',
|
||||
alias: UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION,
|
||||
api: UmbCollectionBulkActionPermissionCondition,
|
||||
};
|
||||
@@ -1,31 +1,43 @@
|
||||
import type { UmbCollectionContext } from './types.js';
|
||||
import { customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import type { ManifestCollection } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type { UmbCollectionConfiguration, UmbCollectionContext } from './types.js';
|
||||
import { customElement, property, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { createExtensionApi, createExtensionElement } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type { ManifestCollection } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
@customElement('umb-collection')
|
||||
export class UmbCollectionElement extends UmbLitElement {
|
||||
_alias?: string;
|
||||
#alias?: string;
|
||||
@property({ type: String, reflect: true })
|
||||
get alias() {
|
||||
return this._alias;
|
||||
}
|
||||
set alias(newVal) {
|
||||
this._alias = newVal;
|
||||
this.#alias = newVal;
|
||||
this.#observeManifest();
|
||||
}
|
||||
get alias() {
|
||||
return this.#alias;
|
||||
}
|
||||
|
||||
#config?: UmbCollectionConfiguration = { pageSize: 50 };
|
||||
@property({ type: Object, attribute: false })
|
||||
set config(newVal: UmbCollectionConfiguration | undefined) {
|
||||
this.#config = newVal;
|
||||
this.#setConfig();
|
||||
}
|
||||
get config() {
|
||||
return this.#config;
|
||||
}
|
||||
|
||||
@state()
|
||||
_element: HTMLElement | undefined;
|
||||
|
||||
#manifest?: ManifestCollection;
|
||||
|
||||
#api?: UmbCollectionContext;
|
||||
|
||||
#observeManifest() {
|
||||
if (!this._alias) return;
|
||||
if (!this.#alias) return;
|
||||
this.observe(
|
||||
umbExtensionsRegistry.byTypeAndAlias('collection', this._alias),
|
||||
umbExtensionsRegistry.byTypeAndAlias('collection', this.#alias),
|
||||
async (manifest) => {
|
||||
if (!manifest) return;
|
||||
this.#manifest = manifest;
|
||||
@@ -38,9 +50,10 @@ export class UmbCollectionElement extends UmbLitElement {
|
||||
|
||||
async #createApi() {
|
||||
if (!this.#manifest) throw new Error('No manifest');
|
||||
const api = (await createExtensionApi(this.#manifest, [this])) as unknown as UmbCollectionContext;
|
||||
if (!api) throw new Error('No api');
|
||||
api.setManifest(this.#manifest);
|
||||
this.#api = (await createExtensionApi(this.#manifest, [this])) as unknown as UmbCollectionContext;
|
||||
if (!this.#api) throw new Error('No api');
|
||||
this.#api.setManifest(this.#manifest);
|
||||
this.#setConfig();
|
||||
}
|
||||
|
||||
async #createElement() {
|
||||
@@ -49,8 +62,13 @@ export class UmbCollectionElement extends UmbLitElement {
|
||||
this.requestUpdate();
|
||||
}
|
||||
|
||||
#setConfig() {
|
||||
if (!this.#config || !this.#api) return;
|
||||
this.#api.setConfig(this.#config);
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`${this._element}`;
|
||||
return this._element;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ export class UmbCollectionToolbarElement extends UmbLitElement {
|
||||
:host {
|
||||
display: flex;
|
||||
gap: var(--uui-size-space-5);
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
`,
|
||||
|
||||
@@ -68,7 +68,7 @@ export class UmbCollectionViewBundleElement extends UmbLitElement {
|
||||
<uui-button compact popovertarget="collection-view-bundle-popover" label="status">
|
||||
${this.#renderItemDisplay(this._currentView)}
|
||||
</uui-button>
|
||||
<uui-popover-container id="collection-view-bundle-popover" placement="bottom">
|
||||
<uui-popover-container id="collection-view-bundle-popover" placement="bottom-end">
|
||||
<umb-popover-layout>
|
||||
<div class="filter-dropdown">${this._views.map((view) => this.#renderItem(view))}</div>
|
||||
</umb-popover-layout>
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { UmbCollectionConfiguration, UmbCollectionContext } from '../types.
|
||||
import { UmbCollectionViewManager } from '../collection-view.manager.js';
|
||||
import type { UmbCollectionRepository } from '@umbraco-cms/backoffice/repository';
|
||||
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
import { UmbArrayState, UmbNumberState, UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
|
||||
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
@@ -44,14 +44,13 @@ export class UmbDefaultCollectionContext<
|
||||
public readonly selection = new UmbSelectionManager(this);
|
||||
public readonly view;
|
||||
|
||||
constructor(host: UmbControllerHostElement, config: UmbCollectionConfiguration = { pageSize: 50 }) {
|
||||
constructor(host: UmbControllerHost, defaultViewAlias: string) {
|
||||
super(host, UMB_DEFAULT_COLLECTION_CONTEXT);
|
||||
|
||||
// listen for page changes on the pagination manager
|
||||
this.pagination.addEventListener(UmbChangeEvent.TYPE, this.#onPageChange);
|
||||
|
||||
this.view = new UmbCollectionViewManager(this, { defaultViewAlias: config.defaultViewAlias });
|
||||
this.#configure(config);
|
||||
this.view = new UmbCollectionViewManager(this, { defaultViewAlias: defaultViewAlias });
|
||||
}
|
||||
|
||||
// TODO: find a generic way to do this
|
||||
@@ -62,6 +61,22 @@ export class UmbDefaultCollectionContext<
|
||||
}
|
||||
}
|
||||
|
||||
#config: UmbCollectionConfiguration = { pageSize: 50 };
|
||||
|
||||
/**
|
||||
* Sets the configuration for the collection.
|
||||
* @param {UmbCollectionConfiguration} config
|
||||
* @memberof UmbCollectionContext
|
||||
*/
|
||||
public setConfig(config: UmbCollectionConfiguration) {
|
||||
this.#config = config;
|
||||
this.#configure();
|
||||
}
|
||||
|
||||
public getConfig() {
|
||||
return this.#config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the manifest for the collection.
|
||||
* @param {ManifestCollection} manifest
|
||||
@@ -113,10 +128,10 @@ export class UmbDefaultCollectionContext<
|
||||
this.requestCollection();
|
||||
}
|
||||
|
||||
#configure(configuration: UmbCollectionConfiguration) {
|
||||
#configure() {
|
||||
this.selection.setMultiple(true);
|
||||
this.pagination.setPageSize(configuration.pageSize!);
|
||||
this.#filter.setValue({ ...this.#filter.getValue(), skip: 0, take: configuration.pageSize });
|
||||
this.pagination.setPageSize(this.#config.pageSize!);
|
||||
this.#filter.setValue({ ...this.#filter.getValue(), skip: 0, take: this.#config.pageSize });
|
||||
}
|
||||
|
||||
#onPageChange = (event: UmbChangeEvent) => {
|
||||
|
||||
@@ -10,4 +10,6 @@ export * from './default/collection-default.context.js';
|
||||
export * from './collection-filter-model.interface.js';
|
||||
|
||||
export { UMB_COLLECTION_ALIAS_CONDITION } from './collection-alias.condition.js';
|
||||
export { UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION } from './collection-bulk-action-permission.condition.js';
|
||||
|
||||
export { UmbCollectionActionElement, UmbCollectionActionBase } from './action/index.js';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { manifest as collectionAliasCondition } from './collection-alias.condition.js';
|
||||
import { manifest as collectionBulkActionPermissionCondition } from './collection-bulk-action-permission.condition.js';
|
||||
|
||||
export const manifests = [collectionAliasCondition];
|
||||
export const manifests = [collectionAliasCondition, collectionBulkActionPermissionCondition];
|
||||
|
||||
@@ -2,12 +2,26 @@ import type { ManifestCollection } from '@umbraco-cms/backoffice/extension-regis
|
||||
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
import type { UmbPaginationManager } from '@umbraco-cms/backoffice/utils';
|
||||
|
||||
export interface UmbCollectionBulkActionPermissions {
|
||||
allowBulkCopy: boolean;
|
||||
allowBulkDelete: boolean;
|
||||
allowBulkMove: boolean;
|
||||
allowBulkPublish: boolean;
|
||||
allowBulkUnpublish: boolean;
|
||||
}
|
||||
|
||||
export interface UmbCollectionConfiguration {
|
||||
allowedEntityBulkActions?: UmbCollectionBulkActionPermissions;
|
||||
includeProperties?: Array<any>;
|
||||
orderBy?: string;
|
||||
orderDirection?: string;
|
||||
pageSize?: number;
|
||||
defaultViewAlias?: string;
|
||||
useInfiniteEditor?: boolean;
|
||||
}
|
||||
|
||||
export interface UmbCollectionContext {
|
||||
setConfig(config: UmbCollectionConfiguration): void;
|
||||
getConfig(): UmbCollectionConfiguration | undefined;
|
||||
setManifest(manifest: ManifestCollection): void;
|
||||
getManifest(): ManifestCollection | undefined;
|
||||
requestCollection(): Promise<void>;
|
||||
|
||||
@@ -115,6 +115,7 @@ export class UmbExtensionSlotElement extends UmbLitElement {
|
||||
(extensionControllers) => {
|
||||
this._permittedExts = extensionControllers;
|
||||
},
|
||||
'extensionsInitializer',
|
||||
this.defaultElement,
|
||||
);
|
||||
this.#extensionsController.properties = this.#props;
|
||||
|
||||
@@ -70,7 +70,7 @@ describe('UmbExtensionSlotElement', () => {
|
||||
it('renders a manifest element', async () => {
|
||||
element = await fixture(html`<umb-extension-slot type="dashboard"></umb-extension-slot>`);
|
||||
|
||||
await sleep(0);
|
||||
await sleep(20);
|
||||
|
||||
expect(element.shadowRoot!.firstElementChild).to.be.instanceOf(UmbTestExtensionSlotManifestElement);
|
||||
});
|
||||
@@ -82,7 +82,7 @@ describe('UmbExtensionSlotElement', () => {
|
||||
.filter=${(x: ManifestDashboard) => x.alias === 'unit-test-ext-slot-element-manifest'}></umb-extension-slot>`,
|
||||
);
|
||||
|
||||
await sleep(0);
|
||||
await sleep(20);
|
||||
|
||||
expect(element.shadowRoot!.firstElementChild).to.be.instanceOf(UmbTestExtensionSlotManifestElement);
|
||||
});
|
||||
@@ -96,7 +96,7 @@ describe('UmbExtensionSlotElement', () => {
|
||||
</umb-extension-slot>`,
|
||||
);
|
||||
|
||||
await sleep(0);
|
||||
await sleep(20);
|
||||
|
||||
expect(element.shadowRoot!.firstElementChild?.nodeName).to.be.equal('BLA');
|
||||
expect(element.shadowRoot!.firstElementChild?.firstElementChild).to.be.instanceOf(
|
||||
@@ -113,7 +113,7 @@ describe('UmbExtensionSlotElement', () => {
|
||||
</umb-extension-slot>`,
|
||||
);
|
||||
|
||||
await sleep(0);
|
||||
await sleep(20);
|
||||
|
||||
expect((element.shadowRoot!.firstElementChild as any).testProp).to.be.equal('fooBar');
|
||||
expect(element.shadowRoot!.firstElementChild).to.be.instanceOf(UmbTestExtensionSlotManifestElement);
|
||||
|
||||
@@ -504,5 +504,6 @@ export class UmbContentTypePropertyStructureManager<T extends UmbContentTypeMode
|
||||
this._reset();
|
||||
this.#contentTypes.destroy();
|
||||
this.#containers.destroy();
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,5 +291,6 @@ export class UmbDataTypeWorkspaceContext
|
||||
|
||||
public destroy(): void {
|
||||
this.#data.destroy();
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { CollectionAliasConditionConfig } from '../../collection/collection-alias.condition.js';
|
||||
import type { CollectionBulkActionPermissionConditionConfig } from '../../collection/collection-bulk-action-permission.condition.js';
|
||||
import type { SectionAliasConditionConfig } from './section-alias.condition.js';
|
||||
import type { SwitchConditionConfig } from './switch.condition.js';
|
||||
import type { UserPermissionConditionConfig } from '@umbraco-cms/backoffice/user-permission';
|
||||
@@ -15,6 +16,7 @@ Niels: Sadly I don't see any other solutions currently. But are very open for id
|
||||
*/
|
||||
export type ConditionTypes =
|
||||
| CollectionAliasConditionConfig
|
||||
| CollectionBulkActionPermissionConditionConfig
|
||||
| SectionAliasConditionConfig
|
||||
| WorkspaceAliasConditionConfig
|
||||
| BlockWorkspaceHasSettingsConditionConfig
|
||||
|
||||
@@ -32,4 +32,44 @@ export interface UmbracoPackage {
|
||||
* @required
|
||||
*/
|
||||
extensions: ManifestTypes[];
|
||||
|
||||
/**
|
||||
* @title The importmap for the package
|
||||
* @description This is used to define the imports and the scopes for the package to be used in the browser. It will be combined with the global importmap.
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap
|
||||
*/
|
||||
importmap?: UmbracoPackageImportmap;
|
||||
}
|
||||
|
||||
export interface UmbracoPackageImportmap {
|
||||
/**
|
||||
* @title A module specifier with a path for the importmap
|
||||
* @description This is used to define the module specifiers and their respective paths for the package to be used in the browser.
|
||||
* @examples [{
|
||||
* "library": "./path/to/library.js",
|
||||
* "library/*": "./path/to/library/*"
|
||||
* }]
|
||||
* @required
|
||||
* @minProperties 1
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap#imports
|
||||
*/
|
||||
imports: UmbracoPackageImportmapValue;
|
||||
|
||||
/**
|
||||
* @title The importmap scopes for the package
|
||||
* @description This is used to define the scopes for the package to be used in the browser. It has to specify a path and a value that is an object with module specifiers and their respective paths.
|
||||
* @examples [{
|
||||
* "/path/to/library": { "library": "./path/to/some/other/library.js" }
|
||||
* }]
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap#scopes
|
||||
*/
|
||||
scopes?: UmbracoPackageImportmapScopes;
|
||||
}
|
||||
|
||||
export interface UmbracoPackageImportmapScopes {
|
||||
[key: string]: UmbracoPackageImportmapValue;
|
||||
}
|
||||
|
||||
export interface UmbracoPackageImportmapValue {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import type { UmbModalContext } from './modal.context.js';
|
||||
import { UMB_MODAL_CONTEXT } from './modal.context.js';
|
||||
import type { ManifestModal } from '@umbraco-cms/backoffice/extension-registry';
|
||||
@@ -5,7 +6,6 @@ import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registr
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import type { CSSResultGroup } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { html, customElement } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { BehaviorSubject } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
import type { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
|
||||
import {
|
||||
@@ -29,7 +29,7 @@ export class UmbModalElement extends UmbLitElement {
|
||||
this.#modalContext = value;
|
||||
|
||||
if (!value) {
|
||||
this.#destroy();
|
||||
this.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,15 +166,16 @@ export class UmbModalElement extends UmbLitElement {
|
||||
return html`${this.element}`;
|
||||
}
|
||||
|
||||
#destroy() {
|
||||
disconnectedCallback(): void {
|
||||
super.disconnectedCallback();
|
||||
this.destroy();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.#innerElement.complete();
|
||||
this.#modalExtensionObserver?.destroy();
|
||||
this.#modalExtensionObserver = undefined;
|
||||
}
|
||||
|
||||
disconnectedCallback(): void {
|
||||
super.disconnectedCallback();
|
||||
this.#destroy();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
static styles: CSSResultGroup = [UmbTextStyles];
|
||||
|
||||
@@ -35,6 +35,7 @@ export class UmbPropertyActionMenuElement extends UmbLitElement {
|
||||
(ctrls) => {
|
||||
this._actions = ctrls;
|
||||
},
|
||||
'extensionsInitializer',
|
||||
);
|
||||
}
|
||||
@state()
|
||||
|
||||
@@ -14,27 +14,27 @@ export const manifest: ManifestPropertyEditorSchema = {
|
||||
description: 'Number of items per page.',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Number',
|
||||
},
|
||||
{
|
||||
alias: 'orderDirection',
|
||||
label: 'Order Direction',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.OrderDirection',
|
||||
},
|
||||
{
|
||||
alias: 'includeProperties',
|
||||
label: 'Columns Displayed',
|
||||
description: 'The properties that will be displayed for each column',
|
||||
description: 'The properties that will be displayed for each column.',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.CollectionView.ColumnConfiguration',
|
||||
},
|
||||
{
|
||||
alias: 'orderBy',
|
||||
label: 'Order By',
|
||||
description: 'The properties that will be displayed for each column',
|
||||
description: 'The default sort order for the list.',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.CollectionView.OrderBy',
|
||||
},
|
||||
{
|
||||
alias: 'orderDirection',
|
||||
label: 'Order Direction',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.OrderDirection',
|
||||
},
|
||||
{
|
||||
alias: 'bulkActionPermissions',
|
||||
label: 'Bulk Action Permissions',
|
||||
description: 'The properties that will be displayed for each column',
|
||||
description: 'The bulk actions that are allowed from the list view.',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.CollectionView.BulkActionPermissions',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { UmbCollectionBulkActionPermissions } from '../../../../../../core/collection/types.js';
|
||||
import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { html, customElement, property, css } from '@umbraco-cms/backoffice/external/lit';
|
||||
import type { UUIBooleanInputEvent } from '@umbraco-cms/backoffice/external/uui';
|
||||
@@ -13,14 +14,6 @@ type BulkActionPermissionType =
|
||||
| 'allowBulkPublish'
|
||||
| 'allowBulkUnpublish';
|
||||
|
||||
interface BulkActionPermissions {
|
||||
allowBulkCopy: boolean;
|
||||
allowBulkDelete: boolean;
|
||||
allowBulkMove: boolean;
|
||||
allowBulkPublish: boolean;
|
||||
allowBulkUnpublish: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @element umb-property-editor-ui-collection-view-bulk-action-permissions
|
||||
*/
|
||||
@@ -29,7 +22,7 @@ export class UmbPropertyEditorUICollectionViewBulkActionPermissionsElement
|
||||
extends UmbLitElement
|
||||
implements UmbPropertyEditorUiElement
|
||||
{
|
||||
private _value: BulkActionPermissions = {
|
||||
private _value: UmbCollectionBulkActionPermissions = {
|
||||
allowBulkPublish: false,
|
||||
allowBulkUnpublish: false,
|
||||
allowBulkCopy: false,
|
||||
@@ -38,7 +31,7 @@ export class UmbPropertyEditorUICollectionViewBulkActionPermissionsElement
|
||||
};
|
||||
|
||||
@property({ type: Object })
|
||||
public set value(obj: BulkActionPermissions) {
|
||||
public set value(obj: UmbCollectionBulkActionPermissions) {
|
||||
if (!obj) return;
|
||||
this._value = obj;
|
||||
}
|
||||
|
||||
@@ -19,31 +19,31 @@ const manifest: ManifestPropertyEditorUi = {
|
||||
{
|
||||
alias: 'layouts',
|
||||
label: 'Layouts',
|
||||
description: 'The properties that will be displayed for each column',
|
||||
description: 'The properties that will be displayed for each column.',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.CollectionView.LayoutConfiguration',
|
||||
},
|
||||
{
|
||||
alias: 'icon',
|
||||
label: 'Content app icon',
|
||||
description: 'The icon of the listview content app',
|
||||
description: 'The icon of the listview content app.',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.IconPicker',
|
||||
},
|
||||
{
|
||||
alias: 'tabName',
|
||||
label: 'Content app name',
|
||||
description: 'The name of the listview content app (default if empty: Child Items)',
|
||||
description: 'The name of the listview content app (default if empty: Child Items).',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
|
||||
},
|
||||
{
|
||||
alias: 'showContentFirst',
|
||||
label: 'Show Content App First',
|
||||
description: 'Enable this to show the content app by default instead of the list view app',
|
||||
description: 'Enable this to show the content app by default instead of the list view app.',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Toggle',
|
||||
},
|
||||
{
|
||||
alias: 'useInfiniteEditor',
|
||||
label: 'Edit in Infinite Editor',
|
||||
description: 'Enable this to use infinite editing to edit the content of the list view',
|
||||
description: 'Enable this to use infinite editing to edit the content of the list view.',
|
||||
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Toggle',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type {
|
||||
UmbCollectionBulkActionPermissions,
|
||||
UmbCollectionConfiguration,
|
||||
} from '../../../../core/collection/types.js';
|
||||
import type { UmbPropertyEditorConfigCollection } from '../../config/index.js';
|
||||
import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
|
||||
/**
|
||||
@@ -10,16 +13,31 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
@customElement('umb-property-editor-ui-collection-view')
|
||||
export class UmbPropertyEditorUICollectionViewElement extends UmbLitElement implements UmbPropertyEditorUiElement {
|
||||
@property()
|
||||
value = '';
|
||||
value?: string;
|
||||
|
||||
@property({ type: Object, attribute: false })
|
||||
public config?: UmbPropertyEditorConfigCollection;
|
||||
@state()
|
||||
private _config?: UmbCollectionConfiguration;
|
||||
|
||||
render() {
|
||||
return html`<div>umb-property-editor-ui-collection-view</div>`;
|
||||
@property({ attribute: false })
|
||||
public set config(config: UmbPropertyEditorConfigCollection | undefined) {
|
||||
this._config = this.#mapDataTypeConfigToCollectionConfig(config);
|
||||
}
|
||||
|
||||
static styles = [UmbTextStyles];
|
||||
#mapDataTypeConfigToCollectionConfig(
|
||||
config: UmbPropertyEditorConfigCollection | undefined,
|
||||
): UmbCollectionConfiguration {
|
||||
return {
|
||||
allowedEntityBulkActions: config?.getValueByAlias<UmbCollectionBulkActionPermissions>('bulkActionPermissions'),
|
||||
orderBy: config?.getValueByAlias('orderBy') ?? 'updateDate',
|
||||
orderDirection: config?.getValueByAlias('orderDirection') ?? 'asc',
|
||||
pageSize: Number(config?.getValueByAlias('pageSize')) ?? 50,
|
||||
useInfiniteEditor: config?.getValueByAlias('useInfiniteEditor') ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`<umb-collection alias="Umb.Collection.Document" .config=${this._config}></umb-collection>`;
|
||||
}
|
||||
}
|
||||
|
||||
export default UmbPropertyEditorUICollectionViewElement;
|
||||
|
||||
@@ -47,7 +47,8 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
new UmbExtensionsManifestInitializer(this, umbExtensionsRegistry, ['workspaceView'], null, (workspaceViews) => {
|
||||
|
||||
new UmbExtensionsManifestInitializer(this, umbExtensionsRegistry, 'workspaceView', null, (workspaceViews) => {
|
||||
this._workspaceViews = workspaceViews.map((view) => view.manifest);
|
||||
this._createRoutes();
|
||||
});
|
||||
|
||||
@@ -97,6 +97,7 @@ export class UmbDictionaryWorkspaceContext
|
||||
|
||||
public destroy(): void {
|
||||
this.#data.destroy();
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
import { html, customElement, property, state, map } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbDocumentTypeStructureRepository } from '@umbraco-cms/backoffice/document-type';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/document';
|
||||
import type { ManifestCollectionAction } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type { UmbAllowedDocumentTypeModel } from '@umbraco-cms/backoffice/document-type';
|
||||
|
||||
@customElement('umb-create-document-collection-action')
|
||||
export class UmbCreateDocumentCollectionActionElement extends UmbLitElement {
|
||||
@state()
|
||||
private _allowedDocumentTypes: Array<UmbAllowedDocumentTypeModel> = [];
|
||||
|
||||
@state()
|
||||
private _documentUnique?: string;
|
||||
|
||||
@state()
|
||||
private _documentTypeUnique?: string;
|
||||
|
||||
@state()
|
||||
private _popoverOpen = false;
|
||||
|
||||
@property({ attribute: false })
|
||||
manifest?: ManifestCollectionAction;
|
||||
|
||||
#documentTypeStructureRepository = new UmbDocumentTypeStructureRepository(this);
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (workspaceContext) => {
|
||||
this.observe(workspaceContext.unique, (unique) => {
|
||||
this._documentUnique = unique;
|
||||
});
|
||||
this.observe(workspaceContext.contentTypeUnique, (documentTypeUnique) => {
|
||||
this._documentTypeUnique = documentTypeUnique;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async firstUpdated() {
|
||||
if (this._documentTypeUnique) {
|
||||
this.#retrieveAllowedDocumentTypesOf(this._documentTypeUnique);
|
||||
}
|
||||
}
|
||||
|
||||
async #retrieveAllowedDocumentTypesOf(unique: string | null) {
|
||||
const { data } = await this.#documentTypeStructureRepository.requestAllowedChildrenOf(unique);
|
||||
|
||||
if (data && data.items) {
|
||||
this._allowedDocumentTypes = data.items;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: This ignorer is just neede for JSON SCHEMA TO WORK, As its not updated with latest TS jet.
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
#onPopoverToggle(event: ToggleEvent) {
|
||||
this._popoverOpen = event.newState === 'open';
|
||||
}
|
||||
|
||||
#onClick(item: UmbAllowedDocumentTypeModel, e: Event) {
|
||||
e.preventDefault();
|
||||
// TODO: Do anything else here? [LK]
|
||||
}
|
||||
|
||||
#getCreateUrl(item: UmbAllowedDocumentTypeModel) {
|
||||
// TODO: Review how the "Create" URL is generated. [LK]
|
||||
return `section/content/workspace/document/create/${this._documentUnique ?? 'null'}/${item.unique}`;
|
||||
}
|
||||
|
||||
render() {
|
||||
return this._allowedDocumentTypes.length !== 1 ? this.#renderDropdown() : this.#renderCreateButton();
|
||||
}
|
||||
|
||||
#renderCreateButton() {
|
||||
if (this._allowedDocumentTypes.length !== 1) return;
|
||||
|
||||
const item = this._allowedDocumentTypes[0];
|
||||
const label = (this.manifest?.meta.label ?? this.localize.term('general_create')) + ' ' + item.name;
|
||||
|
||||
return html`<uui-button
|
||||
@click=${(e: Event) => this.#onClick(item, e)}
|
||||
color="default"
|
||||
href=${this.#getCreateUrl(item)}
|
||||
label=${label}
|
||||
look="outline"></uui-button>`;
|
||||
}
|
||||
|
||||
#renderDropdown() {
|
||||
if (!this._allowedDocumentTypes.length) return;
|
||||
|
||||
const label = this.manifest?.meta.label ?? this.localize.term('general_create');
|
||||
|
||||
return html`
|
||||
<uui-button popovertarget="collection-action-menu-popover" label=${label}>
|
||||
${label}
|
||||
<uui-symbol-expand .open=${this._popoverOpen}></uui-symbol-expand>
|
||||
</uui-button>
|
||||
<uui-popover-container
|
||||
id="collection-action-menu-popover"
|
||||
placement="bottom-start"
|
||||
@toggle=${this.#onPopoverToggle}>
|
||||
<umb-popover-layout>
|
||||
<uui-scroll-container>
|
||||
${map(
|
||||
this._allowedDocumentTypes,
|
||||
(item) => html`
|
||||
<uui-menu-item
|
||||
@click=${(e: Event) => this.#onClick(item, e)}
|
||||
label=${item.name}
|
||||
href=${this.#getCreateUrl(item)}>
|
||||
<uui-icon slot="icon" name=${item.icon ?? 'icon-document'}></uui-icon>
|
||||
</uui-menu-item>
|
||||
`,
|
||||
)}
|
||||
</uui-scroll-container>
|
||||
</umb-popover-layout>
|
||||
</uui-popover-container>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
export default UmbCreateDocumentCollectionActionElement;
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-create-document-collection-action': UmbCreateDocumentCollectionActionElement;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { UMB_COLLECTION_ALIAS_CONDITION } from '@umbraco-cms/backoffice/collection';
|
||||
import type { ManifestCollectionAction } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const createManifest: ManifestCollectionAction = {
|
||||
type: 'collectionAction',
|
||||
kind: 'button',
|
||||
name: 'Create Document Collection Action',
|
||||
alias: 'Umb.CollectionAction.Document.Create',
|
||||
element: () => import('./create-document-collection-action.element.js'),
|
||||
weight: 100,
|
||||
meta: {
|
||||
label: 'Create',
|
||||
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
alias: UMB_COLLECTION_ALIAS_CONDITION,
|
||||
match: 'Umb.Collection.Document',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const manifests = [createManifest];
|
||||
@@ -0,0 +1,67 @@
|
||||
import type { UmbDocumentCollectionContext } from './document-collection.context.js';
|
||||
import { css, html, customElement } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection';
|
||||
|
||||
@customElement('umb-document-collection-toolbar')
|
||||
export class UmbDocumentCollectionToolbarElement extends UmbLitElement {
|
||||
#collectionContext?: UmbDocumentCollectionContext;
|
||||
|
||||
#inputTimer?: NodeJS.Timeout;
|
||||
#inputTimerAmount = 500;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (instance) => {
|
||||
this.#collectionContext = instance as UmbDocumentCollectionContext;
|
||||
});
|
||||
}
|
||||
|
||||
#updateSearch(event: InputEvent) {
|
||||
const target = event.target as HTMLInputElement;
|
||||
const filter = target.value || '';
|
||||
clearTimeout(this.#inputTimer);
|
||||
this.#inputTimer = setTimeout(() => this.#collectionContext?.setFilter({ filter }), this.#inputTimerAmount);
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-collection-action-bundle></umb-collection-action-bundle>
|
||||
${this.#renderSearch()}
|
||||
<umb-collection-view-bundle></umb-collection-view-bundle>
|
||||
`;
|
||||
}
|
||||
|
||||
#renderSearch() {
|
||||
return html`
|
||||
<uui-input @input=${this.#updateSearch} label="Search" placeholder="Search..." id="input-search"></uui-input>
|
||||
`;
|
||||
}
|
||||
|
||||
static styles = [
|
||||
css`
|
||||
:host {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
white-space: nowrap;
|
||||
gap: var(--uui-size-space-5);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#input-search {
|
||||
width: 100%;
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
||||
export default UmbDocumentCollectionToolbarElement;
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-document-collection-toolbar': UmbDocumentCollectionToolbarElement;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { UmbDocumentDetailModel } from '../types.js';
|
||||
import type { UmbDocumentCollectionFilterModel } from './types.js';
|
||||
import { UMB_DOCUMENT_TABLE_COLLECTION_VIEW_ALIAS } from './views/index.js';
|
||||
import { UmbDefaultCollectionContext } from '@umbraco-cms/backoffice/collection';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export class UmbDocumentCollectionContext extends UmbDefaultCollectionContext<
|
||||
UmbDocumentDetailModel,
|
||||
UmbDocumentCollectionFilterModel
|
||||
> {
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host, UMB_DOCUMENT_TABLE_COLLECTION_VIEW_ALIAS);
|
||||
|
||||
this.selection.setSelectable(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { html, customElement } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbCollectionDefaultElement } from '@umbraco-cms/backoffice/collection';
|
||||
|
||||
import './document-collection-toolbar.element.js';
|
||||
|
||||
@customElement('umb-document-collection')
|
||||
export class UmbDocumentCollectionElement extends UmbCollectionDefaultElement {
|
||||
protected renderToolbar() {
|
||||
return html`<umb-document-collection-toolbar slot="header"></umb-document-collection-toolbar>`;
|
||||
}
|
||||
}
|
||||
|
||||
export default UmbDocumentCollectionElement;
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-document-collection': UmbDocumentCollectionElement;
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
export { UMB_DOCUMENT_COLLECTION_ALIAS } from './manifests.js';
|
||||
export const UMB_DOCUMENT_COLLECTION_ALIAS = 'Umb.Collection.Document';
|
||||
|
||||
@@ -1,32 +1,25 @@
|
||||
import { UMB_COLLECTION_ALIAS_CONDITION } from '@umbraco-cms/backoffice/collection';
|
||||
import { UMB_DOCUMENT_COLLECTION_REPOSITORY_ALIAS } from './repository/index.js';
|
||||
import { manifests as collectionActionManifests } from './action/manifests.js';
|
||||
import { manifests as collectionRepositoryManifests } from './repository/manifests.js';
|
||||
import { manifests as collectionViewManifests } from './views/manifests.js';
|
||||
import { UmbDocumentCollectionContext } from './document-collection.context.js';
|
||||
import { UMB_DOCUMENT_COLLECTION_ALIAS } from './index.js';
|
||||
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const UMB_DOCUMENT_COLLECTION_ALIAS = 'document';
|
||||
const collectionManifest: ManifestTypes = {
|
||||
type: 'collection',
|
||||
alias: UMB_DOCUMENT_COLLECTION_ALIAS,
|
||||
name: 'Document Collection',
|
||||
api: UmbDocumentCollectionContext,
|
||||
element: () => import('./document-collection.element.js'),
|
||||
meta: {
|
||||
repositoryAlias: UMB_DOCUMENT_COLLECTION_REPOSITORY_ALIAS,
|
||||
},
|
||||
};
|
||||
|
||||
export const manifests: Array<ManifestTypes> = [
|
||||
// TODO: temp registration, missing collection repository
|
||||
{
|
||||
type: 'collection',
|
||||
kind: 'default',
|
||||
alias: 'Umb.Collection.Document',
|
||||
name: 'Document Collection',
|
||||
},
|
||||
{
|
||||
type: 'collectionView',
|
||||
alias: 'Umb.CollectionView.Document.Table',
|
||||
name: 'Document Table Collection View',
|
||||
js: () => import('./views/table/document-table-collection-view.element.js'),
|
||||
weight: 200,
|
||||
meta: {
|
||||
label: 'Table',
|
||||
icon: 'icon-box',
|
||||
pathName: 'table',
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
alias: UMB_COLLECTION_ALIAS_CONDITION,
|
||||
match: UMB_DOCUMENT_COLLECTION_ALIAS,
|
||||
},
|
||||
],
|
||||
},
|
||||
export const manifests = [
|
||||
collectionManifest,
|
||||
...collectionActionManifests,
|
||||
...collectionRepositoryManifests,
|
||||
...collectionViewManifests,
|
||||
];
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { UmbDocumentCollectionFilterModel } from '../types.js';
|
||||
import { UmbDocumentCollectionServerDataSource } from './document-collection.server.data-source.js';
|
||||
import type { UmbCollectionRepository } from '@umbraco-cms/backoffice/repository';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export class UmbDocumentCollectionRepository implements UmbCollectionRepository {
|
||||
#collectionSource: UmbDocumentCollectionServerDataSource;
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
this.#collectionSource = new UmbDocumentCollectionServerDataSource(host);
|
||||
}
|
||||
|
||||
async requestCollection(filter: UmbDocumentCollectionFilterModel) {
|
||||
return this.#collectionSource.getCollection(filter);
|
||||
}
|
||||
|
||||
destroy(): void {}
|
||||
}
|
||||
|
||||
export default UmbDocumentCollectionRepository;
|
||||
@@ -0,0 +1,61 @@
|
||||
import { UMB_DOCUMENT_ENTITY_TYPE } from '../../entity.js';
|
||||
import type { UmbDocumentCollectionFilterModel } from '../types.js';
|
||||
import type { UmbDocumentTreeItemModel } from '../../tree/types.js';
|
||||
import { DocumentResource } from '@umbraco-cms/backoffice/external/backend-api';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
import type { DocumentTreeItemResponseModel } from '@umbraco-cms/backoffice/external/backend-api';
|
||||
import type { UmbCollectionDataSource } from '@umbraco-cms/backoffice/repository';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export class UmbDocumentCollectionServerDataSource implements UmbCollectionDataSource<UmbDocumentTreeItemModel> {
|
||||
#host: UmbControllerHost;
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
this.#host = host;
|
||||
}
|
||||
|
||||
async getCollection(filter: UmbDocumentCollectionFilterModel) {
|
||||
// TODO: [LK] Replace the Management API call with the correct endpoint once it is available.
|
||||
const { data, error } = await tryExecuteAndNotify(this.#host, DocumentResource.getTreeDocumentRoot(filter));
|
||||
|
||||
if (data) {
|
||||
const skip = Number(filter.skip) ?? 0;
|
||||
const take = Number(filter.take) ?? 100;
|
||||
|
||||
const items = data.items.slice(skip, skip + take).map((item) => this.#mapper(item));
|
||||
|
||||
//console.log('UmbDocumentCollectionServerDataSource.getCollection', [data, items]);
|
||||
|
||||
return { data: { items, total: data.total } };
|
||||
}
|
||||
|
||||
return { error };
|
||||
}
|
||||
|
||||
// TODO: [LK] Temp solution. Copied from "src\packages\documents\documents\tree\document-tree.server.data-source.ts"
|
||||
#mapper = (item: DocumentTreeItemResponseModel): UmbDocumentTreeItemModel => {
|
||||
return {
|
||||
unique: item.id,
|
||||
parentUnique: item.parent ? item.parent.id : null,
|
||||
entityType: UMB_DOCUMENT_ENTITY_TYPE,
|
||||
noAccess: item.noAccess,
|
||||
isTrashed: item.isTrashed,
|
||||
hasChildren: item.hasChildren,
|
||||
isProtected: item.isProtected,
|
||||
documentType: {
|
||||
unique: item.documentType.id,
|
||||
icon: item.documentType.icon,
|
||||
hasCollection: item.documentType.hasListView,
|
||||
},
|
||||
variants: item.variants.map((variant) => {
|
||||
return {
|
||||
name: variant.name,
|
||||
culture: variant.culture || null,
|
||||
state: variant.state,
|
||||
};
|
||||
}),
|
||||
name: item.variants[0]?.name, // TODO: this is not correct. We need to get it from the variants. This is a temp solution.
|
||||
isFolder: false,
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export { UmbDocumentCollectionRepository } from './document-collection.repository.js';
|
||||
|
||||
export const UMB_DOCUMENT_COLLECTION_REPOSITORY_ALIAS = 'Umb.Repository.DocumentCollection';
|
||||
@@ -0,0 +1,12 @@
|
||||
import { UmbDocumentCollectionRepository } from './document-collection.repository.js';
|
||||
import { UMB_DOCUMENT_COLLECTION_REPOSITORY_ALIAS } from './index.js';
|
||||
import type { ManifestRepository } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
const collectionRepositoryManifest: ManifestRepository = {
|
||||
type: 'repository',
|
||||
alias: UMB_DOCUMENT_COLLECTION_REPOSITORY_ALIAS,
|
||||
name: 'Document Collection Repository',
|
||||
api: UmbDocumentCollectionRepository,
|
||||
};
|
||||
|
||||
export const manifests = [collectionRepositoryManifest];
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface UmbDocumentCollectionFilterModel {
|
||||
skip?: number;
|
||||
take?: number;
|
||||
filter?: string;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import type { UmbDocumentCollectionFilterModel } from '../../types.js';
|
||||
import type { UmbDocumentTreeItemModel } from '../../../tree/types.js';
|
||||
import { css, html, nothing, customElement, state, repeat } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection';
|
||||
import type { UmbDefaultCollectionContext } from '@umbraco-cms/backoffice/collection';
|
||||
|
||||
@customElement('umb-document-grid-collection-view')
|
||||
export class UmbDocumentGridCollectionViewElement extends UmbLitElement {
|
||||
@state()
|
||||
private _items: Array<UmbDocumentTreeItemModel> = [];
|
||||
|
||||
@state()
|
||||
private _selection: Array<string | null> = [];
|
||||
|
||||
@state()
|
||||
private _loading = false;
|
||||
|
||||
#collectionContext?: UmbDefaultCollectionContext<UmbDocumentTreeItemModel, UmbDocumentCollectionFilterModel>;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.consumeContext(UMB_DEFAULT_COLLECTION_CONTEXT, (instance) => {
|
||||
this.#collectionContext = instance;
|
||||
this.observe(
|
||||
this.#collectionContext.selection.selection,
|
||||
(selection) => (this._selection = selection),
|
||||
'umbCollectionSelectionObserver',
|
||||
);
|
||||
this.observe(this.#collectionContext.items, (items) => (this._items = items), 'umbCollectionItemsObserver');
|
||||
});
|
||||
}
|
||||
|
||||
//TODO How should we handle url stuff?
|
||||
private _handleOpenCard(id: string) {
|
||||
//TODO this will not be needed when cards works as links with href
|
||||
history.pushState(null, '', 'section/content/workspace/document/edit/' + id);
|
||||
}
|
||||
|
||||
#onSelect(item: UmbDocumentTreeItemModel) {
|
||||
this.#collectionContext?.selection.select(item.unique ?? '');
|
||||
}
|
||||
|
||||
#onDeselect(item: UmbDocumentTreeItemModel) {
|
||||
this.#collectionContext?.selection.deselect(item.unique ?? '');
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this._loading) nothing;
|
||||
return html`
|
||||
<div id="document-grid">
|
||||
${repeat(
|
||||
this._items,
|
||||
(item) => item.unique,
|
||||
(item) => this.#renderCard(item),
|
||||
)}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
#renderCard(item: UmbDocumentTreeItemModel) {
|
||||
return html`
|
||||
<uui-card-content-node
|
||||
.name=${item.name ?? 'Unnamed Document'}
|
||||
selectable
|
||||
?select-only=${this._selection.length > 0}
|
||||
?selected=${this.#collectionContext?.selection.isSelected(item.unique ?? '')}
|
||||
@open=${() => this._handleOpenCard(item.unique ?? '')}
|
||||
@selected=${() => this.#onSelect(item)}
|
||||
@deselected=${() => this.#onDeselect(item)}>
|
||||
<uui-icon slot="icon" name=${item.documentType.icon}></uui-icon>
|
||||
</uui-card-content-node>
|
||||
`;
|
||||
}
|
||||
|
||||
static styles = [
|
||||
UmbTextStyles,
|
||||
css`
|
||||
:host {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#document-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||
gap: var(--uui-size-space-4);
|
||||
}
|
||||
|
||||
uui-card-content-node {
|
||||
width: 100%;
|
||||
height: 180px;
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
||||
export default UmbDocumentGridCollectionViewElement;
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-document-grid-collection-view': UmbDocumentGridCollectionViewElement;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { UMB_DOCUMENT_GRID_COLLECTION_VIEW_ALIAS, UMB_DOCUMENT_TABLE_COLLECTION_VIEW_ALIAS } from './manifests.js';
|
||||
@@ -0,0 +1,45 @@
|
||||
import { UMB_COLLECTION_ALIAS_CONDITION } from '@umbraco-cms/backoffice/collection';
|
||||
import type { ManifestCollectionView } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const UMB_DOCUMENT_TABLE_COLLECTION_VIEW_ALIAS = 'Umb.CollectionView.Document.Table';
|
||||
export const UMB_DOCUMENT_GRID_COLLECTION_VIEW_ALIAS = 'Umb.CollectionView.Document.Grid';
|
||||
|
||||
const gridViewManifest: ManifestCollectionView = {
|
||||
type: 'collectionView',
|
||||
alias: UMB_DOCUMENT_GRID_COLLECTION_VIEW_ALIAS,
|
||||
name: 'Document Grid Collection View',
|
||||
element: () => import('./grid/document-grid-collection-view.element.js'),
|
||||
weight: 200,
|
||||
meta: {
|
||||
label: 'Grid',
|
||||
icon: 'icon-grid',
|
||||
pathName: 'grid',
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
alias: UMB_COLLECTION_ALIAS_CONDITION,
|
||||
match: 'Umb.Collection.Document',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableViewManifest: ManifestCollectionView = {
|
||||
type: 'collectionView',
|
||||
alias: UMB_DOCUMENT_TABLE_COLLECTION_VIEW_ALIAS,
|
||||
name: 'Document Table Collection View',
|
||||
element: () => import('./table/document-table-collection-view.element.js'),
|
||||
weight: 201,
|
||||
meta: {
|
||||
label: 'Table',
|
||||
icon: 'icon-list',
|
||||
pathName: 'table',
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
alias: UMB_COLLECTION_ALIAS_CONDITION,
|
||||
match: 'Umb.Collection.Document',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const manifests = [gridViewManifest, tableViewManifest];
|
||||
@@ -1,7 +1,9 @@
|
||||
import type { UmbDocumentCollectionFilterModel } from '../../types.js';
|
||||
import type { UmbDocumentTreeItemModel } from '../../../tree/types.js';
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection';
|
||||
import type {
|
||||
UmbTableColumn,
|
||||
UmbTableConfig,
|
||||
@@ -12,10 +14,8 @@ import type {
|
||||
UmbTableSelectedEvent,
|
||||
} from '@umbraco-cms/backoffice/components';
|
||||
import type { UmbDefaultCollectionContext } from '@umbraco-cms/backoffice/collection';
|
||||
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
|
||||
import './column-layouts/document-table-actions-column-layout.element.js';
|
||||
//import './column-layouts/document-table-actions-column-layout.element.js';
|
||||
|
||||
@customElement('umb-document-table-collection-view')
|
||||
export class UmbDocumentTableCollectionViewElement extends UmbLitElement {
|
||||
@@ -35,21 +35,21 @@ export class UmbDocumentTableCollectionViewElement extends UmbLitElement {
|
||||
allowSorting: true,
|
||||
},
|
||||
// TODO: actions should live in an UmbTable element when we have moved the current UmbTable to UUI.
|
||||
{
|
||||
name: 'Actions',
|
||||
alias: 'entityActions',
|
||||
elementName: 'umb-document-table-actions-column-layout',
|
||||
width: '80px',
|
||||
},
|
||||
// {
|
||||
// name: 'Actions',
|
||||
// alias: 'entityActions',
|
||||
// elementName: 'umb-document-table-actions-column-layout',
|
||||
// width: '80px',
|
||||
// },
|
||||
];
|
||||
|
||||
@state()
|
||||
private _tableItems: Array<UmbTableItem> = [];
|
||||
|
||||
@state()
|
||||
private _selection: Array<string | null> = [];
|
||||
private _selection: Array<string> = [];
|
||||
|
||||
private _collectionContext?: UmbDefaultCollectionContext<UmbDocumentTreeItemModel, any>;
|
||||
private _collectionContext?: UmbDefaultCollectionContext<UmbDocumentTreeItemModel, UmbDocumentCollectionFilterModel>;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -68,7 +68,7 @@ export class UmbDocumentTableCollectionViewElement extends UmbLitElement {
|
||||
});
|
||||
|
||||
this.observe(this._collectionContext.selection.selection, (selection) => {
|
||||
this._selection = selection;
|
||||
this._selection = selection as string[];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -77,17 +77,18 @@ export class UmbDocumentTableCollectionViewElement extends UmbLitElement {
|
||||
if (!item.unique) throw new Error('Item id is missing.');
|
||||
return {
|
||||
id: item.unique,
|
||||
icon: item.documentType.icon,
|
||||
data: [
|
||||
{
|
||||
columnAlias: 'entityName',
|
||||
value: item.name || 'Untitled',
|
||||
},
|
||||
{
|
||||
columnAlias: 'entityActions',
|
||||
value: {
|
||||
entityType: item.entityType,
|
||||
},
|
||||
value: item.name || 'Unnamed Document',
|
||||
},
|
||||
// {
|
||||
// columnAlias: 'entityActions',
|
||||
// value: {
|
||||
// entityType: item.entityType,
|
||||
// },
|
||||
// },
|
||||
],
|
||||
};
|
||||
});
|
||||
@@ -133,9 +134,9 @@ export class UmbDocumentTableCollectionViewElement extends UmbLitElement {
|
||||
:host {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
padding: var(--uui-size-space-3) var(--uui-size-space-6);
|
||||
padding: var(--uui-size-space-3) 0;
|
||||
}
|
||||
|
||||
/* TODO: Should we have embedded padding in the table component? */
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '../workspace/document-workspace.context-token.js';
|
||||
import { UmbBaseController } from '@umbraco-cms/backoffice/class-api';
|
||||
import type {
|
||||
ManifestCondition,
|
||||
UmbConditionConfigBase,
|
||||
UmbConditionControllerArguments,
|
||||
UmbExtensionCondition,
|
||||
} from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
export class UmbDocumentWorkspaceHasCollectionCondition extends UmbBaseController implements UmbExtensionCondition {
|
||||
config: DocumentWorkspaceHasCollectionConditionConfig;
|
||||
permitted = false;
|
||||
#onChange: () => void;
|
||||
|
||||
constructor(args: UmbConditionControllerArguments<DocumentWorkspaceHasCollectionConditionConfig>) {
|
||||
super(args.host);
|
||||
this.config = args.config;
|
||||
this.#onChange = args.onChange;
|
||||
|
||||
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (context) => {
|
||||
this.observe(context.contentTypeHasCollection, (hasCollection) => {
|
||||
this.permitted = hasCollection === true;
|
||||
this.#onChange();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export type DocumentWorkspaceHasCollectionConditionConfig = UmbConditionConfigBase<
|
||||
typeof UMB_DOCUMENT_WORKSPACE_HAS_COLLECTION_CONDITION
|
||||
>;
|
||||
|
||||
export const UMB_DOCUMENT_WORKSPACE_HAS_COLLECTION_CONDITION = 'Umb.Condition.DocumentWorkspaceHasCollection';
|
||||
|
||||
export const manifest: ManifestCondition = {
|
||||
type: 'condition',
|
||||
name: 'Document Workspace Has Collection Condition',
|
||||
alias: UMB_DOCUMENT_WORKSPACE_HAS_COLLECTION_CONDITION,
|
||||
api: UmbDocumentWorkspaceHasCollectionCondition,
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export { UMB_DOCUMENT_WORKSPACE_HAS_COLLECTION_CONDITION } from './document-workspace-has-collection.condition.js';
|
||||
@@ -0,0 +1,3 @@
|
||||
import { manifest as docummentWorkspaceHasCollectionCondition } from './document-workspace-has-collection.condition.js';
|
||||
|
||||
export const manifests = [docummentWorkspaceHasCollectionCondition];
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { UmbDocumentDetailRepository } from '../../repository/index.js';
|
||||
import { UmbEntityBulkActionBase } from '@umbraco-cms/backoffice/entity-bulk-action';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export class UmbDocumentDeleteEntityBulkAction extends UmbEntityBulkActionBase<UmbDocumentDetailRepository> {
|
||||
constructor(host: UmbControllerHostElement, repositoryAlias: string, selection: Array<string>) {
|
||||
super(host, repositoryAlias, selection);
|
||||
}
|
||||
|
||||
async execute() {
|
||||
console.log(`execute delete for: ${this.selection}`);
|
||||
//await this.repository?.delete();
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,66 @@
|
||||
import type { UmbCollectionBulkActionPermissions } from '../../../core/collection/types.js';
|
||||
import { UMB_DOCUMENT_DETAIL_REPOSITORY_ALIAS } from '../repository/index.js';
|
||||
import { UMB_DOCUMENT_ENTITY_TYPE } from '../entity.js';
|
||||
import { UMB_DOCUMENT_COLLECTION_ALIAS } from '../collection/index.js';
|
||||
import { UmbDocumentMoveEntityBulkAction } from './move/move.action.js';
|
||||
import { UmbDocumentCopyEntityBulkAction } from './copy/copy.action.js';
|
||||
import { UmbDocumentDeleteEntityBulkAction } from './delete/delete.action.js';
|
||||
import { UmbDocumentMoveEntityBulkAction } from './move/move.action.js';
|
||||
import { UmbDocumentPublishEntityBulkAction } from './publish/publish.action.js';
|
||||
import { UmbDocumentUnpublishEntityBulkAction } from './unpublish/unpublish.action.js';
|
||||
import type { ManifestEntityBulkAction } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { UMB_COLLECTION_ALIAS_CONDITION } from '@umbraco-cms/backoffice/collection';
|
||||
import {
|
||||
UMB_COLLECTION_ALIAS_CONDITION,
|
||||
UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION,
|
||||
} from '@umbraco-cms/backoffice/collection';
|
||||
|
||||
const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
// TODO: [LK] Wondering how these actions could be wired up to the `bulkActionPermissions` config?
|
||||
export const manifests: Array<ManifestEntityBulkAction> = [
|
||||
{
|
||||
type: 'entityBulkAction',
|
||||
alias: 'Umb.EntityBulkAction.Document.Move',
|
||||
name: 'Move Document Entity Bulk Action',
|
||||
weight: 10,
|
||||
api: UmbDocumentMoveEntityBulkAction,
|
||||
alias: 'Umb.EntityBulkAction.Document.Publish',
|
||||
name: 'Publish Document Entity Bulk Action',
|
||||
weight: 50,
|
||||
api: UmbDocumentPublishEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Move',
|
||||
label: 'Publish',
|
||||
repositoryAlias: UMB_DOCUMENT_DETAIL_REPOSITORY_ALIAS,
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
// TODO: this condition should be based on entity types in the selection
|
||||
alias: UMB_COLLECTION_ALIAS_CONDITION,
|
||||
match: UMB_DOCUMENT_COLLECTION_ALIAS,
|
||||
},
|
||||
{
|
||||
alias: UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION,
|
||||
match: (permissions: UmbCollectionBulkActionPermissions) => permissions.allowBulkPublish,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'entityBulkAction',
|
||||
alias: 'Umb.EntityBulkAction.Document.Unpublish',
|
||||
name: 'Unpublish Document Entity Bulk Action',
|
||||
weight: 40,
|
||||
api: UmbDocumentUnpublishEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Unpublish',
|
||||
repositoryAlias: UMB_DOCUMENT_DETAIL_REPOSITORY_ALIAS,
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
alias: UMB_COLLECTION_ALIAS_CONDITION,
|
||||
match: UMB_DOCUMENT_COLLECTION_ALIAS,
|
||||
},
|
||||
{
|
||||
alias: UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION,
|
||||
match: (permissions: UmbCollectionBulkActionPermissions) => permissions.allowBulkUnpublish,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'entityBulkAction',
|
||||
alias: 'Umb.EntityBulkAction.Document.Copy',
|
||||
name: 'Copy Document Entity Bulk Action',
|
||||
weight: 9,
|
||||
weight: 30,
|
||||
api: UmbDocumentCopyEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Copy',
|
||||
@@ -37,12 +68,55 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
// TODO: this condition should be based on entity types in the selection
|
||||
alias: UMB_COLLECTION_ALIAS_CONDITION,
|
||||
match: UMB_DOCUMENT_ENTITY_TYPE,
|
||||
match: UMB_DOCUMENT_COLLECTION_ALIAS,
|
||||
},
|
||||
{
|
||||
alias: UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION,
|
||||
match: (permissions: UmbCollectionBulkActionPermissions) => permissions.allowBulkCopy,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'entityBulkAction',
|
||||
alias: 'Umb.EntityBulkAction.Document.Move',
|
||||
name: 'Move Document Entity Bulk Action',
|
||||
weight: 20,
|
||||
api: UmbDocumentMoveEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Move',
|
||||
repositoryAlias: UMB_DOCUMENT_DETAIL_REPOSITORY_ALIAS,
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
alias: UMB_COLLECTION_ALIAS_CONDITION,
|
||||
match: UMB_DOCUMENT_COLLECTION_ALIAS,
|
||||
},
|
||||
{
|
||||
alias: UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION,
|
||||
match: (permissions: UmbCollectionBulkActionPermissions) => permissions.allowBulkMove,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'entityBulkAction',
|
||||
alias: 'Umb.EntityBulkAction.Document.Delete',
|
||||
name: 'Delete Document Entity Bulk Action',
|
||||
weight: 10,
|
||||
api: UmbDocumentDeleteEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Delete',
|
||||
repositoryAlias: UMB_DOCUMENT_DETAIL_REPOSITORY_ALIAS,
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
alias: UMB_COLLECTION_ALIAS_CONDITION,
|
||||
match: UMB_DOCUMENT_COLLECTION_ALIAS,
|
||||
},
|
||||
{
|
||||
alias: UMB_COLLECTION_BULK_ACTION_PERMISSION_CONDITION,
|
||||
match: (permissions: UmbCollectionBulkActionPermissions) => permissions.allowBulkDelete,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export const manifests = [...entityActions];
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { UmbDocumentDetailRepository } from '../../repository/index.js';
|
||||
import { UmbEntityBulkActionBase } from '@umbraco-cms/backoffice/entity-bulk-action';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export class UmbDocumentPublishEntityBulkAction extends UmbEntityBulkActionBase<UmbDocumentDetailRepository> {
|
||||
constructor(host: UmbControllerHostElement, repositoryAlias: string, selection: Array<string>) {
|
||||
super(host, repositoryAlias, selection);
|
||||
}
|
||||
|
||||
async execute() {
|
||||
console.log(`execute publish for: ${this.selection}`);
|
||||
//await this.repository?.publish();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { UmbDocumentDetailRepository } from '../../repository/index.js';
|
||||
import { UmbEntityBulkActionBase } from '@umbraco-cms/backoffice/entity-bulk-action';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export class UmbDocumentUnpublishEntityBulkAction extends UmbEntityBulkActionBase<UmbDocumentDetailRepository> {
|
||||
constructor(host: UmbControllerHostElement, repositoryAlias: string, selection: Array<string>) {
|
||||
super(host, repositoryAlias, selection);
|
||||
}
|
||||
|
||||
async execute() {
|
||||
console.log(`execute unpublish for: ${this.selection}`);
|
||||
//await this.repository?.unpublish();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ export * from './user-permissions/index.js';
|
||||
export * from './components/index.js';
|
||||
export * from './entity.js';
|
||||
export * from './entity-actions/index.js';
|
||||
export * from './conditions/index.js';
|
||||
|
||||
export { UMB_DOCUMENT_TREE_ALIAS } from './tree/index.js';
|
||||
export { UMB_CONTENT_MENU_ALIAS } from './menu.manifests.js';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { manifests as collectionManifests } from './collection/manifests.js';
|
||||
import { manifests as conditionManifests } from './conditions/manifests.js';
|
||||
import { manifests as menuItemManifests } from './menu-item/manifests.js';
|
||||
import { manifests as repositoryManifests } from './repository/manifests.js';
|
||||
import { manifests as treeManifests } from './tree/manifests.js';
|
||||
@@ -12,6 +13,7 @@ import { manifests as trackedReferenceManifests } from './tracked-reference/mani
|
||||
|
||||
export const manifests = [
|
||||
...collectionManifests,
|
||||
...conditionManifests,
|
||||
...menuItemManifests,
|
||||
...treeManifests,
|
||||
...repositoryManifests,
|
||||
|
||||
@@ -43,6 +43,7 @@ export class UmbDocumentServerDataSource implements UmbDetailDataSource<UmbDocum
|
||||
template: null,
|
||||
documentType: {
|
||||
unique: '',
|
||||
hasCollection: false,
|
||||
},
|
||||
isTrashed: false,
|
||||
values: [],
|
||||
@@ -109,7 +110,10 @@ export class UmbDocumentServerDataSource implements UmbDetailDataSource<UmbDocum
|
||||
};
|
||||
}),
|
||||
template: data.template ? { unique: data.template.id } : null,
|
||||
documentType: { unique: data.documentType.id },
|
||||
documentType: {
|
||||
unique: data.documentType.id,
|
||||
hasCollection: data.documentType.hasListView,
|
||||
},
|
||||
isTrashed: data.isTrashed,
|
||||
};
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ const mapper = (item: DocumentTreeItemResponseModel): UmbDocumentTreeItemModel =
|
||||
documentType: {
|
||||
unique: item.documentType.id,
|
||||
icon: item.documentType.icon,
|
||||
hasListView: item.documentType.hasListView,
|
||||
hasCollection: item.documentType.hasListView,
|
||||
},
|
||||
variants: item.variants.map((variant) => {
|
||||
return {
|
||||
|
||||
@@ -10,7 +10,7 @@ export interface UmbDocumentTreeItemModel extends UmbUniqueTreeItemModel {
|
||||
documentType: {
|
||||
unique: string;
|
||||
icon: string;
|
||||
hasListView: boolean;
|
||||
hasCollection: boolean;
|
||||
};
|
||||
variants: Array<UmbDocumentTreeItemVariantModel>;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@ import type { UmbVariantModel } from '@umbraco-cms/backoffice/variant';
|
||||
import type { DocumentVariantStateModel } from '@umbraco-cms/backoffice/external/backend-api';
|
||||
|
||||
export interface UmbDocumentDetailModel {
|
||||
documentType: { unique: string };
|
||||
documentType: {
|
||||
unique: string;
|
||||
hasCollection: boolean;
|
||||
};
|
||||
entityType: UmbDocumentEntityType;
|
||||
isTrashed: boolean;
|
||||
template: { unique: string } | null;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { UmbDocumentWorkspaceSplitViewElement } from './document-workspace-split-view.element.js';
|
||||
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from './document-workspace.context-token.js';
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
@@ -6,7 +7,6 @@ import type { UmbVariantModel } from '@umbraco-cms/backoffice/variant';
|
||||
import { UmbVariantId } from '@umbraco-cms/backoffice/variant';
|
||||
import type { UmbRoute, UmbRouterSlotInitEvent } from '@umbraco-cms/backoffice/router';
|
||||
import type { ActiveVariant } from '@umbraco-cms/backoffice/workspace';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
@customElement('umb-document-workspace-editor')
|
||||
export class UmbDocumentWorkspaceEditorElement extends UmbLitElement {
|
||||
//private _defaultVariant?: VariantViewModelBaseModel;
|
||||
|
||||
@@ -34,7 +34,9 @@ export class UmbDocumentWorkspaceContext
|
||||
}
|
||||
|
||||
readonly unique = this.#currentData.asObservablePart((data) => data?.unique);
|
||||
|
||||
readonly contentTypeUnique = this.#currentData.asObservablePart((data) => data?.documentType.unique);
|
||||
readonly contentTypeHasCollection = this.#currentData.asObservablePart((data) => data?.documentType.hasCollection);
|
||||
|
||||
readonly variants = this.#currentData.asObservablePart((data) => data?.variants || []);
|
||||
readonly urls = this.#currentData.asObservablePart((data) => data?.urls || []);
|
||||
@@ -67,7 +69,10 @@ export class UmbDocumentWorkspaceContext
|
||||
|
||||
async create(parentUnique: string | null, documentTypeUnique: string) {
|
||||
this.#getDataPromise = this.repository.createScaffold(parentUnique, {
|
||||
documentType: { unique: documentTypeUnique },
|
||||
documentType: {
|
||||
unique: documentTypeUnique,
|
||||
hasCollection: false,
|
||||
},
|
||||
});
|
||||
const { data } = await this.#getDataPromise;
|
||||
if (!data) return undefined;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user