zek 19.0.1 → 19.0.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.
package/fesm2022/zek.mjs CHANGED
@@ -1808,19 +1808,25 @@ class CrudService extends BaseService {
1808
1808
  return this.api.delete(`api/${this.controller}/${id}/${id2}`).pipe(catchError(this.handleError(this.delete2.name, null)));
1809
1809
  }
1810
1810
  restore(id) {
1811
- return this.api.patch(`api/${this.controller}/${id}/Restore`).pipe(catchError(this.handleError(this.restore.name, null)));
1811
+ return this.api.patch(`api/${this.controller}/${id}/restore`).pipe(catchError(this.handleError(this.restore.name, null)));
1812
1812
  }
1813
- approve(model) {
1814
- return this.api.patch(`api/${this.controller}/Approve`, model).pipe(catchError(this.handleError(this.approve.name, null)));
1813
+ approve(id, model) {
1814
+ return this.api.patch(`api/${this.controller}/${id}/approve`, model).pipe(catchError(this.handleError(this.approve.name, null)));
1815
1815
  }
1816
- disapprove(model) {
1817
- return this.api.patch(`api/${this.controller}/Disapprove`, model).pipe(catchError(this.handleError(this.disapprove.name, null)));
1816
+ bulkApprove(model) {
1817
+ return this.api.patch(`api/${this.controller}/bulk-approve`, model).pipe(catchError(this.handleError(this.bulkApprove.name, null)));
1818
+ }
1819
+ disapprove(id, model) {
1820
+ return this.api.patch(`api/${this.controller}/${id}/disapprove`, model).pipe(catchError(this.handleError(this.disapprove.name, null)));
1821
+ }
1822
+ bulkDisapprove(model) {
1823
+ return this.api.patch(`api/${this.controller}/bulk-disapprove`, model).pipe(catchError(this.handleError(this.bulkDisapprove.name, null)));
1818
1824
  }
1819
1825
  batch(model) {
1820
- return this.api.post(`api/${this.controller}/Batch`, model).pipe(catchError(this.handleError(this.batch.name, null)));
1826
+ return this.api.post(`api/${this.controller}/batch`, model).pipe(catchError(this.handleError(this.batch.name, null)));
1821
1827
  }
1822
1828
  export(model, fileTypeId) {
1823
- return this.api.getBlob(`api/${this.controller}/Export/${fileTypeId}`, model).pipe(catchError(this.handleError('export', null)));
1829
+ return this.api.getBlob(`api/${this.controller}/export/${fileTypeId}`, model).pipe(catchError(this.handleError('export', null)));
1824
1830
  }
1825
1831
  }
1826
1832
 
@@ -2582,7 +2588,6 @@ class EditFormComponent extends BaseComponent {
2582
2588
  }
2583
2589
  async approve() {
2584
2590
  if (this.id) {
2585
- this.approveModel.ids = [this.id];
2586
2591
  const approved = await this.internalApprove(this.approveModel);
2587
2592
  if (approved) {
2588
2593
  this.load();
@@ -2667,7 +2672,7 @@ class EditBaseComponent extends EditFormComponent {
2667
2672
  }
2668
2673
  }
2669
2674
  async internalApprove(model) {
2670
- const data = await firstValueFrom(this.service.approve(model));
2675
+ const data = await firstValueFrom(this.service.approve(this.id, model));
2671
2676
  if (data && data.length > 0) {
2672
2677
  const message = await firstValueFrom(this.translate.get('Alert.Approved'));
2673
2678
  this.alert.success(message, null, 'fa-solid fa-floppy-disk');
@@ -2680,7 +2685,7 @@ class EditBaseComponent extends EditFormComponent {
2680
2685
  }
2681
2686
  }
2682
2687
  async internalDisapprove(model) {
2683
- const data = await firstValueFrom(this.service.disapprove(model));
2688
+ const data = await firstValueFrom(this.service.disapprove(this.id, model));
2684
2689
  if (data && data.length > 0) {
2685
2690
  const message = await firstValueFrom(this.translate.get('Alert.Disapproved'));
2686
2691
  this.alert.success(message, null, 'fa-solid fa-floppy-disk');
@@ -2693,7 +2698,7 @@ class EditBaseComponent extends EditFormComponent {
2693
2698
  }
2694
2699
  }
2695
2700
  async internalSubmit(model) {
2696
- const data = await firstValueFrom(this.service.approve(model));
2701
+ const data = await firstValueFrom(this.service.approve(this.id, model));
2697
2702
  if (data && data.length > 0) {
2698
2703
  const message = await firstValueFrom(this.translate.get('Alert.Submitted'));
2699
2704
  this.alert.success(message, null, 'fa-solid fa-floppy-disk');
@@ -4225,6 +4230,205 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
4225
4230
  }]
4226
4231
  }] });
4227
4232
 
4233
+ const ZEK_DROPDOWN_CONTROL_VALUE_ACCESSOR = {
4234
+ provide: NG_VALUE_ACCESSOR,
4235
+ useExisting: forwardRef(() => ZekDropdown),
4236
+ multi: true,
4237
+ };
4238
+ class ZekDropdown extends CoreUiComponent {
4239
+ constructor(renderer, elementRef) {
4240
+ super(renderer, elementRef);
4241
+ }
4242
+ _uniqueId = `zek-dropdown-${this.uniqueId}`;
4243
+ /** The unique ID for the radio button. */
4244
+ id = this._uniqueId;
4245
+ get inputId() {
4246
+ return `${this.id || this._uniqueId}-input`;
4247
+ }
4248
+ _multiple = false;
4249
+ get multiple() {
4250
+ return this._multiple;
4251
+ }
4252
+ set multiple(value) {
4253
+ this._multiple = Convert.toBooleanProperty(value);
4254
+ }
4255
+ valueField;
4256
+ textField;
4257
+ checkedTextField;
4258
+ css = 'primary';
4259
+ searchText = '';
4260
+ get label() {
4261
+ return this._label;
4262
+ }
4263
+ set label(value) {
4264
+ if (value)
4265
+ this._label = value;
4266
+ else
4267
+ this._label = '';
4268
+ }
4269
+ _label = '';
4270
+ _data = [];
4271
+ get data() {
4272
+ return this._data;
4273
+ }
4274
+ set data(value) {
4275
+ if (this._data !== value) {
4276
+ this._data = value ? value : [];
4277
+ this._onDataChanged();
4278
+ }
4279
+ }
4280
+ _onDataChanged() {
4281
+ this._normalizeData();
4282
+ this._filterData();
4283
+ }
4284
+ normalizedItems = [];
4285
+ filteredItems = [];
4286
+ selectedItems = [];
4287
+ selectedItemsText = '';
4288
+ onTextChange() {
4289
+ this._filterData();
4290
+ }
4291
+ _filterData() {
4292
+ if (this.searchText) {
4293
+ const normalized = StringHelper.trimStart(this.searchText.toUpperCase(), ' ');
4294
+ this.filteredItems = this.normalizedItems.filter(item => item.normalized.indexOf(normalized) !== -1);
4295
+ }
4296
+ else {
4297
+ this.filteredItems = this.normalizedItems;
4298
+ }
4299
+ }
4300
+ _normalizeData() {
4301
+ this.normalizedItems = [];
4302
+ if (this.valueField && this.textField) {
4303
+ for (const item of this._data) {
4304
+ this.normalizedItems.push({
4305
+ key: item[this.valueField],
4306
+ value: item[this.textField],
4307
+ normalized: (item[this.textField] || '').toUpperCase(),
4308
+ checked: this.selectedItems.includes(item),
4309
+ item: item
4310
+ });
4311
+ }
4312
+ }
4313
+ else {
4314
+ for (const item of this._data) {
4315
+ this.normalizedItems.push({ key: item, value: item, checked: this.selectedItems.includes(item), item });
4316
+ }
4317
+ }
4318
+ }
4319
+ checkAll(checked, ngModelChange = true) {
4320
+ if (this.disabled || this.readonly)
4321
+ return;
4322
+ for (const item of this.normalizedItems) {
4323
+ item.checked = checked;
4324
+ }
4325
+ this.selectedItems = [];
4326
+ if (checked) {
4327
+ if (this.multiple) {
4328
+ const tmp = [];
4329
+ for (const normalized of this.normalizedItems) {
4330
+ this.selectedItems.push(normalized.item);
4331
+ tmp.push(normalized.key);
4332
+ }
4333
+ if (ngModelChange)
4334
+ this.setNgModel(tmp);
4335
+ }
4336
+ }
4337
+ else if (ngModelChange)
4338
+ this.setNgModel(null);
4339
+ }
4340
+ toggleChecked(normalized) {
4341
+ if (!normalized || this.disabled || this.readonly)
4342
+ return;
4343
+ const checked = normalized.checked || false;
4344
+ if (!this.multiple) {
4345
+ for (const item of this.normalizedItems) {
4346
+ item.checked = false;
4347
+ }
4348
+ }
4349
+ //on check item
4350
+ if (!checked) {
4351
+ normalized.checked = true;
4352
+ if (this.multiple) {
4353
+ if (!this.selectedItems.includes(normalized.item)) {
4354
+ this.selectedItems.push(normalized.item);
4355
+ }
4356
+ //todo optimize
4357
+ const tmp = [];
4358
+ for (const item of this.normalizedItems) {
4359
+ if (item.checked) {
4360
+ tmp.push(item.key);
4361
+ }
4362
+ }
4363
+ this.setNgModel(tmp);
4364
+ }
4365
+ else {
4366
+ this.selectedItems = [normalized.item];
4367
+ this.setNgModel(normalized.key);
4368
+ }
4369
+ }
4370
+ else {
4371
+ //on uncheck
4372
+ normalized.checked = false;
4373
+ if (this.multiple) {
4374
+ const index = this.selectedItems.indexOf(normalized.item);
4375
+ if (index !== -1) {
4376
+ this.selectedItems.splice(index, 1);
4377
+ }
4378
+ //todo optimize
4379
+ const tmp = [];
4380
+ for (const item of this.normalizedItems) {
4381
+ if (item.checked) {
4382
+ tmp.push(item.key);
4383
+ }
4384
+ }
4385
+ this.setNgModel(tmp);
4386
+ }
4387
+ else {
4388
+ this.selectedItems = [];
4389
+ this.setNgModel(null);
4390
+ }
4391
+ }
4392
+ this._initText();
4393
+ }
4394
+ _initText() {
4395
+ const field = this.checkedTextField || this.textField || '';
4396
+ if (field) {
4397
+ this.selectedItemsText = this.selectedItems.map(x => x[field]).join(', ');
4398
+ }
4399
+ else {
4400
+ this.selectedItemsText = this.selectedItems.join(', ');
4401
+ }
4402
+ }
4403
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekDropdown, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4404
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ZekDropdown, isStandalone: true, selector: "zek-dropdown,[zek-dropdown]", inputs: { id: "id", multiple: "multiple", valueField: "valueField", textField: "textField", checkedTextField: "checkedTextField", css: "css", label: "label", data: "data" }, host: { properties: { "attr.id": "id" } }, providers: [ZEK_DROPDOWN_CONTROL_VALUE_ACCESSOR], usesInheritance: true, ngImport: i0, template: "<div class=\"btn-group\" id=\"dropdown-{{id}}\">\r\n <button class=\"btn btn-{{css}} dropdown-toggle\" type=\"button\" data-bs-toggle=\"dropdown\" data-bs-auto-close=\"outside\" aria-expanded=\"false\">\r\n <!-- <ng-container *ngIf=\"!_text\">{{placeholder}}</ng-container> {{_text}} -->\r\n {{label}}\r\n </button>\r\n <ul class=\"dropdown-menu dropdown-menu-scrollable\">\r\n <li class=\"px-2 py-1\">\r\n <input type=\"text\" class=\"form-control\"\r\n [id]=\"inputId\"\r\n [name]=\"inputId\"\r\n [(ngModel)]=\"searchText\"\r\n (ngModelChange)=\"onTextChange()\">\r\n </li>\r\n <ng-container *ngIf=\"normalizedItems\">\r\n <li>\r\n <a class=\"dropdown-item\" href=\"javascript:void(0)\" *ngFor=\"let item of filteredItems\" (click)=\"toggleChecked(item)\">\r\n <span *ngIf=\"item.checked\"><i class=\"fa-regular fa-square-check\"></i></span>\r\n <span *ngIf=\"!item.checked\"><i class=\"fa-regular fa-square\"></i></span>\r\n {{item.value}}\r\n </a>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n</div>", styles: [":host{display:inline-block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
4405
+ }
4406
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekDropdown, decorators: [{
4407
+ type: Component,
4408
+ args: [{ standalone: true, selector: 'zek-dropdown,[zek-dropdown]', providers: [ZEK_DROPDOWN_CONTROL_VALUE_ACCESSOR], host: {
4409
+ '[attr.id]': 'id',
4410
+ }, imports: [
4411
+ CommonModule,
4412
+ FormsModule
4413
+ ], template: "<div class=\"btn-group\" id=\"dropdown-{{id}}\">\r\n <button class=\"btn btn-{{css}} dropdown-toggle\" type=\"button\" data-bs-toggle=\"dropdown\" data-bs-auto-close=\"outside\" aria-expanded=\"false\">\r\n <!-- <ng-container *ngIf=\"!_text\">{{placeholder}}</ng-container> {{_text}} -->\r\n {{label}}\r\n </button>\r\n <ul class=\"dropdown-menu dropdown-menu-scrollable\">\r\n <li class=\"px-2 py-1\">\r\n <input type=\"text\" class=\"form-control\"\r\n [id]=\"inputId\"\r\n [name]=\"inputId\"\r\n [(ngModel)]=\"searchText\"\r\n (ngModelChange)=\"onTextChange()\">\r\n </li>\r\n <ng-container *ngIf=\"normalizedItems\">\r\n <li>\r\n <a class=\"dropdown-item\" href=\"javascript:void(0)\" *ngFor=\"let item of filteredItems\" (click)=\"toggleChecked(item)\">\r\n <span *ngIf=\"item.checked\"><i class=\"fa-regular fa-square-check\"></i></span>\r\n <span *ngIf=\"!item.checked\"><i class=\"fa-regular fa-square\"></i></span>\r\n {{item.value}}\r\n </a>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n</div>", styles: [":host{display:inline-block}\n"] }]
4414
+ }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }], propDecorators: { id: [{
4415
+ type: Input
4416
+ }], multiple: [{
4417
+ type: Input
4418
+ }], valueField: [{
4419
+ type: Input
4420
+ }], textField: [{
4421
+ type: Input
4422
+ }], checkedTextField: [{
4423
+ type: Input
4424
+ }], css: [{
4425
+ type: Input
4426
+ }], label: [{
4427
+ type: Input
4428
+ }], data: [{
4429
+ type: Input
4430
+ }] } });
4431
+
4228
4432
  class ZekEditToolbar {
4229
4433
  _showSave = true;
4230
4434
  get showSave() {
@@ -7532,5 +7736,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
7532
7736
  * Generated bundle index. Do not edit.
7533
7737
  */
7534
7738
 
7535
- 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, FileHelper, FileService, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, HtmlHelper, HttpErrorHandler, IntervalHelper, 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, ZekDelayedInputDirective, 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 };
7739
+ 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, FileHelper, FileService, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, HtmlHelper, HttpErrorHandler, IntervalHelper, 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, ZekDelayedInputDirective, ZekDeleteModal, ZekDisapproveModal, ZekDropdown, 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 };
7536
7740
  //# sourceMappingURL=zek.mjs.map