imm-element-ui 2.8.2 → 2.8.4
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/form/form/form.component.mjs +4 -3
- package/esm2022/lib/form/form-field/field-utils.mjs +2 -2
- package/esm2022/lib/grid/cell-edit/cell-edit-async-selectField.component.mjs +28 -13
- package/esm2022/lib/grid/cell-edit/cell-edit-selectField.component.mjs +143 -130
- package/fesm2022/imm-element-ui.mjs +173 -144
- package/fesm2022/imm-element-ui.mjs.map +1 -1
- package/lib/grid/cell-edit/cell-edit-async-selectField.component.d.ts +1 -0
- package/lib/grid/cell-edit/cell-edit-selectField.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1509,7 +1509,7 @@ const _fieldUtils = {
|
|
|
1509
1509
|
if (field.type == 'upload') {
|
|
1510
1510
|
return _fieldUtils.toUploadValue(field, raw);
|
|
1511
1511
|
}
|
|
1512
|
-
return raw
|
|
1512
|
+
return raw ?? '';
|
|
1513
1513
|
},
|
|
1514
1514
|
toTreeSelectValue: (field, raw) => {
|
|
1515
1515
|
if (field.treeSelectProps?.selectionMode == 'single') {
|
|
@@ -5404,7 +5404,7 @@ class CellEditSelectFieldComponent {
|
|
|
5404
5404
|
if (!this.params.rawOptions && typeof this.params.getOptions === 'function') {
|
|
5405
5405
|
if (isObservable(this.params.getOptions(this.params.data))) {
|
|
5406
5406
|
this.params.getOptions(this.params.data).subscribe((res) => {
|
|
5407
|
-
this.params.options = res.hasOwnPropertys('data') ? res.data :
|
|
5407
|
+
this.params.options = res.hasOwnPropertys('data') ? res.data : res || [];
|
|
5408
5408
|
});
|
|
5409
5409
|
}
|
|
5410
5410
|
else {
|
|
@@ -5425,7 +5425,7 @@ class CellEditSelectFieldComponent {
|
|
|
5425
5425
|
width: `${cellWidth}px`,
|
|
5426
5426
|
background: 'var(--ag-background-color)',
|
|
5427
5427
|
height: '40px',
|
|
5428
|
-
alignItems: 'center'
|
|
5428
|
+
alignItems: 'center',
|
|
5429
5429
|
};
|
|
5430
5430
|
this.params.panelStyle = {
|
|
5431
5431
|
width: `${cellWidth}px`,
|
|
@@ -5443,145 +5443,158 @@ class CellEditSelectFieldComponent {
|
|
|
5443
5443
|
});
|
|
5444
5444
|
}
|
|
5445
5445
|
updateNameField(nameField, event) {
|
|
5446
|
-
const oldValue = this.params.data[nameField.field];
|
|
5446
|
+
const oldValue = this.params.data?.[nameField.field];
|
|
5447
5447
|
const valueField = this.params.optionValue || 'value';
|
|
5448
5448
|
const item = this.params.options.find((op) => op?.[valueField] === event.value);
|
|
5449
5449
|
const newValue = item ? item[nameField.key] : null;
|
|
5450
|
-
const grid = this.
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5450
|
+
const grid = this.getGrid();
|
|
5451
|
+
if (grid?.cellValueChanged) {
|
|
5452
|
+
let e = {
|
|
5453
|
+
colDef: nameField,
|
|
5454
|
+
oldValue,
|
|
5455
|
+
newValue,
|
|
5456
|
+
rowIndex: this.params.node?.rowIndex,
|
|
5457
|
+
data: { id: this.params.data?.id },
|
|
5458
|
+
};
|
|
5459
|
+
grid.cellValueChanged(e);
|
|
5460
|
+
}
|
|
5461
|
+
if (this.params.data) {
|
|
5462
|
+
this.params.data[nameField.field] = newValue;
|
|
5463
|
+
}
|
|
5464
|
+
}
|
|
5465
|
+
getGrid() {
|
|
5466
|
+
if (typeof this.params.grid === 'function') {
|
|
5467
|
+
return this.params.grid();
|
|
5468
|
+
}
|
|
5469
|
+
if (typeof this.params.context?.grid === 'function') {
|
|
5470
|
+
return this.params.context.grid();
|
|
5471
|
+
}
|
|
5472
|
+
return undefined;
|
|
5460
5473
|
}
|
|
5461
5474
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CellEditSelectFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5462
5475
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: CellEditSelectFieldComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: `
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5476
|
+
<p-select
|
|
5477
|
+
[(ngModel)]="value"
|
|
5478
|
+
[scrollHeight]="params.scrollHeight || '200px'"
|
|
5479
|
+
[filter]="params.filter"
|
|
5480
|
+
[name]="params.name"
|
|
5481
|
+
[options]="params.options"
|
|
5482
|
+
[placeholder]="params.placeholder"
|
|
5483
|
+
[class]="params.class"
|
|
5484
|
+
[style]="params.style"
|
|
5485
|
+
[panelStyle]="params.panelStyle"
|
|
5486
|
+
[panelStyleClass]="params.panelStyleClass"
|
|
5487
|
+
[readonly]="params.readonly"
|
|
5488
|
+
[editable]="params.editable"
|
|
5489
|
+
[appendTo]="params.appendTo || 'body'"
|
|
5490
|
+
[tabindex]="params.tabindex"
|
|
5491
|
+
[placeholder]="params.placeholder"
|
|
5492
|
+
[loadingIcon]="params.loadingIcon"
|
|
5493
|
+
[filterPlaceholder]="params.filterPlaceholder"
|
|
5494
|
+
[filterLocale]="params.filterLocale"
|
|
5495
|
+
[variant]="params.variant"
|
|
5496
|
+
[inputId]="params.inputId"
|
|
5497
|
+
[dataKey]="params.dataKey"
|
|
5498
|
+
[filterBy]="params.filterBy"
|
|
5499
|
+
[filterFields]="params.filterFields"
|
|
5500
|
+
[autofocus]="params.autofocus ?? true"
|
|
5501
|
+
[resetFilterOnHide]="params.resetFilterOnHide"
|
|
5502
|
+
[checkmark]="params.checkmark"
|
|
5503
|
+
[dropdownIcon]="params.dropdownIcon"
|
|
5504
|
+
[loading]="params.loading"
|
|
5505
|
+
[optionLabel]="params.optionLabel"
|
|
5506
|
+
[optionValue]="params.optionValue"
|
|
5507
|
+
[optionDisabled]="params.optionDisabled"
|
|
5508
|
+
[optionGroupLabel]="params.optionGroupLabel"
|
|
5509
|
+
[optionGroupChildren]="params.optionGroupChildren || 'items'"
|
|
5510
|
+
[group]="params.group"
|
|
5511
|
+
[showClear]="params.showClear"
|
|
5512
|
+
[emptyFilterMessage]="params.emptyFilterMessage"
|
|
5513
|
+
[emptyMessage]="params.emptyMessage"
|
|
5514
|
+
[lazy]="params.lazy"
|
|
5515
|
+
[virtualScroll]="params.virtualScroll"
|
|
5516
|
+
[virtualScrollItemSize]="params.virtualScrollItemSize"
|
|
5517
|
+
[virtualScrollOptions]="params.virtualScrollOptions"
|
|
5518
|
+
[overlayOptions]="params.overlayOptions"
|
|
5519
|
+
[size]="params.size"
|
|
5520
|
+
[ariaFilterLabel]="params.ariaFilterLabel"
|
|
5521
|
+
[ariaLabel]="params.ariaLabel"
|
|
5522
|
+
[ariaLabelledBy]="params.ariaLabelledBy"
|
|
5523
|
+
[filterMatchMode]="params.filterMatchMode"
|
|
5524
|
+
[maxlength]="params.maxlength"
|
|
5525
|
+
[tooltip]="params.tooltip"
|
|
5526
|
+
[tooltipPosition]="params.tooltipPosition || 'right'"
|
|
5527
|
+
[tooltipPositionStyle]="params.tooltipPositionStyle || 'absolute'"
|
|
5528
|
+
[tooltipStyleClass]="params.tooltipStyleClass"
|
|
5529
|
+
[focusOnHover]="params.focusOnHover == undefined ? true : params.focusOnHover"
|
|
5530
|
+
[fluid]="params.fluid == undefined ? true : params.fluid"
|
|
5531
|
+
[filterValue]="params.filterValue"
|
|
5532
|
+
(onChange)="onChange($event)" />
|
|
5533
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { 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: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i2$7.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }] }); }
|
|
5521
5534
|
}
|
|
5522
5535
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CellEditSelectFieldComponent, decorators: [{
|
|
5523
5536
|
type: Component,
|
|
5524
5537
|
args: [{
|
|
5525
5538
|
standalone: true,
|
|
5526
5539
|
template: `
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5540
|
+
<p-select
|
|
5541
|
+
[(ngModel)]="value"
|
|
5542
|
+
[scrollHeight]="params.scrollHeight || '200px'"
|
|
5543
|
+
[filter]="params.filter"
|
|
5544
|
+
[name]="params.name"
|
|
5545
|
+
[options]="params.options"
|
|
5546
|
+
[placeholder]="params.placeholder"
|
|
5547
|
+
[class]="params.class"
|
|
5548
|
+
[style]="params.style"
|
|
5549
|
+
[panelStyle]="params.panelStyle"
|
|
5550
|
+
[panelStyleClass]="params.panelStyleClass"
|
|
5551
|
+
[readonly]="params.readonly"
|
|
5552
|
+
[editable]="params.editable"
|
|
5553
|
+
[appendTo]="params.appendTo || 'body'"
|
|
5554
|
+
[tabindex]="params.tabindex"
|
|
5555
|
+
[placeholder]="params.placeholder"
|
|
5556
|
+
[loadingIcon]="params.loadingIcon"
|
|
5557
|
+
[filterPlaceholder]="params.filterPlaceholder"
|
|
5558
|
+
[filterLocale]="params.filterLocale"
|
|
5559
|
+
[variant]="params.variant"
|
|
5560
|
+
[inputId]="params.inputId"
|
|
5561
|
+
[dataKey]="params.dataKey"
|
|
5562
|
+
[filterBy]="params.filterBy"
|
|
5563
|
+
[filterFields]="params.filterFields"
|
|
5564
|
+
[autofocus]="params.autofocus ?? true"
|
|
5565
|
+
[resetFilterOnHide]="params.resetFilterOnHide"
|
|
5566
|
+
[checkmark]="params.checkmark"
|
|
5567
|
+
[dropdownIcon]="params.dropdownIcon"
|
|
5568
|
+
[loading]="params.loading"
|
|
5569
|
+
[optionLabel]="params.optionLabel"
|
|
5570
|
+
[optionValue]="params.optionValue"
|
|
5571
|
+
[optionDisabled]="params.optionDisabled"
|
|
5572
|
+
[optionGroupLabel]="params.optionGroupLabel"
|
|
5573
|
+
[optionGroupChildren]="params.optionGroupChildren || 'items'"
|
|
5574
|
+
[group]="params.group"
|
|
5575
|
+
[showClear]="params.showClear"
|
|
5576
|
+
[emptyFilterMessage]="params.emptyFilterMessage"
|
|
5577
|
+
[emptyMessage]="params.emptyMessage"
|
|
5578
|
+
[lazy]="params.lazy"
|
|
5579
|
+
[virtualScroll]="params.virtualScroll"
|
|
5580
|
+
[virtualScrollItemSize]="params.virtualScrollItemSize"
|
|
5581
|
+
[virtualScrollOptions]="params.virtualScrollOptions"
|
|
5582
|
+
[overlayOptions]="params.overlayOptions"
|
|
5583
|
+
[size]="params.size"
|
|
5584
|
+
[ariaFilterLabel]="params.ariaFilterLabel"
|
|
5585
|
+
[ariaLabel]="params.ariaLabel"
|
|
5586
|
+
[ariaLabelledBy]="params.ariaLabelledBy"
|
|
5587
|
+
[filterMatchMode]="params.filterMatchMode"
|
|
5588
|
+
[maxlength]="params.maxlength"
|
|
5589
|
+
[tooltip]="params.tooltip"
|
|
5590
|
+
[tooltipPosition]="params.tooltipPosition || 'right'"
|
|
5591
|
+
[tooltipPositionStyle]="params.tooltipPositionStyle || 'absolute'"
|
|
5592
|
+
[tooltipStyleClass]="params.tooltipStyleClass"
|
|
5593
|
+
[focusOnHover]="params.focusOnHover == undefined ? true : params.focusOnHover"
|
|
5594
|
+
[fluid]="params.fluid == undefined ? true : params.fluid"
|
|
5595
|
+
[filterValue]="params.filterValue"
|
|
5596
|
+
(onChange)="onChange($event)" />
|
|
5597
|
+
`,
|
|
5585
5598
|
imports: [FormsModule, ReactiveFormsModule, SelectModule],
|
|
5586
5599
|
}]
|
|
5587
5600
|
}], propDecorators: { input: [{
|
|
@@ -5744,18 +5757,31 @@ class CellEditAsyncSelectFieldComponent {
|
|
|
5744
5757
|
};
|
|
5745
5758
|
}
|
|
5746
5759
|
updateNameField(nameField, event) {
|
|
5747
|
-
const oldValue = this.params.data[nameField.field];
|
|
5760
|
+
const oldValue = this.params.data?.[nameField.field];
|
|
5748
5761
|
const newValue = this.resolveNameFieldValue(nameField, event.value);
|
|
5749
|
-
const grid = this.
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5762
|
+
const grid = this.getGrid();
|
|
5763
|
+
if (grid?.cellValueChanged) {
|
|
5764
|
+
const e = {
|
|
5765
|
+
colDef: nameField,
|
|
5766
|
+
oldValue,
|
|
5767
|
+
newValue,
|
|
5768
|
+
rowIndex: this.params.node?.rowIndex,
|
|
5769
|
+
data: { id: this.params.data?.id },
|
|
5770
|
+
};
|
|
5771
|
+
grid.cellValueChanged(e);
|
|
5772
|
+
}
|
|
5773
|
+
if (this.params.data) {
|
|
5774
|
+
this.params.data[nameField.field] = newValue;
|
|
5775
|
+
}
|
|
5776
|
+
}
|
|
5777
|
+
getGrid() {
|
|
5778
|
+
if (typeof this.params.grid === 'function') {
|
|
5779
|
+
return this.params.grid();
|
|
5780
|
+
}
|
|
5781
|
+
if (typeof this.params.context?.grid === 'function') {
|
|
5782
|
+
return this.params.context.grid();
|
|
5783
|
+
}
|
|
5784
|
+
return undefined;
|
|
5759
5785
|
}
|
|
5760
5786
|
resolveNameFieldValue(nameField, value) {
|
|
5761
5787
|
const valueField = this.params.optionValue || 'value';
|
|
@@ -5777,7 +5803,9 @@ class CellEditAsyncSelectFieldComponent {
|
|
|
5777
5803
|
if (value === '' || value == null) {
|
|
5778
5804
|
return [];
|
|
5779
5805
|
}
|
|
5780
|
-
return String(value)
|
|
5806
|
+
return String(value)
|
|
5807
|
+
.split(',')
|
|
5808
|
+
.filter((item) => item !== '');
|
|
5781
5809
|
}
|
|
5782
5810
|
toValueString(value) {
|
|
5783
5811
|
if (Array.isArray(value)) {
|
|
@@ -9846,6 +9874,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
9846
9874
|
args: ['fieldLabelRef', { static: false }]
|
|
9847
9875
|
}] } });
|
|
9848
9876
|
|
|
9877
|
+
const nonEmptyRequired = (control) => (control.value === false ? null : Validators.required(control));
|
|
9849
9878
|
class FormComponent {
|
|
9850
9879
|
onResize() {
|
|
9851
9880
|
this.reCalcLabelSize();
|
|
@@ -9987,7 +10016,7 @@ class FormComponent {
|
|
|
9987
10016
|
handleFieldControl(field) {
|
|
9988
10017
|
const key = field.key || '';
|
|
9989
10018
|
const isDisplayOnly = !!field.extra?.displayOnly;
|
|
9990
|
-
const validators = isDisplayOnly ? null : fieldUtils.props(field)?.required ? (field.validators ? field.validators :
|
|
10019
|
+
const validators = isDisplayOnly ? null : fieldUtils.props(field)?.required ? (field.validators ? field.validators : nonEmptyRequired) : null;
|
|
9991
10020
|
let fieldControl = this.options().form?.get(key);
|
|
9992
10021
|
if (!fieldControl) {
|
|
9993
10022
|
fieldControl = new FieldControl(null, validators || undefined);
|
|
@@ -10089,7 +10118,7 @@ class FormComponent {
|
|
|
10089
10118
|
const validators = field.extra?.displayOnly
|
|
10090
10119
|
? null
|
|
10091
10120
|
: fieldUtils.props(field)?.required
|
|
10092
|
-
? (field?.validators ? field?.validators :
|
|
10121
|
+
? (field?.validators ? field?.validators : nonEmptyRequired)
|
|
10093
10122
|
: null;
|
|
10094
10123
|
field.fieldControl?.setValidators(validators);
|
|
10095
10124
|
}
|