imm-element-ui 2.7.0 → 2.7.2

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.
@@ -15,7 +15,7 @@ import * as i2 from '@angular/cdk/platform';
15
15
  import * as i3 from 'primeng/config';
16
16
  import { PrimeNG } from 'primeng/config';
17
17
  import * as i1$3 from '@angular/common';
18
- import { DatePipe, NgTemplateOutlet, DOCUMENT, isPlatformBrowser, AsyncPipe, CommonModule, PlatformLocation } from '@angular/common';
18
+ import { DatePipe, NgTemplateOutlet, DOCUMENT, isPlatformBrowser, NgStyle, AsyncPipe, CommonModule, PlatformLocation } from '@angular/common';
19
19
  import * as i2$2 from '@angular/forms';
20
20
  import { FormControl, ReactiveFormsModule, FormGroup, FormsModule, Validators, NG_VALUE_ACCESSOR } from '@angular/forms';
21
21
  import { ContextMenu } from 'primeng/contextmenu';
@@ -6580,6 +6580,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
6580
6580
  ` }]
6581
6581
  }] });
6582
6582
 
6583
+ class CellEditTextareaComponent {
6584
+ constructor() {
6585
+ this.textareaStyle = {};
6586
+ }
6587
+ agInit(params) {
6588
+ this.params = params;
6589
+ this.value = params.value;
6590
+ this.setEditorSize(params);
6591
+ }
6592
+ getValue() {
6593
+ return this.value;
6594
+ }
6595
+ ngAfterViewInit() {
6596
+ this.syncRowHeight();
6597
+ }
6598
+ syncRowHeight() {
6599
+ requestAnimationFrame(() => {
6600
+ const textarea = this.textareaRef?.nativeElement;
6601
+ if (!textarea || !this.params?.node || !this.params?.api) {
6602
+ return;
6603
+ }
6604
+ const themeRowHeight = this.params.api.getSizesForCurrentTheme().rowHeight || 40;
6605
+ const textareaHeight = Math.ceil(textarea.getBoundingClientRect().height);
6606
+ const rowHeight = Math.max(themeRowHeight, textareaHeight);
6607
+ this.params.node.setRowHeight(rowHeight);
6608
+ this.params.api.onRowHeightChanged();
6609
+ });
6610
+ }
6611
+ setEditorSize(params) {
6612
+ const cellWidth = params.column.getActualWidth();
6613
+ this.textareaStyle = {
6614
+ border: 'none',
6615
+ boxShadow: 'none',
6616
+ width: `${cellWidth}px`,
6617
+ lineHeight: 'normal',
6618
+ padding: '4px',
6619
+ background: 'var(--ag-background-color)',
6620
+ ...(this.params.style || {}),
6621
+ };
6622
+ }
6623
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CellEditTextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6624
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: CellEditTextareaComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "textareaRef", first: true, predicate: ["textareaRef"], descendants: true, read: ElementRef }], ngImport: i0, template: `
6625
+ <textarea
6626
+ #textareaRef
6627
+ pTextarea
6628
+ [(ngModel)]="value"
6629
+ [rows]="params.rows || 1"
6630
+ [cols]="params.cols"
6631
+ [maxlength]="params.maxlength || null"
6632
+ [placeholder]="params.placeholder"
6633
+ [readonly]="params.readonly"
6634
+ [disabled]="params.disabled"
6635
+ [autoResize]="params.autoResize"
6636
+ [variant]="params.variant"
6637
+ [fluid]="params.fluid ?? true"
6638
+ [pSize]="params.size"
6639
+ [class]="params.class"
6640
+ [ngStyle]="textareaStyle"
6641
+ (input)="syncRowHeight()"></textarea>
6642
+ `, isInline: true, styles: [":host{display:flex;width:100%;height:100%}textarea{resize:none}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$2.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$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i2$3.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }] }); }
6643
+ }
6644
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CellEditTextareaComponent, decorators: [{
6645
+ type: Component,
6646
+ args: [{ standalone: true, imports: [FormsModule, NgStyle, TextareaModule], template: `
6647
+ <textarea
6648
+ #textareaRef
6649
+ pTextarea
6650
+ [(ngModel)]="value"
6651
+ [rows]="params.rows || 1"
6652
+ [cols]="params.cols"
6653
+ [maxlength]="params.maxlength || null"
6654
+ [placeholder]="params.placeholder"
6655
+ [readonly]="params.readonly"
6656
+ [disabled]="params.disabled"
6657
+ [autoResize]="params.autoResize"
6658
+ [variant]="params.variant"
6659
+ [fluid]="params.fluid ?? true"
6660
+ [pSize]="params.size"
6661
+ [class]="params.class"
6662
+ [ngStyle]="textareaStyle"
6663
+ (input)="syncRowHeight()"></textarea>
6664
+ `, styles: [":host{display:flex;width:100%;height:100%}textarea{resize:none}\n"] }]
6665
+ }], propDecorators: { textareaRef: [{
6666
+ type: ViewChild,
6667
+ args: ['textareaRef', { read: ElementRef }]
6668
+ }] } });
6669
+
6583
6670
  class LinkRenderer {
6584
6671
  constructor() {
6585
6672
  this.router = inject(Router);
@@ -7308,6 +7395,7 @@ const components = {
7308
7395
  rowSpanRenderer: RowSpanRenderer,
7309
7396
  cellEditSelectFieldComponent: CellEditSelectFieldComponent,
7310
7397
  cellEditAsyncSelectFieldComponent: CellEditAsyncSelectFieldComponent,
7398
+ cellEditTextareaComponent: CellEditTextareaComponent,
7311
7399
  primeActionsRenderer: PrimeActionsRenderer,
7312
7400
  asyncLinkRenderer: AsyncLinkRenderer,
7313
7401
  asyncSelectLabelRenderer: AsyncSelectLabelRenderer,
@@ -7394,6 +7482,7 @@ class GridComponent {
7394
7482
  this.autoGroupColumnDef = {
7395
7483
  minWidth: 180,
7396
7484
  };
7485
+ this.columnDefsLoadId = 0;
7397
7486
  this.singleClickEdit.set(this.isMobileOrTabletBrowser());
7398
7487
  this.searchPrmSub = toObservable(this.searchPrm).subscribe((searchPrm) => {
7399
7488
  if (searchPrm.modelName !== undefined) {
@@ -7401,19 +7490,19 @@ class GridComponent {
7401
7490
  this.searchPrmSub.unsubscribe();
7402
7491
  }
7403
7492
  });
7404
- effect(async () => {
7405
- this.columnDefs = await this.setRichValue();
7406
- this.columnDefs = gridUtils.handleI18nKey(this.toOptions().columnDefs || [], this.i18nService);
7407
- this.mainField = this.toOptions().mainField;
7408
- this.modelName = this.toOptions().modelName;
7493
+ effect(() => {
7494
+ const options = this.toOptions();
7495
+ void this.refreshColumnDefs(options);
7496
+ this.mainField = options.mainField;
7497
+ this.modelName = options.modelName;
7409
7498
  if (!this.upsert()?.subsert?.find((v) => v.subModelName === this.modelName)) {
7410
7499
  this.upsert()?.subsert?.push({
7411
- subModelName: this.toOptions().modelName,
7412
- fk: this.toOptions().fk,
7500
+ subModelName: options.modelName,
7501
+ fk: options.fk,
7413
7502
  subData: [],
7414
7503
  maptmp: new Map(),
7415
7504
  logtmp: new Map(),
7416
- reference: this.toOptions().reference,
7505
+ reference: options.reference,
7417
7506
  });
7418
7507
  }
7419
7508
  this.subIndex = this.upsert()?.subsert?.findIndex((v) => v.subModelName === this.modelName);
@@ -7425,14 +7514,19 @@ class GridComponent {
7425
7514
  this.getData();
7426
7515
  }, { allowSignalWrites: true });
7427
7516
  effect(() => {
7428
- if (this.rowData() === undefined)
7517
+ const rowData = this.rowData();
7518
+ if (rowData === undefined)
7429
7519
  return;
7430
7520
  untracked(() => {
7431
- if (this.toOptions().rowModelType === 'serverSide' && this.toOptions().serverFunc) {
7521
+ const options = this.toOptions();
7522
+ if (this.hasDynamicSelectDataColumn(options)) {
7523
+ void this.refreshColumnDefs(options);
7524
+ }
7525
+ if (options.rowModelType === 'serverSide' && options.serverFunc) {
7432
7526
  return;
7433
7527
  }
7434
- this.toOptions().rowModelType = 'clientSide';
7435
- this.toOptions().clientFunc = () => of({ data: this.rowData(), totalNum: this.rowData()?.length });
7528
+ options.rowModelType = 'clientSide';
7529
+ options.clientFunc = () => of({ data: rowData, totalNum: rowData?.length });
7436
7530
  setTimeout(() => {
7437
7531
  this.getClientData(undefined);
7438
7532
  }, 100);
@@ -7517,34 +7611,54 @@ class GridComponent {
7517
7611
  });
7518
7612
  });
7519
7613
  }
7520
- async setRichValue() {
7521
- let col = this.toOptions().columnDefs || [];
7614
+ hasDynamicSelectDataColumn(options = this.toOptions()) {
7615
+ return !!options.columnDefs?.some((item) => item?.hasOwnProperty('selectData') && typeof item.selectData === 'function');
7616
+ }
7617
+ async refreshColumnDefs(options = this.toOptions()) {
7618
+ const loadId = ++this.columnDefsLoadId;
7619
+ const columnDefs = await this.setRichValue(options);
7620
+ if (loadId !== this.columnDefsLoadId) {
7621
+ return;
7622
+ }
7623
+ this.columnDefs = gridUtils.handleI18nKey(columnDefs, this.i18nService);
7624
+ if (this.grid?.api) {
7625
+ this.grid.api.setGridOption('columnDefs', this.columnDefs);
7626
+ this.grid.api.refreshCells({
7627
+ force: true,
7628
+ suppressFlash: true,
7629
+ });
7630
+ }
7631
+ }
7632
+ async setRichValue(options = this.toOptions()) {
7633
+ let col = options.columnDefs || [];
7522
7634
  try {
7523
7635
  const processedCols = await Promise.all(col.map(async (item) => {
7524
- if (item.hasOwnProperty('fieldId') && (item.cellEditor == 'agRichSelectCellEditor' || item.cellEditor == 'agSelectCellEditor' || item.cellEditor == 'cellEditSelectFieldComponent') && !item.rowGroup) {
7636
+ const nextItem = { ...item };
7637
+ if (nextItem.hasOwnProperty('fieldId') && (nextItem.cellEditor == 'agRichSelectCellEditor' || nextItem.cellEditor == 'agSelectCellEditor' || nextItem.cellEditor == 'cellEditSelectFieldComponent') && !nextItem.rowGroup) {
7525
7638
  let values = [];
7526
- if (item.cellEditorParams && typeof item.cellEditorParams === 'function') {
7527
- item.cellEditorParams = item.cellEditorParams() || {};
7528
- values = JSON.parse(JSON.stringify(item.cellEditorParams.values || [])) || [];
7639
+ const rawCellEditorParams = typeof item.cellEditorParams === 'function' ? item.cellEditorParams() || {} : item.cellEditorParams || {};
7640
+ const cellEditorParams = { ...rawCellEditorParams };
7641
+ if (cellEditorParams.hasOwnProperty('values')) {
7642
+ values = cellEditorParams.values || [];
7529
7643
  }
7530
- if ((!item.cellEditorParams || !item.cellEditorParams.hasOwnProperty('values')) && item.hasOwnProperty('selectData') && typeof item.selectData === 'function') {
7531
- values = await item.selectData();
7644
+ if (nextItem.hasOwnProperty('selectData') && typeof nextItem.selectData === 'function') {
7645
+ values = (await item.selectData()) || [];
7532
7646
  }
7533
- item.cellEditorParams = {
7534
- ...(item.cellEditorParams || {}),
7647
+ nextItem.cellEditorParams = {
7648
+ ...cellEditorParams,
7535
7649
  valueListMaxHeight: 200,
7536
7650
  suppressMultiSelectPillRenderer: true,
7537
7651
  };
7538
- if (item.cellEditorParams.hasOwnProperty('values')) {
7539
- values = item.cellEditorParams.values;
7652
+ if (nextItem.cellEditorParams.hasOwnProperty('values') && !(nextItem.hasOwnProperty('selectData') && typeof nextItem.selectData === 'function')) {
7653
+ values = nextItem.cellEditorParams.values;
7540
7654
  }
7541
7655
  let isString = values.every((item) => typeof item === 'string');
7542
7656
  if (!isString) {
7543
- const optionValueField = item.cellEditorParams.optionValue || 'value';
7544
- const optionLabelField = item.cellEditorParams.optionLabel || 'label';
7545
- item.cellEditorParams.rawOptions = values;
7546
- item.cellEditorParams.values = values.map((item) => item?.[optionValueField]);
7547
- item.valueFormatter = (params) => {
7657
+ const optionValueField = nextItem.cellEditorParams.optionValue || 'value';
7658
+ const optionLabelField = nextItem.cellEditorParams.optionLabel || 'label';
7659
+ nextItem.cellEditorParams.rawOptions = values;
7660
+ nextItem.cellEditorParams.values = values.map((item) => item?.[optionValueField]);
7661
+ nextItem.valueFormatter = (params) => {
7548
7662
  const options = params.colDef.cellEditorParams.rawOptions;
7549
7663
  const valueField = params.colDef.cellEditorParams.optionValue || 'value';
7550
7664
  const labelField = params.colDef.cellEditorParams.optionLabel || 'label';
@@ -7566,14 +7680,14 @@ class GridComponent {
7566
7680
  return option.length > 0 ? option.map((v) => v?.[labelField]) : params.value;
7567
7681
  }
7568
7682
  };
7569
- item.valueGetter = (params) => {
7683
+ nextItem.valueGetter = (params) => {
7570
7684
  // console.log('pamrams----',params,item.field)
7571
- if ((item.cellEditor == 'agRichSelectCellEditor' || item.cellEditor == 'cellEditSelectFieldComponent') && params.data && params.data.hasOwnProperty(item.field)) {
7572
- return typeof params.data[item.field] == 'string' ? params.data[item.field].split(',') : params.data[item.field];
7685
+ if ((nextItem.cellEditor == 'agRichSelectCellEditor' || nextItem.cellEditor == 'cellEditSelectFieldComponent') && params.data && params.data.hasOwnProperty(nextItem.field)) {
7686
+ return typeof params.data[nextItem.field] == 'string' ? params.data[nextItem.field].split(',') : params.data[nextItem.field];
7573
7687
  }
7574
- return params.data ? params.data[item.field] : '';
7688
+ return params.data ? params.data[nextItem.field] : '';
7575
7689
  };
7576
- item.valueParser = (params) => {
7690
+ nextItem.valueParser = (params) => {
7577
7691
  // console.log('params----',params)
7578
7692
  const options = params.colDef.cellEditorParams.rawOptions;
7579
7693
  const valueField = params.colDef.cellEditorParams.optionValue || 'value';
@@ -7583,16 +7697,16 @@ class GridComponent {
7583
7697
  };
7584
7698
  }
7585
7699
  else {
7586
- item.cellEditorParams.values = values;
7587
- item.valueGetter = (params) => {
7588
- if ((item.cellEditor == 'agRichSelectCellEditor' || item.cellEditor == 'cellEditSelectFieldComponent') && params.data && params.data.hasOwnProperty(item.field)) {
7589
- return typeof params.data[item.field] == 'string' ? params.data[item.field].split(',') : params.data[item.field];
7700
+ nextItem.cellEditorParams.values = values;
7701
+ nextItem.valueGetter = (params) => {
7702
+ if ((nextItem.cellEditor == 'agRichSelectCellEditor' || nextItem.cellEditor == 'cellEditSelectFieldComponent') && params.data && params.data.hasOwnProperty(nextItem.field)) {
7703
+ return typeof params.data[nextItem.field] == 'string' ? params.data[nextItem.field].split(',') : params.data[nextItem.field];
7590
7704
  }
7591
- return params.data ? params.data[item.field] : '';
7705
+ return params.data ? params.data[nextItem.field] : '';
7592
7706
  };
7593
7707
  }
7594
7708
  }
7595
- return item;
7709
+ return nextItem;
7596
7710
  }));
7597
7711
  return processedCols;
7598
7712
  }
@@ -11186,7 +11300,7 @@ class PageFormComponent extends AmComponent {
11186
11300
  }
11187
11301
  this.leftPanelInitialized = true;
11188
11302
  this.leftPanelInitializedMode = this.getLeftPanelMode();
11189
- this.baseGridListSnapshot = this.gridList().map((item) => item);
11303
+ this.baseGridListSnapshot = deepClone(this.gridList(), this);
11190
11304
  const dataSource = this.getPanelDataSource();
11191
11305
  this.runLeftPanelEvent('onInit');
11192
11306
  const items = await this.loadLeftPanelItems(dataSource);
@@ -12693,5 +12807,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
12693
12807
  * Generated bundle index. Do not edit.
12694
12808
  */
12695
12809
 
12696
- export { ActionService, ActionsComponent, AmComponent, AsyncRenderer, AsyncSelectLabelRenderer, CellEditAsyncSelectFieldComponent, CellEditAutoCompleteComponent, CellEditDatePickerComponent, CellEditInputDateComponent, CellEditInputNumberCompoent, CellEditInputTextCompoent, CellEditSelectComponent, CellEditSelectFieldComponent, CodeMirrorComponent, CrumbActionComponent, FieldControl, FormComponent, FormFieldComponent, FormTypeComponent, GridComponent, HeadComponent, HrefBtnListComponent, I18N_Token, I18nService, ImportComponent, LANGS, LinkRenderer, LoadingComponent, LoadingService, LogComponent, PageActionService, PageFormComponent, PageFormService, PageFormSlotDirective, PageGridListComponent, PagerComponent, PopActionService, RowSelectorComponent$1 as RowSelectorComponent, SearchComponent, SingleSelectListboxComponent, StepsComponent, ThemeConfigComponent, ThemeConfigService, UploadRenderer, UserHistoryService, calcRowSpan, changeContent, clearLocal, compileTsToJs, convertAct, convertCol, convertForm, convertGrid, createCircularIterator, deepClone, executeRuntimeContextInit, filterObjectByKeys, formTypeToProps, generateUniqueId, getFilterMatchMode, gridOptionsHooker, gridUtils, isJSONParsable, pageListGridOptions, parseFunctions, toPascalCase, wrapHeaderValueGetter };
12810
+ export { ActionService, ActionsComponent, AmComponent, AsyncRenderer, AsyncSelectLabelRenderer, CellEditAsyncSelectFieldComponent, CellEditAutoCompleteComponent, CellEditDatePickerComponent, CellEditInputDateComponent, CellEditInputNumberCompoent, CellEditInputTextCompoent, CellEditSelectComponent, CellEditSelectFieldComponent, CellEditTextareaComponent, CodeMirrorComponent, CrumbActionComponent, FieldControl, FormComponent, FormFieldComponent, FormTypeComponent, GridComponent, HeadComponent, HrefBtnListComponent, I18N_Token, I18nService, ImportComponent, LANGS, LinkRenderer, LoadingComponent, LoadingService, LogComponent, PageActionService, PageFormComponent, PageFormService, PageFormSlotDirective, PageGridListComponent, PagerComponent, PopActionService, RowSelectorComponent$1 as RowSelectorComponent, SearchComponent, SingleSelectListboxComponent, StepsComponent, ThemeConfigComponent, ThemeConfigService, UploadRenderer, UserHistoryService, calcRowSpan, changeContent, clearLocal, compileTsToJs, convertAct, convertCol, convertForm, convertGrid, createCircularIterator, deepClone, executeRuntimeContextInit, filterObjectByKeys, formTypeToProps, generateUniqueId, getFilterMatchMode, gridOptionsHooker, gridUtils, isJSONParsable, pageListGridOptions, parseFunctions, toPascalCase, wrapHeaderValueGetter };
12697
12811
  //# sourceMappingURL=imm-element-ui.mjs.map