Merge branch 'develop' into feature/AAE-36582-forms-misalignment

This commit is contained in:
Tomasz Nastaly
2025-07-31 23:22:09 +02:00
committed by GitHub
38 changed files with 1051 additions and 1697 deletions
@@ -17,13 +17,12 @@
import { EventEmitter } from '@angular/core'; import { EventEmitter } from '@angular/core';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { AppConfigModule, AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core'; import { AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core';
import { UploadService } from './upload.service'; import { UploadService } from './upload.service';
import { RepositoryInfo } from '@alfresco/js-api'; import { RepositoryInfo } from '@alfresco/js-api';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { DiscoveryApiService } from '../../common/services/discovery-api.service'; import { DiscoveryApiService } from '../../common/services/discovery-api.service';
import { FileModel, FileUploadStatus } from '../../common/models/file.model'; import { FileModel, FileUploadStatus } from '../../common/models/file.model';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AlfrescoApiService } from '../../services'; import { AlfrescoApiService } from '../../services';
import { AlfrescoApiServiceMock } from '../../mock'; import { AlfrescoApiServiceMock } from '../../mock';
@@ -38,7 +37,7 @@ describe('UploadService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [AppConfigModule, HttpClientTestingModule], imports: [],
providers: [ providers: [
UploadService, UploadService,
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
+1 -2
View File
@@ -26,8 +26,7 @@ module.exports = function (config) {
included: false, included: false,
served: true, served: true,
watched: false watched: false
}, }
{ pattern: 'node_modules/resize-observer-polyfill/dist/ResizeObserver.global.js', included: true, watched: false }
], ],
frameworks: ['jasmine-ajax', 'jasmine', '@angular-devkit/build-angular'], frameworks: ['jasmine-ajax', 'jasmine', '@angular-devkit/build-angular'],
@@ -20,5 +20,4 @@ export * from './debug-app-config.service';
export * from './app-config.pipe'; export * from './app-config.pipe';
export * from './app-config-storage-prefix.factory'; export * from './app-config-storage-prefix.factory';
export * from './app-config.module';
export * from './provide-app-config'; export * from './provide-app-config';
@@ -1,7 +1,7 @@
<div <div
role="grid" role="grid"
*ngIf="data" *ngIf="data"
class="adf-full-width adf-datatable-list" class="adf-datatable-list"
[class.adf-sticky-header]="isStickyHeaderEnabled()" [class.adf-sticky-header]="isStickyHeaderEnabled()"
[class.adf-datatable--empty]="(isEmpty() && !isHeaderVisible()) || loading" [class.adf-datatable--empty]="(isEmpty() && !isHeaderVisible()) || loading"
[class.adf-datatable--empty--header-visible]="isEmpty() && isHeaderVisible()" [class.adf-datatable--empty--header-visible]="isEmpty() && isHeaderVisible()"
@@ -19,6 +19,7 @@ $data-table-cell-min-width-file-size: $data-table-cell-min-width-1 !default;
.adf-datatable { .adf-datatable {
overflow-y: scroll; overflow-y: scroll;
height: 100%; height: 100%;
display: block;
.adf-full-width { .adf-full-width {
width: 100%; width: 100%;
@@ -60,6 +61,8 @@ $data-table-cell-min-width-file-size: $data-table-cell-min-width-1 !default;
border: 1px solid var(--adf-theme-foreground-text-color-007); border: 1px solid var(--adf-theme-foreground-text-color-007);
box-sizing: border-box; box-sizing: border-box;
overflow-x: auto; overflow-x: auto;
min-width: 100%;
width: fit-content;
@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) { @media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) {
.adf-datatable-center-size-column-ie { .adf-datatable-center-size-column-ie {
@@ -671,7 +674,7 @@ $data-table-cell-min-width-file-size: $data-table-cell-min-width-1 !default;
.adf-datatable-body { .adf-datatable-body {
display: block; display: block;
flex: 1; flex: 1;
overflow-y: scroll; overflow: hidden auto;
margin-top: -1px; margin-top: -1px;
} }
} }
@@ -16,10 +16,11 @@
*/ */
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UnitTestingUtils } from '../../../testing'; import { UnitTestingUtils, NoopTranslateModule } from '../../../testing';
import { FormFieldModel, FormModel } from '../widgets'; import { FormFieldModel, FormModel } from '../widgets';
import { FormSectionComponent } from './form-section.component'; import { FormSectionComponent } from './form-section.component';
import { mockSectionWithFields } from '../mock/form-renderer.component.mock'; import { mockSectionWithFields } from '../mock/form-renderer.component.mock';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
describe('FormSectionComponent', () => { describe('FormSectionComponent', () => {
let fixture: ComponentFixture<FormSectionComponent>; let fixture: ComponentFixture<FormSectionComponent>;
@@ -28,7 +29,7 @@ describe('FormSectionComponent', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [FormSectionComponent] imports: [FormSectionComponent, NoopTranslateModule, NoopAnimationsModule]
}); });
fixture = TestBed.createComponent(FormSectionComponent); fixture = TestBed.createComponent(FormSectionComponent);
testingUtils = new UnitTestingUtils(fixture.debugElement); testingUtils = new UnitTestingUtils(fixture.debugElement);
@@ -59,4 +60,87 @@ describe('FormSectionComponent', () => {
const sectionFields = testingUtils.getAllByCSS('.adf-grid-list-section-column-view-item adf-form-field'); const sectionFields = testingUtils.getAllByCSS('.adf-grid-list-section-column-view-item adf-form-field');
expect(sectionFields.length).toBe(2); expect(sectionFields.length).toBe(2);
}); });
describe('getSectionColumnWidth', () => {
it('should cap width at 100% when numberOfColumns is not a number', () => {
const columnField = { colspan: 2 } as FormFieldModel;
const width = component.getSectionColumnWidth('invalid' as unknown as number, [columnField]);
expect(width).toBe('100');
});
it('should cap width at 100% when numberOfColumns is null', () => {
const columnField = { colspan: 3 } as FormFieldModel;
const width = component.getSectionColumnWidth(null as unknown as number, [columnField]);
expect(width).toBe('100');
});
it('should return 100% when numberOfColumns is undefined', () => {
const columnField = { colspan: 1 } as FormFieldModel;
const width = component.getSectionColumnWidth(undefined as unknown as number, [columnField]);
expect(width).toBe('100');
});
it('should cap width at 100% when numberOfColumns is 0', () => {
const columnField = { colspan: 2 } as FormFieldModel;
const width = component.getSectionColumnWidth(0, [columnField]);
expect(width).toBe('100');
});
it('should cap width at 100% when numberOfColumns is negative', () => {
const columnField = { colspan: 3 } as FormFieldModel;
const width = component.getSectionColumnWidth(-1, [columnField]);
expect(width).toBe('100');
});
it('should return 100 when numberOfColumns is falsy and no colspan is defined', () => {
const columnField = {} as FormFieldModel;
const width = component.getSectionColumnWidth(null as unknown as number, [columnField]);
expect(width).toBe('100');
});
it('should calculate percentage width when numberOfColumns is a valid number', () => {
const numberOfColumns = 4;
const columnField = { colspan: 2 } as FormFieldModel;
const width = component.getSectionColumnWidth(numberOfColumns, [columnField]);
expect(width).toBe('50');
});
it('should cap width at 100% when colspan exceeds numberOfColumns', () => {
const numberOfColumns = 2;
const columnField = { colspan: 5 } as FormFieldModel;
const width = component.getSectionColumnWidth(numberOfColumns, [columnField]);
expect(width).toBe('100');
});
it('should use default colspan of 1 when field has no colspan and numberOfColumns is valid', () => {
const numberOfColumns = 5;
const columnField = {} as FormFieldModel;
const width = component.getSectionColumnWidth(numberOfColumns, [columnField]);
expect(width).toBe('20');
});
it('should handle empty columnFields array', () => {
const numberOfColumns = 3;
const width = component.getSectionColumnWidth(numberOfColumns, []);
expect(parseFloat(width)).toBeCloseTo(33.33);
});
it('should use first field colspan when multiple fields are provided', () => {
const numberOfColumns = 2;
const columnFields = [{ colspan: 1 } as FormFieldModel, { colspan: 3 } as FormFieldModel];
const width = component.getSectionColumnWidth(numberOfColumns, columnFields);
expect(width).toBe('50');
});
});
}); });
@@ -43,6 +43,10 @@ export class FormSectionComponent implements OnInit {
const defaultColspan = 1; const defaultColspan = 1;
const fieldColspan = columnFields[firstColumnFieldIndex]?.colspan ?? defaultColspan; const fieldColspan = columnFields[firstColumnFieldIndex]?.colspan ?? defaultColspan;
return (100 / numberOfColumns) * fieldColspan + ''; if (typeof numberOfColumns !== 'number' || !numberOfColumns || numberOfColumns <= 0) {
numberOfColumns = 1;
}
return Math.min(100, (100 / numberOfColumns) * fieldColspan) + '';
} }
} }
@@ -5,4 +5,6 @@
color: var(--adf-readonly-text-color, var(--adf-form-label-color, var(--theme-text-color))); color: var(--adf-readonly-text-color, var(--adf-form-label-color, var(--theme-text-color)));
line-height: normal; line-height: normal;
word-break: break-word; word-break: break-word;
position: relative;
top: 3px;
} }
+13 -1
View File
@@ -292,7 +292,19 @@
}, },
"SEARCH": { "SEARCH": {
"TOGGLE_ASC_DESC_ORDER": "Umschalten zwischen auf- und absteigender Reihenfolge der Ergebnisse", "TOGGLE_ASC_DESC_ORDER": "Umschalten zwischen auf- und absteigender Reihenfolge der Ergebnisse",
"SORT_BY": "Sortieren nach" "SORT_BY": "Sortieren nach",
"BUTTON": {
"TOOLTIP": "Search",
"ARIA-LABEL": "Search button"
},
"INPUT": {
"ARIA-LABEL": "Search input"
},
"FILTER": {
"BUTTONS": {
"CLOSE": "Close"
}
}
}, },
"FEATURE-FLAGS": { "FEATURE-FLAGS": {
"OVERRIDES": "Feature-Flags überschreibt", "OVERRIDES": "Feature-Flags überschreibt",
+13 -1
View File
@@ -292,7 +292,19 @@
}, },
"SEARCH": { "SEARCH": {
"TOGGLE_ASC_DESC_ORDER": "Toggle results between ascending and descending order", "TOGGLE_ASC_DESC_ORDER": "Toggle results between ascending and descending order",
"SORT_BY": "Sort by" "SORT_BY": "Sort by",
"BUTTON": {
"TOOLTIP": "Search",
"ARIA-LABEL": "Search button"
},
"INPUT": {
"ARIA-LABEL": "Search input"
},
"FILTER": {
"BUTTONS": {
"CLOSE": "Close"
}
}
}, },
"FEATURE-FLAGS": { "FEATURE-FLAGS": {
"OVERRIDES": "Feature flag overrides", "OVERRIDES": "Feature flag overrides",
+13 -1
View File
@@ -292,7 +292,19 @@
}, },
"SEARCH": { "SEARCH": {
"TOGGLE_ASC_DESC_ORDER": "Cambiar entre orden ascendente y descendente de resultados", "TOGGLE_ASC_DESC_ORDER": "Cambiar entre orden ascendente y descendente de resultados",
"SORT_BY": "Clasificar por" "SORT_BY": "Clasificar por",
"BUTTON": {
"TOOLTIP": "Search",
"ARIA-LABEL": "Search button"
},
"INPUT": {
"ARIA-LABEL": "Search input"
},
"FILTER": {
"BUTTONS": {
"CLOSE": "Close"
}
}
}, },
"FEATURE-FLAGS": { "FEATURE-FLAGS": {
"OVERRIDES": "Anulación de indicador de características", "OVERRIDES": "Anulación de indicador de características",
+13 -1
View File
@@ -292,7 +292,19 @@
}, },
"SEARCH": { "SEARCH": {
"TOGGLE_ASC_DESC_ORDER": "Afficher les résultats dans l'ordre croissant ou décroissant", "TOGGLE_ASC_DESC_ORDER": "Afficher les résultats dans l'ordre croissant ou décroissant",
"SORT_BY": "Trier par" "SORT_BY": "Trier par",
"BUTTON": {
"TOOLTIP": "Search",
"ARIA-LABEL": "Search button"
},
"INPUT": {
"ARIA-LABEL": "Search input"
},
"FILTER": {
"BUTTONS": {
"CLOSE": "Close"
}
}
}, },
"FEATURE-FLAGS": { "FEATURE-FLAGS": {
"OVERRIDES": "Remplacements dindicateur de fonctionnalité", "OVERRIDES": "Remplacements dindicateur de fonctionnalité",
+13 -1
View File
@@ -292,7 +292,19 @@
}, },
"SEARCH": { "SEARCH": {
"TOGGLE_ASC_DESC_ORDER": "Ordina i risultati in modo crescente o decrescente", "TOGGLE_ASC_DESC_ORDER": "Ordina i risultati in modo crescente o decrescente",
"SORT_BY": "Ordina per" "SORT_BY": "Ordina per",
"BUTTON": {
"TOOLTIP": "Search",
"ARIA-LABEL": "Search button"
},
"INPUT": {
"ARIA-LABEL": "Search input"
},
"FILTER": {
"BUTTONS": {
"CLOSE": "Close"
}
}
}, },
"FEATURE-FLAGS": { "FEATURE-FLAGS": {
"OVERRIDES": "Ridefinizioni flag funzione", "OVERRIDES": "Ridefinizioni flag funzione",
+13 -1
View File
@@ -292,7 +292,19 @@
}, },
"SEARCH": { "SEARCH": {
"TOGGLE_ASC_DESC_ORDER": "Przełącz kolejność sortowania wyników między rosnącą a malejącą", "TOGGLE_ASC_DESC_ORDER": "Przełącz kolejność sortowania wyników między rosnącą a malejącą",
"SORT_BY": "Sortuj wg" "SORT_BY": "Sortuj wg",
"BUTTON": {
"TOOLTIP": "Search",
"ARIA-LABEL": "Search button"
},
"INPUT": {
"ARIA-LABEL": "Search input"
},
"FILTER": {
"BUTTONS": {
"CLOSE": "Close"
}
}
}, },
"FEATURE-FLAGS": { "FEATURE-FLAGS": {
"OVERRIDES": "Zastąpienie flagi funkcji", "OVERRIDES": "Zastąpienie flagi funkcji",
+13 -1
View File
@@ -292,7 +292,19 @@
}, },
"SEARCH": { "SEARCH": {
"TOGGLE_ASC_DESC_ORDER": "Alternar resultados entre ordem crescente e decrescente", "TOGGLE_ASC_DESC_ORDER": "Alternar resultados entre ordem crescente e decrescente",
"SORT_BY": "Ordenar por:" "SORT_BY": "Ordenar por:",
"BUTTON": {
"TOOLTIP": "Search",
"ARIA-LABEL": "Search button"
},
"INPUT": {
"ARIA-LABEL": "Search input"
},
"FILTER": {
"BUTTONS": {
"CLOSE": "Close"
}
}
}, },
"FEATURE-FLAGS": { "FEATURE-FLAGS": {
"OVERRIDES": "Substituições do sinalizador de caraterística", "OVERRIDES": "Substituições do sinalizador de caraterística",
@@ -7,16 +7,16 @@
id="adf-search-button" id="adf-search-button"
class="adf-search-button" class="adf-search-button"
[ngClass]="{'adf-search-button-inactive': subscriptAnimationState.value === 'inactive'}" [ngClass]="{'adf-search-button-inactive': subscriptAnimationState.value === 'inactive'}"
[title]="'SEARCH.BUTTON.TOOLTIP' | translate" [title]="'CORE.SEARCH.BUTTON.TOOLTIP' | translate"
(click)="toggleSearchBar()" (click)="toggleSearchBar()"
(keyup.enter)="toggleSearchBar()"> (keyup.enter)="toggleSearchBar()">
<mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon> <mat-icon [attr.aria-label]="'CORE.SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon>
</button> </button>
<mat-form-field class="adf-input-form-field-divider" [hintLabel]="hintLabel"> <mat-form-field class="adf-input-form-field-divider" [hintLabel]="hintLabel">
<mat-label *ngIf='label'>{{label}}</mat-label> <mat-label *ngIf='label'>{{label}}</mat-label>
<input matInput <input matInput
#searchInput #searchInput
[attr.aria-label]="'SEARCH.INPUT.ARIA-LABEL' | translate" [attr.aria-label]="'CORE.SEARCH.INPUT.ARIA-LABEL' | translate"
[attr.type]="inputType" [attr.type]="inputType"
[autocomplete]="getAutoComplete()" [autocomplete]="getAutoComplete()"
id="adf-control-input" id="adf-control-input"
@@ -34,7 +34,7 @@
matSuffix matSuffix
data-automation-id="adf-clear-search-button" data-automation-id="adf-clear-search-button"
class="adf-clear-search-button" class="adf-clear-search-button"
[title]="'SEARCH.FILTER.BUTTONS.CLOSE' | translate" [title]="'CORE.SEARCH.FILTER.BUTTONS.CLOSE' | translate"
(click)="resetSearch()" (click)="resetSearch()"
(keyup.enter)="resetSearch()"> (keyup.enter)="resetSearch()">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
@@ -21,6 +21,8 @@ import { DebugElement } from '@angular/core';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { UserPreferencesService } from '../common/services/user-preferences.service'; import { UserPreferencesService } from '../common/services/user-preferences.service';
import { UnitTestingUtils } from '../testing/unit-testing-utils'; import { UnitTestingUtils } from '../testing/unit-testing-utils';
import { NoopTranslateModule } from '../testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
describe('SearchTextInputComponent', () => { describe('SearchTextInputComponent', () => {
let fixture: ComponentFixture<SearchTextInputComponent>; let fixture: ComponentFixture<SearchTextInputComponent>;
@@ -31,7 +33,7 @@ describe('SearchTextInputComponent', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [SearchTextInputComponent] imports: [NoopAnimationsModule, SearchTextInputComponent, NoopTranslateModule]
}); });
fixture = TestBed.createComponent(SearchTextInputComponent); fixture = TestBed.createComponent(SearchTextInputComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
@@ -356,4 +358,37 @@ describe('SearchTextInputComponent', () => {
}); });
}); });
}); });
describe('Translations', () => {
beforeEach(fakeAsync(() => {
component.expandable = true;
component.showClearButton = true;
fixture.detectChanges();
component.subscriptAnimationState.value = 'active';
fixture.detectChanges();
tick(200);
}));
it('should contain correct translation key for search button tooltip', () => {
const searchButton = testingUtils.getByCSS('#adf-search-button');
expect(searchButton.nativeElement.getAttribute('title')).toBe('CORE.SEARCH.BUTTON.TOOLTIP');
});
it('should contain correct translation key for search button aria-label', () => {
const searchButton = testingUtils.getByCSS('#adf-search-button');
// eslint-disable-next-line @alfresco/eslint-angular/no-angular-material-selectors
const searchIcon = searchButton.nativeElement.querySelector('mat-icon');
expect(searchIcon.getAttribute('aria-label')).toBe('CORE.SEARCH.BUTTON.ARIA-LABEL');
});
it('should contain correct translation key for search input aria-label', () => {
const searchInput = testingUtils.getByCSS('#adf-control-input');
expect(searchInput.nativeElement.getAttribute('aria-label')).toBe('CORE.SEARCH.INPUT.ARIA-LABEL');
});
it('should contain correct translation key for clear button title', () => {
const clearButton = testingUtils.getByDataAutomationId('adf-clear-search-button');
expect(clearButton.nativeElement.getAttribute('title')).toBe('CORE.SEARCH.FILTER.BUTTONS.CLOSE');
});
});
}); });
@@ -1,110 +1,118 @@
<div *ngIf="isLoading" class="adf-viewer-render-main-loader"> @if (isLoading) {
<div class="adf-viewer-render-layout-content adf-viewer__fullscreen-container"> <div class="adf-viewer-render-main-loader">
<div class="adf-viewer-render-content-container"> <div class="adf-viewer-render-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-render__loading-screen"> <div class="adf-viewer-render-content-container">
<h2 id="loading-spinner-label">{{ 'ADF_VIEWER.LOADING' | translate }}</h2> <div class="adf-viewer-render__loading-screen">
<div> <h2 id="loading-spinner-label">{{ 'ADF_VIEWER.LOADING' | translate }}</h2>
<mat-spinner aria-labelledby="loading-spinner-label" <div>
class="adf-viewer-render__loading-screen__spinner" /> <mat-spinner aria-labelledby="loading-spinner-label" class="adf-viewer-render__loading-screen__spinner" />
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> }
@if (urlFile || blobFile) { @if (urlFile || blobFile) {
<div [style.visibility]="isLoading ? 'hidden' : 'visible'" class="adf-viewer-render-main"> <div [style.visibility]="isLoading ? 'hidden' : 'visible'" class="adf-viewer-render-main">
<div class="adf-viewer-render-layout-content adf-viewer__fullscreen-container"> <div class="adf-viewer-render-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-render-content-container" [ngSwitch]="viewerType"> <div class="adf-viewer-render-content-container">
<ng-container *ngSwitchCase="'external'"> @switch (viewerType) {
<adf-preview-extension @case ('external') {
*ngIf="!!externalViewer" @if (!!externalViewer) {
[id]="externalViewer.component" <adf-preview-extension
[url]="urlFile" [id]="externalViewer.component"
[extension]="externalViewer.fileExtension" [url]="urlFile"
[nodeId]="nodeId" [extension]="externalViewer.fileExtension"
[attr.data-automation-id]="externalViewer.component" [nodeId]="nodeId"
(contentLoaded)="markAsLoaded()" [attr.data-automation-id]="externalViewer.component"
/> (contentLoaded)="markAsLoaded()"
</ng-container>
<ng-container *ngSwitchCase="'pdf'">
<adf-pdf-viewer
[thumbnailsTemplate]="thumbnailsTemplate"
[allowThumbnails]="allowThumbnails"
[blobFile]="blobFile"
[urlFile]="urlFile"
[fileName]="internalFileName"
[cacheType]="cacheTypeForContent"
(pagesLoaded)="markAsLoaded()"
(close)="onClose()"
(error)="onUnsupportedFile()"
/>
</ng-container>
<ng-container *ngSwitchCase="'image'">
<adf-img-viewer
[urlFile]="urlFile"
[readOnly]="readOnly"
[fileName]="internalFileName"
[allowedEditActions]="allowedEditActions"
[blobFile]="blobFile"
(error)="onUnsupportedFile()"
(submit)="onSubmitFile($event)"
(imageLoaded)="markAsLoaded()"
(isSaving)="isSaving.emit($event)"
/>
</ng-container>
<ng-container *ngSwitchCase="'media'">
<adf-media-player
id="adf-mdedia-player"
[urlFile]="urlFile"
[tracks]="tracks"
[mimeType]="mimeType"
[blobFile]="blobFile"
[fileName]="internalFileName"
(error)="onUnsupportedFile()"
(canPlay)="markAsLoaded()"
/>
</ng-container>
<ng-container *ngSwitchCase="'text'">
<adf-txt-viewer [urlFile]="urlFile" [blobFile]="blobFile" (contentLoaded)="markAsLoaded()" />
</ng-container>
<ng-container *ngSwitchCase="'custom'">
<ng-container *ngFor="let ext of viewerExtensions">
<adf-preview-extension
*ngIf="checkExtensions(ext.fileExtension)"
[id]="ext.component"
[url]="urlFile"
[extension]="extension"
[nodeId]="nodeId"
[attr.data-automation-id]="ext.component"
(contentLoaded)="markAsLoaded()"
/>
</ng-container>
<ng-container *ngFor="let extensionTemplate of extensionTemplates">
<span *ngIf="extensionTemplate.isVisible" class="adf-viewer-render-custom-content">
<ng-template
[ngTemplateOutlet]="extensionTemplate.template"
[ngTemplateOutletContext]="{ urlFile: urlFile, extension: extension, markAsLoaded: markAsLoaded.bind(this) }"
/> />
</span> }
</ng-container> }
</ng-container>
<ng-container *ngSwitchDefault> @case ('pdf') {
<adf-viewer-unknown-format [customError]="customError" /> <adf-pdf-viewer
</ng-container> [thumbnailsTemplate]="thumbnailsTemplate"
[allowThumbnails]="allowThumbnails"
[blobFile]="blobFile"
[urlFile]="urlFile"
[fileName]="internalFileName"
[cacheType]="cacheTypeForContent"
(pagesLoaded)="markAsLoaded()"
(close)="onClose()"
(error)="onUnsupportedFile()"
/>
}
@case ('image') {
<adf-img-viewer
[urlFile]="urlFile"
[readOnly]="readOnly"
[fileName]="internalFileName"
[allowedEditActions]="allowedEditActions"
[blobFile]="blobFile"
(error)="onUnsupportedFile()"
(submit)="onSubmitFile($event)"
(imageLoaded)="markAsLoaded()"
(isSaving)="isSaving.emit($event)"
/>
}
@case ('media') {
<adf-media-player
id="adf-mdedia-player"
[urlFile]="urlFile"
[tracks]="tracks"
[mimeType]="mimeType"
[blobFile]="blobFile"
[fileName]="internalFileName"
(error)="onUnsupportedFile()"
(canPlay)="markAsLoaded()"
/>
}
@case ('text') {
<adf-txt-viewer [urlFile]="urlFile" [blobFile]="blobFile" (contentLoaded)="markAsLoaded()" />
}
@case ('custom') {
@for (ext of viewerExtensions; track ext.id) {
@if (checkExtensions(ext.fileExtension)) {
<adf-preview-extension
[id]="ext.component"
[url]="urlFile"
[extension]="extension"
[nodeId]="nodeId"
[attr.data-automation-id]="ext.component"
(contentLoaded)="markAsLoaded()"
/>
}
}
<ng-container *ngFor="let extensionTemplate of extensionTemplates">
@if (extensionTemplate.isVisible) {
<span class="adf-viewer-render-custom-content">
<ng-template
[ngTemplateOutlet]="extensionTemplate.template"
[ngTemplateOutletContext]="{ urlFile: urlFile, extension: extension, markAsLoaded: markAsLoaded.bind(this) }"
/>
</span>
}
</ng-container>
}
@default {
<adf-viewer-unknown-format [customError]="customError" />
}
}
</div> </div>
</div> </div>
</div> </div>
} }
<ng-container *ngIf="viewerTemplateExtensions">
@if (viewerTemplateExtensions) {
<ng-template [ngTemplateOutlet]="viewerTemplateExtensions" <ng-template [ngTemplateOutlet]="viewerTemplateExtensions"
[ngTemplateOutletContext]="{ urlFile: urlFile, extension: extension, markAsLoaded: markAsLoaded.bind(this) }" [ngTemplateOutletContext]="{ urlFile: urlFile, extension: extension, markAsLoaded: markAsLoaded.bind(this) }"
[ngTemplateOutletInjector]="injector" /> [ngTemplateOutletInjector]="injector" />
</ng-container> }
@@ -15,8 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { AppExtensionService, ExtensionsModule, ViewerExtensionRef } from '@alfresco/adf-extensions'; import { AppExtensionService, ExtensionsModule, ViewerExtensionRef, PreviewExtensionComponent } from '@alfresco/adf-extensions';
import { NgForOf, NgIf, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet } from '@angular/common'; import { NgForOf, NgTemplateOutlet } from '@angular/common';
import { Component, EventEmitter, Injector, Input, OnChanges, OnInit, Output, TemplateRef, ViewEncapsulation } from '@angular/core'; import { Component, EventEmitter, Injector, Input, OnChanges, OnInit, Output, TemplateRef, ViewEncapsulation } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
@@ -38,9 +38,6 @@ import { UnknownFormatComponent } from '../unknown-format/unknown-format.compone
imports: [ imports: [
TranslatePipe, TranslatePipe,
MatProgressSpinnerModule, MatProgressSpinnerModule,
NgSwitch,
NgSwitchCase,
NgIf,
PdfViewerComponent, PdfViewerComponent,
ImgViewerComponent, ImgViewerComponent,
MediaPlayerComponent, MediaPlayerComponent,
@@ -49,7 +46,7 @@ import { UnknownFormatComponent } from '../unknown-format/unknown-format.compone
UnknownFormatComponent, UnknownFormatComponent,
ExtensionsModule, ExtensionsModule,
NgForOf, NgForOf,
NgSwitchDefault PreviewExtensionComponent
], ],
providers: [ViewUtilService] providers: [ViewUtilService]
}) })
+5 -15
View File
@@ -15,36 +15,26 @@
* limitations under the License. * limitations under the License.
*/ */
import { DynamicExtensionComponent } from './components/dynamic-component/dynamic.component';
import { DynamicTabComponent } from './components/dynamic-tab/dynamic-tab.component';
import { DynamicColumnComponent } from './components/dynamic-column/dynamic-column.component';
import { PreviewExtensionComponent } from './components/viewer/preview-extension.component';
import { NgModule, ModuleWithProviders, inject, provideAppInitializer } from '@angular/core'; import { NgModule, ModuleWithProviders, inject, provideAppInitializer } from '@angular/core';
import { AppExtensionService } from './services/app-extension.service'; import { AppExtensionService } from './services/app-extension.service';
import { setupExtensions } from './services/startup-extension-factory';
export const EXTENSION_DIRECTIVES = [DynamicExtensionComponent, DynamicTabComponent, DynamicColumnComponent, PreviewExtensionComponent] as const; /** @deprecated use provideAppExtensions() api instead */
@NgModule()
/** @deprecated import EXTENSION_DIRECTIVES or standalone components instead */
@NgModule({
imports: [...EXTENSION_DIRECTIVES],
exports: [...EXTENSION_DIRECTIVES]
})
export class ExtensionsModule { export class ExtensionsModule {
static forRoot(): ModuleWithProviders<ExtensionsModule> { static forRoot(): ModuleWithProviders<ExtensionsModule> {
return { return {
ngModule: ExtensionsModule, ngModule: ExtensionsModule,
providers: [ providers: [
provideAppInitializer(() => { provideAppInitializer(() => {
const initializerFn = setupExtensions(inject(AppExtensionService)); const appExtensionService = inject(AppExtensionService);
return initializerFn(); return appExtensionService.load();
}) })
] ]
}; };
} }
/** /**
* @deprecated use `ExtensionsModule` instead, `EXTENSION_DIRECTIVES` or direct standalone components * @deprecated use provideAppExtensions() api instead
* @returns Module with providers * @returns Module with providers
*/ */
static forChild(): ModuleWithProviders<ExtensionsModule> { static forChild(): ModuleWithProviders<ExtensionsModule> {
@@ -15,12 +15,18 @@
* limitations under the License. * limitations under the License.
*/ */
import { NgModule } from '@angular/core'; import { EnvironmentProviders, inject, provideAppInitializer, Provider } from '@angular/core';
import { AppConfigPipe } from './app-config.pipe'; import { AppExtensionService } from './services/app-extension.service';
/** @deprecated This module is deprecated, consider importing AppConfigPipe directly */ /**
@NgModule({ * Provides all necessary entries for the app extensibility
imports: [AppConfigPipe], * @returns list of providers
exports: [AppConfigPipe] */
}) export function provideAppExtensions(): (Provider | EnvironmentProviders)[] {
export class AppConfigModule {} return [
provideAppInitializer(() => {
const appExtensionService = inject(AppExtensionService);
return appExtensionService.load();
})
];
}
@@ -1,20 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AppExtensionService } from './app-extension.service';
export const setupExtensions = (appExtensionService: AppExtensionService) => () => appExtensionService.load();
+1
View File
@@ -41,3 +41,4 @@ export * from './lib/store/states/repository.state';
export * from './lib/components/public-api'; export * from './lib/components/public-api';
export * from './lib/extensions.module'; export * from './lib/extensions.module';
export * from './lib/providers';
+1 -1
View File
@@ -5,7 +5,7 @@ export default {
testEnvironment: 'jsdom', testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'], setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../coverage/libs/js-api', coverageDirectory: '../../../coverage/libs/js-api',
moduleMNameMapper: { moduleNameMapper: {
'^pdfjs-dist$': 'pdfjs-dist/legacy/build/pdf' '^pdfjs-dist$': 'pdfjs-dist/legacy/build/pdf'
}, },
transform: { transform: {
+2 -2
View File
@@ -15,5 +15,5 @@
* limitations under the License. * limitations under the License.
*/ */
import 'jest-preset-angular/setup-jest'; import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
import 'resize-observer-polyfill/dist/ResizeObserver.global'; setupZoneTestEnv();
@@ -13,7 +13,6 @@
overflow-x: auto; overflow-x: auto;
resize: vertical; resize: vertical;
border-radius: 3px; border-radius: 3px;
padding: 10px 12px;
outline: none; outline: none;
width: 100%; width: 100%;
} }
-1118
View File
File diff suppressed because it is too large Load Diff
-9
View File
@@ -149,12 +149,8 @@
"moment": "^2.29.4", "moment": "^2.29.4",
"ng-packagr": "19.2.2", "ng-packagr": "19.2.2",
"nock": "13.5.5", "nock": "13.5.5",
"npm-run-all": "^4.1.5",
"nx": "20.8.0", "nx": "20.8.0",
"postcss": "8.5.4",
"postcss-sass": "^0.5.0",
"prettier": "3.6.2", "prettier": "3.6.2",
"resize-observer-polyfill": "^1.5.1",
"rimraf": "6.0.1", "rimraf": "6.0.1",
"sass-loader": "16.0.5", "sass-loader": "16.0.5",
"shelljs": "^0.8.5", "shelljs": "^0.8.5",
@@ -163,18 +159,13 @@
"stylelint": "16.20.0", "stylelint": "16.20.0",
"stylelint-config-standard-scss": "^13.1.0", "stylelint-config-standard-scss": "^13.1.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"tsconfig-paths": "^4.1.1",
"typescript": "5.8.2", "typescript": "5.8.2",
"webdriver-manager": "12.1.9",
"webpack": "5.98.0", "webpack": "5.98.0",
"webpack-cli": "^5.1.4" "webpack-cli": "^5.1.4"
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"
},
"overrides": {
"stylus": "github:stylus/stylus#0.64.0"
}, },
"module": "./index.js", "module": "./index.js",
"typings": "./index.d.ts" "typings": "./index.d.ts"
+171 -62
View File
@@ -1,15 +1,39 @@
"use strict"; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); /*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.MDNav = void 0; exports.MDNav = void 0;
var MDNav = /** @class */ (function () { var MDNav = /** @class */ (function () {
function MDNav(root, pos) { function MDNav(root, pos) {
if (pos === void 0) { pos = 0; } if (pos === void 0) {
pos = 0;
}
this.root = root; this.root = root;
this.pos = pos; this.pos = pos;
} }
MDNav.prototype.find = function (test, index) { MDNav.prototype.find = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
if (!this.root || !this.root.children) { if (!this.root || !this.root.children) {
return new MDNav(null); return new MDNav(null);
} }
@@ -19,8 +43,7 @@ var MDNav = /** @class */ (function () {
if (test(child)) { if (test(child)) {
if (currIndex === index) { if (currIndex === index) {
return new MDNav(this.root, i); return new MDNav(this.root, i);
} } else {
else {
currIndex++; currIndex++;
} }
} }
@@ -28,8 +51,14 @@ var MDNav = /** @class */ (function () {
return new MDNav(this.root, this.root.children.length); return new MDNav(this.root, this.root.children.length);
}; };
MDNav.prototype.findAll = function (test, index) { MDNav.prototype.findAll = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
if (!this.root || !this.root.children) { if (!this.root || !this.root.children) {
return []; return [];
} }
@@ -40,8 +69,7 @@ var MDNav = /** @class */ (function () {
if (test(child)) { if (test(child)) {
if (currIndex === index) { if (currIndex === index) {
result.push(new MDNav(this.root, i)); result.push(new MDNav(this.root, i));
} } else {
else {
currIndex++; currIndex++;
} }
} }
@@ -49,166 +77,247 @@ var MDNav = /** @class */ (function () {
return result; return result;
}; };
MDNav.prototype.emph = function (test, index) { MDNav.prototype.emph = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'emphasis' && test(h); return h.type === 'emphasis' && test(h);
}, index); }, index);
}; };
MDNav.prototype.heading = function (test, index) { MDNav.prototype.heading = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'heading' && test(h); return h.type === 'heading' && test(h);
}, index); }, index);
}; };
MDNav.prototype.headings = function (test, index) { MDNav.prototype.headings = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.findAll(function (h) { return this.findAll(function (h) {
return h.type === 'heading' && test(h); return h.type === 'heading' && test(h);
}, index); }, index);
}; };
MDNav.prototype.html = function (test, index) { MDNav.prototype.html = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'html' && test(h); return h.type === 'html' && test(h);
}, index); }, index);
}; };
MDNav.prototype.link = function (test, index) { MDNav.prototype.link = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'link' && test(h); return h.type === 'link' && test(h);
}, index); }, index);
}; };
MDNav.prototype.links = function (test, index) { MDNav.prototype.links = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.findAll(function (h) { return this.findAll(function (h) {
return h.type === 'link' && test(h); return h.type === 'link' && test(h);
}, index); }, index);
}; };
MDNav.prototype.list = function (test, index) { MDNav.prototype.list = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'list' && test(h); return h.type === 'list' && test(h);
}, index); }, index);
}; };
MDNav.prototype.listItem = function (test, index) { MDNav.prototype.listItem = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'listItem' && test(h); return h.type === 'listItem' && test(h);
}, index); }, index);
}; };
MDNav.prototype.listItems = function (test, index) { MDNav.prototype.listItems = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.findAll(function (h) { return this.findAll(function (h) {
return h.type === 'listItem' && test(h); return h.type === 'listItem' && test(h);
}, index); }, index);
}; };
MDNav.prototype.paragraph = function (test, index) { MDNav.prototype.paragraph = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'paragraph' && test(h); return h.type === 'paragraph' && test(h);
}, index); }, index);
}; };
MDNav.prototype.strong = function (test, index) { MDNav.prototype.strong = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'strong' && test(h); return h.type === 'strong' && test(h);
}, index); }, index);
}; };
MDNav.prototype.table = function (test, index) { MDNav.prototype.table = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'table' && test(h); return h.type === 'table' && test(h);
}, index); }, index);
}; };
MDNav.prototype.tableRow = function (test, index) { MDNav.prototype.tableRow = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'tableRow' && test(h); return h.type === 'tableRow' && test(h);
}, index); }, index);
}; };
MDNav.prototype.tableCell = function (test, index) { MDNav.prototype.tableCell = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'tableCell' && test(h); return h.type === 'tableCell' && test(h);
}, index); }, index);
}; };
MDNav.prototype.text = function (test, index) { MDNav.prototype.text = function (test, index) {
if (test === void 0) { test = function () { return true; }; } if (test === void 0) {
if (index === void 0) { index = 0; } test = function () {
return true;
};
}
if (index === void 0) {
index = 0;
}
return this.find(function (h) { return this.find(function (h) {
return h.type === 'text' && test(h); return h.type === 'text' && test(h);
}, index); }, index);
}; };
Object.defineProperty(MDNav.prototype, "item", { Object.defineProperty(MDNav.prototype, 'item', {
get: function () { get: function () {
if (!this.root || !this.root.children) { if (!this.root || !this.root.children) {
return undefined; return undefined;
} } else {
else {
return this.root.children[this.pos]; return this.root.children[this.pos];
} }
}, },
enumerable: false, enumerable: false,
configurable: true configurable: true
}); });
Object.defineProperty(MDNav.prototype, "empty", { Object.defineProperty(MDNav.prototype, 'empty', {
get: function () { get: function () {
return !this.root || return !this.root || !this.root.children || this.pos >= this.root.children.length;
!this.root.children ||
(this.pos >= this.root.children.length);
}, },
enumerable: false, enumerable: false,
configurable: true configurable: true
}); });
Object.defineProperty(MDNav.prototype, "childNav", { Object.defineProperty(MDNav.prototype, 'childNav', {
get: function () { get: function () {
return new MDNav(this.item); return new MDNav(this.item);
}, },
enumerable: false, enumerable: false,
configurable: true configurable: true
}); });
Object.defineProperty(MDNav.prototype, "value", { Object.defineProperty(MDNav.prototype, 'value', {
get: function () { get: function () {
if (this.item && this.item['value']) { if (this.item && this.item['value']) {
return this.item.value; return this.item.value;
} } else {
else {
return ''; return '';
} }
}, },
enumerable: false, enumerable: false,
configurable: true configurable: true
}); });
Object.defineProperty(MDNav.prototype, "textValue", { Object.defineProperty(MDNav.prototype, 'textValue', {
get: function () { get: function () {
if (this.item) { if (this.item) {
if (this.item['value']) { if (this.item['value']) {
return this.item.value; return this.item.value;
} } else if (this.item.children && this.item.children.length > 0 && this.item.children[0].type === 'text') {
else if (this.item.children &&
(this.item.children.length > 0) &&
(this.item.children[0].type === 'text')) {
return this.item.children[0].value; return this.item.children[0].value;
} } else {
else {
return ''; return '';
} }
} } else {
else {
return ''; return '';
} }
}, },
@@ -216,5 +325,5 @@ var MDNav = /** @class */ (function () {
configurable: true configurable: true
}); });
return MDNav; return MDNav;
}()); })();
exports.MDNav = MDNav; exports.MDNav = MDNav;
+131 -71
View File
@@ -1,24 +1,59 @@
"use strict"; 'use strict';
var __extends = (this && this.__extends) || (function () { /*!
var extendStatics = function (d, b) { * @license
extendStatics = Object.setPrototypeOf || * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || *
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; * Licensed under the Apache License, Version 2.0 (the "License");
return extendStatics(d, b); * you may not use this file except in compliance with the License.
}; * You may obtain a copy of the License at
return function (d, b) { *
if (typeof b !== "function" && b !== null) * http://www.apache.org/licenses/LICENSE-2.0
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); *
extendStatics(d, b); * Unless required by applicable law or agreed to in writing, software
function __() { this.constructor = d; } * distributed under the License is distributed on an "AS IS" BASIS,
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
}; * See the License for the specific language governing permissions and
})(); * limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true }); */
exports.Docset = exports.Text = exports.Link = exports.Paragraph = exports.Heading = exports.Root = exports.Parent = exports.Node = exports.schema = void 0; var __extends =
var mdToString = require("mdast-util-to-string"); (this && this.__extends) ||
var jsyaml = require("js-yaml"); (function () {
exports.schema = "\n type Query {\n documents(idFilter: String = \"\"): [Root]\n }\n\n type Root {\n id: ID\n type: String\n folder(depth: Int = 1): String\n metadata(key: String): String\n heading(depth: Int = 0): Heading\n headings(depth: Int = 0): [Heading]\n paragraph: Paragraph\n paragraphs: [Paragraph]\n link: Link\n links: [Link]\n text: Text\n texts: [Text]\n children: [Node]\n }\n\n type Heading {\n depth: Int\n plaintext: String\n paragraph: Paragraph\n paragraphs: [Paragraph]\n link: Link\n links: [Link]\n children: [Node]\n }\n\n type Paragraph {\n plaintext: String\n }\n\n type Link {\n plaintext: String\n title: String\n url: String\n paragraph: Paragraph\n paragraphs: [Paragraph]\n text: Text\n texts: [Text]\n }\n\n type Text {\n value: String\n }\n\n type Node {\n type: String\n children: [Node]\n }\n"; 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 (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 __());
};
})();
Object.defineProperty(exports, '__esModule', { value: true });
exports.Docset =
exports.Text =
exports.Link =
exports.Paragraph =
exports.Heading =
exports.Root =
exports.Parent =
exports.Node =
exports.schema =
void 0;
var mdast_util_to_string_1 = require('mdast-util-to-string');
var jsyaml = require('js-yaml');
exports.schema =
'\n type Query {\n documents(idFilter: String = ""): [Root]\n }\n\n type Root {\n id: ID\n type: String\n folder(depth: Int = 1): String\n metadata(key: String): String\n heading(depth: Int = 0): Heading\n headings(depth: Int = 0): [Heading]\n paragraph: Paragraph\n paragraphs: [Paragraph]\n link: Link\n links: [Link]\n text: Text\n texts: [Text]\n children: [Node]\n }\n\n type Heading {\n depth: Int\n plaintext: String\n paragraph: Paragraph\n paragraphs: [Paragraph]\n link: Link\n links: [Link]\n children: [Node]\n }\n\n type Paragraph {\n plaintext: String\n }\n\n type Link {\n plaintext: String\n title: String\n url: String\n paragraph: Paragraph\n paragraphs: [Paragraph]\n text: Text\n texts: [Text]\n }\n\n type Text {\n value: String\n }\n\n type Node {\n type: String\n children: [Node]\n }\n';
var Node = /** @class */ (function () { var Node = /** @class */ (function () {
function Node(orig) { function Node(orig) {
this.orig = orig; this.orig = orig;
@@ -52,56 +87,78 @@ var Node = /** @class */ (function () {
}; };
Node.prototype.children = function () { Node.prototype.children = function () {
if (this.orig['children']) { if (this.orig['children']) {
return this.orig['children'].map(function (x) { return new Node(x); }); return this.orig['children'].map(function (x) {
} return new Node(x);
else { });
} else {
return null; return null;
} }
}; };
return Node; return Node;
}()); })();
exports.Node = Node; exports.Node = Node;
var Parent = /** @class */ (function () { var Parent = /** @class */ (function () {
function Parent(orig) { function Parent(orig) {
this.orig = orig; this.orig = orig;
} }
Parent.prototype.plaintext = function () { Parent.prototype.plaintext = function () {
return mdToString(this.orig); return (0, mdast_util_to_string_1.toString)(this.orig);
}; };
Parent.prototype.paragraph = function () { Parent.prototype.paragraph = function () {
return new Paragraph(this.orig.children.find(function (ch) { return (ch.type === 'paragraph'); })); return new Paragraph(
this.orig.children.find(function (ch) {
return ch.type === 'paragraph';
})
);
}; };
Parent.prototype.paragraphs = function () { Parent.prototype.paragraphs = function () {
return this.orig.children.filter(function (ch) { return this.orig.children
return (ch.type === 'paragraph'); .filter(function (ch) {
}) return ch.type === 'paragraph';
.map(function (ch) { return new Paragraph(ch); }); })
.map(function (ch) {
return new Paragraph(ch);
});
}; };
Parent.prototype.link = function () { Parent.prototype.link = function () {
return new Link(this.orig.children.find(function (ch) { return (ch.type === 'link'); })); return new Link(
this.orig.children.find(function (ch) {
return ch.type === 'link';
})
);
}; };
Parent.prototype.links = function () { Parent.prototype.links = function () {
return this.orig.children.filter(function (ch) { return this.orig.children
return (ch.type === 'link'); .filter(function (ch) {
}) return ch.type === 'link';
.map(function (ch) { return new Link(ch); }); })
.map(function (ch) {
return new Link(ch);
});
}; };
Parent.prototype.text = function () { Parent.prototype.text = function () {
return new Text(this.orig.children.find(function (ch) { return (ch.type === 'text'); })); return new Text(
this.orig.children.find(function (ch) {
return ch.type === 'text';
})
);
}; };
Parent.prototype.texts = function () { Parent.prototype.texts = function () {
return this.orig.children.filter(function (ch) { return this.orig.children
return (ch.type === 'text'); .filter(function (ch) {
}) return ch.type === 'text';
.map(function (ch) { return new Text(ch); }); })
.map(function (ch) {
return new Text(ch);
});
}; };
return Parent; return Parent;
}()); })();
exports.Parent = Parent; exports.Parent = Parent;
var Root = /** @class */ (function (_super) { var Root = /** @class */ (function (_super) {
__extends(Root, _super); __extends(Root, _super);
function Root() { function Root() {
return _super !== null && _super.apply(this, arguments) || this; return (_super !== null && _super.apply(this, arguments)) || this;
} }
Root.prototype.type = function () { Root.prototype.type = function () {
return 'root'; return 'root';
@@ -114,62 +171,65 @@ var Root = /** @class */ (function (_super) {
}; };
Root.prototype.metadata = function (args) { Root.prototype.metadata = function (args) {
if (!this._meta) { if (!this._meta) {
var yamlElement = this.orig.children.find(function (ch) { return (ch.type === 'yaml'); }); var yamlElement = this.orig.children.find(function (ch) {
return ch.type === 'yaml';
});
if (yamlElement) { if (yamlElement) {
this._meta = jsyaml.safeLoad(yamlElement.value); this._meta = jsyaml.safeLoad(yamlElement.value);
} } else {
else {
this._meta = {}; this._meta = {};
} }
} }
if (this._meta[args['key']]) { if (this._meta[args['key']]) {
return this._meta[args['key']]; return this._meta[args['key']];
} } else {
else {
return ''; return '';
} }
}; };
Root.prototype.heading = function (args) { Root.prototype.heading = function (args) {
var depth = args['depth']; var depth = args['depth'];
return new Heading(this.orig.children.find(function (ch) { return new Heading(
return (ch.type === 'heading') && this.orig.children.find(function (ch) {
((depth === 0) || (depth === ch.depth)); return ch.type === 'heading' && (depth === 0 || depth === ch.depth);
})); })
);
}; };
Root.prototype.headings = function (args) { Root.prototype.headings = function (args) {
var depth = args['depth']; var depth = args['depth'];
return this.orig.children.filter(function (ch) { return this.orig.children
return (ch.type === 'heading') && .filter(function (ch) {
((depth === 0) || (depth === ch.depth)); return ch.type === 'heading' && (depth === 0 || depth === ch.depth);
}) })
.map(function (ch) { return new Heading(ch); }); .map(function (ch) {
return new Heading(ch);
});
}; };
return Root; return Root;
}(Parent)); })(Parent);
exports.Root = Root; exports.Root = Root;
var Heading = /** @class */ (function (_super) { var Heading = /** @class */ (function (_super) {
__extends(Heading, _super); __extends(Heading, _super);
function Heading() { function Heading() {
return _super !== null && _super.apply(this, arguments) || this; return (_super !== null && _super.apply(this, arguments)) || this;
} }
Heading.prototype.depth = function () { Heading.prototype.depth = function () {
return this.orig.depth; return this.orig.depth;
}; };
return Heading; return Heading;
}(Parent)); })(Parent);
exports.Heading = Heading; exports.Heading = Heading;
var Paragraph = /** @class */ (function (_super) { var Paragraph = /** @class */ (function (_super) {
__extends(Paragraph, _super); __extends(Paragraph, _super);
function Paragraph() { function Paragraph() {
return _super !== null && _super.apply(this, arguments) || this; return (_super !== null && _super.apply(this, arguments)) || this;
} }
return Paragraph; return Paragraph;
}(Parent)); })(Parent);
exports.Paragraph = Paragraph; exports.Paragraph = Paragraph;
var Link = /** @class */ (function (_super) { var Link = /** @class */ (function (_super) {
__extends(Link, _super); __extends(Link, _super);
function Link() { function Link() {
return _super !== null && _super.apply(this, arguments) || this; return (_super !== null && _super.apply(this, arguments)) || this;
} }
Link.prototype.title = function () { Link.prototype.title = function () {
return this.orig.title; return this.orig.title;
@@ -178,7 +238,7 @@ var Link = /** @class */ (function (_super) {
return this.orig.url; return this.orig.url;
}; };
return Link; return Link;
}(Parent)); })(Parent);
exports.Link = Link; exports.Link = Link;
var Text = /** @class */ (function () { var Text = /** @class */ (function () {
function Text(orig) { function Text(orig) {
@@ -188,7 +248,7 @@ var Text = /** @class */ (function () {
return this.orig.value; return this.orig.value;
}; };
return Text; return Text;
}()); })();
exports.Text = Text; exports.Text = Text;
var libNamesRegex = /content-services|core|extensions|insights|process-services|process-services-cloud/; var libNamesRegex = /content-services|core|extensions|insights|process-services|process-services-cloud/;
var Docset = /** @class */ (function () { var Docset = /** @class */ (function () {
@@ -197,8 +257,7 @@ var Docset = /** @class */ (function () {
this.docs = []; this.docs = [];
var pathnames = Object.keys(mdCache); var pathnames = Object.keys(mdCache);
pathnames.forEach(function (pathname) { pathnames.forEach(function (pathname) {
if (!pathname.match(/README/) && if (!pathname.match(/README/) && pathname.match(libNamesRegex)) {
pathname.match(libNamesRegex)) {
var doc = new Root(mdCache[pathname].mdInTree); var doc = new Root(mdCache[pathname].mdInTree);
doc.id = pathname.replace(/\\/g, '/'); doc.id = pathname.replace(/\\/g, '/');
_this.docs.push(doc); _this.docs.push(doc);
@@ -208,14 +267,15 @@ var Docset = /** @class */ (function () {
Docset.prototype.documents = function (args) { Docset.prototype.documents = function (args) {
if (args['idFilter'] === '') { if (args['idFilter'] === '') {
return this.docs; return this.docs;
} } else {
else { return this.docs.filter(function (doc) {
return this.docs.filter(function (doc) { return doc.id.indexOf(args['idFilter'] + '/') !== -1; }); return doc.id.indexOf(args['idFilter'] + '/') !== -1;
});
} }
}; };
Docset.prototype.size = function () { Docset.prototype.size = function () {
return this.docs.length; return this.docs.length;
}; };
return Docset; return Docset;
}()); })();
exports.Docset = Docset; exports.Docset = Docset;
+57 -30
View File
@@ -1,11 +1,23 @@
"use strict"; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); /*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.ComponentInfo = exports.MethodSigInfo = exports.ParamInfo = exports.PropInfo = void 0; exports.ComponentInfo = exports.MethodSigInfo = exports.ParamInfo = exports.PropInfo = void 0;
var skipMethodNames = [ var skipMethodNames = ['ngOnChanges', 'ngOnDestroy', 'ngOnInit'];
'ngOnChanges',
'ngOnDestroy',
'ngOnInit'
];
var PropInfo = /** @class */ (function () { var PropInfo = /** @class */ (function () {
function PropInfo(sourceData) { function PropInfo(sourceData) {
var _this = this; var _this = this;
@@ -19,7 +31,9 @@ var PropInfo = /** @class */ (function () {
this.type = sourceData.syntax['return'].type || ''; this.type = sourceData.syntax['return'].type || '';
this.type = this.type.toString().replace(/\|/, '\\|').replace('unknown', ''); this.type = this.type.toString().replace(/\|/, '\\|').replace('unknown', '');
if (sourceData.tags) { if (sourceData.tags) {
var depTag = sourceData.tags.find(function (tag) { return tag.name === 'deprecated'; }); var depTag = sourceData.tags.find(function (tag) {
return tag.name === 'deprecated';
});
if (depTag) { if (depTag) {
this.isDeprecated = true; this.isDeprecated = true;
this.docText = '(**Deprecated:** ' + depTag.text.replace(/[\n\r]+/g, ' ').trim() + ') ' + this.docText; this.docText = '(**Deprecated:** ' + depTag.text.replace(/[\n\r]+/g, ' ').trim() + ') ' + this.docText;
@@ -33,24 +47,24 @@ var PropInfo = /** @class */ (function () {
_this.isInput = true; _this.isInput = true;
if (dec.arguments) { if (dec.arguments) {
var bindingName = dec.arguments['bindingPropertyName']; var bindingName = dec.arguments['bindingPropertyName'];
if (bindingName && (bindingName !== '')) { if (bindingName && bindingName !== '') {
_this.name = bindingName.replace(/['"]/g, ''); _this.name = bindingName.replace(/['"]/g, '');
} }
} }
if (!_this.docText && !_this.isDeprecated) { if (!_this.docText && !_this.isDeprecated) {
_this.errorMessages.push("Error: Input \"".concat(sourceData.name, "\" has no doc text.")); _this.errorMessages.push('Error: Input "'.concat(sourceData.name, '" has no doc text.'));
} }
} }
if (dec.name === 'Output') { if (dec.name === 'Output') {
_this.isOutput = true; _this.isOutput = true;
if (!_this.docText && !_this.isDeprecated) { if (!_this.docText && !_this.isDeprecated) {
_this.errorMessages.push("Error: Output \"".concat(sourceData.name, "\" has no doc text.")); _this.errorMessages.push('Error: Output "'.concat(sourceData.name, '" has no doc text.'));
} }
} }
}); });
} }
} }
Object.defineProperty(PropInfo.prototype, "errors", { Object.defineProperty(PropInfo.prototype, 'errors', {
get: function () { get: function () {
return this.errorMessages; return this.errorMessages;
}, },
@@ -58,7 +72,7 @@ var PropInfo = /** @class */ (function () {
configurable: true configurable: true
}); });
return PropInfo; return PropInfo;
}()); })();
exports.PropInfo = PropInfo; exports.PropInfo = PropInfo;
var ParamInfo = /** @class */ (function () { var ParamInfo = /** @class */ (function () {
function ParamInfo(sourceData) { function ParamInfo(sourceData) {
@@ -68,7 +82,9 @@ var ParamInfo = /** @class */ (function () {
this.docText = sourceData.description.replace(/[\n\r]+/g, ' ').trim(); this.docText = sourceData.description.replace(/[\n\r]+/g, ' ').trim();
this.isOptional = false; this.isOptional = false;
if (sourceData.flags) { if (sourceData.flags) {
var flag = sourceData.flags.find(function (sourceFlag) { return sourceFlag.name === 'isOptional'; }); var flag = sourceData.flags.find(function (sourceFlag) {
return sourceFlag.name === 'isOptional';
});
if (flag) { if (flag) {
this.isOptional = true; this.isOptional = true;
} }
@@ -77,13 +93,13 @@ var ParamInfo = /** @class */ (function () {
if (this.isOptional) { if (this.isOptional) {
this.combined += '?'; this.combined += '?';
} }
this.combined += ": `".concat(this.type, "`"); this.combined += ': `'.concat(this.type, '`');
if (this.defaultValue !== '') { if (this.defaultValue !== '') {
this.combined += " = `".concat(this.defaultValue, "`"); this.combined += ' = `'.concat(this.defaultValue, '`');
} }
} }
return ParamInfo; return ParamInfo;
}()); })();
exports.ParamInfo = ParamInfo; exports.ParamInfo = ParamInfo;
var MethodSigInfo = /** @class */ (function () { var MethodSigInfo = /** @class */ (function () {
function MethodSigInfo(sourceData) { function MethodSigInfo(sourceData) {
@@ -93,21 +109,23 @@ var MethodSigInfo = /** @class */ (function () {
this.docText = sourceData.summary || ''; this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim(); this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
if (!this.docText && this.name.indexOf('service') > 0) { if (!this.docText && this.name.indexOf('service') > 0) {
this.errorMessages.push("Warning: method \"".concat(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 = sourceData.syntax['return'].type || '';
this.returnType = this.returnType.toString().replace(/\s/g, ''); this.returnType = this.returnType.toString().replace(/\s/g, '');
this.returnsSomething = this.returnType && (this.returnType !== 'void'); this.returnsSomething = this.returnType && this.returnType !== 'void';
this.returnDocText = sourceData.syntax['return'].summary || ''; this.returnDocText = sourceData.syntax['return'].summary || '';
if (this.returnDocText.toLowerCase() === 'nothing') { if (this.returnDocText.toLowerCase() === 'nothing') {
this.returnsSomething = false; this.returnsSomething = false;
} }
if (this.returnsSomething && !this.returnDocText && this.name.indexOf('service') > 0) { if (this.returnsSomething && !this.returnDocText && this.name.indexOf('service') > 0) {
this.errorMessages.push("Warning: Return value of method \"".concat(sourceData.name, "\" has no doc text.")); this.errorMessages.push('Warning: Return value of method "'.concat(sourceData.name, '" has no doc text.'));
} }
this.isDeprecated = false; this.isDeprecated = false;
if (sourceData.tags) { if (sourceData.tags) {
var depTag = sourceData.tags.find(function (tag) { return tag.name === 'deprecated'; }); var depTag = sourceData.tags.find(function (tag) {
return tag.name === 'deprecated';
});
if (depTag) { if (depTag) {
this.isDeprecated = true; this.isDeprecated = true;
this.docText = '(**Deprecated:** ' + depTag.text.replace(/[\n\r]+/g, ' ').trim() + ') ' + this.docText; this.docText = '(**Deprecated:** ' + depTag.text.replace(/[\n\r]+/g, ' ').trim() + ') ' + this.docText;
@@ -118,7 +136,9 @@ var MethodSigInfo = /** @class */ (function () {
if (sourceData.syntax.parameters) { if (sourceData.syntax.parameters) {
sourceData.syntax.parameters.forEach(function (rawParam) { sourceData.syntax.parameters.forEach(function (rawParam) {
if (rawParam.name && !rawParam.description && !rawParam.name.startWith('on')) { if (rawParam.name && !rawParam.description && !rawParam.name.startWith('on')) {
_this.errorMessages.push("Warning: parameter \"".concat(rawParam.name, "\" of method \"").concat(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); var param = new ParamInfo(rawParam);
_this.params.push(param); _this.params.push(param);
@@ -127,7 +147,7 @@ var MethodSigInfo = /** @class */ (function () {
} }
this.signature = '(' + paramStrings.join(', ') + ')'; this.signature = '(' + paramStrings.join(', ') + ')';
} }
Object.defineProperty(MethodSigInfo.prototype, "errors", { Object.defineProperty(MethodSigInfo.prototype, 'errors', {
get: function () { get: function () {
return this.errorMessages; return this.errorMessages;
}, },
@@ -135,7 +155,7 @@ var MethodSigInfo = /** @class */ (function () {
configurable: true configurable: true
}); });
return MethodSigInfo; return MethodSigInfo;
}()); })();
exports.MethodSigInfo = MethodSigInfo; exports.MethodSigInfo = MethodSigInfo;
var ComponentInfo = /** @class */ (function () { var ComponentInfo = /** @class */ (function () {
function ComponentInfo(sourceData) { function ComponentInfo(sourceData) {
@@ -166,10 +186,17 @@ var ComponentInfo = /** @class */ (function () {
} }
break; break;
case 'method': case 'method':
if (item.flags && (item.flags.length > 0) && if (
!item.flags.find(function (flag) { return flag.name === 'isPrivate'; }) && item.flags &&
!item.flags.find(function (flag) { return flag.name === 'isProtected'; }) && item.flags.length > 0 &&
!skipMethodNames.includes(item.name)) { !item.flags.find(function (flag) {
return flag.name === 'isPrivate';
}) &&
!item.flags.find(function (flag) {
return flag.name === 'isProtected';
}) &&
!skipMethodNames.includes(item.name)
) {
_this.methods.push(new MethodSigInfo(item)); _this.methods.push(new MethodSigInfo(item));
_this.hasMethods = true; _this.hasMethods = true;
} }
@@ -179,7 +206,7 @@ var ComponentInfo = /** @class */ (function () {
} }
}); });
} }
Object.defineProperty(ComponentInfo.prototype, "errors", { Object.defineProperty(ComponentInfo.prototype, 'errors', {
get: function () { get: function () {
var combinedErrors = []; var combinedErrors = [];
this.methods.forEach(function (method) { this.methods.forEach(function (method) {
@@ -198,5 +225,5 @@ var ComponentInfo = /** @class */ (function () {
configurable: true configurable: true
}); });
return ComponentInfo; return ComponentInfo;
}()); })();
exports.ComponentInfo = ComponentInfo; exports.ComponentInfo = ComponentInfo;
+37 -20
View File
@@ -1,11 +1,27 @@
"use strict"; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); /*!
exports.processDocs = void 0; * @license
var path = require("path"); * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
var fs = require("fs"); *
var unist_util_select_1 = require("unist-util-select"); * Licensed under the Apache License, Version 2.0 (the "License");
var lev = require("fast-levenshtein"); * you may not use this file except in compliance with the License.
var ngHelpers = require("../ngHelpers"); * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var path = require('path');
var fs = require('fs');
var unist_util_select_1 = require('unist-util-select');
var lev = require('fast-levenshtein');
var ngHelpers = require('../ngHelpers');
var imageFolderPath = path.resolve('docs', 'docassets', 'images'); var imageFolderPath = path.resolve('docs', 'docassets', 'images');
// Using this value for the edit distance between Markdown image URLs // Using this value for the edit distance between Markdown image URLs
// and filenames is enough to trap errors like missing out the 'images' // and filenames is enough to trap errors like missing out the 'images'
@@ -27,8 +43,7 @@ function processDocs(mdCache, aggData) {
if (!filterFilepath(filters, pathname)) { if (!filterFilepath(filters, pathname)) {
classlessDocs.push(pathname); classlessDocs.push(pathname);
} }
} } else {
else {
var linkElems = (0, unist_util_select_1.selectAll)('link', tree); var linkElems = (0, unist_util_select_1.selectAll)('link', tree);
linkElems.forEach(function (linkElem) { linkElems.forEach(function (linkElem) {
var normUrl = normaliseLinkPath(pathname, linkElem.url); var normUrl = normaliseLinkPath(pathname, linkElem.url);
@@ -46,11 +61,11 @@ function processDocs(mdCache, aggData) {
}); });
classlessDocs.forEach(function (docPath) { classlessDocs.forEach(function (docPath) {
var relDocPath = docPath.substring(docPath.indexOf('docs')); var relDocPath = docPath.substring(docPath.indexOf('docs'));
console.group("Warning: no source class found for \"".concat(relDocPath, "\"")); console.group('Warning: no source class found for "'.concat(relDocPath, '"'));
if (linkRefs[docPath]) { if (linkRefs[docPath]) {
linkRefs[docPath].forEach(function (linkRef) { linkRefs[docPath].forEach(function (linkRef) {
var relLinkPath = linkRef.substring(linkRef.indexOf('docs')); var relLinkPath = linkRef.substring(linkRef.indexOf('docs'));
console.log("Linked from: \"".concat(relLinkPath, "\"")); console.log('Linked from: "'.concat(relLinkPath, '"'));
}); });
} }
console.groupEnd(); console.groupEnd();
@@ -60,7 +75,7 @@ function processDocs(mdCache, aggData) {
imagePaths.forEach(function (imagePath) { imagePaths.forEach(function (imagePath) {
if (!imageRefs[imagePath]) { if (!imageRefs[imagePath]) {
var relImagePath = imagePath.substring(imagePath.indexOf('docs')); var relImagePath = imagePath.substring(imagePath.indexOf('docs'));
console.log("Warning: no links to image file \"".concat(relImagePath, "\"")); console.log('Warning: no links to image file "'.concat(relImagePath, '"'));
} }
}); });
console.log(); console.log();
@@ -68,27 +83,30 @@ function processDocs(mdCache, aggData) {
brokenImUrls.forEach(function (url) { brokenImUrls.forEach(function (url) {
var relUrl = url.substring(url.indexOf('docs')); var relUrl = url.substring(url.indexOf('docs'));
var relDocPath = brokenImageRefs[url].substring(brokenImageRefs[url].indexOf('docs')); var relDocPath = brokenImageRefs[url].substring(brokenImageRefs[url].indexOf('docs'));
console.group("Broken image link \"".concat(relUrl, "\" found in \"").concat(relDocPath)); console.group('Broken image link "'.concat(relUrl, '" found in "').concat(relDocPath));
imagePaths.forEach(function (imPath) { imagePaths.forEach(function (imPath) {
if (lev.get(imPath, url) <= maxImagePathLevDistance) { if (lev.get(imPath, url) <= maxImagePathLevDistance) {
var relImPath = imPath.substring(imPath.indexOf('docs')); var relImPath = imPath.substring(imPath.indexOf('docs'));
console.log("Should it be \"".concat(relImPath, "\"?")); console.log('Should it be "'.concat(relImPath, '"?'));
} }
}); });
console.groupEnd(); console.groupEnd();
}); });
} }
exports.processDocs = processDocs;
function normaliseLinkPath(homeFilePath, linkUrl) { function normaliseLinkPath(homeFilePath, linkUrl) {
var homeFolder = path.dirname(homeFilePath); var homeFolder = path.dirname(homeFilePath);
return path.resolve(homeFolder, linkUrl); return path.resolve(homeFolder, linkUrl);
} }
function getImagePaths(imageFolder) { function getImagePaths(imageFolder) {
var files = fs.readdirSync(imageFolder); var files = fs.readdirSync(imageFolder);
return files.map(function (f) { return path.resolve(imageFolder, f); }); return files.map(function (f) {
return path.resolve(imageFolder, f);
});
} }
function makeFilepathFilters(patterns) { function makeFilepathFilters(patterns) {
return patterns.map(function (r) { return new RegExp(r); }); return patterns.map(function (r) {
return new RegExp(r);
});
} }
function filterFilepath(filters, filepath) { function filterFilepath(filters, filepath) {
for (var i = 0; i < filters.length; i++) { for (var i = 0; i < filters.length; i++) {
@@ -101,8 +119,7 @@ function filterFilepath(filters, filepath) {
function multiSetAdd(container, key, value) { function multiSetAdd(container, key, value) {
if (container[key]) { if (container[key]) {
container[key].push(value); container[key].push(value);
} } else {
else {
container[key] = [value]; container[key] = [value];
} }
} }
+33 -24
View File
@@ -1,19 +1,33 @@
"use strict"; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); /*!
exports.processDocs = void 0; * @license
var fs = require("fs"); * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
var path = require("path"); *
var ejs = require("ejs"); * Licensed under the Apache License, Version 2.0 (the "License");
var remark = require("remark"); * you may not use this file except in compliance with the License.
var frontMatter = require("remark-frontmatter"); * You may obtain a copy of the License at
var replaceZone = require("mdast-zone"); *
var graphql_1 = require("graphql"); * http://www.apache.org/licenses/LICENSE-2.0
var MQ = require("../mqDefs"); *
var libNamesList = [ * Unless required by applicable law or agreed to in writing, software
'content-services', 'core', 'extensions', * distributed under the License is distributed on an "AS IS" BASIS,
'insights', 'process-services', 'process-services-cloud' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
]; * See the License for the specific language governing permissions and
var query = "\n query libIndex($libName: String) {\n documents(idFilter: $libName) {\n title: metadata(key: \"Title\")\n status: metadata(key: \"Status\")\n id\n classType: folder(depth: 2)\n heading {\n link {\n url\n }\n }\n paragraph {\n plaintext\n }\n }\n }\n"; * limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var fs = require('fs');
var path = require('path');
var ejs = require('ejs');
var remark = require('remark');
var frontMatter = require('remark-frontmatter');
var replaceZone = require('mdast-zone');
var graphql_1 = require('graphql');
var MQ = require('../mqDefs');
var libNamesList = ['content-services', 'core', 'extensions', 'insights', 'process-services', 'process-services-cloud'];
var query =
'\n query libIndex($libName: String) {\n documents(idFilter: $libName) {\n title: metadata(key: "Title")\n status: metadata(key: "Status")\n id\n classType: folder(depth: 2)\n heading {\n link {\n url\n }\n }\n paragraph {\n plaintext\n }\n }\n }\n';
function processDocs(mdCache, aggData) { function processDocs(mdCache, aggData) {
var docset = new MQ.Docset(mdCache); var docset = new MQ.Docset(mdCache);
var templateFilePath = path.resolve(__dirname, '..', 'templates', 'gqIndex.ejs'); var templateFilePath = path.resolve(__dirname, '..', 'templates', 'gqIndex.ejs');
@@ -21,17 +35,13 @@ function processDocs(mdCache, aggData) {
var template = ejs.compile(templateSource); var template = ejs.compile(templateSource);
var indexFilePath = path.resolve(aggData['rootFolder'], 'docs', 'README.md'); var indexFilePath = path.resolve(aggData['rootFolder'], 'docs', 'README.md');
var indexFileText = fs.readFileSync(indexFilePath, 'utf8'); var indexFileText = fs.readFileSync(indexFilePath, 'utf8');
var indexMD = remark() var indexMD = remark().use(frontMatter, ['yaml']).parse(indexFileText);
.use(frontMatter, ['yaml'])
.parse(indexFileText);
var schema = (0, graphql_1.buildSchema)(MQ.schema); var schema = (0, graphql_1.buildSchema)(MQ.schema);
libNamesList.forEach(function (libName) { libNamesList.forEach(function (libName) {
(0, graphql_1.graphql)(schema, query, docset, null, { 'libName': libName }) (0, graphql_1.graphql)(schema, query, docset, null, { libName: libName }).then(function (response) {
.then(function (response) {
if (!response['data']) { if (!response['data']) {
console.log(JSON.stringify(response)); console.log(JSON.stringify(response));
} } else {
else {
// console.log(template(response['data'])); // console.log(template(response['data']));
var newSection_1 = remark().parse(template(response['data'])).children; var newSection_1 = remark().parse(template(response['data'])).children;
replaceZone(indexMD, libName, function (start, _oldZone, end) { replaceZone(indexMD, libName, function (start, _oldZone, end) {
@@ -48,4 +58,3 @@ function processDocs(mdCache, aggData) {
}); });
}); });
} }
exports.processDocs = processDocs;
+37 -22
View File
@@ -1,9 +1,25 @@
"use strict"; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); /*!
exports.processDocs = void 0; * @license
var path = require("path"); * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
var fs = require("fs"); *
var unist_util_select_1 = require("unist-util-select"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var path = require('path');
var fs = require('fs');
var unist_util_select_1 = require('unist-util-select');
var suffixesNotToCheck = /\.ts/; var suffixesNotToCheck = /\.ts/;
function processDocs(mdCache, aggData) { function processDocs(mdCache, aggData) {
var pathnames = Object.keys(mdCache); var pathnames = Object.keys(mdCache);
@@ -16,7 +32,6 @@ function processDocs(mdCache, aggData) {
fixUrls(tree, pathname, imageSet, 'image'); fixUrls(tree, pathname, imageSet, 'image');
}); });
} }
exports.processDocs = processDocs;
function fixUrls(tree, docFilePath, linkSet, selector) { function fixUrls(tree, docFilePath, linkSet, selector) {
var linksInDoc = (0, unist_util_select_1.selectAll)(selector, tree); var linksInDoc = (0, unist_util_select_1.selectAll)(selector, tree);
var errors = []; var errors = [];
@@ -28,20 +43,22 @@ function fixUrls(tree, docFilePath, linkSet, selector) {
anchor = origFullUrlPath.substring(hashPos); anchor = origFullUrlPath.substring(hashPos);
origFullUrlPath = origFullUrlPath.substring(0, hashPos); origFullUrlPath = origFullUrlPath.substring(0, hashPos);
} }
if (!linkElem.url.match(/http:|https:|ftp:|mailto:/) && if (
!linkElem.url.match(/http:|https:|ftp:|mailto:/) &&
!path.extname(origFullUrlPath).match(suffixesNotToCheck) && !path.extname(origFullUrlPath).match(suffixesNotToCheck) &&
(origFullUrlPath !== '') && origFullUrlPath !== '' &&
!fs.existsSync(origFullUrlPath)) { !fs.existsSync(origFullUrlPath)
) {
var newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath; var newUrl = linkSet.update(origFullUrlPath) || origFullUrlPath;
linkElem.url = path.relative(path.dirname(docFilePath), newUrl).replace(/\\/g, '/') + anchor; linkElem.url = path.relative(path.dirname(docFilePath), newUrl).replace(/\\/g, '/') + anchor;
errors.push("Bad link: ".concat(origFullUrlPath, "\nReplacing with ").concat(linkElem.url)); errors.push('Bad link: '.concat(origFullUrlPath, '\nReplacing with ').concat(linkElem.url));
} /*else { } /*else {
console.log(`Link OK: ${origFullUrlPath}`); console.log(`Link OK: ${origFullUrlPath}`);
} }
*/ */
}); });
if (errors.length > 0) { if (errors.length > 0) {
showMessages("File: ".concat(docFilePath, ":"), errors); showMessages('File: '.concat(docFilePath, ':'), errors);
} }
} }
function showMessages(groupName, messages) { function showMessages(groupName, messages) {
@@ -52,8 +69,9 @@ function showMessages(groupName, messages) {
console.groupEnd(); console.groupEnd();
} }
function getImagePaths(imageFolderPath) { function getImagePaths(imageFolderPath) {
return fs.readdirSync(imageFolderPath) return fs.readdirSync(imageFolderPath).map(function (imageFileName) {
.map(function (imageFileName) { return path.resolve(imageFolderPath, imageFileName); }); return path.resolve(imageFolderPath, imageFileName);
});
} }
var LinkSet = /** @class */ (function () { var LinkSet = /** @class */ (function () {
function LinkSet(urls) { function LinkSet(urls) {
@@ -64,8 +82,7 @@ var LinkSet = /** @class */ (function () {
if (_this.links.has(fileName)) { if (_this.links.has(fileName)) {
var item = _this.links.get(fileName); var item = _this.links.get(fileName);
item.push(url); item.push(url);
} } else {
else {
_this.links.set(fileName, [url]); _this.links.set(fileName, [url]);
} }
}); });
@@ -74,17 +91,15 @@ var LinkSet = /** @class */ (function () {
var oldFileName = path.basename(oldUrl); var oldFileName = path.basename(oldUrl);
if (!this.links.has(oldFileName)) { if (!this.links.has(oldFileName)) {
return ''; return '';
} } else {
else {
var candidates = this.links.get(oldFileName); var candidates = this.links.get(oldFileName);
if (candidates.length === 1) { if (candidates.length === 1) {
return candidates[0]; return candidates[0];
} } else {
else { console.log('Multiple candidates for '.concat(oldUrl));
console.log("Multiple candidates for ".concat(oldUrl));
return ''; return '';
} }
} }
}; };
return LinkSet; return LinkSet;
}()); })();
+28 -14
View File
@@ -1,9 +1,25 @@
"use strict"; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); /*!
exports.processDocs = void 0; * @license
var path = require("path"); * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
var unist_util_select_1 = require("unist-util-select"); *
var ngHelpers = require("../ngHelpers"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var path = require('path');
var unist_util_select_1 = require('unist-util-select');
var ngHelpers = require('../ngHelpers');
var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/; var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(dialog)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/;
function processDocs(mdCache, aggData) { function processDocs(mdCache, aggData) {
var pathnames = Object.keys(mdCache); var pathnames = Object.keys(mdCache);
@@ -23,23 +39,21 @@ function processDocs(mdCache, aggData) {
var titleText = titleHeading.children[0]; var titleText = titleHeading.children[0];
titleHeading.children[0] = { titleHeading.children[0] = {
type: 'link', type: 'link',
url: srcUrl, url: srcUrl, // `../../${sourcePath}`,
title: "Defined in ".concat(path.basename(sourcePath)), title: 'Defined in '.concat(path.basename(sourcePath)),
children: [titleText] children: [titleText]
}; };
} } else if (titleHeading && titleHeading.children[0].type === 'link' && sourcePath) {
else if ((titleHeading && titleHeading.children[0].type === 'link') && sourcePath) {
var linkElem = titleHeading.children[0]; var linkElem = titleHeading.children[0];
linkElem.url = srcUrl, // `../../${sourcePath}`; ((linkElem.url = srcUrl), // `../../${sourcePath}`;
linkElem.title = "Defined in ".concat(path.basename(sourcePath)); (linkElem.title = 'Defined in '.concat(path.basename(sourcePath))));
} }
}); });
} }
exports.processDocs = processDocs;
function fixRelSrcUrl(docPath, srcPath) { function fixRelSrcUrl(docPath, srcPath) {
var docPathSegments = docPath.split(/[\\\/]/); var docPathSegments = docPath.split(/[\\\/]/);
var dotPathPart = ''; var dotPathPart = '';
for (var i = 0; i < (docPathSegments.length - 1); i++) { for (var i = 0; i < docPathSegments.length - 1; i++) {
dotPathPart += '../'; dotPathPart += '../';
} }
return dotPathPart + srcPath; return dotPathPart + srcPath;
+71 -63
View File
@@ -1,20 +1,36 @@
"use strict"; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); /*!
exports.processDocs = void 0; * @license
var fs = require("fs"); * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
var path = require("path"); *
var replaceSection = require("mdast-util-heading-range"); * Licensed under the Apache License, Version 2.0 (the "License");
var remark = require("remark"); * you may not use this file except in compliance with the License.
var ejs = require("ejs"); * You may obtain a copy of the License at
var mdNav_1 = require("../mdNav"); *
var ngHelpers_1 = require("../ngHelpers"); * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var fs = require('fs');
var path = require('path');
var replaceSection = require('mdast-util-heading-range');
var remark = require('remark');
var ejs = require('ejs');
var mdNav_1 = require('../mdNav');
var ngHelpers_1 = require('../ngHelpers');
var templateFolder = path.resolve('tools', 'doc', 'templates'); var templateFolder = path.resolve('tools', 'doc', 'templates');
var nameExceptions; var nameExceptions;
function processDocs(mdCache, aggData) { function processDocs(mdCache, aggData) {
nameExceptions = aggData.config.typeNameExceptions; nameExceptions = aggData.config.typeNameExceptions;
var pathnames = Object.keys(mdCache); var pathNames = Object.keys(mdCache);
var internalErrors; var internalErrors;
pathnames.forEach(function (pathname) { pathNames.forEach(function (pathname) {
internalErrors = []; internalErrors = [];
updateFile(mdCache[pathname].mdOutTree, pathname, aggData, internalErrors); updateFile(mdCache[pathname].mdOutTree, pathname, aggData, internalErrors);
if (internalErrors.length > 0) { if (internalErrors.length > 0) {
@@ -22,7 +38,6 @@ function processDocs(mdCache, aggData) {
} }
}); });
} }
exports.processDocs = processDocs;
function showErrors(filename, errorMessages) { function showErrors(filename, errorMessages) {
console.log(filename); console.log(filename);
errorMessages.forEach(function (message) { errorMessages.forEach(function (message) {
@@ -48,7 +63,7 @@ function updateFile(tree, pathname, aggData, errorMessages) {
var templateSource = fs.readFileSync(templateName, 'utf8'); var templateSource = fs.readFileSync(templateName, 'utf8');
var template = ejs.compile(templateSource); var template = ejs.compile(templateSource);
var mdText = template(compData); var mdText = template(compData);
mdText = mdText.replace(/^ +\|/mg, '|'); mdText = mdText.replace(/^ +\|/gm, '|');
var newSection_1 = remark().parse(mdText.trim()).children; var newSection_1 = remark().parse(mdText.trim()).children;
replaceSection(tree, 'Class members', function (before, section, after) { replaceSection(tree, 'Class members', function (before, section, after) {
newSection_1.unshift(before); newSection_1.unshift(before);
@@ -64,94 +79,86 @@ function updateFile(tree, pathname, aggData, errorMessages) {
function getPropDocsFromMD(tree, sectionHeading, docsColumn) { function getPropDocsFromMD(tree, sectionHeading, docsColumn) {
var result = {}; var result = {};
var nav = new mdNav_1.MDNav(tree); var nav = new mdNav_1.MDNav(tree);
var classMemHeading = nav var classMemHeading = nav.heading(function (h) {
.heading(function (h) { return h.children[0].type === 'text' && h.children[0].value === 'Class members';
return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
}); });
var propsTable = classMemHeading var propsTable = classMemHeading
.heading(function (h) { .heading(function (h) {
return (h.children[0].type === 'text') && (h.children[0].value === sectionHeading); return h.children[0].type === 'text' && h.children[0].value === sectionHeading;
}).table(); })
var propTableRow = propsTable.childNav .table();
.tableRow(function () { return true; }, 1).childNav; var propTableRow = propsTable.childNav.tableRow(function () {
return true;
}, 1).childNav;
var i = 1; var i = 1;
while (!propTableRow.empty) { while (!propTableRow.empty) {
var propName = propTableRow var propName = propTableRow.tableCell().childNav.text().item.value;
.tableCell().childNav
.text().item.value;
var propDocText = propTableRow var propDocText = propTableRow
.tableCell(function () { return true; }, docsColumn).childNav .tableCell(function () {
.text().item; return true;
}, docsColumn)
.childNav.text().item;
if (propDocText) { if (propDocText) {
result[propName] = propDocText.value; result[propName] = propDocText.value;
} }
i++; i++;
propTableRow = propsTable.childNav propTableRow = propsTable.childNav.tableRow(function () {
.tableRow(function () { return true; }, i).childNav; return true;
}, i).childNav;
} }
return result; return result;
} }
function getMethodDocsFromMD(tree) { function getMethodDocsFromMD(tree) {
var result = {}; var result = {};
var nav = new mdNav_1.MDNav(tree); var nav = new mdNav_1.MDNav(tree);
var classMemHeading = nav var classMemHeading = nav.heading(function (h) {
.heading(function (h) { return h.children[0].type === 'text' && h.children[0].value === 'Class members';
return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
}); });
var methListItems = classMemHeading var methListItems = classMemHeading
.heading(function (h) { .heading(function (h) {
return (h.children[0].type === 'text') && (h.children[0].value === 'Methods'); return h.children[0].type === 'text' && h.children[0].value === 'Methods';
}).list().childNav; })
var methItem = methListItems .list().childNav;
.listItem(); var methItem = methListItems.listItem();
var i = 0; var i = 0;
while (!methItem.empty) { while (!methItem.empty) {
var methNameSection = methItem.childNav var methNameSection = methItem.childNav.paragraph().childNav.strong().childNav;
.paragraph().childNav
.strong().childNav;
var methName = ''; var methName = '';
// Method docs must be in "new" format with names and types styled separately. // Method docs must be in "new" format with names and types styled separately.
if (!methNameSection.empty) { if (!methNameSection.empty) {
methName = methNameSection.text().item.value; methName = methNameSection.text().item.value;
var methDoc = methItem.childNav var methDoc = methItem.childNav.paragraph().childNav.html().text().value;
.paragraph().childNav
.html()
.text().value;
var params = getMDMethodParams(methItem); var params = getMDMethodParams(methItem);
result[methName] = { result[methName] = {
'docText': methDoc.replace(/^\n/, ''), docText: methDoc.replace(/^\n/, ''),
'params': params params: params
}; };
} }
i++; i++;
methItem = methListItems methItem = methListItems.listItem(function (l) {
.listItem(function (l) { return true; }, i); return true;
}, i);
} }
return result; return result;
} }
function getMDMethodParams(methItem) { function getMDMethodParams(methItem) {
var result = {}; var result = {};
var paramList = methItem.childNav.list().childNav; var paramList = methItem.childNav.list().childNav;
var paramListItems = paramList var paramListItems = paramList.listItems();
.listItems();
paramListItems.forEach(function (paramListItem) { paramListItems.forEach(function (paramListItem) {
var paramNameNode = paramListItem.childNav var paramNameNode = paramListItem.childNav.paragraph().childNav.emph().childNav;
.paragraph().childNav
.emph().childNav;
var paramName; var paramName;
if (!paramNameNode.empty) { if (!paramNameNode.empty) {
paramName = paramNameNode.text().item.value.replace(/:/, ''); paramName = paramNameNode.text().item.value.replace(/:/, '');
} } else {
else { var item = paramListItem.childNav.paragraph().childNav.strong().childNav.text();
var item = paramListItem.childNav.paragraph().childNav
.strong().childNav.text();
if (paramName) { if (paramName) {
paramName = item.value; paramName = item.value;
} }
} }
var paramDoc = paramListItem.childNav var paramDoc = paramListItem.childNav.paragraph().childNav.text(function (t) {
.paragraph().childNav return true;
.text(function (t) { return true; }, 1).value; // item.value; }, 1).value; // item.value;
result[paramName] = paramDoc.replace(/^[ -]+/, ''); result[paramName] = paramDoc.replace(/^[ -]+/, '');
}); });
return result; return result;
@@ -161,14 +168,13 @@ function updatePropDocsFromMD(comp, inputDocs, outputDocs, errorMessages) {
var propMDDoc; var propMDDoc;
if (prop.isInput) { if (prop.isInput) {
propMDDoc = inputDocs[prop.name]; propMDDoc = inputDocs[prop.name];
} } else if (prop.isOutput) {
else if (prop.isOutput) {
propMDDoc = outputDocs[prop.name]; propMDDoc = outputDocs[prop.name];
} }
// If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date. // If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date.
if (!prop.docText && propMDDoc) { if (!prop.docText && propMDDoc) {
prop.docText = propMDDoc; prop.docText = propMDDoc;
errorMessages.push("Warning: empty JSDocs for property \"".concat(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 +184,14 @@ function updateMethodDocsFromMD(comp, methodDocs, errorMessages) {
// If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date. // If JSDocs are empty but MD docs aren't then the Markdown is presumably more up-to-date.
if (!meth.docText && currMethMD && currMethMD.docText) { if (!meth.docText && currMethMD && currMethMD.docText) {
meth.docText = currMethMD.docText; meth.docText = currMethMD.docText;
errorMessages.push("Warning: empty JSDocs for method sig \"".concat(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) { meth.params.forEach(function (param) {
if (!param.docText && currMethMD && currMethMD.params[param.name]) { if (!param.docText && currMethMD && currMethMD.params[param.name]) {
param.docText = currMethMD.params[param.name]; param.docText = currMethMD.params[param.name];
errorMessages.push("Warning: empty JSDocs for parameter \"".concat(param.name, " (").concat(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.')
);
} }
}); });
}); });
+40 -28
View File
@@ -1,28 +1,43 @@
"use strict"; 'use strict';
Object.defineProperty(exports, "__esModule", { value: true }); /*!
exports.processDocs = void 0; * @license
var fs = require("fs"); * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
var path = require("path"); *
var replaceSection = require("mdast-util-heading-range"); * Licensed under the Apache License, Version 2.0 (the "License");
var remark = require("remark"); * you may not use this file except in compliance with the License.
var frontMatter = require("remark-frontmatter"); * You may obtain a copy of the License at
var yaml = require("js-yaml"); *
var ejs = require("ejs"); * http://www.apache.org/licenses/LICENSE-2.0
var unist = require("../unistHelpers"); *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, '__esModule', { value: true });
exports.processDocs = processDocs;
var fs = require('fs');
var path = require('path');
var replaceSection = require('mdast-util-heading-range');
var remark = require('remark');
var frontMatter = require('remark-frontmatter');
var yaml = require('js-yaml');
var ejs = require('ejs');
var unist = require('../unistHelpers');
var tutFolder = path.resolve('docs', 'tutorials'); var tutFolder = path.resolve('docs', 'tutorials');
var templateFolder = path.resolve('tools', 'doc', 'templates'); var templateFolder = path.resolve('tools', 'doc', 'templates');
var userGuideFolder = path.resolve('docs', 'user-guide'); var userGuideFolder = path.resolve('docs', 'user-guide');
function processDocs() { function processDocs() {
aggPhase(); aggPhase();
} }
exports.processDocs = processDocs;
function aggPhase() { function aggPhase() {
var indexDocData = getIndexDocData(); var indexDocData = getIndexDocData();
var templateName = path.resolve(templateFolder, 'tutIndex.ejs'); var templateName = path.resolve(templateFolder, 'tutIndex.ejs');
var templateSource = fs.readFileSync(templateName, 'utf8'); var templateSource = fs.readFileSync(templateName, 'utf8');
var template = ejs.compile(templateSource); var template = ejs.compile(templateSource);
var mdText = template(indexDocData); var mdText = template(indexDocData);
mdText = mdText.replace(/^ +\|/mg, '|'); mdText = mdText.replace(/^ +\|/gm, '|');
var newSection = remark().use(frontMatter, ['yaml']).data('settings', { paddedTable: false, gfm: false }).parse(mdText.trim()).children; var newSection = remark().use(frontMatter, ['yaml']).data('settings', { paddedTable: false, gfm: false }).parse(mdText.trim()).children;
var tutIndexFile = path.resolve(tutFolder, 'README.md'); var tutIndexFile = path.resolve(tutFolder, 'README.md');
var tutIndexText = fs.readFileSync(tutIndexFile, 'utf8'); var tutIndexText = fs.readFileSync(tutIndexFile, 'utf8');
@@ -32,7 +47,10 @@ function aggPhase() {
newSection.push(after); newSection.push(after);
return newSection; return newSection;
}); });
fs.writeFileSync(tutIndexFile, remark().use(frontMatter, { type: 'yaml', fence: '---' }).data('settings', { paddedTable: false, gfm: false }).stringify(tutIndexMD)); fs.writeFileSync(
tutIndexFile,
remark().use(frontMatter, { type: 'yaml', fence: '---' }).data('settings', { paddedTable: false, gfm: false }).stringify(tutIndexMD)
);
} }
function getIndexDocData() { function getIndexDocData() {
var indexFile = path.resolve(userGuideFolder, 'summary.json'); var indexFile = path.resolve(userGuideFolder, 'summary.json');
@@ -54,22 +72,19 @@ function getIndexDocData() {
var metadata = getDocMetadata(tutMD); var metadata = getDocMetadata(tutMD);
if (metadata['Level']) { if (metadata['Level']) {
tutData['level'] = metadata['Level']; tutData['level'] = metadata['Level'];
} } else {
else {
tutData['level'] = ''; tutData['level'] = '';
} }
var briefDesc = getFirstParagraph(tutMD); var briefDesc = getFirstParagraph(tutMD);
var briefDescText = remark() tutData['briefDesc'] = remark()
.use(frontMatter, { type: 'yaml', fence: '---' }) .use(frontMatter, { type: 'yaml', fence: '---' })
.data('settings', { paddedTable: false, gfm: false }) .data('settings', { paddedTable: false, gfm: false })
.stringify(briefDesc); .stringify(briefDesc);
tutData['briefDesc'] = briefDescText;
var title = getFirstHeading(tutMD); var title = getFirstHeading(tutMD);
var titleText = remark() tutData['title'] = remark()
.use(frontMatter, { type: 'yaml', fence: '---' }) .use(frontMatter, { type: 'yaml', fence: '---' })
.data('settings', { paddedTable: false, gfm: false }) .data('settings', { paddedTable: false, gfm: false })
.stringify(title.children[0]); .stringify(title.children[0]);
tutData['title'] = titleText;
result.tuts.push(tutData); result.tuts.push(tutData);
}); });
return result; return result;
@@ -77,28 +92,25 @@ function getIndexDocData() {
function getDocMetadata(tree) { function getDocMetadata(tree) {
if (tree.children[0].type === 'yaml') { if (tree.children[0].type === 'yaml') {
return yaml.load(tree.children[0].value); return yaml.load(tree.children[0].value);
} } else {
else {
return {}; return {};
} }
} }
function getFirstParagraph(tree) { function getFirstParagraph(tree) {
var s = 0; var s = 0;
for (; (s < tree.children.length) && !unist.isParagraph(tree.children[s]); s++) { } for (; s < tree.children.length && !unist.isParagraph(tree.children[s]); s++) {}
if (s < tree.children.length) { if (s < tree.children.length) {
return tree.children[s]; return tree.children[s];
} } else {
else {
return null; return null;
} }
} }
function getFirstHeading(tree) { function getFirstHeading(tree) {
var s = 0; var s = 0;
for (; (s < tree.children.length) && !unist.isHeading(tree.children[s]); s++) { } for (; s < tree.children.length && !unist.isHeading(tree.children[s]); s++) {}
if (s < tree.children.length) { if (s < tree.children.length) {
return tree.children[s]; return tree.children[s];
} } else {
else {
return null; return null;
} }
} }
+87 -67
View File
@@ -1,22 +1,50 @@
"use strict"; 'use strict';
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++) { * @license
if (ar || !(i in from)) { * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
if (!ar) ar = Array.prototype.slice.call(from, 0, i); *
ar[i] = from[i]; * Licensed under the Apache License, Version 2.0 (the "License");
} * you may not use this file except in compliance with the License.
} * You may obtain a copy of the License at
return to.concat(ar || Array.prototype.slice.call(from)); *
}; * http://www.apache.org/licenses/LICENSE-2.0
Object.defineProperty(exports, "__esModule", { value: true }); *
exports.processDocs = void 0; * Unless required by applicable law or agreed to in writing, software
var path = require("path"); * distributed under the License is distributed on an "AS IS" BASIS,
var unist = require("../unistHelpers"); * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
var ngHelpers = require("../ngHelpers"); * See the License for the specific language governing permissions and
* limitations under the License.
*/
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 = processDocs;
var path = require('path');
var unist = require('../unistHelpers');
var ngHelpers = require('../ngHelpers');
var includedNodeTypes = [ var includedNodeTypes = [
'root', 'paragraph', 'inlineCode', 'list', 'listItem', 'root',
'table', 'tableRow', 'tableCell', 'emphasis', 'strong', 'paragraph',
'link', 'text' 'inlineCode',
'list',
'listItem',
'table',
'tableRow',
'tableCell',
'emphasis',
'strong',
'link',
'text'
]; ];
var externalNameLinks; var externalNameLinks;
var linkOverrides; var linkOverrides;
@@ -28,7 +56,6 @@ function processDocs(mdCache, aggData) {
updateFile(mdCache[pathname].mdOutTree, pathname, aggData); updateFile(mdCache[pathname].mdOutTree, pathname, aggData);
}); });
} }
exports.processDocs = processDocs;
function initPhase(aggData, mdCache) { function initPhase(aggData, mdCache) {
externalNameLinks = aggData.config.externalNameLinks; externalNameLinks = aggData.config.externalNameLinks;
ignoreLinkWords = aggData.config.ignoreLinkWords; ignoreLinkWords = aggData.config.ignoreLinkWords;
@@ -59,8 +86,7 @@ function updateFile(tree, pathname, aggData) {
return; return;
} }
if (node.type === 'link') { if (node.type === 'link') {
if (node.children[0] && ((node.children[0].type === 'inlineCode') || if (node.children[0] && (node.children[0].type === 'inlineCode' || node.children[0].type === 'text')) {
(node.children[0].type === 'text'))) {
if (!ignoreLinkWords.includes(node.children[0].value)) { if (!ignoreLinkWords.includes(node.children[0].value)) {
var link = resolveTypeLink(aggData, pathname, node.children[0].value); var link = resolveTypeLink(aggData, pathname, node.children[0].value);
if (link) { if (link) {
@@ -68,15 +94,13 @@ function updateFile(tree, pathname, aggData) {
} }
} }
} }
} } else if (node.children && node.type !== 'heading') {
else if ((node.children) && (node.type !== 'heading')) {
node.children.forEach(function (child, index) { node.children.forEach(function (child, index) {
var _a; var _a;
if ((child.type === 'text') || (child.type === 'inlineCode')) { if (child.type === 'text' || child.type === 'inlineCode') {
var newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode'); var newNodes = handleLinksInBodyText(aggData, pathname, child.value, child.type === 'inlineCode');
(_a = node.children).splice.apply(_a, __spreadArray([index, 1], newNodes, false)); (_a = node.children).splice.apply(_a, __spreadArray([index, 1], newNodes, false));
} } else {
else {
traverseMDTree(child); traverseMDTree(child);
} }
}); });
@@ -85,8 +109,12 @@ function updateFile(tree, pathname, aggData) {
} }
var SplitNameNode = /** @class */ (function () { var SplitNameNode = /** @class */ (function () {
function SplitNameNode(key, value) { function SplitNameNode(key, value) {
if (key === void 0) { key = ''; } if (key === void 0) {
if (value === void 0) { value = ''; } key = '';
}
if (value === void 0) {
value = '';
}
this.key = key; this.key = key;
this.value = value; this.value = value;
this.children = {}; this.children = {};
@@ -95,21 +123,21 @@ var SplitNameNode = /** @class */ (function () {
this.children[child.key] = child; this.children[child.key] = child;
}; };
return SplitNameNode; return SplitNameNode;
}()); })();
var SplitNameMatchElement = /** @class */ (function () { var SplitNameMatchElement = /** @class */ (function () {
function SplitNameMatchElement(node, textPos) { function SplitNameMatchElement(node, textPos) {
this.node = node; this.node = node;
this.textPos = textPos; this.textPos = textPos;
} }
return SplitNameMatchElement; return SplitNameMatchElement;
}()); })();
var SplitNameMatchResult = /** @class */ (function () { var SplitNameMatchResult = /** @class */ (function () {
function SplitNameMatchResult(value, startPos) { function SplitNameMatchResult(value, startPos) {
this.value = value; this.value = value;
this.startPos = startPos; this.startPos = startPos;
} }
return SplitNameMatchResult; return SplitNameMatchResult;
}()); })();
var SplitNameMatcher = /** @class */ (function () { var SplitNameMatcher = /** @class */ (function () {
function SplitNameMatcher(root) { function SplitNameMatcher(root) {
this.root = root; this.root = root;
@@ -125,29 +153,25 @@ var SplitNameMatcher = /** @class */ (function () {
if (child) { if (child) {
if (child.value) { if (child.value) {
/* Using unshift to add the match to the array means that /* Using unshift to add the match to the array means that
* the longest matches will appear first in the array. * the longest matches will appear first in the array.
* User can then just use the first array element if only * User can then just use the first array element if only
* the longest match is needed. * the longest match is needed.
*/ */
result.unshift(new SplitNameMatchResult(child.value, this.matches[i].textPos)); result.unshift(new SplitNameMatchResult(child.value, this.matches[i].textPos));
this.matches.splice(i, 1); this.matches.splice(i, 1);
} } else {
else {
this.matches[i] = new SplitNameMatchElement(child, this.matches[i].textPos); this.matches[i] = new SplitNameMatchElement(child, this.matches[i].textPos);
} }
} } else {
else {
this.matches.splice(i, 1); this.matches.splice(i, 1);
} }
} } else {
else {
this.matches.splice(i, 1); this.matches.splice(i, 1);
} }
} }
if (result === []) { if (result === []) {
return null; return null;
} } else {
else {
return result; return result;
} }
}; };
@@ -155,7 +179,7 @@ var SplitNameMatcher = /** @class */ (function () {
this.matches = []; this.matches = [];
}; };
return SplitNameMatcher; return SplitNameMatcher;
}()); })();
var SplitNameLookup = /** @class */ (function () { var SplitNameLookup = /** @class */ (function () {
function SplitNameLookup() { function SplitNameLookup() {
this.root = new SplitNameNode(); this.root = new SplitNameNode();
@@ -166,7 +190,7 @@ var SplitNameLookup = /** @class */ (function () {
var currNode = this.root; var currNode = this.root;
segments.forEach(function (segment, index) { segments.forEach(function (segment, index) {
var value = ''; var value = '';
if (index === (segments.length - 1)) { if (index === segments.length - 1) {
value = name; value = name;
} }
var childNode = currNode.children[segment]; var childNode = currNode.children[segment];
@@ -178,7 +202,7 @@ var SplitNameLookup = /** @class */ (function () {
}); });
}; };
return SplitNameLookup; return SplitNameLookup;
}()); })();
var WordScanner = /** @class */ (function () { var WordScanner = /** @class */ (function () {
function WordScanner(text) { function WordScanner(text) {
this.text = text; this.text = text;
@@ -214,9 +238,11 @@ var WordScanner = /** @class */ (function () {
this.index = this.text.length; this.index = this.text.length;
}; };
return WordScanner; return WordScanner;
}()); })();
function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) { function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
if (wrapInlineCode === void 0) { wrapInlineCode = false; } if (wrapInlineCode === void 0) {
wrapInlineCode = false;
}
var result = []; var result = [];
var currTextStart = 0; var currTextStart = 0;
var matcher = new SplitNameMatcher(aggData.nameLookup.root); var matcher = new SplitNameMatcher(aggData.nameLookup.root);
@@ -234,8 +260,7 @@ function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
link = resolveTypeLink(aggData, docFilePath, match[0].value); link = resolveTypeLink(aggData, docFilePath, match[0].value);
matchStart = match[0].startPos; matchStart = match[0].startPos;
} }
} } else {
else {
matchStart = scanner.index; matchStart = scanner.index;
} }
if (link) { if (link) {
@@ -243,8 +268,7 @@ function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
var linkTitle = void 0; var linkTitle = void 0;
if (wrapInlineCode) { if (wrapInlineCode) {
linkTitle = unist.makeInlineCode(linkText); linkTitle = unist.makeInlineCode(linkText);
} } else {
else {
linkTitle = unist.makeText(linkText); linkTitle = unist.makeText(linkText);
} }
var linkNode = unist.makeLink(linkTitle, link); var linkNode = unist.makeLink(linkTitle, link);
@@ -252,8 +276,7 @@ function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
if (prevText) { if (prevText) {
if (wrapInlineCode) { if (wrapInlineCode) {
result.push(unist.makeInlineCode(prevText)); result.push(unist.makeInlineCode(prevText));
} } else {
else {
result.push(unist.makeText(prevText)); result.push(unist.makeText(prevText));
} }
} }
@@ -267,8 +290,7 @@ function handleLinksInBodyText(aggData, docFilePath, text, wrapInlineCode) {
if (remainingText) { if (remainingText) {
if (wrapInlineCode) { if (wrapInlineCode) {
result.push(unist.makeInlineCode(remainingText)); result.push(unist.makeInlineCode(remainingText));
} } else {
else {
result.push(unist.makeText(remainingText)); result.push(unist.makeText(remainingText));
} }
} }
@@ -282,11 +304,9 @@ function resolveTypeLink(aggData, docFilePath, text) {
var classInfo = aggData.classInfo[possTypeName]; var classInfo = aggData.classInfo[possTypeName];
if (linkOverrides[possTypeName.toLowerCase()]) { if (linkOverrides[possTypeName.toLowerCase()]) {
return ''; return '';
} } else if (externalNameLinks[possTypeName]) {
else if (externalNameLinks[possTypeName]) {
return externalNameLinks[possTypeName]; return externalNameLinks[possTypeName];
} } else if (classInfo) {
else if (classInfo) {
var kebabName = ngHelpers.kebabifyClassName(possTypeName); var kebabName = ngHelpers.kebabifyClassName(possTypeName);
var possDocFile = aggData.docFiles[kebabName]; var possDocFile = aggData.docFiles[kebabName];
var url = fixRelSrcUrl(docFilePath, classInfo.sourcePath); var url = fixRelSrcUrl(docFilePath, classInfo.sourcePath);
@@ -294,8 +314,7 @@ function resolveTypeLink(aggData, docFilePath, text) {
url = fixRelDocUrl(docFilePath, possDocFile); url = fixRelDocUrl(docFilePath, possDocFile);
} }
return url; return url;
} } else {
else {
return ''; return '';
} }
} }
@@ -303,7 +322,7 @@ function fixRelSrcUrl(docPath, srcPath) {
var relDocPath = docPath.substring(docPath.indexOf('docs')); var relDocPath = docPath.substring(docPath.indexOf('docs'));
var docPathSegments = relDocPath.split(/[\\\/]/); var docPathSegments = relDocPath.split(/[\\\/]/);
var dotPathPart = ''; var dotPathPart = '';
for (var i = 0; i < (docPathSegments.length - 1); i++) { for (var i = 0; i < docPathSegments.length - 1; i++) {
dotPathPart += '../'; dotPathPart += '../';
} }
return dotPathPart + srcPath; return dotPathPart + srcPath;
@@ -312,7 +331,7 @@ function fixRelDocUrl(docPathFrom, docPathTo) {
var relDocPathFrom = docPathFrom.substring(docPathFrom.indexOf('docs')); var relDocPathFrom = docPathFrom.substring(docPathFrom.indexOf('docs'));
var docPathSegments = relDocPathFrom.split(/[\\\/]/); var docPathSegments = relDocPathFrom.split(/[\\\/]/);
var dotPathPart = ''; var dotPathPart = '';
for (var i = 0; i < (docPathSegments.length - 2); i++) { for (var i = 0; i < docPathSegments.length - 2; i++) {
dotPathPart += '../'; dotPathPart += '../';
} }
return dotPathPart + docPathTo; return dotPathPart + docPathTo;
@@ -321,13 +340,14 @@ function cleanTypeName(text) {
var matches = text.match(/[a-zA-Z0-9_]+<([a-zA-Z0-9_]+)(\[\])?>/); var matches = text.match(/[a-zA-Z0-9_]+<([a-zA-Z0-9_]+)(\[\])?>/);
if (matches) { if (matches) {
return matches[1]; return matches[1];
} } else {
else {
return text.replace(/\[\]$/, ''); return text.replace(/\[\]$/, '');
} }
} }
function convertNodeToTypeLink(node, text, url, title) { function convertNodeToTypeLink(node, text, url, title) {
if (title === void 0) { title = null; } if (title === void 0) {
title = null;
}
var linkDisplayText = unist.makeInlineCode(text); var linkDisplayText = unist.makeInlineCode(text);
node.type = 'link'; node.type = 'link';
node.title = title; node.title = title;