-
Notifications
You must be signed in to change notification settings - Fork 160
fix(elements): strip Blazor externalObject from expression tree events - 21.2.x #17252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 21.2.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ import { NgElement, NgElementStrategyEvent } from '@angular/elements'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { fromEvent, Observable } from 'rxjs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { map, takeUntil } from 'rxjs/operators'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { ComponentConfig, ContentQueryMeta } from './component-config'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { IExpressionTree, IFilteringExpression } from 'igniteui-angular/core'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { ComponentNgElementStrategy, ComponentNgElementStrategyFactory, extractProjectableNodes } from './ng-element-strategy'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { TemplateWrapperComponent } from './wrapper/wrapper.component'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -465,11 +466,30 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| protected patchOutputComponents(eventName: string, eventArgs: any) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Single out only `columnInit` event for now. If more events pop up will require a config generation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (eventName !== "columnInit") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (eventName === 'filteringExpressionsTreeChange' || eventName === 'expressionTreeChange' || eventName === 'advancedFilteringExpressionsTreeChange') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.stripExternalObject(eventArgs); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return eventArgs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return this.createProxyForComponentValue(eventArgs, 1).value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Single out only `columnInit` event for now. If more events pop up will require a config generation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (eventName === "columnInit") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return this.createProxyForComponentValue(eventArgs, 1).value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return eventArgs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| protected stripExternalObject(tree: IExpressionTree): void { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const operand of tree?.filteringOperands ?? []) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ('operator' in operand) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.stripExternalObject(operand); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| delete (operand.condition as any)?.externalObject; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ((operand as IFilteringExpression).searchTree) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.stripExternalObject(operand.searchTree); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+481
to
+492
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const operand of tree?.filteringOperands ?? []) { | |
| if ('operator' in operand) { | |
| this.stripExternalObject(operand); | |
| continue; | |
| } | |
| delete (operand.condition as any)?.externalObject; | |
| if ((operand as IFilteringExpression).searchTree) { | |
| this.stripExternalObject(operand.searchTree); | |
| } | |
| } | |
| this.stripExternalObjectFromNode(tree, new WeakSet<object>()); | |
| } | |
| protected stripExternalObjectFromNode(value: unknown, visited: WeakSet<object>): void { | |
| if (!value || typeof value !== 'object') { | |
| return; | |
| } | |
| if (visited.has(value)) { | |
| return; | |
| } | |
| visited.add(value); | |
| delete (value as { externalObject?: unknown }).externalObject; | |
| if (Array.isArray(value)) { | |
| for (const item of value) { | |
| this.stripExternalObjectFromNode(item, visited); | |
| } | |
| return; | |
| } | |
| for (const nestedValue of Object.values(value)) { | |
| this.stripExternalObjectFromNode(nestedValue, visited); | |
| } |
Uh oh!
There was an error while loading. Please reload this page.