@g9tm/lynxcontrols-projects 0.0.0-stage → 2.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/catalog/cards/G9Board.md +17 -0
- package/catalog/cards/G9RuleBuilder.md +17 -0
- package/catalog/cards/G9TaskCard.md +17 -0
- package/catalog/cards/G9Timeline.md +17 -0
- package/catalog/catalog.json +1881 -0
- package/catalog/index.md +8 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/board.d.ts +47 -0
- package/dist/board.d.ts.map +1 -0
- package/dist/board.jsx +380 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.jsx +5 -0
- package/dist/model.d.ts +127 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.jsx +242 -0
- package/dist/projects.css +582 -0
- package/dist/projects.css.map +1 -0
- package/dist/rule-builder.d.ts +60 -0
- package/dist/rule-builder.d.ts.map +1 -0
- package/dist/rule-builder.jsx +145 -0
- package/dist/task-card.d.ts +54 -0
- package/dist/task-card.d.ts.map +1 -0
- package/dist/task-card.jsx +117 -0
- package/dist/timeline.d.ts +60 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.jsx +389 -0
- package/package.json +36 -4
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { g9IdProps } from "@g9tm/lynxcontrols/base";
|
|
2
|
+
import { G9Button, G9IconButton } from "@g9tm/lynxcontrols/button";
|
|
3
|
+
import { G9Menu } from "@g9tm/lynxcontrols/popover";
|
|
4
|
+
import { useG9Culture, useG9Direction, useG9Layout } from "@g9tm/lynxcontrols/provider";
|
|
5
|
+
import { toNativeDigits } from "@g9tm/lynxcontrols-foundation";
|
|
6
|
+
import { useState } from "@lynx-js/react";
|
|
7
|
+
import "./projects.css";
|
|
8
|
+
function Step(props) {
|
|
9
|
+
const align = {
|
|
10
|
+
textAlign: props.rtl ? 'right' : 'left'
|
|
11
|
+
};
|
|
12
|
+
return <view className={props.columns ? 'g9-rule__step g9-rule__step--column' : 'g9-rule__step'}>
|
|
13
|
+
<view className="g9-rule__head" style={{
|
|
14
|
+
flexDirection: props.rtl ? 'row-reverse' : 'row',
|
|
15
|
+
direction: 'ltr'
|
|
16
|
+
}}>
|
|
17
|
+
<view className="g9-rule__badge">
|
|
18
|
+
<text className="g9-rule__badge-text">{props.digits(props.n)}</text>
|
|
19
|
+
</view>
|
|
20
|
+
<view className="g9-rule__head-texts">
|
|
21
|
+
<text className="g9-rule__title" style={align}>
|
|
22
|
+
{props.title}
|
|
23
|
+
</text>
|
|
24
|
+
{props.hint ? <text className="g9-rule__hint" style={align}>
|
|
25
|
+
{props.hint}
|
|
26
|
+
</text> : null}
|
|
27
|
+
</view>
|
|
28
|
+
</view>
|
|
29
|
+
<view className="g9-rule__items">{props.children}</view>
|
|
30
|
+
</view>;
|
|
31
|
+
}
|
|
32
|
+
function G9RuleBuilder(props) {
|
|
33
|
+
var _props_maxConditions, _props_maxActions, _ref;
|
|
34
|
+
const rtl = 'rtl' === useG9Direction();
|
|
35
|
+
const culture = useG9Culture();
|
|
36
|
+
const { wide } = useG9Layout();
|
|
37
|
+
const columns = 'columns' === props.layout || 'stack' !== props.layout && wide;
|
|
38
|
+
const digits = (n)=>toNativeDigits(String(n), culture.numberingSystem);
|
|
39
|
+
const [menu, setMenu] = useState(null);
|
|
40
|
+
const id = (s)=>props.id ? `${props.id}_${s}` : void 0;
|
|
41
|
+
const labels = props.labels;
|
|
42
|
+
const L = props.labels;
|
|
43
|
+
const align = {
|
|
44
|
+
textAlign: rtl ? 'right' : 'left'
|
|
45
|
+
};
|
|
46
|
+
const items = (kinds, checked)=>kinds.map((k)=>({
|
|
47
|
+
key: k.key,
|
|
48
|
+
label: k.label,
|
|
49
|
+
...k.description ? {
|
|
50
|
+
description: k.description
|
|
51
|
+
} : {},
|
|
52
|
+
...void 0 !== checked ? {
|
|
53
|
+
checked: k.key === checked
|
|
54
|
+
} : {}
|
|
55
|
+
}));
|
|
56
|
+
const problem = (step, i)=>{
|
|
57
|
+
var _props_problem;
|
|
58
|
+
const p = null == (_props_problem = props.problem) ? void 0 : _props_problem.call(props, step, i);
|
|
59
|
+
return p ? <text className="g9-rule__problem" style={align}>
|
|
60
|
+
{p}
|
|
61
|
+
</text> : null;
|
|
62
|
+
};
|
|
63
|
+
const item = (content, key, extra)=><view key={key} className="g9-rule__item">
|
|
64
|
+
<view className="g9-rule__item-row" style={{
|
|
65
|
+
flexDirection: rtl ? 'row-reverse' : 'row',
|
|
66
|
+
direction: 'ltr'
|
|
67
|
+
}}>
|
|
68
|
+
<view className="g9-rule__item-body">{content}</view>
|
|
69
|
+
{extra}
|
|
70
|
+
</view>
|
|
71
|
+
</view>;
|
|
72
|
+
const trigger = props.triggers.find((t)=>t.key === props.trigger);
|
|
73
|
+
const maxC = null != (_props_maxConditions = props.maxConditions) ? _props_maxConditions : 10;
|
|
74
|
+
const maxA = null != (_props_maxActions = props.maxActions) ? _props_maxActions : 10;
|
|
75
|
+
const anchor = 'trigger' === menu ? id('Trigger') : 'condition' === menu ? id('AddCondition') : id('AddAction');
|
|
76
|
+
return <view className="g9-rule" {...g9IdProps(props.id)}>
|
|
77
|
+
<view className={columns ? 'g9-rule__steps g9-rule__steps--columns' : 'g9-rule__steps'} style={columns ? {
|
|
78
|
+
flexDirection: rtl ? 'row-reverse' : 'row',
|
|
79
|
+
direction: 'ltr'
|
|
80
|
+
} : {}}>
|
|
81
|
+
<Step n={1} title={L.when} hint={L.whenHint} columns={columns} rtl={rtl} digits={digits}>
|
|
82
|
+
<G9Button {...id('Trigger') ? {
|
|
83
|
+
id: id('Trigger')
|
|
84
|
+
} : {}} text={null != (_ref = null == trigger ? void 0 : trigger.label) ? _ref : labels.chooseTrigger} variant={trigger ? 'tonal' : 'outline'} onPress={()=>setMenu('trigger')}/>
|
|
85
|
+
{props.trigger && props.renderTrigger ? props.renderTrigger(props.trigger) : null}
|
|
86
|
+
{problem('trigger', 0)}
|
|
87
|
+
</Step>
|
|
88
|
+
<Step n={2} title={L.if} hint={L.ifHint} columns={columns} rtl={rtl} digits={digits}>
|
|
89
|
+
{0 === props.conditions.length && L.noConditions ? <text className="g9-rule__none" style={align}>
|
|
90
|
+
{L.noConditions}
|
|
91
|
+
</text> : null}
|
|
92
|
+
{props.conditions.map((c, i)=>item(<>
|
|
93
|
+
{props.renderCondition(c, i)}
|
|
94
|
+
{problem('condition', i)}
|
|
95
|
+
</>, `c${i}`, <G9IconButton {...id(`Condition${i}_Remove`) ? {
|
|
96
|
+
id: id(`Condition${i}_Remove`)
|
|
97
|
+
} : {}} icon="close" isGhost accessibilityText={L.remove} onPress={()=>props.onRemoveCondition(i)}/>))}
|
|
98
|
+
{props.conditionKinds.length && props.conditions.length < maxC ? <G9Button {...id('AddCondition') ? {
|
|
99
|
+
id: id('AddCondition')
|
|
100
|
+
} : {}} text={`+ ${L.addCondition}`} variant="ghost" size="small" onPress={()=>setMenu('condition')}/> : null}
|
|
101
|
+
</Step>
|
|
102
|
+
<Step n={3} title={L.then} hint={L.thenHint} columns={columns} rtl={rtl} digits={digits}>
|
|
103
|
+
{0 === props.actions.length && L.noActions ? <text className="g9-rule__none" style={align}>
|
|
104
|
+
{L.noActions}
|
|
105
|
+
</text> : null}
|
|
106
|
+
{props.actions.map((a, i)=>item(<>
|
|
107
|
+
{props.renderAction(a, i)}
|
|
108
|
+
{problem('action', i)}
|
|
109
|
+
</>, `a${i}`, <view className="g9-rule__tools">
|
|
110
|
+
{props.onMoveAction && props.actions.length > 1 ? <>
|
|
111
|
+
<G9IconButton {...id(`Action${i}_Up`) ? {
|
|
112
|
+
id: id(`Action${i}_Up`)
|
|
113
|
+
} : {}} emoji="↑" isGhost disabled={0 === i} accessibilityText={L.moveUp} onPress={()=>{
|
|
114
|
+
var _props_onMoveAction;
|
|
115
|
+
return null == (_props_onMoveAction = props.onMoveAction) ? void 0 : _props_onMoveAction.call(props, i, i - 1);
|
|
116
|
+
}}/>
|
|
117
|
+
<G9IconButton {...id(`Action${i}_Down`) ? {
|
|
118
|
+
id: id(`Action${i}_Down`)
|
|
119
|
+
} : {}} emoji="↓" isGhost disabled={i === props.actions.length - 1} accessibilityText={L.moveDown} onPress={()=>{
|
|
120
|
+
var _props_onMoveAction;
|
|
121
|
+
return null == (_props_onMoveAction = props.onMoveAction) ? void 0 : _props_onMoveAction.call(props, i, i + 1);
|
|
122
|
+
}}/>
|
|
123
|
+
</> : null}
|
|
124
|
+
<G9IconButton {...id(`Action${i}_Remove`) ? {
|
|
125
|
+
id: id(`Action${i}_Remove`)
|
|
126
|
+
} : {}} icon="close" isGhost accessibilityText={L.remove} onPress={()=>props.onRemoveAction(i)}/>
|
|
127
|
+
</view>))}
|
|
128
|
+
{props.actionKinds.length && props.actions.length < maxA ? <G9Button {...id('AddAction') ? {
|
|
129
|
+
id: id('AddAction')
|
|
130
|
+
} : {}} text={`+ ${L.addAction}`} variant="ghost" size="small" onPress={()=>setMenu('action')}/> : null}
|
|
131
|
+
</Step>
|
|
132
|
+
</view>
|
|
133
|
+
{props.footer ? <view className="g9-rule__footer">{props.footer}</view> : null}
|
|
134
|
+
<G9Menu open={null !== menu} onClose={()=>setMenu(null)} {...anchor ? {
|
|
135
|
+
anchorId: anchor
|
|
136
|
+
} : {}} {...props.id ? {
|
|
137
|
+
id: `${props.id}_Menu`
|
|
138
|
+
} : {}} items={'trigger' === menu ? items(props.triggers, props.trigger) : 'condition' === menu ? items(props.conditionKinds) : items(props.actionKinds)} onSelect={(key)=>{
|
|
139
|
+
if ('trigger' === menu) props.onTriggerChange(key);
|
|
140
|
+
else if ('condition' === menu) props.onAddCondition(key);
|
|
141
|
+
else props.onAddAction(key);
|
|
142
|
+
}}/>
|
|
143
|
+
</view>;
|
|
144
|
+
}
|
|
145
|
+
export { G9RuleBuilder };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type G9IconInput } from '@g9tm/lynxcontrols/icon';
|
|
2
|
+
import './projects.css';
|
|
3
|
+
/** How urgent a task is (none has no mark). */
|
|
4
|
+
export type G9TaskPriority = 'none' | 'low' | 'medium' | 'high' | 'urgent';
|
|
5
|
+
/** The tone of a due date: due soon, overdue, done in time. */
|
|
6
|
+
export type G9DueTone = 'neutral' | 'warning' | 'danger' | 'success';
|
|
7
|
+
/** A person on a task. */
|
|
8
|
+
export interface G9TaskPerson {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly image?: string | null;
|
|
11
|
+
}
|
|
12
|
+
/** Props of {@link G9TaskCard}. */
|
|
13
|
+
export interface G9TaskCardProps {
|
|
14
|
+
readonly id?: string;
|
|
15
|
+
/** The task's code (`WEB-12`), left to right. */
|
|
16
|
+
readonly code?: string;
|
|
17
|
+
readonly title: string;
|
|
18
|
+
/** Done: the title struck through and dimmed. */
|
|
19
|
+
readonly done?: boolean;
|
|
20
|
+
readonly priority?: G9TaskPriority;
|
|
21
|
+
/** The priority's words (spoken; the app's language). */
|
|
22
|
+
readonly priorityLabel?: string;
|
|
23
|
+
/** The priority's icon instead of its glyph. */
|
|
24
|
+
readonly priorityIcon?: G9IconInput;
|
|
25
|
+
/** Up to three shown, then «+n». */
|
|
26
|
+
readonly labels?: readonly string[];
|
|
27
|
+
readonly due?: {
|
|
28
|
+
readonly text: string;
|
|
29
|
+
readonly tone?: G9DueTone;
|
|
30
|
+
};
|
|
31
|
+
readonly checklist?: {
|
|
32
|
+
readonly done: number;
|
|
33
|
+
readonly total: number;
|
|
34
|
+
};
|
|
35
|
+
readonly people?: readonly G9TaskPerson[];
|
|
36
|
+
/** Waits for unfinished tasks: a badge with `blockedLabel`. */
|
|
37
|
+
readonly blocked?: boolean;
|
|
38
|
+
readonly blockedLabel?: string;
|
|
39
|
+
/** Where it came from (a message, a meeting, a form, a repeat): small icons after the code. */
|
|
40
|
+
readonly marks?: readonly G9IconInput[];
|
|
41
|
+
/** A colour stripe at the start (the project's, an epic's). */
|
|
42
|
+
readonly color?: string;
|
|
43
|
+
/** A cover picture. */
|
|
44
|
+
readonly cover?: string | null;
|
|
45
|
+
/** Lifted by a drag (faded where it was). */
|
|
46
|
+
readonly dragging?: boolean;
|
|
47
|
+
readonly onPress?: () => void;
|
|
48
|
+
readonly onLongPress?: () => void;
|
|
49
|
+
/** Default: the code and the title. */
|
|
50
|
+
readonly accessibilityLabel?: string;
|
|
51
|
+
}
|
|
52
|
+
/** A task on a board or in a list. */
|
|
53
|
+
export declare const G9TaskCard: import("react").NamedExoticComponent<G9TaskCardProps>;
|
|
54
|
+
//# sourceMappingURL=task-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-card.d.ts","sourceRoot":"","sources":["../src/task-card.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,gBAAgB,CAAC;AAExB,+CAA+C;AAC/C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3E,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErE,0BAA0B;AAC1B,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC,yDAAyD;IACzD,QAAQ,CAAC,aAA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
+
import { G9Avatar } from "@g9tm/lynxcontrols/display";
|
|
3
|
+
import { G9Icon } from "@g9tm/lynxcontrols/icon";
|
|
4
|
+
import { useG9Culture, useG9Direction } from "@g9tm/lynxcontrols/provider";
|
|
5
|
+
import { g9Haptic, toNativeDigits } from "@g9tm/lynxcontrols-foundation";
|
|
6
|
+
import { memo } from "@lynx-js/react";
|
|
7
|
+
import "./projects.css";
|
|
8
|
+
const PRIORITY = {
|
|
9
|
+
low: {
|
|
10
|
+
glyph: '↓',
|
|
11
|
+
color: 'var(--g9-info)'
|
|
12
|
+
},
|
|
13
|
+
medium: {
|
|
14
|
+
glyph: '↑',
|
|
15
|
+
color: 'var(--g9-warning)'
|
|
16
|
+
},
|
|
17
|
+
high: {
|
|
18
|
+
glyph: '⇈',
|
|
19
|
+
color: '#f76707'
|
|
20
|
+
},
|
|
21
|
+
urgent: {
|
|
22
|
+
glyph: '‼',
|
|
23
|
+
color: 'var(--g9-error)'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const DUE = {
|
|
27
|
+
neutral: 'var(--g9-text-tertiary)',
|
|
28
|
+
warning: 'var(--g9-warning)',
|
|
29
|
+
danger: 'var(--g9-error)',
|
|
30
|
+
success: 'var(--g9-success)'
|
|
31
|
+
};
|
|
32
|
+
const G9TaskCard = memo(function(props) {
|
|
33
|
+
var _props_labels, _props_people, _props_accessibilityLabel, _props_marks, _props_blockedLabel, _props_due_tone;
|
|
34
|
+
var _props_marks1;
|
|
35
|
+
const rtl = 'rtl' === useG9Direction();
|
|
36
|
+
const culture = useG9Culture();
|
|
37
|
+
const digits = (n)=>toNativeDigits(String(n), culture.numberingSystem);
|
|
38
|
+
const row = {
|
|
39
|
+
flexDirection: rtl ? 'row-reverse' : 'row',
|
|
40
|
+
direction: 'ltr'
|
|
41
|
+
};
|
|
42
|
+
const align = {
|
|
43
|
+
textAlign: rtl ? 'right' : 'left'
|
|
44
|
+
};
|
|
45
|
+
const mark = props.priority && 'none' !== props.priority ? PRIORITY[props.priority] : null;
|
|
46
|
+
const labels = null != (_props_labels = props.labels) ? _props_labels : [];
|
|
47
|
+
const people = null != (_props_people = props.people) ? _props_people : [];
|
|
48
|
+
const list = props.checklist && props.checklist.total > 0 ? props.checklist : null;
|
|
49
|
+
const complete = list ? list.done >= list.total : false;
|
|
50
|
+
return <view className={`g9-task${props.dragging ? ' g9-task--dragging' : ''}`} {...g9IdProps(props.id)} {...props.onPress ? {
|
|
51
|
+
bindtap: ()=>{
|
|
52
|
+
var _props_onPress;
|
|
53
|
+
return null == (_props_onPress = props.onPress) ? void 0 : _props_onPress.call(props);
|
|
54
|
+
}
|
|
55
|
+
} : {}} {...props.onLongPress ? {
|
|
56
|
+
bindlongpress: ()=>{
|
|
57
|
+
var _props_onLongPress;
|
|
58
|
+
return g9Haptic('impact'), null == (_props_onLongPress = props.onLongPress) ? void 0 : _props_onLongPress.call(props);
|
|
59
|
+
}
|
|
60
|
+
} : {}} accessibility-element={true} accessibility-traits="button" accessibility-label={null != (_props_accessibilityLabel = props.accessibilityLabel) ? _props_accessibilityLabel : [
|
|
61
|
+
props.code,
|
|
62
|
+
props.title,
|
|
63
|
+
props.blocked ? props.blockedLabel : '',
|
|
64
|
+
mark ? props.priorityLabel : ''
|
|
65
|
+
].filter(Boolean).join(', ')}>
|
|
66
|
+
{props.color ? <view className="g9-task__stripe" style={{
|
|
67
|
+
backgroundColor: props.color,
|
|
68
|
+
[rtl ? 'right' : 'left']: '0px'
|
|
69
|
+
}}/> : null}
|
|
70
|
+
{props.cover ? <image src={props.cover} mode="aspectFill" className="g9-task__cover"/> : null}
|
|
71
|
+
{props.code || (null == (_props_marks1 = props.marks) ? void 0 : _props_marks1.length) || props.blocked || mark ? <view className="g9-task__top" style={row}>
|
|
72
|
+
{props.code ? <text className="g9-task__code">{props.code}</text> : null}
|
|
73
|
+
{(null != (_props_marks = props.marks) ? _props_marks : []).map((m, i)=><G9Icon key={i} icon={m} size={12} color="var(--g9-text-tertiary)"/>)}
|
|
74
|
+
{props.blocked ? <view className="g9-task__blocked" style={row}>
|
|
75
|
+
<text className="g9-task__blocked-text">{`🔒 ${null != (_props_blockedLabel = props.blockedLabel) ? _props_blockedLabel : ''}`.trim()}</text>
|
|
76
|
+
</view> : null}
|
|
77
|
+
<view className="g9-task__spacer"/>
|
|
78
|
+
{mark ? props.priorityIcon ? <G9Icon icon={props.priorityIcon} size={15} color={mark.color}/> : <text className="g9-task__priority" style={{
|
|
79
|
+
color: mark.color
|
|
80
|
+
}}>
|
|
81
|
+
{mark.glyph}
|
|
82
|
+
</text> : null}
|
|
83
|
+
</view> : null}
|
|
84
|
+
<text className={`g9-task__title${props.done ? ' g9-task__title--done' : ''}`} text-maxline="3" style={align}>
|
|
85
|
+
{props.title}
|
|
86
|
+
</text>
|
|
87
|
+
{labels.length ? <view className="g9-task__labels" style={row}>
|
|
88
|
+
{labels.slice(0, 3).map((l)=><view key={l} className="g9-task__label">
|
|
89
|
+
<text className="g9-task__label-text" text-maxline="1">
|
|
90
|
+
{l}
|
|
91
|
+
</text>
|
|
92
|
+
</view>)}
|
|
93
|
+
{labels.length > 3 ? <view className="g9-task__label">
|
|
94
|
+
<text className="g9-task__label-text">{`+${digits(labels.length - 3)}`}</text>
|
|
95
|
+
</view> : null}
|
|
96
|
+
</view> : null}
|
|
97
|
+
{props.due || list || people.length ? <view className="g9-task__bottom" style={row}>
|
|
98
|
+
{props.due ? <text className="g9-task__due" style={{
|
|
99
|
+
color: DUE[null != (_props_due_tone = props.due.tone) ? _props_due_tone : 'neutral']
|
|
100
|
+
}}>
|
|
101
|
+
{props.due.text}
|
|
102
|
+
</text> : null}
|
|
103
|
+
{list ? <text className={`g9-task__check${complete ? ' g9-task__check--done' : ''}`}>
|
|
104
|
+
{`☑ ${digits(list.done)}/${digits(list.total)}`}
|
|
105
|
+
</text> : null}
|
|
106
|
+
<view className="g9-task__spacer"/>
|
|
107
|
+
<view className="g9-task__people" style={row}>
|
|
108
|
+
{people.slice(0, 3).map((p, i)=>{
|
|
109
|
+
var _p_image;
|
|
110
|
+
return <G9Avatar key={`${p.name}${i}`} name={p.name} image={null != (_p_image = p.image) ? _p_image : null} size={20}/>;
|
|
111
|
+
})}
|
|
112
|
+
{people.length > 3 ? <text className="g9-task__more">{`+${digits(people.length - 3)}`}</text> : null}
|
|
113
|
+
</view>
|
|
114
|
+
</view> : null}
|
|
115
|
+
</view>;
|
|
116
|
+
});
|
|
117
|
+
export { G9TaskCard };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ReactNode } from '@lynx-js/react';
|
|
2
|
+
import './projects.css';
|
|
3
|
+
import { type G9DaySpan, type G9TimelineZoom } from './model.js';
|
|
4
|
+
/** One row of the timeline. */
|
|
5
|
+
export interface G9TimelineRow {
|
|
6
|
+
readonly key: string;
|
|
7
|
+
/** `'item'` (default) a bar, `'group'` a heading row, `'milestone'` a diamond on `day`. */
|
|
8
|
+
readonly kind?: 'item' | 'group' | 'milestone';
|
|
9
|
+
readonly title: string;
|
|
10
|
+
readonly span?: G9DaySpan | null;
|
|
11
|
+
/** A milestone's day. */
|
|
12
|
+
readonly day?: number;
|
|
13
|
+
readonly color?: string;
|
|
14
|
+
readonly done?: boolean;
|
|
15
|
+
/** Waits for unfinished work: a warning outline. */
|
|
16
|
+
readonly blocked?: boolean;
|
|
17
|
+
/** 0–1: the part of the bar filled. */
|
|
18
|
+
readonly progress?: number;
|
|
19
|
+
/** The keys of rows it waits for (arrows from their ends). */
|
|
20
|
+
readonly dependsOn?: readonly string[];
|
|
21
|
+
/** Its bar is not moved by a drag. */
|
|
22
|
+
readonly locked?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Props of {@link G9Timeline}. */
|
|
25
|
+
export interface G9TimelineProps {
|
|
26
|
+
readonly id?: string;
|
|
27
|
+
readonly rows: readonly G9TimelineRow[];
|
|
28
|
+
/** Today (epoch days). */
|
|
29
|
+
readonly today: number;
|
|
30
|
+
readonly zoom?: G9TimelineZoom;
|
|
31
|
+
/** A zoom switcher over the chart, in the app's words. */
|
|
32
|
+
readonly onZoomChange?: (zoom: G9TimelineZoom) => void;
|
|
33
|
+
readonly zoomLabels?: Readonly<Record<G9TimelineZoom, string>>;
|
|
34
|
+
/** A bar moved or resized (or an unscheduled row tapped: a day at the tap). */
|
|
35
|
+
readonly onSpanChange?: (key: string, span: G9DaySpan) => void;
|
|
36
|
+
/** A row's title or bar tapped. */
|
|
37
|
+
readonly onOpen?: (key: string) => void;
|
|
38
|
+
/** The titles column's width. Default 160. */
|
|
39
|
+
readonly labelWidth?: number;
|
|
40
|
+
readonly rowHeight?: number;
|
|
41
|
+
/** Arrows for `dependsOn`. Default true. */
|
|
42
|
+
readonly showLinks?: boolean;
|
|
43
|
+
/** Weekdays shaded (0 Sunday … 6 Saturday). Default Friday in Persian, Saturday and Sunday elsewhere. */
|
|
44
|
+
readonly weekend?: readonly number[];
|
|
45
|
+
/** The week's first day. Default Saturday in Persian, Monday elsewhere. */
|
|
46
|
+
readonly weekStartsOn?: number;
|
|
47
|
+
/** The range drawn (epoch days); default every bar and today, padded. */
|
|
48
|
+
readonly range?: {
|
|
49
|
+
readonly from: number;
|
|
50
|
+
readonly to: number;
|
|
51
|
+
};
|
|
52
|
+
/** The row ringed (opened from elsewhere). */
|
|
53
|
+
readonly focusedKey?: string | null;
|
|
54
|
+
readonly todayLabel?: string;
|
|
55
|
+
/** How a bar is spoken (default its title). */
|
|
56
|
+
readonly barLabel?: (row: G9TimelineRow) => string;
|
|
57
|
+
}
|
|
58
|
+
/** A Gantt chart: rows and bars an app keeps, moved and resized on the main thread, in the culture's calendar. */
|
|
59
|
+
export declare function G9Timeline(props: G9TimelineProps): ReactNode;
|
|
60
|
+
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../src/timeline.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,gBAAgB,CAAC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