@ng-util/monaco-editor 11.2.0 → 12.1.2
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/bundles/ng-util-monaco-editor.umd.js +104 -338
- package/bundles/ng-util-monaco-editor.umd.js.map +1 -1
- package/esm2015/monaco-editor-base.component.js +46 -199
- package/esm2015/monaco-editor-diff.component.js +8 -28
- package/esm2015/monaco-editor.component.js +19 -89
- package/esm2015/monaco-editor.config.js +1 -30
- package/esm2015/monaco-editor.module.js +2 -11
- package/esm2015/monaco-editor.types.js +2 -46
- package/esm2015/ng-util-monaco-editor.js +2 -7
- package/esm2015/public-api.js +6 -11
- package/fesm2015/ng-util-monaco-editor.js +72 -407
- package/fesm2015/ng-util-monaco-editor.js.map +1 -1
- package/monaco-editor-base.component.d.ts +2 -2
- package/monaco-editor.component.d.ts +1 -1
- package/monaco-editor.config.d.ts +5 -1
- package/monaco.d.ts +868 -333
- package/package.json +3 -3
- package/bundles/ng-util-monaco-editor.umd.min.js +0 -21
- package/bundles/ng-util-monaco-editor.umd.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license ng-util(cipchk@qq.com)
|
|
2
|
+
* @license ng-util(cipchk@qq.com) v12.1.2
|
|
3
3
|
* (c) 2020 cipchk https://github.com/ng-util
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
return extendStatics(d, b);
|
|
34
34
|
};
|
|
35
35
|
function __extends(d, b) {
|
|
36
|
+
if (typeof b !== "function" && b !== null)
|
|
37
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
36
38
|
extendStatics(d, b);
|
|
37
39
|
function __() { this.constructor = d; }
|
|
38
40
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -218,11 +220,13 @@
|
|
|
218
220
|
}
|
|
219
221
|
return ar;
|
|
220
222
|
}
|
|
223
|
+
/** @deprecated */
|
|
221
224
|
function __spread() {
|
|
222
225
|
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
223
226
|
ar = ar.concat(__read(arguments[i]));
|
|
224
227
|
return ar;
|
|
225
228
|
}
|
|
229
|
+
/** @deprecated */
|
|
226
230
|
function __spreadArrays() {
|
|
227
231
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
228
232
|
s += arguments[i].length;
|
|
@@ -231,7 +235,17 @@
|
|
|
231
235
|
r[k] = a[j];
|
|
232
236
|
return r;
|
|
233
237
|
}
|
|
234
|
-
|
|
238
|
+
function __spreadArray(to, from, pack) {
|
|
239
|
+
if (pack || arguments.length === 2)
|
|
240
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
241
|
+
if (ar || !(i in from)) {
|
|
242
|
+
if (!ar)
|
|
243
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
244
|
+
ar[i] = from[i];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
248
|
+
}
|
|
235
249
|
function __await(v) {
|
|
236
250
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
237
251
|
}
|
|
@@ -296,84 +310,41 @@
|
|
|
296
310
|
function __importDefault(mod) {
|
|
297
311
|
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
298
312
|
}
|
|
299
|
-
function __classPrivateFieldGet(receiver,
|
|
300
|
-
if (!
|
|
301
|
-
throw new TypeError("
|
|
302
|
-
|
|
303
|
-
|
|
313
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
314
|
+
if (kind === "a" && !f)
|
|
315
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
316
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
317
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
318
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
304
319
|
}
|
|
305
|
-
function __classPrivateFieldSet(receiver,
|
|
306
|
-
if (
|
|
307
|
-
throw new TypeError("
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
320
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
321
|
+
if (kind === "m")
|
|
322
|
+
throw new TypeError("Private method is not writable");
|
|
323
|
+
if (kind === "a" && !f)
|
|
324
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
325
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
326
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
327
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
311
328
|
}
|
|
312
329
|
|
|
313
|
-
/**
|
|
314
|
-
* @fileoverview added by tsickle
|
|
315
|
-
* Generated from: monaco-editor.config.ts
|
|
316
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
317
|
-
*/
|
|
318
|
-
/** @type {?} */
|
|
319
330
|
var NU_MONACO_EDITOR_CONFIG = new core.InjectionToken('NU_MONACO_EDITOR_CONFIG');
|
|
320
|
-
/**
|
|
321
|
-
* @record
|
|
322
|
-
*/
|
|
323
|
-
function NuMonacoEditorConfig() { }
|
|
324
|
-
if (false) {
|
|
325
|
-
/**
|
|
326
|
-
* The base URL to monaco editor library assets via AMD (RequireJS), Default: `https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min`
|
|
327
|
-
* You can using local path, e.g.: `assets/monaco-editor/min`.
|
|
328
|
-
* @type {?|undefined}
|
|
329
|
-
*/
|
|
330
|
-
NuMonacoEditorConfig.prototype.baseUrl;
|
|
331
|
-
/**
|
|
332
|
-
* Default options when creating editors
|
|
333
|
-
* @type {?|undefined}
|
|
334
|
-
*/
|
|
335
|
-
NuMonacoEditorConfig.prototype.defaultOptions;
|
|
336
|
-
/**
|
|
337
|
-
* The event after the first loading of the monaco editor library is completed, use this function to extend monaco editor functionalities.
|
|
338
|
-
* - \@param `_monaco` equar to `window.monaco`
|
|
339
|
-
* @type {?|undefined}
|
|
340
|
-
*/
|
|
341
|
-
NuMonacoEditorConfig.prototype.monacoLoad;
|
|
342
|
-
}
|
|
343
331
|
|
|
344
|
-
/**
|
|
345
|
-
* @fileoverview added by tsickle
|
|
346
|
-
* Generated from: monaco-editor-base.component.ts
|
|
347
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
348
|
-
*/
|
|
349
|
-
/** @type {?} */
|
|
350
332
|
var loadedMonaco = false;
|
|
351
|
-
/** @type {?} */
|
|
352
333
|
var loadPromise;
|
|
353
|
-
//
|
|
334
|
+
// eslint-disable-next-line @angular-eslint/component-class-suffix
|
|
354
335
|
var NuMonacoEditorBase = /** @class */ (function () {
|
|
355
|
-
/**
|
|
356
|
-
* @param {?} el
|
|
357
|
-
* @param {?} config
|
|
358
|
-
* @param {?} doc
|
|
359
|
-
* @param {?} ngZone
|
|
360
|
-
*/
|
|
361
336
|
function NuMonacoEditorBase(el, config, doc, ngZone) {
|
|
362
337
|
this.el = el;
|
|
363
338
|
this.doc = doc;
|
|
364
339
|
this.ngZone = ngZone;
|
|
365
|
-
this.
|
|
340
|
+
this._resize$ = null;
|
|
366
341
|
this.height = "200px";
|
|
367
342
|
this.delay = 0;
|
|
368
343
|
this.event = new core.EventEmitter();
|
|
369
|
-
this._config = Object.assign({ baseUrl: 'https://
|
|
370
|
-
this.options =
|
|
344
|
+
this._config = Object.assign({ baseUrl: 'https://cdn.jsdelivr.net/npm/monaco-editor/min' }, config);
|
|
345
|
+
this.options = this._config.defaultOptions;
|
|
371
346
|
}
|
|
372
347
|
Object.defineProperty(NuMonacoEditorBase.prototype, "disabled", {
|
|
373
|
-
/**
|
|
374
|
-
* @param {?} val
|
|
375
|
-
* @return {?}
|
|
376
|
-
*/
|
|
377
348
|
set: function (val) {
|
|
378
349
|
this._disabled = typeof val === 'string' ? true : val;
|
|
379
350
|
this.setDisabled();
|
|
@@ -382,72 +353,34 @@
|
|
|
382
353
|
configurable: true
|
|
383
354
|
});
|
|
384
355
|
Object.defineProperty(NuMonacoEditorBase.prototype, "options", {
|
|
385
|
-
/**
|
|
386
|
-
* @return {?}
|
|
387
|
-
*/
|
|
388
356
|
get: function () {
|
|
389
357
|
return this._options;
|
|
390
358
|
},
|
|
391
|
-
/**
|
|
392
|
-
* @param {?} val
|
|
393
|
-
* @return {?}
|
|
394
|
-
*/
|
|
395
359
|
set: function (val) {
|
|
396
360
|
this._options = Object.assign(Object.assign({}, this._config.defaultOptions), val);
|
|
397
361
|
},
|
|
398
362
|
enumerable: false,
|
|
399
363
|
configurable: true
|
|
400
364
|
});
|
|
401
|
-
/**
|
|
402
|
-
* @protected
|
|
403
|
-
* @param {?} _options
|
|
404
|
-
* @param {?} _initEvent
|
|
405
|
-
* @return {?}
|
|
406
|
-
*/
|
|
407
365
|
NuMonacoEditorBase.prototype.initMonaco = function (_options, _initEvent) { };
|
|
408
|
-
/**
|
|
409
|
-
* @protected
|
|
410
|
-
* @param {?} type
|
|
411
|
-
* @param {?=} other
|
|
412
|
-
* @return {?}
|
|
413
|
-
*/
|
|
414
366
|
NuMonacoEditorBase.prototype.notifyEvent = function (type, other) {
|
|
415
367
|
var _this = this;
|
|
416
|
-
this.ngZone.run((
|
|
417
|
-
* @return {?}
|
|
418
|
-
*/function () { return _this.event.emit(Object.assign({ type: type, editor: ( /** @type {?} */(_this._editor)) }, other)); }));
|
|
368
|
+
this.ngZone.run(function () { return _this.event.emit(Object.assign({ type: type, editor: _this._editor }, other)); });
|
|
419
369
|
};
|
|
420
|
-
/**
|
|
421
|
-
* @protected
|
|
422
|
-
* @template THIS
|
|
423
|
-
* @this {THIS}
|
|
424
|
-
* @return {THIS}
|
|
425
|
-
*/
|
|
426
370
|
NuMonacoEditorBase.prototype.setDisabled = function () {
|
|
427
|
-
if (
|
|
428
|
-
|
|
371
|
+
if (this._editor) {
|
|
372
|
+
this._editor.updateOptions({ readOnly: this._disabled });
|
|
429
373
|
}
|
|
430
|
-
return
|
|
374
|
+
return this;
|
|
431
375
|
};
|
|
432
|
-
/**
|
|
433
|
-
* @private
|
|
434
|
-
* @return {?}
|
|
435
|
-
*/
|
|
436
376
|
NuMonacoEditorBase.prototype.init = function () {
|
|
437
377
|
var _this = this;
|
|
438
378
|
if (loadedMonaco) {
|
|
439
|
-
loadPromise.then((
|
|
440
|
-
* @return {?}
|
|
441
|
-
*/function () { return _this.initMonaco(_this.options, true); }));
|
|
379
|
+
loadPromise.then(function () { return _this.initMonaco(_this.options, true); });
|
|
442
380
|
return;
|
|
443
381
|
}
|
|
444
382
|
loadedMonaco = true;
|
|
445
|
-
loadPromise = new Promise((
|
|
446
|
-
* @param {?} resolve
|
|
447
|
-
* @param {?} reject
|
|
448
|
-
* @return {?}
|
|
449
|
-
*/function (resolve, reject) {
|
|
450
|
-
/** @type {?} */
|
|
383
|
+
loadPromise = new Promise(function (resolve, reject) {
|
|
451
384
|
var win = window;
|
|
452
385
|
if (win == null) {
|
|
453
386
|
resolve();
|
|
@@ -457,120 +390,71 @@
|
|
|
457
390
|
resolve();
|
|
458
391
|
return;
|
|
459
392
|
}
|
|
460
|
-
/** @type {?} */
|
|
461
393
|
var baseUrl = _this._config.baseUrl;
|
|
462
|
-
|
|
463
|
-
var amdLoader = ( /**
|
|
464
|
-
* @return {?}
|
|
465
|
-
*/function () {
|
|
394
|
+
var amdLoader = function () {
|
|
466
395
|
win.require.config({ paths: { vs: baseUrl + "/vs" } });
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
396
|
+
if (typeof _this._config.monacoPreLoad === 'function') {
|
|
397
|
+
_this._config.monacoPreLoad();
|
|
398
|
+
}
|
|
399
|
+
win.require(['vs/editor/editor.main'], function () {
|
|
470
400
|
if (typeof _this._config.monacoLoad === 'function') {
|
|
471
401
|
_this._config.monacoLoad(win.monaco);
|
|
472
402
|
}
|
|
473
403
|
_this.initMonaco(_this.options, true);
|
|
474
404
|
resolve();
|
|
475
|
-
}
|
|
476
|
-
* @return {?}
|
|
477
|
-
*/function () {
|
|
405
|
+
}, function () {
|
|
478
406
|
reject("Unable to load editor/editor.main module, please check your network environment.");
|
|
479
|
-
})
|
|
480
|
-
}
|
|
407
|
+
});
|
|
408
|
+
};
|
|
481
409
|
if (!win.require) {
|
|
482
|
-
|
|
483
|
-
var loaderScript_1 = ( /** @type {?} */(_this.doc.createElement('script')));
|
|
410
|
+
var loaderScript_1 = _this.doc.createElement('script');
|
|
484
411
|
loaderScript_1.type = 'text/javascript';
|
|
485
412
|
loaderScript_1.src = baseUrl + "/vs/loader.js";
|
|
486
413
|
loaderScript_1.onload = amdLoader;
|
|
487
|
-
loaderScript_1.onerror = (
|
|
488
|
-
* @return {?}
|
|
489
|
-
*/function () { return reject("Unable to load " + loaderScript_1.src + ", please check your network environment."); });
|
|
414
|
+
loaderScript_1.onerror = function () { return reject("Unable to load " + loaderScript_1.src + ", please check your network environment."); };
|
|
490
415
|
_this.doc.getElementsByTagName('head')[0].appendChild(loaderScript_1);
|
|
491
416
|
}
|
|
492
417
|
else {
|
|
493
418
|
amdLoader();
|
|
494
419
|
}
|
|
495
|
-
})
|
|
496
|
-
* @param {?} error
|
|
497
|
-
* @return {?}
|
|
498
|
-
*/function (/**
|
|
499
|
-
* @param {?} error
|
|
500
|
-
* @return {?}
|
|
501
|
-
*/ error) { return _this.notifyEvent('load-error', { error: error }); }));
|
|
420
|
+
}).catch(function (error) { return _this.notifyEvent('load-error', { error: error }); });
|
|
502
421
|
};
|
|
503
|
-
/**
|
|
504
|
-
* @protected
|
|
505
|
-
* @template THIS
|
|
506
|
-
* @this {THIS}
|
|
507
|
-
* @return {THIS}
|
|
508
|
-
*/
|
|
509
422
|
NuMonacoEditorBase.prototype.cleanResize = function () {
|
|
510
|
-
if (
|
|
511
|
-
|
|
423
|
+
if (this._resize$) {
|
|
424
|
+
this._resize$.unsubscribe();
|
|
512
425
|
}
|
|
513
|
-
return
|
|
426
|
+
return this;
|
|
514
427
|
};
|
|
515
|
-
/**
|
|
516
|
-
* @protected
|
|
517
|
-
* @template THIS
|
|
518
|
-
* @this {THIS}
|
|
519
|
-
* @return {THIS}
|
|
520
|
-
*/
|
|
521
428
|
NuMonacoEditorBase.prototype.registerResize = function () {
|
|
522
429
|
var _this = this;
|
|
523
|
-
|
|
524
|
-
|
|
430
|
+
this.cleanResize();
|
|
431
|
+
this._resize$ = rxjs.fromEvent(window, 'resize')
|
|
525
432
|
.pipe(operators.debounceTime(100))
|
|
526
|
-
.subscribe((
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}));
|
|
532
|
-
return ( /** @type {?} */(this));
|
|
433
|
+
.subscribe(function () {
|
|
434
|
+
_this._editor.layout();
|
|
435
|
+
_this.notifyEvent('resize');
|
|
436
|
+
});
|
|
437
|
+
return this;
|
|
533
438
|
};
|
|
534
|
-
/**
|
|
535
|
-
* @protected
|
|
536
|
-
* @return {?}
|
|
537
|
-
*/
|
|
538
439
|
NuMonacoEditorBase.prototype.updateOptions = function () {
|
|
539
440
|
var _this = this;
|
|
540
441
|
if (!this._editor)
|
|
541
442
|
return;
|
|
542
|
-
this.ngZone.runOutsideAngular((
|
|
543
|
-
|
|
544
|
-
*/function () {
|
|
545
|
-
( /** @type {?} */(_this._editor)).dispose();
|
|
443
|
+
this.ngZone.runOutsideAngular(function () {
|
|
444
|
+
_this._editor.dispose();
|
|
546
445
|
_this.initMonaco(_this._options, false);
|
|
547
|
-
})
|
|
446
|
+
});
|
|
548
447
|
};
|
|
549
|
-
/**
|
|
550
|
-
* @return {?}
|
|
551
|
-
*/
|
|
552
448
|
NuMonacoEditorBase.prototype.ngAfterViewInit = function () {
|
|
553
449
|
var _this = this;
|
|
554
|
-
this.ngZone.runOutsideAngular((
|
|
555
|
-
* @return {?}
|
|
556
|
-
*/function () { return setTimeout(( /**
|
|
557
|
-
* @return {?}
|
|
558
|
-
*/function () { return _this.init(); }), +_this.delay); }));
|
|
450
|
+
this.ngZone.runOutsideAngular(function () { return setTimeout(function () { return _this.init(); }, +_this.delay); });
|
|
559
451
|
};
|
|
560
|
-
/**
|
|
561
|
-
* @param {?} changes
|
|
562
|
-
* @return {?}
|
|
563
|
-
*/
|
|
564
452
|
NuMonacoEditorBase.prototype.ngOnChanges = function (changes) {
|
|
565
|
-
/** @type {?} */
|
|
566
453
|
var allKeys = Object.keys(changes);
|
|
567
454
|
if (allKeys.length === 1 && allKeys[0] === 'disabled')
|
|
568
455
|
return;
|
|
569
456
|
this.updateOptions();
|
|
570
457
|
};
|
|
571
|
-
/**
|
|
572
|
-
* @return {?}
|
|
573
|
-
*/
|
|
574
458
|
NuMonacoEditorBase.prototype.ngOnDestroy = function () {
|
|
575
459
|
this.cleanResize();
|
|
576
460
|
if (this._editor) {
|
|
@@ -580,19 +464,27 @@
|
|
|
580
464
|
};
|
|
581
465
|
return NuMonacoEditorBase;
|
|
582
466
|
}());
|
|
467
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
583
468
|
NuMonacoEditorBase.decorators = [
|
|
584
469
|
{ type: core.Component, args: [{
|
|
585
470
|
selector: 'nu-monaco-base',
|
|
586
471
|
template: ""
|
|
587
|
-
}] }
|
|
472
|
+
},] }
|
|
588
473
|
];
|
|
589
|
-
/**
|
|
474
|
+
/**
|
|
475
|
+
* @type {function(): !Array<(null|{
|
|
476
|
+
* type: ?,
|
|
477
|
+
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
478
|
+
* })>}
|
|
479
|
+
* @nocollapse
|
|
480
|
+
*/
|
|
590
481
|
NuMonacoEditorBase.ctorParameters = function () { return [
|
|
591
482
|
{ type: core.ElementRef },
|
|
592
483
|
{ type: undefined, decorators: [{ type: core.Inject, args: [NU_MONACO_EDITOR_CONFIG,] }] },
|
|
593
484
|
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
|
|
594
485
|
{ type: core.NgZone }
|
|
595
486
|
]; };
|
|
487
|
+
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
596
488
|
NuMonacoEditorBase.propDecorators = {
|
|
597
489
|
height: [{ type: core.Input }],
|
|
598
490
|
delay: [{ type: core.Input }],
|
|
@@ -600,162 +492,76 @@
|
|
|
600
492
|
options: [{ type: core.Input }],
|
|
601
493
|
event: [{ type: core.Output }]
|
|
602
494
|
};
|
|
603
|
-
if (false) {
|
|
604
|
-
/**
|
|
605
|
-
* @type {?}
|
|
606
|
-
* @protected
|
|
607
|
-
*/
|
|
608
|
-
NuMonacoEditorBase.prototype._editor;
|
|
609
|
-
/**
|
|
610
|
-
* @type {?}
|
|
611
|
-
* @protected
|
|
612
|
-
*/
|
|
613
|
-
NuMonacoEditorBase.prototype._options;
|
|
614
|
-
/**
|
|
615
|
-
* @type {?}
|
|
616
|
-
* @protected
|
|
617
|
-
*/
|
|
618
|
-
NuMonacoEditorBase.prototype._resize$;
|
|
619
|
-
/**
|
|
620
|
-
* @type {?}
|
|
621
|
-
* @protected
|
|
622
|
-
*/
|
|
623
|
-
NuMonacoEditorBase.prototype._config;
|
|
624
|
-
/**
|
|
625
|
-
* @type {?}
|
|
626
|
-
* @protected
|
|
627
|
-
*/
|
|
628
|
-
NuMonacoEditorBase.prototype._disabled;
|
|
629
|
-
/** @type {?} */
|
|
630
|
-
NuMonacoEditorBase.prototype.height;
|
|
631
|
-
/** @type {?} */
|
|
632
|
-
NuMonacoEditorBase.prototype.delay;
|
|
633
|
-
/** @type {?} */
|
|
634
|
-
NuMonacoEditorBase.prototype.event;
|
|
635
|
-
/**
|
|
636
|
-
* @type {?}
|
|
637
|
-
* @protected
|
|
638
|
-
*/
|
|
639
|
-
NuMonacoEditorBase.prototype.el;
|
|
640
|
-
/**
|
|
641
|
-
* @type {?}
|
|
642
|
-
* @protected
|
|
643
|
-
*/
|
|
644
|
-
NuMonacoEditorBase.prototype.doc;
|
|
645
|
-
/**
|
|
646
|
-
* @type {?}
|
|
647
|
-
* @protected
|
|
648
|
-
*/
|
|
649
|
-
NuMonacoEditorBase.prototype.ngZone;
|
|
650
|
-
}
|
|
651
495
|
|
|
652
496
|
var NuMonacoEditorComponent = /** @class */ (function (_super) {
|
|
653
497
|
__extends(NuMonacoEditorComponent, _super);
|
|
654
498
|
function NuMonacoEditorComponent() {
|
|
655
|
-
var _this = _super.apply(this,
|
|
499
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
656
500
|
_this._value = '';
|
|
657
|
-
_this.onChange = (
|
|
658
|
-
|
|
659
|
-
* @return {?}
|
|
660
|
-
*/function (_) { });
|
|
661
|
-
_this.onTouched = ( /**
|
|
662
|
-
* @return {?}
|
|
663
|
-
*/function () { });
|
|
501
|
+
_this.onChange = function (_) { };
|
|
502
|
+
_this.onTouched = function () { };
|
|
664
503
|
return _this;
|
|
665
504
|
}
|
|
666
505
|
Object.defineProperty(NuMonacoEditorComponent.prototype, "editor", {
|
|
667
|
-
/**
|
|
668
|
-
* @return {?}
|
|
669
|
-
*/
|
|
670
506
|
get: function () {
|
|
671
|
-
return
|
|
507
|
+
return this._editor;
|
|
672
508
|
},
|
|
673
509
|
enumerable: false,
|
|
674
510
|
configurable: true
|
|
675
511
|
});
|
|
676
|
-
/**
|
|
677
|
-
* @param {?} options
|
|
678
|
-
* @param {?} initEvent
|
|
679
|
-
* @return {?}
|
|
680
|
-
*/
|
|
681
512
|
NuMonacoEditorComponent.prototype.initMonaco = function (options, initEvent) {
|
|
682
513
|
var _this = this;
|
|
683
|
-
/** @type {?} */
|
|
684
514
|
var hasModel = !!this.model;
|
|
685
515
|
if (hasModel) {
|
|
686
|
-
|
|
687
|
-
var model = monaco.editor.getModel(( /** @type {?} */(this.model.uri)) || '');
|
|
516
|
+
var model = monaco.editor.getModel(this.model.uri || '');
|
|
688
517
|
if (model) {
|
|
689
518
|
options.model = model;
|
|
690
519
|
options.model.setValue(this._value);
|
|
691
520
|
}
|
|
692
521
|
else {
|
|
693
|
-
var _a =
|
|
522
|
+
var _a = this.model, value = _a.value, language = _a.language, uri = _a.uri;
|
|
694
523
|
options.model = monaco.editor.createModel(value || this._value, language, uri);
|
|
695
524
|
}
|
|
696
525
|
}
|
|
697
|
-
|
|
526
|
+
if (this._disabled != null)
|
|
527
|
+
options.readOnly = this._disabled;
|
|
698
528
|
var editor = (this._editor = monaco.editor.create(this.el.nativeElement, options));
|
|
699
529
|
if (!hasModel) {
|
|
700
530
|
editor.setValue(this._value);
|
|
701
531
|
}
|
|
702
|
-
editor.onDidChangeModelContent((
|
|
703
|
-
* @return {?}
|
|
704
|
-
*/function () {
|
|
705
|
-
/** @type {?} */
|
|
532
|
+
editor.onDidChangeModelContent(function () {
|
|
706
533
|
var value = editor.getValue();
|
|
707
|
-
_this.ngZone.run((
|
|
708
|
-
* @return {?}
|
|
709
|
-
*/function () {
|
|
534
|
+
_this.ngZone.run(function () {
|
|
710
535
|
_this._value = value;
|
|
711
536
|
_this.onChange(value);
|
|
712
|
-
})
|
|
713
|
-
})
|
|
714
|
-
editor.onDidBlurEditorWidget((
|
|
715
|
-
* @return {?}
|
|
716
|
-
*/function () { return _this.onTouched(); }));
|
|
537
|
+
});
|
|
538
|
+
});
|
|
539
|
+
editor.onDidBlurEditorWidget(function () { return _this.onTouched(); });
|
|
717
540
|
this.registerResize();
|
|
718
541
|
editor
|
|
719
542
|
.getAction('editor.action.formatDocument')
|
|
720
543
|
.run()
|
|
721
|
-
.then((
|
|
722
|
-
* @return {?}
|
|
723
|
-
*/function () { return _this.notifyEvent(initEvent ? 'init' : 're-init'); }));
|
|
544
|
+
.then(function () { return _this.notifyEvent(initEvent ? 'init' : 're-init'); });
|
|
724
545
|
};
|
|
725
|
-
/**
|
|
726
|
-
* @param {?} value
|
|
727
|
-
* @return {?}
|
|
728
|
-
*/
|
|
729
546
|
NuMonacoEditorComponent.prototype.writeValue = function (value) {
|
|
730
547
|
this._value = value || '';
|
|
731
548
|
if (this._editor) {
|
|
732
|
-
|
|
549
|
+
this._editor.setValue(this._value);
|
|
733
550
|
}
|
|
734
551
|
};
|
|
735
|
-
/**
|
|
736
|
-
* @param {?} fn
|
|
737
|
-
* @return {?}
|
|
738
|
-
*/
|
|
739
552
|
NuMonacoEditorComponent.prototype.registerOnChange = function (fn) {
|
|
740
553
|
this.onChange = fn;
|
|
741
554
|
};
|
|
742
|
-
/**
|
|
743
|
-
* @param {?} fn
|
|
744
|
-
* @return {?}
|
|
745
|
-
*/
|
|
746
555
|
NuMonacoEditorComponent.prototype.registerOnTouched = function (fn) {
|
|
747
556
|
this.onTouched = fn;
|
|
748
557
|
};
|
|
749
|
-
/**
|
|
750
|
-
* @param {?} _isDisabled
|
|
751
|
-
* @return {?}
|
|
752
|
-
*/
|
|
753
558
|
NuMonacoEditorComponent.prototype.setDisabledState = function (_isDisabled) {
|
|
754
559
|
this.disabled = _isDisabled;
|
|
755
560
|
this.setDisabled();
|
|
756
561
|
};
|
|
757
562
|
return NuMonacoEditorComponent;
|
|
758
563
|
}(NuMonacoEditorBase));
|
|
564
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
759
565
|
NuMonacoEditorComponent.decorators = [
|
|
760
566
|
{ type: core.Component, args: [{
|
|
761
567
|
selector: 'nu-monaco-editor',
|
|
@@ -768,37 +574,17 @@
|
|
|
768
574
|
providers: [
|
|
769
575
|
{
|
|
770
576
|
provide: forms.NG_VALUE_ACCESSOR,
|
|
771
|
-
useExisting: core.forwardRef((
|
|
772
|
-
* @return {?}
|
|
773
|
-
*/function () { return NuMonacoEditorComponent; })),
|
|
577
|
+
useExisting: core.forwardRef(function () { return NuMonacoEditorComponent; }),
|
|
774
578
|
multi: true,
|
|
775
579
|
},
|
|
776
580
|
],
|
|
777
581
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
778
|
-
}] }
|
|
582
|
+
},] }
|
|
779
583
|
];
|
|
584
|
+
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
780
585
|
NuMonacoEditorComponent.propDecorators = {
|
|
781
586
|
model: [{ type: core.Input }]
|
|
782
587
|
};
|
|
783
|
-
if (false) {
|
|
784
|
-
/**
|
|
785
|
-
* @type {?}
|
|
786
|
-
* @private
|
|
787
|
-
*/
|
|
788
|
-
NuMonacoEditorComponent.prototype._value;
|
|
789
|
-
/** @type {?} */
|
|
790
|
-
NuMonacoEditorComponent.prototype.model;
|
|
791
|
-
/**
|
|
792
|
-
* @type {?}
|
|
793
|
-
* @private
|
|
794
|
-
*/
|
|
795
|
-
NuMonacoEditorComponent.prototype.onChange;
|
|
796
|
-
/**
|
|
797
|
-
* @type {?}
|
|
798
|
-
* @private
|
|
799
|
-
*/
|
|
800
|
-
NuMonacoEditorComponent.prototype.onTouched;
|
|
801
|
-
}
|
|
802
588
|
|
|
803
589
|
var NuMonacoEditorDiffComponent = /** @class */ (function (_super) {
|
|
804
590
|
__extends(NuMonacoEditorDiffComponent, _super);
|
|
@@ -806,28 +592,20 @@
|
|
|
806
592
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
807
593
|
}
|
|
808
594
|
Object.defineProperty(NuMonacoEditorDiffComponent.prototype, "editor", {
|
|
809
|
-
/**
|
|
810
|
-
* @return {?}
|
|
811
|
-
*/
|
|
812
595
|
get: function () {
|
|
813
|
-
return
|
|
596
|
+
return this._editor;
|
|
814
597
|
},
|
|
815
598
|
enumerable: false,
|
|
816
599
|
configurable: true
|
|
817
600
|
});
|
|
818
|
-
/**
|
|
819
|
-
* @param {?} options
|
|
820
|
-
* @param {?} initEvent
|
|
821
|
-
* @return {?}
|
|
822
|
-
*/
|
|
823
601
|
NuMonacoEditorDiffComponent.prototype.initMonaco = function (options, initEvent) {
|
|
824
602
|
var _this = this;
|
|
825
603
|
if (!this.old || !this.new) {
|
|
826
604
|
throw new Error('old or new not found for nu-monaco-diff-editor');
|
|
827
605
|
}
|
|
828
|
-
/** @type {?} */
|
|
829
606
|
var theme = options.theme;
|
|
830
|
-
|
|
607
|
+
if (this._disabled != null)
|
|
608
|
+
options.readOnly = this._disabled;
|
|
831
609
|
var editor = (this._editor = monaco.editor.createDiffEditor(this.el.nativeElement, options));
|
|
832
610
|
options.theme = theme;
|
|
833
611
|
editor.setModel({
|
|
@@ -835,15 +613,14 @@
|
|
|
835
613
|
modified: monaco.editor.createModel(this.new.code, this.new.language || options.language),
|
|
836
614
|
});
|
|
837
615
|
// this.setDisabled();
|
|
838
|
-
editor.onDidUpdateDiff((
|
|
839
|
-
* @return {?}
|
|
840
|
-
*/function () { return _this.notifyEvent('update-diff', { diffValue: editor.getModifiedEditor().getValue() }); }));
|
|
616
|
+
editor.onDidUpdateDiff(function () { return _this.notifyEvent('update-diff', { diffValue: editor.getModifiedEditor().getValue() }); });
|
|
841
617
|
this.registerResize();
|
|
842
618
|
if (initEvent)
|
|
843
619
|
this.notifyEvent('init');
|
|
844
620
|
};
|
|
845
621
|
return NuMonacoEditorDiffComponent;
|
|
846
622
|
}(NuMonacoEditorBase));
|
|
623
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
847
624
|
NuMonacoEditorDiffComponent.decorators = [
|
|
848
625
|
{ type: core.Component, args: [{
|
|
849
626
|
selector: 'nu-monaco-diff-editor',
|
|
@@ -854,28 +631,18 @@
|
|
|
854
631
|
'[style.height]': 'height',
|
|
855
632
|
},
|
|
856
633
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
857
|
-
}] }
|
|
634
|
+
},] }
|
|
858
635
|
];
|
|
636
|
+
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
859
637
|
NuMonacoEditorDiffComponent.propDecorators = {
|
|
860
638
|
old: [{ type: core.Input }],
|
|
861
639
|
new: [{ type: core.Input }]
|
|
862
640
|
};
|
|
863
|
-
if (false) {
|
|
864
|
-
/** @type {?} */
|
|
865
|
-
NuMonacoEditorDiffComponent.prototype.old;
|
|
866
|
-
/** @type {?} */
|
|
867
|
-
NuMonacoEditorDiffComponent.prototype.new;
|
|
868
|
-
}
|
|
869
641
|
|
|
870
|
-
/** @type {?} */
|
|
871
642
|
var COMPONENTS = [NuMonacoEditorComponent, NuMonacoEditorDiffComponent];
|
|
872
643
|
var NuMonacoEditorModule = /** @class */ (function () {
|
|
873
644
|
function NuMonacoEditorModule() {
|
|
874
645
|
}
|
|
875
|
-
/**
|
|
876
|
-
* @param {?=} config
|
|
877
|
-
* @return {?}
|
|
878
|
-
*/
|
|
879
646
|
NuMonacoEditorModule.forRoot = function (config) {
|
|
880
647
|
return {
|
|
881
648
|
ngModule: NuMonacoEditorModule,
|
|
@@ -884,18 +651,17 @@
|
|
|
884
651
|
};
|
|
885
652
|
return NuMonacoEditorModule;
|
|
886
653
|
}());
|
|
654
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
887
655
|
NuMonacoEditorModule.decorators = [
|
|
888
656
|
{ type: core.NgModule, args: [{
|
|
889
657
|
imports: [common.CommonModule],
|
|
890
|
-
declarations:
|
|
658
|
+
declarations: __spreadArray([NuMonacoEditorBase], __read(COMPONENTS)),
|
|
891
659
|
exports: COMPONENTS,
|
|
892
660
|
},] }
|
|
893
661
|
];
|
|
894
662
|
|
|
895
663
|
/**
|
|
896
|
-
*
|
|
897
|
-
* Generated from: ng-util-monaco-editor.ts
|
|
898
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
664
|
+
* Generated bundle index. Do not edit.
|
|
899
665
|
*/
|
|
900
666
|
|
|
901
667
|
exports.NU_MONACO_EDITOR_CONFIG = NU_MONACO_EDITOR_CONFIG;
|