zek 17.3.67 → 17.3.69

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/fesm2022/zek.mjs CHANGED
@@ -26,6 +26,33 @@ class ArrayHelper {
26
26
  static insert(array, index, item) {
27
27
  array.splice(index, 0, item);
28
28
  }
29
+ /**
30
+ * Remove item from array
31
+ * @param array
32
+ * @param item item to remove
33
+ */
34
+ static remove(array, item) {
35
+ const index = array.indexOf(item);
36
+ if (index > -1) { // only splice array when item is found
37
+ array.splice(index, 1); // 2nd parameter means remove one item only
38
+ }
39
+ }
40
+ /**
41
+ * Remove all items from array
42
+ * @param array
43
+ * @param item item to remove
44
+ */
45
+ static removeAll(array, item) {
46
+ var i = 0;
47
+ while (i < array.length) {
48
+ if (array[i] === item) {
49
+ array.splice(i, 1);
50
+ }
51
+ else {
52
+ ++i;
53
+ }
54
+ }
55
+ }
29
56
  static move(array, fromIndex, toIndex) {
30
57
  const item = array[fromIndex];
31
58
  array.splice(fromIndex, 1); //remove item frrom array
@@ -493,9 +520,6 @@ class TimeHelper {
493
520
  }
494
521
 
495
522
  class DateHelper {
496
- static minDate() {
497
- return new Date(0);
498
- }
499
523
  static equals(value1, value2) {
500
524
  const val1 = (value1 === undefined || value1 === null) ? null : value1;
501
525
  const val2 = (value2 === undefined || value2 === null) ? null : value2;
@@ -1958,6 +1982,23 @@ class CustomHttpParamEncoder {
1958
1982
  }
1959
1983
  }
1960
1984
 
1985
+ class FileService extends CrudService {
1986
+ constructor(api, httpErrorHandler) {
1987
+ super('files', api, httpErrorHandler);
1988
+ }
1989
+ download(id, hash) {
1990
+ return this.api.getBlob(`api/${this.controller}`, { id, hash }).pipe(catchError(this.handleError(this.download.name, null)));
1991
+ }
1992
+ presignedUrl(id, hash) {
1993
+ return this.api.get(`api/${this.controller}/${id}/${hash}/presigned-url`).pipe(catchError(this.handleError(this.presignedUrl.name, null)));
1994
+ }
1995
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FileService, deps: [{ token: WebApiClient }, { token: HttpErrorHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
1996
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FileService }); }
1997
+ }
1998
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FileService, decorators: [{
1999
+ type: Injectable
2000
+ }], ctorParameters: () => [{ type: WebApiClient }, { type: HttpErrorHandler }] });
2001
+
1961
2002
  class CoreComponent {
1962
2003
  constructor() {
1963
2004
  this.loading = false;
@@ -2094,7 +2135,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
2094
2135
  type: Output
2095
2136
  }] } });
2096
2137
 
2097
- let uniqueId$6 = 0;
2138
+ let uniqueId$7 = 0;
2098
2139
  class CoreUiComponent extends CoreComponent {
2099
2140
  constructor(_renderer, _elementRef
2100
2141
  //private _changeDetector: ChangeDetectorRef
@@ -2111,7 +2152,7 @@ class CoreUiComponent extends CoreComponent {
2111
2152
  this._onTouched = () => { };
2112
2153
  this.change = new EventEmitter();
2113
2154
  this.changing = new EventEmitter();
2114
- this._name = `zek-${++uniqueId$6}`;
2155
+ this._name = `zek-${++uniqueId$7}`;
2115
2156
  this._isInitialized = false;
2116
2157
  this._value = null;
2117
2158
  this._readonly = false;
@@ -3173,7 +3214,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
3173
3214
  }]
3174
3215
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.Router }] });
3175
3216
 
3176
- let uniqueId$5 = 0;
3217
+ let uniqueId$6 = 0;
3177
3218
  /**
3178
3219
  * Provider Expression that allows bb to register as a ControlValueAccessor. This
3179
3220
  * allows it to support [(ngModel)] and ngControl.
@@ -3187,7 +3228,7 @@ const ZEK_BB_CONTROL_VALUE_ACCESSOR = {
3187
3228
  class ZekButtonBrowse extends CoreUiComponent {
3188
3229
  constructor() {
3189
3230
  super(...arguments);
3190
- this._uniqueId = `zek-bb-${++uniqueId$5}`;
3231
+ this._uniqueId = `zek-bb-${++uniqueId$6}`;
3191
3232
  /** The unique ID for the bb. */
3192
3233
  this.id = this._uniqueId;
3193
3234
  this.filter = {};
@@ -3513,6 +3554,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
3513
3554
  type: Output
3514
3555
  }] } });
3515
3556
 
3557
+ class ZekCallbackPipe {
3558
+ transform(items, callback, filter) {
3559
+ if (!items || !callback) {
3560
+ return items;
3561
+ }
3562
+ return filter
3563
+ ? items.filter(item => callback(item, filter))
3564
+ : items.filter(item => callback(item));
3565
+ }
3566
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ZekCallbackPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3567
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.4", ngImport: i0, type: ZekCallbackPipe, isStandalone: true, name: "callback", pure: false }); }
3568
+ }
3569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ZekCallbackPipe, decorators: [{
3570
+ type: Pipe,
3571
+ args: [{
3572
+ standalone: true,
3573
+ name: 'callback',
3574
+ pure: false //this pure need because we are changing filter model and pure=false is handling
3575
+ }]
3576
+ }] });
3577
+
3516
3578
  class ZekCard {
3517
3579
  /**
3518
3580
  *
@@ -3655,30 +3717,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
3655
3717
  type: Input
3656
3718
  }] } });
3657
3719
 
3658
- class ZekCallbackPipe {
3659
- transform(items, callback, filter) {
3660
- if (!items || !callback) {
3661
- return items;
3662
- }
3663
- return filter
3664
- ? items.filter(item => callback(item, filter))
3665
- : items.filter(item => callback(item));
3666
- }
3667
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ZekCallbackPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3668
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.4", ngImport: i0, type: ZekCallbackPipe, isStandalone: true, name: "callback", pure: false }); }
3669
- }
3670
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ZekCallbackPipe, decorators: [{
3671
- type: Pipe,
3672
- args: [{
3673
- standalone: true,
3674
- name: 'callback',
3675
- pure: false //this pure need because we are changing filter model and pure=false is handling
3676
- }]
3677
- }] });
3678
-
3679
3720
  class ZekDateAgoPipe {
3680
3721
  transform(value, args) {
3681
- if (value === undefined || value === null || value === '' || value !== value)
3722
+ if (typeof value === 'undefined' || value === null || value === '' || value !== value)
3682
3723
  return null;
3683
3724
  const date = DateHelper.toDate(value);
3684
3725
  const seconds = Math.floor((+new Date() - +new Date(date)) / 1000);
@@ -4062,6 +4103,79 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
4062
4103
  }]
4063
4104
  }] });
4064
4105
 
4106
+ let uniqueId$5 = 0;
4107
+ class ZekFileInput extends CoreUiComponent {
4108
+ constructor() {
4109
+ super(...arguments);
4110
+ // @Input() model!: string[] | null;
4111
+ this.onUpload = new EventEmitter();
4112
+ this.fileService = inject(FileService);
4113
+ this._uniqueId = `zek-file-input-${++uniqueId$5}`;
4114
+ /** The unique ID for the tag. */
4115
+ this.id = this._uniqueId;
4116
+ this._accept = '*';
4117
+ this._multiple = false;
4118
+ }
4119
+ get inputId() {
4120
+ return `${this.id || this._uniqueId}-input`;
4121
+ }
4122
+ get accept() {
4123
+ return this._accept;
4124
+ }
4125
+ set accept(v) {
4126
+ if (!v)
4127
+ this._accept = '*';
4128
+ else
4129
+ this._accept = v;
4130
+ }
4131
+ get multiple() {
4132
+ return this._multiple;
4133
+ }
4134
+ set multiple(v) {
4135
+ this._multiple = Convert.toBooleanProperty(v);
4136
+ }
4137
+ // files: File[] | null = null;
4138
+ clickInput() {
4139
+ const el = document.getElementById(this.inputId);
4140
+ if (el) {
4141
+ el.click();
4142
+ }
4143
+ }
4144
+ async onFileInputChange(event) {
4145
+ event.preventDefault();
4146
+ event.stopPropagation();
4147
+ const files = event?.target?.files;
4148
+ if (Array.isArray(!files))
4149
+ return;
4150
+ const formData = new FormData();
4151
+ for (let i = 0; i < files.length; i++) {
4152
+ const file = files[i];
4153
+ formData.append('files', file, file.name);
4154
+ }
4155
+ this.fileService.save(formData).subscribe(data => {
4156
+ if (data?.success) {
4157
+ this.onUpload.emit(data.value);
4158
+ }
4159
+ });
4160
+ }
4161
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ZekFileInput, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
4162
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: ZekFileInput, isStandalone: true, selector: "zek-file-input", inputs: { id: "id", accept: "accept", multiple: "multiple" }, outputs: { onUpload: "onUpload" }, host: { properties: { "attr.id": "id" } }, providers: [FileService], usesInheritance: true, ngImport: i0, template: "<input type=\"file\" class=\"form-control\"\r\n name=\"{{inputId}}\"\r\n id=\"{{inputId}}\"\r\n [multiple]=\"multiple\" [accept]=\"accept\" [required]=\"required\" [disabled]=\"readonly\"\r\n #fileInput\r\n (change)=\"onFileInputChange($event)\" />", styles: [":host input[type=file]{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }] }); }
4163
+ }
4164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ZekFileInput, decorators: [{
4165
+ type: Component,
4166
+ args: [{ standalone: true, imports: [CommonModule, FormsModule], selector: 'zek-file-input', providers: [FileService], host: {
4167
+ '[attr.id]': 'id',
4168
+ }, template: "<input type=\"file\" class=\"form-control\"\r\n name=\"{{inputId}}\"\r\n id=\"{{inputId}}\"\r\n [multiple]=\"multiple\" [accept]=\"accept\" [required]=\"required\" [disabled]=\"readonly\"\r\n #fileInput\r\n (change)=\"onFileInputChange($event)\" />", styles: [":host input[type=file]{display:none}\n"] }]
4169
+ }], propDecorators: { onUpload: [{
4170
+ type: Output
4171
+ }], id: [{
4172
+ type: Input
4173
+ }], accept: [{
4174
+ type: Input
4175
+ }], multiple: [{
4176
+ type: Input
4177
+ }] } });
4178
+
4065
4179
  let uniqueId$4 = 0;
4066
4180
  class ZekModal extends CoreComponent {
4067
4181
  constructor() {
@@ -5124,7 +5238,7 @@ class ZekNumericDirective {
5124
5238
  return this._digits;
5125
5239
  }
5126
5240
  set digits(v) {
5127
- const tmp = MathHelper.clamp(Convert.toNumber(v) || 0, 0, 29);
5241
+ const tmp = MathHelper.clamp(Convert.toNumber(v) ?? 0, 0, 29);
5128
5242
  this._digits = tmp;
5129
5243
  }
5130
5244
  get negative() {
@@ -6739,8 +6853,7 @@ class ZekUtcToLocalPipe {
6739
6853
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ZekUtcToLocalPipe, decorators: [{
6740
6854
  type: Pipe,
6741
6855
  args: [{
6742
- name: 'utcToLocal',
6743
- pure: true
6856
+ name: 'utcToLocal'
6744
6857
  }]
6745
6858
  }], ctorParameters: () => [{ type: i1$2.DatePipe }] });
6746
6859
  class ZekUtcToLocalModule {
@@ -7073,8 +7186,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
7073
7186
  args: [{ standalone: true, selector: 'zek-wizard2', imports: [CommonModule], template: "<div class=\"m-2\">\r\n <button *ngFor=\"let item of stepsArray\"\r\n [class.btn-outline-secondary]=\"item.step >= steps\"\r\n [class.btn-primary]=\"item.step < steps\"\r\n type=\"button\"\r\n class=\"btn btn-sm mr me-2\"></button>\r\n</div>" }]
7074
7187
  }] });
7075
7188
 
7076
- // export * from './'
7077
-
7078
7189
  class WebApiModule {
7079
7190
  static forRoot(config) {
7080
7191
  return {
@@ -7107,5 +7218,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
7107
7218
  * Generated bundle index. Do not edit.
7108
7219
  */
7109
7220
 
7110
- export { API_BASE_URL, AgePipe, Alert, AlertService, ArrayHelper, AuthService, Base64Helper, BaseAlert, BaseComponent, BaseService, BitwiseHelper, BootstrapHelper, CacheHelper, Color, ComponentType, Convert, CoreComponent, CoreUiComponent, CrudService, CssHelper, CustomHttpParamEncoder, DATE_FORMAT, DateHelper, DateValueAccessor, DatepickerModule, EditBase, EditBaseComponent, EditComponent, EditFormComponent, ErrorHelper, ExcelHelper, FileBase, FileBytes, FileHelper, FileString, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, HtmlHelper, HttpErrorHandler, JwtHelper, KeyPair, KeyPairChecked, KeyPairEx, KeyPairRequired, LANGUAGE, ListBase, ListBaseComponent, MATCH_VALIDATOR, MatchValidator, MathHelper, Month, ObjectHelper, OverlapHelper, PagedList, Pager, PagerHelper, PeriodRelation, PrintType, RANGE_VALIDATOR, RECAPTCHA_SITE_KEY, RandomHelper, RangeValidator, ReCaptchaService, RecaptchaModule, StorageHelper, StringHelper, TimeHelper, TimeModule, TimePipe, TimerService, TmpHelper, Toast, Tree, UrlHelper, ValidEventArgs, ValidationHelper, Validators, ValidatorsModule, WebApiClient, WebApiModule, ZekAlert, ZekApproveModal, ZekAutoComplete, ZekButtonBrowse, ZekButtonBrowseModalBase, ZekButtonBrowseModalToolbar, ZekButtonBrowseModule, ZekCallbackPipe, ZekCard, ZekCountdown, ZekDateAgoPipe, ZekDeleteModal, ZekDisapproveModal, ZekEditToolbar, ZekFieldValidator, ZekFileSizePipe, ZekFileViewer, ZekFilterModal, ZekGoogleLoginButton, ZekGoogleLoginModule, ZekGridToolbar, ZekGridToolbarBar, ZekListToolbar, ZekLoading, ZekLoadingModule, ZekLocalToUtcModule, ZekLocalToUtcPipe, ZekModal, ZekModalModule, ZekNumericDirective, ZekPageTitle, ZekPager, ZekPassword, ZekProgress, ZekRadio, ZekReadOnlyDirective, ZekRestoreModal, ZekSafePipe, ZekSelect2, ZekSelect2Multiple, ZekSelectMultiple, ZekSort, ZekSortButtonGroup, ZekSubmitModal, ZekSumModal, ZekTag, ZekToast, ZekTooltip, ZekUtcToLocalModule, ZekUtcToLocalPipe, ZekValidation, ZekWizard, ZekWizard2, firstBy, handler, matchValidator, nullValidator, rangeValidator, zekAuthGuard };
7221
+ export { API_BASE_URL, AgePipe, Alert, AlertService, ArrayHelper, AuthService, Base64Helper, BaseAlert, BaseComponent, BaseService, BitwiseHelper, BootstrapHelper, CacheHelper, Color, ComponentType, Convert, CoreComponent, CoreUiComponent, CrudService, CssHelper, CustomHttpParamEncoder, DATE_FORMAT, DateHelper, DateValueAccessor, DatepickerModule, EditBase, EditBaseComponent, EditComponent, EditFormComponent, ErrorHelper, ExcelHelper, FileBase, FileBytes, FileHelper, FileService, FileString, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, HtmlHelper, HttpErrorHandler, JwtHelper, KeyPair, KeyPairChecked, KeyPairEx, KeyPairRequired, LANGUAGE, ListBase, ListBaseComponent, MATCH_VALIDATOR, MatchValidator, MathHelper, Month, ObjectHelper, OverlapHelper, PagedList, Pager, PagerHelper, PeriodRelation, PrintType, RANGE_VALIDATOR, RECAPTCHA_SITE_KEY, RandomHelper, RangeValidator, ReCaptchaService, RecaptchaModule, StorageHelper, StringHelper, TimeHelper, TimeModule, TimePipe, TimerService, TmpHelper, Toast, Tree, UrlHelper, ValidEventArgs, ValidationHelper, Validators, ValidatorsModule, WebApiClient, WebApiModule, ZekAlert, ZekApproveModal, ZekAutoComplete, ZekButtonBrowse, ZekButtonBrowseModalBase, ZekButtonBrowseModalToolbar, ZekButtonBrowseModule, ZekCallbackPipe, ZekCard, ZekCountdown, ZekDateAgoPipe, ZekDeleteModal, ZekDisapproveModal, ZekEditToolbar, ZekFieldValidator, ZekFileInput, ZekFileSizePipe, ZekFileViewer, ZekFilterModal, ZekGoogleLoginButton, ZekGoogleLoginModule, ZekGridToolbar, ZekGridToolbarBar, ZekListToolbar, ZekLoading, ZekLoadingModule, ZekLocalToUtcModule, ZekLocalToUtcPipe, ZekModal, ZekModalModule, ZekNumericDirective, ZekPageTitle, ZekPager, ZekPassword, ZekProgress, ZekRadio, ZekReadOnlyDirective, ZekRestoreModal, ZekSafePipe, ZekSelect2, ZekSelect2Multiple, ZekSelectMultiple, ZekSort, ZekSortButtonGroup, ZekSubmitModal, ZekSumModal, ZekTag, ZekToast, ZekTooltip, ZekUtcToLocalModule, ZekUtcToLocalPipe, ZekValidation, ZekWizard, ZekWizard2, firstBy, handler, matchValidator, nullValidator, rangeValidator, zekAuthGuard };
7111
7222
  //# sourceMappingURL=zek.mjs.map