imm-element-ui 2.6.9 → 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/cell-render/upload-renderer.mjs +79 -67
- package/esm2022/lib/grid/grid/grid.component.mjs +69 -43
- package/esm2022/lib/page-form/page-form.component.mjs +2 -2
- package/fesm2022/imm-element-ui.mjs +147 -109
- package/fesm2022/imm-element-ui.mjs.map +1 -1
- package/lib/crumb-action/crumb-action.component.d.ts +1 -1
- package/lib/grid/cell-render/upload-renderer.d.ts +1 -0
- package/lib/grid/grid/grid.component.d.ts +5 -2
- package/package.json +1 -1
|
@@ -7076,6 +7076,12 @@ class UploadRenderer {
|
|
|
7076
7076
|
this.fileList = this.toFileList(params.value);
|
|
7077
7077
|
return true;
|
|
7078
7078
|
}
|
|
7079
|
+
choose(callback) {
|
|
7080
|
+
if (this.isDisabled() || this.loading) {
|
|
7081
|
+
return;
|
|
7082
|
+
}
|
|
7083
|
+
callback();
|
|
7084
|
+
}
|
|
7079
7085
|
uploadHandler(event, fu) {
|
|
7080
7086
|
const files = Array.from(event.files || []);
|
|
7081
7087
|
if (!files.length || this.isDisabled()) {
|
|
@@ -7174,32 +7180,33 @@ class UploadRenderer {
|
|
|
7174
7180
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UploadRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7175
7181
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: UploadRenderer, isStandalone: true, selector: "ng-component", ngImport: i0, template: `
|
|
7176
7182
|
<div class="upload-renderer">
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7183
|
+
@if (!isDisabled()) {
|
|
7184
|
+
<p-fileUpload
|
|
7185
|
+
#fu
|
|
7186
|
+
auto
|
|
7187
|
+
mode="advanced"
|
|
7188
|
+
[name]="uploadParams.name || 'file'"
|
|
7189
|
+
[multiple]="uploadParams.multiple ?? true"
|
|
7190
|
+
[accept]="uploadParams.accept"
|
|
7191
|
+
[maxFileSize]="uploadParams.maxFileSize"
|
|
7192
|
+
[fileLimit]="uploadParams.fileLimit"
|
|
7193
|
+
[withCredentials]="uploadParams.withCredentials ?? false"
|
|
7194
|
+
[customUpload]="true"
|
|
7195
|
+
[disabled]="loading"
|
|
7196
|
+
[styleClass]="'upload-renderer-choose'"
|
|
7197
|
+
(uploadHandler)="uploadHandler($event, fu)">
|
|
7198
|
+
<ng-template
|
|
7199
|
+
#header
|
|
7200
|
+
let-chooseCallback="chooseCallback">
|
|
7201
|
+
<p-button
|
|
7202
|
+
icon="pi pi-cloud-upload"
|
|
7203
|
+
[text]="true"
|
|
7204
|
+
size="small"
|
|
7205
|
+
[disabled]="loading"
|
|
7206
|
+
(onClick)="choose(chooseCallback)" />
|
|
7207
|
+
</ng-template>
|
|
7208
|
+
</p-fileUpload>
|
|
7209
|
+
}
|
|
7203
7210
|
|
|
7204
7211
|
<div class="upload-renderer-files">
|
|
7205
7212
|
@for (file of fileList; track index; let index = $index) {
|
|
@@ -7212,13 +7219,15 @@ class UploadRenderer {
|
|
|
7212
7219
|
(click)="$event.stopPropagation()"
|
|
7213
7220
|
>{{ file }}</a
|
|
7214
7221
|
>
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
+
@if (!isDisabled()) {
|
|
7223
|
+
<p-button
|
|
7224
|
+
icon="pi pi-times"
|
|
7225
|
+
severity="danger"
|
|
7226
|
+
size="small"
|
|
7227
|
+
[text]="true"
|
|
7228
|
+
[disabled]="loading"
|
|
7229
|
+
(onClick)="deleteHandler(file, index)" />
|
|
7230
|
+
}
|
|
7222
7231
|
</div>
|
|
7223
7232
|
}
|
|
7224
7233
|
</div>
|
|
@@ -7229,32 +7238,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
7229
7238
|
type: Component,
|
|
7230
7239
|
args: [{ standalone: true, imports: [ButtonModule, FileUpload], template: `
|
|
7231
7240
|
<div class="upload-renderer">
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7241
|
+
@if (!isDisabled()) {
|
|
7242
|
+
<p-fileUpload
|
|
7243
|
+
#fu
|
|
7244
|
+
auto
|
|
7245
|
+
mode="advanced"
|
|
7246
|
+
[name]="uploadParams.name || 'file'"
|
|
7247
|
+
[multiple]="uploadParams.multiple ?? true"
|
|
7248
|
+
[accept]="uploadParams.accept"
|
|
7249
|
+
[maxFileSize]="uploadParams.maxFileSize"
|
|
7250
|
+
[fileLimit]="uploadParams.fileLimit"
|
|
7251
|
+
[withCredentials]="uploadParams.withCredentials ?? false"
|
|
7252
|
+
[customUpload]="true"
|
|
7253
|
+
[disabled]="loading"
|
|
7254
|
+
[styleClass]="'upload-renderer-choose'"
|
|
7255
|
+
(uploadHandler)="uploadHandler($event, fu)">
|
|
7256
|
+
<ng-template
|
|
7257
|
+
#header
|
|
7258
|
+
let-chooseCallback="chooseCallback">
|
|
7259
|
+
<p-button
|
|
7260
|
+
icon="pi pi-cloud-upload"
|
|
7261
|
+
[text]="true"
|
|
7262
|
+
size="small"
|
|
7263
|
+
[disabled]="loading"
|
|
7264
|
+
(onClick)="choose(chooseCallback)" />
|
|
7265
|
+
</ng-template>
|
|
7266
|
+
</p-fileUpload>
|
|
7267
|
+
}
|
|
7258
7268
|
|
|
7259
7269
|
<div class="upload-renderer-files">
|
|
7260
7270
|
@for (file of fileList; track index; let index = $index) {
|
|
@@ -7267,13 +7277,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
7267
7277
|
(click)="$event.stopPropagation()"
|
|
7268
7278
|
>{{ file }}</a
|
|
7269
7279
|
>
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7280
|
+
@if (!isDisabled()) {
|
|
7281
|
+
<p-button
|
|
7282
|
+
icon="pi pi-times"
|
|
7283
|
+
severity="danger"
|
|
7284
|
+
size="small"
|
|
7285
|
+
[text]="true"
|
|
7286
|
+
[disabled]="loading"
|
|
7287
|
+
(onClick)="deleteHandler(file, index)" />
|
|
7288
|
+
}
|
|
7277
7289
|
</div>
|
|
7278
7290
|
}
|
|
7279
7291
|
</div>
|
|
@@ -7382,6 +7394,7 @@ class GridComponent {
|
|
|
7382
7394
|
this.autoGroupColumnDef = {
|
|
7383
7395
|
minWidth: 180,
|
|
7384
7396
|
};
|
|
7397
|
+
this.columnDefsLoadId = 0;
|
|
7385
7398
|
this.singleClickEdit.set(this.isMobileOrTabletBrowser());
|
|
7386
7399
|
this.searchPrmSub = toObservable(this.searchPrm).subscribe((searchPrm) => {
|
|
7387
7400
|
if (searchPrm.modelName !== undefined) {
|
|
@@ -7389,19 +7402,19 @@ class GridComponent {
|
|
|
7389
7402
|
this.searchPrmSub.unsubscribe();
|
|
7390
7403
|
}
|
|
7391
7404
|
});
|
|
7392
|
-
effect(
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
this.mainField =
|
|
7396
|
-
this.modelName =
|
|
7405
|
+
effect(() => {
|
|
7406
|
+
const options = this.toOptions();
|
|
7407
|
+
void this.refreshColumnDefs(options);
|
|
7408
|
+
this.mainField = options.mainField;
|
|
7409
|
+
this.modelName = options.modelName;
|
|
7397
7410
|
if (!this.upsert()?.subsert?.find((v) => v.subModelName === this.modelName)) {
|
|
7398
7411
|
this.upsert()?.subsert?.push({
|
|
7399
|
-
subModelName:
|
|
7400
|
-
fk:
|
|
7412
|
+
subModelName: options.modelName,
|
|
7413
|
+
fk: options.fk,
|
|
7401
7414
|
subData: [],
|
|
7402
7415
|
maptmp: new Map(),
|
|
7403
7416
|
logtmp: new Map(),
|
|
7404
|
-
reference:
|
|
7417
|
+
reference: options.reference,
|
|
7405
7418
|
});
|
|
7406
7419
|
}
|
|
7407
7420
|
this.subIndex = this.upsert()?.subsert?.findIndex((v) => v.subModelName === this.modelName);
|
|
@@ -7413,14 +7426,19 @@ class GridComponent {
|
|
|
7413
7426
|
this.getData();
|
|
7414
7427
|
}, { allowSignalWrites: true });
|
|
7415
7428
|
effect(() => {
|
|
7416
|
-
|
|
7429
|
+
const rowData = this.rowData();
|
|
7430
|
+
if (rowData === undefined)
|
|
7417
7431
|
return;
|
|
7418
7432
|
untracked(() => {
|
|
7419
|
-
|
|
7433
|
+
const options = this.toOptions();
|
|
7434
|
+
if (this.hasDynamicSelectDataColumn(options)) {
|
|
7435
|
+
void this.refreshColumnDefs(options);
|
|
7436
|
+
}
|
|
7437
|
+
if (options.rowModelType === 'serverSide' && options.serverFunc) {
|
|
7420
7438
|
return;
|
|
7421
7439
|
}
|
|
7422
|
-
|
|
7423
|
-
|
|
7440
|
+
options.rowModelType = 'clientSide';
|
|
7441
|
+
options.clientFunc = () => of({ data: rowData, totalNum: rowData?.length });
|
|
7424
7442
|
setTimeout(() => {
|
|
7425
7443
|
this.getClientData(undefined);
|
|
7426
7444
|
}, 100);
|
|
@@ -7444,12 +7462,12 @@ class GridComponent {
|
|
|
7444
7462
|
this.editingFix();
|
|
7445
7463
|
}
|
|
7446
7464
|
withGridContext(options) {
|
|
7447
|
-
|
|
7465
|
+
this.gridDisable();
|
|
7448
7466
|
return {
|
|
7449
7467
|
...options,
|
|
7450
7468
|
context: {
|
|
7451
7469
|
...(options.context || {}),
|
|
7452
|
-
gridDisabled: () =>
|
|
7470
|
+
gridDisabled: () => this.gridDisable(),
|
|
7453
7471
|
grid: () => this,
|
|
7454
7472
|
},
|
|
7455
7473
|
};
|
|
@@ -7505,34 +7523,54 @@ class GridComponent {
|
|
|
7505
7523
|
});
|
|
7506
7524
|
});
|
|
7507
7525
|
}
|
|
7508
|
-
|
|
7509
|
-
|
|
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 || [];
|
|
7510
7546
|
try {
|
|
7511
7547
|
const processedCols = await Promise.all(col.map(async (item) => {
|
|
7512
|
-
|
|
7548
|
+
const nextItem = { ...item };
|
|
7549
|
+
if (nextItem.hasOwnProperty('fieldId') && (nextItem.cellEditor == 'agRichSelectCellEditor' || nextItem.cellEditor == 'agSelectCellEditor' || nextItem.cellEditor == 'cellEditSelectFieldComponent') && !nextItem.rowGroup) {
|
|
7513
7550
|
let values = [];
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7551
|
+
const rawCellEditorParams = typeof item.cellEditorParams === 'function' ? item.cellEditorParams() || {} : item.cellEditorParams || {};
|
|
7552
|
+
const cellEditorParams = { ...rawCellEditorParams };
|
|
7553
|
+
if (cellEditorParams.hasOwnProperty('values')) {
|
|
7554
|
+
values = cellEditorParams.values || [];
|
|
7517
7555
|
}
|
|
7518
|
-
if (
|
|
7519
|
-
values = await item.selectData();
|
|
7556
|
+
if (nextItem.hasOwnProperty('selectData') && typeof nextItem.selectData === 'function') {
|
|
7557
|
+
values = (await item.selectData()) || [];
|
|
7520
7558
|
}
|
|
7521
|
-
|
|
7522
|
-
...
|
|
7559
|
+
nextItem.cellEditorParams = {
|
|
7560
|
+
...cellEditorParams,
|
|
7523
7561
|
valueListMaxHeight: 200,
|
|
7524
7562
|
suppressMultiSelectPillRenderer: true,
|
|
7525
7563
|
};
|
|
7526
|
-
if (
|
|
7527
|
-
values =
|
|
7564
|
+
if (nextItem.cellEditorParams.hasOwnProperty('values') && !(nextItem.hasOwnProperty('selectData') && typeof nextItem.selectData === 'function')) {
|
|
7565
|
+
values = nextItem.cellEditorParams.values;
|
|
7528
7566
|
}
|
|
7529
7567
|
let isString = values.every((item) => typeof item === 'string');
|
|
7530
7568
|
if (!isString) {
|
|
7531
|
-
const optionValueField =
|
|
7532
|
-
const optionLabelField =
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
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) => {
|
|
7536
7574
|
const options = params.colDef.cellEditorParams.rawOptions;
|
|
7537
7575
|
const valueField = params.colDef.cellEditorParams.optionValue || 'value';
|
|
7538
7576
|
const labelField = params.colDef.cellEditorParams.optionLabel || 'label';
|
|
@@ -7554,14 +7592,14 @@ class GridComponent {
|
|
|
7554
7592
|
return option.length > 0 ? option.map((v) => v?.[labelField]) : params.value;
|
|
7555
7593
|
}
|
|
7556
7594
|
};
|
|
7557
|
-
|
|
7595
|
+
nextItem.valueGetter = (params) => {
|
|
7558
7596
|
// console.log('pamrams----',params,item.field)
|
|
7559
|
-
if ((
|
|
7560
|
-
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];
|
|
7561
7599
|
}
|
|
7562
|
-
return params.data ? params.data[
|
|
7600
|
+
return params.data ? params.data[nextItem.field] : '';
|
|
7563
7601
|
};
|
|
7564
|
-
|
|
7602
|
+
nextItem.valueParser = (params) => {
|
|
7565
7603
|
// console.log('params----',params)
|
|
7566
7604
|
const options = params.colDef.cellEditorParams.rawOptions;
|
|
7567
7605
|
const valueField = params.colDef.cellEditorParams.optionValue || 'value';
|
|
@@ -7571,16 +7609,16 @@ class GridComponent {
|
|
|
7571
7609
|
};
|
|
7572
7610
|
}
|
|
7573
7611
|
else {
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
if ((
|
|
7577
|
-
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];
|
|
7578
7616
|
}
|
|
7579
|
-
return params.data ? params.data[
|
|
7617
|
+
return params.data ? params.data[nextItem.field] : '';
|
|
7580
7618
|
};
|
|
7581
7619
|
}
|
|
7582
7620
|
}
|
|
7583
|
-
return
|
|
7621
|
+
return nextItem;
|
|
7584
7622
|
}));
|
|
7585
7623
|
return processedCols;
|
|
7586
7624
|
}
|
|
@@ -11174,7 +11212,7 @@ class PageFormComponent extends AmComponent {
|
|
|
11174
11212
|
}
|
|
11175
11213
|
this.leftPanelInitialized = true;
|
|
11176
11214
|
this.leftPanelInitializedMode = this.getLeftPanelMode();
|
|
11177
|
-
this.baseGridListSnapshot = this.gridList()
|
|
11215
|
+
this.baseGridListSnapshot = deepClone(this.gridList(), this);
|
|
11178
11216
|
const dataSource = this.getPanelDataSource();
|
|
11179
11217
|
this.runLeftPanelEvent('onInit');
|
|
11180
11218
|
const items = await this.loadLeftPanelItems(dataSource);
|