-
Notifications
You must be signed in to change notification settings - Fork 672
DataGrid/TreeList: Implement AiPromptEditor #31289
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
Merged
Alyar666
merged 31 commits into
DevExpress:25_2
from
Alyar666:datagrid_ai_prompt_editor_25_2
Oct 17, 2025
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
08155a7
Implement the AiPromptEditor base
1e02630
Add Regenerate Data and Apply buttons
897fe94
Add localizations
bcd71c6
Add title, height and width for Popup
324723f
Add localizations for popup title
6a40316
Implement updating disabled state for buttons
2dc710d
Code refactoring - remove async operations. Change height to 'auto'. …
b6fd0de
Implement positioning relative to headers
32f61bc
Rename updateApplyAndStopButtonsVisibility -> toggleApplyButtonVisibi…
f1221c5
Add progressbar
4788dbe
Prepare AiColumnController and AiColumnIntegrationController for use …
313a1c0
Implement AiPromptEditor state update
407859b
Add cancellation of the request when hiding the AiPromptEditor. Add s…
d88305a
Add icons to buttons. Enable resizing and dragging for popup. Add min…
6722108
Show stop button when clicking on the Regenerate Data button
be5c54b
Fix tests
557c597
Fix the sendAiColumnRequest method
62a9032
Add storybook example
758fde1
Add placeholder for TextArea
c33fe9e
Rename AIPrompEditor.value -> AIPrompEditor.prompt
01ada70
add the 'wrapInstance' helper for jest tests
d4f29aa
Fix test
8bf66cb
Fix test (part 2)
6ad2133
Update localization messages after review
4f9fece
Fix minor issues. And a little code refactoring
c800bda
Fix popup positioning issue after reordering AI column
4331e7c
Create POM for textarea, button and progressbar components
e9d271f
Add the 'dx-aidialog' class
f9e44e9
Disable the resizeEnabled option
6b42e17
Set a constant height for TextArea
aaff650
Fix updating states for the Apply and Regenerate Data buttons
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/devextreme/js/__internal/grids/grid_core/__tests__/__mock__/helpers/wrapInstance.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { jest } from '@jest/globals'; | ||
|
|
||
| export default function wrapInstance<T extends object>(instance: T): T { | ||
| const proto = Object.getPrototypeOf(instance); | ||
|
|
||
| (Object.getOwnPropertyNames(proto) as (keyof T)[]).forEach((key): void => { | ||
| const originalValue = instance[key]; | ||
| if (typeof originalValue === 'function' && key !== 'constructor') { | ||
| const originalMethod = originalValue as (...a: unknown[]) => unknown; | ||
|
|
||
| instance[key] = jest.fn(originalMethod.bind(instance)) as T[typeof key]; | ||
| } | ||
| }); | ||
|
|
||
| return instance; | ||
| } |
71 changes: 71 additions & 0 deletions
71
...ges/devextreme/js/__internal/grids/grid_core/__tests__/__mock__/model/ai_prompt_editor.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import Popup from '@js/ui/popup'; | ||
| import { ProgressBarModel } from '@ts/ui/__tests__/__mock__/model/progress_bar'; | ||
| import { TextAreaModel } from '@ts/ui/__tests__/__mock__/model/text_area'; | ||
| import { ButtonModel } from '@ts/ui/button/__tests__/__mock__/model/button'; | ||
|
|
||
| const CLASSES = { | ||
| wrapper: 'dx-overlay-wrapper', | ||
| toolbarItem: 'dx-toolbar-item', | ||
| stateInvisible: 'dx-state-invisible', | ||
| stateDisabled: 'dx-state-disabled', | ||
| aiPromptEditor: 'dx-ai-prompt-editor', | ||
| aiPromptEditorTextArea: 'dx-ai-prompt-editor__text-area', | ||
| aiPromptEditorRefreshButton: 'dx-ai-prompt-editor__refresh-button', | ||
| aiPromptEditorApplyButton: 'dx-ai-prompt-editor__apply-button', | ||
| aiPromptEditorStopButton: 'dx-ai-prompt-editor__stop-button', | ||
| aiPromptEditorProgressBar: 'dx-ai-prompt-editor__progressbar', | ||
| }; | ||
|
|
||
| export class AiPromptEditorModel { | ||
| constructor(protected readonly root: HTMLElement) {} | ||
|
|
||
| public isVisible(): boolean { | ||
| return this.getWrapperElement() !== null; | ||
| } | ||
|
|
||
| public getPopupInstance(): Popup { | ||
| return Popup.getInstance(this.root) as Popup; | ||
| } | ||
|
|
||
| public getTextArea(): TextAreaModel { | ||
| return new TextAreaModel( | ||
| this.getWrapperElement().querySelector(`.${CLASSES.aiPromptEditorTextArea}`) as HTMLElement, | ||
| ); | ||
| } | ||
|
|
||
| public getWrapperElement(): HTMLElement { | ||
| return document.body.querySelector(`.${CLASSES.aiPromptEditor}.${CLASSES.wrapper}`) as HTMLElement; | ||
| } | ||
|
|
||
| public getRefreshButton(): ButtonModel { | ||
| return new ButtonModel(this.getWrapperElement().querySelector(`.${CLASSES.aiPromptEditorRefreshButton}`) as HTMLElement); | ||
| } | ||
|
|
||
| public getApplyButton(): ButtonModel { | ||
| return new ButtonModel(this.getWrapperElement().querySelector(`.${CLASSES.aiPromptEditorApplyButton}`) as HTMLElement); | ||
| } | ||
|
|
||
| public getStopButton(): ButtonModel { | ||
| return new ButtonModel(this.getWrapperElement().querySelector(`.${CLASSES.aiPromptEditorStopButton}`) as HTMLElement); | ||
| } | ||
|
|
||
| public getProgressBar(): ProgressBarModel { | ||
| return new ProgressBarModel( | ||
| this.getWrapperElement().querySelector(`.${CLASSES.aiPromptEditorProgressBar}`) as HTMLElement, | ||
| ); | ||
| } | ||
|
|
||
| public isApplyToolbarItemVisible(): boolean { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: I'd suggest to avoid this method too. There are two ways:
|
||
| const applyButton = this.getApplyButton().getElement(); | ||
| const toolbarItem = applyButton.closest(`.${CLASSES.toolbarItem}`); | ||
|
|
||
| return !!toolbarItem && !toolbarItem.classList.contains(CLASSES.stateInvisible); | ||
| } | ||
|
|
||
| public isStopToolbarItemVisible(): boolean { | ||
| const stopButton = this.getStopButton().getElement(); | ||
| const toolbarItem = stopButton.closest(`.${CLASSES.toolbarItem}`); | ||
|
|
||
| return !!toolbarItem && !toolbarItem.classList.contains(CLASSES.stateInvisible); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.