Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyManetov committed Dec 12, 2024
2 parents 47d406d + 618f3fc commit f58fe68
Show file tree
Hide file tree
Showing 112 changed files with 2,409 additions and 1,693 deletions.
27 changes: 13 additions & 14 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@epam/app",
"version": "5.11.1-alpha.0",
"version": "5.11.1-rc.0",
"description": "EPAM Unified UI landing",
"author": "EPAM",
"license": "MIT",
Expand All @@ -17,19 +17,19 @@
"dependencies": {
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
"@elastic/apm-rum": "^5.14.0",
"@epam/assets": "5.11.1-alpha.0",
"@epam/draft-rte": "5.11.1-alpha.0",
"@epam/electric": "5.11.1-alpha.0",
"@epam/assets": "5.11.1-rc.0",
"@epam/draft-rte": "5.11.1-rc.0",
"@epam/electric": "5.11.1-rc.0",
"@epam/internal": "0.0.2",
"@epam/loveship": "5.11.1-alpha.0",
"@epam/promo": "5.11.1-alpha.0",
"@epam/uui": "5.11.1-alpha.0",
"@epam/uui-components": "5.11.1-alpha.0",
"@epam/uui-core": "5.11.1-alpha.0",
"@epam/uui-db": "5.11.1-alpha.0",
"@epam/uui-docs": "5.11.1-alpha.0",
"@epam/uui-editor": "5.11.1-alpha.0",
"@epam/uui-timeline": "5.11.1-alpha.0",
"@epam/loveship": "5.11.1-rc.0",
"@epam/promo": "5.11.1-rc.0",
"@epam/uui": "5.11.1-rc.0",
"@epam/uui-components": "5.11.1-rc.0",
"@epam/uui-core": "5.11.1-rc.0",
"@epam/uui-db": "5.11.1-rc.0",
"@epam/uui-docs": "5.11.1-rc.0",
"@epam/uui-editor": "5.11.1-rc.0",
"@epam/uui-timeline": "5.11.1-rc.0",
"@tanstack/react-query": "^5.17.19",
"@udecode/plate-common": "31.3.2",
"amplitude-js": "8.9.1",
Expand All @@ -40,7 +40,6 @@
"imask": "6.0.7",
"lodash.assign": "4.2.0",
"prismjs": "^1.19.0",
"prop-types": "15.7.2",
"qhistory": "1.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
10 changes: 6 additions & 4 deletions app/src/demo/tables/editableTable/ProjectTableDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function ProjectTableDemo() {
}, []);

const insertTask = useCallback((position: DropPosition, relativeTask: Task | null = null, existingTask: Task | null = null) => {
const taskToInsert: Task = existingTask ? { ...existingTask, type: 'task' } : { id: lastId--, name: '', type: 'task' };
const taskToInsert: Task = existingTask ? { ...existingTask, type: 'task' } : { id: lastId--, name: '', type: 'task', parentId: null };
const task: Task = setTaskInsertPosition(taskToInsert, relativeTask, position, treeRef.current);

setValue((currentValue) => {
Expand All @@ -153,9 +153,11 @@ export function ProjectTableDemo() {
}
}

let currentItems = currentValue.items
.set(task.id, task)
.set(parentTask.id, parentTask);
let currentItems = currentValue.items.set(task.id, task);

if (parentTask) {
currentValue.items.set(parentTask.id, parentTask);
}

if (prevParentTask !== null && prevParentTask !== NOT_FOUND_RECORD) {
currentItems = currentItems.set(prevParentTask.id, prevParentTask);
Expand Down
1 change: 0 additions & 1 deletion app/src/demo/tables/editableTable/TimelineMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export function TimelineMode({
value={ tableState }
onValueChange={ setTableState }
dataTableFocusManager={ dataTableFocusManager }
showColumnsConfig
allowColumnsResizing
allowColumnsReordering
headerSize="60"
Expand Down
1 change: 1 addition & 0 deletions app/src/docs/_examples/alert/Sizes.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function BasicAlertExample() {
{' '}
</SuccessAlert>
<WarningAlert
size="48"
onClose={ () => alert('close action') }
actions={ [{ name: 'ACTION 1', action: () => null }, { name: 'ACTION 2', action: () => null }] }
>
Expand Down
19 changes: 10 additions & 9 deletions app/src/docs/_examples/multiSwitch/Basic.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import { ReactComponent as ChatIcon } from '@epam/assets/icons/communication-cha
import css from './BasicExample.module.scss';

export default function BasicExample() {
const [value, onValueChange] = useState(null);
const [view, setView] = useState(null);
const [filter, setFilter] = useState(null);
const [value, onValueChange] = useState('on');
const [userType, userTypeOnValueChange] = useState();
const [view, setView] = useState(1);
const [filter, setFilter] = useState(2);

return (
<FlexCell width="auto" cx={ css.container }>
Expand All @@ -28,8 +29,8 @@ export default function BasicExample() {
items={ [
{ id: 1, caption: 'Mentee' }, { id: 2, caption: 'Mentor' }, { id: 3, caption: 'Coordinator' },
] }
value={ value }
onValueChange={ onValueChange }
value={ userType }
onValueChange={ userTypeOnValueChange }
/>
<Text>With Grey border</Text>
<MultiSwitch
Expand All @@ -38,16 +39,16 @@ export default function BasicExample() {
{ id: 1, caption: 'Mentee' }, { id: 2, caption: 'Mentor' }, { id: 3, caption: 'Coordinator' },
] }
color="secondary"
value={ value }
onValueChange={ onValueChange }
value={ userType }
onValueChange={ userTypeOnValueChange }
/>
<Text>Disabled</Text>
<MultiSwitch
items={ [
{ id: 1, caption: 'Mentee' }, { id: 2, caption: 'Mentor' }, { id: 3, caption: 'Coordinator' },
] }
value={ value }
onValueChange={ onValueChange }
value={ userType }
onValueChange={ userTypeOnValueChange }
isDisabled
/>
<Text>Icon only</Text>
Expand Down
2 changes: 2 additions & 0 deletions app/src/docs/_examples/pickerInput/LazyTreeSearch.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default function LazyTreeSearch() {
getId: (i) => i.id,
getParentId: (i) => i.parentId,
getChildCount: (l) => l.childCount,
selectAll: false,
},
[],
);
Expand All @@ -42,6 +43,7 @@ export default function LazyTreeSearch() {
getId: (i) => i.id,
getParentId: (i) => i.parentId,
getChildCount: (l) => l.childCount,
selectAll: false,
},
[],
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { FileUploadResponse, useUuiContext } from '@epam/uui-core';
import { ErrorNotification, Panel } from '@epam/promo';
import { ErrorNotification, FlexRow } from '@epam/promo';
import { SlateEditor, defaultPlugins, imagePlugin, videoPlugin, attachmentPlugin, toDoListPlugin, baseMarksPlugin,
linkPlugin, iframePlugin, notePlugin, separatorPlugin, uploadFilePlugin, tablePlugin, quotePlugin, colorPlugin,
superscriptPlugin, headerPlugin, listPlugin, placeholderPlugin, EditorValue, codeBlockPlugin,
Expand Down Expand Up @@ -56,7 +56,7 @@ export default function WithInnerScrollExample() {
];

return (
<Panel rawProps={ { style: { width: '100%', height: '350px' } } }>
<FlexRow rawProps={ { style: { width: '100%', height: '350px' } } }>
<SlateEditor
value={ value }
onValueChange={ setValue }
Expand All @@ -68,6 +68,6 @@ export default function WithInnerScrollExample() {
fontSize="14"
scrollbars
/>
</Panel>
</FlexRow>
);
}
24 changes: 5 additions & 19 deletions app/src/docs/_examples/tables/PagedTable.example.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { SetStateAction, useCallback, useMemo, useState } from 'react';
import isEqual from 'react-fast-compare';
import React, { useCallback, useMemo, useState } from 'react';
import { DataColumnProps, useLazyDataSource, DataSourceState, LazyDataSourceApiRequest, useUuiContext, LazyDataSourceApi } from '@epam/uui-core';
import { DataTable, Panel, Text, Paginator, FlexRow, FlexSpacer } from '@epam/uui';
import { Person } from '@epam/uui-docs';
Expand All @@ -11,20 +10,6 @@ export default function PagedTable() {
page: 1, pageSize: 10,
});

const setTableState = useCallback((newState: SetStateAction<DataSourceState>) => {
setState((currentState) => {
const updatedState = typeof newState === 'function' ? newState(currentState) : newState;
const isFilterChanged = !isEqual(currentState.filter, updatedState.filter);
const isSearchChanged = currentState.search !== updatedState.search;
const isSortingChanged = !isEqual(currentState.sorting, updatedState.sorting);

if (isFilterChanged || isSearchChanged || isSortingChanged) {
return { ...updatedState, checked: [] };
}
return updatedState;
});
}, []);

const columns: DataColumnProps<Person>[] = useMemo(
() => [
{
Expand Down Expand Up @@ -67,9 +52,10 @@ export default function PagedTable() {
},
},
backgroundReload: true,
selectAll: false,
}, []);

const view = dataSource.useView(state, setTableState, {});
const view = dataSource.useView(state, setState, {});
const listProps = view.getListProps();

return (
Expand All @@ -78,15 +64,15 @@ export default function PagedTable() {
{ ...listProps }
getRows={ view.getVisibleRows }
value={ state }
onValueChange={ setTableState }
onValueChange={ setState }
columns={ columns }
headerTextCase="upper"
/>
<FlexRow size="36" padding="12">
<FlexSpacer />
<Paginator
value={ state.page }
onValueChange={ (newPage) => setTableState({ ...state, page: newPage, scrollTo: { index: 0 } }) }
onValueChange={ (newPage) => setState({ ...state, page: newPage, scrollTo: { index: 0 } }) }
totalPages={ Math.ceil((listProps.totalCount ?? 0) / state.pageSize) }
/>
<FlexSpacer />
Expand Down
116 changes: 116 additions & 0 deletions app/src/docs/_examples/tables/TableGroupedHeader.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React, { useState } from 'react';
import { DataSourceState, DataColumnProps, useUuiContext, useLazyDataSource, DataColumnGroupProps } from '@epam/uui-core';
import { Text, DataTable, Panel, FlexRow, Badge, BadgeProps } from '@epam/uui';
import { Person } from '@epam/uui-docs';

import css from './TablesExamples.module.scss';
import { TApi } from '../../../data';

export default function TableGroupedHeaderExample() {
const svc = useUuiContext<TApi>();
const [tableState, setTableState] = useState<DataSourceState>({});

// Define columns groups array
const columnGroups: DataColumnGroupProps[] = [
{
key: 'location',
caption: 'Location',
textAlign: 'center',
},
{
key: 'position',
caption: 'Position',
textAlign: 'center',
},
];

// Define columns config array
const personColumns: DataColumnProps<Person, number>[] = [
{
key: 'name',
caption: 'Name',
render: (p) => <Text>{p.name}</Text>,
width: 130,
isSortable: true,
},
{
key: 'profileStatus',
caption: 'Status',
render: (p) => (
<FlexRow>
<Badge size="24" indicator fill="outline" color={ p.profileStatus.toLowerCase() as BadgeProps['color'] } caption={ p.profileStatus } />
</FlexRow>
),
grow: 0,
width: 100,
minWidth: 90,
isSortable: true,
},
{
key: 'countryName',
caption: 'Country',
group: 'location', // Specify group key
render: (p) => <Text>{p.countryName}</Text>,
grow: 0,
width: 110,
isSortable: true,
},
{
key: 'cityName',
caption: 'City',
group: 'location', // Specify group key
render: (p) => <Text>{p.cityName}</Text>,
grow: 0,
width: 110,
isSortable: true,
},
{
key: 'officeAddress',
caption: 'Office',
group: 'location', // Specify group key
render: (p) => <Text>{p.officeAddress}</Text>,
grow: 0,
width: 150,
isSortable: true,
},
{
key: 'jobTitle',
caption: 'Title',
group: 'position', // Specify group key
render: (r) => <Text>{r.jobTitle}</Text>,
width: 180,
isSortable: true,
},
{
key: 'titleLevel',
caption: 'Track & Level',
group: 'position', // Specify group key
render: (p) => <Text>{p.titleLevel}</Text>,
grow: 1,
width: 100,
isSortable: true,
},
];

const citiesDS = useLazyDataSource<Person, number, unknown>({
api: svc.api.demo.persons,
backgroundReload: true,
}, []);

const view = citiesDS.useView(tableState, setTableState);

return (
<Panel background="surface-main" shadow cx={ css.container }>
<DataTable
value={ tableState }
onValueChange={ setTableState }
{ ...view.getListProps() }
getRows={ view.getVisibleRows }
showColumnsConfig={ false }
columnGroups={ columnGroups }
columns={ personColumns }
headerTextCase="upper"
/>
</Panel>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const initialPresets: ITablePreset[] = [
name: 'Red status',
order: 'a',
filter: {
profileStatusId: 1,
profileStatusId: [1],
},
isReadonly: true,
},
Expand Down
24 changes: 0 additions & 24 deletions app/src/docs/_examples/tooltip/Basic.example.tsx

This file was deleted.

Loading

0 comments on commit f58fe68

Please sign in to comment.