mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-10778] Refactor Viewer (#7992)
* refactor version 1 many todo
* split render from viewer
move alfresco render in content pack
* refactor part 2
* test fixed
* fix doc
* [AAE-10778] Fix lint issues
* [AAE-10778] Fix lint issue: remove duplicated declaration
* [AAE-10778] Fix lint issue: use flex shorthand rule
* [AAE-10778] Fix FormService and WidgetComponent imports
* [AAE-10778] Fix import FormModel, FormService, FormFieldModel from adf-core
* [AAE-10778] Implement missing oninit, onchanges and ondestroy
* [AAE-10778] Replace adf-viewer with adf-alfresco-viewer, update escape command to close the viewer
* [AAE-10778] Fix unit test: fix the class name to match the 'adf-viewer-render.image-viewer-scaling' get from the appConfigService
* [AAE-10778] Fix image-viewer unit tests: replace ContentService with UrlService
* [AAE-10778] Fix unit test 'should if the extension change extension Change event be fired': emit file extension when the filename extension change
* [AAE-10778] Fix unit test: expect for internalFileName value instead of display-name id because the display name logic has been moved to the alfresco-viewer.component
* [AAE-10778] Fix unit test: remove display name it because the unknown display name value is no longer handled after refactoring
* [AAE-10778] Fix e2e: [C260096] Should the Viewer able to accept a customToolbar
* [AAE-10778] Update selector to fix e2e: '[C362265] Should the Viewer be able to download a previous version of a file'
* [AAE-10778] Update selector to fix e2e: '[C260038] Should display first page, toolbar and pagination when opening a .pdf file'
* fix aftrer rebase
* fix unit test
* [AAE-10778] Add adf viewer component that is node agnostic, show adf-alfresco-viewer or adf-viewer into file-view-component if blob or node are set
* [AAE-10778] Update viewer export path
* [AAE-10778] Update selectors since have been updated in the viewer component
* [AAE-10778] Call adf-viewer from alfresco-viewer, project adf-alfresco-viewer content to adf-viewer
* [AAE-10778] Remove full screen unit tests from alfresco-viewer component becase that logic is handled in the viewer.component
* [AAE-10778] Export toolbar custom actions component
* [AAE-10778] Pass mimeType as input to adf-viewer to update mime icon
* [AAE-10778] Remove e2e because the custom name behaviour has been removed from the file-view.component (9f21b6dc69
\#diff-4b438dc59784dce9eb7634cfeca6d8db61362966343bd3d6895a3edafdf4cfd5L129)
* [AAE-10778] Use two-way binding for showViewer change to fix C260100
* [AAE-10778] Update prefix css selectors to adf-viewer because are related to the adf-viewer component
* [AAE-10778] Update prefix css selectors to adf-viewer in the unit tests because are related to the adf-viewer component
* [AAE-10778] Update the output name to showViewerChange to navigate to primary url after closing the viewer
* [AAE-10778] Pass right and left sidebar template context to viewer component (fix C362242)
* [AAE-10778] Add allowFullScreen input to disable/enable full screen behaviour
* [AAE-10778] Handle loading visualization only inside the viewer-render component
* [AAE-10778] PDF viewer: fix mat-progress-bar is not showed during the pdf loading, center progress bar
* [AAE-10778] Remove isLoading from unit tests because no longer exists
* [AAE-10778] Remove viewerType input from adf-viewer, viewerType will be handled by viewer-render
* [AAE-10778] Remove console.log
* [AAE-10778] Remove check full screen button is not displayed on the media file because is not needed anymore, we don't need to check for the fullscreen button in the viewer component
* [AAE-10778] Check for node rendtion before to assign to urlFileContent and mimeType
* [AAE-10778] Process Services Cloud: register file-viewer widget that uses adf-alfresco-viewer component to display content from ACS
* [AAE-10778] Core: rename file-viewer widget into base-viewer, base-viewer no longer accept nodeId, but will accept urlFile and blobFile
* [AAE-10778] Process Services: register file-viewer widget that uses adf-alfresco-viewer component to display content from ACS
* [AAE-10778] Base viewer widget: show viewer only if there's a file input
* [AAE-10778] Viewer component: check for fileName when urlFile is provided as Input
* [AAE-10778] Viewer component documentation
* [AAE-10778] Update upgrade guide with viewer changes
* [AAE-10778] Fix double quote lint issue after rebase
---------
Co-authored-by: Amedeo Lepore <amedeo.lepore@hyland.com>
Co-authored-by: Amedeo Lepore <amedeo.lepore85@gmail.com>
This commit is contained in:
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
|
@@ -13,11 +13,11 @@ var tree = remark()
|
||||
.use(frontMatter, ['yaml'])
|
||||
.parse(docSrc);
|
||||
tree = removePosInfo(tree);
|
||||
var schema = graphql_1.buildSchema(MQ.schema);
|
||||
var schema = (0, graphql_1.buildSchema)(MQ.schema);
|
||||
var root = {
|
||||
document: function () { return new MQ.Root(tree); }
|
||||
};
|
||||
var query = "\n {\n document {\n metadata(key: \"Status\")\n heading {\n link {\n text {\n value\n }\n }\n }\n paragraph {\n plaintext\n }\n }\n }\n";
|
||||
graphql_1.graphql(schema, query, root).then(function (response) {
|
||||
(0, graphql_1.graphql)(schema, query, root).then(function (response) {
|
||||
console.log(JSON.stringify(response));
|
||||
});
|
||||
|
@@ -30,7 +30,7 @@ var client = new graphql_request_1.GraphQLClient('https://api.github.com/graphql
|
||||
});
|
||||
var query = "query commitHistory($path: String) {\n repository(name: \"alfresco-ng2-components\", owner: \"alfresco\") {\n ref(qualifiedName: \"development\") {\n target {\n ... on Commit {\n history(first: 15, path: $path) {\n nodes {\n pushedDate\n message\n }\n }\n }\n }\n }\n }\n}";
|
||||
var docFiles = getDocFilePaths(docsFolderPath);
|
||||
var docNames = rxjs_1.of(docFiles);
|
||||
var docNames = (0, rxjs_1.of)(docFiles);
|
||||
console.log("'Name','Review date','Commits since review','Score'");
|
||||
docNames.subscribe(function (docs) {
|
||||
docs.forEach(function (x) {
|
||||
@@ -48,7 +48,7 @@ docNames.subscribe(function (docs) {
|
||||
if (numUsefulCommits > 0) {
|
||||
var dateString = lastReviewDate.format('YYYY-MM-DD');
|
||||
var score = priorityScore(lastReviewDate, numUsefulCommits).toPrecision(3);
|
||||
console.log("'" + key + "','" + dateString + "','" + numUsefulCommits + "','" + score + "'");
|
||||
console.log("'".concat(key, "','").concat(dateString, "','").concat(numUsefulCommits, "','").concat(score, "'"));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@@ -38,13 +38,13 @@ var PropInfo = /** @class */ (function () {
|
||||
}
|
||||
}
|
||||
if (!_this.docText && !_this.isDeprecated) {
|
||||
_this.errorMessages.push("Warning: Input \"" + sourceData.name + "\" has no doc text.");
|
||||
_this.errorMessages.push("Warning: Input \"".concat(sourceData.name, "\" has no doc text."));
|
||||
}
|
||||
}
|
||||
if (dec.name === 'Output') {
|
||||
_this.isOutput = true;
|
||||
if (!_this.docText && !_this.isDeprecated) {
|
||||
_this.errorMessages.push("Warning: Output \"" + sourceData.name + "\" has no doc text.");
|
||||
_this.errorMessages.push("Warning: Output \"".concat(sourceData.name, "\" has no doc text."));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -77,9 +77,9 @@ var ParamInfo = /** @class */ (function () {
|
||||
if (this.isOptional) {
|
||||
this.combined += '?';
|
||||
}
|
||||
this.combined += ": `" + this.type + "`";
|
||||
this.combined += ": `".concat(this.type, "`");
|
||||
if (this.defaultValue !== '') {
|
||||
this.combined += " = `" + this.defaultValue + "`";
|
||||
this.combined += " = `".concat(this.defaultValue, "`");
|
||||
}
|
||||
}
|
||||
return ParamInfo;
|
||||
@@ -93,7 +93,7 @@ var MethodSigInfo = /** @class */ (function () {
|
||||
this.docText = sourceData.summary || '';
|
||||
this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
|
||||
if (!this.docText && this.name.indexOf('service') > 0) {
|
||||
this.errorMessages.push("Warning: method \"" + sourceData.name + "\" has no doc text.");
|
||||
this.errorMessages.push("Warning: method \"".concat(sourceData.name, "\" has no doc text."));
|
||||
}
|
||||
this.returnType = sourceData.syntax['return'].type || '';
|
||||
this.returnType = this.returnType.toString().replace(/\s/g, '');
|
||||
@@ -103,7 +103,7 @@ var MethodSigInfo = /** @class */ (function () {
|
||||
this.returnsSomething = false;
|
||||
}
|
||||
if (this.returnsSomething && !this.returnDocText && this.name.indexOf('service') > 0) {
|
||||
this.errorMessages.push("Warning: Return value of method \"" + sourceData.name + "\" has no doc text.");
|
||||
this.errorMessages.push("Warning: Return value of method \"".concat(sourceData.name, "\" has no doc text."));
|
||||
}
|
||||
this.isDeprecated = false;
|
||||
if (sourceData.tags) {
|
||||
@@ -118,7 +118,7 @@ var MethodSigInfo = /** @class */ (function () {
|
||||
if (sourceData.syntax.parameters) {
|
||||
sourceData.syntax.parameters.forEach(function (rawParam) {
|
||||
if (rawParam.name && !rawParam.description && !rawParam.name.startWith('on')) {
|
||||
_this.errorMessages.push("Warning: parameter \"" + rawParam.name + "\" of method \"" + sourceData.name + "\" has no doc text.");
|
||||
_this.errorMessages.push("Warning: parameter \"".concat(rawParam.name, "\" of method \"").concat(sourceData.name, "\" has no doc text."));
|
||||
}
|
||||
var param = new ParamInfo(rawParam);
|
||||
_this.params.push(param);
|
||||
|
@@ -29,13 +29,13 @@ function processDocs(mdCache, aggData) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
var linkElems = unist_util_select_1.selectAll('link', tree);
|
||||
var linkElems = (0, unist_util_select_1.selectAll)('link', tree);
|
||||
linkElems.forEach(function (linkElem) {
|
||||
var normUrl = normaliseLinkPath(pathname, linkElem.url);
|
||||
multiSetAdd(linkRefs, normUrl, pathname);
|
||||
});
|
||||
}
|
||||
var imageElems = unist_util_select_1.selectAll('image', tree);
|
||||
var imageElems = (0, unist_util_select_1.selectAll)('image', tree);
|
||||
imageElems.forEach(function (imageElem) {
|
||||
var normUrl = normaliseLinkPath(pathname, imageElem.url);
|
||||
multiSetAdd(imageRefs, normUrl, pathname);
|
||||
@@ -46,11 +46,11 @@ function processDocs(mdCache, aggData) {
|
||||
});
|
||||
classlessDocs.forEach(function (docPath) {
|
||||
var relDocPath = docPath.substring(docPath.indexOf('docs'));
|
||||
console.group("Warning: no source class found for \"" + relDocPath + "\"");
|
||||
console.group("Warning: no source class found for \"".concat(relDocPath, "\""));
|
||||
if (linkRefs[docPath]) {
|
||||
linkRefs[docPath].forEach(function (linkRef) {
|
||||
var relLinkPath = linkRef.substring(linkRef.indexOf('docs'));
|
||||
console.log("Linked from: \"" + relLinkPath + "\"");
|
||||
console.log("Linked from: \"".concat(relLinkPath, "\""));
|
||||
});
|
||||
}
|
||||
console.groupEnd();
|
||||
@@ -60,7 +60,7 @@ function processDocs(mdCache, aggData) {
|
||||
imagePaths.forEach(function (imagePath) {
|
||||
if (!imageRefs[imagePath]) {
|
||||
var relImagePath = imagePath.substring(imagePath.indexOf('docs'));
|
||||
console.log("Warning: no links to image file \"" + relImagePath + "\"");
|
||||
console.log("Warning: no links to image file \"".concat(relImagePath, "\""));
|
||||
}
|
||||
});
|
||||
console.log();
|
||||
@@ -68,11 +68,11 @@ function processDocs(mdCache, aggData) {
|
||||
brokenImUrls.forEach(function (url) {
|
||||
var relUrl = url.substring(url.indexOf('docs'));
|
||||
var relDocPath = brokenImageRefs[url].substring(brokenImageRefs[url].indexOf('docs'));
|
||||
console.group("Broken image link \"" + relUrl + "\" found in \"" + relDocPath);
|
||||
console.group("Broken image link \"".concat(relUrl, "\" found in \"").concat(relDocPath));
|
||||
imagePaths.forEach(function (imPath) {
|
||||
if (lev.get(imPath, url) <= maxImagePathLevDistance) {
|
||||
var relImPath = imPath.substring(imPath.indexOf('docs'));
|
||||
console.log("Should it be \"" + relImPath + "\"?");
|
||||
console.log("Should it be \"".concat(relImPath, "\"?"));
|
||||
}
|
||||
});
|
||||
console.groupEnd();
|
||||
|
@@ -24,9 +24,9 @@ function processDocs(mdCache, aggData) {
|
||||
var indexMD = remark()
|
||||
.use(frontMatter, ['yaml'])
|
||||
.parse(indexFileText);
|
||||
var schema = graphql_1.buildSchema(MQ.schema);
|
||||
var schema = (0, graphql_1.buildSchema)(MQ.schema);
|
||||
libNamesList.forEach(function (libName) {
|
||||
graphql_1.graphql(schema, query, docset, null, { 'libName': libName })
|
||||
(0, graphql_1.graphql)(schema, query, docset, null, { 'libName': libName })
|
||||
.then(function (response) {
|
||||
if (!response['data']) {
|
||||
console.log(JSON.stringify(response));
|
||||
|
@@ -18,7 +18,7 @@ function processDocs(mdCache, aggData) {
|
||||
}
|
||||
exports.processDocs = processDocs;
|
||||
function fixUrls(tree, docFilePath, linkSet, selector) {
|
||||
var linksInDoc = unist_util_select_1.selectAll(selector, tree);
|
||||
var linksInDoc = (0, unist_util_select_1.selectAll)(selector, tree);
|
||||
var errors = [];
|
||||
linksInDoc.forEach(function (linkElem) {
|
||||
var origFullUrlPath = path.resolve(path.dirname(docFilePath), linkElem.url);
|
||||
@@ -34,14 +34,14 @@ function fixUrls(tree, docFilePath, linkSet, selector) {
|
||||
!fs.existsSync(origFullUrlPath)) {
|
||||
var newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath;
|
||||
linkElem.url = path.relative(path.dirname(docFilePath), newUrl).replace(/\\/g, '/') + anchor;
|
||||
errors.push("Bad link: " + origFullUrlPath + "\nReplacing with " + linkElem.url);
|
||||
errors.push("Bad link: ".concat(origFullUrlPath, "\nReplacing with ").concat(linkElem.url));
|
||||
} /*else {
|
||||
console.log(`Link OK: ${origFullUrlPath}`);
|
||||
}
|
||||
*/
|
||||
});
|
||||
if (errors.length > 0) {
|
||||
showMessages("File: " + docFilePath + ":", errors);
|
||||
showMessages("File: ".concat(docFilePath, ":"), errors);
|
||||
}
|
||||
}
|
||||
function showMessages(groupName, messages) {
|
||||
@@ -81,7 +81,7 @@ var LinkSet = /** @class */ (function () {
|
||||
return candidates[0];
|
||||
}
|
||||
else {
|
||||
console.log("Multiple candidates for " + oldUrl);
|
||||
console.log("Multiple candidates for ".concat(oldUrl));
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ function processDocs(mdCache, aggData) {
|
||||
var className = ngHelpers.ngNameToClassName(fileBaseName, aggData.config.typeNameExceptions);
|
||||
var classInfo = aggData.classInfo[className];
|
||||
var sourcePath = classInfo ? classInfo.sourcePath : '';
|
||||
var titleHeading = unist_util_select_1.select('heading[depth=1]:first-of-type', tree);
|
||||
var titleHeading = (0, unist_util_select_1.select)('heading[depth=1]:first-of-type', tree);
|
||||
var relDocPath = pathname.substring(pathname.indexOf('docs'));
|
||||
var srcUrl = fixRelSrcUrl(relDocPath, sourcePath);
|
||||
if (titleHeading && titleHeading.children[0] && titleHeading.children[0].type === 'text') {
|
||||
@@ -24,14 +24,14 @@ function processDocs(mdCache, aggData) {
|
||||
titleHeading.children[0] = {
|
||||
type: 'link',
|
||||
url: srcUrl,
|
||||
title: "Defined in " + path.basename(sourcePath),
|
||||
title: "Defined in ".concat(path.basename(sourcePath)),
|
||||
children: [titleText]
|
||||
};
|
||||
}
|
||||
else if ((titleHeading && titleHeading.children[0].type === 'link') && sourcePath) {
|
||||
var linkElem = titleHeading.children[0];
|
||||
linkElem.url = srcUrl, // `../../${sourcePath}`;
|
||||
linkElem.title = "Defined in " + path.basename(sourcePath);
|
||||
linkElem.title = "Defined in ".concat(path.basename(sourcePath));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ function showErrors(filename, errorMessages) {
|
||||
console.log('');
|
||||
}
|
||||
function updateFile(tree, pathname, aggData, errorMessages) {
|
||||
var className = ngHelpers_1.ngNameToClassName(path.basename(pathname, '.md'), nameExceptions);
|
||||
var className = (0, ngHelpers_1.ngNameToClassName)(path.basename(pathname, '.md'), nameExceptions);
|
||||
var classTypeMatch = className.match(/component|directive|service/i);
|
||||
var compData = aggData.classInfo[className];
|
||||
if (classTypeMatch && compData) {
|
||||
@@ -168,7 +168,7 @@ function updatePropDocsFromMD(comp, inputDocs, outputDocs, errorMessages) {
|
||||
// If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date.
|
||||
if (!prop.docText && propMDDoc) {
|
||||
prop.docText = propMDDoc;
|
||||
errorMessages.push("Warning: empty JSDocs for property \"" + prop.name + "\" may need sync with the .md file.");
|
||||
errorMessages.push("Warning: empty JSDocs for property \"".concat(prop.name, "\" may need sync with the .md file."));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -178,12 +178,12 @@ function updateMethodDocsFromMD(comp, methodDocs, errorMessages) {
|
||||
// If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date.
|
||||
if (!meth.docText && currMethMD && currMethMD.docText) {
|
||||
meth.docText = currMethMD.docText;
|
||||
errorMessages.push("Warning: empty JSDocs for method sig \"" + meth.name + "\" may need sync with the .md file.");
|
||||
errorMessages.push("Warning: empty JSDocs for method sig \"".concat(meth.name, "\" may need sync with the .md file."));
|
||||
}
|
||||
meth.params.forEach(function (param) {
|
||||
if (!param.docText && currMethMD && currMethMD.params[param.name]) {
|
||||
param.docText = currMethMD.params[param.name];
|
||||
errorMessages.push("Warning: empty JSDocs for parameter \"" + param.name + " (" + meth.name + ")\" may need sync with the .md file.");
|
||||
errorMessages.push("Warning: empty JSDocs for parameter \"".concat(param.name, " (").concat(meth.name, ")\" may need sync with the .md file."));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@@ -1,10 +1,12 @@
|
||||
"use strict";
|
||||
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.processDocs = void 0;
|
||||
@@ -72,7 +74,7 @@ function updateFile(tree, pathname, aggData) {
|
||||
var _a;
|
||||
if ((child.type === 'text') || (child.type === 'inlineCode')) {
|
||||
var newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode');
|
||||
(_a = node.children).splice.apply(_a, __spreadArrays([index, 1], newNodes));
|
||||
(_a = node.children).splice.apply(_a, __spreadArray([index, 1], newNodes, false));
|
||||
}
|
||||
else {
|
||||
traverseMDTree(child);
|
||||
|
Reference in New Issue
Block a user