imm-element-ui 2.7.0 → 2.7.1
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/esm2022/lib/grid/grid/grid.component.mjs +67 -41
- package/esm2022/lib/page-form/page-form.component.mjs +2 -2
- package/fesm2022/imm-element-ui.mjs +67 -41
- package/fesm2022/imm-element-ui.mjs.map +1 -1
- package/lib/crumb-action/crumb-action.component.d.ts +1 -1
- package/lib/grid/grid/grid.component.d.ts +5 -2
- package/package.json +1 -1
|
@@ -7394,6 +7394,7 @@ class GridComponent {
|
|
|
7394
7394
|
this.autoGroupColumnDef = {
|
|
7395
7395
|
minWidth: 180,
|
|
7396
7396
|
};
|
|
7397
|
+
this.columnDefsLoadId = 0;
|
|
7397
7398
|
this.singleClickEdit.set(this.isMobileOrTabletBrowser());
|
|
7398
7399
|
this.searchPrmSub = toObservable(this.searchPrm).subscribe((searchPrm) => {
|
|
7399
7400
|
if (searchPrm.modelName !== undefined) {
|
|
@@ -7401,19 +7402,19 @@ class GridComponent {
|
|
|
7401
7402
|
this.searchPrmSub.unsubscribe();
|
|
7402
7403
|
}
|
|
7403
7404
|
});
|
|
7404
|
-
effect(
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
this.mainField =
|
|
7408
|
-
this.modelName =
|
|
7405
|
+
effect(() => {
|
|
7406
|
+
const options = this.toOptions();
|
|
7407
|
+
void this.refreshColumnDefs(options);
|
|
7408
|
+
this.mainField = options.mainField;
|
|
7409
|
+
this.modelName = options.modelName;
|
|
7409
7410
|
if (!this.upsert()?.subsert?.find((v) => v.subModelName === this.modelName)) {
|
|
7410
7411
|
this.upsert()?.subsert?.push({
|
|
7411
|
-
subModelName:
|
|
7412
|
-
fk:
|
|
7412
|
+
subModelName: options.modelName,
|
|
7413
|
+
fk: options.fk,
|
|
7413
7414
|
subData: [],
|
|
7414
7415
|
maptmp: new Map(),
|
|
7415
7416
|
logtmp: new Map(),
|
|
7416
|
-
reference:
|
|
7417
|
+
reference: options.reference,
|
|
7417
7418
|
});
|
|
7418
7419
|
}
|
|
7419
7420
|
this.subIndex = this.upsert()?.subsert?.findIndex((v) => v.subModelName === this.modelName);
|
|
@@ -7425,14 +7426,19 @@ class GridComponent {
|
|
|
7425
7426
|
this.getData();
|
|
7426
7427
|
}, { allowSignalWrites: true });
|
|
7427
7428
|
effect(() => {
|
|
7428
|
-
|
|
7429
|
+
const rowData = this.rowData();
|
|
7430
|
+
if (rowData === undefined)
|
|
7429
7431
|
return;
|
|
7430
7432
|
untracked(() => {
|
|
7431
|
-
|
|
7433
|
+
const options = this.toOptions();
|
|
7434
|
+
if (this.hasDynamicSelectDataColumn(options)) {
|
|
7435
|
+
void this.refreshColumnDefs(options);
|
|
7436
|
+
}
|
|
7437
|
+
if (options.rowModelType === 'serverSide' && options.serverFunc) {
|
|
7432
7438
|
return;
|
|
7433
7439
|
}
|
|
7434
|
-
|
|
7435
|
-
|
|
7440
|
+
options.rowModelType = 'clientSide';
|
|
7441
|
+
options.clientFunc = () => of({ data: rowData, totalNum: rowData?.length });
|
|
7436
7442
|
setTimeout(() => {
|
|
7437
7443
|
this.getClientData(undefined);
|
|
7438
7444
|
}, 100);
|
|
@@ -7517,34 +7523,54 @@ class GridComponent {
|
|
|
7517
7523
|
});
|
|
7518
7524
|
});
|
|
7519
7525
|
}
|
|
7520
|
-
|
|
7521
|
-
|
|
7526
|
+
hasDynamicSelectDataColumn(options = this.toOptions()) {
|
|
7527
|
+
return !!options.columnDefs?.some((item) => item?.hasOwnProperty('selectData') && typeof item.selectData === 'function');
|
|
7528
|
+
}
|
|
7529
|
+
async refreshColumnDefs(options = this.toOptions()) {
|
|
7530
|
+
const loadId = ++this.columnDefsLoadId;
|
|
7531
|
+
const columnDefs = await this.setRichValue(options);
|
|
7532
|
+
if (loadId !== this.columnDefsLoadId) {
|
|
7533
|
+
return;
|
|
7534
|
+
}
|
|
7535
|
+
this.columnDefs = gridUtils.handleI18nKey(columnDefs, this.i18nService);
|
|
7536
|
+
if (this.grid?.api) {
|
|
7537
|
+
this.grid.api.setGridOption('columnDefs', this.columnDefs);
|
|
7538
|
+
this.grid.api.refreshCells({
|
|
7539
|
+
force: true,
|
|
7540
|
+
suppressFlash: true,
|
|
7541
|
+
});
|
|
7542
|
+
}
|
|
7543
|
+
}
|
|
7544
|
+
async setRichValue(options = this.toOptions()) {
|
|
7545
|
+
let col = options.columnDefs || [];
|
|
7522
7546
|
try {
|
|
7523
7547
|
const processedCols = await Promise.all(col.map(async (item) => {
|
|
7524
|
-
|
|
7548
|
+
const nextItem = { ...item };
|
|
7549
|
+
if (nextItem.hasOwnProperty('fieldId') && (nextItem.cellEditor == 'agRichSelectCellEditor' || nextItem.cellEditor == 'agSelectCellEditor' || nextItem.cellEditor == 'cellEditSelectFieldComponent') && !nextItem.rowGroup) {
|
|
7525
7550
|
let values = [];
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7551
|
+
const rawCellEditorParams = typeof item.cellEditorParams === 'function' ? item.cellEditorParams() || {} : item.cellEditorParams || {};
|
|
7552
|
+
const cellEditorParams = { ...rawCellEditorParams };
|
|
7553
|
+
if (cellEditorParams.hasOwnProperty('values')) {
|
|
7554
|
+
values = cellEditorParams.values || [];
|
|
7529
7555
|
}
|
|
7530
|
-
if (
|
|
7531
|
-
values = await item.selectData();
|
|
7556
|
+
if (nextItem.hasOwnProperty('selectData') && typeof nextItem.selectData === 'function') {
|
|
7557
|
+
values = (await item.selectData()) || [];
|
|
7532
7558
|
}
|
|
7533
|
-
|
|
7534
|
-
...
|
|
7559
|
+
nextItem.cellEditorParams = {
|
|
7560
|
+
...cellEditorParams,
|
|
7535
7561
|
valueListMaxHeight: 200,
|
|
7536
7562
|
suppressMultiSelectPillRenderer: true,
|
|
7537
7563
|
};
|
|
7538
|
-
if (
|
|
7539
|
-
values =
|
|
7564
|
+
if (nextItem.cellEditorParams.hasOwnProperty('values') && !(nextItem.hasOwnProperty('selectData') && typeof nextItem.selectData === 'function')) {
|
|
7565
|
+
values = nextItem.cellEditorParams.values;
|
|
7540
7566
|
}
|
|
7541
7567
|
let isString = values.every((item) => typeof item === 'string');
|
|
7542
7568
|
if (!isString) {
|
|
7543
|
-
const optionValueField =
|
|
7544
|
-
const optionLabelField =
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7569
|
+
const optionValueField = nextItem.cellEditorParams.optionValue || 'value';
|
|
7570
|
+
const optionLabelField = nextItem.cellEditorParams.optionLabel || 'label';
|
|
7571
|
+
nextItem.cellEditorParams.rawOptions = values;
|
|
7572
|
+
nextItem.cellEditorParams.values = values.map((item) => item?.[optionValueField]);
|
|
7573
|
+
nextItem.valueFormatter = (params) => {
|
|
7548
7574
|
const options = params.colDef.cellEditorParams.rawOptions;
|
|
7549
7575
|
const valueField = params.colDef.cellEditorParams.optionValue || 'value';
|
|
7550
7576
|
const labelField = params.colDef.cellEditorParams.optionLabel || 'label';
|
|
@@ -7566,14 +7592,14 @@ class GridComponent {
|
|
|
7566
7592
|
return option.length > 0 ? option.map((v) => v?.[labelField]) : params.value;
|
|
7567
7593
|
}
|
|
7568
7594
|
};
|
|
7569
|
-
|
|
7595
|
+
nextItem.valueGetter = (params) => {
|
|
7570
7596
|
// console.log('pamrams----',params,item.field)
|
|
7571
|
-
if ((
|
|
7572
|
-
return typeof params.data[
|
|
7597
|
+
if ((nextItem.cellEditor == 'agRichSelectCellEditor' || nextItem.cellEditor == 'cellEditSelectFieldComponent') && params.data && params.data.hasOwnProperty(nextItem.field)) {
|
|
7598
|
+
return typeof params.data[nextItem.field] == 'string' ? params.data[nextItem.field].split(',') : params.data[nextItem.field];
|
|
7573
7599
|
}
|
|
7574
|
-
return params.data ? params.data[
|
|
7600
|
+
return params.data ? params.data[nextItem.field] : '';
|
|
7575
7601
|
};
|
|
7576
|
-
|
|
7602
|
+
nextItem.valueParser = (params) => {
|
|
7577
7603
|
// console.log('params----',params)
|
|
7578
7604
|
const options = params.colDef.cellEditorParams.rawOptions;
|
|
7579
7605
|
const valueField = params.colDef.cellEditorParams.optionValue || 'value';
|
|
@@ -7583,16 +7609,16 @@ class GridComponent {
|
|
|
7583
7609
|
};
|
|
7584
7610
|
}
|
|
7585
7611
|
else {
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
if ((
|
|
7589
|
-
return typeof params.data[
|
|
7612
|
+
nextItem.cellEditorParams.values = values;
|
|
7613
|
+
nextItem.valueGetter = (params) => {
|
|
7614
|
+
if ((nextItem.cellEditor == 'agRichSelectCellEditor' || nextItem.cellEditor == 'cellEditSelectFieldComponent') && params.data && params.data.hasOwnProperty(nextItem.field)) {
|
|
7615
|
+
return typeof params.data[nextItem.field] == 'string' ? params.data[nextItem.field].split(',') : params.data[nextItem.field];
|
|
7590
7616
|
}
|
|
7591
|
-
return params.data ? params.data[
|
|
7617
|
+
return params.data ? params.data[nextItem.field] : '';
|
|
7592
7618
|
};
|
|
7593
7619
|
}
|
|
7594
7620
|
}
|
|
7595
|
-
return
|
|
7621
|
+
return nextItem;
|
|
7596
7622
|
}));
|
|
7597
7623
|
return processedCols;
|
|
7598
7624
|
}
|
|
@@ -11186,7 +11212,7 @@ class PageFormComponent extends AmComponent {
|
|
|
11186
11212
|
}
|
|
11187
11213
|
this.leftPanelInitialized = true;
|
|
11188
11214
|
this.leftPanelInitializedMode = this.getLeftPanelMode();
|
|
11189
|
-
this.baseGridListSnapshot = this.gridList()
|
|
11215
|
+
this.baseGridListSnapshot = deepClone(this.gridList(), this);
|
|
11190
11216
|
const dataSource = this.getPanelDataSource();
|
|
11191
11217
|
this.runLeftPanelEvent('onInit');
|
|
11192
11218
|
const items = await this.loadLeftPanelItems(dataSource);
|