Skip to content

Commit

Permalink
Add stand to test components performance
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyManetov committed Dec 18, 2024
1 parent 327a9ac commit 76d78bd
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 10 deletions.
30 changes: 20 additions & 10 deletions app/src/demo/tables/filteredTable/filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const getFilters = (): TableFiltersConfig<Person>[] => {
),
predicates: defaultPredicates.multiPicker,
showSearch: false,
}, {
},
{
field: 'countryId',
columnKey: 'countryName',
title: 'Country',
Expand All @@ -47,39 +48,45 @@ export const getFilters = (): TableFiltersConfig<Person>[] => {
) }
/>
),
}, {
},
{
field: 'jobTitleId',
columnKey: 'jobTitle',
title: 'Title',
type: 'multiPicker',
dataSource: new LazyDataSource({ api: svc.api.demo.jobTitles }),
}, {
},
{
field: 'departmentId',
columnKey: 'departmentName',
title: 'Department',
type: 'singlePicker',
dataSource: new LazyDataSource({ api: svc.api.demo.departments }),
predicates: [{ predicate: 'eq', name: 'is' }, { predicate: 'neq', name: 'is not' }],
}, {
},
{
field: 'officeId',
columnKey: 'officeAddress',
title: 'Office',
type: 'singlePicker',
dataSource: new LazyDataSource({ api: svc.api.demo.offices }),
}, {
},
{
field: 'managerId',
columnKey: 'managerName',
title: 'Manager',
type: 'multiPicker',
dataSource: new LazyDataSource({ api: svc.api.demo.managers }),
}, {
},
{
field: 'cityId',
columnKey: 'cityName',
title: 'City',
type: 'multiPicker',
getName: (item) => `${item.name} (${item.countryName})`,
dataSource: new LazyDataSource({ api: svc.api.demo.cities }),
}, {
},
{
field: 'workload',
columnKey: 'workload',
title: 'Workload',
Expand All @@ -89,18 +96,21 @@ export const getFilters = (): TableFiltersConfig<Person>[] => {
{ predicate: 'eq', name: '=' }, { predicate: 'neq', name: '≠' }, { predicate: 'lte', name: '≤' }, { predicate: 'gte', name: '≥' },
],
showSearch: false,
}, {
},
{
field: 'salary',
columnKey: 'salary',
title: 'Salary',
type: 'numeric',
predicates: defaultPredicates.numeric,
}, {
},
{
field: 'hireDate',
columnKey: 'hireDate',
title: 'Hire Date',
type: 'datePicker',
}, {
},
{
field: 'birthDate',
columnKey: 'birthDate',
title: 'Birth Date',
Expand Down
2 changes: 2 additions & 0 deletions app/src/sandbox/SandboxPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { ProjectTableDemo } from './editableTable';
import { RtlExample } from './rtl/Rtl-example';
import { DemoForm } from './rtl/form/DemoForm';
import { RichTextEditorDemoReadonly } from './RTE-readonly/RichTextEditorDemo';
import { PerformanceTestPage } from './perfomance-stand/PerformanceTestPage';

export function SandboxPage() {
const items = useMemo(
Expand All @@ -48,6 +49,7 @@ export function SandboxPage() {
{ parentId: 'tokens', id: 'tokensPalette', name: 'Palette', component: PalettePage },
{ id: 'rtl-example', name: 'Rtl-example', component: RtlExample },
{ id: 'rtl-form', name: 'Rtl-Form', component: DemoForm },
{ id: 'performanceStand', name: 'Performance stand', component: PerformanceTestPage },
],
[],
);
Expand Down
51 changes: 51 additions & 0 deletions app/src/sandbox/perfomance-stand/PerformanceTestPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useState, useMemo } from 'react';
import { FlexRow, DatePicker } from '@epam/uui';
// import { LazyDataSourceApiRequest, useLazyDataSource } from '@epam/uui-core';
// import { Person } from '@epam/uui-docs';
// import { svc } from '../../services';

export function PerformanceTestPage() {
const [componentValue, componentOnValueChange] = useState<any>();
// const loadPersons = useCallback((request: LazyDataSourceApiRequest<Person, number>) => {
// return svc.api.demo.persons(request);
// }, []);

// const dataSource = useLazyDataSource({ api: loadPersons, selectAll: false }, []);

const renderTestedComponent = () => {
// return (
// <PickerInput
// dataSource={ dataSource }
// value={ componentValue }
// onValueChange={ componentOnValueChange }
// valueType="id"
// selectionMode="multi"
// />
// );

return (
<DatePicker
value={ componentValue }
onValueChange={ componentOnValueChange }
/>
);
};

const gridArray = useMemo(() => new Array(30).fill(new Array(8).fill(undefined)), []);

return (
<div>
{ gridArray.map((row) => {
return (
<FlexRow>
{ row.map((cell: any, idx: number) => (
<div key={ idx }>
{ renderTestedComponent() }
</div>
)) }
</FlexRow>
);
}) }
</div>
);
}

0 comments on commit 76d78bd

Please sign in to comment.