@acorex/components 4.2.45 → 4.2.50

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.
@@ -10255,16 +10255,19 @@ class AXSearchBarComponent {
10255
10255
  this._items = [];
10256
10256
  this._filterItems = [];
10257
10257
  this._filterItemsClone = [];
10258
+ this._defultValueCount = [];
10258
10259
  this._context = {};
10259
10260
  }
10260
10261
  set items(v) {
10262
+ this._defultValueCount = v.filter((x) => x.value);
10261
10263
  v.forEach((el) => {
10262
10264
  if (el.value != null) {
10263
10265
  this._filterItems.push({
10264
10266
  name: el.property.name,
10265
10267
  title: el.property.title,
10266
- textValue: this.handleTextValue(el),
10267
- value: el.value,
10268
+ field: el.property.field,
10269
+ textValue: this._handleTextValue(el),
10270
+ value: el.value ? this._handleDefultVlaue(el) : null,
10268
10271
  component: el
10269
10272
  });
10270
10273
  }
@@ -10284,52 +10287,7 @@ class AXSearchBarComponent {
10284
10287
  this.dropdown.toggle();
10285
10288
  }
10286
10289
  async handleValueChange(e) {
10287
- let value = [];
10288
- let text = [];
10289
- if (e.property.editorOptions?.valueField && e.value != null) {
10290
- if (e.property.editorOptions.returnAllData) {
10291
- value = e.value;
10292
- text = await this.handleTextValue(e);
10293
- }
10294
- else if (e.property.editorOptions?.mode == 'multiple') {
10295
- e.value.forEach((element) => {
10296
- value.push(element[e.property.editorOptions.valueField]);
10297
- text.push(element[e.property.editorOptions.textField]);
10298
- });
10299
- }
10300
- else {
10301
- if (e.value.length) {
10302
- value = e.value[0][e.property.editorOptions.valueField];
10303
- text = e.value[0][e.property.editorOptions.textField];
10304
- }
10305
- }
10306
- }
10307
- else {
10308
- value = e.value;
10309
- text = e.value;
10310
- }
10311
- const findEl = this._filterItemsClone.find((el) => el.name == e.property.name);
10312
- if (findEl) {
10313
- findEl.value = value;
10314
- findEl.textValue = text ? text.toString() : null;
10315
- }
10316
- else if (e.value != null) {
10317
- this._filterItemsClone.push({
10318
- name: e.property.name,
10319
- title: e.property.title,
10320
- value,
10321
- textValue: text.toString(),
10322
- component: e,
10323
- filterOptions: {
10324
- filters: e.property?.filterOptions?.filters ? e.property.filterOptions.filters : [],
10325
- logic: e.property?.filterOptions?.logic ? e.property.filterOptions.logic : 'and',
10326
- ignoreCase: e.property?.filterOptions?.ignoreCase ? e.property.filterOptions.ignoreCase : true,
10327
- joinType: e.property?.filterOptions?.joinType ? e.property.filterOptions.joinType : 'INNER',
10328
- operator: e.property?.filterOptions?.operator ? e.property.filterOptions.operator : null,
10329
- truncateDate: e.property?.filterOptions?.truncateDate ? e.property.filterOptions.truncateDate : true
10330
- }
10331
- });
10332
- }
10290
+ await this._handleInitVlaue(e);
10333
10291
  this.onValueChange.emit(e);
10334
10292
  }
10335
10293
  handleItemRemoveClick(item) {
@@ -10345,7 +10303,6 @@ class AXSearchBarComponent {
10345
10303
  if (c.result) {
10346
10304
  this._filterItems = JSON.parse(JSON.stringify(this._filterItemsClone.filter((el) => el.value != null && el.value != '')));
10347
10305
  this.handleButtonClick();
10348
- console.log(this._filterItems);
10349
10306
  this.onSearchValue.emit(this._filterItems);
10350
10307
  }
10351
10308
  });
@@ -10382,43 +10339,109 @@ class AXSearchBarComponent {
10382
10339
  }
10383
10340
  }
10384
10341
  }
10385
- return className.toString().replace(/,/, ' ');
10342
+ return className.toString().replace(/,/g, ' ');
10386
10343
  }
10387
10344
  _handleShowTitleSelected(item) {
10388
- if (item.component.property.editorClass !== 'ax/editors/check') {
10345
+ if (item.title) {
10389
10346
  return item.title + ':';
10390
10347
  }
10391
10348
  }
10392
10349
  _handleShowValueSelected(item) {
10393
10350
  if (item.component.property.editorClass === 'ax/editors/check') {
10394
- return item.title;
10351
+ return item.component.property.editorOptions.label;
10395
10352
  }
10396
10353
  else {
10397
10354
  return item.textValue;
10398
10355
  }
10399
10356
  }
10400
10357
  ngOnInit() { }
10401
- handleTextValue(dataItem) {
10402
- if (dataItem.value.length) {
10403
- let text = '';
10404
- dataItem.value.forEach((element, index) => {
10405
- text +=
10406
- index === dataItem.value.length - 1
10407
- ? element[dataItem.property.editorOptions.textField]
10408
- : element[dataItem.property.editorOptions.textField] + ',';
10409
- });
10358
+ _handleTextValue(dataItem) {
10359
+ let text = '';
10360
+ if (Array.isArray(dataItem.value)) {
10361
+ if (dataItem.value.length) {
10362
+ dataItem.value.forEach((element, index) => {
10363
+ text +=
10364
+ index === dataItem.value.length - 1
10365
+ ? element[dataItem.property.editorOptions.textField]
10366
+ : element[dataItem.property.editorOptions.textField] + ',';
10367
+ });
10368
+ }
10410
10369
  return text;
10411
10370
  }
10371
+ else if (dataItem.property.editorClass === 'ax/editors/date') {
10372
+ if (dataItem.value) {
10373
+ return new AXDateTime(dataItem.value, 'jalali').format('yyyy/MM/DD');
10374
+ }
10375
+ else {
10376
+ return;
10377
+ }
10378
+ }
10412
10379
  else {
10413
10380
  return;
10414
10381
  }
10415
10382
  }
10383
+ async _handleDefultVlaue(dataItem) {
10384
+ this._handleInitVlaue(dataItem);
10385
+ this._filterItems = JSON.parse(JSON.stringify(this._filterItemsClone.filter((el) => el.value != null && el.value != '')));
10386
+ if (this._filterItems.length === this._defultValueCount.length) {
10387
+ this.onSearchValue.emit(this._filterItems);
10388
+ }
10389
+ }
10390
+ async _handleInitVlaue(e) {
10391
+ let value = [];
10392
+ let text = [];
10393
+ if (e.property.editorOptions?.valueField && e.value != null) {
10394
+ if (e.property.editorOptions.returnAllData) {
10395
+ value = e.value;
10396
+ text = await this._handleTextValue(e);
10397
+ }
10398
+ else if (e.property.editorOptions?.mode == 'multiple') {
10399
+ e.value.forEach((element) => {
10400
+ value.push(element[e.property.editorOptions.valueField]);
10401
+ text.push(element[e.property.editorOptions.textField]);
10402
+ });
10403
+ }
10404
+ else {
10405
+ if (e.value.length) {
10406
+ value = e.value[0][e.property.editorOptions.valueField];
10407
+ text = e.value[0][e.property.editorOptions.textField];
10408
+ }
10409
+ }
10410
+ }
10411
+ else {
10412
+ value = e.value;
10413
+ text = e.value;
10414
+ }
10415
+ const findEl = this._filterItemsClone.find((el) => el.name == e.property.name);
10416
+ if (findEl) {
10417
+ findEl.value = value;
10418
+ findEl.textValue = e.property.editorClass === 'ax/editors/date' ? new AXDateTime(text, 'jalali').format('yyyy/MM/DD') : text.toString();
10419
+ }
10420
+ else if (e.value != null) {
10421
+ this._filterItemsClone.push({
10422
+ name: e.property.name,
10423
+ field: e.property.field,
10424
+ title: e.property.title,
10425
+ value,
10426
+ textValue: e.property.editorClass === 'ax/editors/date' ? new AXDateTime(text, 'jalali').format('yyyy/MM/DD') : text.toString(),
10427
+ component: e,
10428
+ filterOptions: {
10429
+ filters: e.property?.filterOptions?.filters ? e.property.filterOptions.filters : [],
10430
+ logic: e.property?.filterOptions?.logic ? e.property.filterOptions.logic : 'and',
10431
+ ignoreCase: e.property?.filterOptions?.ignoreCase ? e.property.filterOptions.ignoreCase : true,
10432
+ joinType: e.property?.filterOptions?.joinType ? e.property.filterOptions.joinType : 'INNER',
10433
+ operator: e.property?.filterOptions?.operator ? e.property.filterOptions.operator : null,
10434
+ truncateDate: e.property?.filterOptions?.truncateDate ? e.property.filterOptions.truncateDate : true
10435
+ }
10436
+ });
10437
+ }
10438
+ }
10416
10439
  }
10417
10440
  AXSearchBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSearchBarComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
10418
- AXSearchBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXSearchBarComponent, selector: "ax-search-bar", inputs: { size: "size", disabled: "disabled", items: "items", rtl: "rtl" }, outputs: { onValueChange: "onValueChange", onSearchValue: "onSearchValue" }, viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true, static: true }, { propertyName: "form", first: true, predicate: AXValidationFormComponent, descendants: true }, { propertyName: "_editors", predicate: AXPropertyEditorRendererDirective, descendants: true }], ngImport: i0, template: "<ax-drop-down [fitParent]=\"true\" [size]=\"size\" [showDropDownButton]=\"false\" icon=\"far fa-sliders-h\" #dropdown\r\n maxHeight=\"unset\">\r\n <ng-container start>\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </ng-container>\r\n <ng-container header>\r\n <div class=\"ax chips-container\">\r\n <div class=\"chips\" *ngFor=\"let item of _filterItems\">\r\n <span class=\"chips-text\" style=\"direction:rtl;\">\r\n <b>{{_handleShowTitleSelected(item)}}</b> {{_handleShowValueSelected(item)}}\r\n </span>\r\n <span class=\"close-icon\" (click)=\"handleItemRemoveClick(item)\">\r\n <i class=\"far fa-times close\"></i>\r\n </span>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container panel>\r\n <div class=\"panel-box\">\r\n <ax-validation-form #form>\r\n <div *ngFor=\"let item of _items\" class=\"row\">\r\n <div *ngFor=\"let prop of item.items\" class=\"{{renderCol(prop.property.col)}}\">\r\n <!-- <ax-form-group> -->\r\n <div *ngIf=\"prop.property.visible != false\">\r\n <ax-label>{{prop.property.title}}</ax-label>\r\n <ng-container ax-property-editor-renderer [validationForm]=\"form\" [property]=\"prop\"\r\n [context]=\"_context\" (onValueChange)=\"handleValueChange($event)\"></ng-container>\r\n </div>\r\n <!-- </ax-form-group> -->\r\n </div>\r\n </div>\r\n <div class=\"footer-button\">\r\n <ax-button (click)=\"search()\">{{'common.search' | trans}}</ax-button>\r\n <ax-button type=\"blank danger\" (click)=\"clear()\">{{'dataGrid.clearFilter' | trans}}</ax-button>\r\n </div>\r\n </ax-validation-form>\r\n </div>\r\n </ng-container>\r\n <ng-container end>\r\n <ax-button end icon=\"far fa-sliders-h icon\" type=\"light blank\" [disabled]=\"disabled\" [size]=\"size\"\r\n [tabIndex]=\"-1\" (click)=\"handleButtonClick()\">{{'common.search' | trans}}</ax-button>\r\n </ng-container>\r\n\r\n</ax-drop-down>", styles: [".ax.chips-container{height:100%}.panel-box{padding:1rem}.panel-box .footer-button{margin-top:1rem;display:flex;align-items:center;gap:.5rem}\n"], components: [{ type: AXDropdownComponent, selector: "ax-drop-down", inputs: ["rtl", "readonly", "loading"], outputs: ["dropdownToggle", "onButtonClick"] }, { type: AXValidationFormComponent, selector: "ax-validation-form", inputs: ["validateOn"], outputs: ["onInit"] }, { type: AXLabelComponent, selector: "ax-label", inputs: ["size"] }, { type: AXButtonComponent, selector: "ax-button", inputs: ["type", "icon", "submitBehavior", "cancelBehavior", "block", "loading", "selected"] }], directives: [{ type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: AXPropertyEditorRendererDirective, selector: "[ax-property-editor-renderer]", inputs: ["property", "validationForm", "context", "host", "groupId"], outputs: ["onValueChange"] }], pipes: { "trans": i1$2.AXTranslatorPipe } });
10441
+ AXSearchBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXSearchBarComponent, selector: "ax-search-bar", inputs: { size: "size", disabled: "disabled", items: "items", rtl: "rtl" }, outputs: { onValueChange: "onValueChange", onSearchValue: "onSearchValue" }, viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true, static: true }, { propertyName: "form", first: true, predicate: AXValidationFormComponent, descendants: true }, { propertyName: "_editors", predicate: AXPropertyEditorRendererDirective, descendants: true }], ngImport: i0, template: "<ax-drop-down [fitParent]=\"true\" [size]=\"size\" [showDropDownButton]=\"false\" icon=\"far fa-sliders-h\" #dropdown\r\n maxHeight=\"unset\">\r\n <ng-container start>\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </ng-container>\r\n <ng-container header>\r\n <div class=\"ax chips-container\">\r\n <div class=\"chips\" *ngFor=\"let item of _filterItems\">\r\n <span class=\"chips-text\" style=\"direction:rtl;\">\r\n <b>{{_handleShowTitleSelected(item)}}</b> {{_handleShowValueSelected(item)}}\r\n </span>\r\n <span class=\"close-icon\" (click)=\"handleItemRemoveClick(item)\">\r\n </span>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container panel>\r\n <div class=\"panel-box\">\r\n <ax-validation-form #form>\r\n <div *ngFor=\"let item of _items\" class=\"row\">\r\n <div *ngFor=\"let prop of item.items\" class=\"{{renderCol(prop.property.col)}}\">\r\n <!-- <ax-form-group> -->\r\n <div *ngIf=\"prop.property.visible != false\">\r\n <ax-label>{{prop.property.title}}</ax-label>\r\n <ng-container ax-property-editor-renderer [validationForm]=\"form\" [property]=\"prop\"\r\n [context]=\"_context\" (onValueChange)=\"handleValueChange($event)\"></ng-container>\r\n </div>\r\n <!-- </ax-form-group> -->\r\n </div>\r\n </div>\r\n <div class=\"footer-button\">\r\n <ax-button (click)=\"search()\">{{'common.search' | trans}}</ax-button>\r\n <ax-button type=\"blank danger\" (click)=\"clear()\">{{'dataGrid.clearFilter' | trans}}</ax-button>\r\n </div>\r\n </ax-validation-form>\r\n </div>\r\n </ng-container>\r\n <ng-container end>\r\n <ax-button end icon=\"far fa-sliders-h icon\" type=\"light blank\" [disabled]=\"disabled\" [size]=\"size\"\r\n [tabIndex]=\"-1\" (click)=\"handleButtonClick()\">{{'common.search' | trans}}</ax-button>\r\n </ng-container>\r\n\r\n</ax-drop-down>", styles: [".ax.chips-container{height:100%}.panel-box{padding:1rem}.panel-box .footer-button{margin-top:1rem;display:flex;align-items:center;gap:.5rem}\n"], components: [{ type: AXDropdownComponent, selector: "ax-drop-down", inputs: ["rtl", "readonly", "loading"], outputs: ["dropdownToggle", "onButtonClick"] }, { type: AXValidationFormComponent, selector: "ax-validation-form", inputs: ["validateOn"], outputs: ["onInit"] }, { type: AXLabelComponent, selector: "ax-label", inputs: ["size"] }, { type: AXButtonComponent, selector: "ax-button", inputs: ["type", "icon", "submitBehavior", "cancelBehavior", "block", "loading", "selected"] }], directives: [{ type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: AXPropertyEditorRendererDirective, selector: "[ax-property-editor-renderer]", inputs: ["property", "validationForm", "context", "host", "groupId"], outputs: ["onValueChange"] }], pipes: { "trans": i1$2.AXTranslatorPipe } });
10419
10442
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSearchBarComponent, decorators: [{
10420
10443
  type: Component,
10421
- args: [{ selector: 'ax-search-bar', template: "<ax-drop-down [fitParent]=\"true\" [size]=\"size\" [showDropDownButton]=\"false\" icon=\"far fa-sliders-h\" #dropdown\r\n maxHeight=\"unset\">\r\n <ng-container start>\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </ng-container>\r\n <ng-container header>\r\n <div class=\"ax chips-container\">\r\n <div class=\"chips\" *ngFor=\"let item of _filterItems\">\r\n <span class=\"chips-text\" style=\"direction:rtl;\">\r\n <b>{{_handleShowTitleSelected(item)}}</b> {{_handleShowValueSelected(item)}}\r\n </span>\r\n <span class=\"close-icon\" (click)=\"handleItemRemoveClick(item)\">\r\n <i class=\"far fa-times close\"></i>\r\n </span>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container panel>\r\n <div class=\"panel-box\">\r\n <ax-validation-form #form>\r\n <div *ngFor=\"let item of _items\" class=\"row\">\r\n <div *ngFor=\"let prop of item.items\" class=\"{{renderCol(prop.property.col)}}\">\r\n <!-- <ax-form-group> -->\r\n <div *ngIf=\"prop.property.visible != false\">\r\n <ax-label>{{prop.property.title}}</ax-label>\r\n <ng-container ax-property-editor-renderer [validationForm]=\"form\" [property]=\"prop\"\r\n [context]=\"_context\" (onValueChange)=\"handleValueChange($event)\"></ng-container>\r\n </div>\r\n <!-- </ax-form-group> -->\r\n </div>\r\n </div>\r\n <div class=\"footer-button\">\r\n <ax-button (click)=\"search()\">{{'common.search' | trans}}</ax-button>\r\n <ax-button type=\"blank danger\" (click)=\"clear()\">{{'dataGrid.clearFilter' | trans}}</ax-button>\r\n </div>\r\n </ax-validation-form>\r\n </div>\r\n </ng-container>\r\n <ng-container end>\r\n <ax-button end icon=\"far fa-sliders-h icon\" type=\"light blank\" [disabled]=\"disabled\" [size]=\"size\"\r\n [tabIndex]=\"-1\" (click)=\"handleButtonClick()\">{{'common.search' | trans}}</ax-button>\r\n </ng-container>\r\n\r\n</ax-drop-down>", styles: [".ax.chips-container{height:100%}.panel-box{padding:1rem}.panel-box .footer-button{margin-top:1rem;display:flex;align-items:center;gap:.5rem}\n"] }]
10444
+ args: [{ selector: 'ax-search-bar', template: "<ax-drop-down [fitParent]=\"true\" [size]=\"size\" [showDropDownButton]=\"false\" icon=\"far fa-sliders-h\" #dropdown\r\n maxHeight=\"unset\">\r\n <ng-container start>\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </ng-container>\r\n <ng-container header>\r\n <div class=\"ax chips-container\">\r\n <div class=\"chips\" *ngFor=\"let item of _filterItems\">\r\n <span class=\"chips-text\" style=\"direction:rtl;\">\r\n <b>{{_handleShowTitleSelected(item)}}</b> {{_handleShowValueSelected(item)}}\r\n </span>\r\n <span class=\"close-icon\" (click)=\"handleItemRemoveClick(item)\">\r\n </span>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container panel>\r\n <div class=\"panel-box\">\r\n <ax-validation-form #form>\r\n <div *ngFor=\"let item of _items\" class=\"row\">\r\n <div *ngFor=\"let prop of item.items\" class=\"{{renderCol(prop.property.col)}}\">\r\n <!-- <ax-form-group> -->\r\n <div *ngIf=\"prop.property.visible != false\">\r\n <ax-label>{{prop.property.title}}</ax-label>\r\n <ng-container ax-property-editor-renderer [validationForm]=\"form\" [property]=\"prop\"\r\n [context]=\"_context\" (onValueChange)=\"handleValueChange($event)\"></ng-container>\r\n </div>\r\n <!-- </ax-form-group> -->\r\n </div>\r\n </div>\r\n <div class=\"footer-button\">\r\n <ax-button (click)=\"search()\">{{'common.search' | trans}}</ax-button>\r\n <ax-button type=\"blank danger\" (click)=\"clear()\">{{'dataGrid.clearFilter' | trans}}</ax-button>\r\n </div>\r\n </ax-validation-form>\r\n </div>\r\n </ng-container>\r\n <ng-container end>\r\n <ax-button end icon=\"far fa-sliders-h icon\" type=\"light blank\" [disabled]=\"disabled\" [size]=\"size\"\r\n [tabIndex]=\"-1\" (click)=\"handleButtonClick()\">{{'common.search' | trans}}</ax-button>\r\n </ng-container>\r\n\r\n</ax-drop-down>", styles: [".ax.chips-container{height:100%}.panel-box{padding:1rem}.panel-box .footer-button{margin-top:1rem;display:flex;align-items:center;gap:.5rem}\n"] }]
10422
10445
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { dropdown: [{
10423
10446
  type: ViewChild,
10424
10447
  args: ['dropdown', { static: true }]