Skip to content

Commit f6e1512

Browse files
author
pipeline
committed
v29.1.33 is released
1 parent e458139 commit f6e1512

File tree

749 files changed

+22744
-8134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

749 files changed

+22744
-8134
lines changed

config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
"dropdown-button",
132132
"virtualize",
133133
"textarea",
134-
"keytip",
135-
null
134+
"keytip"
136135
]
137136
}

index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ <h1 class='sb-sample-text' role="heading" aria-level="1"></h1>
393393
<div class="sb-footer">
394394
<div class="sb-footer-left">
395395
<div class="sb-footer-links">
396-
<a href="http://ej2.syncfusion.com/react/documentation" target="_blank" aria-label="Documentation - Opens in a new window">
396+
<a href="http://ej2.syncfusion.com/react/documentation/introduction" target="_blank" aria-label="Documentation - Opens in a new window">
397397
<div class="sb-footer-link">Documentation</div>
398398
</a>
399399
<a href="https://www.syncfusion.com/forums/react-js2" target="_blank" aria-label="Forum - Opens in a new window">
@@ -445,6 +445,12 @@ <h1 class='sb-sample-text' role="heading" aria-level="1"></h1>
445445
</div>
446446

447447
</div>
448+
<script>
449+
// Hide the "FREE TRIAL" button on localhost
450+
if (window.location.hostname === "localhost") {
451+
document.getElementById('download-now').style.display = 'none';
452+
}
453+
</script>
448454
<script id="template" type="text/x-template">
449455
<a href="${link}" target="_blank">${name}</a>
450456
</script>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@syncfusion/ej2-react-samples",
3-
"version": "28.1.33",
3+
"version": "29.1.33",
44
"description": "Examples of React UI Components",
55
"author": "Syncfusion Inc.",
66
"license": "SEE LICENSE IN license",

sampleName.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,27 +826,37 @@
826826
"pivot-table": {
827827
"ControlName": "Pivot Table",
828828
"Samples": {
829+
"overview": "Overview",
829830
"default": "Default Functionalities",
831+
"classic-layout": "Classic Layout",
832+
"live-data": "Live Data",
830833
"local": "Local Data",
831834
"remote": "Remote Data",
835+
"server-side-aggregation": "Server-Side Aggregation",
832836
"olap": "OLAP",
837+
"performance": "Performance",
833838
"pivot-chart": "Pivot Chart",
834839
"external-binding": "External Binding",
840+
"heatmap": "HeatMap",
835841
"field-list": "Field List",
836842
"grouping-bar": "Grouping Bar",
837843
"conditional-formatting": "Conditional Formatting",
838844
"selection": "Selection",
845+
"drill-down": "Drill Down",
839846
"summary-customization": "Show/Hide Totals",
840847
"grouping": "Grouping",
841848
"tool-bar": "Toolbar",
849+
"keyboard-navigation": "Keyboard Navigation",
842850
"calculated-field": "Calculated Field",
843851
"aggregation": "Aggregation",
844852
"sorting": "Default Sorting",
853+
"custom-sorting": "Custom Sorting",
845854
"value-sorting": "Value Sorting",
846855
"filtering": "Default Filtering",
847856
"label-filtering": "Label Filtering",
848857
"value-filtering": "Value Filtering",
849858
"virtual-scrolling": "Virtual Scrolling",
859+
"paging": "Paging",
850860
"cell-template": "Cell Template",
851861
"drill-through": "Drill Through",
852862
"editing": "Editing",
@@ -913,6 +923,7 @@
913923
"Samples": {
914924
"default":"Default Functionalities",
915925
"custom-views": "Custom Views",
926+
"streaming": "Streaming Response",
916927
"template": "Template",
917928
"dialog": "Dialog"
918929
}
@@ -921,6 +932,7 @@
921932
"ControlName": "Chat UI",
922933
"Samples": {
923934
"default":"Default Functionalities",
935+
"loadOn-demand": "Load On-demand",
924936
"template": "Template",
925937
"api": "API",
926938
"chat-integration": "Use Case"
@@ -1102,7 +1114,7 @@
11021114
"default": "Default Functionalities",
11031115
"formula": "Formula",
11041116
"protect-sheet": "Protect Sheet",
1105-
"freeze-panes": "Freeze Panes",
1117+
"freeze-pane": "Freeze Panes",
11061118
"data-validation": "Data Validation",
11071119
"hyperlink": "Hyperlink",
11081120
"cell-data-binding": "Cell Data Binding",
@@ -1114,7 +1126,7 @@
11141126
"chart": "Chart",
11151127
"image": "Image",
11161128
"cell-template": "Cell Template",
1117-
"note": "Note",
1129+
"notes": "Note",
11181130
"print": "Print"
11191131
}
11201132
},
@@ -1312,5 +1324,13 @@
13121324
"file-upload-with-forms": "Form Support",
13131325
"custom-drop-area": "Custom Drop Area"
13141326
}
1327+
},
1328+
"speech-to-text": {
1329+
"ControlName": "Speech TocText",
1330+
"Samples": {
1331+
"default": "Default Functionalities",
1332+
"use-case": "Use Case",
1333+
"integration": "Ai-Assistview"
1334+
}
13151335
}
13161336
}

src/ai-assistview/config.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ export const AIAssistViewSampleOrder: Object = [
2525
{ 'displayName': 'promptResponseData.json', 'path': 'src/ai-assistview/promptResponseData.json' }
2626
]
2727
},
28+
{ 'path': 'ai-assistview/streaming',
29+
'component': 'Streaming',
30+
'name': 'Streaming Response',
31+
'description':'Showcases the AI AssistView component in React, highlighting the streaming support how response is updated in chunks.',
32+
'order': '01',
33+
'type': 'new',
34+
'category': 'AI AssistView',
35+
'api':'{"AIAssitView": ["promptRequest", "promptSuggestions", "bannerTemplate", "toolbarSettings"] }',
36+
'sourceFiles': [
37+
{ 'displayName': 'streaming.tsx', 'path': 'src/ai-assistview/streaming.tsx' },
38+
{ 'displayName': 'streaming.jsx', 'path': 'src/ai-assistview/streaming.jsx' },
39+
{ 'displayName': 'promptResponseData.json', 'path': 'src/ai-assistview/promptResponseData.json' }
40+
]
41+
},
2842
{ 'path': 'ai-assistview/template',
2943
'component': 'Template',
3044
'name': 'Template',

src/ai-assistview/default.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class Default extends SampleBase<{}, {}> {
2929

3030
assistInstance: AIAssistViewComponent;
3131

32-
bannerTemplate: `<div class="banner-content">
32+
bannerTemplate: string = `<div class="banner-content">
3333
<div class="e-icons e-assistview-icon"></div>
3434
<h3>AI Assistance</h3>
3535
<i>To get started, provide input or choose a suggestion.</i>
@@ -50,7 +50,7 @@ export class Default extends SampleBase<{}, {}> {
5050
<div className='control-pane'>
5151
<div className="control-section">
5252
<div className="default-aiassistview">
53-
<AIAssistViewComponent id="aiAssistView" bannerTemplate={this.bannerTemplate} promptSuggestions={this.suggestion} promptRequest={this.promptRequest} ref={aiassistView => (this.assistInstance = aiassistView)}></AIAssistViewComponent>
53+
<AIAssistViewComponent id="aiAssistView" toolbarSettings={this.assistViewToolbarSettings} bannerTemplate={this.bannerTemplate} promptSuggestions={this.suggestion} promptRequest={this.promptRequest} ref={aiassistView => (this.assistInstance = aiassistView)}></AIAssistViewComponent>
5454
</div>
5555
</div>
5656

src/ai-assistview/promptResponseData.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,44 @@
3636
"defaultSuggestions": [
3737
"How do I set daily goals in my work day?",
3838
"Steps to publish a e-book with marketing strategy"
39+
],
40+
"streamingSuggestions": [
41+
"What are the main features of the AI AssistView component?",
42+
"What is Markdown and how is it used?"
43+
],
44+
"streamingPromptResponseData": [
45+
{
46+
"prompt": "What are the main features of the AI AssistView component?",
47+
"response": "The AI AssistView component offers several powerful features that enhance user interaction:\n\n- **Customizable Views:** Allows for custom templates to be used for banners, prompts, responses, and suggestions.\n- **Streaming Responses:** Provides real-time feedback as data is processed, enhancing immediacy and user engagement.\n- **Interactive Toolbar:** Easily integrates custom toolbar items, such as buttons and inputs, enhancing functionality.\n- **Seamless Integration:** Connects with AI services to provide advanced processing and intelligent responses.",
48+
"suggestions": [ "How can I customize the appearance of AI AssistView?", "What are the benefits of using Markdown?" ]
49+
},
50+
{
51+
"prompt": "How can I customize the appearance of AI AssistView?",
52+
"response": "Customizing AI AssistView enables you to tailor the look and functionality to suit specific needs:\n\n- **Template Customization:** Modify templates for prompts, responses, and more.\n- **CSS Styling:** Apply custom styles to align with your application’s visual theme.\n- **Theme Support:** Utilize built-in themes or create your own for consistent styling.\n- **Banner and Toolbar Configurations:** Adjust content and tools for personalized UI experiences.",
53+
"suggestions": [ "What customization options are available in AI AssistView?", "Prime number checking C# example?" ]
54+
},
55+
{
56+
"prompt": "What is Markdown and how is it used?",
57+
"response": "Markdown is a straightforward syntax used primarily for formatting text documents:\n\n- **Headers:** Create headings with `#`, `##`, `###` for different levels.\n- **Emphasis:** Use `*text*` for italic and `**text**` for bold.\n- **Links and Images:** `[Link](URL)`, `![Alt Text](ImageURL)` to include links and images.\n- **Lists and Code Blocks:** Use `-` for lists and triple backticks ``` for code blocks.\n\nMarkdown’s simplicity and readability make it ideal for writing documentation.",
58+
"suggestions": [ "What are the benefits of using Markdown?", "What customization options are available in AI AssistView?" ]
59+
},
60+
{
61+
"prompt": "What customization options are available in AI AssistView?",
62+
"response": "AI AssistView provides extensive customization options for tailored user interactions:\n\n- **Templates:** Use `<PromptItemTemplate>`, `<ResponseItemTemplate>`, etc., for customized display.\n- **Custom Toolbar Items:** Add buttons and other controls via `AssistViewToolbar`.\n- **Dynamic Content:** Update content based on user actions or external events.\n- **Styling:** Full CSS support for styling individual components and layouts.",
63+
"suggestions": [ "What are the main features of the AI AssistView component?", "Generate Fibonacci sequence C# example?" ]
64+
},
65+
{
66+
"prompt": "What are the benefits of using Markdown?",
67+
"response": "Markdown provides several benefits, especially in documentation and writing:\n\n- **Ease of Use:** Its syntax is simple and quick to learn, increasing productivity.\n- **Readability:** Plain text format ensures content is easy to read and edit.\n- **Flexibility:** Can be converted to HTML, PDF, and other formats easily.\n- **Collaboration:** Widely supported in various tools for collaborative writing and documentation.",
68+
"suggestions": ["Prime number checking C# example?", "Generate Fibonacci sequence C# example?"]
69+
},
70+
{
71+
"prompt": "Prime number checking C# example?",
72+
"response": "<pre><code class=\"csharp language-csharp\">using System;\n\nclass Program\n{\n static bool IsPrime(int n)\n {\n if (n <= 1) return false;\n for (int i = 2; i <= Math.Sqrt(n); i++)\n if (n % i == 0) return false;\n return true;\n }\n\n static void Main()\n {\n Console.WriteLine(IsPrime(11)); // True\n }\n}\n</code></pre>"
73+
},
74+
{
75+
"prompt": "Generate Fibonacci sequence C# example?",
76+
"response": "<pre><code class=\"csharp language-csharp\">using System;\n\nclass Program\n{\n static void Fibonacci(int n)\n {\n int a = 0, b = 1, c;\n for (int i = 0; i < n; i++)\n {\n Console.Write(a + \" \");\n c = a + b;\n a = b;\n b = c;\n }\n }\n\n static void Main()\n {\n Fibonacci(10); // 0 1 1 2 3 5 8 13 21 34\n }\n}\n</code></pre>"
77+
}
3978
]
4079
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import * as React from 'react';
2+
import { useEffect, useRef } from 'react';
3+
import { updateSampleSection } from '../common/sample-base';
4+
import './streaming.css';
5+
import { AIAssistViewComponent, PromptRequestEventArgs, ToolbarSettingsModel } from '@syncfusion/ej2-react-interactive-chat';
6+
import * as data from './promptResponseData.json';
7+
import * as Marked from 'marked';
8+
9+
const Streaming = () => {
10+
useEffect(() => {
11+
updateSampleSection();
12+
}, []);
13+
14+
const streamingAIAssistView = useRef<AIAssistViewComponent>(null);
15+
let stopStreaming: boolean = false;
16+
const bannerTemplate: string = `<div class="banner-content">
17+
<div class="e-icons e-assistview-icon"></div>
18+
<h3>AI Assistance</h3>
19+
<i>To get started, provide input or choose a suggestion.</i>
20+
</div>`;
21+
22+
const prompts: any[] = data["streamingPromptResponseData"];
23+
24+
const suggestion: string[] = data["streamingSuggestions"];
25+
26+
const toolbarItemClicked = (args) => {
27+
if (args.item.iconCss === 'e-icons e-refresh') {
28+
streamingAIAssistView.current.prompts = [];
29+
streamingAIAssistView.current.promptSuggestions = suggestion;
30+
}
31+
};
32+
33+
const assistViewToolbarSettings: ToolbarSettingsModel = {
34+
items: [{ iconCss: 'e-icons e-refresh', align: 'Right' }],
35+
itemClicked: toolbarItemClicked
36+
};
37+
38+
const handleStopResponse = () => {
39+
stopStreaming = true
40+
}
41+
42+
const onPromptRequest = (args: PromptRequestEventArgs) => {
43+
let lastResponse: string = "";
44+
let streamingResponse: any = prompts.find((data: any) => data.prompt === args.prompt);
45+
const defaultResponse = "For real-time prompt processing, connect the AI AssistView control to your preferred AI service, such as OpenAI or Azure Cognitive Services. Ensure you obtain the necessary API credentials to authenticate and enable seamless integration.";
46+
const responseUpdateRate = 10;
47+
async function streamResponse(response) {
48+
let i = 0;
49+
const responseLength = response.length;
50+
while (i < responseLength && !stopStreaming) {
51+
lastResponse += response[i];
52+
i++;
53+
if (i % responseUpdateRate === 0 || i === responseLength) {
54+
const htmlResponse = Marked.marked(lastResponse);
55+
streamingAIAssistView.current.addPromptResponse(htmlResponse, i === responseLength);
56+
streamingAIAssistView.current.scrollToBottom();
57+
}
58+
await new Promise(resolve => setTimeout(resolve, 15)); // Delay before the next chunk
59+
}
60+
streamingAIAssistView.current.promptSuggestions = streamingResponse?.suggestions || suggestion;
61+
}
62+
if (streamingResponse) {
63+
stopStreaming = false;
64+
streamResponse(streamingResponse.response);
65+
} else {
66+
streamingAIAssistView.current.addPromptResponse(defaultResponse, true);
67+
streamingAIAssistView.current.promptSuggestions = suggestion;
68+
}
69+
}
70+
71+
return (
72+
<div className='control-pane'>
73+
<div className="control-section">
74+
<div className="stream-aiassistview">
75+
<AIAssistViewComponent id="streamAssistView" ref={streamingAIAssistView} promptSuggestions={suggestion} toolbarSettings={assistViewToolbarSettings} promptRequest={onPromptRequest} stopRespondingClick={handleStopResponse} bannerTemplate={bannerTemplate}></AIAssistViewComponent>
76+
</div>
77+
</div>
78+
79+
<div id="action-description">
80+
<p>
81+
This sample demonstrates the streaming response update in the <code>AI AssistView</code> component.
82+
</p>
83+
</div>
84+
<div id="description">
85+
<p>
86+
In this example, the <code>AI AssistView</code> component dynamically updates responses in a streaming manner using the <code>addPromptResponse</code> method, while the <code>scrollToBottom</code> method ensures automatic scrolling. The <code>bannerTemplate</code> allows customization of the banner content, and <code>toolbarSettings</code> enables custom toolbar items, including a right-aligned Refresh button. Additionally, <code>promptSuggestions</code> offers AI-generated prompt suggestions, while <code>promptRequest</code> processes prompt requests when triggered.
87+
</p>
88+
<p>
89+
This implementation provides an interactive AI chat experience with real-time streaming updates, enhanced by Markdown-to-HTML conversion using the <code>Marked</code> plugin.
90+
</p>
91+
</div>
92+
</div>
93+
);
94+
}
95+
export default Streaming;

src/ai-assistview/streaming.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.stream-aiassistview {
2+
height: 600px;
3+
width: 60vw;
4+
margin: 0 auto;
5+
}
6+
7+
.stream-aiassistview .banner-content .e-assistview-icon:before {
8+
font-size: 35px;
9+
}
10+
11+
.stream-aiassistview .banner-content {
12+
display: flex;
13+
flex-direction: column;
14+
justify-content: center;
15+
height: 330px;
16+
text-align: center;
17+
}
18+
19+
@media only screen and (max-width: 750px) {
20+
.stream-aiassistview {
21+
width: 100%;
22+
}
23+
}

0 commit comments

Comments
 (0)