Skip to content

Commit 7487d75

Browse files
author
pipeline
committed
v29.1.33 is released
1 parent c7e8e26 commit 7487d75

File tree

545 files changed

+13864
-10483
lines changed

Some content is hidden

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

545 files changed

+13864
-10483
lines changed

config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@
181181
"textarea",
182182
"aiassistview",
183183
"ai",
184-
"assistview",
185-
null
184+
"assistview"
186185
]
187186
}

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,4 +542,4 @@ gulp.task('serve', function(done) {
542542
};
543543
bs.init(options, done);
544544
});
545-
});
545+
});

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ <h1 class='sb-sample-text' aria-level="1" role="heading">Data Grid</h1>
455455
<div class="sb-footer">
456456
<div class="sb-footer-left">
457457
<div class="sb-footer-links">
458-
<a href="https://ej2.syncfusion.com/documentation/" target="_blank" aria-label="Documentation (Opens in a new window)">
458+
<a href="https://ej2.syncfusion.com/documentation/introduction" target="_blank" aria-label="Documentation (Opens in a new window)">
459459
<div class="sb-footer-link">Documentation</div>
460460
</a>
461461
<a href="https://www.syncfusion.com/forums/essential-js2" target="_blank" aria-label="Forum (Opens in a new window)">

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-samples",
3-
"version": "28.1.33",
3+
"version": "29.1.33",
44
"description": "Samples for Syncfusion Essential JS 2",
55
"author": "Syncfusion Inc.",
66
"license": "SEE LICENSE IN license",

sampleOrder.json

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@
639639
"Samples": {
640640
"default": "Default Functionalities",
641641
"custom-views": "Custom Views",
642+
"streaming": "Streaming Response",
642643
"template": "Template",
643644
"dialog": "Dialog"
644645
}
@@ -887,27 +888,37 @@
887888
"pivot-table": {
888889
"ControlName": "Pivot Table",
889890
"Samples": {
891+
"overview": "Overview",
890892
"default": "Default Functionalities",
893+
"classic-layout": "Classic Layout",
894+
"live-data": "Live Data",
891895
"local": "Local Data",
892896
"remote": "Remote Data",
897+
"server-side-aggregation": "Server-Side Aggregation",
893898
"olap": "OLAP",
899+
"performance": "Performance",
894900
"pivot-chart": "Pivot Chart",
895901
"external-binding": "External Binding",
902+
"heatmap": "HeatMap",
896903
"field-list": "Field List",
897904
"grouping-bar": "Grouping Bar",
898905
"conditional-formatting": "Conditional Formatting",
899906
"selection": "Selection",
907+
"drill-down": "Drill Down",
900908
"summary-customization": "Show/Hide Totals",
901909
"grouping": "Grouping",
902910
"toolbar": "Toolbar",
911+
"keyboard-navigation": "Keyboard Navigation",
903912
"calculated-field": "Calculated Field",
904913
"aggregation": "Aggregation",
905914
"sorting": "Default Sorting",
915+
"custom-sorting": "Custom Sorting",
906916
"value-sorting": "Value Sorting",
907917
"filtering": "Default Filtering",
908918
"label-filtering": "Label Filtering",
909919
"value-filtering": "Value Filtering",
910920
"virtual-scrolling": "Virtual Scrolling",
921+
"paging": "Paging",
911922
"cell-template": "Cell Template",
912923
"drill-through": "Drill Through",
913924
"editing": "Editing",
@@ -1155,12 +1166,15 @@
11551166
"Samples": {
11561167
"default": "Default Functionalities",
11571168
"formula": "Formula",
1169+
"protect-sheet": "Protect Sheet",
11581170
"cell-data-binding": "Cell Data Binding",
11591171
"remote-data-binding": "Remote Data Binding",
11601172
"cell-formatting": "Cell Formatting",
11611173
"number-formatting": "Number Formatting",
11621174
"sorting-and-filtering": "Sorting and Filtering",
1163-
"cell-template": "Cell Template"
1175+
"cell-template": "Cell Template",
1176+
"notes": "Note",
1177+
"print": "Print"
11641178
}
11651179
},
11661180
"speed-dial": {
@@ -1383,9 +1397,18 @@
13831397
"ControlName": "Chat UI",
13841398
"Samples": {
13851399
"default": "Default Functionalities",
1400+
"loadOn-demand": "Load On-demand",
13861401
"template": "Template",
13871402
"api": "API",
13881403
"chat-integration": "Use Case"
13891404
}
1405+
},
1406+
"speech-to-text": {
1407+
"ControlName": "Speech To Text",
1408+
"Samples": {
1409+
"default": "Default Functionalities",
1410+
"use-case": "Use Case",
1411+
"integration": "Assist View"
1412+
}
13901413
}
13911414
}

src/ai-assistview/promptResponseData.ts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,83 @@ export let defaultPromptResponseData: any = [
3030
export let defaultSuggestions: any = [
3131
"How do I set daily goals in my work day?",
3232
"Steps to publish a e-book with marketing strategy"
33+
];
34+
35+
export let streamingData: any = [
36+
{
37+
prompt: "What are the main features of the AI AssistView component?",
38+
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.",
39+
suggestions: [ "How can I customize the appearance of AI AssistView?", "What are the benefits of using Markdown?" ]
40+
},
41+
{
42+
prompt: "How can I customize the appearance of AI AssistView?",
43+
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.",
44+
suggestions: [ "What customization options are available in AI AssistView?", "Prime number checking C# example?" ]
45+
},
46+
{
47+
prompt: "What is Markdown and how is it used?",
48+
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.",
49+
suggestions: [ "What are the benefits of using Markdown?", "What customization options are available in AI AssistView?" ]
50+
},
51+
{
52+
prompt: "What customization options are available in AI AssistView?",
53+
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.",
54+
suggestions: ["What are the main features of the AI AssistView component?", "Generate Fibonacci sequence C# example?"]
55+
},
56+
{
57+
prompt: "What are the benefits of using Markdown?",
58+
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.",
59+
suggestions: ["Prime number checking C# example?", "Generate Fibonacci sequence C# example?"]
60+
},
61+
{
62+
prompt: "Prime number checking C# example?",
63+
response: `<pre><code class=\"csharp language-csharp\">using System;
64+
65+
class Program
66+
{
67+
static bool IsPrime(int n)
68+
{
69+
if (n <= 1) return false;
70+
for (int i = 2; i <= Math.Sqrt(n); i++)
71+
if (n % i == 0) return false;
72+
return true;
73+
}
74+
75+
static void Main()
76+
{
77+
Console.WriteLine(IsPrime(11)); // True
78+
}
79+
}
80+
</code></pre>`
81+
},
82+
{
83+
prompt: "Generate Fibonacci sequence C# example?",
84+
response: `<pre><code class=\"csharp language-csharp\">using System;
85+
86+
class Program
87+
{
88+
static void Fibonacci(int n)
89+
{
90+
int a = 0, b = 1, c;
91+
for (int i = 0; i < n; i++)
92+
{
93+
Console.Write(a + \" \");
94+
c = a + b;
95+
a = b;
96+
b = c;
97+
}
98+
}
99+
100+
static void Main()
101+
{
102+
Fibonacci(10); // 0 1 1 2 3 5 8 13 21 34
103+
}
104+
}
105+
</code></pre>`
106+
}
107+
];
108+
109+
export let streamingSuggestions: any = [
110+
"What are the main features of the AI AssistView component?",
111+
"What is Markdown and how is it used?"
33112
];

src/ai-assistview/sample.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"directory": "ai-assistview",
44
"category": "Interactive Chat",
55
"ftName": "AIAssitView",
6+
"type": "update",
67
"samples": [
78
{
89
"url": "default",
@@ -28,6 +29,19 @@
2829
{ "displayName": "promptResponseData.ts", "path":"src/ai-assistview/promptResponseData.ts" }
2930
]
3031
},
32+
{
33+
"url": "streaming",
34+
"name": "Streaming Response",
35+
"category": "AI AssistView",
36+
"type": "new",
37+
"api":{ "AIAssitView": ["promptRequest", "promptSuggestions", "bannerTemplate", "toolbarSettings"] },
38+
"description": "Showcases the AiAssistView control with its streaming support.",
39+
"sourceFiles": [
40+
{ "displayName": "streaming.ts", "path":"src/ai-assistview/streaming.ts" },
41+
{ "displayName": "streaming.html", "path":"src/ai-assistview/streaming.html" },
42+
{ "displayName": "promptResponseData.ts", "path":"src/ai-assistview/promptResponseData.ts" }
43+
]
44+
},
3145
{
3246
"url": "template",
3347
"name": "Template",

src/ai-assistview/streaming.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<div class="control-section">
2+
<div class="stream-aiassistview">
3+
<div id="streamAssistView"></div>
4+
</div>
5+
</div>
6+
7+
<script id="bannerContent" type="text/x-jsrender">
8+
<div class="banner-content">
9+
<div class="e-icons e-assistview-icon"></div>
10+
<h3>AI Assistance</h3>
11+
<i>
12+
Update real-time responses with chunked streaming updates.
13+
</i>
14+
</div>
15+
</script>
16+
17+
<style>
18+
19+
.stream-aiassistview {
20+
height: 600px;
21+
width: 60vw;
22+
margin: 0 auto;
23+
}
24+
25+
.stream-aiassistview .banner-content .e-assistview-icon:before {
26+
font-size: 35px;
27+
}
28+
29+
.stream-aiassistview .banner-content {
30+
display: flex;
31+
flex-direction: column;
32+
justify-content: center;
33+
height: 330px;
34+
text-align: center;
35+
}
36+
37+
@media only screen and (max-width: 750px) {
38+
.stream-aiassistview {
39+
width: 100%;
40+
}
41+
}
42+
43+
</style>
44+
45+
<div id="action-description">
46+
<p>
47+
This sample demonstrates the streaming response update in the <code>AI AssistView</code> control.
48+
</p>
49+
</div>
50+
<div id="description">
51+
<p> In this example, the <code>AI AssistView</code> control 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.
52+
</p>
53+
<p>
54+
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.
55+
</p>
56+
</div>
57+

src/ai-assistview/streaming.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { loadCultureFiles } from '../common/culture-loader';
2+
import { AIAssistView, PromptRequestEventArgs, ToolbarItemClickedEventArgs } from "@syncfusion/ej2-interactive-chat";
3+
import { streamingSuggestions, streamingData } from './promptResponseData';
4+
import * as Marked from 'marked';
5+
6+
/**
7+
* streaming sample
8+
*/
9+
10+
(window as any).default = (): void => {
11+
loadCultureFiles();
12+
13+
let stopStreaming: boolean = false;
14+
let streamingAIAssistView: AIAssistView = new AIAssistView({
15+
promptSuggestions: streamingSuggestions,
16+
promptRequest: onPromptRequest,
17+
bannerTemplate: "#bannerContent",
18+
toolbarSettings: {
19+
items: [{ iconCss: 'e-icons e-refresh', align: 'Right' }],
20+
itemClicked: toolbarItemClicked
21+
},
22+
stopRespondingClick: handleStopResponse
23+
});
24+
streamingAIAssistView.appendTo('#streamAssistView');
25+
26+
function handleStopResponse(): void {
27+
stopStreaming = true;
28+
}
29+
function onPromptRequest(args: PromptRequestEventArgs) {
30+
let lastResponse: string = "";
31+
let streamingResponse: any = streamingData.find((data: any) => data.prompt === args.prompt);
32+
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.";
33+
const responseUpdateRate: number = 10; // Update scroll and streaming response every 10 characters
34+
async function streamResponse(response: string) {
35+
let i = 0;
36+
const responseLength: number = response.length;
37+
while (i < responseLength && !stopStreaming) {
38+
lastResponse += response[i];
39+
i++;
40+
if (i % responseUpdateRate === 0 || i === responseLength) {
41+
const htmlResponse: string = Marked.marked(lastResponse);
42+
streamingAIAssistView.addPromptResponse(htmlResponse, i === responseLength);
43+
streamingAIAssistView.scrollToBottom();
44+
}
45+
await new Promise(resolve => setTimeout(resolve, 15)); // Delay before the next chunk
46+
}
47+
streamingAIAssistView.promptSuggestions = streamingResponse?.suggestions || streamingSuggestions;
48+
}
49+
50+
if (streamingResponse) {
51+
stopStreaming = false;
52+
streamResponse(streamingResponse.response);
53+
} else {
54+
streamingAIAssistView.addPromptResponse(defaultResponse, true);
55+
streamingAIAssistView.promptSuggestions = streamingSuggestions;
56+
}
57+
}
58+
59+
function toolbarItemClicked(args: ToolbarItemClickedEventArgs) {
60+
if (args.item.iconCss === 'e-icons e-refresh') {
61+
streamingAIAssistView.prompts = [];
62+
streamingAIAssistView.promptSuggestions = streamingSuggestions;
63+
}
64+
}
65+
};

src/ai-assistview/template.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ <h3><span class="e-icons e-assistview-icon"></span>AI Assistance</h3>
4545
.response-header .e-assistview-icon:before {
4646
margin-right: 10px;
4747
}
48+
49+
.template-aiassistview .e-rtl .banner-content .e-assistview-icon:before,
50+
.template-aiassistview .e-rtl .responseItemContent .e-assistview-icon:before
51+
{
52+
margin-left: 10px;
53+
}
4854

4955
.template-aiassistview .banner-content {
5056
display: flex;

0 commit comments

Comments
 (0)