Skip to content

Commit

Permalink
Merge branch '24_2' into 24_2_testcafe_bump
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeniyKiyashko committed Oct 12, 2024
2 parents 2cfb1de + a64be34 commit 5f507e5
Show file tree
Hide file tree
Showing 42 changed files with 198 additions and 466 deletions.
88 changes: 85 additions & 3 deletions apps/react-storybook/stories/chat/Chat.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useCallback } from 'react';
import React, { useState, useCallback, useEffect } from 'react';
import {Chat, ChatTypes} from 'devextreme-react/chat'
import type {Meta, StoryObj} from '@storybook/react';
import { firstAuthor, secondAuthor, initialMessages } from './data';
Expand Down Expand Up @@ -44,6 +44,7 @@ export const Overview: Story = {
[firstAuthor.name]: firstAuthor,
[secondAuthor.name]: secondAuthor,
},
defaultValue: firstAuthor.name,
},
hint: {
control: 'text',
Expand All @@ -65,8 +66,14 @@ export const Overview: Story = {
const [messages, setMessages] = useState(items);

const onMessageSend = useCallback(({ message }) => {
setMessages((prevMessages) => [...prevMessages, message]);
}, []);
const updatedMessages = [...messages, message];

setMessages(updatedMessages);
}, [messages]);

useEffect(() => {
setMessages(items);
}, [items]);

return (
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
Expand All @@ -90,6 +97,76 @@ export const Overview: Story = {
}
}

export const EmptyView: Story = {
args: {
items: [],
user: firstAuthor,
...commonArgs,
},
argTypes: {
user: {
control: 'select',
options: [firstAuthor.name, secondAuthor.name],
mapping: {
[firstAuthor.name]: firstAuthor,
[secondAuthor.name]: secondAuthor,
},
defaultValue: firstAuthor.name,
},
hint: {
control: 'text',
}
},
render: ({
width,
height,
disabled,
rtlEnabled,
user,
items,
onItemsChange,
visible,
hint,
activeStateEnabled,
hoverStateEnabled,
focusStateEnabled,
}) => {
const [messages, setMessages] = useState(items);

const onMessageSend = useCallback(({ message }) => {
const updatedMessages = [...messages, message];

setMessages(updatedMessages);
}, [messages]);

useEffect(() => {
console.log(2);
setMessages(items);
}, [items]);

return (
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<Chat
width={width}
height={height}
items={messages}
onItemsChange={onItemsChange}
disabled={disabled}
rtlEnabled={rtlEnabled}
user={user}
onMessageSend={onMessageSend}
visible={visible}
hint={hint}
activeStateEnabled={activeStateEnabled}
focusStateEnabled={focusStateEnabled}
hoverStateEnabled={hoverStateEnabled}
>
</Chat>
</div>
);
}
}

export const PopupIntegration: Story = {
args: {
items: initialMessages,
Expand All @@ -106,6 +183,7 @@ export const PopupIntegration: Story = {
[firstAuthor.name]: firstAuthor,
[secondAuthor.name]: secondAuthor,
},
defaultValue: firstAuthor.name,
},
hint: {
control: 'text',
Expand All @@ -130,6 +208,10 @@ export const PopupIntegration: Story = {
setMessages((prevMessages) => [...prevMessages, message]);
}, []);

useEffect(() => {
setMessages(items);
}, [items]);

return (
<Popup
width={300}
Expand Down
17 changes: 16 additions & 1 deletion apps/react-storybook/stories/chat/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export const secondAuthor: ChatTypes.User = {
name: "Jane Smith"
};

const todayDate = new Date();

const date = new Date();
const yesterdayDate = date.setDate(date.getDate() - 1);

export const initialMessages: ChatTypes.Message[] = [
{
timestamp: "2024-10-01T10:15:30Z",
Expand Down Expand Up @@ -54,8 +59,18 @@ export const initialMessages: ChatTypes.Message[] = [
text: "I also want to get out into nature. Want to join me?"
},
{
timestamp: "2024-10-01T10:35:00Z",
timestamp: yesterdayDate,
author: secondAuthor,
text: "I'd love to! Just let me know when you're ready."
},
{
timestamp: todayDate,
author: firstAuthor,
text: "Great!"
},
{
timestamp: todayDate,
author: firstAuthor,
text: "Great! Looking forward to it!"
}
];
5 changes: 5 additions & 0 deletions e2e/testcafe-devextreme/tests/chat/messageList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ test('Messagelist appearance with scrollbar', async (t) => {
user: userSecond,
width: 400,
height: 600,
onMessageSend: (e) => {
const { component, message } = e;

component.renderMessage(message);
},
});
});

Expand Down
6 changes: 3 additions & 3 deletions packages/devextreme-angular/src/ui/map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ export class DxMapComponent extends DxComponent implements OnDestroy, OnChanges,
*/
@Input()
get apiKey(): string | { bing?: string, google?: string, googleStatic?: string } {
get apiKey(): string | { azure?: string, bing?: string, google?: string, googleStatic?: string } {
return this._getOption('apiKey');
}
set apiKey(value: string | { bing?: string, google?: string, googleStatic?: string }) {
set apiKey(value: string | { azure?: string, bing?: string, google?: string, googleStatic?: string }) {
this._setOption('apiKey', value);
}

Expand Down Expand Up @@ -468,7 +468,7 @@ export class DxMapComponent extends DxComponent implements OnDestroy, OnChanges,
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
@Output() apiKeyChange: EventEmitter<string | { bing?: string, google?: string, googleStatic?: string }>;
@Output() apiKeyChange: EventEmitter<string | { azure?: string, bing?: string, google?: string, googleStatic?: string }>;

/**
Expand Down
8 changes: 8 additions & 0 deletions packages/devextreme-angular/src/ui/map/nested/api-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ import { NestedOption } from 'devextreme-angular/core';
providers: [NestedOptionHost]
})
export class DxoMapApiKeyComponent extends NestedOption implements OnDestroy, OnInit {
@Input()
get azure(): string {
return this._getOption('azure');
}
set azure(value: string) {
this._setOption('azure', value);
}

@Input()
get bing(): string {
return this._getOption('bing');
Expand Down
8 changes: 8 additions & 0 deletions packages/devextreme-angular/src/ui/nested/api-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ import { NestedOption } from 'devextreme-angular/core';
providers: [NestedOptionHost]
})
export class DxoApiKeyComponent extends NestedOption implements OnDestroy, OnInit {
@Input()
get azure(): string {
return this._getOption('azure');
}
set azure(value: string) {
this._setOption('azure', value);
}

@Input()
get bing(): string {
return this._getOption('bing');
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme-angular/src/ui/pagination/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {

import { DisplayMode } from 'devextreme/common';

import DxPagination from 'devextreme/ui/pager';
import DxPagination from 'devextreme/ui/pagination';


import {
Expand Down Expand Up @@ -630,7 +630,7 @@ export class DxPaginationComponent extends DxComponent implements OnDestroy, OnC
})
export class DxPaginationModule { }

import type * as DxPaginationTypes from "devextreme/ui/pager_types";
import type * as DxPaginationTypes from "devextreme/ui/pagination_types";
export { DxPaginationTypes };


1 change: 1 addition & 0 deletions packages/devextreme-react/src/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const Map = memo(
// owners:
// Map
type IApiKeyProps = React.PropsWithChildren<{
azure?: string;
bing?: string;
google?: string;
googleStatic?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme-react/src/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from "react";
import { memo, forwardRef, useImperativeHandle, useRef, useMemo, ForwardedRef, Ref, ReactElement } from "react";
import dxPagination, {
Properties
} from "devextreme/ui/pager";
} from "devextreme/ui/pagination";

import { Component as BaseComponent, IHtmlOptions, ComponentRef } from "./core/component";

Expand Down Expand Up @@ -58,6 +58,6 @@ export {
IPaginationOptions,
PaginationRef
};
import type * as PaginationTypes from 'devextreme/ui/pager_types';
import type * as PaginationTypes from 'devextreme/ui/pagination_types';
export { PaginationTypes };

2 changes: 2 additions & 0 deletions packages/devextreme-vue/src/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,13 @@ const DxApiKeyConfig = {
emits: {
"update:isActive": null,
"update:hoveredElement": null,
"update:azure": null,
"update:bing": null,
"update:google": null,
"update:googleStatic": null,
},
props: {
azure: String,
bing: String,
google: String,
googleStatic: String
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme-vue/src/pagination.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Pagination, { Properties } from "devextreme/ui/pager";
import Pagination, { Properties } from "devextreme/ui/pagination";
import { defineComponent } from "vue";
import { prepareComponentConfig } from "./core/index";

Expand Down Expand Up @@ -113,5 +113,5 @@ export default DxPagination;
export {
DxPagination
};
import type * as DxPaginationTypes from "devextreme/ui/pager_types";
import type * as DxPaginationTypes from "devextreme/ui/pagination_types";
export { DxPaginationTypes };
2 changes: 1 addition & 1 deletion packages/devextreme/build/gulp/modules_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@
}
},
{
"name": "ui/pager",
"name": "ui/pagination",
"exports": {
"default": { "path": "ui.dxPagination", "isWidget": true }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { DisplayMode } from '@js/common';
import type { PageSize } from '@js/ui/pager_types';
import type { PageSize } from '@js/ui/pagination_types';

import messageLocalization from '../../../localization/message';
import type { EventCallback } from '../../core/r1/event_callback';
Expand Down
1 change: 0 additions & 1 deletion packages/devextreme/js/__internal/ui/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ class Chat extends Widget<Properties> {
text,
};

this.renderMessage(message);
this._messageSendAction?.({ message, event });
}

Expand Down

This file was deleted.

Loading

0 comments on commit 5f507e5

Please sign in to comment.