-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
877 changed files
with
90,727 additions
and
109,445 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -27,5 +27,6 @@ | |
|
||
@media (max-width: 1279px) { | ||
justify-content: center; | ||
margin: 30px 24px; | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import * as React from 'react'; | ||
import cx from 'classnames'; | ||
import { BaseDocsBlock, DocExample } from '../common'; | ||
import css from './styles.module.scss'; | ||
|
||
export class RichTextEditorDoc extends BaseDocsBlock { | ||
title = 'Rich Text Editor'; | ||
renderContent() { | ||
return ( | ||
<span className={ cx(css.wrapper) }> | ||
<> | ||
<DocExample path="./_examples/richTextEditor/Basic.example.tsx" /> | ||
<DocExample title="Inner scroll behavior" path="./_examples/richTextEditor/WithInnerScroll.example.tsx" /> | ||
</span> | ||
</> | ||
); | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import * as React from 'react'; | ||
import cx from 'classnames'; | ||
import { BaseDocsBlock, DocExample } from '../common'; | ||
import css from './styles.module.scss'; | ||
|
||
export class RichTextEditorSerializersDoc extends BaseDocsBlock { | ||
title = 'Rich Text Editor Serializers'; | ||
renderContent() { | ||
return ( | ||
<span className={ cx(css.wrapper) }> | ||
<> | ||
<DocExample title="MD format" path="./_examples/richTextEditor/MdSerialization.example.tsx" /> | ||
<DocExample title="HTML format" path="./_examples/richTextEditor/HtmlSerialization.example.tsx" /> | ||
</span> | ||
</> | ||
); | ||
} | ||
} |
This file contains 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 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
53 changes: 53 additions & 0 deletions
53
app/src/docs/_examples/dataSources/LazyDataSourceCursor.example.tsx
This file contains 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,53 @@ | ||
import React, { useState } from 'react'; | ||
import { DataQueryFilter, DataSourceState, useLazyDataSource, useUuiContext } from '@epam/uui-core'; | ||
import { DataSourceViewer } from '@epam/uui-docs'; | ||
import { TApi } from '../../../data'; | ||
import { City } from '@epam/uui-docs'; | ||
|
||
export default function LazyDataSourceDataExample() { | ||
const svc = useUuiContext<TApi>(); | ||
|
||
const [value, onValueChange] = useState<DataSourceState>({}); | ||
const dataSource = useLazyDataSource<City, string, DataQueryFilter<City>>({ | ||
api: async (req) => { | ||
// We emulate server cursor-based API here. | ||
// Usually this done at server, and you need to pass cursor as is. | ||
|
||
// The server-side logic might be more complex, as we ignore several cases here: | ||
// - we assume the list is sorted by name, and sorting can't change | ||
// To handle this, cursor would need to store field by which the list is sorted. | ||
// - we assume that names are unique. | ||
// To handle this, we would need to add item ID to cursor, and make more complex filter, like: | ||
// where (name > cursor.name) OR (name = cursor.name && id > cursor.id) | ||
// order by name, id | ||
|
||
const { cursor, ...request } = req; | ||
|
||
if (cursor) { | ||
request.filter = request.filter || {}; | ||
// fetch only cities with name after the last fetched city alphabetically | ||
request.filter.name = { gt: cursor }; | ||
request.range = { ...request.range, from: 0 }; | ||
} | ||
|
||
request.sorting = [{ field: 'name', direction: 'asc' }]; | ||
|
||
const response = await svc.api.demo.cities(request); | ||
|
||
if (response.items.length > 0) { | ||
// store last item's name as cursor | ||
response.cursor = response.items[response.items.length - 1].name; | ||
} | ||
|
||
return response; | ||
}, | ||
}, []); | ||
|
||
return ( | ||
<DataSourceViewer | ||
value={ value } | ||
onValueChange={ onValueChange } | ||
dataSource={ dataSource } | ||
/> | ||
); | ||
} |
Oops, something went wrong.