@covalent/markdown-navigator 6.3.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/markdown-navigator-window/markdown-navigator-window.component.mjs +90 -0
- package/esm2022/markdown-navigator-window-directive/markdown-navigator-window.directive.mjs +34 -0
- package/esm2022/markdown-navigator-window-service/markdown-navigator-window.service.mjs +137 -0
- package/esm2022/markdown-navigator.component.mjs +436 -0
- package/{esm2020 → esm2022}/markdown-navigator.module.mjs +29 -29
- package/{fesm2020 → fesm2022}/covalent-markdown-navigator.mjs +121 -70
- package/{fesm2020 → fesm2022}/covalent-markdown-navigator.mjs.map +1 -1
- package/markdown-navigator-window/markdown-navigator-window.component.d.ts +1 -1
- package/markdown-navigator-window-directive/markdown-navigator-window.directive.d.ts +1 -1
- package/markdown-navigator.component.d.ts +1 -1
- package/package.json +13 -21
- package/esm2020/markdown-navigator-window/markdown-navigator-window.component.mjs +0 -87
- package/esm2020/markdown-navigator-window-directive/markdown-navigator-window.directive.mjs +0 -32
- package/esm2020/markdown-navigator-window-service/markdown-navigator-window.service.mjs +0 -130
- package/esm2020/markdown-navigator.component.mjs +0 -397
- package/fesm2015/covalent-markdown-navigator.mjs +0 -720
- package/fesm2015/covalent-markdown-navigator.mjs.map +0 -1
- /package/{esm2020 → esm2022}/covalent-markdown-navigator.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
|
@@ -1,720 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, SecurityContext, Component, ChangeDetectionStrategy, Input, Output, ViewChild, HostListener, Injectable, Inject, Directive, NgModule } from '@angular/core';
|
|
3
|
-
import * as i4 from '@angular/common';
|
|
4
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
5
|
-
import { __awaiter } from 'tslib';
|
|
6
|
-
import * as i1 from '@covalent/markdown';
|
|
7
|
-
import { removeLeadingHash, isAnchorLink } from '@covalent/markdown';
|
|
8
|
-
import { firstValueFrom } from 'rxjs';
|
|
9
|
-
import * as i2 from '@angular/platform-browser';
|
|
10
|
-
import * as i3 from '@angular/common/http';
|
|
11
|
-
import * as i5 from '@angular/material/tooltip';
|
|
12
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
13
|
-
import * as i6 from '@angular/material/list';
|
|
14
|
-
import { MatListModule } from '@angular/material/list';
|
|
15
|
-
import * as i7 from '@angular/material/divider';
|
|
16
|
-
import * as i8 from '@angular/material/icon';
|
|
17
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
18
|
-
import * as i9 from '@angular/material/progress-bar';
|
|
19
|
-
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
20
|
-
import * as i10 from '@covalent/core/breadcrumbs';
|
|
21
|
-
import { CovalentBreadcrumbsModule } from '@covalent/core/breadcrumbs';
|
|
22
|
-
import * as i11 from '@covalent/flavored-markdown';
|
|
23
|
-
import { CovalentFlavoredMarkdownModule } from '@covalent/flavored-markdown';
|
|
24
|
-
import * as i12 from '@covalent/core/message';
|
|
25
|
-
import { CovalentMessageModule } from '@covalent/core/message';
|
|
26
|
-
import * as i1$1 from '@covalent/core/dialogs';
|
|
27
|
-
import { ResizableDraggableDialog, CovalentDialogsModule } from '@covalent/core/dialogs';
|
|
28
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
29
|
-
|
|
30
|
-
const DEFAULT_MARKDOWN_NAVIGATOR_LABELS = {
|
|
31
|
-
goHome: 'Go home',
|
|
32
|
-
goBack: 'Go back',
|
|
33
|
-
emptyState: 'No item(s) to display',
|
|
34
|
-
};
|
|
35
|
-
class TdMarkdownNavigatorComponent {
|
|
36
|
-
constructor(_markdownUrlLoaderService, _changeDetectorRef, _sanitizer, _http) {
|
|
37
|
-
this._markdownUrlLoaderService = _markdownUrlLoaderService;
|
|
38
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
39
|
-
this._sanitizer = _sanitizer;
|
|
40
|
-
this._http = _http;
|
|
41
|
-
/**
|
|
42
|
-
* copyCodeToClipboard?: boolean
|
|
43
|
-
*
|
|
44
|
-
* Display copy button on code snippets to copy code to clipboard.
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
this.copyCodeToClipboard = false;
|
|
48
|
-
/**
|
|
49
|
-
* copyCodeTooltips?: ICopyCodeTooltips
|
|
50
|
-
*
|
|
51
|
-
* Tooltips for copy button to copy and upon copying.
|
|
52
|
-
*/
|
|
53
|
-
this.copyCodeTooltips = {};
|
|
54
|
-
this.buttonClicked = new EventEmitter();
|
|
55
|
-
this.itemSelected = new EventEmitter();
|
|
56
|
-
this.historyStack = []; // history
|
|
57
|
-
this.currentMenuItems = []; // current menu items
|
|
58
|
-
this.loading = false;
|
|
59
|
-
}
|
|
60
|
-
clickListener(event) {
|
|
61
|
-
const element = event.srcElement;
|
|
62
|
-
if (element.matches('a[href]') &&
|
|
63
|
-
isMarkdownHref(element)) {
|
|
64
|
-
this.handleLinkClick(event);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
get showGoBackButton() {
|
|
68
|
-
return this.historyStack.length > 0;
|
|
69
|
-
}
|
|
70
|
-
get showHeader() {
|
|
71
|
-
return !!this.currentItemTitle;
|
|
72
|
-
}
|
|
73
|
-
get showMenu() {
|
|
74
|
-
const showMenu = this.currentMenuItems && this.currentMenuItems.length > 0;
|
|
75
|
-
return showMenu !== null && showMenu !== void 0 ? showMenu : false;
|
|
76
|
-
}
|
|
77
|
-
get showTdMarkdownLoader() {
|
|
78
|
-
return (!!this.currentMarkdownItem &&
|
|
79
|
-
!!this.currentMarkdownItem.url &&
|
|
80
|
-
!this.showTdMarkdown);
|
|
81
|
-
}
|
|
82
|
-
get showTdMarkdown() {
|
|
83
|
-
return (!!this.currentMarkdownItem && !!this.currentMarkdownItem.markdownString);
|
|
84
|
-
}
|
|
85
|
-
get url() {
|
|
86
|
-
if (this.currentMarkdownItem) {
|
|
87
|
-
return this.currentMarkdownItem.url;
|
|
88
|
-
}
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
get footerComponent() {
|
|
92
|
-
if (this.currentMarkdownItem && this.currentMarkdownItem.footer) {
|
|
93
|
-
return this.currentMarkdownItem.footer;
|
|
94
|
-
}
|
|
95
|
-
return this.footer;
|
|
96
|
-
}
|
|
97
|
-
get httpOptions() {
|
|
98
|
-
if (this.currentMarkdownItem) {
|
|
99
|
-
return this.currentMarkdownItem.httpOptions;
|
|
100
|
-
}
|
|
101
|
-
return undefined;
|
|
102
|
-
}
|
|
103
|
-
get markdownString() {
|
|
104
|
-
if (this.currentMarkdownItem) {
|
|
105
|
-
return this.currentMarkdownItem.markdownString;
|
|
106
|
-
}
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
get anchor() {
|
|
110
|
-
if (this.currentMarkdownItem) {
|
|
111
|
-
return this.currentMarkdownItem.anchor;
|
|
112
|
-
}
|
|
113
|
-
return undefined;
|
|
114
|
-
}
|
|
115
|
-
get showEmptyState() {
|
|
116
|
-
return !this.items || this.items.length < 1;
|
|
117
|
-
}
|
|
118
|
-
get goHomeLabel() {
|
|
119
|
-
return ((this.labels && this.labels.goHome) ||
|
|
120
|
-
DEFAULT_MARKDOWN_NAVIGATOR_LABELS.goHome);
|
|
121
|
-
}
|
|
122
|
-
get goBackLabel() {
|
|
123
|
-
return ((this.labels && this.labels.goBack) ||
|
|
124
|
-
DEFAULT_MARKDOWN_NAVIGATOR_LABELS.goBack);
|
|
125
|
-
}
|
|
126
|
-
get emptyStateLabel() {
|
|
127
|
-
return ((this.labels && this.labels.emptyState) ||
|
|
128
|
-
DEFAULT_MARKDOWN_NAVIGATOR_LABELS.emptyState);
|
|
129
|
-
}
|
|
130
|
-
get currentItemTitle() {
|
|
131
|
-
if (this.currentMarkdownItem) {
|
|
132
|
-
return this.getTitle(this.currentMarkdownItem);
|
|
133
|
-
}
|
|
134
|
-
else if (this.historyStack.length > 0) {
|
|
135
|
-
return this.getTitle(this.historyStack[this.historyStack.length - 1]);
|
|
136
|
-
}
|
|
137
|
-
return '';
|
|
138
|
-
}
|
|
139
|
-
ngOnChanges(changes) {
|
|
140
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
if (changes['items']) {
|
|
142
|
-
this.reset();
|
|
143
|
-
}
|
|
144
|
-
if (changes['startAt'] && this.items && this.startAt) {
|
|
145
|
-
this._jumpTo(this.startAt, undefined);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
hasChildrenOrChildrenUrl(item) {
|
|
150
|
-
return (item.children && item.children.length > 0) || !!item.childrenUrl;
|
|
151
|
-
}
|
|
152
|
-
clearErrors() {
|
|
153
|
-
this.markdownLoaderError = undefined;
|
|
154
|
-
this.childrenUrlError = undefined;
|
|
155
|
-
}
|
|
156
|
-
reset() {
|
|
157
|
-
this.loading = false;
|
|
158
|
-
this.clearErrors();
|
|
159
|
-
// if single item and no children
|
|
160
|
-
if (this.items &&
|
|
161
|
-
this.items.length === 1 &&
|
|
162
|
-
!this.hasChildrenOrChildrenUrl(this.items[0])) {
|
|
163
|
-
this.currentMenuItems = [];
|
|
164
|
-
this.currentMarkdownItem = this.items[0];
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
this.currentMenuItems = this.items;
|
|
168
|
-
this.currentMarkdownItem = undefined;
|
|
169
|
-
}
|
|
170
|
-
this.historyStack = [];
|
|
171
|
-
this.itemSelected.emit(undefined);
|
|
172
|
-
this._changeDetectorRef.markForCheck();
|
|
173
|
-
}
|
|
174
|
-
goBack(goBackLength = 2) {
|
|
175
|
-
this.loading = false;
|
|
176
|
-
this.clearErrors();
|
|
177
|
-
let parent = this.historyStack[this.historyStack.length - goBackLength];
|
|
178
|
-
if (parent === null || parent === void 0 ? void 0 : parent.startAtLink) {
|
|
179
|
-
parent = this.historyStack[this.historyStack.length - 3]
|
|
180
|
-
? this.historyStack[this.historyStack.length - 3]
|
|
181
|
-
: undefined;
|
|
182
|
-
this.historyStack = this.historyStack.slice(0, -goBackLength);
|
|
183
|
-
}
|
|
184
|
-
if (parent) {
|
|
185
|
-
this.currentMarkdownItem = parent;
|
|
186
|
-
this.historyStack = this.historyStack.slice(0, this.historyStack.length - goBackLength + 1);
|
|
187
|
-
this.setChildrenAsCurrentMenuItems(parent);
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
this.reset();
|
|
191
|
-
}
|
|
192
|
-
this.itemSelected.emit(parent);
|
|
193
|
-
this._changeDetectorRef.markForCheck();
|
|
194
|
-
}
|
|
195
|
-
handleItemSelected(item) {
|
|
196
|
-
this.clearErrors();
|
|
197
|
-
this.currentMarkdownItem = item;
|
|
198
|
-
this.historyStack = [...this.historyStack, item];
|
|
199
|
-
this.setChildrenAsCurrentMenuItems(item);
|
|
200
|
-
this.itemSelected.emit(item);
|
|
201
|
-
this._changeDetectorRef.markForCheck();
|
|
202
|
-
}
|
|
203
|
-
setChildrenAsCurrentMenuItems(item) {
|
|
204
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
-
this.currentMenuItems = [];
|
|
206
|
-
this.loading = true;
|
|
207
|
-
this._changeDetectorRef.markForCheck();
|
|
208
|
-
const stackSnapshot = this.historyStack;
|
|
209
|
-
let children = [];
|
|
210
|
-
if (item.children) {
|
|
211
|
-
children = item.children;
|
|
212
|
-
}
|
|
213
|
-
else if (item.childrenUrl) {
|
|
214
|
-
children = yield this.loadChildrenUrl(item);
|
|
215
|
-
}
|
|
216
|
-
if (children && children.length && item.startAtLink) {
|
|
217
|
-
this._jumpTo(item.startAtLink, children);
|
|
218
|
-
}
|
|
219
|
-
const newStackSnapshot = this.historyStack;
|
|
220
|
-
if (stackSnapshot.length === newStackSnapshot.length &&
|
|
221
|
-
stackSnapshot.every((stackItem, index) => stackItem === newStackSnapshot[index])) {
|
|
222
|
-
this.currentMenuItems = children;
|
|
223
|
-
}
|
|
224
|
-
this.loading = false;
|
|
225
|
-
this._changeDetectorRef.markForCheck();
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
loadChildrenUrl(item) {
|
|
229
|
-
var _a, _b;
|
|
230
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
-
const sanitizedUrl = (_b = this._sanitizer.sanitize(SecurityContext.URL, (_a = item.childrenUrl) !== null && _a !== void 0 ? _a : null)) !== null && _b !== void 0 ? _b : '';
|
|
232
|
-
try {
|
|
233
|
-
return yield firstValueFrom(this._http.get(sanitizedUrl, Object.assign({}, item.httpOptions)));
|
|
234
|
-
}
|
|
235
|
-
catch (error) {
|
|
236
|
-
this.handleChildrenUrlError(error);
|
|
237
|
-
return [];
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
getTitle(item) {
|
|
242
|
-
var _a, _b, _c;
|
|
243
|
-
if (!item) {
|
|
244
|
-
return '';
|
|
245
|
-
}
|
|
246
|
-
return (removeLeadingHash((_a = item.anchor) !== null && _a !== void 0 ? _a : '') ||
|
|
247
|
-
item.title ||
|
|
248
|
-
getTitleFromUrl((_b = item.url) !== null && _b !== void 0 ? _b : '') ||
|
|
249
|
-
getTitleFromMarkdownString((_c = item.markdownString) !== null && _c !== void 0 ? _c : '') ||
|
|
250
|
-
'').trim();
|
|
251
|
-
}
|
|
252
|
-
getIcon(item) {
|
|
253
|
-
return (item === null || item === void 0 ? void 0 : item.icon) || 'subject';
|
|
254
|
-
}
|
|
255
|
-
handleChildrenUrlError(error) {
|
|
256
|
-
this.childrenUrlError = error.message;
|
|
257
|
-
this._changeDetectorRef.markForCheck();
|
|
258
|
-
}
|
|
259
|
-
handleMarkdownLoaderError(error) {
|
|
260
|
-
this.markdownLoaderError = error ? error.message : '';
|
|
261
|
-
this._changeDetectorRef.markForCheck();
|
|
262
|
-
}
|
|
263
|
-
_jumpTo(itemOrPath, children) {
|
|
264
|
-
var _a;
|
|
265
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
-
const historyStack = this.historyStack;
|
|
267
|
-
let path = [];
|
|
268
|
-
if ((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) {
|
|
269
|
-
if (Array.isArray(itemOrPath)) {
|
|
270
|
-
path = yield this.followPath(this.items, itemOrPath);
|
|
271
|
-
}
|
|
272
|
-
else if (children && children.length > 0) {
|
|
273
|
-
this.historyStack = historyStack;
|
|
274
|
-
path = this.findPath(children, itemOrPath);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
path = this.findPath(this.items, itemOrPath);
|
|
278
|
-
}
|
|
279
|
-
path.forEach((pathItem, index) => {
|
|
280
|
-
if (index === 0) {
|
|
281
|
-
this.reset();
|
|
282
|
-
}
|
|
283
|
-
this.handleItemSelected(pathItem);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
return !!path.length;
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
followPath(items, path) {
|
|
290
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
291
|
-
let pathItems = [];
|
|
292
|
-
let currentLevel = items;
|
|
293
|
-
const compareWith = this.compareWith || defaultCompareWith;
|
|
294
|
-
for (const pathItem of path) {
|
|
295
|
-
const foundItem = currentLevel.find((item) => compareWith(pathItem, item));
|
|
296
|
-
if (foundItem) {
|
|
297
|
-
pathItems = [...pathItems, foundItem];
|
|
298
|
-
if (foundItem.children) {
|
|
299
|
-
currentLevel = foundItem.children;
|
|
300
|
-
}
|
|
301
|
-
else if (foundItem.childrenUrl) {
|
|
302
|
-
currentLevel = yield this.loadChildrenUrl(foundItem);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
break;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
if (pathItems.length !== path.length) {
|
|
310
|
-
pathItems = [];
|
|
311
|
-
}
|
|
312
|
-
return pathItems;
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
findPath(items, item) {
|
|
316
|
-
const compareWith = this.compareWith || defaultCompareWith;
|
|
317
|
-
if (items) {
|
|
318
|
-
for (const child of items) {
|
|
319
|
-
if (item && compareWith(child, item)) {
|
|
320
|
-
return [child];
|
|
321
|
-
}
|
|
322
|
-
const ancestors = this.findPath(child.children, item);
|
|
323
|
-
if (ancestors.length) {
|
|
324
|
-
return [child, ...ancestors];
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
return [];
|
|
329
|
-
}
|
|
330
|
-
handleLinkClick(event) {
|
|
331
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
332
|
-
event.preventDefault();
|
|
333
|
-
const link = event.target;
|
|
334
|
-
const url = new URL(link.href);
|
|
335
|
-
const urlParts = url.href.split('/');
|
|
336
|
-
const id = urlParts[urlParts.length - 1].split('.md')[0];
|
|
337
|
-
this.loading = true;
|
|
338
|
-
this._changeDetectorRef.markForCheck();
|
|
339
|
-
const pathFound = yield this._jumpTo({ id });
|
|
340
|
-
if (pathFound) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
try {
|
|
344
|
-
const markdownString = yield this._markdownUrlLoaderService.load(url.href);
|
|
345
|
-
// pass in url to be able to use currentMarkdownItem.url later on
|
|
346
|
-
this.handleItemSelected({ markdownString, url: url.href });
|
|
347
|
-
this.markdownWrapper.nativeElement.scrollTop = 0;
|
|
348
|
-
}
|
|
349
|
-
catch (error) {
|
|
350
|
-
const win = window.open(url.href, '_blank');
|
|
351
|
-
win === null || win === void 0 ? void 0 : win.focus();
|
|
352
|
-
}
|
|
353
|
-
finally {
|
|
354
|
-
this.loading = false;
|
|
355
|
-
}
|
|
356
|
-
this._changeDetectorRef.markForCheck();
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
TdMarkdownNavigatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdMarkdownNavigatorComponent, deps: [{ token: i1.TdMarkdownLoaderService }, { token: i0.ChangeDetectorRef }, { token: i2.DomSanitizer }, { token: i3.HttpClient }], target: i0.ɵɵFactoryTarget.Component });
|
|
361
|
-
TdMarkdownNavigatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: TdMarkdownNavigatorComponent, selector: "td-markdown-navigator", inputs: { items: "items", labels: "labels", startAt: "startAt", copyCodeToClipboard: "copyCodeToClipboard", copyCodeTooltips: "copyCodeTooltips", footer: "footer", compareWith: "compareWith" }, outputs: { buttonClicked: "buttonClicked", itemSelected: "itemSelected" }, host: { listeners: { "click": "clickListener($event)" } }, viewQueries: [{ propertyName: "markdownWrapper", first: true, predicate: ["markdownWrapper"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"!showEmptyState\">\n <mat-progress-bar\n *ngIf=\"loading\"\n mode=\"indeterminate\"\n color=\"accent\"\n ></mat-progress-bar>\n <ng-container *ngIf=\"showHeader\">\n <td-breadcrumbs>\n <a\n td-breadcrumb\n [matTooltip]=\"goHomeLabel ?? ''\"\n (click)=\"reset()\"\n [attr.data-test]=\"'home-button'\"\n >Home</a\n >\n <ng-container\n *ngFor=\"let stack of historyStack; last as isLast; index as index\"\n >\n <ng-container *ngIf=\"!isLast; else lastBreadCrumb\">\n <a\n td-breadcrumb\n (click)=\"goBack(historyStack.length - index)\"\n [attr.data-test]=\"'back-button'\"\n >{{ stack.title }}</a\n >\n </ng-container>\n <ng-template #lastBreadCrumb>\n <mat-icon class=\"breadcrumb-end-icon\">chevron_right</mat-icon>\n </ng-template>\n </ng-container>\n </td-breadcrumbs>\n <div class=\"breadcrumb-current-title\" [attr.data-test]=\"'title'\">\n {{ currentItemTitle }}\n </div>\n\n <mat-divider [style.position]=\"'relative'\"></mat-divider>\n </ng-container>\n\n <div class=\"scroll-area\" id=\"td-markdown-navigator-content\">\n <div\n *ngIf=\"showTdMarkdownLoader || showTdMarkdown\"\n class=\"markdown-wrapper\"\n #markdownWrapper\n >\n <td-message\n *ngIf=\"markdownLoaderError\"\n [sublabel]=\"markdownLoaderError\"\n color=\"warn\"\n icon=\"error\"\n [attr.data-test]=\"'markdown-loader-error'\"\n ></td-message>\n <td-flavored-markdown-loader\n *ngIf=\"showTdMarkdownLoader\"\n [url]=\"url ?? ''\"\n [httpOptions]=\"httpOptions ?? {}\"\n [anchor]=\"anchor ?? ''\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n (loadFailed)=\"handleMarkdownLoaderError($event)\"\n (buttonClicked)=\"buttonClicked.emit($event)\"\n ></td-flavored-markdown-loader>\n <td-flavored-markdown\n *ngIf=\"showTdMarkdown\"\n [content]=\"markdownString ?? ''\"\n [hostedUrl]=\"url ?? ''\"\n [anchor]=\"anchor ?? ''\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n (buttonClicked)=\"buttonClicked.emit($event)\"\n ></td-flavored-markdown>\n </div>\n\n <td-message\n *ngIf=\"childrenUrlError\"\n [sublabel]=\"childrenUrlError\"\n color=\"warn\"\n icon=\"error\"\n [attr.data-test]=\"'children-url-error'\"\n ></td-message>\n <div *ngIf=\"showMenu\" class=\"td-markdown-list\">\n <mat-action-list>\n <button\n *ngFor=\"let item of currentMenuItems; index as index\"\n [id]=\"\n 'td-markdown-navigator-list-item-' + (item.id ? item.id : index)\n \"\n (click)=\"handleItemSelected(item)\"\n mat-list-item\n [matTooltip]=\"getTitle(item)\"\n matTooltipPosition=\"before\"\n matTooltipShowDelay=\"500\"\n >\n <mat-icon matListIcon>\n {{ getIcon(item) }}\n </mat-icon>\n <span matListItemLine class=\"truncate\">\n {{ getTitle(item) }}\n </span>\n <span matListItemLine class=\"truncate\">{{ item.description }}</span>\n <mat-divider></mat-divider>\n </button>\n </mat-action-list>\n </div>\n\n <ng-container *ngComponentOutlet=\"footerComponent\"></ng-container>\n </div>\n</ng-container>\n\n<div\n *ngIf=\"showEmptyState\"\n layout=\"column\"\n layout-align=\"center center\"\n class=\"empty-state\"\n>\n <mat-icon matListItemAvatar>subject</mat-icon>\n <h2>{{ emptyStateLabel }}</h2>\n</div>\n", styles: [":host{position:relative;height:inherit;height:100%;box-sizing:border-box;display:flex;flex-direction:column}:host td-breadcrumbs::ng-deep{margin:16px 16px 8px}:host td-breadcrumbs::ng-deep mat-icon{font-size:16px;margin-left:1px;margin-right:0;margin-top:-1px}:host .breadcrumb-end-icon{line-height:16px;margin-top:1px}:host .breadcrumb-current-title{font-weight:700;margin:0 16px 16px}:host .scroll-area{min-height:1px;overflow-y:auto;flex:1;box-sizing:border-box}:host .markdown-wrapper{padding:16px 16px 0}:host .td-markdown-list>.mat-list{padding-top:0}:host td-flavored-markdown-loader ::ng-deep .mat-progress-bar{top:0;left:0;right:0;position:absolute}:host .title{display:inline-block;vertical-align:middle;margin:8px 0;padding-left:16px}.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.empty-state{padding:32px}.empty-state mat-icon{font-size:4em}\n"], dependencies: [{ kind: "directive", type: i4.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i6.MatActionList, selector: "mat-action-list", exportAs: ["matActionList"] }, { kind: "component", type: i6.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: i6.MatListItemAvatar, selector: "[matListItemAvatar]" }, { kind: "component", type: i7.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: i6.MatListItemLine, selector: "[matListItemLine]" }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i9.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i10.TdBreadcrumbsComponent, selector: "td-breadcrumbs", inputs: ["separatorIcon"] }, { kind: "component", type: i10.TdBreadcrumbComponent, selector: "td-breadcrumb, a[td-breadcrumb]" }, { kind: "component", type: i11.TdFlavoredMarkdownComponent, selector: "td-flavored-markdown", inputs: ["content", "simpleLineBreaks", "hostedUrl", "anchor", "copyCodeToClipboard", "copyCodeTooltips", "toggleRawCode", "rawToggleLabels", "useCfmList"], outputs: ["contentReady", "buttonClicked"] }, { kind: "component", type: i11.TdFlavoredMarkdownLoaderComponent, selector: "td-flavored-markdown-loader", inputs: ["url", "httpOptions", "anchor", "copyCodeToClipboard", "copyCodeTooltips", "useCfmList"], outputs: ["contentReady", "loadFailed", "buttonClicked"] }, { kind: "component", type: i12.TdMessageComponent, selector: "td-message", inputs: ["label", "sublabel", "icon", "color", "opened"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
362
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdMarkdownNavigatorComponent, decorators: [{
|
|
363
|
-
type: Component,
|
|
364
|
-
args: [{ selector: 'td-markdown-navigator', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"!showEmptyState\">\n <mat-progress-bar\n *ngIf=\"loading\"\n mode=\"indeterminate\"\n color=\"accent\"\n ></mat-progress-bar>\n <ng-container *ngIf=\"showHeader\">\n <td-breadcrumbs>\n <a\n td-breadcrumb\n [matTooltip]=\"goHomeLabel ?? ''\"\n (click)=\"reset()\"\n [attr.data-test]=\"'home-button'\"\n >Home</a\n >\n <ng-container\n *ngFor=\"let stack of historyStack; last as isLast; index as index\"\n >\n <ng-container *ngIf=\"!isLast; else lastBreadCrumb\">\n <a\n td-breadcrumb\n (click)=\"goBack(historyStack.length - index)\"\n [attr.data-test]=\"'back-button'\"\n >{{ stack.title }}</a\n >\n </ng-container>\n <ng-template #lastBreadCrumb>\n <mat-icon class=\"breadcrumb-end-icon\">chevron_right</mat-icon>\n </ng-template>\n </ng-container>\n </td-breadcrumbs>\n <div class=\"breadcrumb-current-title\" [attr.data-test]=\"'title'\">\n {{ currentItemTitle }}\n </div>\n\n <mat-divider [style.position]=\"'relative'\"></mat-divider>\n </ng-container>\n\n <div class=\"scroll-area\" id=\"td-markdown-navigator-content\">\n <div\n *ngIf=\"showTdMarkdownLoader || showTdMarkdown\"\n class=\"markdown-wrapper\"\n #markdownWrapper\n >\n <td-message\n *ngIf=\"markdownLoaderError\"\n [sublabel]=\"markdownLoaderError\"\n color=\"warn\"\n icon=\"error\"\n [attr.data-test]=\"'markdown-loader-error'\"\n ></td-message>\n <td-flavored-markdown-loader\n *ngIf=\"showTdMarkdownLoader\"\n [url]=\"url ?? ''\"\n [httpOptions]=\"httpOptions ?? {}\"\n [anchor]=\"anchor ?? ''\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n (loadFailed)=\"handleMarkdownLoaderError($event)\"\n (buttonClicked)=\"buttonClicked.emit($event)\"\n ></td-flavored-markdown-loader>\n <td-flavored-markdown\n *ngIf=\"showTdMarkdown\"\n [content]=\"markdownString ?? ''\"\n [hostedUrl]=\"url ?? ''\"\n [anchor]=\"anchor ?? ''\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n (buttonClicked)=\"buttonClicked.emit($event)\"\n ></td-flavored-markdown>\n </div>\n\n <td-message\n *ngIf=\"childrenUrlError\"\n [sublabel]=\"childrenUrlError\"\n color=\"warn\"\n icon=\"error\"\n [attr.data-test]=\"'children-url-error'\"\n ></td-message>\n <div *ngIf=\"showMenu\" class=\"td-markdown-list\">\n <mat-action-list>\n <button\n *ngFor=\"let item of currentMenuItems; index as index\"\n [id]=\"\n 'td-markdown-navigator-list-item-' + (item.id ? item.id : index)\n \"\n (click)=\"handleItemSelected(item)\"\n mat-list-item\n [matTooltip]=\"getTitle(item)\"\n matTooltipPosition=\"before\"\n matTooltipShowDelay=\"500\"\n >\n <mat-icon matListIcon>\n {{ getIcon(item) }}\n </mat-icon>\n <span matListItemLine class=\"truncate\">\n {{ getTitle(item) }}\n </span>\n <span matListItemLine class=\"truncate\">{{ item.description }}</span>\n <mat-divider></mat-divider>\n </button>\n </mat-action-list>\n </div>\n\n <ng-container *ngComponentOutlet=\"footerComponent\"></ng-container>\n </div>\n</ng-container>\n\n<div\n *ngIf=\"showEmptyState\"\n layout=\"column\"\n layout-align=\"center center\"\n class=\"empty-state\"\n>\n <mat-icon matListItemAvatar>subject</mat-icon>\n <h2>{{ emptyStateLabel }}</h2>\n</div>\n", styles: [":host{position:relative;height:inherit;height:100%;box-sizing:border-box;display:flex;flex-direction:column}:host td-breadcrumbs::ng-deep{margin:16px 16px 8px}:host td-breadcrumbs::ng-deep mat-icon{font-size:16px;margin-left:1px;margin-right:0;margin-top:-1px}:host .breadcrumb-end-icon{line-height:16px;margin-top:1px}:host .breadcrumb-current-title{font-weight:700;margin:0 16px 16px}:host .scroll-area{min-height:1px;overflow-y:auto;flex:1;box-sizing:border-box}:host .markdown-wrapper{padding:16px 16px 0}:host .td-markdown-list>.mat-list{padding-top:0}:host td-flavored-markdown-loader ::ng-deep .mat-progress-bar{top:0;left:0;right:0;position:absolute}:host .title{display:inline-block;vertical-align:middle;margin:8px 0;padding-left:16px}.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.empty-state{padding:32px}.empty-state mat-icon{font-size:4em}\n"] }]
|
|
365
|
-
}], ctorParameters: function () { return [{ type: i1.TdMarkdownLoaderService }, { type: i0.ChangeDetectorRef }, { type: i2.DomSanitizer }, { type: i3.HttpClient }]; }, propDecorators: { items: [{
|
|
366
|
-
type: Input
|
|
367
|
-
}], labels: [{
|
|
368
|
-
type: Input
|
|
369
|
-
}], startAt: [{
|
|
370
|
-
type: Input
|
|
371
|
-
}], copyCodeToClipboard: [{
|
|
372
|
-
type: Input
|
|
373
|
-
}], copyCodeTooltips: [{
|
|
374
|
-
type: Input
|
|
375
|
-
}], footer: [{
|
|
376
|
-
type: Input
|
|
377
|
-
}], compareWith: [{
|
|
378
|
-
type: Input
|
|
379
|
-
}], buttonClicked: [{
|
|
380
|
-
type: Output
|
|
381
|
-
}], itemSelected: [{
|
|
382
|
-
type: Output
|
|
383
|
-
}], markdownWrapper: [{
|
|
384
|
-
type: ViewChild,
|
|
385
|
-
args: ['markdownWrapper']
|
|
386
|
-
}], clickListener: [{
|
|
387
|
-
type: HostListener,
|
|
388
|
-
args: ['click', ['$event']]
|
|
389
|
-
}] } });
|
|
390
|
-
function getTitleFromUrl(url) {
|
|
391
|
-
if (url) {
|
|
392
|
-
const temp = new URL(url);
|
|
393
|
-
if (temp.hash) {
|
|
394
|
-
return removeLeadingHash(temp.hash);
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
const path = temp.pathname.split('/');
|
|
398
|
-
const fileName = path[path.length - 1];
|
|
399
|
-
return fileName.replace(/\.[^/.]+$/, ''); // remove .md
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
return '';
|
|
403
|
-
}
|
|
404
|
-
function getTitleFromMarkdownString(markdownString) {
|
|
405
|
-
var _a;
|
|
406
|
-
if (markdownString) {
|
|
407
|
-
const firstLine = (_a = markdownString.split(/[\r\n]+/).find((line) => !!line)) !== null && _a !== void 0 ? _a : '';
|
|
408
|
-
return removeLeadingHash(firstLine).trim();
|
|
409
|
-
}
|
|
410
|
-
return '';
|
|
411
|
-
}
|
|
412
|
-
function isMarkdownHref(anchor) {
|
|
413
|
-
return !isAnchorLink(anchor) && anchor.pathname.endsWith('.md');
|
|
414
|
-
}
|
|
415
|
-
function defaultCompareWith(o1, o2) {
|
|
416
|
-
if (o1.id && o2.id) {
|
|
417
|
-
return o1.id === o2.id;
|
|
418
|
-
}
|
|
419
|
-
return o1 === o2;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
const DEFAULT_MARKDOWN_NAVIGATOR_WINDOW_LABELS = {
|
|
423
|
-
title: 'Help',
|
|
424
|
-
close: 'Close',
|
|
425
|
-
dock: 'Dock',
|
|
426
|
-
unDock: 'Undock',
|
|
427
|
-
};
|
|
428
|
-
class TdMarkdownNavigatorWindowComponent {
|
|
429
|
-
constructor() {
|
|
430
|
-
this.toolbarColor = 'primary';
|
|
431
|
-
this.docked = false;
|
|
432
|
-
this.copyCodeToClipboard = false;
|
|
433
|
-
this.copyCodeTooltips = {};
|
|
434
|
-
this.closed = new EventEmitter();
|
|
435
|
-
this.dockToggled = new EventEmitter();
|
|
436
|
-
this.buttonClicked = new EventEmitter();
|
|
437
|
-
this.itemSelected = new EventEmitter();
|
|
438
|
-
}
|
|
439
|
-
get markdownNavigatorLabels() {
|
|
440
|
-
if (!this.labels) {
|
|
441
|
-
return undefined;
|
|
442
|
-
}
|
|
443
|
-
const { goHome, goBack, emptyState } = this.labels;
|
|
444
|
-
return {
|
|
445
|
-
goHome,
|
|
446
|
-
goBack,
|
|
447
|
-
emptyState,
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
get titleLabel() {
|
|
451
|
-
return ((this.labels && this.labels.title) ||
|
|
452
|
-
DEFAULT_MARKDOWN_NAVIGATOR_WINDOW_LABELS.title);
|
|
453
|
-
}
|
|
454
|
-
get closeLabel() {
|
|
455
|
-
return ((this.labels && this.labels.close) ||
|
|
456
|
-
DEFAULT_MARKDOWN_NAVIGATOR_WINDOW_LABELS.close);
|
|
457
|
-
}
|
|
458
|
-
get toggleDockedStateLabel() {
|
|
459
|
-
if (this.docked) {
|
|
460
|
-
return ((this.labels && this.labels.unDock) ||
|
|
461
|
-
DEFAULT_MARKDOWN_NAVIGATOR_WINDOW_LABELS.unDock);
|
|
462
|
-
}
|
|
463
|
-
else {
|
|
464
|
-
return ((this.labels && this.labels.dock) ||
|
|
465
|
-
DEFAULT_MARKDOWN_NAVIGATOR_WINDOW_LABELS.dock);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
toggleDockedState() {
|
|
469
|
-
this.dockToggled.emit(this.docked);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
TdMarkdownNavigatorWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdMarkdownNavigatorWindowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
473
|
-
TdMarkdownNavigatorWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: TdMarkdownNavigatorWindowComponent, selector: "td-markdown-navigator-window", inputs: { items: "items", labels: "labels", toolbarColor: "toolbarColor", startAt: "startAt", compareWith: "compareWith", docked: "docked", copyCodeToClipboard: "copyCodeToClipboard", copyCodeTooltips: "copyCodeTooltips", footer: "footer" }, outputs: { closed: "closed", dockToggled: "dockToggled", buttonClicked: "buttonClicked", itemSelected: "itemSelected" }, ngImport: i0, template: "<td-window-dialog\n [toolbarColor]=\"toolbarColor\"\n [docked]=\"docked\"\n [title]=\"titleLabel\"\n [toggleDockedStateLabel]=\"toggleDockedStateLabel\"\n [closeLabel]=\"closeLabel\"\n (dockToggled)=\"toggleDockedState()\"\n (closed)=\"closed.emit()\"\n>\n <td-markdown-navigator\n [items]=\"items\"\n [labels]=\"markdownNavigatorLabels\"\n [style.display]=\"docked ? 'none' : 'inherit'\"\n [startAt]=\"startAt\"\n [compareWith]=\"compareWith\"\n [footer]=\"footer\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n (buttonClicked)=\"buttonClicked.emit($event)\"\n (itemSelected)=\"itemSelected.emit($event)\"\n ></td-markdown-navigator>\n</td-window-dialog>\n", styles: [":host{height:100%;display:flex;flex-direction:column}td-markdown-navigator{height:calc(100% - 56px)}\n"], dependencies: [{ kind: "component", type: i1$1.TdWindowDialogComponent, selector: "td-window-dialog", inputs: ["toolbarColor", "docked", "title", "toggleDockedStateLabel", "closeLabel"], outputs: ["dockToggled", "closed"] }, { kind: "component", type: TdMarkdownNavigatorComponent, selector: "td-markdown-navigator", inputs: ["items", "labels", "startAt", "copyCodeToClipboard", "copyCodeTooltips", "footer", "compareWith"], outputs: ["buttonClicked", "itemSelected"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
474
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdMarkdownNavigatorWindowComponent, decorators: [{
|
|
475
|
-
type: Component,
|
|
476
|
-
args: [{ selector: 'td-markdown-navigator-window', changeDetection: ChangeDetectionStrategy.OnPush, template: "<td-window-dialog\n [toolbarColor]=\"toolbarColor\"\n [docked]=\"docked\"\n [title]=\"titleLabel\"\n [toggleDockedStateLabel]=\"toggleDockedStateLabel\"\n [closeLabel]=\"closeLabel\"\n (dockToggled)=\"toggleDockedState()\"\n (closed)=\"closed.emit()\"\n>\n <td-markdown-navigator\n [items]=\"items\"\n [labels]=\"markdownNavigatorLabels\"\n [style.display]=\"docked ? 'none' : 'inherit'\"\n [startAt]=\"startAt\"\n [compareWith]=\"compareWith\"\n [footer]=\"footer\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n (buttonClicked)=\"buttonClicked.emit($event)\"\n (itemSelected)=\"itemSelected.emit($event)\"\n ></td-markdown-navigator>\n</td-window-dialog>\n", styles: [":host{height:100%;display:flex;flex-direction:column}td-markdown-navigator{height:calc(100% - 56px)}\n"] }]
|
|
477
|
-
}], propDecorators: { items: [{
|
|
478
|
-
type: Input
|
|
479
|
-
}], labels: [{
|
|
480
|
-
type: Input
|
|
481
|
-
}], toolbarColor: [{
|
|
482
|
-
type: Input
|
|
483
|
-
}], startAt: [{
|
|
484
|
-
type: Input
|
|
485
|
-
}], compareWith: [{
|
|
486
|
-
type: Input
|
|
487
|
-
}], docked: [{
|
|
488
|
-
type: Input
|
|
489
|
-
}], copyCodeToClipboard: [{
|
|
490
|
-
type: Input
|
|
491
|
-
}], copyCodeTooltips: [{
|
|
492
|
-
type: Input
|
|
493
|
-
}], footer: [{
|
|
494
|
-
type: Input
|
|
495
|
-
}], closed: [{
|
|
496
|
-
type: Output
|
|
497
|
-
}], dockToggled: [{
|
|
498
|
-
type: Output
|
|
499
|
-
}], buttonClicked: [{
|
|
500
|
-
type: Output
|
|
501
|
-
}], itemSelected: [{
|
|
502
|
-
type: Output
|
|
503
|
-
}] } });
|
|
504
|
-
|
|
505
|
-
const CDK_OVERLAY_CUSTOM_CLASS = 'td-window-dialog';
|
|
506
|
-
const DEFAULT_POSITION = { bottom: '0px', right: '0px' };
|
|
507
|
-
const DEFAULT_WIDTH = '360px';
|
|
508
|
-
const DEFAULT_HEIGHT = '75vh';
|
|
509
|
-
const MIN_HEIGHT = '56px';
|
|
510
|
-
const MAX_WIDTH = '100vw';
|
|
511
|
-
const DEFAULT_DRAGGABLE_DIALOG_CONFIG = {
|
|
512
|
-
hasBackdrop: false,
|
|
513
|
-
closeOnNavigation: true,
|
|
514
|
-
panelClass: [CDK_OVERLAY_CUSTOM_CLASS],
|
|
515
|
-
position: DEFAULT_POSITION,
|
|
516
|
-
height: DEFAULT_HEIGHT,
|
|
517
|
-
width: DEFAULT_WIDTH,
|
|
518
|
-
maxWidth: MAX_WIDTH,
|
|
519
|
-
};
|
|
520
|
-
class TdMarkdownNavigatorWindowService {
|
|
521
|
-
constructor(_tdDialogService, _document, rendererFactory) {
|
|
522
|
-
this._tdDialogService = _tdDialogService;
|
|
523
|
-
this._document = _document;
|
|
524
|
-
this.rendererFactory = rendererFactory;
|
|
525
|
-
this.markdownNavigatorWindowDialogsOpen = 0;
|
|
526
|
-
this._renderer2 = rendererFactory.createRenderer(undefined, null);
|
|
527
|
-
}
|
|
528
|
-
open(config) {
|
|
529
|
-
var _a;
|
|
530
|
-
this.close();
|
|
531
|
-
const configClass = (_a = config === null || config === void 0 ? void 0 : config.dialogConfig) === null || _a === void 0 ? void 0 : _a.panelClass;
|
|
532
|
-
const panelClass = configClass && !Array.isArray(configClass) ? [configClass] : [];
|
|
533
|
-
const draggableConfig = Object.assign(Object.assign(Object.assign({}, DEFAULT_DRAGGABLE_DIALOG_CONFIG), config.dialogConfig), panelClass);
|
|
534
|
-
const { matDialogRef, dragRefSubject, } = this._tdDialogService.openDraggable({
|
|
535
|
-
component: TdMarkdownNavigatorWindowComponent,
|
|
536
|
-
config: draggableConfig,
|
|
537
|
-
dragHandleSelectors: ['.td-window-dialog-toolbar'],
|
|
538
|
-
draggableClass: 'td-draggable-markdown-navigator-window',
|
|
539
|
-
});
|
|
540
|
-
this.markdownNavigatorWindowDialog = matDialogRef;
|
|
541
|
-
this.markdownNavigatorWindowDialog.componentInstance.items = config.items;
|
|
542
|
-
this.markdownNavigatorWindowDialog.componentInstance.labels = config.labels;
|
|
543
|
-
this.markdownNavigatorWindowDialog.componentInstance.startAt =
|
|
544
|
-
config.startAt;
|
|
545
|
-
this.markdownNavigatorWindowDialog.componentInstance.copyCodeToClipboard =
|
|
546
|
-
config.copyCodeToClipboard;
|
|
547
|
-
this.markdownNavigatorWindowDialog.componentInstance.copyCodeTooltips =
|
|
548
|
-
config.copyCodeTooltips;
|
|
549
|
-
this.markdownNavigatorWindowDialog.componentInstance.compareWith =
|
|
550
|
-
config.compareWith;
|
|
551
|
-
this.markdownNavigatorWindowDialog.componentInstance.toolbarColor =
|
|
552
|
-
'toolbarColor' in config ? config.toolbarColor : 'primary';
|
|
553
|
-
this.markdownNavigatorWindowDialogsOpen++;
|
|
554
|
-
this.markdownNavigatorWindowDialog.componentInstance.footer = config.footer;
|
|
555
|
-
dragRefSubject.subscribe((dragRf) => {
|
|
556
|
-
this.dragRef = dragRf;
|
|
557
|
-
this.resizableDraggableDialog = new ResizableDraggableDialog(this._document, this._renderer2, this.markdownNavigatorWindowDialog, this.dragRef);
|
|
558
|
-
});
|
|
559
|
-
this._handleEvents();
|
|
560
|
-
return this.markdownNavigatorWindowDialog;
|
|
561
|
-
}
|
|
562
|
-
close() {
|
|
563
|
-
if (this.markdownNavigatorWindowDialog) {
|
|
564
|
-
if (this.resizableDraggableDialog) {
|
|
565
|
-
this.resizableDraggableDialog.detach();
|
|
566
|
-
}
|
|
567
|
-
this.markdownNavigatorWindowDialog.close();
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
get isOpen() {
|
|
571
|
-
return this.markdownNavigatorWindowDialogsOpen > 0;
|
|
572
|
-
}
|
|
573
|
-
_handleEvents() {
|
|
574
|
-
let position;
|
|
575
|
-
let dimensions;
|
|
576
|
-
this.markdownNavigatorWindowDialog.componentInstance.closed.subscribe(() => this.close());
|
|
577
|
-
this.markdownNavigatorWindowDialog.componentInstance.dockToggled.subscribe((docked) => {
|
|
578
|
-
if (docked) {
|
|
579
|
-
this.markdownNavigatorWindowDialog.componentInstance.docked = false;
|
|
580
|
-
this.markdownNavigatorWindowDialog.updateSize(dimensions.width, dimensions.height);
|
|
581
|
-
this.markdownNavigatorWindowDialog.updatePosition({
|
|
582
|
-
top: '0px',
|
|
583
|
-
right: '0px',
|
|
584
|
-
bottom: '0px',
|
|
585
|
-
left: '0px',
|
|
586
|
-
});
|
|
587
|
-
this.dragRef.setFreeDragPosition(position);
|
|
588
|
-
this.dragRef.disabled = false;
|
|
589
|
-
this.resizableDraggableDialog.attach();
|
|
590
|
-
}
|
|
591
|
-
else {
|
|
592
|
-
dimensions = this._getDialogSize(this.markdownNavigatorWindowDialog);
|
|
593
|
-
position = this.dragRef.getFreeDragPosition();
|
|
594
|
-
this.markdownNavigatorWindowDialog.componentInstance.docked = true;
|
|
595
|
-
this.markdownNavigatorWindowDialog.updateSize(DEFAULT_WIDTH, MIN_HEIGHT);
|
|
596
|
-
this.markdownNavigatorWindowDialog.updatePosition(DEFAULT_POSITION);
|
|
597
|
-
this.dragRef.reset();
|
|
598
|
-
this.dragRef.disabled = true;
|
|
599
|
-
this.resizableDraggableDialog.detach();
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
this.markdownNavigatorWindowDialog
|
|
603
|
-
.afterClosed()
|
|
604
|
-
.toPromise()
|
|
605
|
-
.then(() => {
|
|
606
|
-
this.markdownNavigatorWindowDialogsOpen--;
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
_getDialogSize(dialogRef) {
|
|
610
|
-
const { width, height } = getComputedStyle(this._document.getElementById(dialogRef.id).parentElement);
|
|
611
|
-
return {
|
|
612
|
-
width,
|
|
613
|
-
height,
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
TdMarkdownNavigatorWindowService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdMarkdownNavigatorWindowService, deps: [{ token: i1$1.TdDialogService }, { token: DOCUMENT }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
618
|
-
TdMarkdownNavigatorWindowService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdMarkdownNavigatorWindowService });
|
|
619
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdMarkdownNavigatorWindowService, decorators: [{
|
|
620
|
-
type: Injectable
|
|
621
|
-
}], ctorParameters: function () {
|
|
622
|
-
return [{ type: i1$1.TdDialogService }, { type: undefined, decorators: [{
|
|
623
|
-
type: Inject,
|
|
624
|
-
args: [DOCUMENT]
|
|
625
|
-
}] }, { type: i0.RendererFactory2 }];
|
|
626
|
-
} });
|
|
627
|
-
|
|
628
|
-
class TdMarkdownNavigatorWindowDirective {
|
|
629
|
-
constructor(_markdownNavigatorWindowService) {
|
|
630
|
-
this._markdownNavigatorWindowService = _markdownNavigatorWindowService;
|
|
631
|
-
this.disabled = false;
|
|
632
|
-
}
|
|
633
|
-
click() {
|
|
634
|
-
if (!this.disabled && this.config) {
|
|
635
|
-
this._markdownNavigatorWindowService.open(this.config);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
TdMarkdownNavigatorWindowDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdMarkdownNavigatorWindowDirective, deps: [{ token: TdMarkdownNavigatorWindowService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
640
|
-
TdMarkdownNavigatorWindowDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: TdMarkdownNavigatorWindowDirective, selector: "[tdMarkdownNavigatorWindow]", inputs: { config: ["tdMarkdownNavigatorWindow", "config"], disabled: "disabled" }, host: { listeners: { "click": "click()" } }, ngImport: i0 });
|
|
641
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdMarkdownNavigatorWindowDirective, decorators: [{
|
|
642
|
-
type: Directive,
|
|
643
|
-
args: [{
|
|
644
|
-
selector: '[tdMarkdownNavigatorWindow]',
|
|
645
|
-
}]
|
|
646
|
-
}], ctorParameters: function () { return [{ type: TdMarkdownNavigatorWindowService }]; }, propDecorators: { config: [{
|
|
647
|
-
type: Input,
|
|
648
|
-
args: ['tdMarkdownNavigatorWindow']
|
|
649
|
-
}], disabled: [{
|
|
650
|
-
type: Input
|
|
651
|
-
}], click: [{
|
|
652
|
-
type: HostListener,
|
|
653
|
-
args: ['click']
|
|
654
|
-
}] } });
|
|
655
|
-
|
|
656
|
-
class CovalentMarkdownNavigatorModule {
|
|
657
|
-
}
|
|
658
|
-
CovalentMarkdownNavigatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentMarkdownNavigatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
659
|
-
CovalentMarkdownNavigatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: CovalentMarkdownNavigatorModule, declarations: [TdMarkdownNavigatorComponent,
|
|
660
|
-
TdMarkdownNavigatorWindowComponent,
|
|
661
|
-
TdMarkdownNavigatorWindowDirective], imports: [CommonModule,
|
|
662
|
-
// material
|
|
663
|
-
MatButtonModule,
|
|
664
|
-
MatTooltipModule,
|
|
665
|
-
MatListModule,
|
|
666
|
-
MatIconModule,
|
|
667
|
-
MatProgressBarModule,
|
|
668
|
-
CovalentBreadcrumbsModule,
|
|
669
|
-
CovalentDialogsModule,
|
|
670
|
-
CovalentFlavoredMarkdownModule,
|
|
671
|
-
CovalentMessageModule], exports: [TdMarkdownNavigatorComponent,
|
|
672
|
-
TdMarkdownNavigatorWindowComponent,
|
|
673
|
-
TdMarkdownNavigatorWindowDirective] });
|
|
674
|
-
CovalentMarkdownNavigatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentMarkdownNavigatorModule, providers: [TdMarkdownNavigatorWindowService], imports: [CommonModule,
|
|
675
|
-
// material
|
|
676
|
-
MatButtonModule,
|
|
677
|
-
MatTooltipModule,
|
|
678
|
-
MatListModule,
|
|
679
|
-
MatIconModule,
|
|
680
|
-
MatProgressBarModule,
|
|
681
|
-
CovalentBreadcrumbsModule,
|
|
682
|
-
CovalentDialogsModule,
|
|
683
|
-
CovalentFlavoredMarkdownModule,
|
|
684
|
-
CovalentMessageModule] });
|
|
685
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentMarkdownNavigatorModule, decorators: [{
|
|
686
|
-
type: NgModule,
|
|
687
|
-
args: [{
|
|
688
|
-
imports: [
|
|
689
|
-
CommonModule,
|
|
690
|
-
// material
|
|
691
|
-
MatButtonModule,
|
|
692
|
-
MatTooltipModule,
|
|
693
|
-
MatListModule,
|
|
694
|
-
MatIconModule,
|
|
695
|
-
MatProgressBarModule,
|
|
696
|
-
CovalentBreadcrumbsModule,
|
|
697
|
-
CovalentDialogsModule,
|
|
698
|
-
CovalentFlavoredMarkdownModule,
|
|
699
|
-
CovalentMessageModule,
|
|
700
|
-
],
|
|
701
|
-
declarations: [
|
|
702
|
-
TdMarkdownNavigatorComponent,
|
|
703
|
-
TdMarkdownNavigatorWindowComponent,
|
|
704
|
-
TdMarkdownNavigatorWindowDirective,
|
|
705
|
-
],
|
|
706
|
-
exports: [
|
|
707
|
-
TdMarkdownNavigatorComponent,
|
|
708
|
-
TdMarkdownNavigatorWindowComponent,
|
|
709
|
-
TdMarkdownNavigatorWindowDirective,
|
|
710
|
-
],
|
|
711
|
-
providers: [TdMarkdownNavigatorWindowService],
|
|
712
|
-
}]
|
|
713
|
-
}] });
|
|
714
|
-
|
|
715
|
-
/**
|
|
716
|
-
* Generated bundle index. Do not edit.
|
|
717
|
-
*/
|
|
718
|
-
|
|
719
|
-
export { CovalentMarkdownNavigatorModule, DEFAULT_MARKDOWN_NAVIGATOR_LABELS, DEFAULT_MARKDOWN_NAVIGATOR_WINDOW_LABELS, TdMarkdownNavigatorComponent, TdMarkdownNavigatorWindowComponent, TdMarkdownNavigatorWindowDirective, TdMarkdownNavigatorWindowService };
|
|
720
|
-
//# sourceMappingURL=covalent-markdown-navigator.mjs.map
|