ngx-techlify-core 11.3.2 → 11.3.3

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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/dialog'), require('@angular/material/table'), require('@angular/material/sort'), require('@ngneat/until-destroy'), require('@angular/common'), require('@angular/forms'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@angular/material/snack-bar'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/material/form-field'), require('@angular/material/select'), require('@angular/material/icon'), require('@angular/router'), require('@angular/material/tooltip'), require('@angular/material/core'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/input'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/material/card'), require('@angular/material/divider'), require('@angular/material/chips'), require('@angular/material/datepicker'), require('@angular/material/list'), require('@angular/flex-layout'), require('ngx-infinite-scroll'), require('ngx-doc-viewer'), require('ngx-editor'), require('xlsx'), require('@angular/platform-browser'), require('jsondiffpatch')) :
3
- typeof define === 'function' && define.amd ? define('ngx-techlify-core', ['exports', '@angular/core', '@angular/material/dialog', '@angular/material/table', '@angular/material/sort', '@ngneat/until-destroy', '@angular/common', '@angular/forms', '@angular/common/http', 'rxjs', 'rxjs/operators', '@angular/material/snack-bar', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/material/form-field', '@angular/material/select', '@angular/material/icon', '@angular/router', '@angular/material/tooltip', '@angular/material/core', '@angular/material/button', '@angular/material/checkbox', '@angular/material/input', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/material/card', '@angular/material/divider', '@angular/material/chips', '@angular/material/datepicker', '@angular/material/list', '@angular/flex-layout', 'ngx-infinite-scroll', 'ngx-doc-viewer', 'ngx-editor', 'xlsx', '@angular/platform-browser', 'jsondiffpatch'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ngx-techlify-core'] = {}, global.ng.core, global.ng.material.dialog, global.ng.material.table, global.ng.material.sort, global['@ngneat/until-destroy'], global.ng.common, global.ng.forms, global.ng.common.http, global.rxjs, global.rxjs.operators, global.ng.material.snackBar, global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.material.formField, global.ng.material.select, global.ng.material.icon, global.ng.router, global.ng.material.tooltip, global.ng.material.core, global.ng.material.button, global.ng.material.checkbox, global.ng.material.input, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.material.card, global.ng.material.divider, global.ng.material.chips, global.ng.material.datepicker, global.ng.material.list, global.ng.flexLayout, global['ngx-infinite-scroll'], global['ngx-doc-viewer'], global['ngx-editor'], global.xlsx, global.ng.platformBrowser, global.jsondiffpatch));
5
- }(this, (function (exports, i0, dialog, table, sort, untilDestroy, common, forms, i1$1, rxjs, operators, i1, a11y, coercion, formField, select, icon, i1$2, tooltip, core, button, checkbox, input, menu, progressSpinner, card, divider, chips, datepicker, list, flexLayout, ngxInfiniteScroll, ngxDocViewer, ngxEditor, XLSX, platformBrowser, jsondiffpatch) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/dialog'), require('@angular/material/table'), require('@angular/material/sort'), require('@ngneat/until-destroy'), require('@angular/common'), require('@angular/forms'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@angular/material/snack-bar'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/material/form-field'), require('@angular/material/select'), require('@angular/material/icon'), require('@angular/router'), require('@angular/material/tooltip'), require('@angular/material/core'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/input'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/material/card'), require('@angular/material/divider'), require('@angular/material/chips'), require('@angular/material/datepicker'), require('@angular/material/list'), require('@angular/flex-layout'), require('ngx-infinite-scroll'), require('ngx-doc-viewer'), require('ngx-editor'), require('xlsx'), require('@angular/platform-browser'), require('jsondiffpatch'), require('@angular/cdk/keycodes'), require('@angular/material/autocomplete'), require('@angular/material/button-toggle')) :
3
+ typeof define === 'function' && define.amd ? define('ngx-techlify-core', ['exports', '@angular/core', '@angular/material/dialog', '@angular/material/table', '@angular/material/sort', '@ngneat/until-destroy', '@angular/common', '@angular/forms', '@angular/common/http', 'rxjs', 'rxjs/operators', '@angular/material/snack-bar', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/material/form-field', '@angular/material/select', '@angular/material/icon', '@angular/router', '@angular/material/tooltip', '@angular/material/core', '@angular/material/button', '@angular/material/checkbox', '@angular/material/input', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/material/card', '@angular/material/divider', '@angular/material/chips', '@angular/material/datepicker', '@angular/material/list', '@angular/flex-layout', 'ngx-infinite-scroll', 'ngx-doc-viewer', 'ngx-editor', 'xlsx', '@angular/platform-browser', 'jsondiffpatch', '@angular/cdk/keycodes', '@angular/material/autocomplete', '@angular/material/button-toggle'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ngx-techlify-core'] = {}, global.ng.core, global.ng.material.dialog, global.ng.material.table, global.ng.material.sort, global['@ngneat/until-destroy'], global.ng.common, global.ng.forms, global.ng.common.http, global.rxjs, global.rxjs.operators, global.ng.material.snackBar, global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.material.formField, global.ng.material.select, global.ng.material.icon, global.ng.router, global.ng.material.tooltip, global.ng.material.core, global.ng.material.button, global.ng.material.checkbox, global.ng.material.input, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.material.card, global.ng.material.divider, global.ng.material.chips, global.ng.material.datepicker, global.ng.material.list, global.ng.flexLayout, global['ngx-infinite-scroll'], global['ngx-doc-viewer'], global['ngx-editor'], global.xlsx, global.ng.platformBrowser, global.jsondiffpatch, global.ng.cdk.keycodes, global.ng.material.autocomplete, global.ng.material.buttonToggle));
5
+ }(this, (function (exports, i0, dialog, table, sort, untilDestroy, common, forms, i1$1, rxjs, operators, i1, a11y, coercion, formField, select, icon, i1$2, tooltip, core, button, checkbox, input, menu, progressSpinner, card, divider, chips, datepicker, list, flexLayout, ngxInfiniteScroll, ngxDocViewer, ngxEditor, XLSX, platformBrowser, jsondiffpatch, keycodes, autocomplete, buttonToggle) { 'use strict';
6
6
 
7
7
  var ActionPopup = /** @class */ (function () {
8
8
  function ActionPopup() {
@@ -6464,6 +6464,571 @@
6464
6464
  },] }
6465
6465
  ];
6466
6466
 
6467
+ var TechlifyTaggerTagFormConfigModel = /** @class */ (function () {
6468
+ function TechlifyTaggerTagFormConfigModel() {
6469
+ this.selectable = true;
6470
+ this.removable = true;
6471
+ this.separatorKeysCodes = [keycodes.ENTER, keycodes.COMMA];
6472
+ this.placeholder = 'New Tag..';
6473
+ this.apiUrl = 'api/techlify-tagger-tags';
6474
+ this.createApiUrl = 'api/techlify-tagger-tags';
6475
+ this.isCreateable = true;
6476
+ this.isCacheTags = false;
6477
+ this.isSingle = false;
6478
+ }
6479
+ return TechlifyTaggerTagFormConfigModel;
6480
+ }());
6481
+
6482
+ var TechlifyTaggerTagFormFieldComponent_1;
6483
+ exports.TechlifyTaggerTagFormFieldComponent = TechlifyTaggerTagFormFieldComponent_1 = /** @class */ (function () {
6484
+ function TechlifyTaggerTagFormFieldComponent(_focusMonitor, _elementRef, httpService, _formField, ngControl) {
6485
+ var _this = this;
6486
+ this._focusMonitor = _focusMonitor;
6487
+ this._elementRef = _elementRef;
6488
+ this.httpService = httpService;
6489
+ this._formField = _formField;
6490
+ this.ngControl = ngControl;
6491
+ this.stateChanges = new rxjs.Subject();
6492
+ this.focused = false;
6493
+ this.controlType = 'techlify-tagger-form-field';
6494
+ this.id = "techlify-tagger-form-field-" + TechlifyTaggerTagFormFieldComponent_1.nextId++;
6495
+ this.onChange = function (_) { };
6496
+ this.onTouched = function () { };
6497
+ this.tagInputCtrl = new forms.FormControl();
6498
+ /**Pass the configuration for Techlify Tagger */
6499
+ this.config = new TechlifyTaggerTagFormConfigModel();
6500
+ /**Pass the default list of tags */
6501
+ this._allTags = [];
6502
+ /**Pass the Categories to filter for a model */
6503
+ this.categories = [];
6504
+ this._required = false;
6505
+ this._disabled = false;
6506
+ this._value = [];
6507
+ this.tagInputCtrl.valueChanges
6508
+ .subscribe(function (filterValue) {
6509
+ _this.filterString = filterValue;
6510
+ });
6511
+ //Set Focus Monitor
6512
+ _focusMonitor.monitor(_elementRef, true).subscribe(function (origin) {
6513
+ if (_this.focused && !origin) {
6514
+ _this.onTouched();
6515
+ }
6516
+ _this.focused = !!origin;
6517
+ _this.stateChanges.next();
6518
+ });
6519
+ if (this.ngControl != null) {
6520
+ this.ngControl.valueAccessor = this;
6521
+ }
6522
+ }
6523
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "allTags", {
6524
+ get: function () {
6525
+ return this._allTags;
6526
+ },
6527
+ set: function (value) {
6528
+ this._allTags = value;
6529
+ },
6530
+ enumerable: false,
6531
+ configurable: true
6532
+ });
6533
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "tags", {
6534
+ get: function () {
6535
+ var _this = this;
6536
+ return this.allTags.filter(function (x) { return _this.value.some(function (y) { return y == x.id; }); });
6537
+ },
6538
+ enumerable: false,
6539
+ configurable: true
6540
+ });
6541
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "empty", {
6542
+ //Default Getter and Setters for a Form Field Implementation
6543
+ get: function () {
6544
+ return this.value.length == 0;
6545
+ },
6546
+ enumerable: false,
6547
+ configurable: true
6548
+ });
6549
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "shouldLabelFloat", {
6550
+ get: function () {
6551
+ return this.focused || !this.empty || this.tagInputCtrl.value;
6552
+ },
6553
+ enumerable: false,
6554
+ configurable: true
6555
+ });
6556
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "required", {
6557
+ get: function () {
6558
+ return this._required;
6559
+ },
6560
+ set: function (value) {
6561
+ this._required = coercion.coerceBooleanProperty(value);
6562
+ this.stateChanges.next();
6563
+ },
6564
+ enumerable: false,
6565
+ configurable: true
6566
+ });
6567
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "disabled", {
6568
+ get: function () {
6569
+ return this._disabled;
6570
+ },
6571
+ set: function (value) {
6572
+ this._disabled = coercion.coerceBooleanProperty(value);
6573
+ this._disabled ? this.tagInputCtrl.disable() : this.tagInputCtrl.enable();
6574
+ this.stateChanges.next();
6575
+ },
6576
+ enumerable: false,
6577
+ configurable: true
6578
+ });
6579
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "value", {
6580
+ get: function () {
6581
+ return this._value;
6582
+ },
6583
+ set: function (tagIds) {
6584
+ this._value = tagIds || [];
6585
+ this.stateChanges.next();
6586
+ },
6587
+ enumerable: false,
6588
+ configurable: true
6589
+ });
6590
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "errorState", {
6591
+ get: function () {
6592
+ return this.tagInputCtrl.dirty && this.required && (this.value.length == 0);
6593
+ },
6594
+ enumerable: false,
6595
+ configurable: true
6596
+ });
6597
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "placeholder", {
6598
+ get: function () {
6599
+ return this._placeholder;
6600
+ },
6601
+ set: function (value) {
6602
+ this._placeholder = value;
6603
+ this.stateChanges.next();
6604
+ },
6605
+ enumerable: false,
6606
+ configurable: true
6607
+ });
6608
+ TechlifyTaggerTagFormFieldComponent.prototype.ngOnInit = function () {
6609
+ };
6610
+ TechlifyTaggerTagFormFieldComponent.prototype.ngOnChanges = function (changes) {
6611
+ var _this = this;
6612
+ //API to load all tags for the model type
6613
+ if (this.allTags.length == 0) {
6614
+ this.httpService
6615
+ .cache(!this.config.isCacheTags)
6616
+ .get(this.config.apiUrl, {
6617
+ params: {
6618
+ categories: this.categories.join(','),
6619
+ perPage: '1000'
6620
+ }
6621
+ }).pipe(operators.debounceTime(500), untilDestroy.untilDestroyed(this)).subscribe(function (result) {
6622
+ _this.allTags = result.data;
6623
+ });
6624
+ }
6625
+ //API to load only the selected tags for the model
6626
+ if (this.modelId && this.value.length == 0) {
6627
+ //Model Id is passed and no tags are present, so we query db for the avilable tags for the model ID.
6628
+ this.httpService
6629
+ .cache(!this.config.isCacheTags)
6630
+ .get(this.config.apiUrl, {
6631
+ params: {
6632
+ categories: this.categories.join(','),
6633
+ model_type: this.modelType,
6634
+ model_id: this.modelId,
6635
+ perPage: '1000'
6636
+ }
6637
+ }).pipe(operators.debounceTime(500), untilDestroy.untilDestroyed(this)).subscribe(function (result) {
6638
+ _this.value = ((result === null || result === void 0 ? void 0 : result.data) || []).map(function (x) { return x.id; });
6639
+ _this._handleInput();
6640
+ });
6641
+ }
6642
+ };
6643
+ TechlifyTaggerTagFormFieldComponent.prototype.init = function () {
6644
+ var _this = this;
6645
+ if (this.modelId && this.allTags.length == 0) {
6646
+ //Model Id is passed and no tags are passed, so we query db for the avilable tags for the model ID.
6647
+ this.httpService
6648
+ .cache(!this.config.isCacheTags)
6649
+ .get(this.config.apiUrl, {
6650
+ params: {
6651
+ categories: this.categories.join(','),
6652
+ model_type: this.modelType,
6653
+ model_id: this.modelId
6654
+ }
6655
+ }).pipe(untilDestroy.untilDestroyed(this)).subscribe(function (result) {
6656
+ _this.allTags = result.data;
6657
+ });
6658
+ }
6659
+ };
6660
+ Object.defineProperty(TechlifyTaggerTagFormFieldComponent.prototype, "filteredTags", {
6661
+ get: function () {
6662
+ return this._filter();
6663
+ },
6664
+ enumerable: false,
6665
+ configurable: true
6666
+ });
6667
+ TechlifyTaggerTagFormFieldComponent.prototype.setDescribedByIds = function (ids) {
6668
+ // Just a empty implementation for Mat Form Field Interface
6669
+ };
6670
+ TechlifyTaggerTagFormFieldComponent.prototype.onContainerClick = function () {
6671
+ // Just a empty implementation for Mat Form Field Interface
6672
+ };
6673
+ TechlifyTaggerTagFormFieldComponent.prototype.add = function (event) {
6674
+ return __awaiter(this, void 0, void 0, function () {
6675
+ var value, tags, tag, result, error_1;
6676
+ return __generator(this, function (_a) {
6677
+ switch (_a.label) {
6678
+ case 0:
6679
+ value = (event.value || '').trim();
6680
+ if (!(!this.config.isSingle || (this.value.length === 0))) return [3 /*break*/, 7];
6681
+ if (!(value && this.config.isCreateable)) return [3 /*break*/, 7];
6682
+ tags = this.allTags;
6683
+ tag = tags.find(function (item) { return item.title.toLowerCase() == value.toLowerCase(); });
6684
+ if (!!tag) return [3 /*break*/, 5];
6685
+ _a.label = 1;
6686
+ case 1:
6687
+ _a.trys.push([1, 3, , 4]);
6688
+ return [4 /*yield*/, this.httpService.post(this.config.createApiUrl, {
6689
+ title: value,
6690
+ description: value,
6691
+ category_title: (this.categories.length > 0) ? (this.defaultCreateCategory ? this.defaultCreateCategory : this.categories[0]) : ''
6692
+ }).toPromise()];
6693
+ case 2:
6694
+ result = _a.sent();
6695
+ tag = result.item;
6696
+ return [3 /*break*/, 4];
6697
+ case 3:
6698
+ error_1 = _a.sent();
6699
+ return [2 /*return*/];
6700
+ case 4:
6701
+ this.allTags.push(tag);
6702
+ return [3 /*break*/, 6];
6703
+ case 5:
6704
+ //Optionally clean the existing value, to avoid duplicate
6705
+ this.remove(tag);
6706
+ _a.label = 6;
6707
+ case 6:
6708
+ this.value.push(tag.id);
6709
+ this._handleInput();
6710
+ _a.label = 7;
6711
+ case 7:
6712
+ // Clear the input value
6713
+ event.input.value = '';
6714
+ this.tagInputCtrl.setValue(null);
6715
+ return [2 /*return*/];
6716
+ }
6717
+ });
6718
+ });
6719
+ };
6720
+ TechlifyTaggerTagFormFieldComponent.prototype.remove = function (tag) {
6721
+ this.value = this.value.filter(function (x) { return x !== tag.id; });
6722
+ this._handleInput();
6723
+ };
6724
+ TechlifyTaggerTagFormFieldComponent.prototype.selected = function (event) {
6725
+ // Validate for single mode
6726
+ if (!this.config.isSingle || (this.value.length === 0)) {
6727
+ //Clean the existing value, to avoid duplicate
6728
+ this.remove({ id: event.option.value });
6729
+ this.value.push(event.option.value);
6730
+ this._handleInput();
6731
+ }
6732
+ this.tagInput.nativeElement.value = '';
6733
+ this.tagInputCtrl.setValue(null);
6734
+ };
6735
+ TechlifyTaggerTagFormFieldComponent.prototype._filter = function () {
6736
+ var _this = this;
6737
+ var filterValue = this.filterString ? this.filterString.toString().toLowerCase() : null;
6738
+ var availableTags = this.allTags.filter(function (tag) { return !_this.value.some(function (item) { return item == tag.id; }); });
6739
+ return filterValue ? availableTags.filter(function (tag) { return tag.title.toLowerCase().includes(filterValue); }) : availableTags;
6740
+ };
6741
+ TechlifyTaggerTagFormFieldComponent.prototype.writeValue = function (tagIds) {
6742
+ this.value = tagIds || [];
6743
+ };
6744
+ TechlifyTaggerTagFormFieldComponent.prototype.registerOnChange = function (fn) {
6745
+ this.onChange = fn;
6746
+ };
6747
+ TechlifyTaggerTagFormFieldComponent.prototype.registerOnTouched = function (fn) {
6748
+ this.onTouched = fn;
6749
+ };
6750
+ TechlifyTaggerTagFormFieldComponent.prototype.setDisabledState = function (isDisabled) {
6751
+ this.disabled = isDisabled;
6752
+ };
6753
+ TechlifyTaggerTagFormFieldComponent.prototype._handleInput = function () {
6754
+ this.onChange(this.value);
6755
+ };
6756
+ TechlifyTaggerTagFormFieldComponent.prototype.ngOnDestroy = function () {
6757
+ this.stateChanges.complete();
6758
+ this._focusMonitor.stopMonitoring(this._elementRef);
6759
+ };
6760
+ return TechlifyTaggerTagFormFieldComponent;
6761
+ }());
6762
+ exports.TechlifyTaggerTagFormFieldComponent.nextId = 0;
6763
+ exports.TechlifyTaggerTagFormFieldComponent.decorators = [
6764
+ { type: i0.Component, args: [{
6765
+ selector: 'app-techlify-tagger-tag-form-field',
6766
+ template: "<mat-chip-list #chipList aria-label=\"Tag Selection\">\n <mat-chip *ngFor=\"let tag of tags\" [selectable]=\"config.selectable\" [removable]=\"config.removable\"\n (removed)=\"remove(tag)\">\n {{tag.title}}\n <button matChipRemove *ngIf=\"config.removable\" class=\"border-0\">\n <mat-icon class=\"mat-relative-icon\">cancel</mat-icon>\n </button>\n </mat-chip>\n <input placeholder=\"{{config.isCreateable? config.placeholder:''}}\" #tagInput [formControl]=\"tagInputCtrl\"\n [matAutocomplete]=\"auto\" [matChipInputFor]=\"chipList\"\n [matChipInputSeparatorKeyCodes]=\"config.separatorKeysCodes\" (matChipInputTokenEnd)=\"add($event)\"\n #trigger=\"matAutocompleteTrigger\" (click)=\"trigger.openPanel()\">\n</mat-chip-list>\n<mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let tag of filteredTags\" [value]=\"tag.id\">\n {{tag.title}}\n </mat-option>\n</mat-autocomplete>",
6767
+ providers: [{ provide: formField.MatFormFieldControl, useExisting: TechlifyTaggerTagFormFieldComponent_1 }],
6768
+ styles: [".mat-relative-icon{font-size:20px;position:relative;right:7px;top:-3px}"]
6769
+ },] }
6770
+ ];
6771
+ exports.TechlifyTaggerTagFormFieldComponent.ctorParameters = function () { return [
6772
+ { type: a11y.FocusMonitor },
6773
+ { type: i0.ElementRef },
6774
+ { type: HttpService },
6775
+ { type: formField.MatFormField, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [formField.MAT_FORM_FIELD,] }] },
6776
+ { type: forms.NgControl, decorators: [{ type: i0.Optional }, { type: i0.Self }] }
6777
+ ]; };
6778
+ exports.TechlifyTaggerTagFormFieldComponent.propDecorators = {
6779
+ tagInput: [{ type: i0.ViewChild, args: ['tagInput',] }],
6780
+ config: [{ type: i0.Input }],
6781
+ modelType: [{ type: i0.Input }],
6782
+ modelId: [{ type: i0.Input }],
6783
+ allTags: [{ type: i0.Input }],
6784
+ categories: [{ type: i0.Input }],
6785
+ defaultCreateCategory: [{ type: i0.Input }],
6786
+ required: [{ type: i0.Input }],
6787
+ disabled: [{ type: i0.Input }],
6788
+ value: [{ type: i0.Input }],
6789
+ placeholder: [{ type: i0.Input }]
6790
+ };
6791
+ exports.TechlifyTaggerTagFormFieldComponent = TechlifyTaggerTagFormFieldComponent_1 = __decorate([
6792
+ untilDestroy.UntilDestroy()
6793
+ ], exports.TechlifyTaggerTagFormFieldComponent);
6794
+
6795
+ var TechlifyTaggerTagFormFieldModule = /** @class */ (function () {
6796
+ function TechlifyTaggerTagFormFieldModule() {
6797
+ }
6798
+ return TechlifyTaggerTagFormFieldModule;
6799
+ }());
6800
+ TechlifyTaggerTagFormFieldModule.decorators = [
6801
+ { type: i0.NgModule, args: [{
6802
+ declarations: [
6803
+ exports.TechlifyTaggerTagFormFieldComponent
6804
+ ],
6805
+ imports: [
6806
+ common.CommonModule,
6807
+ MaterialModule,
6808
+ flexLayout.FlexLayoutModule,
6809
+ autocomplete.MatAutocompleteModule,
6810
+ forms.ReactiveFormsModule
6811
+ ],
6812
+ exports: [exports.TechlifyTaggerTagFormFieldComponent]
6813
+ },] }
6814
+ ];
6815
+
6816
+ var TechlifyTaggerTagSelectorComponent_1;
6817
+ exports.TechlifyTaggerTagSelectorComponent = TechlifyTaggerTagSelectorComponent_1 = /** @class */ (function () {
6818
+ function TechlifyTaggerTagSelectorComponent(_focusMonitor, _elementRef, httpService, _formField, ngControl) {
6819
+ var _this = this;
6820
+ this._focusMonitor = _focusMonitor;
6821
+ this._elementRef = _elementRef;
6822
+ this.httpService = httpService;
6823
+ this._formField = _formField;
6824
+ this.ngControl = ngControl;
6825
+ /**Pass the Categories to filter for a model */
6826
+ this.categories = [];
6827
+ this.multiple = false;
6828
+ this.enableSearch = true;
6829
+ this.tagSelectorCtrl = new forms.FormControl();
6830
+ this.showAllTags = false;
6831
+ this.useSelectButtonStyle = false;
6832
+ this.tags = [];
6833
+ this.stateChanges = new rxjs.Subject();
6834
+ this.focused = false;
6835
+ this.controlType = 'techlify-tagger-selector';
6836
+ this.id = "techlify-tagger-selector-" + TechlifyTaggerTagSelectorComponent_1.nextId++;
6837
+ this.onChange = function (_) { };
6838
+ this.onTouched = function () { };
6839
+ this._required = false;
6840
+ this._disabled = false;
6841
+ //Set Focus Monitor
6842
+ _focusMonitor.monitor(_elementRef, true).subscribe(function (origin) {
6843
+ if (_this.focused && !origin) {
6844
+ _this.onTouched();
6845
+ }
6846
+ _this.focused = !!origin;
6847
+ _this.stateChanges.next();
6848
+ });
6849
+ if (this.ngControl != null) {
6850
+ this.ngControl.valueAccessor = this;
6851
+ }
6852
+ }
6853
+ Object.defineProperty(TechlifyTaggerTagSelectorComponent.prototype, "apiUrl", {
6854
+ get: function () {
6855
+ var _a;
6856
+ if (this.showAllTags) {
6857
+ return 'api/techlify-tagger-tags';
6858
+ }
6859
+ else if (((_a = this.categories) === null || _a === void 0 ? void 0 : _a.length) > 0) {
6860
+ return 'api/techlify-tagger-tags?categories=' + this.categories.join(',');
6861
+ }
6862
+ else {
6863
+ return '';
6864
+ }
6865
+ },
6866
+ enumerable: false,
6867
+ configurable: true
6868
+ });
6869
+ Object.defineProperty(TechlifyTaggerTagSelectorComponent.prototype, "empty", {
6870
+ //Default Getter and Setters for a Form Field Implementation
6871
+ get: function () {
6872
+ return this.value.length == 0;
6873
+ },
6874
+ enumerable: false,
6875
+ configurable: true
6876
+ });
6877
+ Object.defineProperty(TechlifyTaggerTagSelectorComponent.prototype, "shouldLabelFloat", {
6878
+ get: function () {
6879
+ return this.focused || !this.empty;
6880
+ },
6881
+ enumerable: false,
6882
+ configurable: true
6883
+ });
6884
+ Object.defineProperty(TechlifyTaggerTagSelectorComponent.prototype, "required", {
6885
+ get: function () {
6886
+ return this._required;
6887
+ },
6888
+ set: function (value) {
6889
+ this._required = coercion.coerceBooleanProperty(value);
6890
+ this.stateChanges.next();
6891
+ },
6892
+ enumerable: false,
6893
+ configurable: true
6894
+ });
6895
+ Object.defineProperty(TechlifyTaggerTagSelectorComponent.prototype, "disabled", {
6896
+ get: function () {
6897
+ return this._disabled;
6898
+ },
6899
+ set: function (value) {
6900
+ this._disabled = coercion.coerceBooleanProperty(value);
6901
+ this._disabled ? this.tagSelectorCtrl.disable() : this.tagSelectorCtrl.enable();
6902
+ this.stateChanges.next();
6903
+ },
6904
+ enumerable: false,
6905
+ configurable: true
6906
+ });
6907
+ Object.defineProperty(TechlifyTaggerTagSelectorComponent.prototype, "value", {
6908
+ get: function () {
6909
+ return this._value;
6910
+ },
6911
+ set: function (val) {
6912
+ this._value = val;
6913
+ this.tagSelectorCtrl.setValue(val);
6914
+ this.stateChanges.next();
6915
+ },
6916
+ enumerable: false,
6917
+ configurable: true
6918
+ });
6919
+ Object.defineProperty(TechlifyTaggerTagSelectorComponent.prototype, "errorState", {
6920
+ get: function () {
6921
+ return this.tagSelectorCtrl.dirty && this.required && (this.value.length == 0);
6922
+ },
6923
+ enumerable: false,
6924
+ configurable: true
6925
+ });
6926
+ Object.defineProperty(TechlifyTaggerTagSelectorComponent.prototype, "placeholder", {
6927
+ get: function () {
6928
+ return this._placeholder;
6929
+ },
6930
+ set: function (value) {
6931
+ this._placeholder = value;
6932
+ this.stateChanges.next();
6933
+ },
6934
+ enumerable: false,
6935
+ configurable: true
6936
+ });
6937
+ TechlifyTaggerTagSelectorComponent.prototype.ngOnInit = function () {
6938
+ var _this = this;
6939
+ if (this.useSelectButtonStyle) {
6940
+ this.httpService.get(this.apiUrl)
6941
+ .pipe(untilDestroy.untilDestroyed(this))
6942
+ .subscribe(function (res) {
6943
+ _this.tags = res.data;
6944
+ });
6945
+ }
6946
+ };
6947
+ TechlifyTaggerTagSelectorComponent.prototype.selectionChange = function (value) {
6948
+ this.value = value;
6949
+ this._handleInput();
6950
+ };
6951
+ TechlifyTaggerTagSelectorComponent.prototype.setDescribedByIds = function (ids) {
6952
+ // Just a empty implementation for Mat Form Field Interface
6953
+ };
6954
+ TechlifyTaggerTagSelectorComponent.prototype.onContainerClick = function () {
6955
+ // Just a empty implementation for Mat Form Field Interface
6956
+ };
6957
+ TechlifyTaggerTagSelectorComponent.prototype.writeValue = function (val) {
6958
+ this.value = val;
6959
+ };
6960
+ TechlifyTaggerTagSelectorComponent.prototype.registerOnChange = function (fn) {
6961
+ this.onChange = fn;
6962
+ };
6963
+ TechlifyTaggerTagSelectorComponent.prototype.registerOnTouched = function (fn) {
6964
+ this.onTouched = fn;
6965
+ };
6966
+ TechlifyTaggerTagSelectorComponent.prototype.setDisabledState = function (isDisabled) {
6967
+ this.disabled = isDisabled;
6968
+ };
6969
+ TechlifyTaggerTagSelectorComponent.prototype._handleInput = function () {
6970
+ this.onChange(this.value);
6971
+ };
6972
+ TechlifyTaggerTagSelectorComponent.prototype.ngOnDestroy = function () {
6973
+ this.stateChanges.complete();
6974
+ this._focusMonitor.stopMonitoring(this._elementRef);
6975
+ };
6976
+ return TechlifyTaggerTagSelectorComponent;
6977
+ }());
6978
+ exports.TechlifyTaggerTagSelectorComponent.nextId = 0;
6979
+ exports.TechlifyTaggerTagSelectorComponent.decorators = [
6980
+ { type: i0.Component, args: [{
6981
+ selector: 'app-techlify-tagger-tag-selector',
6982
+ template: "<app-searchable-selector *ngIf=\"apiUrl && !useSelectButtonStyle\" [formControl]=\"tagSelectorCtrl\" [apiUrl]=\"apiUrl\"\n [enableSearch]=\"enableSearch\" [multiple]=\"multiple\" (selectionChange)=\"selectionChange($event)\">\n</app-searchable-selector>\n\n<mat-button-toggle-group *ngIf=\"apiUrl && useSelectButtonStyle\" [formControl]=\"tagSelectorCtrl\" [multiple]=\"multiple\"\n (change)=\"selectionChange($event.value)\">\n <mat-button-toggle *ngFor=\"let tag of tags\" [value]=\"tag.id\">{{tag.title}}</mat-button-toggle>\n</mat-button-toggle-group>",
6983
+ providers: [{ provide: formField.MatFormFieldControl, useExisting: TechlifyTaggerTagSelectorComponent_1 }],
6984
+ styles: [""]
6985
+ },] }
6986
+ ];
6987
+ exports.TechlifyTaggerTagSelectorComponent.ctorParameters = function () { return [
6988
+ { type: a11y.FocusMonitor },
6989
+ { type: i0.ElementRef },
6990
+ { type: HttpService },
6991
+ { type: formField.MatFormField, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [formField.MAT_FORM_FIELD,] }] },
6992
+ { type: forms.NgControl, decorators: [{ type: i0.Optional }, { type: i0.Self }] }
6993
+ ]; };
6994
+ exports.TechlifyTaggerTagSelectorComponent.propDecorators = {
6995
+ categories: [{ type: i0.Input }],
6996
+ multiple: [{ type: i0.Input }],
6997
+ enableSearch: [{ type: i0.Input }],
6998
+ showAllTags: [{ type: i0.Input }],
6999
+ useSelectButtonStyle: [{ type: i0.Input }],
7000
+ required: [{ type: i0.Input }],
7001
+ disabled: [{ type: i0.Input }],
7002
+ value: [{ type: i0.Input }],
7003
+ placeholder: [{ type: i0.Input }]
7004
+ };
7005
+ exports.TechlifyTaggerTagSelectorComponent = TechlifyTaggerTagSelectorComponent_1 = __decorate([
7006
+ untilDestroy.UntilDestroy()
7007
+ ], exports.TechlifyTaggerTagSelectorComponent);
7008
+
7009
+ var TechlifyTaggerTagSelectorModule = /** @class */ (function () {
7010
+ function TechlifyTaggerTagSelectorModule() {
7011
+ }
7012
+ return TechlifyTaggerTagSelectorModule;
7013
+ }());
7014
+ TechlifyTaggerTagSelectorModule.decorators = [
7015
+ { type: i0.NgModule, args: [{
7016
+ declarations: [
7017
+ exports.TechlifyTaggerTagSelectorComponent
7018
+ ],
7019
+ imports: [
7020
+ common.CommonModule,
7021
+ MaterialModule,
7022
+ flexLayout.FlexLayoutModule,
7023
+ autocomplete.MatAutocompleteModule,
7024
+ forms.ReactiveFormsModule,
7025
+ SearchableSelectorModule,
7026
+ buttonToggle.MatButtonToggleModule
7027
+ ],
7028
+ exports: [exports.TechlifyTaggerTagSelectorComponent]
7029
+ },] }
7030
+ ];
7031
+
6467
7032
  /*
6468
7033
  * Public API Surface of ngx-techlify-core
6469
7034
  */
@@ -6575,6 +7140,9 @@
6575
7140
  exports.StorageService = StorageService;
6576
7141
  exports.SuccessSnackComponent = SuccessSnackComponent;
6577
7142
  exports.TechlifyConfig = TechlifyConfig;
7143
+ exports.TechlifyTaggerTagFormConfigModel = TechlifyTaggerTagFormConfigModel;
7144
+ exports.TechlifyTaggerTagFormFieldModule = TechlifyTaggerTagFormFieldModule;
7145
+ exports.TechlifyTaggerTagSelectorModule = TechlifyTaggerTagSelectorModule;
6578
7146
  exports.TechlifyUpdateHistoryModule = TechlifyUpdateHistoryModule;
6579
7147
  exports.TechlifyUpdateModule = TechlifyUpdateModule;
6580
7148
  exports.Timeline = Timeline;