Added Persona
This commit is contained in:
parent
5a84a00f54
commit
881f37f254
|
@ -1,5 +1,4 @@
|
|||
export interface IKanbanBoardTaskSettings {
|
||||
showLabels: boolean;
|
||||
showPriority: boolean;
|
||||
showAssignedTo: boolean;
|
||||
showTaskDetailsButton: boolean;
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
import { IPersonaProps } from "office-ui-fabric-react/lib/Persona";
|
||||
|
||||
export interface IKanbanTask {
|
||||
taskId: string;
|
||||
title: string;
|
||||
isCompleted?: boolean;
|
||||
assignedTo?: IPersonaProps[];
|
||||
htmlDescription?:string;
|
||||
priority?:string;
|
||||
bucket: string;
|
||||
mamagedProperties?: IKanbanTaskManagedProps[];
|
||||
|
||||
|
@ -11,7 +16,7 @@ export interface IKanbanTaskManagedProps {
|
|||
name: string;
|
||||
displayName?: string;
|
||||
type: KanbanTaskMamagedPropertyType;
|
||||
value: any;
|
||||
value: string | number | IPersonaProps | IPersonaProps[] | any;
|
||||
renderer?: (name: string, value: object, type: KanbanTaskMamagedPropertyType) => JSX.Element;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
|||
import styles from './KanbanComponent.module.scss';
|
||||
import * as strings from 'KanbanBoardStrings';
|
||||
|
||||
import { IKanbanTask } from './IKanbanTask';
|
||||
import { IKanbanTask, KanbanTaskMamagedPropertyType } from './IKanbanTask';
|
||||
import { IKanbanBoardTaskSettings } from './IKanbanBoardTaskSettings';
|
||||
import { IKanbanBoardTaskActions } from './IKanbanBoardTaskActions';
|
||||
import { IKanbanBoardRenderers } from './IKanbanBoardRenderers';
|
||||
|
@ -171,12 +171,6 @@ export default class KanbanComponent extends React.Component<IKanbanComponentPro
|
|||
</DialogFooter>
|
||||
|
||||
</Dialog>);
|
||||
|
||||
|
||||
// Error Not found or more than one
|
||||
|
||||
return (<div></div>);
|
||||
|
||||
}
|
||||
|
||||
private clickEditTask(): void {
|
||||
|
@ -193,7 +187,6 @@ export default class KanbanComponent extends React.Component<IKanbanComponentPro
|
|||
}
|
||||
}
|
||||
private saveEditTask() {
|
||||
|
||||
if (this.props.taskactions.editTaskSaved) {
|
||||
const edittask = clone(this.state.editTask);
|
||||
//check fist state and than event or in the other way
|
||||
|
@ -201,7 +194,6 @@ export default class KanbanComponent extends React.Component<IKanbanComponentPro
|
|||
this.props.taskactions.editTaskSaved(edittask);
|
||||
} else {
|
||||
throw "allowEdit is Set but no handler is set";
|
||||
|
||||
}
|
||||
}
|
||||
private saveAddTask() {
|
||||
|
@ -213,14 +205,35 @@ export default class KanbanComponent extends React.Component<IKanbanComponentPro
|
|||
this.props.taskactions.editTaskSaved(edittask);
|
||||
} else {
|
||||
throw "allowAdd is Set but no handler is set";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private internalTaskDetailRenderer(task: IKanbanTask): JSX.Element {
|
||||
const {tasksettings} = this.props;
|
||||
return (<Stack>
|
||||
{tasksettings && tasksettings.showPriority && (
|
||||
<KanbanTaskManagedProp
|
||||
name="assignedTo"
|
||||
displayName={strings.Priority}
|
||||
type={KanbanTaskMamagedPropertyType.string }
|
||||
value={task.priority}
|
||||
key={'assignedToProp'} />
|
||||
)}
|
||||
{tasksettings && tasksettings.showAssignedTo && (<KanbanTaskManagedProp
|
||||
name="assignedTo"
|
||||
displayName={strings.AssignedTo}
|
||||
type={KanbanTaskMamagedPropertyType.persons }
|
||||
value={task.assignedTo}
|
||||
key={'assignedToProp'} />
|
||||
)}
|
||||
<KanbanTaskManagedProp
|
||||
name="assignedTo"
|
||||
displayName={strings.HtmlDescription}
|
||||
type={KanbanTaskMamagedPropertyType.html }
|
||||
value={task.htmlDescription}
|
||||
key={'htmlDescriptionProp'} />
|
||||
|
||||
{task.mamagedProperties && (
|
||||
task.mamagedProperties.map((p, i) => {
|
||||
|
@ -229,7 +242,6 @@ export default class KanbanComponent extends React.Component<IKanbanComponentPro
|
|||
);
|
||||
})
|
||||
)}
|
||||
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import { IKanbanTask } from './IKanbanTask';
|
|||
import { IKanbanBoardTaskSettings } from './IKanbanBoardTaskSettings';
|
||||
import { IKanbanBoardTaskActions } from './IKanbanBoardTaskActions';
|
||||
import classNames from 'classnames';
|
||||
import { IconNames } from 'office-ui-fabric-react';
|
||||
import { IconNames, Persona, PersonaSize } from 'office-ui-fabric-react';
|
||||
|
||||
export interface IKanbanTaskProps extends IKanbanTask, IKanbanBoardTaskSettings {
|
||||
|
||||
|
@ -26,7 +26,7 @@ export default class KanbanTask extends React.Component<IKanbanTaskProps, IKanba
|
|||
}
|
||||
public render(): React.ReactElement<IKanbanTaskProps> {
|
||||
|
||||
const { title, showLabels, showPriority, showAssignedTo, isCompleted, isMoving, showTaskDetailsButton } = this.props;
|
||||
const { title, showPriority, showAssignedTo, isCompleted, isMoving, showTaskDetailsButton } = this.props;
|
||||
const showCompleted = !!this.props.toggleCompleted;
|
||||
const iconCompleted = { iconName: isCompleted ? 'RadioBtnOn' : 'RadioBtnOff' };
|
||||
return (
|
||||
|
@ -56,9 +56,23 @@ export default class KanbanTask extends React.Component<IKanbanTaskProps, IKanba
|
|||
|
||||
</div>
|
||||
<div className={styles.membersAndLabels}>
|
||||
{showAssignedTo && (<div className={styles.assignedto}></div>)}
|
||||
{showLabels && (<div className={styles.labels}></div>)}
|
||||
{showPriority && (<div className={styles.priority}></div>)}
|
||||
{showPriority && this.props.priority && (<div className={styles.priority}>{this.props.priority}</div>)}
|
||||
|
||||
{showAssignedTo && this.props.assignedTo && (<div className={styles.assignedto}>
|
||||
{
|
||||
this.props.assignedTo.map((p, i) => (
|
||||
<div key={'personawrapper' + i}>
|
||||
<Persona
|
||||
key={'persona' + i}
|
||||
{...p}
|
||||
size={PersonaSize.size32}
|
||||
hidePersonaDetails={false}
|
||||
/>
|
||||
</div>))
|
||||
}
|
||||
</div>)}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -6,6 +6,7 @@ import styles from './KanbanTaskManagedProp.module.scss';
|
|||
import { IKanbanTaskManagedProps, KanbanTaskMamagedPropertyType } from './IKanbanTask';
|
||||
import { IStackStyles, Stack } from 'office-ui-fabric-react/lib/Stack';
|
||||
import ReactHtmlParser, { processNodes, convertNodeToElement, htmlparser2 } from 'react-html-parser';
|
||||
import { Persona, PersonaSize, PersonaPresence, IPersonaSharedProps, IPersonaProps } from 'office-ui-fabric-react';
|
||||
|
||||
export interface IKanbanTaskManagedPropProps extends IKanbanTaskManagedProps { }
|
||||
|
||||
|
@ -35,7 +36,7 @@ export default class KanbanTaskManagedProp extends React.Component<IKanbanTaskMa
|
|||
return (<span>{value} </span>);
|
||||
break;
|
||||
case KanbanTaskMamagedPropertyType.number:
|
||||
return (<span>{'' + value} </span>);
|
||||
return (<span>{value} </span>);
|
||||
//TODO maybe Formater
|
||||
break;
|
||||
case KanbanTaskMamagedPropertyType.percent:
|
||||
|
@ -44,22 +45,39 @@ export default class KanbanTaskManagedProp extends React.Component<IKanbanTaskMa
|
|||
break;
|
||||
case KanbanTaskMamagedPropertyType.html:
|
||||
return (<span>{ReactHtmlParser(value)}</span>);
|
||||
//TODO maybe better Formater
|
||||
break;
|
||||
case KanbanTaskMamagedPropertyType.person:
|
||||
return (<span>TODO</span>);
|
||||
//TODO
|
||||
|
||||
return (<span>
|
||||
{value && (
|
||||
<Persona
|
||||
{...value}
|
||||
size={PersonaSize.size32}
|
||||
hidePersonaDetails={false} />
|
||||
)}
|
||||
</span>);
|
||||
break;
|
||||
case KanbanTaskMamagedPropertyType.persons:
|
||||
return (<span>TODO</span>);
|
||||
//TODO
|
||||
return (<span>
|
||||
{
|
||||
(value && (
|
||||
(value as IPersonaProps[]).map((p, i) => (<Persona
|
||||
key={'persona' + i}
|
||||
{...value}
|
||||
size={PersonaSize.size32}
|
||||
hidePersonaDetails={false}
|
||||
/>))
|
||||
)
|
||||
)
|
||||
}
|
||||
};
|
||||
</span>);
|
||||
break;
|
||||
case KanbanTaskMamagedPropertyType.complex:
|
||||
return (<span>{JSON.stringify(value)}</span>);
|
||||
break;
|
||||
default:
|
||||
throw "Unknow KanbanTaskMamagedPropertyType";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ Thinking about Kanban component with Fluent Ui Components
|
|||
## current
|
||||
allowMove from one Bucket to the Other tested
|
||||
move task to other Bucket works
|
||||
internalDislplayRenderer: Person / Persons
|
||||
|
||||
playing with drag visibility
|
||||
|
||||
|
@ -59,7 +60,7 @@ Unexpected call to method or property access.
|
|||
|
||||
# Next Steps Component:
|
||||
* think about Promise Task Actions, because actions are async
|
||||
* internalDislplayRenderer: Person / Persons
|
||||
|
||||
* EditSchema To support Edit and New PNP Controls :)
|
||||
* BucketEdit Component (can be used in CustomPropertyPane)
|
||||
|
||||
|
|
|
@ -11,5 +11,8 @@ define([], function () {
|
|||
"CloseTaskDialog": "Close",
|
||||
"AddTaskDlgHeadline": "Add Task",
|
||||
"EditTaskDlgHeadline": "Edit Task",
|
||||
"AssignedTo": "Assigned to",
|
||||
"HtmlDescription": "Description",
|
||||
"Priority": "Priority"
|
||||
}
|
||||
});
|
||||
|
|
|
@ -10,6 +10,10 @@ declare interface IKanbanBoardStrings {
|
|||
CloseTaskDialog: string;
|
||||
AddTaskDlgHeadline: string;
|
||||
EditTaskDlgHeadline: string;
|
||||
|
||||
AssignedTo: string;
|
||||
HtmlDescription: string;
|
||||
Priority:string;
|
||||
}
|
||||
|
||||
declare module 'KanbanBoardStrings' {
|
||||
|
|
Loading…
Reference in New Issue