@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.
@@ -1,4 +1,4 @@
1
- import { ɵɵgetCurrentView, ɵɵelementStart, ɵɵlistener, ɵɵrestoreView, ɵɵnextContext, ɵɵelementEnd, ɵɵadvance, ɵɵproperty, ɵɵtext, ɵɵpipe, ɵɵtextInterpolate, ɵɵpipeBind1, ɵɵdefineComponent, ɵɵProvidersFeature, forwardRef, ɵɵInheritDefinitionFeature, ɵɵtemplate, ɵɵpipeBind2, ɵɵgetInheritedFactory, ɵsetClassMetadata, Component, ViewEncapsulation, Input, ɵɵreference, ɵɵtextInterpolate2, ɵɵelement, EventEmitter, ɵɵpureFunction1, ChangeDetectionStrategy, Output, ɵɵpureFunction3, ɵɵpureFunction2, ɵɵsanitizeUrl, ɵɵprojectionDef, ɵɵprojection, ɵɵviewQuery, ɵɵqueryRefresh, ɵɵloadQuery, ViewChild, ɵɵdirectiveInject, NgZone, ɵɵdefineDirective, Directive, ɵɵtextInterpolate1, ɵɵpipeBind3, ɵɵstaticViewQuery, ɵɵattribute, ɵɵpureFunction0, HostBinding, HostListener, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
1
+ import { ɵɵgetCurrentView, ɵɵelementStart, ɵɵlistener, ɵɵrestoreView, ɵɵnextContext, ɵɵelementEnd, ɵɵadvance, ɵɵproperty, ɵɵtext, ɵɵpipe, ɵɵtextInterpolate, ɵɵpipeBind1, ɵɵdefineComponent, ɵɵProvidersFeature, forwardRef, ɵɵInheritDefinitionFeature, ɵɵtemplate, ɵɵpipeBind2, ɵɵgetInheritedFactory, ɵsetClassMetadata, Component, ViewEncapsulation, Input, ɵɵreference, ɵɵtextInterpolate2, ɵɵelement, EventEmitter, ɵɵpureFunction1, ChangeDetectionStrategy, Output, ɵɵpureFunction3, ɵɵpureFunction2, ɵɵsanitizeUrl, ɵɵprojectionDef, ɵɵprojection, ɵɵviewQuery, ɵɵqueryRefresh, ɵɵloadQuery, ViewChild, ɵɵdirectiveInject, NgZone, ɵɵdefineDirective, Directive, ɵɵtextInterpolate1, ɵɵpipeBind3, ɵɵstaticViewQuery, ɵɵattribute, ɵɵpureFunction0, HostBinding, HostListener, ElementRef, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
2
2
  import { NG_VALUE_ACCESSOR, NgControlStatus, NgModel, DefaultValueAccessor, RequiredValidator, MinLengthValidator, FormsModule } from '@angular/forms';
3
3
  import { NgIf, NgForOf, NgClass, NgStyle, CommonModule } from '@angular/common';
4
4
  import { MatFormField, MatSuffix, MatLabel, MatHint, MatFormFieldModule } from '@angular/material/form-field';
@@ -18,6 +18,8 @@ import { NgSelectComponent, ɵh, ɵj, ɵf, NgSelectModule } from '@ng-select/ng-
18
18
  import { MatSelectFilterModule } from 'mat-select-filter';
19
19
  import { DndDropzoneDirective, DndModule } from 'ngx-drag-drop';
20
20
  import { RouterModule } from '@angular/router';
21
+ import 'brace';
22
+ import 'brace/theme/monokai';
21
23
 
22
24
  class ValueAccessorBase {
23
25
  constructor() {
@@ -1398,6 +1400,351 @@ InputFileComponent.ɵcmp = ɵɵdefineComponent({ type: InputFileComponent, selec
1398
1400
  type: Output
1399
1401
  }] }); })();
1400
1402
 
1403
+ /* tslint:disable */
1404
+ class AceEditorComponent {
1405
+ constructor(elementRef, zone) {
1406
+ this.zone = zone;
1407
+ this.textChanged = new EventEmitter();
1408
+ this.textChange = new EventEmitter();
1409
+ this.style = {};
1410
+ // @ts-ignore
1411
+ this._options = {};
1412
+ // @ts-ignore
1413
+ this._theme = 'monokai';
1414
+ // @ts-ignore
1415
+ this._mode = 'html';
1416
+ // @ts-ignore
1417
+ this._autoUpdateContent = true;
1418
+ // @ts-ignore
1419
+ this._durationBeforeCallback = 0;
1420
+ // @ts-ignore
1421
+ this._text = '';
1422
+ this._onChange = (_) => {
1423
+ };
1424
+ this._onTouched = () => {
1425
+ };
1426
+ const el = elementRef.nativeElement;
1427
+ this.zone.runOutsideAngular(() => {
1428
+ this._editor = ace['edit'](el);
1429
+ });
1430
+ this._editor.$blockScrolling = Infinity;
1431
+ }
1432
+ ngOnInit() {
1433
+ this.init();
1434
+ this.initEvents();
1435
+ }
1436
+ ngOnDestroy() {
1437
+ this._editor.destroy();
1438
+ }
1439
+ init() {
1440
+ this.setOptions(this._options || {});
1441
+ this.setTheme(this._theme);
1442
+ this.setMode(this._mode);
1443
+ this.setReadOnly(this._readOnly);
1444
+ }
1445
+ initEvents() {
1446
+ this._editor.on('change', () => this.updateText());
1447
+ this._editor.on('paste', () => this.updateText());
1448
+ }
1449
+ updateText() {
1450
+ const newVal = this._editor.getValue();
1451
+ if (newVal === this.oldText) {
1452
+ return;
1453
+ }
1454
+ if (!this._durationBeforeCallback) {
1455
+ this._text = newVal;
1456
+ this.zone.run(() => {
1457
+ this.textChange.emit(newVal);
1458
+ this.textChanged.emit(newVal);
1459
+ });
1460
+ this._onChange(newVal);
1461
+ }
1462
+ else {
1463
+ if (this.timeoutSaving) {
1464
+ clearTimeout(this.timeoutSaving);
1465
+ }
1466
+ this.timeoutSaving = setTimeout(() => {
1467
+ this._text = newVal;
1468
+ this.zone.run(() => {
1469
+ this.textChange.emit(newVal);
1470
+ this.textChanged.emit(newVal);
1471
+ });
1472
+ this.timeoutSaving = null;
1473
+ }, this._durationBeforeCallback);
1474
+ }
1475
+ this.oldText = newVal;
1476
+ }
1477
+ set options(options) {
1478
+ this.setOptions(options);
1479
+ }
1480
+ setOptions(options) {
1481
+ this._options = options;
1482
+ this._editor.setOptions(options || {});
1483
+ }
1484
+ set readOnly(readOnly) {
1485
+ this.setReadOnly(readOnly);
1486
+ }
1487
+ setReadOnly(readOnly) {
1488
+ this._readOnly = readOnly;
1489
+ this._editor.setReadOnly(readOnly);
1490
+ }
1491
+ set theme(theme) {
1492
+ this.setTheme(theme);
1493
+ }
1494
+ setTheme(theme) {
1495
+ this._theme = theme;
1496
+ this._editor.setTheme(`ace/theme/${theme}`);
1497
+ }
1498
+ set mode(mode) {
1499
+ this.setMode(mode);
1500
+ }
1501
+ setMode(mode) {
1502
+ this._mode = mode;
1503
+ if (typeof this._mode === 'object') {
1504
+ this._editor.getSession().setMode(this._mode);
1505
+ }
1506
+ else {
1507
+ this._editor.getSession().setMode(`ace/mode/${this._mode}`);
1508
+ }
1509
+ }
1510
+ // @ts-ignore
1511
+ get value() {
1512
+ return this.text;
1513
+ }
1514
+ // @ts-ignore
1515
+ set value(value) {
1516
+ this.setText(value);
1517
+ }
1518
+ writeValue(value) {
1519
+ this.setText(value);
1520
+ }
1521
+ registerOnChange(fn) {
1522
+ this._onChange = fn;
1523
+ }
1524
+ registerOnTouched(fn) {
1525
+ this._onTouched = fn;
1526
+ }
1527
+ get text() {
1528
+ return this._text;
1529
+ }
1530
+ set text(text) {
1531
+ this.setText(text);
1532
+ }
1533
+ setText(text) {
1534
+ if (text === null || text === undefined) {
1535
+ text = '';
1536
+ }
1537
+ if (this._text !== text && this._autoUpdateContent) {
1538
+ this._text = text;
1539
+ this._editor.setValue(text);
1540
+ this._onChange(text);
1541
+ this._editor.clearSelection();
1542
+ }
1543
+ }
1544
+ set autoUpdateContent(status) {
1545
+ this.setAutoUpdateContent(status);
1546
+ }
1547
+ setAutoUpdateContent(status) {
1548
+ this._autoUpdateContent = status;
1549
+ }
1550
+ set durationBeforeCallback(num) {
1551
+ this.setDurationBeforeCallback(num);
1552
+ }
1553
+ setDurationBeforeCallback(num) {
1554
+ this._durationBeforeCallback = num;
1555
+ }
1556
+ getEditor() {
1557
+ return this._editor;
1558
+ }
1559
+ }
1560
+ AceEditorComponent.ɵfac = function AceEditorComponent_Factory(t) { return new (t || AceEditorComponent)(ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(NgZone)); };
1561
+ AceEditorComponent.ɵcmp = ɵɵ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: [ɵɵProvidersFeature([{
1562
+ provide: NG_VALUE_ACCESSOR,
1563
+ useExisting: forwardRef(() => AceEditorComponent),
1564
+ multi: true
1565
+ }])], decls: 0, vars: 0, template: function AceEditorComponent_Template(rf, ctx) { }, styles: ["[_nghost-%COMP%] { display:block;width:100%; }"] });
1566
+ /*@__PURE__*/ (function () { ɵsetClassMetadata(AceEditorComponent, [{
1567
+ type: Component,
1568
+ args: [{
1569
+ selector: 'ace-editor',
1570
+ template: '',
1571
+ styles: [':host { display:block;width:100%; }'],
1572
+ providers: [{
1573
+ provide: NG_VALUE_ACCESSOR,
1574
+ useExisting: forwardRef(() => AceEditorComponent),
1575
+ multi: true
1576
+ }]
1577
+ }]
1578
+ }], function () { return [{ type: ElementRef }, { type: NgZone }]; }, { textChanged: [{
1579
+ type: Output
1580
+ }], textChange: [{
1581
+ type: Output
1582
+ }], style: [{
1583
+ type: Input
1584
+ }], options: [{
1585
+ type: Input
1586
+ }], readOnly: [{
1587
+ type: Input
1588
+ }], theme: [{
1589
+ type: Input
1590
+ }], mode: [{
1591
+ type: Input
1592
+ }], value: [{
1593
+ type: Input
1594
+ }], text: [{
1595
+ type: Input
1596
+ }], autoUpdateContent: [{
1597
+ type: Input
1598
+ }], durationBeforeCallback: [{
1599
+ type: Input
1600
+ }] }); })();
1601
+
1602
+ /* tslint:disable */
1603
+ class AceEditorDirective {
1604
+ constructor(elementRef, zone) {
1605
+ this.zone = zone;
1606
+ this.textChanged = new EventEmitter();
1607
+ this.textChange = new EventEmitter();
1608
+ this._options = {};
1609
+ this._readOnly = false;
1610
+ this._theme = 'monokai';
1611
+ this._mode = 'html';
1612
+ this._autoUpdateContent = true;
1613
+ this._durationBeforeCallback = 0;
1614
+ this._text = '';
1615
+ const el = elementRef.nativeElement;
1616
+ this.zone.runOutsideAngular(() => {
1617
+ this.editor = ace['edit'](el);
1618
+ });
1619
+ this.editor.$blockScrolling = Infinity;
1620
+ }
1621
+ ngOnInit() {
1622
+ this.init();
1623
+ this.initEvents();
1624
+ }
1625
+ ngOnDestroy() {
1626
+ this.editor.destroy();
1627
+ }
1628
+ init() {
1629
+ this.editor.setOptions(this._options || {});
1630
+ this.editor.setTheme(`ace/theme/${this._theme}`);
1631
+ this.setMode(this._mode);
1632
+ this.editor.setReadOnly(this._readOnly);
1633
+ }
1634
+ initEvents() {
1635
+ this.editor.on('change', () => this.updateText());
1636
+ this.editor.on('paste', () => this.updateText());
1637
+ }
1638
+ updateText() {
1639
+ const newVal = this.editor.getValue();
1640
+ if (newVal === this.oldText) {
1641
+ return;
1642
+ }
1643
+ if (!this._durationBeforeCallback) {
1644
+ this._text = newVal;
1645
+ this.zone.run(() => {
1646
+ this.textChange.emit(newVal);
1647
+ this.textChanged.emit(newVal);
1648
+ });
1649
+ }
1650
+ else {
1651
+ if (this.timeoutSaving != null) {
1652
+ clearTimeout(this.timeoutSaving);
1653
+ }
1654
+ this.timeoutSaving = setTimeout(() => {
1655
+ this._text = newVal;
1656
+ this.zone.run(() => {
1657
+ this.textChange.emit(newVal);
1658
+ this.textChanged.emit(newVal);
1659
+ });
1660
+ this.timeoutSaving = null;
1661
+ }, this._durationBeforeCallback);
1662
+ }
1663
+ this.oldText = newVal;
1664
+ }
1665
+ set options(options) {
1666
+ this._options = options;
1667
+ this.editor.setOptions(options || {});
1668
+ }
1669
+ set readOnly(readOnly) {
1670
+ this._readOnly = readOnly;
1671
+ this.editor.setReadOnly(readOnly);
1672
+ }
1673
+ set theme(theme) {
1674
+ this._theme = theme;
1675
+ this.editor.setTheme(`ace/theme/${theme}`);
1676
+ }
1677
+ set mode(mode) {
1678
+ this.setMode(mode);
1679
+ }
1680
+ setMode(mode) {
1681
+ this._mode = mode;
1682
+ if (typeof this._mode === 'object') {
1683
+ this.editor.getSession().setMode(this._mode);
1684
+ }
1685
+ else {
1686
+ this.editor.getSession().setMode(`ace/mode/${this._mode}`);
1687
+ }
1688
+ }
1689
+ // @ts-ignore
1690
+ get text() {
1691
+ return this._text;
1692
+ }
1693
+ set text(text) {
1694
+ this.setText(text);
1695
+ }
1696
+ setText(text) {
1697
+ if (this._text !== text) {
1698
+ if (text === null || text === undefined) {
1699
+ text = '';
1700
+ }
1701
+ if (this._autoUpdateContent) {
1702
+ this._text = text;
1703
+ this.editor.setValue(text);
1704
+ this.editor.clearSelection();
1705
+ }
1706
+ }
1707
+ }
1708
+ set autoUpdateContent(status) {
1709
+ this._autoUpdateContent = status;
1710
+ }
1711
+ set durationBeforeCallback(num) {
1712
+ this.setDurationBeforeCallback(num);
1713
+ }
1714
+ setDurationBeforeCallback(num) {
1715
+ this._durationBeforeCallback = num;
1716
+ }
1717
+ get aceEditor() {
1718
+ return this.editor;
1719
+ }
1720
+ }
1721
+ AceEditorDirective.ɵfac = function AceEditorDirective_Factory(t) { return new (t || AceEditorDirective)(ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(NgZone)); };
1722
+ AceEditorDirective.ɵdir = ɵɵ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" } });
1723
+ /*@__PURE__*/ (function () { ɵsetClassMetadata(AceEditorDirective, [{
1724
+ type: Directive,
1725
+ args: [{
1726
+ selector: '[ace-editor]'
1727
+ }]
1728
+ }], function () { return [{ type: ElementRef }, { type: NgZone }]; }, { textChanged: [{
1729
+ type: Output
1730
+ }], textChange: [{
1731
+ type: Output
1732
+ }], options: [{
1733
+ type: Input
1734
+ }], readOnly: [{
1735
+ type: Input
1736
+ }], theme: [{
1737
+ type: Input
1738
+ }], mode: [{
1739
+ type: Input
1740
+ }], text: [{
1741
+ type: Input
1742
+ }], autoUpdateContent: [{
1743
+ type: Input
1744
+ }], durationBeforeCallback: [{
1745
+ type: Input
1746
+ }] }); })();
1747
+
1401
1748
  class InputsModule {
1402
1749
  }
1403
1750
  InputsModule.ɵmod = ɵɵdefineNgModule({ type: InputsModule });
@@ -1426,7 +1773,9 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
1426
1773
  InputAvatarComponent,
1427
1774
  InputFileComponent,
1428
1775
  CustomSelectComponent,
1429
- FieldComponent], imports: [RouterModule, CommonModule,
1776
+ FieldComponent,
1777
+ AceEditorComponent,
1778
+ AceEditorDirective], imports: [RouterModule, CommonModule,
1430
1779
  FormsModule,
1431
1780
  MatFormFieldModule,
1432
1781
  MatInputModule,
@@ -1446,7 +1795,9 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
1446
1795
  InputAvatarComponent,
1447
1796
  InputFileComponent,
1448
1797
  CustomSelectComponent,
1449
- FieldComponent] }); })();
1798
+ FieldComponent,
1799
+ AceEditorComponent,
1800
+ AceEditorDirective] }); })();
1450
1801
  /*@__PURE__*/ (function () { ɵsetClassMetadata(InputsModule, [{
1451
1802
  type: NgModule,
1452
1803
  args: [{
@@ -1476,7 +1827,9 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
1476
1827
  InputAvatarComponent,
1477
1828
  InputFileComponent,
1478
1829
  CustomSelectComponent,
1479
- FieldComponent
1830
+ FieldComponent,
1831
+ AceEditorComponent,
1832
+ AceEditorDirective
1480
1833
  ],
1481
1834
  exports: [
1482
1835
  SelectBoxComponent,
@@ -1486,7 +1839,9 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
1486
1839
  InputAvatarComponent,
1487
1840
  InputFileComponent,
1488
1841
  CustomSelectComponent,
1489
- FieldComponent
1842
+ FieldComponent,
1843
+ AceEditorComponent,
1844
+ AceEditorDirective
1490
1845
  ],
1491
1846
  providers: [],
1492
1847
  }]
@@ -1496,5 +1851,5 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
1496
1851
  * Generated bundle index. Do not edit.
1497
1852
  */
1498
1853
 
1499
- export { CustomSelectComponent, CustomSelectItem, FieldComponent, InputAvatarComponent, InputFileComponent, InputPasswordComponent, InputTextComponent, InputsModule, SelectBoxComponent, SelectEnumComponent };
1854
+ export { AceEditorComponent, AceEditorDirective, CustomSelectComponent, CustomSelectItem, FieldComponent, InputAvatarComponent, InputFileComponent, InputPasswordComponent, InputTextComponent, InputsModule, SelectBoxComponent, SelectEnumComponent };
1500
1855
  //# sourceMappingURL=apipass-inputs.js.map