@apipass/inputs 0.2.1-alpha.6 → 0.2.1-alpha.7
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/ace-editor/component.d.ts +52 -0
- package/ace-editor/directive.d.ts +39 -0
- package/bundles/apipass-inputs.umd.js +437 -6
- package/bundles/apipass-inputs.umd.js.map +1 -1
- package/bundles/apipass-inputs.umd.min.js +2 -2
- package/bundles/apipass-inputs.umd.min.js.map +1 -1
- package/esm2015/ace-editor/component.js +204 -0
- package/esm2015/ace-editor/directive.js +150 -0
- package/esm2015/inputs.module.js +15 -5
- package/esm2015/public-api.js +3 -1
- package/fesm2015/apipass-inputs.js +361 -6
- package/fesm2015/apipass-inputs.js.map +1 -1
- package/inputs.module.d.ts +18 -16
- package/package.json +3 -1
- package/public-api.d.ts +2 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ElementRef, EventEmitter, NgZone, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import 'brace';
|
|
4
|
+
import 'brace/theme/monokai';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class AceEditorComponent implements ControlValueAccessor, OnInit, OnDestroy {
|
|
7
|
+
private zone;
|
|
8
|
+
textChanged: EventEmitter<any>;
|
|
9
|
+
textChange: EventEmitter<any>;
|
|
10
|
+
style: any;
|
|
11
|
+
_options: any;
|
|
12
|
+
_readOnly: false;
|
|
13
|
+
_theme: string;
|
|
14
|
+
_mode: string;
|
|
15
|
+
_autoUpdateContent: boolean;
|
|
16
|
+
_editor: any;
|
|
17
|
+
_durationBeforeCallback: number;
|
|
18
|
+
_text: string;
|
|
19
|
+
oldText: any;
|
|
20
|
+
timeoutSaving: any;
|
|
21
|
+
constructor(elementRef: ElementRef, zone: NgZone);
|
|
22
|
+
ngOnInit(): void;
|
|
23
|
+
ngOnDestroy(): void;
|
|
24
|
+
init(): void;
|
|
25
|
+
initEvents(): void;
|
|
26
|
+
updateText(): void;
|
|
27
|
+
set options(options: any);
|
|
28
|
+
setOptions(options: any): void;
|
|
29
|
+
set readOnly(readOnly: any);
|
|
30
|
+
setReadOnly(readOnly: any): void;
|
|
31
|
+
set theme(theme: any);
|
|
32
|
+
setTheme(theme: any): void;
|
|
33
|
+
set mode(mode: any);
|
|
34
|
+
setMode(mode: any): void;
|
|
35
|
+
get value(): string;
|
|
36
|
+
set value(value: string);
|
|
37
|
+
writeValue(value: any): void;
|
|
38
|
+
private _onChange;
|
|
39
|
+
registerOnChange(fn: any): void;
|
|
40
|
+
private _onTouched;
|
|
41
|
+
registerOnTouched(fn: any): void;
|
|
42
|
+
get text(): string;
|
|
43
|
+
set text(text: string);
|
|
44
|
+
setText(text: any): void;
|
|
45
|
+
set autoUpdateContent(status: any);
|
|
46
|
+
setAutoUpdateContent(status: any): void;
|
|
47
|
+
set durationBeforeCallback(num: number);
|
|
48
|
+
setDurationBeforeCallback(num: number): void;
|
|
49
|
+
getEditor(): any;
|
|
50
|
+
static ɵfac: i0.ɵɵFactoryDef<AceEditorComponent, never>;
|
|
51
|
+
static ɵcmp: i0.ɵɵComponentDefWithMeta<AceEditorComponent, "ace-editor", never, { "style": "style"; "options": "options"; "readOnly": "readOnly"; "theme": "theme"; "mode": "mode"; "value": "value"; "text": "text"; "autoUpdateContent": "autoUpdateContent"; "durationBeforeCallback": "durationBeforeCallback"; }, { "textChanged": "textChanged"; "textChange": "textChange"; }, never, never>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ElementRef, EventEmitter, NgZone, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import 'brace';
|
|
3
|
+
import 'brace/theme/monokai';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class AceEditorDirective implements OnInit, OnDestroy {
|
|
6
|
+
private zone;
|
|
7
|
+
textChanged: EventEmitter<any>;
|
|
8
|
+
textChange: EventEmitter<any>;
|
|
9
|
+
_options: any;
|
|
10
|
+
_readOnly: boolean;
|
|
11
|
+
_theme: string;
|
|
12
|
+
_mode: string;
|
|
13
|
+
_autoUpdateContent: boolean;
|
|
14
|
+
_durationBeforeCallback: number;
|
|
15
|
+
_text: string;
|
|
16
|
+
editor: any;
|
|
17
|
+
oldText: any;
|
|
18
|
+
timeoutSaving: any;
|
|
19
|
+
constructor(elementRef: ElementRef, zone: NgZone);
|
|
20
|
+
ngOnInit(): void;
|
|
21
|
+
ngOnDestroy(): void;
|
|
22
|
+
init(): void;
|
|
23
|
+
initEvents(): void;
|
|
24
|
+
updateText(): void;
|
|
25
|
+
set options(options: any);
|
|
26
|
+
set readOnly(readOnly: any);
|
|
27
|
+
set theme(theme: any);
|
|
28
|
+
set mode(mode: any);
|
|
29
|
+
setMode(mode: any): void;
|
|
30
|
+
get text(): string;
|
|
31
|
+
set text(text: string);
|
|
32
|
+
setText(text: any): void;
|
|
33
|
+
set autoUpdateContent(status: any);
|
|
34
|
+
set durationBeforeCallback(num: number);
|
|
35
|
+
setDurationBeforeCallback(num: number): void;
|
|
36
|
+
get aceEditor(): any;
|
|
37
|
+
static ɵfac: i0.ɵɵFactoryDef<AceEditorDirective, never>;
|
|
38
|
+
static ɵdir: i0.ɵɵDirectiveDefWithMeta<AceEditorDirective, "[ace-editor]", never, { "options": "options"; "readOnly": "readOnly"; "theme": "theme"; "mode": "mode"; "text": "text"; "autoUpdateContent": "autoUpdateContent"; "durationBeforeCallback": "durationBeforeCallback"; }, { "textChanged": "textChanged"; "textChange": "textChange"; }, never>;
|
|
39
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/common'), require('@angular/material/form-field'), require('@angular/material/select'), require('@angular/material/core'), require('@apipass/pipes'), require('@ngx-translate/core'), require('@angular/material/input'), require('@angular/material/icon'), require('@angular/material/tooltip'), require('lodash'), require('@angular-material-extensions/password-strength'), require('@apipass/icons'), require('rxjs'), require('rxjs/operators'), require('@ng-select/ng-select'), require('mat-select-filter'), require('ngx-drag-drop'), require('@angular/router')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@apipass/inputs', ['exports', '@angular/core', '@angular/forms', '@angular/common', '@angular/material/form-field', '@angular/material/select', '@angular/material/core', '@apipass/pipes', '@ngx-translate/core', '@angular/material/input', '@angular/material/icon', '@angular/material/tooltip', 'lodash', '@angular-material-extensions/password-strength', '@apipass/icons', 'rxjs', 'rxjs/operators', '@ng-select/ng-select', 'mat-select-filter', 'ngx-drag-drop', '@angular/router'], factory) :
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/common'), require('@angular/material/form-field'), require('@angular/material/select'), require('@angular/material/core'), require('@apipass/pipes'), require('@ngx-translate/core'), require('@angular/material/input'), require('@angular/material/icon'), require('@angular/material/tooltip'), require('lodash'), require('@angular-material-extensions/password-strength'), require('@apipass/icons'), require('rxjs'), require('rxjs/operators'), require('@ng-select/ng-select'), require('mat-select-filter'), require('ngx-drag-drop'), require('@angular/router'), require('brace'), require('brace/theme/monokai')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@apipass/inputs', ['exports', '@angular/core', '@angular/forms', '@angular/common', '@angular/material/form-field', '@angular/material/select', '@angular/material/core', '@apipass/pipes', '@ngx-translate/core', '@angular/material/input', '@angular/material/icon', '@angular/material/tooltip', 'lodash', '@angular-material-extensions/password-strength', '@apipass/icons', 'rxjs', 'rxjs/operators', '@ng-select/ng-select', 'mat-select-filter', 'ngx-drag-drop', '@angular/router', 'brace', 'brace/theme/monokai'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.apipass = global.apipass || {}, global.apipass.inputs = {}), global.ng.core, global.ng.forms, global.ng.common, global.ng.material.formField, global.ng.material.select, global.ng.material.core, global.i6, global.i7, global.ng.material.input, global.ng.material.icon, global.ng.material.tooltip, global.lodash, global.i5$1, global.i3$1, global.rxjs, global.rxjs.operators, global.i1$2, global.matSelectFilter, global.i5$3, global.ng.router));
|
|
5
5
|
}(this, (function (exports, i0, i4, i2, i1, i1$1, i5, i6, i7, i3, i5$2, i2$1, lodash, i5$1, i3$1, rxjs, operators, i1$2, matSelectFilter, i5$3, i1$3) { 'use strict';
|
|
6
6
|
|
|
@@ -1850,6 +1850,427 @@
|
|
|
1850
1850
|
}] });
|
|
1851
1851
|
})();
|
|
1852
1852
|
|
|
1853
|
+
/* tslint:disable */
|
|
1854
|
+
var AceEditorComponent = /** @class */ (function () {
|
|
1855
|
+
function AceEditorComponent(elementRef, zone) {
|
|
1856
|
+
var _this = this;
|
|
1857
|
+
this.zone = zone;
|
|
1858
|
+
this.textChanged = new i0.EventEmitter();
|
|
1859
|
+
this.textChange = new i0.EventEmitter();
|
|
1860
|
+
this.style = {};
|
|
1861
|
+
// @ts-ignore
|
|
1862
|
+
this._options = {};
|
|
1863
|
+
// @ts-ignore
|
|
1864
|
+
this._theme = 'monokai';
|
|
1865
|
+
// @ts-ignore
|
|
1866
|
+
this._mode = 'html';
|
|
1867
|
+
// @ts-ignore
|
|
1868
|
+
this._autoUpdateContent = true;
|
|
1869
|
+
// @ts-ignore
|
|
1870
|
+
this._durationBeforeCallback = 0;
|
|
1871
|
+
// @ts-ignore
|
|
1872
|
+
this._text = '';
|
|
1873
|
+
this._onChange = function (_) {
|
|
1874
|
+
};
|
|
1875
|
+
this._onTouched = function () {
|
|
1876
|
+
};
|
|
1877
|
+
var el = elementRef.nativeElement;
|
|
1878
|
+
this.zone.runOutsideAngular(function () {
|
|
1879
|
+
_this._editor = ace['edit'](el);
|
|
1880
|
+
});
|
|
1881
|
+
this._editor.$blockScrolling = Infinity;
|
|
1882
|
+
}
|
|
1883
|
+
AceEditorComponent.prototype.ngOnInit = function () {
|
|
1884
|
+
this.init();
|
|
1885
|
+
this.initEvents();
|
|
1886
|
+
};
|
|
1887
|
+
AceEditorComponent.prototype.ngOnDestroy = function () {
|
|
1888
|
+
this._editor.destroy();
|
|
1889
|
+
};
|
|
1890
|
+
AceEditorComponent.prototype.init = function () {
|
|
1891
|
+
this.setOptions(this._options || {});
|
|
1892
|
+
this.setTheme(this._theme);
|
|
1893
|
+
this.setMode(this._mode);
|
|
1894
|
+
this.setReadOnly(this._readOnly);
|
|
1895
|
+
};
|
|
1896
|
+
AceEditorComponent.prototype.initEvents = function () {
|
|
1897
|
+
var _this = this;
|
|
1898
|
+
this._editor.on('change', function () { return _this.updateText(); });
|
|
1899
|
+
this._editor.on('paste', function () { return _this.updateText(); });
|
|
1900
|
+
};
|
|
1901
|
+
AceEditorComponent.prototype.updateText = function () {
|
|
1902
|
+
var _this = this;
|
|
1903
|
+
var newVal = this._editor.getValue();
|
|
1904
|
+
if (newVal === this.oldText) {
|
|
1905
|
+
return;
|
|
1906
|
+
}
|
|
1907
|
+
if (!this._durationBeforeCallback) {
|
|
1908
|
+
this._text = newVal;
|
|
1909
|
+
this.zone.run(function () {
|
|
1910
|
+
_this.textChange.emit(newVal);
|
|
1911
|
+
_this.textChanged.emit(newVal);
|
|
1912
|
+
});
|
|
1913
|
+
this._onChange(newVal);
|
|
1914
|
+
}
|
|
1915
|
+
else {
|
|
1916
|
+
if (this.timeoutSaving) {
|
|
1917
|
+
clearTimeout(this.timeoutSaving);
|
|
1918
|
+
}
|
|
1919
|
+
this.timeoutSaving = setTimeout(function () {
|
|
1920
|
+
_this._text = newVal;
|
|
1921
|
+
_this.zone.run(function () {
|
|
1922
|
+
_this.textChange.emit(newVal);
|
|
1923
|
+
_this.textChanged.emit(newVal);
|
|
1924
|
+
});
|
|
1925
|
+
_this.timeoutSaving = null;
|
|
1926
|
+
}, this._durationBeforeCallback);
|
|
1927
|
+
}
|
|
1928
|
+
this.oldText = newVal;
|
|
1929
|
+
};
|
|
1930
|
+
Object.defineProperty(AceEditorComponent.prototype, "options", {
|
|
1931
|
+
set: function (options) {
|
|
1932
|
+
this.setOptions(options);
|
|
1933
|
+
},
|
|
1934
|
+
enumerable: false,
|
|
1935
|
+
configurable: true
|
|
1936
|
+
});
|
|
1937
|
+
AceEditorComponent.prototype.setOptions = function (options) {
|
|
1938
|
+
this._options = options;
|
|
1939
|
+
this._editor.setOptions(options || {});
|
|
1940
|
+
};
|
|
1941
|
+
Object.defineProperty(AceEditorComponent.prototype, "readOnly", {
|
|
1942
|
+
set: function (readOnly) {
|
|
1943
|
+
this.setReadOnly(readOnly);
|
|
1944
|
+
},
|
|
1945
|
+
enumerable: false,
|
|
1946
|
+
configurable: true
|
|
1947
|
+
});
|
|
1948
|
+
AceEditorComponent.prototype.setReadOnly = function (readOnly) {
|
|
1949
|
+
this._readOnly = readOnly;
|
|
1950
|
+
this._editor.setReadOnly(readOnly);
|
|
1951
|
+
};
|
|
1952
|
+
Object.defineProperty(AceEditorComponent.prototype, "theme", {
|
|
1953
|
+
set: function (theme) {
|
|
1954
|
+
this.setTheme(theme);
|
|
1955
|
+
},
|
|
1956
|
+
enumerable: false,
|
|
1957
|
+
configurable: true
|
|
1958
|
+
});
|
|
1959
|
+
AceEditorComponent.prototype.setTheme = function (theme) {
|
|
1960
|
+
this._theme = theme;
|
|
1961
|
+
this._editor.setTheme("ace/theme/" + theme);
|
|
1962
|
+
};
|
|
1963
|
+
Object.defineProperty(AceEditorComponent.prototype, "mode", {
|
|
1964
|
+
set: function (mode) {
|
|
1965
|
+
this.setMode(mode);
|
|
1966
|
+
},
|
|
1967
|
+
enumerable: false,
|
|
1968
|
+
configurable: true
|
|
1969
|
+
});
|
|
1970
|
+
AceEditorComponent.prototype.setMode = function (mode) {
|
|
1971
|
+
this._mode = mode;
|
|
1972
|
+
if (typeof this._mode === 'object') {
|
|
1973
|
+
this._editor.getSession().setMode(this._mode);
|
|
1974
|
+
}
|
|
1975
|
+
else {
|
|
1976
|
+
this._editor.getSession().setMode("ace/mode/" + this._mode);
|
|
1977
|
+
}
|
|
1978
|
+
};
|
|
1979
|
+
Object.defineProperty(AceEditorComponent.prototype, "value", {
|
|
1980
|
+
// @ts-ignore
|
|
1981
|
+
get: function () {
|
|
1982
|
+
return this.text;
|
|
1983
|
+
},
|
|
1984
|
+
// @ts-ignore
|
|
1985
|
+
set: function (value) {
|
|
1986
|
+
this.setText(value);
|
|
1987
|
+
},
|
|
1988
|
+
enumerable: false,
|
|
1989
|
+
configurable: true
|
|
1990
|
+
});
|
|
1991
|
+
AceEditorComponent.prototype.writeValue = function (value) {
|
|
1992
|
+
this.setText(value);
|
|
1993
|
+
};
|
|
1994
|
+
AceEditorComponent.prototype.registerOnChange = function (fn) {
|
|
1995
|
+
this._onChange = fn;
|
|
1996
|
+
};
|
|
1997
|
+
AceEditorComponent.prototype.registerOnTouched = function (fn) {
|
|
1998
|
+
this._onTouched = fn;
|
|
1999
|
+
};
|
|
2000
|
+
Object.defineProperty(AceEditorComponent.prototype, "text", {
|
|
2001
|
+
get: function () {
|
|
2002
|
+
return this._text;
|
|
2003
|
+
},
|
|
2004
|
+
set: function (text) {
|
|
2005
|
+
this.setText(text);
|
|
2006
|
+
},
|
|
2007
|
+
enumerable: false,
|
|
2008
|
+
configurable: true
|
|
2009
|
+
});
|
|
2010
|
+
AceEditorComponent.prototype.setText = function (text) {
|
|
2011
|
+
if (text === null || text === undefined) {
|
|
2012
|
+
text = '';
|
|
2013
|
+
}
|
|
2014
|
+
if (this._text !== text && this._autoUpdateContent) {
|
|
2015
|
+
this._text = text;
|
|
2016
|
+
this._editor.setValue(text);
|
|
2017
|
+
this._onChange(text);
|
|
2018
|
+
this._editor.clearSelection();
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
Object.defineProperty(AceEditorComponent.prototype, "autoUpdateContent", {
|
|
2022
|
+
set: function (status) {
|
|
2023
|
+
this.setAutoUpdateContent(status);
|
|
2024
|
+
},
|
|
2025
|
+
enumerable: false,
|
|
2026
|
+
configurable: true
|
|
2027
|
+
});
|
|
2028
|
+
AceEditorComponent.prototype.setAutoUpdateContent = function (status) {
|
|
2029
|
+
this._autoUpdateContent = status;
|
|
2030
|
+
};
|
|
2031
|
+
Object.defineProperty(AceEditorComponent.prototype, "durationBeforeCallback", {
|
|
2032
|
+
set: function (num) {
|
|
2033
|
+
this.setDurationBeforeCallback(num);
|
|
2034
|
+
},
|
|
2035
|
+
enumerable: false,
|
|
2036
|
+
configurable: true
|
|
2037
|
+
});
|
|
2038
|
+
AceEditorComponent.prototype.setDurationBeforeCallback = function (num) {
|
|
2039
|
+
this._durationBeforeCallback = num;
|
|
2040
|
+
};
|
|
2041
|
+
AceEditorComponent.prototype.getEditor = function () {
|
|
2042
|
+
return this._editor;
|
|
2043
|
+
};
|
|
2044
|
+
return AceEditorComponent;
|
|
2045
|
+
}());
|
|
2046
|
+
AceEditorComponent.ɵfac = function AceEditorComponent_Factory(t) { return new (t || AceEditorComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.NgZone)); };
|
|
2047
|
+
AceEditorComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AceEditorComponent, selectors: [["ace-editor"]], inputs: { style: "style", options: "options", readOnly: "readOnly", theme: "theme", mode: "mode", value: "value", text: "text", autoUpdateContent: "autoUpdateContent", durationBeforeCallback: "durationBeforeCallback" }, outputs: { textChanged: "textChanged", textChange: "textChange" }, features: [i0.ɵɵProvidersFeature([{
|
|
2048
|
+
provide: i4.NG_VALUE_ACCESSOR,
|
|
2049
|
+
useExisting: i0.forwardRef(function () { return AceEditorComponent; }),
|
|
2050
|
+
multi: true
|
|
2051
|
+
}])], decls: 0, vars: 0, template: function AceEditorComponent_Template(rf, ctx) { }, styles: ["[_nghost-%COMP%] { display:block;width:100%; }"] });
|
|
2052
|
+
/*@__PURE__*/ (function () {
|
|
2053
|
+
i0.ɵsetClassMetadata(AceEditorComponent, [{
|
|
2054
|
+
type: i0.Component,
|
|
2055
|
+
args: [{
|
|
2056
|
+
selector: 'ace-editor',
|
|
2057
|
+
template: '',
|
|
2058
|
+
styles: [':host { display:block;width:100%; }'],
|
|
2059
|
+
providers: [{
|
|
2060
|
+
provide: i4.NG_VALUE_ACCESSOR,
|
|
2061
|
+
useExisting: i0.forwardRef(function () { return AceEditorComponent; }),
|
|
2062
|
+
multi: true
|
|
2063
|
+
}]
|
|
2064
|
+
}]
|
|
2065
|
+
}], function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, { textChanged: [{
|
|
2066
|
+
type: i0.Output
|
|
2067
|
+
}], textChange: [{
|
|
2068
|
+
type: i0.Output
|
|
2069
|
+
}], style: [{
|
|
2070
|
+
type: i0.Input
|
|
2071
|
+
}], options: [{
|
|
2072
|
+
type: i0.Input
|
|
2073
|
+
}], readOnly: [{
|
|
2074
|
+
type: i0.Input
|
|
2075
|
+
}], theme: [{
|
|
2076
|
+
type: i0.Input
|
|
2077
|
+
}], mode: [{
|
|
2078
|
+
type: i0.Input
|
|
2079
|
+
}], value: [{
|
|
2080
|
+
type: i0.Input
|
|
2081
|
+
}], text: [{
|
|
2082
|
+
type: i0.Input
|
|
2083
|
+
}], autoUpdateContent: [{
|
|
2084
|
+
type: i0.Input
|
|
2085
|
+
}], durationBeforeCallback: [{
|
|
2086
|
+
type: i0.Input
|
|
2087
|
+
}] });
|
|
2088
|
+
})();
|
|
2089
|
+
|
|
2090
|
+
/* tslint:disable */
|
|
2091
|
+
var AceEditorDirective = /** @class */ (function () {
|
|
2092
|
+
function AceEditorDirective(elementRef, zone) {
|
|
2093
|
+
var _this = this;
|
|
2094
|
+
this.zone = zone;
|
|
2095
|
+
this.textChanged = new i0.EventEmitter();
|
|
2096
|
+
this.textChange = new i0.EventEmitter();
|
|
2097
|
+
this._options = {};
|
|
2098
|
+
this._readOnly = false;
|
|
2099
|
+
this._theme = 'monokai';
|
|
2100
|
+
this._mode = 'html';
|
|
2101
|
+
this._autoUpdateContent = true;
|
|
2102
|
+
this._durationBeforeCallback = 0;
|
|
2103
|
+
this._text = '';
|
|
2104
|
+
var el = elementRef.nativeElement;
|
|
2105
|
+
this.zone.runOutsideAngular(function () {
|
|
2106
|
+
_this.editor = ace['edit'](el);
|
|
2107
|
+
});
|
|
2108
|
+
this.editor.$blockScrolling = Infinity;
|
|
2109
|
+
}
|
|
2110
|
+
AceEditorDirective.prototype.ngOnInit = function () {
|
|
2111
|
+
this.init();
|
|
2112
|
+
this.initEvents();
|
|
2113
|
+
};
|
|
2114
|
+
AceEditorDirective.prototype.ngOnDestroy = function () {
|
|
2115
|
+
this.editor.destroy();
|
|
2116
|
+
};
|
|
2117
|
+
AceEditorDirective.prototype.init = function () {
|
|
2118
|
+
this.editor.setOptions(this._options || {});
|
|
2119
|
+
this.editor.setTheme("ace/theme/" + this._theme);
|
|
2120
|
+
this.setMode(this._mode);
|
|
2121
|
+
this.editor.setReadOnly(this._readOnly);
|
|
2122
|
+
};
|
|
2123
|
+
AceEditorDirective.prototype.initEvents = function () {
|
|
2124
|
+
var _this = this;
|
|
2125
|
+
this.editor.on('change', function () { return _this.updateText(); });
|
|
2126
|
+
this.editor.on('paste', function () { return _this.updateText(); });
|
|
2127
|
+
};
|
|
2128
|
+
AceEditorDirective.prototype.updateText = function () {
|
|
2129
|
+
var _this = this;
|
|
2130
|
+
var newVal = this.editor.getValue();
|
|
2131
|
+
if (newVal === this.oldText) {
|
|
2132
|
+
return;
|
|
2133
|
+
}
|
|
2134
|
+
if (!this._durationBeforeCallback) {
|
|
2135
|
+
this._text = newVal;
|
|
2136
|
+
this.zone.run(function () {
|
|
2137
|
+
_this.textChange.emit(newVal);
|
|
2138
|
+
_this.textChanged.emit(newVal);
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
else {
|
|
2142
|
+
if (this.timeoutSaving != null) {
|
|
2143
|
+
clearTimeout(this.timeoutSaving);
|
|
2144
|
+
}
|
|
2145
|
+
this.timeoutSaving = setTimeout(function () {
|
|
2146
|
+
_this._text = newVal;
|
|
2147
|
+
_this.zone.run(function () {
|
|
2148
|
+
_this.textChange.emit(newVal);
|
|
2149
|
+
_this.textChanged.emit(newVal);
|
|
2150
|
+
});
|
|
2151
|
+
_this.timeoutSaving = null;
|
|
2152
|
+
}, this._durationBeforeCallback);
|
|
2153
|
+
}
|
|
2154
|
+
this.oldText = newVal;
|
|
2155
|
+
};
|
|
2156
|
+
Object.defineProperty(AceEditorDirective.prototype, "options", {
|
|
2157
|
+
set: function (options) {
|
|
2158
|
+
this._options = options;
|
|
2159
|
+
this.editor.setOptions(options || {});
|
|
2160
|
+
},
|
|
2161
|
+
enumerable: false,
|
|
2162
|
+
configurable: true
|
|
2163
|
+
});
|
|
2164
|
+
Object.defineProperty(AceEditorDirective.prototype, "readOnly", {
|
|
2165
|
+
set: function (readOnly) {
|
|
2166
|
+
this._readOnly = readOnly;
|
|
2167
|
+
this.editor.setReadOnly(readOnly);
|
|
2168
|
+
},
|
|
2169
|
+
enumerable: false,
|
|
2170
|
+
configurable: true
|
|
2171
|
+
});
|
|
2172
|
+
Object.defineProperty(AceEditorDirective.prototype, "theme", {
|
|
2173
|
+
set: function (theme) {
|
|
2174
|
+
this._theme = theme;
|
|
2175
|
+
this.editor.setTheme("ace/theme/" + theme);
|
|
2176
|
+
},
|
|
2177
|
+
enumerable: false,
|
|
2178
|
+
configurable: true
|
|
2179
|
+
});
|
|
2180
|
+
Object.defineProperty(AceEditorDirective.prototype, "mode", {
|
|
2181
|
+
set: function (mode) {
|
|
2182
|
+
this.setMode(mode);
|
|
2183
|
+
},
|
|
2184
|
+
enumerable: false,
|
|
2185
|
+
configurable: true
|
|
2186
|
+
});
|
|
2187
|
+
AceEditorDirective.prototype.setMode = function (mode) {
|
|
2188
|
+
this._mode = mode;
|
|
2189
|
+
if (typeof this._mode === 'object') {
|
|
2190
|
+
this.editor.getSession().setMode(this._mode);
|
|
2191
|
+
}
|
|
2192
|
+
else {
|
|
2193
|
+
this.editor.getSession().setMode("ace/mode/" + this._mode);
|
|
2194
|
+
}
|
|
2195
|
+
};
|
|
2196
|
+
Object.defineProperty(AceEditorDirective.prototype, "text", {
|
|
2197
|
+
// @ts-ignore
|
|
2198
|
+
get: function () {
|
|
2199
|
+
return this._text;
|
|
2200
|
+
},
|
|
2201
|
+
set: function (text) {
|
|
2202
|
+
this.setText(text);
|
|
2203
|
+
},
|
|
2204
|
+
enumerable: false,
|
|
2205
|
+
configurable: true
|
|
2206
|
+
});
|
|
2207
|
+
AceEditorDirective.prototype.setText = function (text) {
|
|
2208
|
+
if (this._text !== text) {
|
|
2209
|
+
if (text === null || text === undefined) {
|
|
2210
|
+
text = '';
|
|
2211
|
+
}
|
|
2212
|
+
if (this._autoUpdateContent) {
|
|
2213
|
+
this._text = text;
|
|
2214
|
+
this.editor.setValue(text);
|
|
2215
|
+
this.editor.clearSelection();
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
};
|
|
2219
|
+
Object.defineProperty(AceEditorDirective.prototype, "autoUpdateContent", {
|
|
2220
|
+
set: function (status) {
|
|
2221
|
+
this._autoUpdateContent = status;
|
|
2222
|
+
},
|
|
2223
|
+
enumerable: false,
|
|
2224
|
+
configurable: true
|
|
2225
|
+
});
|
|
2226
|
+
Object.defineProperty(AceEditorDirective.prototype, "durationBeforeCallback", {
|
|
2227
|
+
set: function (num) {
|
|
2228
|
+
this.setDurationBeforeCallback(num);
|
|
2229
|
+
},
|
|
2230
|
+
enumerable: false,
|
|
2231
|
+
configurable: true
|
|
2232
|
+
});
|
|
2233
|
+
AceEditorDirective.prototype.setDurationBeforeCallback = function (num) {
|
|
2234
|
+
this._durationBeforeCallback = num;
|
|
2235
|
+
};
|
|
2236
|
+
Object.defineProperty(AceEditorDirective.prototype, "aceEditor", {
|
|
2237
|
+
get: function () {
|
|
2238
|
+
return this.editor;
|
|
2239
|
+
},
|
|
2240
|
+
enumerable: false,
|
|
2241
|
+
configurable: true
|
|
2242
|
+
});
|
|
2243
|
+
return AceEditorDirective;
|
|
2244
|
+
}());
|
|
2245
|
+
AceEditorDirective.ɵfac = function AceEditorDirective_Factory(t) { return new (t || AceEditorDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.NgZone)); };
|
|
2246
|
+
AceEditorDirective.ɵdir = i0.ɵɵdefineDirective({ type: AceEditorDirective, selectors: [["", "ace-editor", ""]], inputs: { options: "options", readOnly: "readOnly", theme: "theme", mode: "mode", text: "text", autoUpdateContent: "autoUpdateContent", durationBeforeCallback: "durationBeforeCallback" }, outputs: { textChanged: "textChanged", textChange: "textChange" } });
|
|
2247
|
+
/*@__PURE__*/ (function () {
|
|
2248
|
+
i0.ɵsetClassMetadata(AceEditorDirective, [{
|
|
2249
|
+
type: i0.Directive,
|
|
2250
|
+
args: [{
|
|
2251
|
+
selector: '[ace-editor]'
|
|
2252
|
+
}]
|
|
2253
|
+
}], function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, { textChanged: [{
|
|
2254
|
+
type: i0.Output
|
|
2255
|
+
}], textChange: [{
|
|
2256
|
+
type: i0.Output
|
|
2257
|
+
}], options: [{
|
|
2258
|
+
type: i0.Input
|
|
2259
|
+
}], readOnly: [{
|
|
2260
|
+
type: i0.Input
|
|
2261
|
+
}], theme: [{
|
|
2262
|
+
type: i0.Input
|
|
2263
|
+
}], mode: [{
|
|
2264
|
+
type: i0.Input
|
|
2265
|
+
}], text: [{
|
|
2266
|
+
type: i0.Input
|
|
2267
|
+
}], autoUpdateContent: [{
|
|
2268
|
+
type: i0.Input
|
|
2269
|
+
}], durationBeforeCallback: [{
|
|
2270
|
+
type: i0.Input
|
|
2271
|
+
}] });
|
|
2272
|
+
})();
|
|
2273
|
+
|
|
1853
2274
|
var InputsModule = /** @class */ (function () {
|
|
1854
2275
|
function InputsModule() {
|
|
1855
2276
|
}
|
|
@@ -1882,7 +2303,9 @@
|
|
|
1882
2303
|
InputAvatarComponent,
|
|
1883
2304
|
InputFileComponent,
|
|
1884
2305
|
CustomSelectComponent,
|
|
1885
|
-
FieldComponent
|
|
2306
|
+
FieldComponent,
|
|
2307
|
+
AceEditorComponent,
|
|
2308
|
+
AceEditorDirective], imports: [i1$3.RouterModule, i2.CommonModule,
|
|
1886
2309
|
i4.FormsModule,
|
|
1887
2310
|
i1.MatFormFieldModule,
|
|
1888
2311
|
i3.MatInputModule,
|
|
@@ -1902,7 +2325,9 @@
|
|
|
1902
2325
|
InputAvatarComponent,
|
|
1903
2326
|
InputFileComponent,
|
|
1904
2327
|
CustomSelectComponent,
|
|
1905
|
-
FieldComponent
|
|
2328
|
+
FieldComponent,
|
|
2329
|
+
AceEditorComponent,
|
|
2330
|
+
AceEditorDirective] });
|
|
1906
2331
|
})();
|
|
1907
2332
|
/*@__PURE__*/ (function () {
|
|
1908
2333
|
i0.ɵsetClassMetadata(InputsModule, [{
|
|
@@ -1934,7 +2359,9 @@
|
|
|
1934
2359
|
InputAvatarComponent,
|
|
1935
2360
|
InputFileComponent,
|
|
1936
2361
|
CustomSelectComponent,
|
|
1937
|
-
FieldComponent
|
|
2362
|
+
FieldComponent,
|
|
2363
|
+
AceEditorComponent,
|
|
2364
|
+
AceEditorDirective
|
|
1938
2365
|
],
|
|
1939
2366
|
exports: [
|
|
1940
2367
|
SelectBoxComponent,
|
|
@@ -1944,7 +2371,9 @@
|
|
|
1944
2371
|
InputAvatarComponent,
|
|
1945
2372
|
InputFileComponent,
|
|
1946
2373
|
CustomSelectComponent,
|
|
1947
|
-
FieldComponent
|
|
2374
|
+
FieldComponent,
|
|
2375
|
+
AceEditorComponent,
|
|
2376
|
+
AceEditorDirective
|
|
1948
2377
|
],
|
|
1949
2378
|
providers: [],
|
|
1950
2379
|
}]
|
|
@@ -1955,6 +2384,8 @@
|
|
|
1955
2384
|
* Generated bundle index. Do not edit.
|
|
1956
2385
|
*/
|
|
1957
2386
|
|
|
2387
|
+
exports.AceEditorComponent = AceEditorComponent;
|
|
2388
|
+
exports.AceEditorDirective = AceEditorDirective;
|
|
1958
2389
|
exports.CustomSelectComponent = CustomSelectComponent;
|
|
1959
2390
|
exports.CustomSelectItem = CustomSelectItem;
|
|
1960
2391
|
exports.FieldComponent = FieldComponent;
|