ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
1 lines • 28.7 kB
Source Map (JSON)
{"version":3,"file":"ng-zorro-antd-code-editor.mjs","sources":["../../components/code-editor/code-editor.service.ts","../../components/code-editor/code-editor.component.ts","../../components/code-editor/code-editor.module.ts","../../components/code-editor/public-api.ts","../../components/code-editor/ng-zorro-antd-code-editor.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable, OnDestroy } from '@angular/core';\nimport { BehaviorSubject, Observable, of, ReplaySubject, Subscription } from 'rxjs';\nimport { map, tap } from 'rxjs/operators';\n\nimport { CodeEditorConfig, NzConfigService } from 'ng-zorro-antd/core/config';\nimport { PREFIX, warn } from 'ng-zorro-antd/core/logger';\nimport { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nimport { JoinedEditorOptions, NzCodeEditorLoadingStatus } from './typings';\n\ndeclare const monaco: NzSafeAny;\n\nconst NZ_CONFIG_MODULE_NAME = 'codeEditor';\n\nfunction tryTriggerFunc(fn?: (...args: NzSafeAny[]) => NzSafeAny): (...args: NzSafeAny) => void {\n return (...args: NzSafeAny[]) => {\n if (fn) {\n fn(...args);\n }\n };\n}\n\n// Caretaker note: previously, these were `NzCodeEditorService` properties.\n// They're kept as static variables because this will allow loading Monaco only once.\n// This applies to micro frontend apps with multiple Angular apps or a single Angular app\n// that can be bootstrapped and destroyed multiple times (e.g. using Webpack module federation).\n// Root providers are re-initialized each time the app is bootstrapped. Platform providers aren't.\n// We can't make the `NzCodeEditorService` to be a platform provider (`@Injectable({ providedIn: 'platform' })`)\n// since it depends on other root providers.\nconst loaded$ = new ReplaySubject<boolean>(1);\nlet loadingStatus = NzCodeEditorLoadingStatus.UNLOAD;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NzCodeEditorService implements OnDestroy {\n private document: Document;\n private firstEditorInitialized = false;\n private option: JoinedEditorOptions = {};\n private config: CodeEditorConfig;\n private subscription: Subscription | null;\n\n option$ = new BehaviorSubject<JoinedEditorOptions>(this.option);\n\n constructor(private readonly nzConfigService: NzConfigService, @Inject(DOCUMENT) _document: NzSafeAny) {\n const globalConfig = this.nzConfigService.getConfigForComponent(NZ_CONFIG_MODULE_NAME);\n\n this.document = _document;\n this.config = { ...globalConfig };\n this.option = this.config.defaultEditorOption || {};\n\n this.subscription = this.nzConfigService.getConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME).subscribe(() => {\n const newGlobalConfig: NzSafeAny = this.nzConfigService.getConfigForComponent(NZ_CONFIG_MODULE_NAME);\n if (newGlobalConfig) {\n this._updateDefaultOption(newGlobalConfig.defaultEditorOption);\n }\n });\n }\n\n ngOnDestroy(): void {\n this.subscription!.unsubscribe();\n this.subscription = null;\n }\n\n private _updateDefaultOption(option: JoinedEditorOptions): void {\n this.option = { ...this.option, ...option };\n this.option$.next(this.option);\n\n if (option.theme) {\n monaco.editor.setTheme(option.theme);\n }\n }\n\n requestToInit(): Observable<JoinedEditorOptions> {\n if (loadingStatus === NzCodeEditorLoadingStatus.LOADED) {\n this.onInit();\n return of(this.getLatestOption());\n }\n\n if (loadingStatus === NzCodeEditorLoadingStatus.UNLOAD) {\n if (this.config.useStaticLoading && typeof monaco === 'undefined') {\n warn(\n 'You choose to use static loading but it seems that you forget ' +\n 'to config webpack plugin correctly. Please refer to our official website' +\n 'for more details about static loading.'\n );\n } else {\n this.loadMonacoScript();\n }\n }\n\n return loaded$.pipe(\n tap(() => this.onInit()),\n map(() => this.getLatestOption())\n );\n }\n\n private loadMonacoScript(): void {\n if (this.config.useStaticLoading) {\n Promise.resolve().then(() => this.onLoad());\n return;\n }\n\n if (loadingStatus === NzCodeEditorLoadingStatus.LOADING) {\n return;\n }\n\n loadingStatus = NzCodeEditorLoadingStatus.LOADING;\n\n const assetsRoot = this.config.assetsRoot;\n const vs = assetsRoot ? `${assetsRoot}/vs` : 'assets/vs';\n const windowAsAny = window as NzSafeAny;\n const loadScript = this.document.createElement('script');\n\n loadScript.type = 'text/javascript';\n loadScript.src = `${vs}/loader.js`;\n\n const onLoad = (): void => {\n cleanup();\n windowAsAny.require.config({\n paths: { vs }\n });\n windowAsAny.require(['vs/editor/editor.main'], () => {\n this.onLoad();\n });\n };\n\n const onError = (): void => {\n cleanup();\n throw new Error(`${PREFIX} cannot load assets of monaco editor from source \"${vs}\".`);\n };\n\n const cleanup = (): void => {\n // Caretaker note: we have to remove these listeners once the `<script>` is loaded successfully\n // or not since the `onLoad` listener captures `this`, which will prevent the `NzCodeEditorService`\n // from being garbage collected.\n loadScript.removeEventListener('load', onLoad);\n loadScript.removeEventListener('error', onError);\n // We don't need to keep the `<script>` element within the `<body>` since JavaScript has\n // been executed and Monaco is available globally. E.g. Webpack, always removes `<script>`\n // elements after loading chunks (see its `LoadScriptRuntimeModule`).\n this.document.documentElement.removeChild(loadScript);\n };\n\n loadScript.addEventListener('load', onLoad);\n loadScript.addEventListener('error', onError);\n\n this.document.documentElement.appendChild(loadScript);\n }\n\n private onLoad(): void {\n loadingStatus = NzCodeEditorLoadingStatus.LOADED;\n loaded$.next(true);\n loaded$.complete();\n\n tryTriggerFunc(this.config.onLoad)();\n }\n\n private onInit(): void {\n if (!this.firstEditorInitialized) {\n this.firstEditorInitialized = true;\n tryTriggerFunc(this.config.onFirstEditorInit)();\n }\n\n tryTriggerFunc(this.config.onInit)();\n }\n\n private getLatestOption(): JoinedEditorOptions {\n return { ...this.option };\n }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { Platform } from '@angular/cdk/platform';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n NgZone,\n OnDestroy,\n Output,\n TemplateRef,\n ViewEncapsulation\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BehaviorSubject, combineLatest, fromEvent, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, filter, map, takeUntil } from 'rxjs/operators';\n\nimport { editor, IDisposable } from 'monaco-editor';\n\nimport { warn } from 'ng-zorro-antd/core/logger';\nimport { BooleanInput, NzSafeAny, OnChangeType, OnTouchedType } from 'ng-zorro-antd/core/types';\nimport { inNextTick, InputBoolean } from 'ng-zorro-antd/core/util';\n\nimport { NzCodeEditorService } from './code-editor.service';\nimport { DiffEditorOptions, EditorOptions, JoinedEditorOptions, NzEditorMode } from './typings';\n\n// Import types from monaco editor.\nimport ITextModel = editor.ITextModel;\nimport IStandaloneCodeEditor = editor.IStandaloneCodeEditor;\nimport IStandaloneDiffEditor = editor.IStandaloneDiffEditor;\n\ndeclare const monaco: NzSafeAny;\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n selector: 'nz-code-editor',\n exportAs: 'nzCodeEditor',\n template: `\n <div class=\"ant-code-editor-loading\" *ngIf=\"nzLoading\">\n <nz-spin></nz-spin>\n </div>\n\n <div class=\"ant-code-editor-toolkit\" *ngIf=\"nzToolkit\">\n <ng-template [ngTemplateOutlet]=\"nzToolkit\"></ng-template>\n </div>\n `,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => NzCodeEditorComponent),\n multi: true\n }\n ]\n})\nexport class NzCodeEditorComponent implements OnDestroy, AfterViewInit {\n static ngAcceptInputType_nzLoading: BooleanInput;\n static ngAcceptInputType_nzFullControl: BooleanInput;\n\n @Input() nzEditorMode: NzEditorMode = 'normal';\n @Input() nzOriginalText = '';\n @Input() @InputBoolean() nzLoading = false;\n @Input() @InputBoolean() nzFullControl = false;\n @Input() nzToolkit?: TemplateRef<void>;\n\n @Input() set nzEditorOption(value: JoinedEditorOptions) {\n this.editorOption$.next(value);\n }\n\n @Output() readonly nzEditorInitialized = new EventEmitter<IStandaloneCodeEditor | IStandaloneDiffEditor>();\n\n editorOptionCached: JoinedEditorOptions = {};\n\n private readonly el: HTMLElement;\n private destroy$ = new Subject<void>();\n private resize$ = new Subject<void>();\n private editorOption$ = new BehaviorSubject<JoinedEditorOptions>({});\n private editorInstance: IStandaloneCodeEditor | IStandaloneDiffEditor | null = null;\n private value = '';\n private modelSet = false;\n private onDidChangeContentDisposable: IDisposable | null = null;\n\n constructor(\n private nzCodeEditorService: NzCodeEditorService,\n private ngZone: NgZone,\n elementRef: ElementRef,\n private platform: Platform\n ) {\n this.el = elementRef.nativeElement;\n this.el.classList.add('ant-code-editor');\n }\n\n /**\n * Initialize a monaco editor instance.\n */\n ngAfterViewInit(): void {\n if (!this.platform.isBrowser) {\n return;\n }\n\n this.nzCodeEditorService\n .requestToInit()\n .pipe(takeUntil(this.destroy$))\n .subscribe(option => this.setup(option));\n }\n\n ngOnDestroy(): void {\n if (this.onDidChangeContentDisposable) {\n this.onDidChangeContentDisposable.dispose();\n this.onDidChangeContentDisposable = null;\n }\n\n if (this.editorInstance) {\n this.editorInstance.dispose();\n this.editorInstance = null;\n }\n\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n writeValue(value: string): void {\n this.value = value;\n this.setValue();\n }\n\n registerOnChange(fn: OnChangeType): NzSafeAny {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: OnTouchedType): void {\n this.onTouch = fn;\n }\n\n onChange: OnChangeType = (_value: string) => {};\n\n onTouch: OnTouchedType = () => {};\n\n layout(): void {\n this.resize$.next();\n }\n\n private setup(option: JoinedEditorOptions): void {\n // The `setup()` is invoked when the Monaco editor is loaded. This may happen asynchronously for the first\n // time, and it'll always happen synchronously afterwards. The first `setup()` invokation is outside the Angular\n // zone, but further invokations will happen within the Angular zone. We call the `setModel()` on the editor\n // instance, which tells Monaco to add event listeners lazily internally (`mousemove`, `mouseout`, etc.).\n // We should avoid adding them within the Angular zone since this will drastically affect the performance.\n this.ngZone.runOutsideAngular(() =>\n inNextTick()\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => {\n this.editorOptionCached = option;\n this.registerOptionChanges();\n this.initMonacoEditorInstance();\n this.registerResizeChange();\n this.setValue();\n\n if (!this.nzFullControl) {\n this.setValueEmitter();\n }\n\n if (this.nzEditorInitialized.observers.length) {\n this.ngZone.run(() => this.nzEditorInitialized.emit(this.editorInstance!));\n }\n })\n );\n }\n\n private registerOptionChanges(): void {\n combineLatest([this.editorOption$, this.nzCodeEditorService.option$])\n .pipe(takeUntil(this.destroy$))\n .subscribe(([selfOpt, defaultOpt]) => {\n this.editorOptionCached = {\n ...this.editorOptionCached,\n ...defaultOpt,\n ...selfOpt\n };\n this.updateOptionToMonaco();\n });\n }\n\n private initMonacoEditorInstance(): void {\n this.ngZone.runOutsideAngular(() => {\n this.editorInstance =\n this.nzEditorMode === 'normal'\n ? monaco.editor.create(this.el, { ...this.editorOptionCached })\n : monaco.editor.createDiffEditor(this.el, {\n ...(this.editorOptionCached as DiffEditorOptions)\n });\n });\n }\n\n private registerResizeChange(): void {\n this.ngZone.runOutsideAngular(() => {\n fromEvent(window, 'resize')\n .pipe(debounceTime(300), takeUntil(this.destroy$))\n .subscribe(() => {\n this.layout();\n });\n\n this.resize$\n .pipe(\n takeUntil(this.destroy$),\n filter(() => !!this.editorInstance),\n map(() => ({\n width: this.el.clientWidth,\n height: this.el.clientHeight\n })),\n distinctUntilChanged((a, b) => a.width === b.width && a.height === b.height),\n debounceTime(50)\n )\n .subscribe(() => {\n this.editorInstance!.layout();\n });\n });\n }\n\n private setValue(): void {\n if (!this.editorInstance) {\n return;\n }\n\n if (this.nzFullControl && this.value) {\n warn(`should not set value when you are using full control mode! It would result in ambiguous data flow!`);\n return;\n }\n\n if (this.nzEditorMode === 'normal') {\n if (this.modelSet) {\n const model = this.editorInstance.getModel() as ITextModel;\n this.preservePositionAndSelections(() => model.setValue(this.value));\n } else {\n (this.editorInstance as IStandaloneCodeEditor).setModel(\n monaco.editor.createModel(this.value, (this.editorOptionCached as EditorOptions).language)\n );\n this.modelSet = true;\n }\n } else {\n if (this.modelSet) {\n const model = (this.editorInstance as IStandaloneDiffEditor).getModel()!;\n this.preservePositionAndSelections(() => {\n model.modified.setValue(this.value);\n model.original.setValue(this.nzOriginalText);\n });\n } else {\n const language = (this.editorOptionCached as EditorOptions).language;\n (this.editorInstance as IStandaloneDiffEditor).setModel({\n original: monaco.editor.createModel(this.nzOriginalText, language),\n modified: monaco.editor.createModel(this.value, language)\n });\n this.modelSet = true;\n }\n }\n }\n\n /**\n * {@link editor.ICodeEditor}#setValue resets the cursor position to the start of the document.\n * This helper memorizes the cursor position and selections and restores them after the given\n * function has been called.\n */\n private preservePositionAndSelections(fn: () => unknown): void {\n if (!this.editorInstance) {\n fn();\n return;\n }\n\n const position = this.editorInstance.getPosition();\n const selections = this.editorInstance.getSelections();\n\n fn();\n\n if (position) {\n this.editorInstance.setPosition(position);\n }\n if (selections) {\n this.editorInstance.setSelections(selections);\n }\n }\n\n private setValueEmitter(): void {\n const model = (\n this.nzEditorMode === 'normal'\n ? (this.editorInstance as IStandaloneCodeEditor).getModel()\n : (this.editorInstance as IStandaloneDiffEditor).getModel()!.modified\n ) as ITextModel;\n\n // The `onDidChangeContent` returns a disposable object (an object with `dispose()` method) which will cleanup\n // the listener. The callback, that we pass to `onDidChangeContent`, captures `this`. This leads to a circular reference\n // (`nz-code-editor -> monaco -> nz-code-editor`) and prevents the `nz-code-editor` from being GC'd.\n this.onDidChangeContentDisposable = model.onDidChangeContent(() => {\n this.emitValue(model.getValue());\n });\n }\n\n private emitValue(value: string): void {\n if (this.value === value) {\n // If the value didn't change there's no reason to send an update.\n // Specifically this may happen during an update from the model (writeValue) where sending an update to the model would actually be incorrect.\n return;\n }\n\n this.value = value;\n // We're re-entering the Angular zone only if the value has been changed since there's a `return` expression previously.\n // This won't cause \"dead\" change detections (basically when the `tick()` has been run, but there's nothing to update).\n this.ngZone.run(() => {\n this.onChange(value);\n });\n }\n\n private updateOptionToMonaco(): void {\n if (this.editorInstance) {\n this.editorInstance.updateOptions({ ...this.editorOptionCached });\n }\n }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { NzIconModule } from 'ng-zorro-antd/icon';\nimport { NzSpinModule } from 'ng-zorro-antd/spin';\n\nimport { NzCodeEditorComponent } from './code-editor.component';\n\n@NgModule({\n declarations: [NzCodeEditorComponent],\n imports: [CommonModule, NzIconModule, NzSpinModule],\n exports: [NzCodeEditorComponent]\n})\nexport class NzCodeEditorModule {}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nexport * from './typings';\nexport * from './code-editor.component';\nexport * from './code-editor.module';\nexport * from './code-editor.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;AAkBA,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C,SAAS,cAAc,CAAC,EAAwC;IAC9D,OAAO,CAAC,GAAG,IAAiB;QAC1B,IAAI,EAAE,EAAE;YACN,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;SACb;KACF,CAAC;AACJ,CAAC;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,OAAO,GAAG,IAAI,aAAa,CAAU,CAAC,CAAC,CAAC;AAC9C,IAAI,aAAa,yBAAoC;MAKxC,mBAAmB;IAS9B,YAA6B,eAAgC,EAAoB,SAAoB;QAAxE,oBAAe,GAAf,eAAe,CAAiB;QAPrD,2BAAsB,GAAG,KAAK,CAAC;QAC/B,WAAM,GAAwB,EAAE,CAAC;QAIzC,YAAO,GAAG,IAAI,eAAe,CAAsB,IAAI,CAAC,MAAM,CAAC,CAAC;QAG9D,MAAM,YAA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