imm-element-ui 2.6.2 → 2.6.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-type/treeselect.type.mjs +1 -3
- package/esm2022/lib/grid/cell-edit/cell-edit-async-selectField.component.mjs +377 -0
- package/esm2022/lib/grid/cell-edit/index.mjs +3 -2
- package/esm2022/lib/grid/cell-render/async-select-label-renderer.mjs +100 -0
- package/esm2022/lib/grid/cell-utils/async-select-options.mjs +81 -0
- package/esm2022/lib/grid/mock-data.mjs +6 -3
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/imm-element-ui.mjs +550 -4
- package/fesm2022/imm-element-ui.mjs.map +1 -1
- package/lib/grid/cell-edit/cell-edit-async-selectField.component.d.ts +21 -0
- package/lib/grid/cell-edit/index.d.ts +2 -1
- package/lib/grid/cell-render/async-select-label-renderer.d.ts +18 -0
- package/lib/grid/cell-utils/async-select-options.d.ts +10 -0
- package/lib/grid/grid/grid.component.d.ts +3 -1
- package/lib/grid/mock-data.d.ts +4 -1
- package/lib/search/pop-date/pop-date.component.d.ts +1 -1
- package/lib/steps/steps.component.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -2825,7 +2825,6 @@ class TreeSelectComponent {
|
|
|
2825
2825
|
(onNodeSelect)="props.onNodeSelect?.(field()!, $event)"
|
|
2826
2826
|
(onNodeUnselect)="props.onNodeUnselect?.(field()!, $event)"
|
|
2827
2827
|
[class]="props.class"
|
|
2828
|
-
[disabled]="true"
|
|
2829
2828
|
[formControl]="field()!.fieldControl!" />`, isInline: true, styles: [":host ::ng-deep .p-disabled,:host ::ng-deep .p-component:disabled{opacity:1}:host ::ng-deep .p-inputtext{border-width:0;border-radius:0;box-shadow:none;background:#fff;padding:0}:host ::ng-deep .p-inputtext:not(.ng-valid).ng-dirty{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-inputtext:not(:disabled):hover{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-inputtext:not(:disabled).ng-hovered{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-inputtext:focus{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .ng-hovered .p-autocomplete-input:not(.p-disabled){border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-select-label{padding:0}:host ::ng-deep .p-select{border-width:0;border-radius:0;box-shadow:none;background:#fff}:host ::ng-deep .p-select .p-select-dropdown{display:none}:host ::ng-deep .p-select .p-select-clear-icon{display:none}:host ::ng-deep .p-select:not(.ng-valid).ng-dirty{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-select-open{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-select-open .p-select-dropdown{display:flex}:host ::ng-deep .p-select-open .p-select-clear-icon{display:flex}:host ::ng-deep .p-select:hover{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-select:hover .p-select-dropdown{display:flex}:host ::ng-deep .p-select:hover .p-select-clear-icon{display:flex}:host ::ng-deep .p-select.ng-hovered{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-select.ng-hovered .p-select-dropdown{display:flex}:host ::ng-deep .p-select.ng-hovered .p-select-clear-icon{display:flex}:host ::ng-deep .p-multiselect-label{padding:0}:host ::ng-deep .p-multiselect{border-width:0;border-radius:0;background:#fff;box-shadow:none}:host ::ng-deep .p-multiselect .p-multiselect-dropdown{display:none}:host ::ng-deep .p-multiselect:not(.ng-valid).ng-dirty{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-multiselect-open{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-multiselect-open .p-multiselect-dropdown{display:flex}:host ::ng-deep .p-multiselect:not(.p-disabled).p-focus{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-multiselect:not(.p-disabled).p-focus .p-multiselect-dropdown{display:flex}:host ::ng-deep .p-multiselect:not(.p-disabled):hover{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-multiselect:not(.p-disabled):hover .p-multiselect-dropdown{display:flex}:host ::ng-deep .p-multiselect:not(.p-disabled).ng-hovered{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-multiselect:not(.p-disabled).ng-hovered .p-multiselect-dropdown{display:flex}:host ::ng-deep .p-textarea{border-radius:0;box-shadow:none;padding:0 .25rem;background:#fff;resize:none}:host ::ng-deep .p-textarea:not(.ng-valid).ng-dirty{background:var(--p-red-200)!important;border:1px solid var(--p-red-500)!important}:host ::ng-deep .p-textarea:not(:disabled):hover{border:1px solid var(--p-primary-color);resize:vertical}:host ::ng-deep .p-textarea:not(:disabled).ng-hovered{border:1px solid var(--p-primary-color);resize:vertical}:host ::ng-deep .p-textarea:focus{border:1px solid var(--p-primary-color);resize:vertical}:host ::ng-deep .p-treeselect-label{padding:0}:host ::ng-deep .p-treeselect{border-width:0;border-radius:0;box-shadow:none;background:#fff}:host ::ng-deep .p-treeselect .p-treeselect-dropdown{display:none}:host ::ng-deep .ng-invalid.ng-dirty>.p-treeselect{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-treeselect-open{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-treeselect-open .p-treeselect-dropdown{display:flex}:host ::ng-deep .p-treeselect:not(.p-disabled).p-focus{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-treeselect:not(.p-disabled).p-focus .p-treeselect-dropdown{display:flex}:host ::ng-deep .p-treeselect:not(.p-disabled):hover{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-treeselect:not(.p-disabled):hover .p-treeselect-dropdown{display:flex}:host ::ng-deep .ng-hovered>.p-treeselect:not(.p-disabled){border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .ng-hovered>.p-treeselect:not(.p-disabled) .p-treeselect-dropdown{display:flex}:host ::ng-deep .p-menubar{border-width:0;padding:0}:host ::ng-deep .p-menubar-submenu{z-index:3}:host ::ng-deep .p-fileupload-advanced{border-width:0;border-radius:0;background-color:#fff}:host ::ng-deep .p-fileupload-header{padding:0}:host ::ng-deep .p-fileupload-content{padding:0;display:block;border-width:0}:host ::ng-deep .p-inputnumber:not(.ng-valid).ng-dirty>.p-inputtext{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-inputnumber.ng-hovered:not(.p-disabled)>.p-inputtext{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .ng-invalid.ng-dirty>.p-datepicker .p-inputtext{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .ng-hovered>.p-datepicker:not(.p-disabled) .p-inputtext{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .cm-editor{border:1px solid #cbd5e1}:host ::ng-deep .cm-editor.cm-focused{outline:none!important;border:1px solid var(--p-primary-color)}:host ::ng-deep .cm-editor:hover{border:1px solid var(--p-primary-color)}:host ::ng-deep .cm-editor.ng-hovered{border:1px solid var(--p-primary-color)}:host ::ng-deep .cm-gutters{background-color:#fff;border:\"none\"}:host ::ng-deep .cm-activeLineGutter{background-color:#fff}\n"], dependencies: [{ kind: "component", type: TreeSelect, selector: "p-treeSelect, p-treeselect, p-tree-select", inputs: ["inputId", "scrollHeight", "disabled", "metaKeySelection", "variant", "display", "selectionMode", "tabindex", "ariaLabel", "ariaLabelledBy", "placeholder", "panelClass", "panelStyle", "fluid", "panelStyleClass", "containerStyle", "containerStyleClass", "labelStyle", "labelStyleClass", "overlayOptions", "emptyMessage", "appendTo", "filter", "filterBy", "filterMode", "filterPlaceholder", "filterLocale", "filterInputAutoFocus", "propagateSelectionDown", "propagateSelectionUp", "showClear", "resetFilterOnHide", "virtualScroll", "virtualScrollItemSize", "size", "virtualScrollOptions", "autofocus", "options", "showTransitionOptions", "hideTransitionOptions", "loading"], outputs: ["onNodeExpand", "onNodeCollapse", "onShow", "onHide", "onClear", "onFilter", "onFocus", "onBlur", "onNodeUnselect", "onNodeSelect"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
2830
2829
|
}
|
|
2831
2830
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TreeSelectComponent, decorators: [{
|
|
@@ -2886,7 +2885,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2886
2885
|
(onNodeSelect)="props.onNodeSelect?.(field()!, $event)"
|
|
2887
2886
|
(onNodeUnselect)="props.onNodeUnselect?.(field()!, $event)"
|
|
2888
2887
|
[class]="props.class"
|
|
2889
|
-
[disabled]="true"
|
|
2890
2888
|
[formControl]="field()!.fieldControl!" />`, styles: [":host ::ng-deep .p-disabled,:host ::ng-deep .p-component:disabled{opacity:1}:host ::ng-deep .p-inputtext{border-width:0;border-radius:0;box-shadow:none;background:#fff;padding:0}:host ::ng-deep .p-inputtext:not(.ng-valid).ng-dirty{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-inputtext:not(:disabled):hover{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-inputtext:not(:disabled).ng-hovered{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-inputtext:focus{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .ng-hovered .p-autocomplete-input:not(.p-disabled){border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-select-label{padding:0}:host ::ng-deep .p-select{border-width:0;border-radius:0;box-shadow:none;background:#fff}:host ::ng-deep .p-select .p-select-dropdown{display:none}:host ::ng-deep .p-select .p-select-clear-icon{display:none}:host ::ng-deep .p-select:not(.ng-valid).ng-dirty{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-select-open{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-select-open .p-select-dropdown{display:flex}:host ::ng-deep .p-select-open .p-select-clear-icon{display:flex}:host ::ng-deep .p-select:hover{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-select:hover .p-select-dropdown{display:flex}:host ::ng-deep .p-select:hover .p-select-clear-icon{display:flex}:host ::ng-deep .p-select.ng-hovered{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-select.ng-hovered .p-select-dropdown{display:flex}:host ::ng-deep .p-select.ng-hovered .p-select-clear-icon{display:flex}:host ::ng-deep .p-multiselect-label{padding:0}:host ::ng-deep .p-multiselect{border-width:0;border-radius:0;background:#fff;box-shadow:none}:host ::ng-deep .p-multiselect .p-multiselect-dropdown{display:none}:host ::ng-deep .p-multiselect:not(.ng-valid).ng-dirty{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-multiselect-open{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-multiselect-open .p-multiselect-dropdown{display:flex}:host ::ng-deep .p-multiselect:not(.p-disabled).p-focus{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-multiselect:not(.p-disabled).p-focus .p-multiselect-dropdown{display:flex}:host ::ng-deep .p-multiselect:not(.p-disabled):hover{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-multiselect:not(.p-disabled):hover .p-multiselect-dropdown{display:flex}:host ::ng-deep .p-multiselect:not(.p-disabled).ng-hovered{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-multiselect:not(.p-disabled).ng-hovered .p-multiselect-dropdown{display:flex}:host ::ng-deep .p-textarea{border-radius:0;box-shadow:none;padding:0 .25rem;background:#fff;resize:none}:host ::ng-deep .p-textarea:not(.ng-valid).ng-dirty{background:var(--p-red-200)!important;border:1px solid var(--p-red-500)!important}:host ::ng-deep .p-textarea:not(:disabled):hover{border:1px solid var(--p-primary-color);resize:vertical}:host ::ng-deep .p-textarea:not(:disabled).ng-hovered{border:1px solid var(--p-primary-color);resize:vertical}:host ::ng-deep .p-textarea:focus{border:1px solid var(--p-primary-color);resize:vertical}:host ::ng-deep .p-treeselect-label{padding:0}:host ::ng-deep .p-treeselect{border-width:0;border-radius:0;box-shadow:none;background:#fff}:host ::ng-deep .p-treeselect .p-treeselect-dropdown{display:none}:host ::ng-deep .ng-invalid.ng-dirty>.p-treeselect{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-treeselect-open{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-treeselect-open .p-treeselect-dropdown{display:flex}:host ::ng-deep .p-treeselect:not(.p-disabled).p-focus{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-treeselect:not(.p-disabled).p-focus .p-treeselect-dropdown{display:flex}:host ::ng-deep .p-treeselect:not(.p-disabled):hover{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .p-treeselect:not(.p-disabled):hover .p-treeselect-dropdown{display:flex}:host ::ng-deep .ng-hovered>.p-treeselect:not(.p-disabled){border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .ng-hovered>.p-treeselect:not(.p-disabled) .p-treeselect-dropdown{display:flex}:host ::ng-deep .p-menubar{border-width:0;padding:0}:host ::ng-deep .p-menubar-submenu{z-index:3}:host ::ng-deep .p-fileupload-advanced{border-width:0;border-radius:0;background-color:#fff}:host ::ng-deep .p-fileupload-header{padding:0}:host ::ng-deep .p-fileupload-content{padding:0;display:block;border-width:0}:host ::ng-deep .p-inputnumber:not(.ng-valid).ng-dirty>.p-inputtext{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .p-inputnumber.ng-hovered:not(.p-disabled)>.p-inputtext{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .ng-invalid.ng-dirty>.p-datepicker .p-inputtext{background:var(--p-red-200)!important;border-bottom:1px solid var(--p-red-500)!important}:host ::ng-deep .ng-hovered>.p-datepicker:not(.p-disabled) .p-inputtext{border-bottom:1px solid var(--p-primary-color)}:host ::ng-deep .cm-editor{border:1px solid #cbd5e1}:host ::ng-deep .cm-editor.cm-focused{outline:none!important;border:1px solid var(--p-primary-color)}:host ::ng-deep .cm-editor:hover{border:1px solid var(--p-primary-color)}:host ::ng-deep .cm-editor.ng-hovered{border:1px solid var(--p-primary-color)}:host ::ng-deep .cm-gutters{background-color:#fff;border:\"none\"}:host ::ng-deep .cm-activeLineGutter{background-color:#fff}\n"] }]
|
|
2891
2889
|
}], ctorParameters: () => [{ type: ActionService }, { type: i0.Renderer2 }], propDecorators: { treeselect: [{
|
|
2892
2890
|
type: ViewChild,
|
|
@@ -5503,6 +5501,455 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
5503
5501
|
args: ['input', { read: ViewContainerRef }]
|
|
5504
5502
|
}] } });
|
|
5505
5503
|
|
|
5504
|
+
const optionsCache = new Map();
|
|
5505
|
+
const resolveAsyncSelectOptions = async (params, context) => {
|
|
5506
|
+
const cache = params.cache !== false;
|
|
5507
|
+
const cacheKey = resolveCacheKey(params, context);
|
|
5508
|
+
if (cache && params.clearCache) {
|
|
5509
|
+
optionsCache.delete(cacheKey);
|
|
5510
|
+
}
|
|
5511
|
+
if (cache && optionsCache.has(cacheKey)) {
|
|
5512
|
+
return optionsCache.get(cacheKey);
|
|
5513
|
+
}
|
|
5514
|
+
const promise = loadOptions(params, context).catch((error) => {
|
|
5515
|
+
if (cache) {
|
|
5516
|
+
optionsCache.delete(cacheKey);
|
|
5517
|
+
}
|
|
5518
|
+
throw error;
|
|
5519
|
+
});
|
|
5520
|
+
if (cache) {
|
|
5521
|
+
optionsCache.set(cacheKey, promise);
|
|
5522
|
+
}
|
|
5523
|
+
return promise;
|
|
5524
|
+
};
|
|
5525
|
+
const clearAsyncSelectOptionsCache = (cacheKey) => {
|
|
5526
|
+
if (cacheKey === undefined) {
|
|
5527
|
+
optionsCache.clear();
|
|
5528
|
+
return;
|
|
5529
|
+
}
|
|
5530
|
+
optionsCache.delete(cacheKey);
|
|
5531
|
+
};
|
|
5532
|
+
const loadOptions = async (params, context) => {
|
|
5533
|
+
const source = resolveOptionsSource(params, context);
|
|
5534
|
+
let options = normalizeOptions(await unwrapOptions(source));
|
|
5535
|
+
console.log('options----', options);
|
|
5536
|
+
if (params.filterOptions && typeof params.filterOptions === 'function') {
|
|
5537
|
+
options = params.filterOptions(options, context) || options;
|
|
5538
|
+
}
|
|
5539
|
+
return options;
|
|
5540
|
+
};
|
|
5541
|
+
const resolveOptionsSource = (params, context) => {
|
|
5542
|
+
if (typeof params.getOptions === 'function') {
|
|
5543
|
+
return params.getOptions(context);
|
|
5544
|
+
}
|
|
5545
|
+
if (typeof params.optionsHook === 'function') {
|
|
5546
|
+
return params.optionsHook(context);
|
|
5547
|
+
}
|
|
5548
|
+
return params.rawOptions || params.options || [];
|
|
5549
|
+
};
|
|
5550
|
+
const unwrapOptions = async (source) => {
|
|
5551
|
+
console.log('source----', source);
|
|
5552
|
+
if (isObservable(source)) {
|
|
5553
|
+
return firstValueFrom(source);
|
|
5554
|
+
}
|
|
5555
|
+
if (source && typeof source.then === 'function') {
|
|
5556
|
+
return source;
|
|
5557
|
+
}
|
|
5558
|
+
return source;
|
|
5559
|
+
};
|
|
5560
|
+
const normalizeOptions = (res) => {
|
|
5561
|
+
if (Array.isArray(res)) {
|
|
5562
|
+
return res;
|
|
5563
|
+
}
|
|
5564
|
+
if (Array.isArray(res?.data)) {
|
|
5565
|
+
return res.data;
|
|
5566
|
+
}
|
|
5567
|
+
return [];
|
|
5568
|
+
};
|
|
5569
|
+
const resolveCacheKey = (params, context) => {
|
|
5570
|
+
if (typeof params.cacheKey === 'function') {
|
|
5571
|
+
return String(params.cacheKey(context));
|
|
5572
|
+
}
|
|
5573
|
+
if (params.cacheKey !== undefined && params.cacheKey !== null) {
|
|
5574
|
+
return String(params.cacheKey);
|
|
5575
|
+
}
|
|
5576
|
+
return [
|
|
5577
|
+
context.field || context.colDef?.field || '',
|
|
5578
|
+
params.optionValue || 'value',
|
|
5579
|
+
params.optionLabel || 'label',
|
|
5580
|
+
params.multiple ? 'multiple' : 'single',
|
|
5581
|
+
].join('|');
|
|
5582
|
+
};
|
|
5583
|
+
|
|
5584
|
+
class CellEditAsyncSelectFieldComponent {
|
|
5585
|
+
async agInit(params) {
|
|
5586
|
+
this.params = params;
|
|
5587
|
+
this.params.optionLabel = this.params.optionLabel || 'label';
|
|
5588
|
+
this.params.optionValue = this.params.optionValue || 'value';
|
|
5589
|
+
const rowValue = this.params.data?.[this.params.colDef.field];
|
|
5590
|
+
this.value = this.params.multiple ? this.toValueArray(params.value ?? rowValue) : (params.value ?? rowValue);
|
|
5591
|
+
this.setEditorSize(params);
|
|
5592
|
+
await this.loadOptions();
|
|
5593
|
+
}
|
|
5594
|
+
getValue() {
|
|
5595
|
+
if (this.params.multiple) {
|
|
5596
|
+
return this.toValueString(this.value);
|
|
5597
|
+
}
|
|
5598
|
+
const value = this.value;
|
|
5599
|
+
return value === '' || value == null ? null : value;
|
|
5600
|
+
}
|
|
5601
|
+
onChange(event) {
|
|
5602
|
+
const nameFields = this.params.nameFields || [];
|
|
5603
|
+
nameFields.forEach((nameField) => {
|
|
5604
|
+
this.updateNameField(nameField, event);
|
|
5605
|
+
});
|
|
5606
|
+
}
|
|
5607
|
+
async loadOptions() {
|
|
5608
|
+
const context = this.createContext();
|
|
5609
|
+
try {
|
|
5610
|
+
this.params.loading = true;
|
|
5611
|
+
this.params.options = await resolveAsyncSelectOptions(this.params, context);
|
|
5612
|
+
}
|
|
5613
|
+
finally {
|
|
5614
|
+
this.params.loading = false;
|
|
5615
|
+
}
|
|
5616
|
+
}
|
|
5617
|
+
createContext() {
|
|
5618
|
+
return {
|
|
5619
|
+
data: this.params.data,
|
|
5620
|
+
value: this.params.multiple ? this.toValueString(this.value) : this.value,
|
|
5621
|
+
params: this.params,
|
|
5622
|
+
field: this.params.colDef.field,
|
|
5623
|
+
colDef: this.params.colDef,
|
|
5624
|
+
rowIndex: this.params.node?.rowIndex,
|
|
5625
|
+
};
|
|
5626
|
+
}
|
|
5627
|
+
setEditorSize(params) {
|
|
5628
|
+
const cellWidth = params.column.getActualWidth();
|
|
5629
|
+
this.params.style = {
|
|
5630
|
+
border: 'none',
|
|
5631
|
+
boxShadow: 'none',
|
|
5632
|
+
width: `${cellWidth}px`,
|
|
5633
|
+
background: 'var(--ag-background-color)',
|
|
5634
|
+
height: '40px',
|
|
5635
|
+
alignItems: 'center',
|
|
5636
|
+
...(this.params.style || {}),
|
|
5637
|
+
};
|
|
5638
|
+
this.params.panelStyle = {
|
|
5639
|
+
width: `${cellWidth}px`,
|
|
5640
|
+
...(this.params.panelStyle || {}),
|
|
5641
|
+
};
|
|
5642
|
+
}
|
|
5643
|
+
updateNameField(nameField, event) {
|
|
5644
|
+
const oldValue = this.params.data[nameField.field];
|
|
5645
|
+
const newValue = this.resolveNameFieldValue(nameField, event.value);
|
|
5646
|
+
const grid = this.params.grid();
|
|
5647
|
+
const e = {
|
|
5648
|
+
colDef: nameField,
|
|
5649
|
+
oldValue,
|
|
5650
|
+
newValue,
|
|
5651
|
+
rowIndex: this.params.node.rowIndex,
|
|
5652
|
+
data: { id: this.params.data.id },
|
|
5653
|
+
};
|
|
5654
|
+
grid.cellValueChanged(e);
|
|
5655
|
+
this.params.data[nameField.field] = newValue;
|
|
5656
|
+
}
|
|
5657
|
+
resolveNameFieldValue(nameField, value) {
|
|
5658
|
+
const valueField = this.params.optionValue || 'value';
|
|
5659
|
+
if (this.params.multiple) {
|
|
5660
|
+
const values = this.toValueArray(value);
|
|
5661
|
+
return (this.params.options || [])
|
|
5662
|
+
.filter((op) => values.some((selectedValue) => selectedValue == op?.[valueField]))
|
|
5663
|
+
.map((op) => op?.[nameField.key])
|
|
5664
|
+
.filter((item) => item !== undefined && item !== null && item !== '')
|
|
5665
|
+
.join(',');
|
|
5666
|
+
}
|
|
5667
|
+
const item = (this.params.options || []).find((op) => op?.[valueField] === value);
|
|
5668
|
+
return item ? item[nameField.key] : null;
|
|
5669
|
+
}
|
|
5670
|
+
toValueArray(value) {
|
|
5671
|
+
if (Array.isArray(value)) {
|
|
5672
|
+
return value;
|
|
5673
|
+
}
|
|
5674
|
+
if (value === '' || value == null) {
|
|
5675
|
+
return [];
|
|
5676
|
+
}
|
|
5677
|
+
return String(value).split(',').filter((item) => item !== '');
|
|
5678
|
+
}
|
|
5679
|
+
toValueString(value) {
|
|
5680
|
+
if (Array.isArray(value)) {
|
|
5681
|
+
return value.filter((item) => item !== '' && item != null).join(',');
|
|
5682
|
+
}
|
|
5683
|
+
if (value === '' || value == null) {
|
|
5684
|
+
return '';
|
|
5685
|
+
}
|
|
5686
|
+
return String(value);
|
|
5687
|
+
}
|
|
5688
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CellEditAsyncSelectFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5689
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CellEditAsyncSelectFieldComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: `
|
|
5690
|
+
@if (params.multiple) {
|
|
5691
|
+
<p-multiselect
|
|
5692
|
+
[(ngModel)]="value"
|
|
5693
|
+
[scrollHeight]="params.scrollHeight || '200px'"
|
|
5694
|
+
[filter]="params.filter"
|
|
5695
|
+
[name]="params.name"
|
|
5696
|
+
[options]="params.options"
|
|
5697
|
+
[placeholder]="params.placeholder"
|
|
5698
|
+
[class]="params.class"
|
|
5699
|
+
[style]="params.style"
|
|
5700
|
+
[panelStyle]="params.panelStyle"
|
|
5701
|
+
[panelStyleClass]="params.panelStyleClass"
|
|
5702
|
+
[readonly]="params.readonly"
|
|
5703
|
+
[appendTo]="params.appendTo || 'body'"
|
|
5704
|
+
[tabindex]="params.tabindex"
|
|
5705
|
+
[loadingIcon]="params.loadingIcon"
|
|
5706
|
+
[filterPlaceHolder]="params.filterPlaceHolder || params.filterPlaceholder"
|
|
5707
|
+
[filterLocale]="params.filterLocale"
|
|
5708
|
+
[variant]="params.variant"
|
|
5709
|
+
[inputId]="params.inputId"
|
|
5710
|
+
[dataKey]="params.dataKey"
|
|
5711
|
+
[filterBy]="params.filterBy"
|
|
5712
|
+
[filterFields]="params.filterFields"
|
|
5713
|
+
[autofocus]="params.autofocus ?? true"
|
|
5714
|
+
[resetFilterOnHide]="params.resetFilterOnHide"
|
|
5715
|
+
[dropdownIcon]="params.dropdownIcon"
|
|
5716
|
+
[loading]="params.loading"
|
|
5717
|
+
[optionLabel]="params.optionLabel"
|
|
5718
|
+
[optionValue]="params.optionValue"
|
|
5719
|
+
[optionDisabled]="params.optionDisabled"
|
|
5720
|
+
[optionGroupLabel]="params.optionGroupLabel"
|
|
5721
|
+
[optionGroupChildren]="params.optionGroupChildren || 'items'"
|
|
5722
|
+
[group]="params.group"
|
|
5723
|
+
[showClear]="params.showClear"
|
|
5724
|
+
[emptyFilterMessage]="params.emptyFilterMessage"
|
|
5725
|
+
[emptyMessage]="params.emptyMessage"
|
|
5726
|
+
[lazy]="params.lazy"
|
|
5727
|
+
[virtualScroll]="params.virtualScroll"
|
|
5728
|
+
[virtualScrollItemSize]="params.virtualScrollItemSize"
|
|
5729
|
+
[virtualScrollOptions]="params.virtualScrollOptions"
|
|
5730
|
+
[overlayOptions]="params.overlayOptions"
|
|
5731
|
+
[size]="params.size"
|
|
5732
|
+
[ariaFilterLabel]="params.ariaFilterLabel"
|
|
5733
|
+
[ariaLabel]="params.ariaLabel"
|
|
5734
|
+
[ariaLabelledBy]="params.ariaLabelledBy"
|
|
5735
|
+
[filterMatchMode]="params.filterMatchMode"
|
|
5736
|
+
[maxlength]="params.maxlength"
|
|
5737
|
+
[tooltip]="params.tooltip"
|
|
5738
|
+
[tooltipPosition]="params.tooltipPosition || 'right'"
|
|
5739
|
+
[tooltipPositionStyle]="params.tooltipPositionStyle || 'absolute'"
|
|
5740
|
+
[tooltipStyleClass]="params.tooltipStyleClass"
|
|
5741
|
+
[focusOnHover]="params.focusOnHover == undefined ? true : params.focusOnHover"
|
|
5742
|
+
[fluid]="params.fluid == undefined ? true : params.fluid"
|
|
5743
|
+
[filterValue]="params.filterValue"
|
|
5744
|
+
[display]="params.display ?? 'comma'"
|
|
5745
|
+
[displaySelectedLabel]="params.displaySelectedLabel ?? true"
|
|
5746
|
+
[maxSelectedLabels]="params.maxSelectedLabels"
|
|
5747
|
+
[selectionLimit]="params.selectionLimit"
|
|
5748
|
+
[selectedItemsLabel]="params.selectedItemsLabel"
|
|
5749
|
+
[showToggleAll]="params.showToggleAll ?? true"
|
|
5750
|
+
[showHeader]="params.showHeader ?? true"
|
|
5751
|
+
[autofocusFilter]="params.autofocusFilter"
|
|
5752
|
+
[selectAll]="params.selectAll ?? null"
|
|
5753
|
+
[selectOnFocus]="params.selectOnFocus"
|
|
5754
|
+
[autoOptionFocus]="params.autoOptionFocus"
|
|
5755
|
+
(onChange)="onChange($event)" />
|
|
5756
|
+
} @else {
|
|
5757
|
+
<p-select
|
|
5758
|
+
[(ngModel)]="value"
|
|
5759
|
+
[scrollHeight]="params.scrollHeight || '200px'"
|
|
5760
|
+
[filter]="params.filter"
|
|
5761
|
+
[name]="params.name"
|
|
5762
|
+
[options]="params.options"
|
|
5763
|
+
[placeholder]="params.placeholder"
|
|
5764
|
+
[class]="params.class"
|
|
5765
|
+
[style]="params.style"
|
|
5766
|
+
[panelStyle]="params.panelStyle"
|
|
5767
|
+
[panelStyleClass]="params.panelStyleClass"
|
|
5768
|
+
[readonly]="params.readonly"
|
|
5769
|
+
[editable]="params.editable"
|
|
5770
|
+
[appendTo]="params.appendTo || 'body'"
|
|
5771
|
+
[tabindex]="params.tabindex"
|
|
5772
|
+
[loadingIcon]="params.loadingIcon"
|
|
5773
|
+
[filterPlaceholder]="params.filterPlaceholder"
|
|
5774
|
+
[filterLocale]="params.filterLocale"
|
|
5775
|
+
[variant]="params.variant"
|
|
5776
|
+
[inputId]="params.inputId"
|
|
5777
|
+
[dataKey]="params.dataKey"
|
|
5778
|
+
[filterBy]="params.filterBy"
|
|
5779
|
+
[filterFields]="params.filterFields"
|
|
5780
|
+
[autofocus]="params.autofocus ?? true"
|
|
5781
|
+
[resetFilterOnHide]="params.resetFilterOnHide"
|
|
5782
|
+
[checkmark]="params.checkmark"
|
|
5783
|
+
[dropdownIcon]="params.dropdownIcon"
|
|
5784
|
+
[loading]="params.loading"
|
|
5785
|
+
[optionLabel]="params.optionLabel"
|
|
5786
|
+
[optionValue]="params.optionValue"
|
|
5787
|
+
[optionDisabled]="params.optionDisabled"
|
|
5788
|
+
[optionGroupLabel]="params.optionGroupLabel"
|
|
5789
|
+
[optionGroupChildren]="params.optionGroupChildren || 'items'"
|
|
5790
|
+
[group]="params.group"
|
|
5791
|
+
[showClear]="params.showClear"
|
|
5792
|
+
[emptyFilterMessage]="params.emptyFilterMessage"
|
|
5793
|
+
[emptyMessage]="params.emptyMessage"
|
|
5794
|
+
[lazy]="params.lazy"
|
|
5795
|
+
[virtualScroll]="params.virtualScroll"
|
|
5796
|
+
[virtualScrollItemSize]="params.virtualScrollItemSize"
|
|
5797
|
+
[virtualScrollOptions]="params.virtualScrollOptions"
|
|
5798
|
+
[overlayOptions]="params.overlayOptions"
|
|
5799
|
+
[size]="params.size"
|
|
5800
|
+
[ariaFilterLabel]="params.ariaFilterLabel"
|
|
5801
|
+
[ariaLabel]="params.ariaLabel"
|
|
5802
|
+
[ariaLabelledBy]="params.ariaLabelledBy"
|
|
5803
|
+
[filterMatchMode]="params.filterMatchMode"
|
|
5804
|
+
[maxlength]="params.maxlength"
|
|
5805
|
+
[tooltip]="params.tooltip"
|
|
5806
|
+
[tooltipPosition]="params.tooltipPosition || 'right'"
|
|
5807
|
+
[tooltipPositionStyle]="params.tooltipPositionStyle || 'absolute'"
|
|
5808
|
+
[tooltipStyleClass]="params.tooltipStyleClass"
|
|
5809
|
+
[focusOnHover]="params.focusOnHover == undefined ? true : params.focusOnHover"
|
|
5810
|
+
[fluid]="params.fluid == undefined ? true : params.fluid"
|
|
5811
|
+
[filterValue]="params.filterValue"
|
|
5812
|
+
(onChange)="onChange($event)" />
|
|
5813
|
+
}
|
|
5814
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i3$1.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$6.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"] }, { kind: "component", type: MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "fluid", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "size", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }] }); }
|
|
5815
|
+
}
|
|
5816
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CellEditAsyncSelectFieldComponent, decorators: [{
|
|
5817
|
+
type: Component,
|
|
5818
|
+
args: [{
|
|
5819
|
+
standalone: true,
|
|
5820
|
+
template: `
|
|
5821
|
+
@if (params.multiple) {
|
|
5822
|
+
<p-multiselect
|
|
5823
|
+
[(ngModel)]="value"
|
|
5824
|
+
[scrollHeight]="params.scrollHeight || '200px'"
|
|
5825
|
+
[filter]="params.filter"
|
|
5826
|
+
[name]="params.name"
|
|
5827
|
+
[options]="params.options"
|
|
5828
|
+
[placeholder]="params.placeholder"
|
|
5829
|
+
[class]="params.class"
|
|
5830
|
+
[style]="params.style"
|
|
5831
|
+
[panelStyle]="params.panelStyle"
|
|
5832
|
+
[panelStyleClass]="params.panelStyleClass"
|
|
5833
|
+
[readonly]="params.readonly"
|
|
5834
|
+
[appendTo]="params.appendTo || 'body'"
|
|
5835
|
+
[tabindex]="params.tabindex"
|
|
5836
|
+
[loadingIcon]="params.loadingIcon"
|
|
5837
|
+
[filterPlaceHolder]="params.filterPlaceHolder || params.filterPlaceholder"
|
|
5838
|
+
[filterLocale]="params.filterLocale"
|
|
5839
|
+
[variant]="params.variant"
|
|
5840
|
+
[inputId]="params.inputId"
|
|
5841
|
+
[dataKey]="params.dataKey"
|
|
5842
|
+
[filterBy]="params.filterBy"
|
|
5843
|
+
[filterFields]="params.filterFields"
|
|
5844
|
+
[autofocus]="params.autofocus ?? true"
|
|
5845
|
+
[resetFilterOnHide]="params.resetFilterOnHide"
|
|
5846
|
+
[dropdownIcon]="params.dropdownIcon"
|
|
5847
|
+
[loading]="params.loading"
|
|
5848
|
+
[optionLabel]="params.optionLabel"
|
|
5849
|
+
[optionValue]="params.optionValue"
|
|
5850
|
+
[optionDisabled]="params.optionDisabled"
|
|
5851
|
+
[optionGroupLabel]="params.optionGroupLabel"
|
|
5852
|
+
[optionGroupChildren]="params.optionGroupChildren || 'items'"
|
|
5853
|
+
[group]="params.group"
|
|
5854
|
+
[showClear]="params.showClear"
|
|
5855
|
+
[emptyFilterMessage]="params.emptyFilterMessage"
|
|
5856
|
+
[emptyMessage]="params.emptyMessage"
|
|
5857
|
+
[lazy]="params.lazy"
|
|
5858
|
+
[virtualScroll]="params.virtualScroll"
|
|
5859
|
+
[virtualScrollItemSize]="params.virtualScrollItemSize"
|
|
5860
|
+
[virtualScrollOptions]="params.virtualScrollOptions"
|
|
5861
|
+
[overlayOptions]="params.overlayOptions"
|
|
5862
|
+
[size]="params.size"
|
|
5863
|
+
[ariaFilterLabel]="params.ariaFilterLabel"
|
|
5864
|
+
[ariaLabel]="params.ariaLabel"
|
|
5865
|
+
[ariaLabelledBy]="params.ariaLabelledBy"
|
|
5866
|
+
[filterMatchMode]="params.filterMatchMode"
|
|
5867
|
+
[maxlength]="params.maxlength"
|
|
5868
|
+
[tooltip]="params.tooltip"
|
|
5869
|
+
[tooltipPosition]="params.tooltipPosition || 'right'"
|
|
5870
|
+
[tooltipPositionStyle]="params.tooltipPositionStyle || 'absolute'"
|
|
5871
|
+
[tooltipStyleClass]="params.tooltipStyleClass"
|
|
5872
|
+
[focusOnHover]="params.focusOnHover == undefined ? true : params.focusOnHover"
|
|
5873
|
+
[fluid]="params.fluid == undefined ? true : params.fluid"
|
|
5874
|
+
[filterValue]="params.filterValue"
|
|
5875
|
+
[display]="params.display ?? 'comma'"
|
|
5876
|
+
[displaySelectedLabel]="params.displaySelectedLabel ?? true"
|
|
5877
|
+
[maxSelectedLabels]="params.maxSelectedLabels"
|
|
5878
|
+
[selectionLimit]="params.selectionLimit"
|
|
5879
|
+
[selectedItemsLabel]="params.selectedItemsLabel"
|
|
5880
|
+
[showToggleAll]="params.showToggleAll ?? true"
|
|
5881
|
+
[showHeader]="params.showHeader ?? true"
|
|
5882
|
+
[autofocusFilter]="params.autofocusFilter"
|
|
5883
|
+
[selectAll]="params.selectAll ?? null"
|
|
5884
|
+
[selectOnFocus]="params.selectOnFocus"
|
|
5885
|
+
[autoOptionFocus]="params.autoOptionFocus"
|
|
5886
|
+
(onChange)="onChange($event)" />
|
|
5887
|
+
} @else {
|
|
5888
|
+
<p-select
|
|
5889
|
+
[(ngModel)]="value"
|
|
5890
|
+
[scrollHeight]="params.scrollHeight || '200px'"
|
|
5891
|
+
[filter]="params.filter"
|
|
5892
|
+
[name]="params.name"
|
|
5893
|
+
[options]="params.options"
|
|
5894
|
+
[placeholder]="params.placeholder"
|
|
5895
|
+
[class]="params.class"
|
|
5896
|
+
[style]="params.style"
|
|
5897
|
+
[panelStyle]="params.panelStyle"
|
|
5898
|
+
[panelStyleClass]="params.panelStyleClass"
|
|
5899
|
+
[readonly]="params.readonly"
|
|
5900
|
+
[editable]="params.editable"
|
|
5901
|
+
[appendTo]="params.appendTo || 'body'"
|
|
5902
|
+
[tabindex]="params.tabindex"
|
|
5903
|
+
[loadingIcon]="params.loadingIcon"
|
|
5904
|
+
[filterPlaceholder]="params.filterPlaceholder"
|
|
5905
|
+
[filterLocale]="params.filterLocale"
|
|
5906
|
+
[variant]="params.variant"
|
|
5907
|
+
[inputId]="params.inputId"
|
|
5908
|
+
[dataKey]="params.dataKey"
|
|
5909
|
+
[filterBy]="params.filterBy"
|
|
5910
|
+
[filterFields]="params.filterFields"
|
|
5911
|
+
[autofocus]="params.autofocus ?? true"
|
|
5912
|
+
[resetFilterOnHide]="params.resetFilterOnHide"
|
|
5913
|
+
[checkmark]="params.checkmark"
|
|
5914
|
+
[dropdownIcon]="params.dropdownIcon"
|
|
5915
|
+
[loading]="params.loading"
|
|
5916
|
+
[optionLabel]="params.optionLabel"
|
|
5917
|
+
[optionValue]="params.optionValue"
|
|
5918
|
+
[optionDisabled]="params.optionDisabled"
|
|
5919
|
+
[optionGroupLabel]="params.optionGroupLabel"
|
|
5920
|
+
[optionGroupChildren]="params.optionGroupChildren || 'items'"
|
|
5921
|
+
[group]="params.group"
|
|
5922
|
+
[showClear]="params.showClear"
|
|
5923
|
+
[emptyFilterMessage]="params.emptyFilterMessage"
|
|
5924
|
+
[emptyMessage]="params.emptyMessage"
|
|
5925
|
+
[lazy]="params.lazy"
|
|
5926
|
+
[virtualScroll]="params.virtualScroll"
|
|
5927
|
+
[virtualScrollItemSize]="params.virtualScrollItemSize"
|
|
5928
|
+
[virtualScrollOptions]="params.virtualScrollOptions"
|
|
5929
|
+
[overlayOptions]="params.overlayOptions"
|
|
5930
|
+
[size]="params.size"
|
|
5931
|
+
[ariaFilterLabel]="params.ariaFilterLabel"
|
|
5932
|
+
[ariaLabel]="params.ariaLabel"
|
|
5933
|
+
[ariaLabelledBy]="params.ariaLabelledBy"
|
|
5934
|
+
[filterMatchMode]="params.filterMatchMode"
|
|
5935
|
+
[maxlength]="params.maxlength"
|
|
5936
|
+
[tooltip]="params.tooltip"
|
|
5937
|
+
[tooltipPosition]="params.tooltipPosition || 'right'"
|
|
5938
|
+
[tooltipPositionStyle]="params.tooltipPositionStyle || 'absolute'"
|
|
5939
|
+
[tooltipStyleClass]="params.tooltipStyleClass"
|
|
5940
|
+
[focusOnHover]="params.focusOnHover == undefined ? true : params.focusOnHover"
|
|
5941
|
+
[fluid]="params.fluid == undefined ? true : params.fluid"
|
|
5942
|
+
[filterValue]="params.filterValue"
|
|
5943
|
+
(onChange)="onChange($event)" />
|
|
5944
|
+
}
|
|
5945
|
+
`,
|
|
5946
|
+
imports: [FormsModule, ReactiveFormsModule, SelectModule, MultiSelect],
|
|
5947
|
+
}]
|
|
5948
|
+
}], propDecorators: { input: [{
|
|
5949
|
+
type: ViewChild,
|
|
5950
|
+
args: ['input', { read: ViewContainerRef }]
|
|
5951
|
+
}] } });
|
|
5952
|
+
|
|
5506
5953
|
class CellEditAutoCompleteComponent {
|
|
5507
5954
|
agInit(params) {
|
|
5508
5955
|
this.params = params;
|
|
@@ -6188,6 +6635,103 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
6188
6635
|
>`, styles: [".cell-link{color:var(--p-primary-color);cursor:pointer}\n"] }]
|
|
6189
6636
|
}] });
|
|
6190
6637
|
|
|
6638
|
+
class AsyncSelectLabelRenderer {
|
|
6639
|
+
constructor() {
|
|
6640
|
+
this.label = '';
|
|
6641
|
+
this.loadId = 0;
|
|
6642
|
+
}
|
|
6643
|
+
agInit(params) {
|
|
6644
|
+
this.refresh(params);
|
|
6645
|
+
}
|
|
6646
|
+
refresh(params) {
|
|
6647
|
+
this.params = this.mergeParams(params);
|
|
6648
|
+
void this.loadLabel();
|
|
6649
|
+
return true;
|
|
6650
|
+
}
|
|
6651
|
+
async loadLabel() {
|
|
6652
|
+
const loadId = ++this.loadId;
|
|
6653
|
+
const value = this.params.value ?? this.params.data?.[this.params.colDef.field];
|
|
6654
|
+
if (value === '' || value == null) {
|
|
6655
|
+
this.label = '';
|
|
6656
|
+
return;
|
|
6657
|
+
}
|
|
6658
|
+
const context = this.createContext(value);
|
|
6659
|
+
try {
|
|
6660
|
+
const options = await resolveAsyncSelectOptions(this.params, context);
|
|
6661
|
+
if (loadId !== this.loadId) {
|
|
6662
|
+
return;
|
|
6663
|
+
}
|
|
6664
|
+
this.label = this.formatLabel(value, options);
|
|
6665
|
+
}
|
|
6666
|
+
catch {
|
|
6667
|
+
if (loadId === this.loadId) {
|
|
6668
|
+
this.label = String(value);
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
}
|
|
6672
|
+
mergeParams(params) {
|
|
6673
|
+
const cellEditorParams = params.colDef?.cellEditorParams || {};
|
|
6674
|
+
return {
|
|
6675
|
+
...cellEditorParams,
|
|
6676
|
+
...params,
|
|
6677
|
+
optionLabel: params.optionLabel || cellEditorParams.optionLabel || 'label',
|
|
6678
|
+
optionValue: params.optionValue || cellEditorParams.optionValue || 'value',
|
|
6679
|
+
multiple: params.multiple ?? cellEditorParams.multiple,
|
|
6680
|
+
};
|
|
6681
|
+
}
|
|
6682
|
+
createContext(value) {
|
|
6683
|
+
return {
|
|
6684
|
+
data: this.params.data,
|
|
6685
|
+
value: this.params.multiple ? this.toValueString(value) : value,
|
|
6686
|
+
params: this.params,
|
|
6687
|
+
field: this.params.colDef.field,
|
|
6688
|
+
colDef: this.params.colDef,
|
|
6689
|
+
rowIndex: this.params.node?.rowIndex,
|
|
6690
|
+
};
|
|
6691
|
+
}
|
|
6692
|
+
formatLabel(value, options) {
|
|
6693
|
+
const valueField = this.params.optionValue || 'value';
|
|
6694
|
+
const labelField = this.params.optionLabel || 'label';
|
|
6695
|
+
if (this.params.multiple) {
|
|
6696
|
+
const values = this.toValueArray(value);
|
|
6697
|
+
const labels = values.map((item) => {
|
|
6698
|
+
const option = options.find((opt) => opt?.[valueField] == item);
|
|
6699
|
+
return option ? option?.[labelField] : item;
|
|
6700
|
+
});
|
|
6701
|
+
return labels.filter((item) => item !== undefined && item !== null && item !== '').join(',');
|
|
6702
|
+
}
|
|
6703
|
+
const option = options.find((opt) => opt?.[valueField] == value);
|
|
6704
|
+
return option ? option?.[labelField] : String(value);
|
|
6705
|
+
}
|
|
6706
|
+
toValueArray(value) {
|
|
6707
|
+
if (Array.isArray(value)) {
|
|
6708
|
+
return value;
|
|
6709
|
+
}
|
|
6710
|
+
if (value === '' || value == null) {
|
|
6711
|
+
return [];
|
|
6712
|
+
}
|
|
6713
|
+
return String(value).split(',').filter((item) => item !== '');
|
|
6714
|
+
}
|
|
6715
|
+
toValueString(value) {
|
|
6716
|
+
if (Array.isArray(value)) {
|
|
6717
|
+
return value.filter((item) => item !== '' && item != null).join(',');
|
|
6718
|
+
}
|
|
6719
|
+
if (value === '' || value == null) {
|
|
6720
|
+
return '';
|
|
6721
|
+
}
|
|
6722
|
+
return String(value);
|
|
6723
|
+
}
|
|
6724
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AsyncSelectLabelRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6725
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: AsyncSelectLabelRenderer, isStandalone: true, selector: "ng-component", ngImport: i0, template: `{{ label }}`, isInline: true }); }
|
|
6726
|
+
}
|
|
6727
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AsyncSelectLabelRenderer, decorators: [{
|
|
6728
|
+
type: Component,
|
|
6729
|
+
args: [{
|
|
6730
|
+
standalone: true,
|
|
6731
|
+
template: `{{ label }}`,
|
|
6732
|
+
}]
|
|
6733
|
+
}] });
|
|
6734
|
+
|
|
6191
6735
|
// rowModelType 使用clientSide的最大值
|
|
6192
6736
|
const CLIENTLIMIT = 9999;
|
|
6193
6737
|
const components = {
|
|
@@ -6202,8 +6746,10 @@ const components = {
|
|
|
6202
6746
|
cellEditInputDateComponent: CellEditInputDateComponent,
|
|
6203
6747
|
rowSpanRenderer: RowSpanRenderer,
|
|
6204
6748
|
cellEditSelectFieldComponent: CellEditSelectFieldComponent,
|
|
6749
|
+
cellEditAsyncSelectFieldComponent: CellEditAsyncSelectFieldComponent,
|
|
6205
6750
|
primeActionsRenderer: PrimeActionsRenderer,
|
|
6206
|
-
asyncLinkRenderer: AsyncLinkRenderer
|
|
6751
|
+
asyncLinkRenderer: AsyncLinkRenderer,
|
|
6752
|
+
asyncSelectLabelRenderer: AsyncSelectLabelRenderer
|
|
6207
6753
|
};
|
|
6208
6754
|
|
|
6209
6755
|
const defaultOption = {
|
|
@@ -11534,5 +12080,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
11534
12080
|
* Generated bundle index. Do not edit.
|
|
11535
12081
|
*/
|
|
11536
12082
|
|
|
11537
|
-
export { ActionService, ActionsComponent, AmComponent, AsyncRenderer, 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, UserHistoryService, calcRowSpan, changeContent, clearLocal, compileTsToJs, convertAct, convertCol, convertForm, convertGrid, createCircularIterator, deepClone, executeRuntimeContextInit, filterObjectByKeys, formTypeToProps, generateUniqueId, getFilterMatchMode, gridOptionsHooker, gridUtils, isJSONParsable, pageListGridOptions, parseFunctions, toPascalCase, wrapHeaderValueGetter };
|
|
12083
|
+
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, UserHistoryService, calcRowSpan, changeContent, clearLocal, compileTsToJs, convertAct, convertCol, convertForm, convertGrid, createCircularIterator, deepClone, executeRuntimeContextInit, filterObjectByKeys, formTypeToProps, generateUniqueId, getFilterMatchMode, gridOptionsHooker, gridUtils, isJSONParsable, pageListGridOptions, parseFunctions, toPascalCase, wrapHeaderValueGetter };
|
|
11538
12084
|
//# sourceMappingURL=imm-element-ui.mjs.map
|