@apipass/inputs 0.2.1-alpha.4 → 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.
@@ -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
+ }
@@ -19,6 +19,9 @@
19
19
  .apipass-btn-icon-text {
20
20
  padding-right: 10px;
21
21
  }
22
+ .apipass-btn-icon-text-suffix {
23
+ padding-left: 10px;
24
+ }
22
25
  }
23
26
 
24
27
  .apipass-btn-default {
@@ -36,6 +39,9 @@
36
39
  .apipass-btn-icon-text {
37
40
  padding-right: 10px;
38
41
  }
42
+ .apipass-btn-icon-text-suffix {
43
+ padding-left: 10px;
44
+ }
39
45
  }
40
46
 
41
47
  .apipass-btn-primary {
@@ -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
 
@@ -1135,6 +1135,7 @@
1135
1135
  _this.addNewItemText = '';
1136
1136
  _this.addNewItemIcon = '';
1137
1137
  _this.addNewItemClickCloseSelect = false;
1138
+ _this.closeOnBodyScroll = false;
1138
1139
  _this.onOpenSelectBox = new i0.EventEmitter();
1139
1140
  _this.onCloseSelectBox = new i0.EventEmitter();
1140
1141
  _this.onSelectChange = new i0.EventEmitter();
@@ -1144,10 +1145,28 @@
1144
1145
  _this.loading = false;
1145
1146
  _this.inputFilter = new rxjs.Subject();
1146
1147
  _this.lastSearchTerm = '';
1148
+ _this.onBodyScroll = function (event) {
1149
+ var _a, _b;
1150
+ if (_this.closeOnBodyScroll && ((_a = _this.ngSelectComponent) === null || _a === void 0 ? void 0 : _a.isOpen)) {
1151
+ var isScrollingInScrollHost = ((_b = event.target.className) === null || _b === void 0 ? void 0 : _b.indexOf('ng-dropdown-panel-items')) > -1;
1152
+ if (isScrollingInScrollHost) {
1153
+ return;
1154
+ }
1155
+ _this.ngSelectComponent.close();
1156
+ }
1157
+ };
1147
1158
  return _this;
1148
1159
  }
1149
1160
  SelectBoxComponent.prototype.ngOnInit = function () {
1150
1161
  this.onSearch();
1162
+ if (this.closeOnBodyScroll) {
1163
+ window.addEventListener('scroll', this.onBodyScroll, true);
1164
+ }
1165
+ };
1166
+ SelectBoxComponent.prototype.ngOnDestroy = function () {
1167
+ if (this.closeOnBodyScroll) {
1168
+ window.removeEventListener('scroll', this.onBodyScroll, true);
1169
+ }
1151
1170
  };
1152
1171
  SelectBoxComponent.prototype.onSearch = function () {
1153
1172
  var _this = this;
@@ -1167,8 +1186,8 @@
1167
1186
  });
1168
1187
  };
1169
1188
  // @ts-ignore
1170
- SelectBoxComponent.prototype.onScroll = function (_b) {
1171
- var end = _b.end;
1189
+ SelectBoxComponent.prototype.onScroll = function (_c) {
1190
+ var end = _c.end;
1172
1191
  if (this.loading || this.data.length <= this.visibleItens.length) {
1173
1192
  return;
1174
1193
  }
@@ -1238,7 +1257,7 @@
1238
1257
  var _t;
1239
1258
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.ngSelectComponent = _t.first);
1240
1259
  }
1241
- }, inputs: { placeholder: "placeholder", searchPlaceHolder: "searchPlaceHolder", clearText: "clearText", notFoundText: "notFoundText", enabledSearch: "enabledSearch", data: "data", disabled: "disabled", selectedItem: "selectedItem", bindImageUrl: "bindImageUrl", bindKey: "bindKey", bindValue: "bindValue", limitItens: "limitItens", showAddNewItem: "showAddNewItem", addNewItemText: "addNewItemText", addNewItemIcon: "addNewItemIcon", addNewItemClickCloseSelect: "addNewItemClickCloseSelect" }, outputs: { onOpenSelectBox: "onOpenSelectBox", onCloseSelectBox: "onCloseSelectBox", onSelectChange: "onSelectChange", onSelectClear: "onSelectClear", onAddNewItemClick: "onAddNewItemClick" }, features: [i0.ɵɵProvidersFeature([{
1260
+ }, inputs: { placeholder: "placeholder", searchPlaceHolder: "searchPlaceHolder", clearText: "clearText", notFoundText: "notFoundText", enabledSearch: "enabledSearch", data: "data", disabled: "disabled", selectedItem: "selectedItem", bindImageUrl: "bindImageUrl", bindKey: "bindKey", bindValue: "bindValue", limitItens: "limitItens", showAddNewItem: "showAddNewItem", addNewItemText: "addNewItemText", addNewItemIcon: "addNewItemIcon", addNewItemClickCloseSelect: "addNewItemClickCloseSelect", closeOnBodyScroll: "closeOnBodyScroll" }, outputs: { onOpenSelectBox: "onOpenSelectBox", onCloseSelectBox: "onCloseSelectBox", onSelectChange: "onSelectChange", onSelectClear: "onSelectClear", onAddNewItemClick: "onAddNewItemClick" }, features: [i0.ɵɵProvidersFeature([{
1242
1261
  provide: i4.NG_VALUE_ACCESSOR,
1243
1262
  useExisting: i0.forwardRef(function () { return SelectBoxComponent; }),
1244
1263
  multi: true
@@ -1306,6 +1325,8 @@
1306
1325
  type: i0.Input
1307
1326
  }], addNewItemClickCloseSelect: [{
1308
1327
  type: i0.Input
1328
+ }], closeOnBodyScroll: [{
1329
+ type: i0.Input
1309
1330
  }], onOpenSelectBox: [{
1310
1331
  type: i0.Output
1311
1332
  }], onCloseSelectBox: [{
@@ -1829,6 +1850,427 @@
1829
1850
  }] });
1830
1851
  })();
1831
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
+
1832
2274
  var InputsModule = /** @class */ (function () {
1833
2275
  function InputsModule() {
1834
2276
  }
@@ -1861,7 +2303,9 @@
1861
2303
  InputAvatarComponent,
1862
2304
  InputFileComponent,
1863
2305
  CustomSelectComponent,
1864
- FieldComponent], imports: [i1$3.RouterModule, i2.CommonModule,
2306
+ FieldComponent,
2307
+ AceEditorComponent,
2308
+ AceEditorDirective], imports: [i1$3.RouterModule, i2.CommonModule,
1865
2309
  i4.FormsModule,
1866
2310
  i1.MatFormFieldModule,
1867
2311
  i3.MatInputModule,
@@ -1881,7 +2325,9 @@
1881
2325
  InputAvatarComponent,
1882
2326
  InputFileComponent,
1883
2327
  CustomSelectComponent,
1884
- FieldComponent] });
2328
+ FieldComponent,
2329
+ AceEditorComponent,
2330
+ AceEditorDirective] });
1885
2331
  })();
1886
2332
  /*@__PURE__*/ (function () {
1887
2333
  i0.ɵsetClassMetadata(InputsModule, [{
@@ -1913,7 +2359,9 @@
1913
2359
  InputAvatarComponent,
1914
2360
  InputFileComponent,
1915
2361
  CustomSelectComponent,
1916
- FieldComponent
2362
+ FieldComponent,
2363
+ AceEditorComponent,
2364
+ AceEditorDirective
1917
2365
  ],
1918
2366
  exports: [
1919
2367
  SelectBoxComponent,
@@ -1923,7 +2371,9 @@
1923
2371
  InputAvatarComponent,
1924
2372
  InputFileComponent,
1925
2373
  CustomSelectComponent,
1926
- FieldComponent
2374
+ FieldComponent,
2375
+ AceEditorComponent,
2376
+ AceEditorDirective
1927
2377
  ],
1928
2378
  providers: [],
1929
2379
  }]
@@ -1934,6 +2384,8 @@
1934
2384
  * Generated bundle index. Do not edit.
1935
2385
  */
1936
2386
 
2387
+ exports.AceEditorComponent = AceEditorComponent;
2388
+ exports.AceEditorDirective = AceEditorDirective;
1937
2389
  exports.CustomSelectComponent = CustomSelectComponent;
1938
2390
  exports.CustomSelectItem = CustomSelectItem;
1939
2391
  exports.FieldComponent = FieldComponent;