v2.4.3
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,7 +6,6 @@ yarn-debug.log*
|
|||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
pnpm-debug.log*
|
pnpm-debug.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
yarn.lock
|
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
@@ -25,3 +24,5 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
yarn.log
|
||||||
|
.claude
|
||||||
|
|||||||
2
.sync
2
.sync
@@ -1 +1 @@
|
|||||||
0d06fa37fa91f51a38b15b4dac095537d366a653
|
913b95b49f0d253d50d6b3461c48aaa9facb7ba2
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useContext, useMemo } from 'react';
|
import { useState, useContext, useMemo } from 'react';
|
||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import { Gantt, ContextMenu, Editor, defaultMenuOptions } from '../../src/';
|
import { Gantt, ContextMenu, Editor, getMenuOptions } from '../../src/';
|
||||||
import { context } from '@svar-ui/react-core';
|
import { context } from '@svar-ui/react-core';
|
||||||
|
|
||||||
export default function ContextMenuOptions({ skinSettings }) {
|
export default function ContextMenuOptions({ skinSettings }) {
|
||||||
@@ -17,9 +17,7 @@ export default function ContextMenuOptions({ skinSettings }) {
|
|||||||
const [options] = useState(() => {
|
const [options] = useState(() => {
|
||||||
const ids = ['cut-task', 'copy-task', 'paste-task', 'delete-task'];
|
const ids = ['cut-task', 'copy-task', 'paste-task', 'delete-task'];
|
||||||
let arr = [{ id: 'add-task:after', text: ' Add below', icon: 'wxi-plus' }];
|
let arr = [{ id: 'add-task:after', text: ' Add below', icon: 'wxi-plus' }];
|
||||||
arr = arr.concat(
|
arr = arr.concat(getMenuOptions().filter((op) => ids.indexOf(op.id) >= 0));
|
||||||
defaultMenuOptions.filter((op) => ids.indexOf(op.id) >= 0),
|
|
||||||
);
|
|
||||||
arr.push({
|
arr.push({
|
||||||
id: 'my-action',
|
id: 'my-action',
|
||||||
text: 'My action',
|
text: 'My action',
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export default function DropDownMenu({ skinSettings }) {
|
|||||||
links={data.links}
|
links={data.links}
|
||||||
scales={data.scales}
|
scales={data.scales}
|
||||||
/>
|
/>
|
||||||
<Editor api={api} />
|
{api && <Editor api={api} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const parseDates = (data) => {
|
|||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export default function GanttBackend() {
|
export default function GanttBackend() {
|
||||||
const server = 'https://master--svar-gantt-go--dev.webix.io';
|
const server = 'https://master--svar-gantt-go--dev.webix.io';
|
||||||
|
|
||||||
@@ -29,30 +28,26 @@ export default function GanttBackend() {
|
|||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const init = useCallback(
|
const init = useCallback((api) => {
|
||||||
(api) => {
|
setApi(api);
|
||||||
setApi(api);
|
|
||||||
|
|
||||||
api.on('request-data', (ev) => {
|
api.on('request-data', (ev) => {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
fetch(server + `/tasks/${ev.id}`)
|
fetch(server + `/tasks/${ev.id}`)
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((arr) => parseDates(arr)),
|
.then((arr) => parseDates(arr)),
|
||||||
fetch(server + `/links/${ev.id}`).then((res) => res.json()),
|
fetch(server + `/links/${ev.id}`).then((res) => res.json()),
|
||||||
]).then(([tasks, links]) => {
|
]).then(([tasks, links]) => {
|
||||||
api.exec('provide-data', {
|
api.exec('provide-data', {
|
||||||
id: ev.id,
|
id: ev.id,
|
||||||
data: {
|
data: {
|
||||||
tasks,
|
tasks,
|
||||||
links,
|
links,
|
||||||
},
|
},
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
[],
|
}, []);
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import { Gantt, ContextMenu, Editor, defaultEditorItems } from '../../src';
|
import { Gantt, ContextMenu, Editor, getEditorItems } from '../../src';
|
||||||
import { RadioButtonGroup } from '@svar-ui/react-core';
|
import { RadioButtonGroup } from '@svar-ui/react-core';
|
||||||
import './GanttDurationUnitChanges.css';
|
import './GanttDurationUnitChanges.css';
|
||||||
|
|
||||||
@@ -18,18 +18,18 @@ export default function GanttDurationUnitChanges({ skinSettings }) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const options = [
|
const options = [
|
||||||
{ id: 'hour', label: 'Hour' },
|
|
||||||
{ id: 'day', label: 'Day' },
|
{ id: 'day', label: 'Day' },
|
||||||
|
{ id: 'hour', label: 'Hour' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const [durationUnit, setDurationUnit] = useState('hour');
|
const [durationUnit, setDurationUnit] = useState('day');
|
||||||
const [scales, setScales] = useState(scalesMap['hour']);
|
const [scales, setScales] = useState(scalesMap['day']);
|
||||||
|
|
||||||
const [api, setApi] = useState(null);
|
const [api, setApi] = useState(null);
|
||||||
|
|
||||||
const items = useMemo(
|
const items = useMemo(
|
||||||
() =>
|
() =>
|
||||||
defaultEditorItems.map((ed) => ({
|
getEditorItems().map((ed) => ({
|
||||||
...ed,
|
...ed,
|
||||||
...(ed.comp === 'date' && {
|
...(ed.comp === 'date' && {
|
||||||
config: { time: durationUnit === 'hour' },
|
config: { time: durationUnit === 'hour' },
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
Gantt,
|
Gantt,
|
||||||
ContextMenu,
|
ContextMenu,
|
||||||
Editor,
|
Editor,
|
||||||
defaultEditorItems,
|
getEditorItems,
|
||||||
defaultColumns,
|
defaultColumns,
|
||||||
} from '../../src';
|
} from '../../src';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
@@ -16,7 +16,7 @@ export default function GanttDurationUnitHour({ skinSettings }) {
|
|||||||
|
|
||||||
const items = useMemo(
|
const items = useMemo(
|
||||||
() =>
|
() =>
|
||||||
defaultEditorItems.map((ed) => ({
|
getEditorItems().map((ed) => ({
|
||||||
...ed,
|
...ed,
|
||||||
...(ed.comp === 'date' && { config: { time: true } }),
|
...(ed.comp === 'date' && { config: { time: true } }),
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
import { useState, useMemo } from 'react';
|
import { useState, useMemo } from 'react';
|
||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import {
|
import { Gantt, Editor, getEditorItems, registerEditorItem } from '../../src';
|
||||||
Gantt,
|
|
||||||
Editor,
|
|
||||||
defaultEditorItems,
|
|
||||||
registerEditorItem,
|
|
||||||
} from '../../src';
|
|
||||||
import { Comments } from '@svar-ui/react-comments';
|
import { Comments } from '@svar-ui/react-comments';
|
||||||
registerEditorItem('comments', Comments);
|
registerEditorItem('comments', Comments);
|
||||||
|
|
||||||
@@ -47,7 +42,7 @@ function GanttEditorComments(props) {
|
|||||||
const [api, setApi] = useState();
|
const [api, setApi] = useState();
|
||||||
const keys = useMemo(() => ['text', 'details'], []);
|
const keys = useMemo(() => ['text', 'details'], []);
|
||||||
const items = useMemo(() => {
|
const items = useMemo(() => {
|
||||||
const items = defaultEditorItems.filter((op) => keys.indexOf(op.key) >= 0);
|
const items = getEditorItems().filter((op) => keys.indexOf(op.key) >= 0);
|
||||||
items.push({
|
items.push({
|
||||||
key: 'comments',
|
key: 'comments',
|
||||||
comp: 'comments',
|
comp: 'comments',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useMemo } from 'react';
|
import { useState, useMemo } from 'react';
|
||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import { Gantt, Editor, defaultEditorItems } from '../../src';
|
import { Gantt, Editor, getEditorItems } from '../../src';
|
||||||
|
|
||||||
function GanttEditorConfig({ skinSettings }) {
|
function GanttEditorConfig({ skinSettings }) {
|
||||||
const data = useMemo(() => getData(), []);
|
const data = useMemo(() => getData(), []);
|
||||||
@@ -24,12 +24,14 @@ function GanttEditorConfig({ skinSettings }) {
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const defaultEditorItems = useMemo(() => getEditorItems(), []);
|
||||||
|
|
||||||
const items = useMemo(
|
const items = useMemo(
|
||||||
() =>
|
() =>
|
||||||
keys.map((key) => ({
|
keys.map((key) => ({
|
||||||
...defaultEditorItems.find((op) => op.key === key),
|
...defaultEditorItems.find((op) => op.key === key),
|
||||||
})),
|
})),
|
||||||
[keys],
|
[keys, defaultEditorItems],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -41,14 +43,16 @@ function GanttEditorConfig({ skinSettings }) {
|
|||||||
links={data.links}
|
links={data.links}
|
||||||
scales={data.scales}
|
scales={data.scales}
|
||||||
/>
|
/>
|
||||||
{api && <Editor
|
{api && (
|
||||||
api={api}
|
<Editor
|
||||||
items={items}
|
api={api}
|
||||||
bottomBar={bottomBar}
|
items={items}
|
||||||
topBar={false}
|
bottomBar={bottomBar}
|
||||||
placement="modal"
|
topBar={false}
|
||||||
autoSave={false}
|
placement="modal"
|
||||||
/>}
|
autoSave={false}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import { useEffect, useMemo, useState } from 'react';
|
|||||||
import {
|
import {
|
||||||
Gantt,
|
Gantt,
|
||||||
Editor,
|
Editor,
|
||||||
defaultEditorItems,
|
|
||||||
registerEditorItem,
|
registerEditorItem,
|
||||||
defaultTaskTypes,
|
defaultTaskTypes,
|
||||||
|
getEditorItems,
|
||||||
} from '../../src';
|
} from '../../src';
|
||||||
import { RadioButtonGroup } from '@svar-ui/react-core';
|
import { RadioButtonGroup } from '@svar-ui/react-core';
|
||||||
import UsersCustomCombo from '../custom/UsersCustomCombo.jsx';
|
import UsersCustomCombo from '../custom/UsersCustomCombo.jsx';
|
||||||
@@ -18,6 +18,8 @@ export default function GanttEditorCustomControls({ skinSettings }) {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const items = useMemo(() => {
|
const items = useMemo(() => {
|
||||||
|
const defaultEditorItems = getEditorItems();
|
||||||
|
|
||||||
const items = defaultEditorItems.map((item) => ({ ...item }));
|
const items = defaultEditorItems.map((item) => ({ ...item }));
|
||||||
items.splice(
|
items.splice(
|
||||||
defaultEditorItems.findIndex((d) => d.key === 'type'),
|
defaultEditorItems.findIndex((d) => d.key === 'type'),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useMemo, useState } from 'react';
|
|||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import { Gantt, Editor } from '../../src';
|
import { Gantt, Editor } from '../../src';
|
||||||
|
|
||||||
function GanttEditorReadonly({...skinSettings}) {
|
function GanttEditorReadonly({ ...skinSettings }) {
|
||||||
const data = useMemo(() => getData(), []);
|
const data = useMemo(() => getData(), []);
|
||||||
const [api, setApi] = useState();
|
const [api, setApi] = useState();
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
import { useState, useMemo } from 'react';
|
import { useState, useMemo } from 'react';
|
||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import {
|
import { Gantt, Editor, getEditorItems, registerEditorItem } from '../../src';
|
||||||
Gantt,
|
|
||||||
Editor,
|
|
||||||
defaultEditorItems,
|
|
||||||
registerEditorItem,
|
|
||||||
} from '../../src';
|
|
||||||
import { Tasklist } from '@svar-ui/react-tasklist';
|
import { Tasklist } from '@svar-ui/react-tasklist';
|
||||||
|
|
||||||
registerEditorItem('tasks', Tasklist);
|
registerEditorItem('tasks', Tasklist);
|
||||||
@@ -71,7 +66,7 @@ export default function GanttEditorTasks({ skinSettings }) {
|
|||||||
|
|
||||||
const items = useMemo(() => {
|
const items = useMemo(() => {
|
||||||
const keys = ['text', 'details'];
|
const keys = ['text', 'details'];
|
||||||
const items = defaultEditorItems.filter((op) => keys.indexOf(op.key) >= 0);
|
const items = getEditorItems().filter((op) => keys.indexOf(op.key) >= 0);
|
||||||
items.push({
|
items.push({
|
||||||
key: 'tasks',
|
key: 'tasks',
|
||||||
comp: 'tasks',
|
comp: 'tasks',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import { Gantt, Editor, defaultEditorItems } from '../../src';
|
import { Gantt, Editor, getEditorItems } from '../../src';
|
||||||
|
|
||||||
function GanttEditorValidation({ skinSettings }) {
|
function GanttEditorValidation({ skinSettings }) {
|
||||||
const data = useMemo(() => getData(), []);
|
const data = useMemo(() => getData(), []);
|
||||||
@@ -8,7 +8,7 @@ function GanttEditorValidation({ skinSettings }) {
|
|||||||
|
|
||||||
const items = useMemo(
|
const items = useMemo(
|
||||||
() =>
|
() =>
|
||||||
defaultEditorItems.map((ed) => ({
|
getEditorItems().map((ed) => ({
|
||||||
...ed,
|
...ed,
|
||||||
...(ed.comp === 'text' && { required: true }),
|
...(ed.comp === 'text' && { required: true }),
|
||||||
...(ed.comp === 'counter' && {
|
...(ed.comp === 'counter' && {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import { Gantt, Fullscreen } from '../../src/';
|
import { Gantt } from '../../src/';
|
||||||
|
import { Fullscreen } from '@svar-ui/react-core';
|
||||||
import './GanttFullscreen.css';
|
import './GanttFullscreen.css';
|
||||||
|
|
||||||
function GanttFullscreen({ skinSettings }) {
|
function GanttFullscreen({ skinSettings }) {
|
||||||
@@ -11,11 +12,7 @@ function GanttFullscreen({ skinSettings }) {
|
|||||||
<h4>Click the "expand" icon, or click on Gantt and press Ctrl+Shift+F</h4>
|
<h4>Click the "expand" icon, or click on Gantt and press Ctrl+Shift+F</h4>
|
||||||
<div className="wx-0qqHrQ85 gtcell">
|
<div className="wx-0qqHrQ85 gtcell">
|
||||||
<Fullscreen hotkey="ctrl+shift+f">
|
<Fullscreen hotkey="ctrl+shift+f">
|
||||||
<Gantt
|
<Gantt {...skinSettings} tasks={data.tasks} links={data.links} />
|
||||||
{...skinSettings}
|
|
||||||
tasks={data.tasks}
|
|
||||||
links={data.links}
|
|
||||||
/>
|
|
||||||
</Fullscreen>
|
</Fullscreen>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ function GanttHolidays({ skinSettings }) {
|
|||||||
|
|
||||||
const scales = useMemo(
|
const scales = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{ unit: 'year', step: 1, format: 'yyyy' },
|
{ unit: 'year', step: 1, format: '%Y' },
|
||||||
{ unit: 'month', step: 2, format: 'MMMM yyy' },
|
{ unit: 'month', step: 2, format: '%F %Y' },
|
||||||
{ unit: 'week', step: 1, format: 'wo' },
|
{ unit: 'week', step: 1, format: 'Week %W' },
|
||||||
{ unit: 'day', step: 1, format: 'd, EEEE' /* , css: dayStyle */ }
|
{ unit: 'day', step: 1, format: '%j, %l' },
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -23,36 +23,36 @@ function GanttLengthUnit({ skinSettings }) {
|
|||||||
switch (lengthUnit) {
|
switch (lengthUnit) {
|
||||||
case 'minute':
|
case 'minute':
|
||||||
scales = [
|
scales = [
|
||||||
{ unit: 'day', step: 1, format: 'MMM d' },
|
{ unit: 'day', step: 1, format: '%M %j' },
|
||||||
{ unit: 'hour', step: 1, format: 'HH:mm' },
|
{ unit: 'hour', step: 1, format: '%H:%i' },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'hour':
|
case 'hour':
|
||||||
scales = [
|
scales = [
|
||||||
{ unit: 'month', step: 1, format: 'MMM' },
|
{ unit: 'month', step: 1, format: '%M' },
|
||||||
{ unit: 'day', step: 1, format: 'MMM d' },
|
{ unit: 'day', step: 1, format: '%M %j' },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
scales = [
|
scales = [
|
||||||
{ unit: 'month', step: 1, format: 'MMM' },
|
{ unit: 'month', step: 1, format: '%M' },
|
||||||
{ unit: 'week', step: 1, format: 'w' },
|
{ unit: 'week', step: 1, format: '%w' },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'week':
|
case 'week':
|
||||||
scales = [
|
scales = [
|
||||||
{ unit: 'year', step: 1, format: 'yyyy' },
|
{ unit: 'year', step: 1, format: '%Y' },
|
||||||
{ unit: 'month', step: 1, format: 'MMM' },
|
{ unit: 'month', step: 1, format: '%M' },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
scales = [
|
scales = [
|
||||||
{ unit: 'year', step: 1, format: 'yyyy' },
|
{ unit: 'year', step: 1, format: '%Y' },
|
||||||
{ unit: 'quarter', step: 1, format: 'QQQ' },
|
{ unit: 'quarter', step: 1, format: '%Q' },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'quarter':
|
case 'quarter':
|
||||||
scales = [{ unit: 'year', step: 1, format: 'yyyy' }];
|
scales = [{ unit: 'year', step: 1, format: '%Y' }];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
scales = bigScales;
|
scales = bigScales;
|
||||||
|
|||||||
@@ -22,11 +22,7 @@ function GanttLocale({ skinSettings }) {
|
|||||||
onChange={({ value }) => setLang(value)}
|
onChange={({ value }) => setLang(value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{lang === 'en' && (
|
{lang === 'en' && <GanttWidget skinSettings={skinSettings} />}
|
||||||
<GanttWidget
|
|
||||||
skinSettings={skinSettings}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{lang === 'cn' && (
|
{lang === 'cn' && (
|
||||||
<Locale words={{ ...cn, ...cnCore }}>
|
<Locale words={{ ...cn, ...cnCore }}>
|
||||||
<GanttWidget skinSettings={skinSettings} />
|
<GanttWidget skinSettings={skinSettings} />
|
||||||
@@ -42,19 +38,20 @@ function GanttWidget(props) {
|
|||||||
const [api, setApi] = useState(null);
|
const [api, setApi] = useState(null);
|
||||||
const data = useMemo(() => getData(), []);
|
const data = useMemo(() => getData(), []);
|
||||||
|
|
||||||
|
const settings = {
|
||||||
|
...skinSettings,
|
||||||
|
tasks: data.tasks,
|
||||||
|
links: data.links,
|
||||||
|
scales: data.scales,
|
||||||
|
zoom: true,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Toolbar api={api} />
|
<Toolbar api={api} />
|
||||||
<div className="wx-ycv5Oz8L gtcell">
|
<div className="wx-ycv5Oz8L gtcell">
|
||||||
<ContextMenu api={api}>
|
<ContextMenu api={api}>
|
||||||
<Gantt
|
<Gantt {...settings} init={setApi} />
|
||||||
{...skinSettings}
|
|
||||||
tasks={data.tasks}
|
|
||||||
links={data.links}
|
|
||||||
scales={data.scales}
|
|
||||||
init={setApi}
|
|
||||||
/>
|
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
{api && <Editor api={api} />}
|
{api && <Editor api={api} />}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ import {
|
|||||||
isSameMonth,
|
isSameMonth,
|
||||||
addMonths,
|
addMonths,
|
||||||
addDays,
|
addDays,
|
||||||
format,
|
|
||||||
differenceInDays,
|
differenceInDays,
|
||||||
|
format,
|
||||||
} from 'date-fns';
|
} from 'date-fns';
|
||||||
import './GanttMinScaleUnit.css';
|
import './GanttMinScaleUnit.css';
|
||||||
|
|
||||||
const options = [
|
const options = [
|
||||||
{ id: 1, label: 'sprint' },
|
{ id: 1, label: 'sprint' },
|
||||||
{ id: 2, label: 'month, sprint' },
|
{ id: 2, label: 'month, sprint' },
|
||||||
{ id: 3, label: 'month, sprint, week' },
|
{ id: 3, label: 'month, sprint, week' },
|
||||||
{ id: 4, label: 'month, sprint, week, day' },
|
{ id: 4, label: 'month, sprint, week, day' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function GanttMinScaleUnit({ skinSettings }) {
|
export default function GanttMinScaleUnit({ skinSettings }) {
|
||||||
const data = useMemo(() => getData(), []);
|
const data = useMemo(() => getData(), []);
|
||||||
@@ -51,10 +51,10 @@ export default function GanttMinScaleUnit({ skinSettings }) {
|
|||||||
|
|
||||||
const allScales = useMemo(
|
const allScales = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{ unit: 'month', step: 1, format: 'MMMM yyy' },
|
{ unit: 'month', step: 1, format: '%F %Y' },
|
||||||
{ unit: 'sprint', step: 1, format: sprintFormat },
|
{ unit: 'sprint', step: 1, format: sprintFormat },
|
||||||
{ unit: 'week', step: 1, format: 'w' },
|
{ unit: 'week', step: 1, format: '%w' },
|
||||||
{ unit: 'day', step: 1, format: 'd' },
|
{ unit: 'day', step: 1, format: '%j' },
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@@ -128,8 +128,8 @@ export default function GanttMinScaleUnit({ skinSettings }) {
|
|||||||
links={data.links}
|
links={data.links}
|
||||||
scales={scales}
|
scales={scales}
|
||||||
zoom={true}
|
zoom={true}
|
||||||
start={new Date(2024, 3, 1)}
|
start={new Date(2026, 3, 1)}
|
||||||
end={new Date(2024, 5, 1)}
|
end={new Date(2026, 5, 1)}
|
||||||
cellWidth={60}
|
cellWidth={60}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,33 +4,59 @@ import { Gantt } from '../../src/';
|
|||||||
import { Button } from '@svar-ui/react-core';
|
import { Button } from '@svar-ui/react-core';
|
||||||
import './GanttPerformance.css';
|
import './GanttPerformance.css';
|
||||||
|
|
||||||
|
function RenderTime({ start }){
|
||||||
|
const [end, setEnd] = useState(null);
|
||||||
|
const [label, setLabel] = useState('')
|
||||||
|
|
||||||
|
let active = useRef(true);
|
||||||
|
useEffect(() => {
|
||||||
|
if (start && end) {
|
||||||
|
setLabel((end - start)+" ms");
|
||||||
|
}
|
||||||
|
|
||||||
|
active.current = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
active.current = false;
|
||||||
|
}, 1000);
|
||||||
|
}, [start, end]);
|
||||||
|
|
||||||
|
window.__RENDER_METRICS_ENABLED__ = true;
|
||||||
|
useEffect(() => {
|
||||||
|
window.addEventListener('render-metric', (e) => {
|
||||||
|
if (!active.current) return;
|
||||||
|
if (e.detail.label === "chart") {
|
||||||
|
setEnd(new Date());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
delete window.__RENDER_METRICS_ENABLED__
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
return <span>{label}</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
const count = 10000;
|
||||||
|
const years = 3;
|
||||||
|
const data = getGeneratedData('', count, years);
|
||||||
|
|
||||||
function GanttPerformance(props) {
|
function GanttPerformance(props) {
|
||||||
const { skinSettings } = props;
|
const { skinSettings } = props;
|
||||||
|
|
||||||
const count = 1000;
|
|
||||||
const years = 3;
|
|
||||||
const data = useMemo(() => getGeneratedData('', count, years), []);
|
|
||||||
|
|
||||||
const [start, setStart] = useState(null);
|
const [start, setStart] = useState(null);
|
||||||
const outAreaRef = useRef(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (start && outAreaRef.current) {
|
|
||||||
outAreaRef.current.innerHTML = new Date() - start;
|
|
||||||
}
|
|
||||||
}, [start]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="wx-KB3Eoqwm rows">
|
<div className="wx-KB3Eoqwm rows">
|
||||||
<div className="wx-KB3Eoqwm row">
|
<div className="wx-KB3Eoqwm row">
|
||||||
{start ? (
|
{start ? (
|
||||||
<>
|
<>
|
||||||
1 000 tasks ({years} years ) rendered in{' '}
|
10 000 tasks ({years} years ) rendered in{' '}
|
||||||
<span ref={outAreaRef}></span> ms
|
<RenderTime start={start} />
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Button type="primary" onClick={() => setStart(new Date())}>
|
<Button type="primary" onClick={() => setStart(new Date()) }>
|
||||||
Press me to render Gantt chart with 1 000 tasks
|
Press me to render Gantt chart with 10 000 tasks
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
align-items: end;
|
align-items: end;
|
||||||
font-family: var(--wx-font-family);
|
font-family: var(--wx-font-family);
|
||||||
font-size: var(--wx-font-size);
|
font-size: var(--wx-font-size);
|
||||||
padding-top: 12px;
|
padding: 12px 0;
|
||||||
--wx-label-width: 130px;
|
--wx-label-width: 130px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,6 +33,16 @@
|
|||||||
.gantt.wx-RPSbwjNq.hide-links > .wx-gantt .wx-bar .wx-link {
|
.gantt.wx-RPSbwjNq.hide-links > .wx-gantt .wx-bar .wx-link {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.gantt.wx-RPSbwjNq.hide-delete-links > .wx-gantt .wx-delete-link {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.gantt.wx-RPSbwjNq.hide-delete-links > .wx-gantt .wx-line:hover {
|
||||||
|
cursor: default;
|
||||||
|
stroke: var(--wx-gantt-link-color);
|
||||||
|
}
|
||||||
|
.gantt.wx-RPSbwjNq.hide-delete-links > .wx-gantt .wx-line.wx-line-selectable {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
.gantt.wx-RPSbwjNq.hide-drag > .wx-gantt .wx-bar {
|
.gantt.wx-RPSbwjNq.hide-drag > .wx-gantt .wx-bar {
|
||||||
cursor: pointer !important;
|
cursor: pointer !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,22 @@
|
|||||||
import { useState, useEffect, useMemo, useRef, useCallback } from 'react';
|
import { useState, useMemo, useRef, useEffect, useCallback } from 'react';
|
||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import { Gantt, defaultColumns, Editor } from '../../src/';
|
import { Gantt, defaultColumns } from '../../src/';
|
||||||
import { Field, Switch } from '@svar-ui/react-core';
|
import { Field, Switch } from '@svar-ui/react-core';
|
||||||
import './GanttPreventActions.css';
|
import './GanttPreventActions.css';
|
||||||
|
|
||||||
function GanttPreventActions({ skinSettings }) {
|
function GanttPreventActions({ skinSettings }) {
|
||||||
const data = useMemo(() => getData(), []);
|
const data = useMemo(() => getData(), []);
|
||||||
|
|
||||||
const [edit, setEdit] = useState(true); // if false - cannot add and edit task
|
const [add, setAdd] = useState(true); // if false - cannot add and edit task
|
||||||
const [drag, setDrag] = useState(true); // if false - cannot drag tasks on scale
|
const [drag, setDrag] = useState(true); // if false - cannot drag tasks on scale
|
||||||
const [order, setOrder] = useState(true); // if false - cannot reorder tasks in grid
|
const [order, setOrder] = useState(true); // if false - cannot reorder tasks in grid
|
||||||
const [newLink, setNewLink] = useState(true); // if false - cannot create new links
|
const [newLink, setNewLink] = useState(true); // if false - cannot create new links
|
||||||
|
const [deleteLink, setDeleteLink] = useState(true); // if false - cannot delete links
|
||||||
|
const [progress, setProgress] = useState(true); // if false - cannot edit progress in chart
|
||||||
|
|
||||||
const ignoreRef = useRef(false);
|
|
||||||
const [api, setApi] = useState();
|
|
||||||
|
|
||||||
const editRef = useRef(edit);
|
|
||||||
const dragRef = useRef(drag);
|
const dragRef = useRef(drag);
|
||||||
const orderRef = useRef(order);
|
const orderRef = useRef(order);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
editRef.current = edit;
|
|
||||||
}, [edit]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dragRef.current = drag;
|
dragRef.current = drag;
|
||||||
}, [drag]);
|
}, [drag]);
|
||||||
@@ -32,9 +26,6 @@ function GanttPreventActions({ skinSettings }) {
|
|||||||
}, [order]);
|
}, [order]);
|
||||||
|
|
||||||
const init = useCallback((gApi) => {
|
const init = useCallback((gApi) => {
|
||||||
setApi(gApi);
|
|
||||||
|
|
||||||
gApi.intercept('show-editor', () => editRef.current || ignoreRef.current);
|
|
||||||
gApi.intercept('drag-task', (ev) => {
|
gApi.intercept('drag-task', (ev) => {
|
||||||
if (typeof ev.top !== 'undefined') return orderRef.current;
|
if (typeof ev.top !== 'undefined') return orderRef.current;
|
||||||
return dragRef.current; // ev.width && ev.left
|
return dragRef.current; // ev.width && ev.left
|
||||||
@@ -43,66 +34,46 @@ function GanttPreventActions({ skinSettings }) {
|
|||||||
|
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() =>
|
() =>
|
||||||
edit ? defaultColumns : defaultColumns.filter((a) => a.id != 'add-task'),
|
add ? defaultColumns : defaultColumns.filter((a) => a.id != 'add-task'),
|
||||||
[edit],
|
[add],
|
||||||
);
|
);
|
||||||
|
|
||||||
// for demo purposes: close editor when checkbox is unchecked
|
|
||||||
useEffect(() => {
|
|
||||||
if (!edit) {
|
|
||||||
ignoreRef.current = true;
|
|
||||||
api.exec('show-editor', { id: null });
|
|
||||||
ignoreRef.current = false;
|
|
||||||
}
|
|
||||||
}, [edit, api]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="wx-RPSbwjNq rows">
|
<div className="wx-RPSbwjNq rows">
|
||||||
<div className="wx-RPSbwjNq bar">
|
<div className="wx-RPSbwjNq bar">
|
||||||
<Field label="Adding and editing" position={'left'}>
|
<Field label="Adding tasks" position={'left'}>
|
||||||
{({ id }) => (
|
<Switch value={add} onChange={({ value }) => setAdd(value)} />
|
||||||
<Switch
|
|
||||||
value={edit}
|
|
||||||
onChange={({ value }) => setEdit(value)}
|
|
||||||
id={id}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
<Field label="Creating links" position={'left'}>
|
<Field label="Creating links" position={'left'}>
|
||||||
{({ id }) => (
|
<Switch value={newLink} onChange={({ value }) => setNewLink(value)} />
|
||||||
<Switch
|
</Field>
|
||||||
value={newLink}
|
<Field label="Deleting links" position={'left'}>
|
||||||
onChange={({ value }) => setNewLink(value)}
|
<Switch
|
||||||
id={id}
|
value={deleteLink}
|
||||||
/>
|
onChange={({ value }) => setDeleteLink(value)}
|
||||||
)}
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<Field label="Dragging tasks" position={'left'}>
|
<Field label="Dragging tasks" position={'left'}>
|
||||||
{({ id }) => (
|
<Switch value={drag} onChange={({ value }) => setDrag(value)} />
|
||||||
<Switch
|
|
||||||
value={drag}
|
|
||||||
onChange={({ value }) => setDrag(value)}
|
|
||||||
id={id}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
<Field label="Reordering tasks" position={'left'}>
|
<Field label="Reordering tasks" position={'left'}>
|
||||||
{({ id }) => (
|
<Switch value={order} onChange={({ value }) => setOrder(value)} />
|
||||||
<Switch
|
</Field>
|
||||||
value={order}
|
<Field label="Editing progress" position={'left'}>
|
||||||
onChange={({ value }) => setOrder(value)}
|
<Switch
|
||||||
id={id}
|
value={progress}
|
||||||
/>
|
onChange={({ value }) => setProgress(value)}
|
||||||
)}
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
'wx-RPSbwjNq ' +
|
'wx-RPSbwjNq ' +
|
||||||
('gantt' +
|
('gantt' +
|
||||||
(!edit ? ' hide-progress' : '') +
|
|
||||||
(!newLink ? ' hide-links' : '') +
|
(!newLink ? ' hide-links' : '') +
|
||||||
(!drag ? ' hide-drag' : ''))
|
(!deleteLink ? ' hide-delete-links' : '') +
|
||||||
|
(!drag ? ' hide-drag' : '') +
|
||||||
|
(!progress ? ' hide-progress' : ''))
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Gantt
|
<Gantt
|
||||||
@@ -113,7 +84,6 @@ function GanttPreventActions({ skinSettings }) {
|
|||||||
scales={data.scales}
|
scales={data.scales}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
/>
|
/>
|
||||||
{api && <Editor api={api} />}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -74,13 +74,13 @@ export default function GanttScaleUnit(props) {
|
|||||||
tasks={data.tasks}
|
tasks={data.tasks}
|
||||||
links={data.links}
|
links={data.links}
|
||||||
scales={[
|
scales={[
|
||||||
{ unit: 'month', step: 1, format: 'MMMM yyy' },
|
{ unit: 'month', step: 1, format: '%F %Y' },
|
||||||
{ unit: 'sprint', step: 1, format: sprintFormat },
|
{ unit: 'sprint', step: 1, format: sprintFormat },
|
||||||
{ unit: 'day', step: 1, format: 'd' },
|
{ unit: 'day', step: 1, format: '%j' },
|
||||||
]}
|
]}
|
||||||
zoom={true}
|
zoom={true}
|
||||||
start={new Date(2024, 3, 1)}
|
start={new Date(2026, 3, 1)}
|
||||||
end={new Date(2024, 5, 1)}
|
end={new Date(2026, 5, 1)}
|
||||||
cellWidth={60}
|
cellWidth={60}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ function GanttScales({ skinSettings }) {
|
|||||||
tasks={data.tasks}
|
tasks={data.tasks}
|
||||||
links={data.links}
|
links={data.links}
|
||||||
scales={complexScales}
|
scales={complexScales}
|
||||||
start={new Date(2024, 3, 1)}
|
start={new Date(2026, 3, 1)}
|
||||||
end={new Date(2024, 4, 12)}
|
end={new Date(2026, 4, 12)}
|
||||||
cellWidth={60}
|
cellWidth={60}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import './GanttStartEnd.css';
|
|||||||
|
|
||||||
export default function GanttStartEnd({ skinSettings }) {
|
export default function GanttStartEnd({ skinSettings }) {
|
||||||
const data = useMemo(() => getData(), []);
|
const data = useMemo(() => getData(), []);
|
||||||
const [start, setStart] = useState(new Date(2024, 3, 5));
|
const [start, setStart] = useState(new Date(2026, 3, 5));
|
||||||
const [end, setEnd] = useState(new Date(2024, 4, 1));
|
const [end, setEnd] = useState(new Date(2026, 4, 1));
|
||||||
const [autoScale, setAutoScale] = useState(false);
|
const [autoScale, setAutoScale] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -15,33 +15,21 @@ export default function GanttStartEnd({ skinSettings }) {
|
|||||||
<Locale>
|
<Locale>
|
||||||
<div className="wx-FJQN2sNt bar">
|
<div className="wx-FJQN2sNt bar">
|
||||||
<Field label="Start" position="left">
|
<Field label="Start" position="left">
|
||||||
{({ id }) => (
|
<DatePicker
|
||||||
<DatePicker
|
value={start}
|
||||||
value={start}
|
onChange={({ value }) => setStart(value)}
|
||||||
id={id}
|
/>
|
||||||
onChange={({ value }) => setStart(value)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
<Field label="End" position="left">
|
<Field label="End" position="left">
|
||||||
{({ id }) => (
|
<DatePicker value={end} onChange={({ value }) => setEnd(value)} />
|
||||||
<DatePicker
|
|
||||||
value={end}
|
|
||||||
id={id}
|
|
||||||
onChange={({ value }) => setEnd(value)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
<Field label="autoScale" position="left">
|
<Field label="autoScale" position="left">
|
||||||
{({ id }) => (
|
<div className="wx-FJQN2sNt input">
|
||||||
<div className="wx-FJQN2sNt input">
|
<Switch
|
||||||
<Switch
|
value={autoScale}
|
||||||
value={autoScale}
|
onChange={({ value }) => setAutoScale(value)}
|
||||||
id={id}
|
/>
|
||||||
onChange={({ value }) => setAutoScale(value)}
|
</div>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
</div>
|
</div>
|
||||||
</Locale>
|
</Locale>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useMemo, useCallback, useContext } from 'react';
|
import { useState, useMemo, useCallback, useContext } from 'react';
|
||||||
import { context } from '@svar-ui/react-core';
|
import { context } from '@svar-ui/react-core';
|
||||||
import { getData } from '../data';
|
import { getData } from '../data';
|
||||||
import { Gantt, Toolbar, Editor, defaultToolbarButtons } from '../../src/';
|
import { Gantt, Toolbar, Editor, getToolbarButtons } from '../../src/';
|
||||||
import './GanttToolbarButtons.css';
|
import './GanttToolbarButtons.css';
|
||||||
|
|
||||||
export default function GanttToolbarButtons({ skinSettings }) {
|
export default function GanttToolbarButtons({ skinSettings }) {
|
||||||
@@ -15,7 +15,7 @@ export default function GanttToolbarButtons({ skinSettings }) {
|
|||||||
}, [helpers]);
|
}, [helpers]);
|
||||||
|
|
||||||
const items = useMemo(() => {
|
const items = useMemo(() => {
|
||||||
const items = defaultToolbarButtons.filter((b) => {
|
const items = getToolbarButtons().filter((b) => {
|
||||||
return b.id?.indexOf('indent') === -1;
|
return b.id?.indexOf('indent') === -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export default function GanttToolbarCustom({ skinSettings }) {
|
|||||||
const data = useMemo(() => getData(), []);
|
const data = useMemo(() => getData(), []);
|
||||||
|
|
||||||
const [api, setApi] = useState(null);
|
const [api, setApi] = useState(null);
|
||||||
const selectedValue = useStoreLater(api, "selected");
|
const selectedValue = useStoreLater(api, 'selected');
|
||||||
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
if (!api) return;
|
if (!api) return;
|
||||||
@@ -81,13 +81,15 @@ export default function GanttToolbarCustom({ skinSettings }) {
|
|||||||
}, [api, selectedValue, allItems]);
|
}, [api, selectedValue, allItems]);
|
||||||
|
|
||||||
const GanttInitialised = useMemo(() => {
|
const GanttInitialised = useMemo(() => {
|
||||||
return <Gantt
|
return (
|
||||||
{...(skinSettings || {})}
|
<Gantt
|
||||||
init={setApi}
|
{...(skinSettings || {})}
|
||||||
tasks={data.tasks}
|
init={setApi}
|
||||||
links={data.links}
|
tasks={data.tasks}
|
||||||
scales={data.scales}
|
links={data.links}
|
||||||
/>
|
scales={data.scales}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}, [skinSettings, data.tasks, data.links, data.scales]);
|
}, [skinSettings, data.tasks, data.links, data.scales]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
23
demos/cases/ProAutoSchedule.css
Normal file
23
demos/cases/ProAutoSchedule.css
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
.demo.wx-vkht5Uh1 {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar.wx-vkht5Uh1 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px;
|
||||||
|
gap: 20px;
|
||||||
|
border-bottom: var(--wx-gantt-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gantt.wx-vkht5Uh1 {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar.wx-left.wx-vkht5Uh1 .wx-field {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
42
demos/cases/ProAutoSchedule.jsx
Normal file
42
demos/cases/ProAutoSchedule.jsx
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import { useState, useMemo } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Editor, ContextMenu } from '../../src';
|
||||||
|
import { DatePicker, Field } from '@svar-ui/react-core';
|
||||||
|
import './ProAutoSchedule.css';
|
||||||
|
|
||||||
|
function ProAutoSchedule({ skinSettings }) {
|
||||||
|
const [api, setApi] = useState(null);
|
||||||
|
const [projectStart, setProjectStart] = useState(new Date(2026, 3, 2));
|
||||||
|
|
||||||
|
const data = useMemo(() => getData(), []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="demo wx-vkht5Uh1">
|
||||||
|
<div className="bar wx-vkht5Uh1">
|
||||||
|
<Field label="Project start" position="left">
|
||||||
|
<DatePicker
|
||||||
|
value={projectStart}
|
||||||
|
onChange={({ value }) => setProjectStart(value)}
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
</div>
|
||||||
|
<div className="gantt wx-vkht5Uh1">
|
||||||
|
{api && <Editor api={api} />}
|
||||||
|
<ContextMenu api={api}>
|
||||||
|
<Gantt
|
||||||
|
{...skinSettings}
|
||||||
|
init={setApi}
|
||||||
|
tasks={data.tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
schedule={{ auto: true }}
|
||||||
|
projectStart={projectStart}
|
||||||
|
projectEnd={new Date(2026, 5, 2)}
|
||||||
|
/>
|
||||||
|
</ContextMenu>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProAutoSchedule;
|
||||||
54
demos/cases/ProBaselines.jsx
Normal file
54
demos/cases/ProBaselines.jsx
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import { useMemo, useState } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Editor, getEditorItems } from '../../src/';
|
||||||
|
|
||||||
|
function ProBaseline({ skinSettings }) {
|
||||||
|
const data = useMemo(() => getData('day', { baselines: true }), []);
|
||||||
|
|
||||||
|
const [api, setApi] = useState();
|
||||||
|
|
||||||
|
const items = useMemo(
|
||||||
|
() =>
|
||||||
|
getEditorItems().flatMap((item) =>
|
||||||
|
item.key === 'links'
|
||||||
|
? [
|
||||||
|
...[
|
||||||
|
{
|
||||||
|
key: 'base_start',
|
||||||
|
comp: 'date',
|
||||||
|
label: 'Baseline start',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'base_end',
|
||||||
|
comp: 'date',
|
||||||
|
label: 'Baseline end',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'base_duration',
|
||||||
|
comp: 'counter',
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
item,
|
||||||
|
]
|
||||||
|
: item,
|
||||||
|
),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Gantt
|
||||||
|
ref={setApi}
|
||||||
|
{...skinSettings}
|
||||||
|
baselines={true}
|
||||||
|
cellHeight={45}
|
||||||
|
tasks={data.tasks}
|
||||||
|
links={data.links}
|
||||||
|
/>
|
||||||
|
{api && <Editor api={api} items={items} />}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProBaseline;
|
||||||
43
demos/cases/ProCalendar.jsx
Normal file
43
demos/cases/ProCalendar.jsx
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import { useState, useMemo } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Editor } from '../../src';
|
||||||
|
import { Calendar } from '@svar-ui/gantt-store';
|
||||||
|
|
||||||
|
function ProCalendar({ skinSettings }) {
|
||||||
|
const { tasks, links, scales } = useMemo(() => getData('calendar'), []);
|
||||||
|
|
||||||
|
const calendar = useMemo(
|
||||||
|
() =>
|
||||||
|
new Calendar({
|
||||||
|
weekHours: {
|
||||||
|
monday: 8,
|
||||||
|
tuesday: 8,
|
||||||
|
wednesday: 8,
|
||||||
|
thursday: 8,
|
||||||
|
friday: 8,
|
||||||
|
saturday: 0,
|
||||||
|
sunday: 0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
const [api, setApi] = useState();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Gantt
|
||||||
|
{...skinSettings}
|
||||||
|
init={setApi}
|
||||||
|
calendar={calendar}
|
||||||
|
tasks={tasks}
|
||||||
|
links={links}
|
||||||
|
scales={scales}
|
||||||
|
cellWidth={60}
|
||||||
|
/>
|
||||||
|
{api && <Editor api={api} />}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProCalendar;
|
||||||
20
demos/cases/ProCalendarChanges.css
Normal file
20
demos/cases/ProCalendarChanges.css
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
.rows.wx-FkPcChng {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar.wx-FkPcChng {
|
||||||
|
padding: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
.gtcell.wx-FkPcChng {
|
||||||
|
position: relative;
|
||||||
|
height: calc(100% - 56px);
|
||||||
|
border-top: var(--wx-gantt-border);
|
||||||
|
}
|
||||||
72
demos/cases/ProCalendarChanges.jsx
Normal file
72
demos/cases/ProCalendarChanges.jsx
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
import { useState, useMemo, useCallback } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Editor } from '../../src';
|
||||||
|
import { Calendar } from '@svar-ui/gantt-store';
|
||||||
|
import { Button } from '@svar-ui/react-core';
|
||||||
|
import './ProCalendarChanges.css';
|
||||||
|
|
||||||
|
function ProCalendarChanges({ skinSettings }) {
|
||||||
|
const initialData = useMemo(() => getData('calendar'), []);
|
||||||
|
const [tasks, setTasks] = useState(initialData.tasks);
|
||||||
|
const { links, scales } = initialData;
|
||||||
|
|
||||||
|
const calendar = useMemo(
|
||||||
|
() =>
|
||||||
|
new Calendar({
|
||||||
|
weekHours: {
|
||||||
|
monday: 8,
|
||||||
|
tuesday: 8,
|
||||||
|
wednesday: 8,
|
||||||
|
thursday: 8,
|
||||||
|
friday: 8,
|
||||||
|
saturday: 0,
|
||||||
|
sunday: 0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
const [api, setApi] = useState();
|
||||||
|
|
||||||
|
const addNewRule = useCallback(() => {
|
||||||
|
calendar.addRule((date) => {
|
||||||
|
const weekday = date.getDay();
|
||||||
|
if (weekday === 3) return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
setTasks(
|
||||||
|
api.serialize().map((task) => {
|
||||||
|
if (!calendar.isWorkingDay(task.start)) {
|
||||||
|
task.start = calendar.getNextWorkingDay(task.start);
|
||||||
|
}
|
||||||
|
return task;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}, [api, calendar]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="wx-FkPcChng rows">
|
||||||
|
<div className="wx-FkPcChng bar">
|
||||||
|
<span> Rule: every Wednesday is off</span>
|
||||||
|
<Button type="primary" onClick={addNewRule}>
|
||||||
|
Add rule
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="wx-FkPcChng gtcell">
|
||||||
|
<Gantt
|
||||||
|
{...skinSettings}
|
||||||
|
init={setApi}
|
||||||
|
calendar={calendar}
|
||||||
|
tasks={tasks}
|
||||||
|
links={links}
|
||||||
|
scales={scales}
|
||||||
|
cellWidth={60}
|
||||||
|
/>
|
||||||
|
{api && <Editor api={api} />}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProCalendarChanges;
|
||||||
12
demos/cases/ProCriticalPath.css
Normal file
12
demos/cases/ProCriticalPath.css
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
.demo.wx-D71fWZ6y {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar.wx-D71fWZ6y {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 12px;
|
||||||
|
border-bottom: var(--wx-gantt-border);
|
||||||
|
}
|
||||||
62
demos/cases/ProCriticalPath.jsx
Normal file
62
demos/cases/ProCriticalPath.jsx
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
import { useMemo, useState } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Editor } from '../../src';
|
||||||
|
import { DatePicker, Field, Locale, RichSelect } from '@svar-ui/react-core';
|
||||||
|
import './ProCriticalPath.css';
|
||||||
|
|
||||||
|
export default function ProCriticalPath({ skinSettings }) {
|
||||||
|
const data = useMemo(() => getData('critical'), []);
|
||||||
|
|
||||||
|
const [api, setApi] = useState();
|
||||||
|
const [pathMode, setPathMode] = useState('flexible');
|
||||||
|
const [projectStart, setProjectStart] = useState(new Date(2026, 3, 2));
|
||||||
|
const [projectEnd, setProjectEnd] = useState(new Date(2026, 3, 12));
|
||||||
|
|
||||||
|
function init(ganttApi) {
|
||||||
|
setApi(ganttApi);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="demo wx-D71fWZ6y">
|
||||||
|
<Locale>
|
||||||
|
<div className="bar wx-D71fWZ6y">
|
||||||
|
<Field label="Mode" position="left">
|
||||||
|
<RichSelect
|
||||||
|
options={[
|
||||||
|
{ id: 'flexible', label: 'Flexible' },
|
||||||
|
{ id: 'strict', label: 'Strict' },
|
||||||
|
]}
|
||||||
|
value={pathMode}
|
||||||
|
onChange={({ value }) => setPathMode(value)}
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
<Field label="Project start" position="left">
|
||||||
|
<DatePicker
|
||||||
|
value={projectStart}
|
||||||
|
onChange={({ value }) => setProjectStart(value)}
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
<Field label="Project end" position="left">
|
||||||
|
<DatePicker
|
||||||
|
value={projectEnd}
|
||||||
|
onChange={({ value }) => setProjectEnd(value)}
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
</div>
|
||||||
|
</Locale>
|
||||||
|
<Gantt
|
||||||
|
{...skinSettings}
|
||||||
|
init={init}
|
||||||
|
tasks={data.tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
criticalPath={{ type: pathMode }}
|
||||||
|
projectStart={projectStart}
|
||||||
|
projectEnd={projectEnd}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{api && <Editor api={api} />}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
10
demos/cases/ProMarkers.css
Normal file
10
demos/cases/ProMarkers.css
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.gt-cell.wx-g4H1PKcW {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.gt-cell.wx-g4H1PKcW > .wx-gantt .myMiddleClass {
|
||||||
|
background-color: rgba(255, 84, 84, 0.77);
|
||||||
|
}
|
||||||
|
.gt-cell.wx-g4H1PKcW > .wx-gantt .myEndClass {
|
||||||
|
background-color: rgba(54, 206, 124, 0.77);
|
||||||
|
}
|
||||||
42
demos/cases/ProMarkers.jsx
Normal file
42
demos/cases/ProMarkers.jsx
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import { useMemo } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt } from '../../src/';
|
||||||
|
import './ProMarkers.css';
|
||||||
|
|
||||||
|
const ProMarkers = ({ skinSettings }) => {
|
||||||
|
const data = useMemo(() => getData(), []);
|
||||||
|
|
||||||
|
const markers = useMemo(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
start: new Date(2026, 3, 2),
|
||||||
|
text: 'Start Project',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
start: new Date(2026, 3, 8),
|
||||||
|
text: 'Today',
|
||||||
|
css: 'myMiddleClass',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
start: new Date(2026, 4, 3),
|
||||||
|
text: 'End Project',
|
||||||
|
css: 'myEndClass',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="wx-g4H1PKcW gt-cell">
|
||||||
|
<Gantt
|
||||||
|
{...skinSettings}
|
||||||
|
markers={markers}
|
||||||
|
tasks={data.tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ProMarkers;
|
||||||
23
demos/cases/ProScheduleAll.css
Normal file
23
demos/cases/ProScheduleAll.css
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
.demo.wx-D71fWZ7y {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar.wx-D71fWZ7y {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px;
|
||||||
|
gap: 20px;
|
||||||
|
border-bottom: var(--wx-gantt-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gantt.wx-D71fWZ7y {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar.wx-D71fWZ7y .wx-field.wx-left {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
160
demos/cases/ProScheduleAll.jsx
Normal file
160
demos/cases/ProScheduleAll.jsx
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
import { useState, useMemo } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Editor, ContextMenu } from '../../src';
|
||||||
|
import { DatePicker, Field, Checkbox } from '@svar-ui/react-core';
|
||||||
|
import { Calendar } from '@svar-ui/gantt-store';
|
||||||
|
import './ProScheduleAll.css';
|
||||||
|
|
||||||
|
function ProScheduleAll({ skinSettings }) {
|
||||||
|
const data = useMemo(
|
||||||
|
() =>
|
||||||
|
getData('calendar', {
|
||||||
|
splitTasks: true,
|
||||||
|
unscheduledTasks: true,
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
const [api, setApi] = useState();
|
||||||
|
const [tasks, setTasks] = useState(data.tasks);
|
||||||
|
|
||||||
|
const calendar = useMemo(() => new Calendar(), []);
|
||||||
|
const [projectStart, setProjectStart] = useState(new Date(2026, 3, 2));
|
||||||
|
const [projectEnd, setProjectEnd] = useState(new Date(2026, 4, 20));
|
||||||
|
|
||||||
|
const [criticalPath, setCriticalPath] = useState({ type: 'flexible' });
|
||||||
|
const [baselines, setBaselines] = useState(true);
|
||||||
|
const [unscheduledTasks, setUnscheduledTasks] = useState(true);
|
||||||
|
const [splitTasks, setSplitTasks] = useState(true);
|
||||||
|
|
||||||
|
const [cellHeight, setCellHeight] = useState(44);
|
||||||
|
|
||||||
|
const markers = useMemo(
|
||||||
|
() =>
|
||||||
|
projectStart
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
text: 'Start',
|
||||||
|
start: projectStart,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [],
|
||||||
|
[projectStart],
|
||||||
|
);
|
||||||
|
|
||||||
|
function onCriticalPathChange() {
|
||||||
|
setCriticalPath(
|
||||||
|
criticalPath?.type === 'flexible' ? null : { type: 'flexible' },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBaselinesChange(ev) {
|
||||||
|
setBaselines(ev.value);
|
||||||
|
setCellHeight(ev.value ? 44 : 38);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSplitChange() {
|
||||||
|
setTasks(
|
||||||
|
api.serialize().map((t) => {
|
||||||
|
//recalculate duration
|
||||||
|
if (t.segments) delete t.duration;
|
||||||
|
return t;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate baselines after summary dates are set
|
||||||
|
function init(ganttApi) {
|
||||||
|
setApi(ganttApi);
|
||||||
|
setTasks(
|
||||||
|
ganttApi.serialize().map((t) => {
|
||||||
|
return {
|
||||||
|
...t,
|
||||||
|
base_start: t.start,
|
||||||
|
base_end: t.end,
|
||||||
|
base_duration: t.segments ? 0 : t.duration,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*data.links.push({
|
||||||
|
source: 2,
|
||||||
|
target: 3,
|
||||||
|
type: "e2s",
|
||||||
|
id: 100,
|
||||||
|
});
|
||||||
|
data.links.push({
|
||||||
|
source: 30,
|
||||||
|
target: 4,
|
||||||
|
type: "e2s",
|
||||||
|
id: 101,
|
||||||
|
});*/
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="demo wx-D71fWZ7y">
|
||||||
|
<div className="bar wx-D71fWZ7y">
|
||||||
|
<Field label="Project start" position="left" width="250px">
|
||||||
|
<DatePicker
|
||||||
|
value={projectStart}
|
||||||
|
onChange={({ value }) => setProjectStart(value)}
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
<Field label="Project end" position="left" width="250px">
|
||||||
|
<DatePicker
|
||||||
|
value={projectEnd}
|
||||||
|
onChange={({ value }) => setProjectEnd(value)}
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
<Checkbox
|
||||||
|
value={!!criticalPath}
|
||||||
|
label="Critical path"
|
||||||
|
onChange={onCriticalPathChange}
|
||||||
|
/>
|
||||||
|
<Checkbox
|
||||||
|
value={baselines}
|
||||||
|
label="Baselines"
|
||||||
|
onChange={onBaselinesChange}
|
||||||
|
/>
|
||||||
|
<Checkbox
|
||||||
|
value={unscheduledTasks}
|
||||||
|
label="Unscheduled tasks"
|
||||||
|
onChange={({ value }) => setUnscheduledTasks(value)}
|
||||||
|
/>
|
||||||
|
<Checkbox
|
||||||
|
value={splitTasks}
|
||||||
|
label="Split tasks"
|
||||||
|
onChange={(ev) => {
|
||||||
|
setSplitTasks(ev.value);
|
||||||
|
onSplitChange();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="gantt wx-D71fWZ7y">
|
||||||
|
{api && <Editor api={api} />}
|
||||||
|
<ContextMenu api={api}>
|
||||||
|
<Gantt
|
||||||
|
init={init}
|
||||||
|
{...skinSettings}
|
||||||
|
cellWidth={50}
|
||||||
|
cellHeight={cellHeight}
|
||||||
|
tasks={tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
calendar={calendar}
|
||||||
|
schedule={{ auto: true }}
|
||||||
|
criticalPath={criticalPath}
|
||||||
|
projectStart={projectStart}
|
||||||
|
projectEnd={projectEnd}
|
||||||
|
markers={markers}
|
||||||
|
baselines={baselines}
|
||||||
|
unscheduledTasks={unscheduledTasks}
|
||||||
|
splitTasks={splitTasks}
|
||||||
|
/>
|
||||||
|
</ContextMenu>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProScheduleAll;
|
||||||
4
demos/cases/ProSplitTasks.css
Normal file
4
demos/cases/ProSplitTasks.css
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.gtcell.wx-4eOjA4yB {
|
||||||
|
height: calc(100% - 50px);
|
||||||
|
border-top: var(--wx-gantt-border);
|
||||||
|
}
|
||||||
28
demos/cases/ProSplitTasks.jsx
Normal file
28
demos/cases/ProSplitTasks.jsx
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { useState, useMemo } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, ContextMenu, Editor, Toolbar } from '../../src/';
|
||||||
|
import './ProSplitTasks.css';
|
||||||
|
|
||||||
|
export default function ProSplitTasks({ skinSettings }) {
|
||||||
|
const [api, setApi] = useState();
|
||||||
|
const data = useMemo(() => getData('day', { splitTasks: true }), []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Toolbar api={api} />
|
||||||
|
<div className="gtcell">
|
||||||
|
<ContextMenu api={api}>
|
||||||
|
<Gantt
|
||||||
|
init={setApi}
|
||||||
|
{...skinSettings}
|
||||||
|
tasks={data.tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
splitTasks={true}
|
||||||
|
/>
|
||||||
|
</ContextMenu>
|
||||||
|
{api && <Editor api={api} />}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
109
demos/cases/ProSummariesConvert.jsx
Normal file
109
demos/cases/ProSummariesConvert.jsx
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
import { useMemo, useCallback, useRef } from 'react';
|
||||||
|
import { useStoreLater } from '@svar-ui/lib-react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import {
|
||||||
|
Gantt,
|
||||||
|
ContextMenu,
|
||||||
|
Editor,
|
||||||
|
getEditorItems,
|
||||||
|
defaultTaskTypes,
|
||||||
|
} from '../../src';
|
||||||
|
|
||||||
|
export default function SummariesConvert({ skinSettings }) {
|
||||||
|
const data = useMemo(() => getData(), []);
|
||||||
|
const gApi = useRef(null);
|
||||||
|
|
||||||
|
const toSummary = useCallback(
|
||||||
|
(id, self) => {
|
||||||
|
const api = gApi.current;
|
||||||
|
if (!api) return;
|
||||||
|
const task = api.getTask(id);
|
||||||
|
if (!self) id = task.parent;
|
||||||
|
|
||||||
|
if (id && task.type !== 'summary') {
|
||||||
|
api.exec('update-task', {
|
||||||
|
id,
|
||||||
|
task: { type: 'summary' },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[gApi],
|
||||||
|
);
|
||||||
|
|
||||||
|
const toTask = useCallback(
|
||||||
|
(id) => {
|
||||||
|
const api = gApi.current;
|
||||||
|
if (!api) return;
|
||||||
|
const obj = api.getTask(id);
|
||||||
|
if (obj && !obj.data?.length) {
|
||||||
|
api.exec('update-task', {
|
||||||
|
id,
|
||||||
|
task: { type: 'task' },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[gApi],
|
||||||
|
);
|
||||||
|
|
||||||
|
const init = useCallback(
|
||||||
|
(api) => {
|
||||||
|
gApi.current = api;
|
||||||
|
|
||||||
|
api.getState().tasks.forEach((task) => {
|
||||||
|
if (task.data?.length) {
|
||||||
|
toSummary(task.id, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
api.on('add-task', ({ id, mode }) => {
|
||||||
|
if (mode === 'child') toSummary(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
api.on('move-task', ({ id, source, mode, inProgress }) => {
|
||||||
|
if (inProgress) return;
|
||||||
|
if (mode == 'child') toSummary(id);
|
||||||
|
else toTask(source);
|
||||||
|
});
|
||||||
|
|
||||||
|
api.on('delete-task', ({ source }) => {
|
||||||
|
toTask(source);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[toSummary, toTask],
|
||||||
|
);
|
||||||
|
|
||||||
|
const activeTaskId = useStoreLater(gApi.current, 'activeTask');
|
||||||
|
|
||||||
|
const items = useMemo(() => {
|
||||||
|
const api = gApi.current;
|
||||||
|
const task = activeTaskId ? api?.getTask(activeTaskId) : null;
|
||||||
|
if (task) {
|
||||||
|
return getEditorItems().map((item) => {
|
||||||
|
item = { ...item };
|
||||||
|
if (item.comp === 'select' && item.key === 'type') {
|
||||||
|
item.options =
|
||||||
|
task.type !== 'summary'
|
||||||
|
? defaultTaskTypes.filter((t) => t.id !== 'summary')
|
||||||
|
: [];
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}, [activeTaskId, gApi.current]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="wx-TEIogFEZ gt-cell">
|
||||||
|
<ContextMenu api={gApi.current}>
|
||||||
|
<Gantt
|
||||||
|
init={init}
|
||||||
|
{...skinSettings}
|
||||||
|
tasks={data.tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
/>
|
||||||
|
</ContextMenu>
|
||||||
|
{gApi.current && <Editor api={gApi.current} items={items} />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
9
demos/cases/ProSummariesProgress.css
Normal file
9
demos/cases/ProSummariesProgress.css
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
.gt-cell > .wx-gantt .wx-summary .wx-progress-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gt-cell.wx-OeNgRLo4,
|
||||||
|
.wrapper.wx-OeNgRLo4 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
131
demos/cases/ProSummariesProgress.jsx
Normal file
131
demos/cases/ProSummariesProgress.jsx
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
import { useState, useMemo, useCallback, useEffect, useRef } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Editor, getEditorItems, ContextMenu } from '../../src';
|
||||||
|
import './ProSummariesProgress.css';
|
||||||
|
|
||||||
|
function SummariesProgress({ skinSettings }) {
|
||||||
|
const data = useMemo(() => getData(), []);
|
||||||
|
const tasks = data.tasks;
|
||||||
|
|
||||||
|
const [api, setApi] = useState();
|
||||||
|
|
||||||
|
const dayDiff = (next, prev) => {
|
||||||
|
const d = (next - prev) / 1000 / 60 / 60 / 24;
|
||||||
|
return Math.ceil(Math.abs(d));
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The formula of calculation is ∑d*p / ∑d , where "d" is task duration in days,
|
||||||
|
* "p" is the task progress and "∑" stands for a sum of all loaded tasks
|
||||||
|
*/
|
||||||
|
function getSummaryProgress(id) {
|
||||||
|
const [totalProgress, totalDuration] = collectProgressFromKids(id);
|
||||||
|
const res = totalProgress / totalDuration;
|
||||||
|
return isNaN(res) ? 0 : Math.round(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
function collectProgressFromKids(id) {
|
||||||
|
let totalProgress = 0,
|
||||||
|
totalDuration = 0;
|
||||||
|
const kids = api.getTask(id).data;
|
||||||
|
|
||||||
|
kids?.forEach((kid) => {
|
||||||
|
let duration = 0;
|
||||||
|
if (kid.type !== 'milestone' && kid.type !== 'summary') {
|
||||||
|
duration = kid.duration || dayDiff(kid.end, kid.start);
|
||||||
|
totalDuration += duration;
|
||||||
|
totalProgress += duration * kid.progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [p, d] = collectProgressFromKids(kid.id);
|
||||||
|
totalProgress += p;
|
||||||
|
totalDuration += d;
|
||||||
|
});
|
||||||
|
return [totalProgress, totalDuration];
|
||||||
|
}
|
||||||
|
|
||||||
|
function recalcSummaryProgress(id, self) {
|
||||||
|
const { tasks } = api.getState();
|
||||||
|
const task = api.getTask(id);
|
||||||
|
|
||||||
|
if (task.type != 'milestone') {
|
||||||
|
const summary =
|
||||||
|
self && task.type === 'summary' ? id : tasks.getSummaryId(id);
|
||||||
|
|
||||||
|
if (summary) {
|
||||||
|
const progress = getSummaryProgress(summary);
|
||||||
|
api.exec('update-task', {
|
||||||
|
id: summary,
|
||||||
|
task: { progress },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const recalcRef = useRef(null);
|
||||||
|
recalcRef.current = recalcSummaryProgress;
|
||||||
|
|
||||||
|
const init = useCallback((api) => {
|
||||||
|
setApi(api);
|
||||||
|
// auto progress calculations
|
||||||
|
api.on('add-task', ({ id }) => {
|
||||||
|
recalcRef.current(id);
|
||||||
|
});
|
||||||
|
api.on('update-task', ({ id }) => {
|
||||||
|
recalcRef.current(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
api.on('delete-task', ({ source }) => {
|
||||||
|
recalcRef.current(source, true);
|
||||||
|
});
|
||||||
|
api.on('copy-task', ({ id }) => {
|
||||||
|
recalcRef.current(id);
|
||||||
|
});
|
||||||
|
api.on('move-task', ({ id, source, inProgress }) => {
|
||||||
|
if (inProgress) return;
|
||||||
|
|
||||||
|
if (api.getTask(id).parent != source) recalcRef.current(source, true);
|
||||||
|
recalcRef.current(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="wx-OeNgRLo4 wrapper">
|
||||||
|
<ContextMenu api={api}>
|
||||||
|
<div className="wx-OeNgRLo4 gt-cell">
|
||||||
|
<Gantt
|
||||||
|
{...skinSettings}
|
||||||
|
init={init}
|
||||||
|
tasks={tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
cellWidth={30}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</ContextMenu>
|
||||||
|
{api && <ConfiguredEditor api={api} />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ConfiguredEditor({ api }) {
|
||||||
|
const [editorItems, setEditorItems] = useState(getEditorItems());
|
||||||
|
|
||||||
|
// disabling progress slider for summary tasks
|
||||||
|
api.on('show-editor', ({ id }) => {
|
||||||
|
if (id) {
|
||||||
|
const type = api.getTask(id).type;
|
||||||
|
setEditorItems(
|
||||||
|
getEditorItems().map((ed) => ({
|
||||||
|
...ed,
|
||||||
|
...(ed.key == 'progress' && {
|
||||||
|
config: { disabled: type === 'summary' },
|
||||||
|
}),
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return <Editor api={api} items={editorItems} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SummariesProgress;
|
||||||
35
demos/cases/ProUndo.css
Normal file
35
demos/cases/ProUndo.css
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
.rows.wx-D71fWZ9y {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.buttons.wx-D71fWZ9y {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
}
|
||||||
|
.gtcell.wx-D71fWZ9y {
|
||||||
|
position: relative;
|
||||||
|
height: calc(100% - 48px);
|
||||||
|
border-top: var(--wx-gantt-border);
|
||||||
|
}
|
||||||
|
.button.wx-D71fWZ9y {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.button.wx-D71fWZ9y span {
|
||||||
|
background-color: var(--wx-color-danger);
|
||||||
|
height: 18px;
|
||||||
|
width: 18px;
|
||||||
|
border-radius: 50px;
|
||||||
|
position: absolute;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 12px;
|
||||||
|
padding: 3px 0;
|
||||||
|
color: #fff;
|
||||||
|
top: -6px;
|
||||||
|
right: -6px;
|
||||||
|
}
|
||||||
79
demos/cases/ProUndo.jsx
Normal file
79
demos/cases/ProUndo.jsx
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import { useState, useEffect, useMemo, useRef } from 'react';
|
||||||
|
import { Button } from '@svar-ui/react-core';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Editor, ContextMenu } from '../../src';
|
||||||
|
import './ProUndo.css';
|
||||||
|
|
||||||
|
export default function ProUndo({ skinSettings }) {
|
||||||
|
const [api, setApi] = useState();
|
||||||
|
|
||||||
|
const { tasks, links, scales } = useMemo(() => getData(), []);
|
||||||
|
function init(ganttApi) {
|
||||||
|
setApi(ganttApi);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="rows wx-D71fWZ9y">
|
||||||
|
{api && <History api={api} />}
|
||||||
|
<div className="gtcell wx-D71fWZ9y">
|
||||||
|
<ContextMenu api={api}>
|
||||||
|
<Gantt
|
||||||
|
init={init}
|
||||||
|
{...skinSettings}
|
||||||
|
tasks={tasks}
|
||||||
|
links={links}
|
||||||
|
scales={scales}
|
||||||
|
undo
|
||||||
|
/>
|
||||||
|
</ContextMenu>
|
||||||
|
{api && <Editor api={api} />}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function History({ api }) {
|
||||||
|
|
||||||
|
const [history, setHistory] = useState(null);
|
||||||
|
function handleUndo() {
|
||||||
|
api.exec('undo');
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRedo() {
|
||||||
|
api.exec('redo');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
api.getReactiveState().history.subscribe((v) => (setHistory(v)));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="buttons wx-D71fWZ9y">
|
||||||
|
<div className="button wx-D71fWZ9y">
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={handleUndo}
|
||||||
|
disabled={history && !history.undo}
|
||||||
|
>
|
||||||
|
Undo
|
||||||
|
</Button>
|
||||||
|
{history && history.undo > 0 && (
|
||||||
|
<span>{history.undo}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="button wx-D71fWZ9y">
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={handleRedo}
|
||||||
|
disabled={history && !history.redo}
|
||||||
|
>
|
||||||
|
Redo
|
||||||
|
</Button>
|
||||||
|
{history && history.redo > 0 && (
|
||||||
|
<span>{history.redo}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
4
demos/cases/ProUndoToolbar.css
Normal file
4
demos/cases/ProUndoToolbar.css
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.gtcell.wx-D71fWZAy {
|
||||||
|
height: calc(100% - 50px);
|
||||||
|
border-top: var(--wx-gantt-border);
|
||||||
|
}
|
||||||
27
demos/cases/ProUndoToolbar.jsx
Normal file
27
demos/cases/ProUndoToolbar.jsx
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { useState, useMemo } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Toolbar, Editor } from '../../src/';
|
||||||
|
import './ProUndoToolbar.css';
|
||||||
|
|
||||||
|
export default function ProUndoToolbar({ skinSettings }) {
|
||||||
|
const [api, setApi] = useState();
|
||||||
|
|
||||||
|
const data = useMemo(() => getData(), []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Toolbar api={api} />
|
||||||
|
<div className="gtcell wx-D71fWZAy">
|
||||||
|
<Gantt
|
||||||
|
{...skinSettings}
|
||||||
|
init={setApi}
|
||||||
|
tasks={data.tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
undo
|
||||||
|
/>
|
||||||
|
{api && <Editor api={api} />}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
25
demos/cases/ProUnscheduledTasks.jsx
Normal file
25
demos/cases/ProUnscheduledTasks.jsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import { getData } from '../data';
|
||||||
|
import { Gantt, Editor } from '../../src';
|
||||||
|
|
||||||
|
function ProUnscheduledTasks({ skinSettings }) {
|
||||||
|
const [api, setApi] = useState(null);
|
||||||
|
|
||||||
|
const data = getData('day', { unscheduledTasks: true });
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Gantt
|
||||||
|
init={setApi}
|
||||||
|
{...skinSettings}
|
||||||
|
tasks={data.tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
unscheduledTasks={true}
|
||||||
|
/>
|
||||||
|
{api && <Editor api={api} />}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProUnscheduledTasks;
|
||||||
89
demos/cases/ProUnscheduledTasksAndBaselines.jsx
Normal file
89
demos/cases/ProUnscheduledTasksAndBaselines.jsx
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import { useMemo, useState } from 'react';
|
||||||
|
import { Gantt, Editor, defaultEditorItems, defaultColumns } from '../../src';
|
||||||
|
import { format } from 'date-fns';
|
||||||
|
import { getBaselinesData } from '../data';
|
||||||
|
|
||||||
|
function ProUnscheduledTasksAndBaselines({ skinSettings }) {
|
||||||
|
const [api, setApi] = useState(null);
|
||||||
|
|
||||||
|
const data = useMemo(() => {
|
||||||
|
const rawData = getBaselinesData();
|
||||||
|
const cloned = { ...rawData };
|
||||||
|
|
||||||
|
cloned.tasks = cloned.tasks.map((task) => {
|
||||||
|
if (task.id === 10 || task.id === 12) {
|
||||||
|
task = { ...task, unscheduled: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task.id === 10) {
|
||||||
|
task = {
|
||||||
|
...task,
|
||||||
|
start: new Date(2024, 3, 5),
|
||||||
|
end: new Date(2024, 3, 7),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (task.id === 11) {
|
||||||
|
task = {
|
||||||
|
...task,
|
||||||
|
start: new Date(2024, 3, 2),
|
||||||
|
end: new Date(2024, 3, 5),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return task;
|
||||||
|
});
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const items = useMemo(() => {
|
||||||
|
return defaultEditorItems.flatMap((item) =>
|
||||||
|
item.key === 'links'
|
||||||
|
? [
|
||||||
|
...[
|
||||||
|
{
|
||||||
|
key: 'base_start',
|
||||||
|
comp: 'date',
|
||||||
|
label: 'Baseline start',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'base_end',
|
||||||
|
comp: 'date',
|
||||||
|
label: 'Baseline end',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
item,
|
||||||
|
]
|
||||||
|
: item,
|
||||||
|
);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const columns = useMemo(() => {
|
||||||
|
return defaultColumns.map((col) => {
|
||||||
|
if (col.id == 'start')
|
||||||
|
col.template = (value, row) =>
|
||||||
|
row.unscheduled ? '-' : format(value, 'dd-MM-yyyy');
|
||||||
|
if (col.id == 'duration')
|
||||||
|
col.template = (value, row) => (row.unscheduled ? '-' : value);
|
||||||
|
return col;
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Gantt
|
||||||
|
init={setApi}
|
||||||
|
{...skinSettings}
|
||||||
|
columns={columns}
|
||||||
|
tasks={data.tasks}
|
||||||
|
links={data.links}
|
||||||
|
scales={data.scales}
|
||||||
|
unscheduledTasks={true}
|
||||||
|
baselines={true}
|
||||||
|
cellHeight={45}
|
||||||
|
/>
|
||||||
|
{api && <Editor api={api} items={items} />}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProUnscheduledTasksAndBaselines;
|
||||||
@@ -76,13 +76,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.wx-demos.sidebar.active {
|
.wx-demos.sidebar.active {
|
||||||
width: 300px;
|
width: 320px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-demos.sidebar-content {
|
.wx-demos.sidebar-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 300px;
|
width: 320px;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-right: 1px solid #ebebeb;
|
border-right: 1px solid #ebebeb;
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
.wx-demos.box-links {
|
.wx-demos.box-links {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 6px;
|
gap: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-demos.hint {
|
.wx-demos.hint {
|
||||||
@@ -210,14 +210,14 @@
|
|||||||
.wx-demos.demo {
|
.wx-demos.demo {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 37px;
|
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
padding-left: 16px;
|
padding: 8px 12px 8px 16px;
|
||||||
border-left: 4px solid transparent;
|
border-left: 4px solid transparent;
|
||||||
color: #595b66;
|
color: #595b66;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
min-height: 38px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-demos.demo.active {
|
.wx-demos.demo.active {
|
||||||
@@ -226,7 +226,26 @@
|
|||||||
|
|
||||||
.wx-demos.demo.active,
|
.wx-demos.demo.active,
|
||||||
.wx-demos.demo:hover {
|
.wx-demos.demo:hover {
|
||||||
font-weight: 500;
|
font-weight: 400;
|
||||||
color: #42454d;
|
color: #42454d;
|
||||||
background-color: #f1f1f1;
|
background-color: #f1f1f1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wx-demos.demo.active {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-demos.demo .pro {
|
||||||
|
color: #087a9f;
|
||||||
|
border: 1px solid #087a9f;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 0px 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-left: auto;
|
||||||
|
letter-spacing: 0.4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-theme {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useState, useEffect, useCallback } from 'react';
|
import { useState, useCallback } from 'react';
|
||||||
import { HashRouter, NavLink, useNavigate } from 'react-router-dom';
|
import { HashRouter, NavLink, useNavigate } from 'react-router-dom';
|
||||||
|
import { Willow } from '@svar-ui/react-core';
|
||||||
|
|
||||||
import Router from './Router';
|
import Router from './Router';
|
||||||
import { links } from '../routes';
|
import { links } from '../routes';
|
||||||
@@ -18,38 +19,28 @@ function DemoExplorerContent({
|
|||||||
const [skin, setSkin] = useState(skins[0].id);
|
const [skin, setSkin] = useState(skins[0].id);
|
||||||
const [title, setTitle] = useState('');
|
const [title, setTitle] = useState('');
|
||||||
const [githubLink, setGithubLink] = useState('');
|
const [githubLink, setGithubLink] = useState('');
|
||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(true);
|
||||||
|
|
||||||
const baseLink =
|
const baseLink =
|
||||||
'https://github.com/svar-widgets/react-' +
|
'https://github.com/svar-widgets/react-' +
|
||||||
productTag +
|
productTag +
|
||||||
'/tree/main/demos/cases/';
|
'/tree/main/demos/cases/';
|
||||||
|
|
||||||
useEffect(() => {
|
const handleRouteChange = useCallback((path) => {
|
||||||
document.body.className = `wx-willow-theme`;
|
const parts = path.split('/');
|
||||||
|
const page = parts[1];
|
||||||
|
const newSkin = parts[2];
|
||||||
|
setSkin(newSkin);
|
||||||
|
|
||||||
|
const targetPage = `/${page}/:skin`;
|
||||||
|
const matched = links.find((a) => a[0] === targetPage);
|
||||||
|
if (matched) {
|
||||||
|
setTitle(matched[1]);
|
||||||
|
const name = matched[3] || matched[1];
|
||||||
|
setGithubLink(`${baseLink}${name}.jsx`);
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleRouteChange = useCallback(
|
|
||||||
(path) => {
|
|
||||||
const parts = path.split('/');
|
|
||||||
const page = parts[1];
|
|
||||||
const newSkin = parts[2];
|
|
||||||
|
|
||||||
if (newSkin && newSkin !== skin) {
|
|
||||||
setSkin(newSkin);
|
|
||||||
}
|
|
||||||
|
|
||||||
const targetPage = `/${page}/:skin`;
|
|
||||||
const matched = links.find((a) => a[0] === targetPage);
|
|
||||||
if (matched) {
|
|
||||||
setTitle(matched[1]);
|
|
||||||
const name = matched[3] || matched[1];
|
|
||||||
setGithubLink(`${baseLink}${name}.jsx`);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[skin],
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleSkinChange = ({ value }) => {
|
const handleSkinChange = ({ value }) => {
|
||||||
setSkin(value);
|
setSkin(value);
|
||||||
const currentPath = window.location.hash.slice(1);
|
const currentPath = window.location.hash.slice(1);
|
||||||
@@ -63,8 +54,10 @@ function DemoExplorerContent({
|
|||||||
setShow(!show);
|
setShow(!show);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const SkinComponent = skins.find((s) => s.id === skin).Component;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`wx-demos layout ${show ? 'active' : ''}`}>
|
<div className={`wx-demos wx-willow-theme layout ${show ? 'active' : ''}`}>
|
||||||
<div
|
<div
|
||||||
className={`wx-demos sidebar ${show ? 'active' : ''}`}
|
className={`wx-demos sidebar ${show ? 'active' : ''}`}
|
||||||
role="tabpanel"
|
role="tabpanel"
|
||||||
@@ -81,7 +74,7 @@ function DemoExplorerContent({
|
|||||||
</a>
|
</a>
|
||||||
<div className="wx-demos separator"></div>
|
<div className="wx-demos separator"></div>
|
||||||
<a
|
<a
|
||||||
href={`https://svar.dev/react/${productTag}/`}
|
href={`https://svar.dev/react/gantt/`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
@@ -107,6 +100,7 @@ function DemoExplorerContent({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{data[1]}
|
{data[1]}
|
||||||
|
{data[4] && data[4].pro && <span className="pro">PRO</span>}
|
||||||
</NavLink>
|
</NavLink>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -159,7 +153,9 @@ function DemoExplorerContent({
|
|||||||
data-wx-portal-root="true"
|
data-wx-portal-root="true"
|
||||||
>
|
>
|
||||||
<Globals>
|
<Globals>
|
||||||
<Router skin={skin} onRouteChange={handleRouteChange} />
|
<SkinComponent>
|
||||||
|
<Router skin={skin} onRouteChange={handleRouteChange} />
|
||||||
|
</SkinComponent>
|
||||||
</Globals>
|
</Globals>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -169,12 +165,9 @@ function DemoExplorerContent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function DemoExplorer(props) {
|
export default function DemoExplorer(props) {
|
||||||
const skins = props.skins;
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{skins.map((skin) => (
|
<Willow />
|
||||||
<skin.Component key={skin.id} />
|
|
||||||
))}
|
|
||||||
<HashRouter>
|
<HashRouter>
|
||||||
<DemoExplorerContent {...props} />
|
<DemoExplorerContent {...props} />
|
||||||
</HashRouter>
|
</HashRouter>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
import {
|
import {
|
||||||
Routes,
|
Routes,
|
||||||
Route,
|
Route,
|
||||||
@@ -12,7 +12,9 @@ export default function Router({ onRouteChange }) {
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const lastRef = useRef(location.pathname);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (lastRef.current === location.pathname) return;
|
||||||
if (location.pathname === '/') {
|
if (location.pathname === '/') {
|
||||||
navigate('/base/willow', { replace: true });
|
navigate('/base/willow', { replace: true });
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -65,68 +65,50 @@ export default function Form(props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="wx-QkE5vh0y body">
|
<div className="wx-QkE5vh0y body">
|
||||||
<Field label="Name">
|
<Field label="Name">
|
||||||
{({ id }) => (
|
<Text
|
||||||
<Text
|
focus={true}
|
||||||
id={id}
|
value={task.text}
|
||||||
focus={true}
|
onChange={(ev) => handleChange(ev, 'text')}
|
||||||
value={task.text}
|
/>
|
||||||
onChange={(ev) => handleChange(ev, 'text')}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
<Field label="Description">
|
<Field label="Description">
|
||||||
{({ id }) => (
|
<TextArea
|
||||||
<TextArea
|
value={task.details}
|
||||||
id={id}
|
onChange={(ev) => handleChange(ev, 'details')}
|
||||||
value={task.details}
|
/>
|
||||||
onChange={(ev) => handleChange(ev, 'details')}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
{taskTypes.length > 1 ? (
|
{taskTypes.length > 1 ? (
|
||||||
<Field label="Type">
|
<Field label="Type">
|
||||||
{({ id }) => (
|
<Select
|
||||||
<Select
|
value={task.type}
|
||||||
id={id}
|
options={taskTypes}
|
||||||
value={task.type}
|
onChange={(ev) => handleChange(ev, 'type')}
|
||||||
options={taskTypes}
|
/>
|
||||||
onChange={(ev) => handleChange(ev, 'type')}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<Field label="Start date">
|
<Field label="Start date">
|
||||||
{({ id }) => (
|
<DatePicker
|
||||||
<DatePicker
|
value={task.start}
|
||||||
id={id}
|
onChange={(ev) => handleChange(ev, 'start')}
|
||||||
value={task.start}
|
/>
|
||||||
onChange={(ev) => handleChange(ev, 'start')}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
{task.type !== 'milestone' ? (
|
{task.type !== 'milestone' ? (
|
||||||
<>
|
<>
|
||||||
<Field label="End date">
|
<Field label="End date">
|
||||||
{({ id }) => (
|
<DatePicker
|
||||||
<DatePicker
|
value={task.end}
|
||||||
id={id}
|
onChange={(ev) => handleChange(ev, 'end')}
|
||||||
value={task.end}
|
/>
|
||||||
onChange={(ev) => handleChange(ev, 'end')}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
<Field label={`Progress: ${task.progress}%`}>
|
<Field label={`Progress: ${task.progress}%`}>
|
||||||
{({ id }) => (
|
<Slider
|
||||||
<Slider
|
value={task.progress}
|
||||||
id={id}
|
onChange={(ev) => handleChange(ev, 'progress')}
|
||||||
value={task.progress}
|
/>
|
||||||
onChange={(ev) => handleChange(ev, 'progress')}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Field>
|
</Field>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
767
demos/data.js
767
demos/data.js
File diff suppressed because it is too large
Load Diff
@@ -30,14 +30,13 @@ import GanttTaskTypes from './cases/GanttTaskTypes.jsx';
|
|||||||
import ChartCellBorders from './cases/ChartBorders.jsx';
|
import ChartCellBorders from './cases/ChartBorders.jsx';
|
||||||
import ContextMenu from './cases/ContextMenu.jsx';
|
import ContextMenu from './cases/ContextMenu.jsx';
|
||||||
import ContextMenuHandler from './cases/ContextMenuHandler.jsx';
|
import ContextMenuHandler from './cases/ContextMenuHandler.jsx';
|
||||||
// import DropDownMenu from "./cases/DropDownMenu.jsx";
|
//import DropDownMenu from "./cases/DropDownMenu.jsx";
|
||||||
import ContextMenuOptions from './cases/ContextMenuOptions.jsx';
|
import ContextMenuOptions from './cases/ContextMenuOptions.jsx';
|
||||||
import GanttHolidays from './cases/GanttHolidays.jsx';
|
import GanttHolidays from './cases/GanttHolidays.jsx';
|
||||||
import GanttSort from './cases/GanttSort.jsx';
|
import GanttSort from './cases/GanttSort.jsx';
|
||||||
import GanttCustomSort from './cases/GanttCustomSort.jsx';
|
import GanttCustomSort from './cases/GanttCustomSort.jsx';
|
||||||
import GanttSummariesProgress from './cases/GanttSummariesProgress.jsx';
|
import SummariesProgress from './cases/ProSummariesProgress.jsx';
|
||||||
import GanttSummariesNoDrag from './cases/GanttSummariesNoDrag.jsx';
|
import SummariesConvert from './cases/ProSummariesConvert.jsx';
|
||||||
import GanttSummariesConvert from './cases/GanttSummariesConvert.jsx';
|
|
||||||
import GanttEditor from './cases/GanttEditor.jsx';
|
import GanttEditor from './cases/GanttEditor.jsx';
|
||||||
import GanttEditorConfig from './cases/GanttEditorConfig.jsx';
|
import GanttEditorConfig from './cases/GanttEditorConfig.jsx';
|
||||||
import GanttEditorCustomControls from './cases/GanttEditorCustomControls.jsx';
|
import GanttEditorCustomControls from './cases/GanttEditorCustomControls.jsx';
|
||||||
@@ -79,28 +78,11 @@ export const links = [
|
|||||||
|
|
||||||
['/holidays/:skin', 'Holidays', GanttHolidays, 'GanttHolidays'],
|
['/holidays/:skin', 'Holidays', GanttHolidays, 'GanttHolidays'],
|
||||||
|
|
||||||
|
|
||||||
['/templates/:skin', 'Custom text', GanttText, 'GanttText'],
|
['/templates/:skin', 'Custom text', GanttText, 'GanttText'],
|
||||||
['/tooltips/:skin', 'Tooltips', GanttTooltips, 'GanttTooltips'],
|
['/tooltips/:skin', 'Tooltips', GanttTooltips, 'GanttTooltips'],
|
||||||
|
|
||||||
['/task-types/:skin', 'Task types', GanttTaskTypes, 'GanttTaskTypes'],
|
['/task-types/:skin', 'Task types', GanttTaskTypes, 'GanttTaskTypes'],
|
||||||
[
|
|
||||||
'/summary-progress/:skin',
|
|
||||||
'Summary tasks with auto progress',
|
|
||||||
GanttSummariesProgress,
|
|
||||||
'GanttSummariesProgress',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'/summary-no-drag/:skin',
|
|
||||||
'No drag for summary tasks',
|
|
||||||
GanttSummariesNoDrag,
|
|
||||||
'GanttSummariesNoDrag',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'/summary-convert/:skin',
|
|
||||||
'Auto convert to summary tasks',
|
|
||||||
GanttSummariesConvert,
|
|
||||||
'GanttSummariesConvert',
|
|
||||||
],
|
|
||||||
|
|
||||||
['/zoom/:skin', 'Zoom', GanttZoom, 'GanttZoom'],
|
['/zoom/:skin', 'Zoom', GanttZoom, 'GanttZoom'],
|
||||||
['/custom-zoom/:skin', 'Custom Zoom', GanttCustomZoom, 'GanttCustomZoom'],
|
['/custom-zoom/:skin', 'Custom Zoom', GanttCustomZoom, 'GanttCustomZoom'],
|
||||||
@@ -176,17 +158,9 @@ export const links = [
|
|||||||
HeaderMenu,
|
HeaderMenu,
|
||||||
'GridHeaderMenu',
|
'GridHeaderMenu',
|
||||||
],
|
],
|
||||||
['/custom-edit-form/:skin', 'Custom editor', GanttForm, 'GanttForm'],
|
|
||||||
['/locale/:skin', 'Locales', GanttLocale, 'GanttLocale'],
|
['/locale/:skin', 'Locales', GanttLocale, 'GanttLocale'],
|
||||||
['/fullscreen/:skin', 'Fullscreen', GanttFullscreen, 'GanttFullscreen'],
|
['/fullscreen/:skin', 'Fullscreen', GanttFullscreen, 'GanttFullscreen'],
|
||||||
['/readonly/:skin', 'Readonly mode', GanttReadOnly, 'GanttReadOnly'],
|
['/readonly/:skin', 'Readonly mode', GanttReadOnly, 'GanttReadOnly'],
|
||||||
|
|
||||||
[
|
|
||||||
'/prevent-actions/:skin',
|
|
||||||
'Preventing actions',
|
|
||||||
GanttPreventActions,
|
|
||||||
'GanttPreventActions',
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'/gantt-multiple/:skin',
|
'/gantt-multiple/:skin',
|
||||||
'Many Gantts per page',
|
'Many Gantts per page',
|
||||||
@@ -194,7 +168,12 @@ export const links = [
|
|||||||
'GanttMultiple',
|
'GanttMultiple',
|
||||||
],
|
],
|
||||||
['/performance/:skin', 'Performance', GanttPerformance, 'GanttPerformance'],
|
['/performance/:skin', 'Performance', GanttPerformance, 'GanttPerformance'],
|
||||||
|
[
|
||||||
|
'/prevent-actions/:skin',
|
||||||
|
'Preventing UI actions',
|
||||||
|
GanttPreventActions,
|
||||||
|
'GanttPreventActions',
|
||||||
|
],
|
||||||
['/sorting/:skin', 'Custom sorting', GanttSort, 'GanttSort'],
|
['/sorting/:skin', 'Custom sorting', GanttSort, 'GanttSort'],
|
||||||
['/sorting-api/:skin', 'Sort by API', GanttCustomSort, 'GanttCustomSort'],
|
['/sorting-api/:skin', 'Sort by API', GanttCustomSort, 'GanttCustomSort'],
|
||||||
|
|
||||||
@@ -248,4 +227,5 @@ export const links = [
|
|||||||
GanttEditorValidation,
|
GanttEditorValidation,
|
||||||
'GanttEditorValidation',
|
'GanttEditorValidation',
|
||||||
],
|
],
|
||||||
|
['/custom-edit-form/:skin', 'Custom edit form', GanttForm, 'GanttForm'],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ export default [
|
|||||||
localStorage: 'readonly',
|
localStorage: 'readonly',
|
||||||
fetch: 'readonly',
|
fetch: 'readonly',
|
||||||
FormData: 'readonly',
|
FormData: 'readonly',
|
||||||
setInterval: 'readonly',
|
performance: 'readonly',
|
||||||
clearInterval: 'readonly',
|
cancelAnimationFrame: 'readonly',
|
||||||
|
CustomEvent: 'readonly',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
|
|||||||
595
license.txt
595
license.txt
@@ -1,595 +1,10 @@
|
|||||||
GNU General Public License
|
MIT License
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
_Version 3, 29 June 2007_
|
Copyright (c) 2025 XB Software Sp. z o.o
|
||||||
_Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>_
|
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
document, but changing it is not allowed.
|
|
||||||
|
|
||||||
## Preamble
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for software and other
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed to take away
|
|
||||||
your freedom to share and change the works. By contrast, the GNU General Public
|
|
||||||
License is intended to guarantee your freedom to share and change all versions of a
|
|
||||||
program--to make sure it remains free software for all its users. We, the Free
|
|
||||||
Software Foundation, use the GNU General Public License for most of our software; it
|
|
||||||
applies also to any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not price. Our General
|
|
||||||
Public Licenses are designed to make sure that you have the freedom to distribute
|
|
||||||
copies of free software (and charge for them if you wish), that you receive source
|
|
||||||
code or can get it if you want it, that you can change the software or use pieces of
|
|
||||||
it in new free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you these rights or
|
|
||||||
asking you to surrender the rights. Therefore, you have certain responsibilities if
|
|
||||||
you distribute copies of the software, or if you modify it: responsibilities to
|
|
||||||
respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether gratis or for a fee,
|
|
||||||
you must pass on to the recipients the same freedoms that you received. You must make
|
|
||||||
sure that they, too, receive or can get the source code. And you must show them these
|
|
||||||
terms so they know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps: **(1)** assert
|
|
||||||
copyright on the software, and **(2)** offer you this License giving you legal permission
|
|
||||||
to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains that there is
|
|
||||||
no warranty for this free software. For both users' and authors' sake, the GPL
|
|
||||||
requires that modified versions be marked as changed, so that their problems will not
|
|
||||||
be attributed erroneously to authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run modified versions of
|
|
||||||
the software inside them, although the manufacturer can do so. This is fundamentally
|
|
||||||
incompatible with the aim of protecting users' freedom to change the software. The
|
|
||||||
systematic pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we have designed
|
|
||||||
this version of the GPL to prohibit the practice for those products. If such problems
|
|
||||||
arise substantially in other domains, we stand ready to extend this provision to
|
|
||||||
those domains in future versions of the GPL, as needed to protect the freedom of
|
|
||||||
users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents. States should
|
|
||||||
not allow patents to restrict development and use of software on general-purpose
|
|
||||||
computers, but in those that do, we wish to avoid the special danger that patents
|
|
||||||
applied to a free program could make it effectively proprietary. To prevent this, the
|
|
||||||
GPL assures that patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and modification follow.
|
|
||||||
|
|
||||||
## TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
### 0. Definitions
|
|
||||||
|
|
||||||
“This License” refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
“Copyright” also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
“The Program” refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as “you”. “Licensees” and
|
|
||||||
“recipients” may be individuals or organizations.
|
|
||||||
|
|
||||||
To “modify” a work means to copy from or adapt all or part of the work in
|
|
||||||
a fashion requiring copyright permission, other than the making of an exact copy. The
|
|
||||||
resulting work is called a “modified version” of the earlier work or a
|
|
||||||
work “based on” the earlier work.
|
|
||||||
|
|
||||||
A “covered work” means either the unmodified Program or a work based on
|
|
||||||
the Program.
|
|
||||||
|
|
||||||
To “propagate” a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for infringement under
|
|
||||||
applicable copyright law, except executing it on a computer or modifying a private
|
|
||||||
copy. Propagation includes copying, distribution (with or without modification),
|
|
||||||
making available to the public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To “convey” a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through a computer
|
|
||||||
network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays “Appropriate Legal Notices” to the
|
|
||||||
extent that it includes a convenient and prominently visible feature that **(1)**
|
|
||||||
displays an appropriate copyright notice, and **(2)** tells the user that there is no
|
|
||||||
warranty for the work (except to the extent that warranties are provided), that
|
|
||||||
licensees may convey the work under this License, and how to view a copy of this
|
|
||||||
License. If the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
### 1. Source Code
|
|
||||||
|
|
||||||
The “source code” for a work means the preferred form of the work for
|
|
||||||
making modifications to it. “Object code” means any non-source form of a
|
|
||||||
work.
|
|
||||||
|
|
||||||
A “Standard Interface” means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of interfaces
|
|
||||||
specified for a particular programming language, one that is widely used among
|
|
||||||
developers working in that language.
|
|
||||||
|
|
||||||
The “System Libraries” of an executable work include anything, other than
|
|
||||||
the work as a whole, that **(a)** is included in the normal form of packaging a Major
|
|
||||||
Component, but which is not part of that Major Component, and **(b)** serves only to
|
|
||||||
enable use of the work with that Major Component, or to implement a Standard
|
|
||||||
Interface for which an implementation is available to the public in source code form.
|
|
||||||
A “Major Component”, in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system (if any) on which
|
|
||||||
the executable work runs, or a compiler used to produce the work, or an object code
|
|
||||||
interpreter used to run it.
|
|
||||||
|
|
||||||
The “Corresponding Source” for a work in object code form means all the
|
|
||||||
source code needed to generate, install, and (for an executable work) run the object
|
|
||||||
code and to modify the work, including scripts to control those activities. However,
|
|
||||||
it does not include the work's System Libraries, or general-purpose tools or
|
|
||||||
generally available free programs which are used unmodified in performing those
|
|
||||||
activities but which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for the work, and
|
|
||||||
the source code for shared libraries and dynamically linked subprograms that the work
|
|
||||||
is specifically designed to require, such as by intimate data communication or
|
|
||||||
control flow between those subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users can regenerate
|
|
||||||
automatically from other parts of the Corresponding Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that same work.
|
|
||||||
|
|
||||||
### 2. Basic Permissions
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of copyright on the
|
|
||||||
Program, and are irrevocable provided the stated conditions are met. This License
|
|
||||||
explicitly affirms your unlimited permission to run the unmodified Program. The
|
|
||||||
output from running a covered work is covered by this License only if the output,
|
|
||||||
given its content, constitutes a covered work. This License acknowledges your rights
|
|
||||||
of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not convey, without
|
|
||||||
conditions so long as your license otherwise remains in force. You may convey covered
|
|
||||||
works to others for the sole purpose of having them make modifications exclusively
|
|
||||||
for you, or provide you with facilities for running those works, provided that you
|
|
||||||
comply with the terms of this License in conveying all material for which you do not
|
|
||||||
control copyright. Those thus making or running the covered works for you must do so
|
|
||||||
exclusively on your behalf, under your direction and control, on terms that prohibit
|
|
||||||
them from making any copies of your copyrighted material outside their relationship
|
|
||||||
with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under the conditions
|
|
||||||
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
|
||||||
|
|
||||||
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological measure under any
|
|
||||||
applicable law fulfilling obligations under article 11 of the WIPO copyright treaty
|
|
||||||
adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention
|
|
||||||
of such measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid circumvention of
|
|
||||||
technological measures to the extent such circumvention is effected by exercising
|
|
||||||
rights under this License with respect to the covered work, and you disclaim any
|
|
||||||
intention to limit operation or modification of the work as a means of enforcing,
|
|
||||||
against the work's users, your or third parties' legal rights to forbid circumvention
|
|
||||||
of technological measures.
|
|
||||||
|
|
||||||
### 4. Conveying Verbatim Copies
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you receive it, in any
|
|
||||||
medium, provided that you conspicuously and appropriately publish on each copy an
|
|
||||||
appropriate copyright notice; keep intact all notices stating that this License and
|
|
||||||
any non-permissive terms added in accord with section 7 apply to the code; keep
|
|
||||||
intact all notices of the absence of any warranty; and give all recipients a copy of
|
|
||||||
this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey, and you may offer
|
|
||||||
support or warranty protection for a fee.
|
|
||||||
|
|
||||||
### 5. Conveying Modified Source Versions
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to produce it from
|
|
||||||
the Program, in the form of source code under the terms of section 4, provided that
|
|
||||||
you also meet all of these conditions:
|
|
||||||
|
|
||||||
* **a)** The work must carry prominent notices stating that you modified it, and giving a
|
|
||||||
relevant date.
|
|
||||||
* **b)** The work must carry prominent notices stating that it is released under this
|
|
||||||
License and any conditions added under section 7. This requirement modifies the
|
|
||||||
requirement in section 4 to “keep intact all notices”.
|
|
||||||
* **c)** You must license the entire work, as a whole, under this License to anyone who
|
|
||||||
comes into possession of a copy. This License will therefore apply, along with any
|
|
||||||
applicable section 7 additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no permission to license the
|
|
||||||
work in any other way, but it does not invalidate such permission if you have
|
|
||||||
separately received it.
|
|
||||||
* **d)** If the work has interactive user interfaces, each must display Appropriate Legal
|
|
||||||
Notices; however, if the Program has interactive interfaces that do not display
|
|
||||||
Appropriate Legal Notices, your work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent works, which are
|
|
||||||
not by their nature extensions of the covered work, and which are not combined with
|
|
||||||
it such as to form a larger program, in or on a volume of a storage or distribution
|
|
||||||
medium, is called an “aggregate” if the compilation and its resulting
|
|
||||||
copyright are not used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work in an aggregate
|
|
||||||
does not cause this License to apply to the other parts of the aggregate.
|
|
||||||
|
|
||||||
### 6. Conveying Non-Source Forms
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms of sections 4 and
|
|
||||||
5, provided that you also convey the machine-readable Corresponding Source under the
|
|
||||||
terms of this License, in one of these ways:
|
|
||||||
|
|
||||||
* **a)** Convey the object code in, or embodied in, a physical product (including a
|
|
||||||
physical distribution medium), accompanied by the Corresponding Source fixed on a
|
|
||||||
durable physical medium customarily used for software interchange.
|
|
||||||
* **b)** Convey the object code in, or embodied in, a physical product (including a
|
|
||||||
physical distribution medium), accompanied by a written offer, valid for at least
|
|
||||||
three years and valid for as long as you offer spare parts or customer support for
|
|
||||||
that product model, to give anyone who possesses the object code either **(1)** a copy of
|
|
||||||
the Corresponding Source for all the software in the product that is covered by this
|
|
||||||
License, on a durable physical medium customarily used for software interchange, for
|
|
||||||
a price no more than your reasonable cost of physically performing this conveying of
|
|
||||||
source, or **(2)** access to copy the Corresponding Source from a network server at no
|
|
||||||
charge.
|
|
||||||
* **c)** Convey individual copies of the object code with a copy of the written offer to
|
|
||||||
provide the Corresponding Source. This alternative is allowed only occasionally and
|
|
||||||
noncommercially, and only if you received the object code with such an offer, in
|
|
||||||
accord with subsection 6b.
|
|
||||||
* **d)** Convey the object code by offering access from a designated place (gratis or for
|
|
||||||
a charge), and offer equivalent access to the Corresponding Source in the same way
|
|
||||||
through the same place at no further charge. You need not require recipients to copy
|
|
||||||
the Corresponding Source along with the object code. If the place to copy the object
|
|
||||||
code is a network server, the Corresponding Source may be on a different server
|
|
||||||
(operated by you or a third party) that supports equivalent copying facilities,
|
|
||||||
provided you maintain clear directions next to the object code saying where to find
|
|
||||||
the Corresponding Source. Regardless of what server hosts the Corresponding Source,
|
|
||||||
you remain obligated to ensure that it is available for as long as needed to satisfy
|
|
||||||
these requirements.
|
|
||||||
* **e)** Convey the object code using peer-to-peer transmission, provided you inform
|
|
||||||
other peers where the object code and Corresponding Source of the work are being
|
|
||||||
offered to the general public at no charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded from the
|
|
||||||
Corresponding Source as a System Library, need not be included in conveying the
|
|
||||||
object code work.
|
|
||||||
|
|
||||||
A “User Product” is either **(1)** a “consumer product”, which
|
|
||||||
means any tangible personal property which is normally used for personal, family, or
|
|
||||||
household purposes, or **(2)** anything designed or sold for incorporation into a
|
|
||||||
dwelling. In determining whether a product is a consumer product, doubtful cases
|
|
||||||
shall be resolved in favor of coverage. For a particular product received by a
|
|
||||||
particular user, “normally used” refers to a typical or common use of
|
|
||||||
that class of product, regardless of the status of the particular user or of the way
|
|
||||||
in which the particular user actually uses, or expects or is expected to use, the
|
|
||||||
product. A product is a consumer product regardless of whether the product has
|
|
||||||
substantial commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
“Installation Information” for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install and execute
|
|
||||||
modified versions of a covered work in that User Product from a modified version of
|
|
||||||
its Corresponding Source. The information must suffice to ensure that the continued
|
|
||||||
functioning of the modified object code is in no case prevented or interfered with
|
|
||||||
solely because modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or specifically for
|
|
||||||
use in, a User Product, and the conveying occurs as part of a transaction in which
|
|
||||||
the right of possession and use of the User Product is transferred to the recipient
|
|
||||||
in perpetuity or for a fixed term (regardless of how the transaction is
|
|
||||||
characterized), the Corresponding Source conveyed under this section must be
|
|
||||||
accompanied by the Installation Information. But this requirement does not apply if
|
|
||||||
neither you nor any third party retains the ability to install modified object code
|
|
||||||
on the User Product (for example, the work has been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a requirement to
|
|
||||||
continue to provide support service, warranty, or updates for a work that has been
|
|
||||||
modified or installed by the recipient, or for the User Product in which it has been
|
|
||||||
modified or installed. Access to a network may be denied when the modification itself
|
|
||||||
materially and adversely affects the operation of the network or violates the rules
|
|
||||||
and protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided, in accord with
|
|
||||||
this section must be in a format that is publicly documented (and with an
|
|
||||||
implementation available to the public in source code form), and must require no
|
|
||||||
special password or key for unpacking, reading or copying.
|
|
||||||
|
|
||||||
### 7. Additional Terms
|
|
||||||
|
|
||||||
“Additional permissions” are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions. Additional
|
|
||||||
permissions that are applicable to the entire Program shall be treated as though they
|
|
||||||
were included in this License, to the extent that they are valid under applicable
|
|
||||||
law. If additional permissions apply only to part of the Program, that part may be
|
|
||||||
used separately under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option remove any
|
|
||||||
additional permissions from that copy, or from any part of it. (Additional
|
|
||||||
permissions may be written to require their own removal in certain cases when you
|
|
||||||
modify the work.) You may place additional permissions on material, added by you to a
|
|
||||||
covered work, for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you add to a
|
|
||||||
covered work, you may (if authorized by the copyright holders of that material)
|
|
||||||
supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
* **a)** Disclaiming warranty or limiting liability differently from the terms of
|
|
||||||
sections 15 and 16 of this License; or
|
|
||||||
* **b)** Requiring preservation of specified reasonable legal notices or author
|
|
||||||
attributions in that material or in the Appropriate Legal Notices displayed by works
|
|
||||||
containing it; or
|
|
||||||
* **c)** Prohibiting misrepresentation of the origin of that material, or requiring that
|
|
||||||
modified versions of such material be marked in reasonable ways as different from the
|
|
||||||
original version; or
|
|
||||||
* **d)** Limiting the use for publicity purposes of names of licensors or authors of the
|
|
||||||
material; or
|
|
||||||
* **e)** Declining to grant rights under trademark law for use of some trade names,
|
|
||||||
trademarks, or service marks; or
|
|
||||||
* **f)** Requiring indemnification of licensors and authors of that material by anyone
|
|
||||||
who conveys the material (or modified versions of it) with contractual assumptions of
|
|
||||||
liability to the recipient, for any liability that these contractual assumptions
|
|
||||||
directly impose on those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered “further
|
|
||||||
restrictions” within the meaning of section 10. If the Program as you received
|
|
||||||
it, or any part of it, contains a notice stating that it is governed by this License
|
|
||||||
along with a term that is a further restriction, you may remove that term. If a
|
|
||||||
license document contains a further restriction but permits relicensing or conveying
|
|
||||||
under this License, you may add to a covered work material governed by the terms of
|
|
||||||
that license document, provided that the further restriction does not survive such
|
|
||||||
relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you must place, in
|
|
||||||
the relevant source files, a statement of the additional terms that apply to those
|
|
||||||
files, or a notice indicating where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the form of a
|
|
||||||
separately written license, or stated as exceptions; the above requirements apply
|
|
||||||
either way.
|
|
||||||
|
|
||||||
### 8. Termination
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly provided under
|
|
||||||
this License. Any attempt otherwise to propagate or modify it is void, and will
|
|
||||||
automatically terminate your rights under this License (including any patent licenses
|
|
||||||
granted under the third paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your license from a
|
|
||||||
particular copyright holder is reinstated **(a)** provisionally, unless and until the
|
|
||||||
copyright holder explicitly and finally terminates your license, and **(b)** permanently,
|
|
||||||
if the copyright holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is reinstated permanently
|
|
||||||
if the copyright holder notifies you of the violation by some reasonable means, this
|
|
||||||
is the first time you have received notice of violation of this License (for any
|
|
||||||
work) from that copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the licenses of
|
|
||||||
parties who have received copies or rights from you under this License. If your
|
|
||||||
rights have been terminated and not permanently reinstated, you do not qualify to
|
|
||||||
receive new licenses for the same material under section 10.
|
|
||||||
|
|
||||||
### 9. Acceptance Not Required for Having Copies
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or run a copy of the
|
|
||||||
Program. Ancillary propagation of a covered work occurring solely as a consequence of
|
|
||||||
using peer-to-peer transmission to receive a copy likewise does not require
|
|
||||||
acceptance. However, nothing other than this License grants you permission to
|
|
||||||
propagate or modify any covered work. These actions infringe copyright if you do not
|
|
||||||
accept this License. Therefore, by modifying or propagating a covered work, you
|
|
||||||
indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
### 10. Automatic Licensing of Downstream Recipients
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically receives a license
|
|
||||||
from the original licensors, to run, modify and propagate that work, subject to this
|
|
||||||
License. You are not responsible for enforcing compliance by third parties with this
|
|
||||||
License.
|
|
||||||
|
|
||||||
An “entity transaction” is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an organization, or
|
|
||||||
merging organizations. If propagation of a covered work results from an entity
|
|
||||||
transaction, each party to that transaction who receives a copy of the work also
|
|
||||||
receives whatever licenses to the work the party's predecessor in interest had or
|
|
||||||
could give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if the predecessor
|
|
||||||
has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the rights granted or
|
|
||||||
affirmed under this License. For example, you may not impose a license fee, royalty,
|
|
||||||
or other charge for exercise of rights granted under this License, and you may not
|
|
||||||
initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging
|
|
||||||
that any patent claim is infringed by making, using, selling, offering for sale, or
|
|
||||||
importing the Program or any portion of it.
|
|
||||||
|
|
||||||
### 11. Patents
|
|
||||||
|
|
||||||
A “contributor” is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The work thus
|
|
||||||
licensed is called the contributor's “contributor version”.
|
|
||||||
|
|
||||||
A contributor's “essential patent claims” are all patent claims owned or
|
|
||||||
controlled by the contributor, whether already acquired or hereafter acquired, that
|
|
||||||
would be infringed by some manner, permitted by this License, of making, using, or
|
|
||||||
selling its contributor version, but do not include claims that would be infringed
|
|
||||||
only as a consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, “control” includes the right to grant patent
|
|
||||||
sublicenses in a manner consistent with the requirements of this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license
|
|
||||||
under the contributor's essential patent claims, to make, use, sell, offer for sale,
|
|
||||||
import and otherwise run, modify and propagate the contents of its contributor
|
|
||||||
version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a “patent license” is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent (such as an
|
|
||||||
express permission to practice a patent or covenant not to sue for patent
|
|
||||||
infringement). To “grant” such a patent license to a party means to make
|
|
||||||
such an agreement or commitment not to enforce a patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license, and the
|
|
||||||
Corresponding Source of the work is not available for anyone to copy, free of charge
|
|
||||||
and under the terms of this License, through a publicly available network server or
|
|
||||||
other readily accessible means, then you must either **(1)** cause the Corresponding
|
|
||||||
Source to be so available, or **(2)** arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or **(3)** arrange, in a manner consistent with
|
|
||||||
the requirements of this License, to extend the patent license to downstream
|
|
||||||
recipients. “Knowingly relying” means you have actual knowledge that, but
|
|
||||||
for the patent license, your conveying the covered work in a country, or your
|
|
||||||
recipient's use of the covered work in a country, would infringe one or more
|
|
||||||
identifiable patents in that country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or arrangement, you
|
|
||||||
convey, or propagate by procuring conveyance of, a covered work, and grant a patent
|
|
||||||
license to some of the parties receiving the covered work authorizing them to use,
|
|
||||||
propagate, modify or convey a specific copy of the covered work, then the patent
|
|
||||||
license you grant is automatically extended to all recipients of the covered work and
|
|
||||||
works based on it.
|
|
||||||
|
|
||||||
A patent license is “discriminatory” if it does not include within the
|
|
||||||
scope of its coverage, prohibits the exercise of, or is conditioned on the
|
|
||||||
non-exercise of one or more of the rights that are specifically granted under this
|
|
||||||
License. You may not convey a covered work if you are a party to an arrangement with
|
|
||||||
a third party that is in the business of distributing software, under which you make
|
|
||||||
payment to the third party based on the extent of your activity of conveying the
|
|
||||||
work, and under which the third party grants, to any of the parties who would receive
|
|
||||||
the covered work from you, a discriminatory patent license **(a)** in connection with
|
|
||||||
copies of the covered work conveyed by you (or copies made from those copies), or **(b)**
|
|
||||||
primarily for and in connection with specific products or compilations that contain
|
|
||||||
the covered work, unless you entered into that arrangement, or that patent license
|
|
||||||
was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting any implied
|
|
||||||
license or other defenses to infringement that may otherwise be available to you
|
|
||||||
under applicable patent law.
|
|
||||||
|
|
||||||
### 12. No Surrender of Others' Freedom
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or otherwise)
|
|
||||||
that contradict the conditions of this License, they do not excuse you from the
|
|
||||||
conditions of this License. If you cannot convey a covered work so as to satisfy
|
|
||||||
simultaneously your obligations under this License and any other pertinent
|
|
||||||
obligations, then as a consequence you may not convey it at all. For example, if you
|
|
||||||
agree to terms that obligate you to collect a royalty for further conveying from
|
|
||||||
those to whom you convey the Program, the only way you could satisfy both those terms
|
|
||||||
and this License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
### 13. Use with the GNU Affero General Public License
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have permission to link or
|
|
||||||
combine any covered work with a work licensed under version 3 of the GNU Affero
|
|
||||||
General Public License into a single combined work, and to convey the resulting work.
|
|
||||||
The terms of this License will continue to apply to the part which is the covered
|
|
||||||
work, but the special requirements of the GNU Affero General Public License, section
|
|
||||||
13, concerning interaction through a network will apply to the combination as such.
|
|
||||||
|
|
||||||
### 14. Revised Versions of this License
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of the GNU
|
|
||||||
General Public License from time to time. Such new versions will be similar in spirit
|
|
||||||
to the present version, but may differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program specifies that
|
|
||||||
a certain numbered version of the GNU General Public License “or any later
|
|
||||||
version” applies to it, you have the option of following the terms and
|
|
||||||
conditions either of that numbered version or of any later version published by the
|
|
||||||
Free Software Foundation. If the Program does not specify a version number of the GNU
|
|
||||||
General Public License, you may choose any version ever published by the Free
|
|
||||||
Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future versions of the GNU
|
|
||||||
General Public License can be used, that proxy's public statement of acceptance of a
|
|
||||||
version permanently authorizes you to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different permissions. However, no
|
|
||||||
additional obligations are imposed on any author or copyright holder as a result of
|
|
||||||
your choosing to follow a later version.
|
|
||||||
|
|
||||||
### 15. Disclaimer of Warranty
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
||||||
PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
|
|
||||||
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
|
|
||||||
QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
|
||||||
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
### 16. Limitation of Liability
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
|
|
||||||
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS
|
|
||||||
PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
|
|
||||||
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
||||||
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE
|
|
||||||
OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE
|
|
||||||
WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
### 17. Interpretation of Sections 15 and 16
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided above cannot be
|
|
||||||
given local legal effect according to their terms, reviewing courts shall apply local
|
|
||||||
law that most closely approximates an absolute waiver of all civil liability in
|
|
||||||
connection with the Program, unless a warranty or assumption of liability accompanies
|
|
||||||
a copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
_END OF TERMS AND CONDITIONS_
|
|
||||||
|
|
||||||
## How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest possible use to
|
|
||||||
the public, the best way to achieve this is to make it free software which everyone
|
|
||||||
can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest to attach them
|
|
||||||
to the start of each source file to most effectively state the exclusion of warranty;
|
|
||||||
and each file should have at least the “copyright” line and a pointer to
|
|
||||||
where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type 'show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w` and `show c` should show the appropriate parts of
|
|
||||||
the General Public License. Of course, your program's commands might be different;
|
|
||||||
for a GUI interface, you would use an “about box”.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school, if any, to
|
|
||||||
sign a “copyright disclaimer” for the program, if necessary. For more
|
|
||||||
information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program into
|
|
||||||
proprietary programs. If your program is a subroutine library, you may consider it
|
|
||||||
more useful to permit linking proprietary applications with the library. If this is
|
|
||||||
what you want to do, use the GNU Lesser General Public License instead of this
|
|
||||||
License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
267
package-lock.json
generated
267
package-lock.json
generated
@@ -1,25 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "@svar-ui/react-gantt",
|
"name": "@svar-ui/react-gantt",
|
||||||
"version": "2.3.4",
|
"version": "2.4.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@svar-ui/react-gantt",
|
"name": "@svar-ui/react-gantt",
|
||||||
"version": "2.3.4",
|
"version": "2.4.3",
|
||||||
"license": "GPL-3.0",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/gantt-data-provider": "2.3.0",
|
"@svar-ui/gantt-data-provider": "2.4.3",
|
||||||
"@svar-ui/gantt-locales": "2.3.0",
|
"@svar-ui/gantt-locales": "2.4.3",
|
||||||
"@svar-ui/gantt-store": "2.3.0",
|
"@svar-ui/gantt-store": "2.4.3",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/lib-react": "1.1.1",
|
"@svar-ui/lib-react": "1.2.2",
|
||||||
"@svar-ui/lib-state": "1.9.6",
|
"@svar-ui/lib-state": "1.9.6",
|
||||||
"@svar-ui/react-core": "2.3.1",
|
"@svar-ui/react-core": "2.4.0",
|
||||||
"@svar-ui/react-editor": "2.3.2",
|
"@svar-ui/react-editor": "2.4.0",
|
||||||
"@svar-ui/react-grid": "2.3.1",
|
"@svar-ui/react-grid": "2.4.0",
|
||||||
"@svar-ui/react-menu": "2.3.1",
|
"@svar-ui/react-menu": "2.4.0",
|
||||||
"@svar-ui/react-toolbar": "2.3.1"
|
"@svar-ui/react-toolbar": "2.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "18.2.66",
|
"@types/react": "18.2.66",
|
||||||
@@ -1312,57 +1312,57 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/comments-locales": {
|
"node_modules/@svar-ui/comments-locales": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/comments-locales/-/comments-locales-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/comments-locales/-/comments-locales-2.4.0.tgz",
|
||||||
"integrity": "sha512-6796sBw/8EXYbOordXVHwwjZruybKZfZBI/VeJTmJwAm5fz/iiHYBWntQJOmRKqs9xcg4hhFo53yFU+uBL90mA==",
|
"integrity": "sha512-StcviQBWrfs4iulgNAb7rjycBe6fsv2/UvmeZpHNHSvSGCMF+q5Cx0FczwgCXd+dVQI6QPhfOPunmu64hzgIWg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/core-locales": {
|
"node_modules/@svar-ui/core-locales": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/core-locales/-/core-locales-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/core-locales/-/core-locales-2.4.0.tgz",
|
||||||
"integrity": "sha512-wv1oWjNVUoG2s3E0TOFvDVAv29WrSzfsS4bjsop9sFF7VAUIJ7wGGGkTbJcBTJZvAuKNFm10/mY1jV253cPXfQ==",
|
"integrity": "sha512-FXB4MtqbZw4TNdPfELsMum6y5Tgu0PRA7a6upJjLWDYJjlcYEcyT49iJONb30gPIL7HgJkUylJnz6iNuNA3Icw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/editor-locales": {
|
"node_modules/@svar-ui/editor-locales": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/editor-locales/-/editor-locales-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/editor-locales/-/editor-locales-2.4.0.tgz",
|
||||||
"integrity": "sha512-Qsz/uId1sxCWiWkIXBG9QknKwu+RmhQbeE4NpdgX6T6obvVLujCHlXDhb9dKmiF9Xib+HNl38ripggXjpTC5Uw==",
|
"integrity": "sha512-ngo2vdAxdpYeEhCfIJstyKP6mY7uE3hDI7xpzkN8d92DJcrdgCquYTAkI7UV94FGlfGMfGM2DFnXYSuQwLYB9w==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/filter-locales": {
|
"node_modules/@svar-ui/filter-locales": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/filter-locales/-/filter-locales-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/filter-locales/-/filter-locales-2.4.0.tgz",
|
||||||
"integrity": "sha512-KKKEDpnyLMm0RAWKatAknP2d2nquuhvUspsmHnkSf4i1eZqdmR3R5od7v3EP18nWBpVbqlhJ6HlWo6jzdPcAbA==",
|
"integrity": "sha512-POV7u7xM9O84i5HnWKQ9LfWyfvmVgFOl0wDO+Ix6MfugPkj14pX6FLvuooyXwfUNMV6G6hS7AuKlNR5SlW94ZA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/filter-store": {
|
"node_modules/@svar-ui/filter-store": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/filter-store/-/filter-store-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/filter-store/-/filter-store-2.4.0.tgz",
|
||||||
"integrity": "sha512-2tF3Q4HFHanDyEW/wZOX9UNcgyrymF4//nXKlatzGnkl0WcNPf867EEzM7+4qO+BP2KG9MICcISv0hjTNely5Q==",
|
"integrity": "sha512-xEnVZXuDFxduHfqq+r1YjditolB1FpHHFGK87WOjTrtIPmiiKCQF2vt5LKJuswUQPbG3kMW93EAvZWZVCnKeKA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/lib-state": "1.9.6"
|
"@svar-ui/lib-state": "1.9.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/gantt-data-provider": {
|
"node_modules/@svar-ui/gantt-data-provider": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/gantt-data-provider/-/gantt-data-provider-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/gantt-data-provider/-/gantt-data-provider-2.4.3.tgz",
|
||||||
"integrity": "sha512-8ooq2MNs5MXxeM92NJjEfhZ0CmJAAjr8Yd5+ip3rd5ZR6d9qsi8Eq/ISUYz+kS0UB/G7VKpKWYTnluxq/GtAQQ==",
|
"integrity": "sha512-PN7c5Il3z47Hbb11CeYDtK1sNAM0hQffYF3fm6hHVnWelgJTg6HP7YC21pjfP+koP37MXYHEsMuIYLsPSZwEQA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/lib-data-provider": "1.7.1"
|
"@svar-ui/lib-data-provider": "1.7.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/gantt-locales": {
|
"node_modules/@svar-ui/gantt-locales": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/gantt-locales/-/gantt-locales-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/gantt-locales/-/gantt-locales-2.4.3.tgz",
|
||||||
"integrity": "sha512-p2nrH9fBvxkmFy9kcWbNDB8ICcD2YcUMpLVWUGVepcnRgm9seauqQevn0mYdBSRpbGuJkQbE/v2rKr5jZe4+lg==",
|
"integrity": "sha512-Bz+T3yztniTN/4YGZ4uvdYg/VeFN0qcvOVifM150hwTQEZEq3dj2dKxpeG6Ez67BUZLgJgLGCvE/nx2wiMbmiw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/gantt-store": {
|
"node_modules/@svar-ui/gantt-store": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/gantt-store/-/gantt-store-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/gantt-store/-/gantt-store-2.4.3.tgz",
|
||||||
"integrity": "sha512-GPJMSvo/Yc/nTikiqt+qMNKTo+/F4Vo9J+t4Nj8b6YXpX4zODLSAKTdCBfazhG4COBDpoFv1hfV64gNO2gXqmQ==",
|
"integrity": "sha512-UXfRjR1/sETv493IE2mXC2yKPMJ6GvStGggAjjq3eFeU/w3nwc3l+mWttUWVqUXgfvR41XXkOl+vLHqSzbJnEw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/lib-state": "1.9.6",
|
"@svar-ui/lib-state": "1.9.6",
|
||||||
@@ -1370,26 +1370,27 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/grid-data-provider": {
|
"node_modules/@svar-ui/grid-data-provider": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/grid-data-provider/-/grid-data-provider-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/grid-data-provider/-/grid-data-provider-2.4.0.tgz",
|
||||||
"integrity": "sha512-vaEgpKbmAj2OKoMF/Y782R4J2NMrq5FZuZR3Quvbj+BlmFb9I3j653IXeyt+vdy0nb73Z2FK95fyRo83h9s0uQ==",
|
"integrity": "sha512-Rm0Zbwj3/ZZLTdpmJXX/lGKafL2sqZuikOh/8KXNty7RXjx6WqryjaAkX6t0cl8lnhPjV/awC4R4+uYRW4UbEQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/lib-data-provider": "1.7.1"
|
"@svar-ui/lib-data-provider": "1.7.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/grid-locales": {
|
"node_modules/@svar-ui/grid-locales": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/grid-locales/-/grid-locales-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/grid-locales/-/grid-locales-2.4.0.tgz",
|
||||||
"integrity": "sha512-ES2vxPfsKjXImEepsO6nZKiKktV8BrUOvn07COyNPwPwvGJBxdiG6p5EdhsxmhK9Sz1phEMxNJr04v/GWnV00Q==",
|
"integrity": "sha512-UnhsQYzDAplMES08QXupa7/1BdBXyCujnTuQaIKZcDf/PGRiSFo3I3iNCk6UdJ5Tnj4si9CqB8/wcIp2YyAHSg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/grid-store": {
|
"node_modules/@svar-ui/grid-store": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/grid-store/-/grid-store-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/grid-store/-/grid-store-2.4.0.tgz",
|
||||||
"integrity": "sha512-nYe7Hs8Vf41pZE677ax0XJK41lQMsswah4/rxEOzLEtQudALJJUi6ZFUHxdTj68pUfP+A/NK5TQPtcubxgzOJQ==",
|
"integrity": "sha512-GJyVC+5G+aA8EfcoKMwrHVP2/OK7bUUbp9ofyZTGUAyuXO9tkxRnfquvk+nTA1ybOfbFCY8rSsJTEHYcgXQCTw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/lib-state": "1.9.6"
|
"@svar-ui/lib-state": "1.9.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1403,18 +1404,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/lib-dom": {
|
"node_modules/@svar-ui/lib-dom": {
|
||||||
"version": "0.9.2",
|
"version": "0.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/lib-dom/-/lib-dom-0.9.2.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/lib-dom/-/lib-dom-0.11.1.tgz",
|
||||||
"integrity": "sha512-U/+2dPuO4GvCxPfyA20XP+cn/5NqJjobS/ZvwTUj1UVMycnIkFRVukboV58LviP5mLJw4o/k1vAgank7sfBEpA==",
|
"integrity": "sha512-4wgerhDVttvrQ9t6OjHur34Of+VVr2VygA16HHGcWHytgdnOuGgfZb5PeBEhCJw/pO3RKfJvBHbaMIzL4IR//g==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/lib-react": {
|
"node_modules/@svar-ui/lib-react": {
|
||||||
"version": "1.1.1",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/lib-react/-/lib-react-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/lib-react/-/lib-react-1.2.2.tgz",
|
||||||
"integrity": "sha512-FPhO9ON12b6ZcSUt7Q/Zua1xL707UrMXCTSLwgf8bKjMSCTYVj602OIm6xR9OEmGvOy2mUhpOZUoZiCMsF1MFA==",
|
"integrity": "sha512-bB+Vou2NM0JhMuFW03MsjjoV5Y3xcFfuuK48+7uzUC9Ui1oSWpCK+txOZ+dnUFJISSVjSsXuF34AzMw/2CA63w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/lib-dom": "^0.9.2"
|
"@svar-ui/lib-dom": "^0.11.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/lib-state": {
|
"node_modules/@svar-ui/lib-state": {
|
||||||
@@ -1423,28 +1424,19 @@
|
|||||||
"integrity": "sha512-twoHa8wZvzdxtES68s6Wnp4Xi1WivScNaFFK6sJ6WDgqVYOzJw0ZhVVrdwHQgieLITTKl/DYh/U3nuqtMetKYw==",
|
"integrity": "sha512-twoHa8wZvzdxtES68s6Wnp4Xi1WivScNaFFK6sJ6WDgqVYOzJw0ZhVVrdwHQgieLITTKl/DYh/U3nuqtMetKYw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/lib-svelte": {
|
|
||||||
"version": "0.5.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/lib-svelte/-/lib-svelte-0.5.2.tgz",
|
|
||||||
"integrity": "sha512-i+hHMT3zctaGbRpyMDREt9im7YfLpvGwFYvH1ntEp/kYAwUrR/sxMJlEEKIid+Yg2EeMUstGxmYQbkWoMpPG7A==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@svar-ui/lib-state": "^1.9.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@svar-ui/react-comments": {
|
"node_modules/@svar-ui/react-comments": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/react-comments/-/react-comments-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/react-comments/-/react-comments-2.4.0.tgz",
|
||||||
"integrity": "sha512-YsFAFM4LHn/l6Mz7r8NNYP1a6jINNBKkH5epMey4iOWVLgoryNwpxQso5f9qmkVZk+LwMpNYTxOgm8IqEpndbg==",
|
"integrity": "sha512-AYIyox5AboURnS+mQXWR+0egk/XGzcZivam9TaGvUh7+msq1Dr0SZXcDXImZDZDQzIFDfgRW6GrJb6i/P4AJkQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/comments-locales": "^2.3.1",
|
"@svar-ui/comments-locales": "2.4.0",
|
||||||
"@svar-ui/core-locales": "^2.3.0",
|
"@svar-ui/core-locales": "2.4.0",
|
||||||
"@svar-ui/lib-data-provider": "1.7.1",
|
"@svar-ui/lib-data-provider": "1.7.1",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/lib-state": "1.9.6",
|
"@svar-ui/lib-state": "1.9.6",
|
||||||
"@svar-ui/react-core": "2.3.1",
|
"@svar-ui/react-core": "2.4.0",
|
||||||
"@svar-ui/react-menu": "2.3.1"
|
"@svar-ui/react-menu": "2.4.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
@@ -1452,14 +1444,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/react-core": {
|
"node_modules/@svar-ui/react-core": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/react-core/-/react-core-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/react-core/-/react-core-2.4.0.tgz",
|
||||||
"integrity": "sha512-J4IkKf+pwVjO+p0vINW+kqXI/0Zb6CtefY39hMyRYF+X0VV+1/5rj0sQBH5eR5A76Y/oX+dUT2uStYtydPolcg==",
|
"integrity": "sha512-65skFDBmQFedlwdMYZ/OF/U/D/IMrs+NqlgI+IUBATXjwshn2YNu6Mke08rfiatr4+Tc/RRowdfhkB0BgmT6Pw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/core-locales": "^2.3.0",
|
"@svar-ui/core-locales": "^2.4.0",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/lib-react": "1.1.1"
|
"@svar-ui/lib-react": "1.2.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
@@ -1467,18 +1459,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/react-editor": {
|
"node_modules/@svar-ui/react-editor": {
|
||||||
"version": "2.3.2",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/react-editor/-/react-editor-2.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/react-editor/-/react-editor-2.4.0.tgz",
|
||||||
"integrity": "sha512-5+VE1QQCZfECWS05SwsOgyzIvEOJo9UlyexIiPSfK3CzSRuu/rEmohp8I2CkmdkyQR5XFKT9ROkoxZ55plzJag==",
|
"integrity": "sha512-hbF5XWPmqrOwo4KTs51jyNyWyeE20n5oTUX0CkL814UiKjGu5LDd4POzpJAVUASeHe535TqS4Vr0SCY1AcrVdQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/editor-locales": "^2.3.1",
|
"@svar-ui/editor-locales": "2.4.0",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/lib-state": "1.9.6",
|
"@svar-ui/lib-state": "1.9.6",
|
||||||
"@svar-ui/react-comments": "2.3.1",
|
"@svar-ui/react-comments": "2.4.0",
|
||||||
"@svar-ui/react-core": "2.3.1",
|
"@svar-ui/react-core": "2.4.0",
|
||||||
"@svar-ui/react-tasklist": "2.3.1",
|
"@svar-ui/react-tasklist": "2.4.0",
|
||||||
"@svar-ui/react-toolbar": "2.3.1"
|
"@svar-ui/react-toolbar": "2.4.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
@@ -1486,18 +1478,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/react-filter": {
|
"node_modules/@svar-ui/react-filter": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/react-filter/-/react-filter-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/react-filter/-/react-filter-2.4.0.tgz",
|
||||||
"integrity": "sha512-3dxiZBat76onAMVRLZeFw2MoimQtICtzAWiNSK2YvrGzbyzlorLFWZtRLD8JXrmBNJPSrwVC6SMb6bxaTLdPAA==",
|
"integrity": "sha512-NaGf1M0uI4n6djpuqy9Lwv2g3YcvRwfwYHnVqLiTb8uspghWucTMM7QVy4ESkwl8CF09MxH4WaEwzpoN5M1+JQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/filter-locales": "^2.3.0",
|
"@svar-ui/filter-locales": "2.4.0",
|
||||||
"@svar-ui/filter-store": "2.3.0",
|
"@svar-ui/filter-store": "2.4.0",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/lib-react": "1.1.1",
|
"@svar-ui/lib-react": "1.2.2",
|
||||||
"@svar-ui/lib-state": "1.9.6",
|
"@svar-ui/lib-state": "1.9.6",
|
||||||
"@svar-ui/react-core": "2.3.1",
|
"@svar-ui/react-core": "2.4.0",
|
||||||
"@svar-ui/react-menu": "2.3.1"
|
"@svar-ui/react-grid": "^2.0.0",
|
||||||
|
"@svar-ui/react-menu": "2.4.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
@@ -1505,41 +1498,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/react-grid": {
|
"node_modules/@svar-ui/react-grid": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/react-grid/-/react-grid-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/react-grid/-/react-grid-2.4.0.tgz",
|
||||||
"integrity": "sha512-Xb/VNQVBYiEkMDv6TkkamZzKSnzEr7dk7R07E6tudL2TL8XXXJiLwaXuZEFR47xo3RNUU45aev2dLvyyAqxb7A==",
|
"integrity": "sha512-N7G7QwBN/1KQliQNdN8xhnF0W+tkdoIDg5plTYr3NspwIZYMF6oQCO+r+jVRNZV2cxtb9WHlq7x2vm/x0twsrg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/grid-data-provider": "2.3.0",
|
"@svar-ui/grid-data-provider": "2.4.0",
|
||||||
"@svar-ui/grid-locales": "2.3.0",
|
"@svar-ui/grid-locales": "2.4.0",
|
||||||
"@svar-ui/grid-store": "2.3.0",
|
"@svar-ui/grid-store": "2.4.0",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/lib-react": "1.1.1",
|
"@svar-ui/lib-react": "1.2.2",
|
||||||
"@svar-ui/lib-state": "1.9.6",
|
"@svar-ui/lib-state": "1.9.6",
|
||||||
"@svar-ui/lib-svelte": "0.5.2",
|
"@svar-ui/react-core": "2.4.0",
|
||||||
"@svar-ui/react-core": "2.3.1",
|
"@svar-ui/react-editor": "2.4.0",
|
||||||
"@svar-ui/react-editor": "2.3.1",
|
"@svar-ui/react-filter": "2.4.0",
|
||||||
"@svar-ui/react-filter": "2.3.1",
|
"@svar-ui/react-menu": "2.4.0"
|
||||||
"@svar-ui/react-menu": "2.3.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": ">=18",
|
|
||||||
"react-dom": ">=18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@svar-ui/react-grid/node_modules/@svar-ui/react-editor": {
|
|
||||||
"version": "2.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/react-editor/-/react-editor-2.3.1.tgz",
|
|
||||||
"integrity": "sha512-INtanBRib2268nqZZCIM8WUsjhctLQ6Y7PpV2O2qE9ECwB47DGLNn4hS4A33YNo86m2Z5Ni42+LQlga9ruv/3w==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@svar-ui/editor-locales": "^2.3.1",
|
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
|
||||||
"@svar-ui/lib-state": "1.9.6",
|
|
||||||
"@svar-ui/react-comments": "2.3.1",
|
|
||||||
"@svar-ui/react-core": "2.3.1",
|
|
||||||
"@svar-ui/react-tasklist": "2.3.1",
|
|
||||||
"@svar-ui/react-toolbar": "2.3.1"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
@@ -1547,14 +1520,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/react-menu": {
|
"node_modules/@svar-ui/react-menu": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/react-menu/-/react-menu-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/react-menu/-/react-menu-2.4.0.tgz",
|
||||||
"integrity": "sha512-fg2zlNnwiL5wcFaCdVghEU+8GybLPcm4Wi9BvKhYm1j2dzcdEYCSusArWcUR7XsnybKGxHfjjRjGse0FC3f3wg==",
|
"integrity": "sha512-v7hPw7T5RRBVEj9F7W35IF38l4SiMauzboDTw7pamcXpA7VJE88Pb3ctCC0TDAFbZPGxVevo+cHliDzfUygQsw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/core-locales": "2.3.1",
|
"@svar-ui/core-locales": "2.4.0",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/react-core": "2.3.1"
|
"@svar-ui/react-core": "2.4.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
@@ -1562,16 +1535,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/react-tasklist": {
|
"node_modules/@svar-ui/react-tasklist": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/react-tasklist/-/react-tasklist-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/react-tasklist/-/react-tasklist-2.4.0.tgz",
|
||||||
"integrity": "sha512-zRnBz8FzprhkgRnwjZ/XWd+50ZoDz2zwOchj6GByaj0rNXDpJ3vmKEVefxtrjfYhqckv+xBLVKQIB4qVo7Pwnw==",
|
"integrity": "sha512-kOTpot7ds+aEAD0OP8K98dyQKQmF7wLpn7BrEHDvcPlwzW6RtajR7mWnK8znw2Y+O0qo3b3uYxBVE1JoKB2ePw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/lib-data-provider": "1.7.1",
|
"@svar-ui/lib-data-provider": "1.7.1",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/lib-state": "1.9.6",
|
"@svar-ui/lib-state": "1.9.6",
|
||||||
"@svar-ui/react-core": "2.3.1",
|
"@svar-ui/react-core": "2.4.0",
|
||||||
"@svar-ui/tasklist-locales": "^2.3.1"
|
"@svar-ui/tasklist-locales": "2.4.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
@@ -1579,14 +1552,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/react-toolbar": {
|
"node_modules/@svar-ui/react-toolbar": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/react-toolbar/-/react-toolbar-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/react-toolbar/-/react-toolbar-2.4.0.tgz",
|
||||||
"integrity": "sha512-e5cbcUp20PtDm4DQQY4fZ+SLbxBu8sy0FbwJbIJ628DHBWVcUHbPrDKyDrB/oK8TCT3aXgnjcLuAAdhRI7OyrA==",
|
"integrity": "sha512-eBtUTftSosf0I7Y3r9TeHe3uVvg+YL77+NhGEGV9DnqFCvw2Zp2IrCViuBbcW9owsPLeXHtM7Eb8/U61EqRUYQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/core-locales": "2.3.1",
|
"@svar-ui/core-locales": "2.4.0",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/react-core": "2.3.1"
|
"@svar-ui/react-core": "2.4.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
@@ -1594,9 +1567,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@svar-ui/tasklist-locales": {
|
"node_modules/@svar-ui/tasklist-locales": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@svar-ui/tasklist-locales/-/tasklist-locales-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@svar-ui/tasklist-locales/-/tasklist-locales-2.4.0.tgz",
|
||||||
"integrity": "sha512-q/inHXJquKjkCEFaBnT5vrcH/Azhy/kDvfGuLmNXzp3kaFiAQM4yOFfh7+zjO05En/FLb81j501j+6WXJ9UAuA==",
|
"integrity": "sha512-gcclKwfShkTiZaYCl9blfOiUqVwcEv8qtyNoKfEhli4FWjjG4sysue27CvHD2qFZAjoRYQi2hoQ4odLM1AO7tQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/babel__core": {
|
"node_modules/@types/babel__core": {
|
||||||
|
|||||||
31
package.json
31
package.json
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "@svar-ui/react-gantt",
|
"name": "@svar-ui/react-gantt",
|
||||||
"version": "2.3.4",
|
"version": "2.4.3",
|
||||||
"description": "A customizable, high-performance React Gantt chart component for building project timelines.",
|
"description": "A customizable, high-performance React Gantt chart component for building project timelines.",
|
||||||
"productTag": "gantt",
|
"productTag": "gantt",
|
||||||
|
"productTrial": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
@@ -21,9 +22,9 @@
|
|||||||
"timeline",
|
"timeline",
|
||||||
"typescript"
|
"typescript"
|
||||||
],
|
],
|
||||||
"license": "GPL-3.0",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite --open",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"build:demo": "BUILD_DEMOS=true vite build",
|
"build:demo": "BUILD_DEMOS=true vite build",
|
||||||
"build:full-css": "BUILD_FULL_CSS=true vite build",
|
"build:full-css": "BUILD_FULL_CSS=true vite build",
|
||||||
@@ -49,26 +50,26 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
"types",
|
"types",
|
||||||
|
"licenses",
|
||||||
"package.json",
|
"package.json",
|
||||||
"dist-full/index.css",
|
"dist-full/index.css"
|
||||||
"whatsnew.md"
|
|
||||||
],
|
],
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
"react-dom": ">=18"
|
"react-dom": ">=18"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@svar-ui/gantt-data-provider": "2.3.0",
|
"@svar-ui/gantt-data-provider": "2.4.3",
|
||||||
"@svar-ui/gantt-locales": "2.3.0",
|
"@svar-ui/gantt-locales": "2.4.3",
|
||||||
"@svar-ui/gantt-store": "2.3.0",
|
"@svar-ui/gantt-store": "2.4.3",
|
||||||
"@svar-ui/lib-dom": "0.9.2",
|
"@svar-ui/lib-dom": "0.11.1",
|
||||||
"@svar-ui/lib-state": "1.9.6",
|
"@svar-ui/lib-state": "1.9.6",
|
||||||
"@svar-ui/lib-react": "1.1.1",
|
"@svar-ui/lib-react": "1.2.2",
|
||||||
"@svar-ui/react-core": "2.3.1",
|
"@svar-ui/react-core": "2.4.0",
|
||||||
"@svar-ui/react-menu": "2.3.1",
|
"@svar-ui/react-menu": "2.4.0",
|
||||||
"@svar-ui/react-grid": "2.3.1",
|
"@svar-ui/react-grid": "2.4.0",
|
||||||
"@svar-ui/react-toolbar": "2.3.1",
|
"@svar-ui/react-toolbar": "2.4.0",
|
||||||
"@svar-ui/react-editor": "2.3.2"
|
"@svar-ui/react-editor": "2.4.0"
|
||||||
},
|
},
|
||||||
"homepage": "https://svar.dev/react/gantt/",
|
"homepage": "https://svar.dev/react/gantt/",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
55
readme.md
55
readme.md
@@ -20,26 +20,41 @@ TypeScript support, React 19 compatibility, and clean UI make it a modern and re
|
|||||||
|
|
||||||
### ✨ Key Features
|
### ✨ Key Features
|
||||||
|
|
||||||
- Interactive drag-and-drop interface
|
- Interactive drag-and-drop interface
|
||||||
- Intuitive and customizable task edit form
|
- Intuitive and customizable task edit form
|
||||||
- Set task dependencies on the timeline or in a popup form
|
- Set task dependencies on the timeline or in a popup form
|
||||||
- Showing task progress on the taskbar
|
- Showing task progress on the taskbar
|
||||||
- Hierarchical view of sub tasks
|
- Hierarchical view of sub tasks
|
||||||
- Configurable timeline (hours, days, weeks)
|
- Configurable timeline (hours, days, weeks)
|
||||||
- Flexible time units: support for hours and minutes
|
- Flexible time units: support for hours and minutes
|
||||||
- Custom time scales: define custom periods like sprints or stages
|
- Custom time scales: define custom periods like sprints or stages
|
||||||
- Ability to use custom HTML in grid cells
|
- Ability to use custom HTML in grid cells
|
||||||
- Sorting tasks in grid
|
- Sorting tasks in grid
|
||||||
- Toolbar and context menu
|
- Toolbar and context menu
|
||||||
- Tooltips for taskbars
|
- Tooltips for taskbars
|
||||||
- Weekends/holidays highlights
|
- Weekends/holidays highlights
|
||||||
- Zooming with scroll
|
- Zooming with scroll
|
||||||
- Hotkey support for common actions
|
- Hotkey support for common actions
|
||||||
- Fast performance with large data sets
|
- Fast performance with large data sets
|
||||||
- Localization
|
- Localization
|
||||||
- Light and dark skins
|
- Light and dark skins
|
||||||
- Full TypeScript support
|
- Full TypeScript support
|
||||||
- React 18 & 19 compatible
|
- React 18 & 19 compatible
|
||||||
|
|
||||||
|
### 🚀 PRO Edition
|
||||||
|
|
||||||
|
SVAR React Gantt is available in open-source and PRO Editions. The PRO Edition offers additional features and automation logic:
|
||||||
|
|
||||||
|
- Work days calendar
|
||||||
|
- Auto-scheduling (forward mode and Finish-to-Start dependencies)
|
||||||
|
- Critical path
|
||||||
|
- Baselines
|
||||||
|
- Split tasks
|
||||||
|
- Vertical markers
|
||||||
|
- Unscheduled tasks
|
||||||
|
- Undo/redo
|
||||||
|
|
||||||
|
Visit the [pricing page](https://svar.dev/react/gantt/pricing/) for full feature comparison and licensing details.
|
||||||
|
|
||||||
[Check out the demos](https://docs.svar.dev/react/gantt/samples/) to see all SVAR React Gantt features in action.
|
[Check out the demos](https://docs.svar.dev/react/gantt/samples/) to see all SVAR React Gantt features in action.
|
||||||
|
|
||||||
|
|||||||
@@ -8,34 +8,27 @@ import {
|
|||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { ContextMenu as WxContextMenu } from '@svar-ui/react-menu';
|
import { ContextMenu as WxContextMenu } from '@svar-ui/react-menu';
|
||||||
import {
|
import { handleAction, getMenuOptions, isHandledAction } from '@svar-ui/gantt-store';
|
||||||
handleAction,
|
import { locale, locateID } from '@svar-ui/lib-dom';
|
||||||
defaultMenuOptions,
|
|
||||||
isHandledAction,
|
|
||||||
} from '@svar-ui/gantt-store';
|
|
||||||
import { locale } from '@svar-ui/lib-dom';
|
|
||||||
import { en } from '@svar-ui/gantt-locales';
|
import { en } from '@svar-ui/gantt-locales';
|
||||||
import { en as coreEn } from '@svar-ui/core-locales';
|
import { en as coreEn } from '@svar-ui/core-locales';
|
||||||
import { context } from '@svar-ui/react-core';
|
import { context } from '@svar-ui/react-core';
|
||||||
import { useWritableProp, useStoreLater } from '@svar-ui/lib-react';
|
import { useStoreLater } from '@svar-ui/lib-react';
|
||||||
import './ContextMenu.css';
|
import './ContextMenu.css';
|
||||||
|
|
||||||
const ContextMenu = forwardRef(function ContextMenu(
|
const ContextMenu = forwardRef(function ContextMenu(
|
||||||
{
|
{
|
||||||
options: optionsInit,
|
options: optionsInit = [],
|
||||||
api = null,
|
api = null,
|
||||||
resolver = null,
|
resolver = null,
|
||||||
filter = null,
|
filter = null,
|
||||||
at = 'point',
|
at = 'point',
|
||||||
children,
|
children,
|
||||||
onClick,
|
onClick,
|
||||||
css
|
css,
|
||||||
},
|
},
|
||||||
ref,
|
ref,
|
||||||
) {
|
) {
|
||||||
const ownMenu = useMemo(() => optionsInit ?? [...defaultMenuOptions], [optionsInit]);
|
|
||||||
const [optionsProp] = useWritableProp(ownMenu);
|
|
||||||
|
|
||||||
const menuRef = useRef(null);
|
const menuRef = useRef(null);
|
||||||
const activeIdRef = useRef(null);
|
const activeIdRef = useRef(null);
|
||||||
|
|
||||||
@@ -44,10 +37,12 @@ const ContextMenu = forwardRef(function ContextMenu(
|
|||||||
const l = useMemo(() => i18nCtx || locale({ ...en, ...coreEn }), [i18nCtx]);
|
const l = useMemo(() => i18nCtx || locale({ ...en, ...coreEn }), [i18nCtx]);
|
||||||
const _ = useMemo(() => l.getGroup('gantt'), [l]);
|
const _ = useMemo(() => l.getGroup('gantt'), [l]);
|
||||||
|
|
||||||
const rTaskTypesVal = useStoreLater(api, "taskTypes");
|
const taskTypesVal = useStoreLater(api, 'taskTypes');
|
||||||
const rTasksVal = useStoreLater(api, "_tasks");
|
const selectedVal = useStoreLater(api, 'selected');
|
||||||
const rSelectedVal = useStoreLater(api, "selected");
|
const selectedTasksVal = useStoreLater(api, '_selected');
|
||||||
const rSelectedTasksVal = useStoreLater(api, "_selected");
|
const splitTasksVal = useStoreLater(api, 'splitTasks');
|
||||||
|
|
||||||
|
const fullOptions = useMemo(() => getMenuOptions({ splitTasks: true }), []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!api) return;
|
if (!api) return;
|
||||||
@@ -71,27 +66,26 @@ const ContextMenu = forwardRef(function ContextMenu(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getOptions() {
|
function getOptions() {
|
||||||
const convertOption = optionsProp.find((o) => o.id === 'convert-task');
|
const finalOptions = optionsInit.length
|
||||||
|
? optionsInit
|
||||||
|
: getMenuOptions({ splitTasks: splitTasksVal });
|
||||||
|
const convertOption = finalOptions.find((o) => o.id === 'convert-task');
|
||||||
if (convertOption) {
|
if (convertOption) {
|
||||||
convertOption.data = [];
|
convertOption.data = [];
|
||||||
(rTaskTypesVal || []).forEach((t) => {
|
(taskTypesVal || []).forEach((t) => {
|
||||||
convertOption.data.push(convertOption.dataFactory(t));
|
convertOption.data.push(convertOption.dataFactory(t));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return applyLocaleFn(optionsProp);
|
return applyLocaleFn(finalOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cOptions = useMemo(() => {
|
const cOptions = useMemo(() => {
|
||||||
if (api) {
|
return getOptions();
|
||||||
return getOptions();
|
}, [api, optionsInit, taskTypesVal, splitTasksVal, _]);
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}, [api, optionsProp, rTaskTypesVal, _]);
|
|
||||||
|
|
||||||
const selectedTasks = useMemo(
|
const selectedTasks = useMemo(
|
||||||
() =>
|
() => (selectedTasksVal && selectedTasksVal.length ? selectedTasksVal : []),
|
||||||
rSelectedTasksVal && rSelectedTasksVal.length ? rSelectedTasksVal : [],
|
[selectedTasksVal],
|
||||||
[rSelectedTasksVal],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const itemResolver = useCallback(
|
const itemResolver = useCallback(
|
||||||
@@ -102,40 +96,55 @@ const ContextMenu = forwardRef(function ContextMenu(
|
|||||||
task = result === true ? task : result;
|
task = result === true ? task : result;
|
||||||
}
|
}
|
||||||
if (task) {
|
if (task) {
|
||||||
activeIdRef.current = task.id;
|
const segmentIndex = locateID(ev.target, 'data-segment');
|
||||||
if (!Array.isArray(rSelectedVal) || !rSelectedVal.includes(task.id)) {
|
if (segmentIndex !== null)
|
||||||
|
activeIdRef.current = { id: task.id, segmentIndex };
|
||||||
|
else activeIdRef.current = task.id;
|
||||||
|
|
||||||
|
if (!Array.isArray(selectedVal) || !selectedVal.includes(task.id)) {
|
||||||
api && api.exec && api.exec('select-task', { id: task.id });
|
api && api.exec && api.exec('select-task', { id: task.id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return task;
|
return task;
|
||||||
},
|
},
|
||||||
[api, resolver, rSelectedVal],
|
[api, resolver, selectedVal],
|
||||||
);
|
);
|
||||||
|
|
||||||
const menuAction = useCallback(
|
const menuAction = useCallback(
|
||||||
(ev) => {
|
(ev) => {
|
||||||
const action = ev.action;
|
const action = ev.action;
|
||||||
if (action) {
|
if (action) {
|
||||||
const isAction = isHandledAction(defaultMenuOptions, action.id);
|
const isAction = isHandledAction(fullOptions, action.id);
|
||||||
if (isAction) handleAction(api, action.id, activeIdRef.current, _);
|
if (isAction) handleAction(api, action.id, activeIdRef.current, _);
|
||||||
onClick && onClick(ev);
|
onClick && onClick(ev);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[api, _, onClick],
|
[api, _, onClick, fullOptions],
|
||||||
);
|
);
|
||||||
|
|
||||||
const filterMenu = useCallback(
|
const filterMenu = useCallback(
|
||||||
(item, task) => {
|
(item, task) => {
|
||||||
|
// for single selection from resolver _selected are empty
|
||||||
|
// due to setAsyncState causing _selected to lag
|
||||||
const tasks = selectedTasks.length ? selectedTasks : task ? [task] : [];
|
const tasks = selectedTasks.length ? selectedTasks : task ? [task] : [];
|
||||||
|
|
||||||
let result = filter ? filter(item, task) : true;
|
let result = filter ? tasks.every((t) => filter(item, t)) : true;
|
||||||
if (item.check && result) {
|
|
||||||
const isDisabled = tasks.some((t) => !item.check(t, rTasksVal));
|
if (result) {
|
||||||
item.css = isDisabled ? 'wx-disabled' : '';
|
if (item.isHidden)
|
||||||
|
result = !tasks.some((t) =>
|
||||||
|
item.isHidden(t, api.getState(), activeIdRef.current),
|
||||||
|
);
|
||||||
|
if (item.isDisabled) {
|
||||||
|
const disabled = tasks.some((t) =>
|
||||||
|
item.isDisabled(t, api.getState(), activeIdRef.current),
|
||||||
|
);
|
||||||
|
item.disabled = disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
[filter, selectedTasks, rTasksVal],
|
[filter, selectedTasks, api],
|
||||||
);
|
);
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.wx-sidearea .wx-gantt-editor.wx-XkvqDXuw {
|
.wx-sidearea .wx-gantt-editor.wx-XkvqDXuw {
|
||||||
width: 400px;
|
width: 450px;
|
||||||
}
|
}
|
||||||
.wx-sidearea .wx-gantt-editor.wx-full-screen.wx-XkvqDXuw {
|
.wx-sidearea .wx-gantt-editor.wx-full-screen.wx-XkvqDXuw {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useEffect, useMemo, useCallback, useContext } from 'react';
|
import { useState, useEffect, useMemo, useCallback, useContext } from 'react';
|
||||||
import { Editor as WxEditor, registerEditorItem } from '@svar-ui/react-editor';
|
import { Editor as WxEditor, registerEditorItem } from '@svar-ui/react-editor';
|
||||||
import { Locale, RichSelect, Slider, Counter, TwoState } from '@svar-ui/react-core';
|
import { Locale, RichSelect, Slider, Counter, TwoState } from '@svar-ui/react-core';
|
||||||
import { defaultEditorItems, normalizeDates } from '@svar-ui/gantt-store';
|
import { getEditorItems, prepareEditTask } from '@svar-ui/gantt-store';
|
||||||
import { dateToString, locale } from '@svar-ui/lib-dom';
|
import { dateToString, locale } from '@svar-ui/lib-dom';
|
||||||
import { en } from '@svar-ui/gantt-locales';
|
import { en } from '@svar-ui/gantt-locales';
|
||||||
import { en as coreEn } from '@svar-ui/core-locales';
|
import { en as coreEn } from '@svar-ui/core-locales';
|
||||||
@@ -9,7 +9,7 @@ import { context } from '@svar-ui/react-core';
|
|||||||
|
|
||||||
import Links from './editor/Links.jsx';
|
import Links from './editor/Links.jsx';
|
||||||
import DateTimePicker from './editor/DateTimePicker.jsx';
|
import DateTimePicker from './editor/DateTimePicker.jsx';
|
||||||
import { useStore, useWritableProp } from '@svar-ui/lib-react';
|
import { useStore } from '@svar-ui/lib-react';
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
import { modeObserver } from '../helpers/modeResizeObserver';
|
import { modeObserver } from '../helpers/modeResizeObserver';
|
||||||
@@ -25,7 +25,7 @@ registerEditorItem('links', Links);
|
|||||||
|
|
||||||
function Editor({
|
function Editor({
|
||||||
api,
|
api,
|
||||||
items = defaultEditorItems,
|
items = [],
|
||||||
css = '',
|
css = '',
|
||||||
layout = 'default',
|
layout = 'default',
|
||||||
readonly = false,
|
readonly = false,
|
||||||
@@ -34,6 +34,7 @@ function Editor({
|
|||||||
topBar = true,
|
topBar = true,
|
||||||
autoSave = true,
|
autoSave = true,
|
||||||
focus = false,
|
focus = false,
|
||||||
|
hotkeys = {},
|
||||||
}) {
|
}) {
|
||||||
const lFromCtx = useContext(context.i18n);
|
const lFromCtx = useContext(context.i18n);
|
||||||
const l = useMemo(() => lFromCtx || locale({ ...en, ...coreEn }), [lFromCtx]);
|
const l = useMemo(() => lFromCtx || locale({ ...en, ...coreEn }), [lFromCtx]);
|
||||||
@@ -91,28 +92,70 @@ function Editor({
|
|||||||
};
|
};
|
||||||
}, [handleResize]);
|
}, [handleResize]);
|
||||||
|
|
||||||
const activeTask = useStore(api, "_activeTask");
|
const activeTask = useStore(api, '_activeTask');
|
||||||
// const taskId = useStore(api, "activeTaskId");
|
const taskId = useStore(api, 'activeTask');
|
||||||
const taskId = useMemo(() => activeTask?.id, [activeTask]);
|
const unscheduledTasks = useStore(api, 'unscheduledTasks');
|
||||||
const unit = useStore(api, "durationUnit");
|
const links = useStore(api, 'links');
|
||||||
const unscheduledTasks = useStore(api, "unscheduledTasks");
|
const splitTasks = useStore(api, 'splitTasks');
|
||||||
const taskTypes = useStore(api, "taskTypes");
|
const segmentIndex = useMemo(
|
||||||
|
() => splitTasks && taskId?.segmentIndex,
|
||||||
|
[splitTasks, taskId],
|
||||||
|
);
|
||||||
|
const isSegment = useMemo(
|
||||||
|
() => segmentIndex || segmentIndex === 0,
|
||||||
|
[segmentIndex],
|
||||||
|
);
|
||||||
|
const baseItems = useMemo(
|
||||||
|
() => getEditorItems({ unscheduledTasks }),
|
||||||
|
[unscheduledTasks],
|
||||||
|
);
|
||||||
|
const undo = useStore(api, 'undo');
|
||||||
|
|
||||||
const [taskType, setTaskType] = useWritableProp(activeTask?.type);
|
|
||||||
const taskUnscheduled = useMemo(() => activeTask?.unscheduled, [activeTask]);
|
|
||||||
const [linksActionsMap, setLinksActionsMap] = useState({});
|
const [linksActionsMap, setLinksActionsMap] = useState({});
|
||||||
|
const [inProgress, setInProgress] = useState(null);
|
||||||
|
const [editorValues, setEditorValues] = useState();
|
||||||
|
const [editorErrors, setEditorErrors] = useState(null);
|
||||||
|
|
||||||
|
const taskTypes = useStore(api, 'taskTypes');
|
||||||
|
|
||||||
|
const task = useMemo(() => {
|
||||||
|
if (!activeTask) return null;
|
||||||
|
let data;
|
||||||
|
if (isSegment && activeTask.segments)
|
||||||
|
data = { ...activeTask.segments[segmentIndex] };
|
||||||
|
else data = { ...activeTask };
|
||||||
|
|
||||||
|
if (readonly) {
|
||||||
|
// preserve parent to differentiate between segment and task
|
||||||
|
let values = { parent: data.parent };
|
||||||
|
baseItems.forEach(({ key, comp }) => {
|
||||||
|
if (comp !== 'links') {
|
||||||
|
const value = data[key];
|
||||||
|
if (comp === 'date' && value instanceof Date) {
|
||||||
|
values[key] = dateFormat(value);
|
||||||
|
} else if (comp === 'slider' && key === 'progress') {
|
||||||
|
values[key] = `${value}%`;
|
||||||
|
} else {
|
||||||
|
values[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
return data || null;
|
||||||
|
}, [activeTask, isSegment, segmentIndex, readonly, baseItems, dateFormat]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setEditorValues(task);
|
||||||
|
}, [task]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLinksActionsMap({});
|
setLinksActionsMap({});
|
||||||
|
setEditorErrors(null);
|
||||||
|
setInProgress(null);
|
||||||
}, [taskId]);
|
}, [taskId]);
|
||||||
|
|
||||||
const milestone = useMemo(() => taskType === 'milestone', [taskType]);
|
function prepareEditorItems(localItems, taskData) {
|
||||||
const summary = useMemo(() => taskType === 'summary', [taskType]);
|
|
||||||
|
|
||||||
function prepareEditorItems(localItems, isUnscheduled) {
|
|
||||||
const dates = { start: 1, end: 1, duration: 1 };
|
|
||||||
|
|
||||||
return localItems.map((a) => {
|
return localItems.map((a) => {
|
||||||
const item = { ...a };
|
const item = { ...a };
|
||||||
if (a.config) item.config = { ...item.config };
|
if (a.config) item.config = { ...item.config };
|
||||||
@@ -122,7 +165,7 @@ function Editor({
|
|||||||
item.onLinksChange = handleLinksChange;
|
item.onLinksChange = handleLinksChange;
|
||||||
}
|
}
|
||||||
if (item.comp === 'select' && item.key === 'type') {
|
if (item.comp === 'select' && item.key === 'type') {
|
||||||
let options = item.options ?? (taskTypes ? taskTypes : []);
|
const options = item.options ?? (taskTypes ? taskTypes : []);
|
||||||
item.options = options.map((t) => ({
|
item.options = options.map((t) => ({
|
||||||
...t,
|
...t,
|
||||||
label: _(t.label),
|
label: _(t.label),
|
||||||
@@ -137,78 +180,28 @@ function Editor({
|
|||||||
if (item.config?.placeholder)
|
if (item.config?.placeholder)
|
||||||
item.config.placeholder = _(item.config.placeholder);
|
item.config.placeholder = _(item.config.placeholder);
|
||||||
|
|
||||||
if (unscheduledTasks && dates[item.key]) {
|
if (taskData) {
|
||||||
if (isUnscheduled) {
|
if (item.isDisabled && item.isDisabled(taskData, api.getState())) {
|
||||||
item.disabled = true;
|
item.disabled = true;
|
||||||
} else {
|
} else delete item.disabled;
|
||||||
delete item.disabled;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterEditorItems(localItems) {
|
|
||||||
return localItems.filter(({ comp, key, options }) => {
|
|
||||||
switch (comp) {
|
|
||||||
case 'date': {
|
|
||||||
return (
|
|
||||||
(!milestone || (key !== 'end' && key !== 'base_end')) && !summary
|
|
||||||
);
|
|
||||||
}
|
|
||||||
case 'select': {
|
|
||||||
return options.length > 1;
|
|
||||||
}
|
|
||||||
case 'twostate': {
|
|
||||||
return unscheduledTasks && !summary;
|
|
||||||
}
|
|
||||||
case 'counter': {
|
|
||||||
return !summary && !milestone;
|
|
||||||
}
|
|
||||||
case 'slider': {
|
|
||||||
return !milestone;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const editorItems = useMemo(() => {
|
const editorItems = useMemo(() => {
|
||||||
const eItems = prepareEditorItems(items, taskUnscheduled);
|
let eItems = items.length ? items : baseItems;
|
||||||
return filterEditorItems(eItems);
|
eItems = prepareEditorItems(eItems, editorValues);
|
||||||
}, [
|
if (!editorValues) return eItems;
|
||||||
items,
|
return eItems.filter(
|
||||||
taskUnscheduled,
|
(item) => !item.isHidden || !item.isHidden(editorValues, api.getState()),
|
||||||
milestone,
|
);
|
||||||
summary,
|
}, [items, baseItems, editorValues, taskTypes, _, api, autoSave]);
|
||||||
unscheduledTasks,
|
|
||||||
taskTypes,
|
|
||||||
_,
|
|
||||||
api,
|
|
||||||
autoSave,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const task = useMemo(() => {
|
const editorKeys = useMemo(
|
||||||
if (readonly && activeTask) {
|
() => editorItems.map((i) => i.key),
|
||||||
let values = {};
|
[editorItems],
|
||||||
editorItems.forEach(({ key, comp }) => {
|
);
|
||||||
if (comp !== 'links') {
|
|
||||||
const value = activeTask[key];
|
|
||||||
if (comp === 'date' && value instanceof Date) {
|
|
||||||
values[key] = dateFormat(value);
|
|
||||||
} else if (comp === 'slider' && key === 'progress') {
|
|
||||||
values[key] = `${value}%`;
|
|
||||||
} else {
|
|
||||||
values[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
return activeTask ? { ...activeTask } : null;
|
|
||||||
}, [readonly, activeTask, editorItems, dateFormat]);
|
|
||||||
|
|
||||||
function handleLinksChange({ id, action, data }) {
|
function handleLinksChange({ id, action, data }) {
|
||||||
setLinksActionsMap((prev) => ({
|
setLinksActionsMap((prev) => ({
|
||||||
@@ -219,64 +212,147 @@ function Editor({
|
|||||||
|
|
||||||
const saveLinks = useCallback(() => {
|
const saveLinks = useCallback(() => {
|
||||||
for (let link in linksActionsMap) {
|
for (let link in linksActionsMap) {
|
||||||
const { action, data } = linksActionsMap[link];
|
if (links.byId(link)) {
|
||||||
api.exec(action, data);
|
const { action, data } = linksActionsMap[link];
|
||||||
|
api.exec(action, data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [api, linksActionsMap]);
|
}, [api, linksActionsMap, links]);
|
||||||
|
|
||||||
const deleteTask = useCallback(() => {
|
const deleteTask = useCallback(() => {
|
||||||
api.exec('delete-task', { id: taskId });
|
const id = taskId?.id || taskId;
|
||||||
}, [api, taskId]);
|
if (isSegment) {
|
||||||
|
if (activeTask?.segments) {
|
||||||
|
const segments = activeTask.segments.filter(
|
||||||
|
(s, index) => index !== segmentIndex,
|
||||||
|
);
|
||||||
|
api.exec('update-task', {
|
||||||
|
id,
|
||||||
|
task: { segments },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
api.exec('delete-task', { id });
|
||||||
|
}
|
||||||
|
}, [api, taskId, isSegment, activeTask, segmentIndex]);
|
||||||
|
|
||||||
const hide = useCallback(() => {
|
const hide = useCallback(() => {
|
||||||
api.exec('show-editor', { id: null });
|
api.exec('show-editor', { id: null });
|
||||||
}, [api]);
|
}, [api]);
|
||||||
|
|
||||||
const handleAction = useCallback((ev) => {
|
const handleAction = useCallback(
|
||||||
const { item, changes } = ev;
|
(ev) => {
|
||||||
if (item.id === 'delete') {
|
const { item, changes } = ev;
|
||||||
deleteTask();
|
if (item.id === 'delete') {
|
||||||
}
|
deleteTask();
|
||||||
if (item.id === 'save') {
|
}
|
||||||
if (!changes.length) saveLinks();
|
if (item.id === 'save') {
|
||||||
else hide();
|
if (!changes.length) saveLinks();
|
||||||
}
|
else hide();
|
||||||
if (item.comp) hide();
|
}
|
||||||
}, [api, taskId, autoSave, saveLinks, deleteTask, hide]);
|
if (item.comp) hide();
|
||||||
|
},
|
||||||
|
[api, taskId, autoSave, saveLinks, deleteTask, hide],
|
||||||
|
);
|
||||||
|
|
||||||
const normalizeTask = useCallback((t, key) => {
|
const normalizeTask = useCallback(
|
||||||
if (unscheduledTasks && t.type === 'summary') t.unscheduled = false;
|
(t, key, input) => {
|
||||||
|
if (unscheduledTasks && t.type === 'summary') t.unscheduled = false;
|
||||||
|
|
||||||
normalizeDates(t, unit, true, key);
|
prepareEditTask(t, api.getState(), key);
|
||||||
return t;
|
if (!input) setInProgress(false);
|
||||||
}, [unscheduledTasks, unit]);
|
return t;
|
||||||
|
},
|
||||||
|
[unscheduledTasks, api],
|
||||||
|
);
|
||||||
|
|
||||||
const handleChange = useCallback((ev) => {
|
const save = useCallback(
|
||||||
let { update, key, value } = ev;
|
(values) => {
|
||||||
ev.update = normalizeTask({ ...update }, key);
|
values = {
|
||||||
|
...values,
|
||||||
|
unscheduled:
|
||||||
|
unscheduledTasks && values.unscheduled && values.type !== 'summary',
|
||||||
|
};
|
||||||
|
delete values.links;
|
||||||
|
delete values.data;
|
||||||
|
|
||||||
if (!autoSave) {
|
if (
|
||||||
if (key === 'type') setTaskType(value);
|
editorKeys.indexOf('duration') === -1 ||
|
||||||
}
|
(values.segments && !values.duration)
|
||||||
}, [api, autoSave]);
|
)
|
||||||
|
delete values.duration;
|
||||||
|
|
||||||
const handleSave = useCallback((ev) => {
|
const data = {
|
||||||
let { values } = ev;
|
id: taskId?.id || taskId,
|
||||||
values = {
|
task: values,
|
||||||
...values,
|
...(isSegment && { segmentIndex }),
|
||||||
unscheduled:
|
};
|
||||||
unscheduledTasks && values.unscheduled && values.type !== 'summary',
|
if (autoSave && inProgress) data.inProgress = inProgress;
|
||||||
};
|
|
||||||
delete values.links;
|
|
||||||
delete values.data;
|
|
||||||
|
|
||||||
api.exec('update-task', {
|
api.exec('update-task', data);
|
||||||
id: taskId,
|
|
||||||
task: values,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!autoSave) saveLinks();
|
if (!autoSave) saveLinks();
|
||||||
}, [api, taskId, unscheduledTasks, autoSave, saveLinks]);
|
},
|
||||||
|
[
|
||||||
|
api,
|
||||||
|
taskId,
|
||||||
|
unscheduledTasks,
|
||||||
|
autoSave,
|
||||||
|
saveLinks,
|
||||||
|
editorKeys,
|
||||||
|
isSegment,
|
||||||
|
segmentIndex,
|
||||||
|
inProgress,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleChange = useCallback(
|
||||||
|
(ev) => {
|
||||||
|
let { update, key, input } = ev;
|
||||||
|
|
||||||
|
if (input) setInProgress(true);
|
||||||
|
|
||||||
|
ev.update = normalizeTask({ ...update }, key, input);
|
||||||
|
|
||||||
|
if (!autoSave) setEditorValues(ev.update);
|
||||||
|
else if (!editorErrors && !input) {
|
||||||
|
const item = editorItems.find((i) => i.key === key);
|
||||||
|
const v = update[key];
|
||||||
|
const isValid = !item.validation || item.validation(v);
|
||||||
|
if (isValid && (!item.required || v)) save(ev.update);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[autoSave, normalizeTask, editorErrors, editorItems, save],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleSave = useCallback(
|
||||||
|
(ev) => {
|
||||||
|
if (!autoSave) save(ev.values);
|
||||||
|
},
|
||||||
|
[autoSave, save],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleValidation = useCallback((check) => {
|
||||||
|
// get all errors after onchange action
|
||||||
|
setEditorErrors(check.errors);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const defaultHotkeys = useMemo(
|
||||||
|
() =>
|
||||||
|
undo
|
||||||
|
? {
|
||||||
|
'ctrl+z': (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
api.exec('undo');
|
||||||
|
},
|
||||||
|
'ctrl+y': (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
api.exec('redo');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
[undo, api],
|
||||||
|
);
|
||||||
|
|
||||||
return task ? (
|
return task ? (
|
||||||
<Locale>
|
<Locale>
|
||||||
@@ -293,7 +369,9 @@ function Editor({
|
|||||||
focus={focus}
|
focus={focus}
|
||||||
onAction={handleAction}
|
onAction={handleAction}
|
||||||
onSave={handleSave}
|
onSave={handleSave}
|
||||||
|
onValidation={handleValidation}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
hotkeys={hotkeys && { ...defaultHotkeys, ...hotkeys }}
|
||||||
/>
|
/>
|
||||||
</Locale>
|
</Locale>
|
||||||
) : null;
|
) : null;
|
||||||
|
|||||||
@@ -5,15 +5,27 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
useState,
|
useState,
|
||||||
|
useContext,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
// core widgets lib
|
// core widgets lib
|
||||||
import { Locale } from '@svar-ui/react-core';
|
import { context } from '@svar-ui/react-core';
|
||||||
|
|
||||||
|
// locales
|
||||||
|
import { locale as l } from '@svar-ui/lib-dom';
|
||||||
import { en } from '@svar-ui/gantt-locales';
|
import { en } from '@svar-ui/gantt-locales';
|
||||||
|
import { en as coreEn } from '@svar-ui/core-locales';
|
||||||
|
|
||||||
// stores
|
// stores
|
||||||
import { EventBusRouter } from '@svar-ui/lib-state';
|
import { EventBusRouter } from '@svar-ui/lib-state';
|
||||||
import { DataStore, defaultColumns, defaultTaskTypes } from '@svar-ui/gantt-store';
|
import {
|
||||||
|
DataStore,
|
||||||
|
defaultColumns,
|
||||||
|
defaultTaskTypes,
|
||||||
|
parseTaskDates,
|
||||||
|
normalizeZoom,
|
||||||
|
normalizeLinks,
|
||||||
|
} from '@svar-ui/gantt-store';
|
||||||
|
|
||||||
// context
|
// context
|
||||||
import StoreContext from '../context';
|
import StoreContext from '../context';
|
||||||
@@ -24,6 +36,13 @@ import { writable } from '@svar-ui/lib-react';
|
|||||||
// ui
|
// ui
|
||||||
import Layout from './Layout.jsx';
|
import Layout from './Layout.jsx';
|
||||||
|
|
||||||
|
// helpers
|
||||||
|
import {
|
||||||
|
prepareScales,
|
||||||
|
prepareFormats,
|
||||||
|
prepareColumns,
|
||||||
|
prepareZoom,
|
||||||
|
} from '../helpers/prepareConfig.js';
|
||||||
|
|
||||||
const camelize = (s) =>
|
const camelize = (s) =>
|
||||||
s
|
s
|
||||||
@@ -32,8 +51,8 @@ const camelize = (s) =>
|
|||||||
.join('');
|
.join('');
|
||||||
|
|
||||||
const defaultScales = [
|
const defaultScales = [
|
||||||
{ unit: 'month', step: 1, format: 'MMMM yyy' },
|
{ unit: 'month', step: 1, format: '%F %Y' },
|
||||||
{ unit: 'day', step: 1, format: 'd' },
|
{ unit: 'day', step: 1, format: '%j' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const Gantt = forwardRef(function Gantt(
|
const Gantt = forwardRef(function Gantt(
|
||||||
@@ -58,10 +77,17 @@ const Gantt = forwardRef(function Gantt(
|
|||||||
cellBorders = 'full',
|
cellBorders = 'full',
|
||||||
zoom = false,
|
zoom = false,
|
||||||
baselines = false,
|
baselines = false,
|
||||||
highlightTime = null,
|
highlightTime: highlightTimeProp = null,
|
||||||
init = null,
|
init = null,
|
||||||
autoScale = true,
|
autoScale = true,
|
||||||
unscheduledTasks = false,
|
unscheduledTasks = false,
|
||||||
|
criticalPath = null,
|
||||||
|
schedule = { type: 'forward' },
|
||||||
|
projectStart = null,
|
||||||
|
projectEnd = null,
|
||||||
|
calendar = null,
|
||||||
|
undo = false,
|
||||||
|
splitTasks = false,
|
||||||
...restProps
|
...restProps
|
||||||
},
|
},
|
||||||
ref,
|
ref,
|
||||||
@@ -70,9 +96,53 @@ const Gantt = forwardRef(function Gantt(
|
|||||||
const restPropsRef = useRef();
|
const restPropsRef = useRef();
|
||||||
restPropsRef.current = restProps;
|
restPropsRef.current = restProps;
|
||||||
|
|
||||||
|
|
||||||
// init stores
|
// init stores
|
||||||
const dataStore = useMemo(() => new DataStore(writable), []);
|
const dataStore = useMemo(() => new DataStore(writable), []);
|
||||||
|
|
||||||
|
// locale and formats
|
||||||
|
// uses same logic as the Locale component
|
||||||
|
const words = useMemo(() => ({ ...coreEn, ...en }), []);
|
||||||
|
const i18nCtx = useContext(context.i18n);
|
||||||
|
const locale = useMemo(() => {
|
||||||
|
if (!i18nCtx) return l(words);
|
||||||
|
return i18nCtx.extend(words, true);
|
||||||
|
}, [i18nCtx, words]);
|
||||||
|
|
||||||
|
// prepare configuration objects
|
||||||
|
const lCalendar = useMemo(() => locale.getRaw().calendar, [locale]);
|
||||||
|
|
||||||
|
const normalizedConfig = useMemo(() => {
|
||||||
|
let config = {
|
||||||
|
zoom: prepareZoom(zoom, lCalendar),
|
||||||
|
scales: prepareScales(scales, lCalendar),
|
||||||
|
columns: prepareColumns(columns, lCalendar),
|
||||||
|
links: normalizeLinks(links),
|
||||||
|
cellWidth,
|
||||||
|
};
|
||||||
|
if (config.zoom) {
|
||||||
|
config = {
|
||||||
|
...config,
|
||||||
|
...normalizeZoom(
|
||||||
|
config.zoom,
|
||||||
|
prepareFormats(lCalendar, locale.getGroup('gantt')),
|
||||||
|
config.scales,
|
||||||
|
cellWidth,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
}, [zoom, scales, columns, links, cellWidth, lCalendar, locale]);
|
||||||
|
|
||||||
|
// parse task dates effect
|
||||||
|
const parsedTasksRef = useRef(null);
|
||||||
|
if (parsedTasksRef.current !== tasks) {
|
||||||
|
parseTaskDates(tasks, { durationUnit, splitTasks, calendar });
|
||||||
|
parsedTasksRef.current = tasks;
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
parseTaskDates(tasks, { durationUnit, splitTasks, calendar });
|
||||||
|
}, [tasks, durationUnit, calendar, splitTasks]);
|
||||||
|
|
||||||
const firstInRoute = useMemo(() => dataStore.in, [dataStore]);
|
const firstInRoute = useMemo(() => dataStore.in, [dataStore]);
|
||||||
|
|
||||||
const lastInRouteRef = useRef(null);
|
const lastInRouteRef = useRef(null);
|
||||||
@@ -86,7 +156,6 @@ const Gantt = forwardRef(function Gantt(
|
|||||||
firstInRoute.setNext(lastInRouteRef.current);
|
firstInRoute.setNext(lastInRouteRef.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// writable prop for two-way binding tableAPI
|
// writable prop for two-way binding tableAPI
|
||||||
const [tableAPI, setTableAPI] = useState(null);
|
const [tableAPI, setTableAPI] = useState(null);
|
||||||
const tableAPIRef = useRef(null);
|
const tableAPIRef = useRef(null);
|
||||||
@@ -112,11 +181,11 @@ const Gantt = forwardRef(function Gantt(
|
|||||||
waitRender
|
waitRender
|
||||||
? new Promise((res) => setTimeout(() => res(tableAPIRef.current), 1))
|
? new Promise((res) => setTimeout(() => res(tableAPIRef.current), 1))
|
||||||
: tableAPIRef.current,
|
: tableAPIRef.current,
|
||||||
|
getHistory: () => dataStore.getHistory(),
|
||||||
}),
|
}),
|
||||||
[dataStore, firstInRoute],
|
[dataStore, firstInRoute],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// expose API via ref
|
// expose API via ref
|
||||||
useImperativeHandle(
|
useImperativeHandle(
|
||||||
ref,
|
ref,
|
||||||
@@ -134,17 +203,17 @@ const Gantt = forwardRef(function Gantt(
|
|||||||
// const prev = dataStore.getState();
|
// const prev = dataStore.getState();
|
||||||
dataStore.init({
|
dataStore.init({
|
||||||
tasks,
|
tasks,
|
||||||
links,
|
links: normalizedConfig.links,
|
||||||
start,
|
start,
|
||||||
columns,
|
columns: normalizedConfig.columns,
|
||||||
end,
|
end,
|
||||||
lengthUnit,
|
lengthUnit,
|
||||||
cellWidth,
|
cellWidth: normalizedConfig.cellWidth,
|
||||||
cellHeight,
|
cellHeight,
|
||||||
scaleHeight,
|
scaleHeight,
|
||||||
scales,
|
scales: normalizedConfig.scales,
|
||||||
taskTypes,
|
taskTypes,
|
||||||
zoom,
|
zoom: normalizedConfig.zoom,
|
||||||
selected,
|
selected,
|
||||||
activeTask,
|
activeTask,
|
||||||
baselines,
|
baselines,
|
||||||
@@ -152,22 +221,28 @@ const Gantt = forwardRef(function Gantt(
|
|||||||
unscheduledTasks,
|
unscheduledTasks,
|
||||||
markers,
|
markers,
|
||||||
durationUnit,
|
durationUnit,
|
||||||
|
criticalPath,
|
||||||
|
schedule,
|
||||||
|
projectStart,
|
||||||
|
projectEnd,
|
||||||
|
calendar,
|
||||||
|
undo,
|
||||||
|
_weekStart: lCalendar.weekStart,
|
||||||
|
splitTasks,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
initOnceRef.current++;
|
initOnceRef.current++;
|
||||||
}, [
|
}, [
|
||||||
|
api,
|
||||||
|
init,
|
||||||
tasks,
|
tasks,
|
||||||
links,
|
normalizedConfig,
|
||||||
start,
|
start,
|
||||||
columns,
|
|
||||||
end,
|
end,
|
||||||
lengthUnit,
|
lengthUnit,
|
||||||
cellWidth,
|
|
||||||
cellHeight,
|
cellHeight,
|
||||||
scaleHeight,
|
scaleHeight,
|
||||||
scales,
|
|
||||||
taskTypes,
|
taskTypes,
|
||||||
zoom,
|
|
||||||
selected,
|
selected,
|
||||||
activeTask,
|
activeTask,
|
||||||
baselines,
|
baselines,
|
||||||
@@ -175,22 +250,31 @@ const Gantt = forwardRef(function Gantt(
|
|||||||
unscheduledTasks,
|
unscheduledTasks,
|
||||||
markers,
|
markers,
|
||||||
durationUnit,
|
durationUnit,
|
||||||
|
criticalPath,
|
||||||
|
schedule,
|
||||||
|
projectStart,
|
||||||
|
projectEnd,
|
||||||
|
calendar,
|
||||||
|
undo,
|
||||||
|
lCalendar,
|
||||||
|
splitTasks,
|
||||||
|
dataStore,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (initOnceRef.current === 0) {
|
if (initOnceRef.current === 0) {
|
||||||
dataStore.init({
|
dataStore.init({
|
||||||
tasks,
|
tasks,
|
||||||
links,
|
links: normalizedConfig.links,
|
||||||
start,
|
start,
|
||||||
columns,
|
columns: normalizedConfig.columns,
|
||||||
end,
|
end,
|
||||||
lengthUnit,
|
lengthUnit,
|
||||||
cellWidth,
|
cellWidth: normalizedConfig.cellWidth,
|
||||||
cellHeight,
|
cellHeight,
|
||||||
scaleHeight,
|
scaleHeight,
|
||||||
scales,
|
scales: normalizedConfig.scales,
|
||||||
taskTypes,
|
taskTypes,
|
||||||
zoom,
|
zoom: normalizedConfig.zoom,
|
||||||
selected,
|
selected,
|
||||||
activeTask,
|
activeTask,
|
||||||
baselines,
|
baselines,
|
||||||
@@ -198,11 +282,31 @@ const Gantt = forwardRef(function Gantt(
|
|||||||
unscheduledTasks,
|
unscheduledTasks,
|
||||||
markers,
|
markers,
|
||||||
durationUnit,
|
durationUnit,
|
||||||
|
criticalPath,
|
||||||
|
schedule,
|
||||||
|
projectStart,
|
||||||
|
projectEnd,
|
||||||
|
calendar,
|
||||||
|
undo,
|
||||||
|
_weekStart: lCalendar.weekStart,
|
||||||
|
splitTasks,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// highlightTime from calendar
|
||||||
|
const highlightTime = useMemo(() => {
|
||||||
|
if (calendar) {
|
||||||
|
return (day, unit) => {
|
||||||
|
if (unit == 'day' && !calendar.getDayHours(day)) return 'wx-weekend';
|
||||||
|
if (unit == 'hour' && !calendar.getDayHours(day)) return 'wx-weekend';
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return highlightTimeProp;
|
||||||
|
}, [calendar, highlightTimeProp]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Locale words={en} optional={true}>
|
<context.i18n.Provider value={locale}>
|
||||||
<StoreContext.Provider value={api}>
|
<StoreContext.Provider value={api}>
|
||||||
<Layout
|
<Layout
|
||||||
taskTemplate={taskTemplate}
|
taskTemplate={taskTemplate}
|
||||||
@@ -212,7 +316,7 @@ const Gantt = forwardRef(function Gantt(
|
|||||||
onTableAPIChange={setTableAPI}
|
onTableAPIChange={setTableAPI}
|
||||||
/>
|
/>
|
||||||
</StoreContext.Provider>
|
</StoreContext.Provider>
|
||||||
</Locale>
|
</context.i18n.Provider>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
.wx-pseudo-rows.wx-jlbQoHOz {
|
.wx-pseudo-rows.wx-jlbQoHOz {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { modeObserver } from '../helpers/modeResizeObserver';
|
|||||||
import storeContext from '../context';
|
import storeContext from '../context';
|
||||||
import { useStore } from '@svar-ui/lib-react';
|
import { useStore } from '@svar-ui/lib-react';
|
||||||
import './Layout.css';
|
import './Layout.css';
|
||||||
|
import { flushSync } from 'react-dom'
|
||||||
|
|
||||||
function Layout(props) {
|
function Layout(props) {
|
||||||
const {
|
const {
|
||||||
@@ -21,20 +22,21 @@ function Layout(props) {
|
|||||||
readonly,
|
readonly,
|
||||||
cellBorders,
|
cellBorders,
|
||||||
highlightTime,
|
highlightTime,
|
||||||
onTableAPIChange
|
onTableAPIChange,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const api = useContext(storeContext);
|
const api = useContext(storeContext);
|
||||||
|
|
||||||
const rTasks = useStore(api, "_tasks");
|
const rTasks = useStore(api, '_tasks');
|
||||||
const rScales = useStore(api, "_scales");
|
const rScales = useStore(api, '_scales');
|
||||||
const rCellHeight = useStore(api, "cellHeight");
|
const rCellHeight = useStore(api, 'cellHeight');
|
||||||
const rColumns = useStore(api, "columns");
|
const rColumns = useStore(api, 'columns');
|
||||||
const rScrollTask = useStore(api, "_scrollTask");
|
const rScrollTask = useStore(api, '_scrollTask');
|
||||||
|
const undo = useStore(api, 'undo');
|
||||||
const [compactMode, setCompactMode] = useState(false);
|
const [compactMode, setCompactMode] = useState(false);
|
||||||
let [gridWidth, setGridWidth] = useState(0);
|
let [gridWidth, setGridWidth] = useState(0);
|
||||||
const [ganttWidth, setGanttWidth] = useState(undefined);
|
const [ganttWidth, setGanttWidth] = useState(0);
|
||||||
const [ganttHeight, setGanttHeight] = useState(undefined);
|
const [ganttHeight, setGanttHeight] = useState(0);
|
||||||
const [innerWidth, setInnerWidth] = useState(undefined);
|
const [innerWidth, setInnerWidth] = useState(undefined);
|
||||||
const [display, setDisplay] = useState('all');
|
const [display, setDisplay] = useState('all');
|
||||||
|
|
||||||
@@ -57,7 +59,6 @@ function Layout(props) {
|
|||||||
[display],
|
[display],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const ro = modeObserver(handleResize);
|
const ro = modeObserver(handleResize);
|
||||||
ro.observe();
|
ro.observe();
|
||||||
@@ -81,7 +82,6 @@ function Layout(props) {
|
|||||||
return w;
|
return w;
|
||||||
}, [rColumns, compactMode, display]);
|
}, [rColumns, compactMode, display]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setGridWidth(gridColumnWidth);
|
setGridWidth(gridColumnWidth);
|
||||||
}, [gridColumnWidth]);
|
}, [gridColumnWidth]);
|
||||||
@@ -125,6 +125,10 @@ function Layout(props) {
|
|||||||
};
|
};
|
||||||
}, [chartRef.current, expandScale]);
|
}, [chartRef.current, expandScale]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
expandScale();
|
||||||
|
}, [fullWidth]);
|
||||||
|
|
||||||
const ganttDivRef = useRef(null);
|
const ganttDivRef = useRef(null);
|
||||||
const pseudoRowsRef = useRef(null);
|
const pseudoRowsRef = useRef(null);
|
||||||
|
|
||||||
@@ -191,39 +195,33 @@ function Layout(props) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
scrollToTask(rScrollTask);
|
scrollToTask(rScrollTask);
|
||||||
}, [rScrollTask]);
|
}, [rScrollTask]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const el = ganttDivRef.current;
|
const ganttDiv = ganttDivRef.current;
|
||||||
if (!el) return;
|
const pseudoRows = pseudoRowsRef.current;
|
||||||
|
if (!ganttDiv || !pseudoRows) return;
|
||||||
const update = () => {
|
const update = () => {
|
||||||
setGanttHeight(el.offsetHeight);
|
flushSync(() => {
|
||||||
setGanttWidth(el.offsetWidth);
|
setGanttHeight(ganttDiv.offsetHeight);
|
||||||
|
setGanttWidth(ganttDiv.offsetWidth);
|
||||||
|
setInnerWidth(pseudoRows.offsetWidth);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
update();
|
|
||||||
const ro = new ResizeObserver(update);
|
const ro = new ResizeObserver(update);
|
||||||
ro.observe(el);
|
ro.observe(ganttDiv);
|
||||||
return () => ro.disconnect();
|
return () => ro.disconnect();
|
||||||
}, [ganttDivRef.current]);
|
}, [ganttDivRef.current]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const el = pseudoRowsRef.current;
|
|
||||||
if (!el) return;
|
|
||||||
const update = () => {
|
|
||||||
setInnerWidth(el.offsetWidth);
|
|
||||||
};
|
|
||||||
update();
|
|
||||||
const ro = new ResizeObserver(update);
|
|
||||||
ro.observe(el);
|
|
||||||
return () => ro.disconnect();
|
|
||||||
}, [pseudoRowsRef.current]);
|
|
||||||
|
|
||||||
const layoutRef = useRef(null);
|
const layoutRef = useRef(null);
|
||||||
const cleanupRef = useRef(null);
|
const cleanupRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (cleanupRef.current) return;
|
if (cleanupRef.current) {
|
||||||
|
cleanupRef.current.destroy();
|
||||||
|
cleanupRef.current = null;
|
||||||
|
}
|
||||||
const node = layoutRef.current;
|
const node = layoutRef.current;
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
@@ -234,6 +232,8 @@ function Layout(props) {
|
|||||||
'ctrl+x': true,
|
'ctrl+x': true,
|
||||||
'ctrl+d': true,
|
'ctrl+d': true,
|
||||||
backspace: true,
|
backspace: true,
|
||||||
|
'ctrl+z': undo,
|
||||||
|
'ctrl+y': undo,
|
||||||
},
|
},
|
||||||
exec: (ev) => {
|
exec: (ev) => {
|
||||||
if (!ev.isInput) api.exec('hotkey', ev);
|
if (!ev.isInput) api.exec('hotkey', ev);
|
||||||
@@ -244,7 +244,7 @@ function Layout(props) {
|
|||||||
cleanupRef.current?.destroy();
|
cleanupRef.current?.destroy();
|
||||||
cleanupRef.current = null;
|
cleanupRef.current = null;
|
||||||
};
|
};
|
||||||
}, []);
|
}, [undo]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="wx-jlbQoHOz wx-gantt" ref={ganttDivRef} onScroll={onScroll}>
|
<div className="wx-jlbQoHOz wx-gantt" ref={ganttDivRef} onScroll={onScroll}>
|
||||||
@@ -276,8 +276,7 @@ function Layout(props) {
|
|||||||
value={gridWidth}
|
value={gridWidth}
|
||||||
display={display}
|
display={display}
|
||||||
compactMode={compactMode}
|
compactMode={compactMode}
|
||||||
minValue="50"
|
containerWidth={ganttWidth}
|
||||||
maxValue="800"
|
|
||||||
onMove={(value) => setGridWidth(value)}
|
onMove={(value) => setGridWidth(value)}
|
||||||
onDisplayChange={(display) => setDisplay(display)}
|
onDisplayChange={(display) => setDisplay(display)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useState, useMemo, useRef, useCallback } from 'react';
|
import { useState, useMemo, useRef, useCallback, useEffect } from 'react';
|
||||||
import { useWritableProp } from '@svar-ui/lib-react';
|
import { useWritableProp } from '@svar-ui/lib-react';
|
||||||
import './Resizer.css';
|
import './Resizer.css';
|
||||||
|
|
||||||
@@ -7,11 +7,12 @@ function Resizer(props) {
|
|||||||
position = 'after',
|
position = 'after',
|
||||||
size = 4,
|
size = 4,
|
||||||
dir = 'x',
|
dir = 'x',
|
||||||
minValue = 0,
|
|
||||||
maxValue = 0,
|
|
||||||
onMove,
|
onMove,
|
||||||
onDisplayChange,
|
onDisplayChange,
|
||||||
compactMode,
|
compactMode,
|
||||||
|
containerWidth = 0,
|
||||||
|
leftThreshold = 50,
|
||||||
|
rightThreshold = 50,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const [value, setValue] = useWritableProp(props.value ?? 0);
|
const [value, setValue] = useWritableProp(props.value ?? 0);
|
||||||
@@ -35,24 +36,52 @@ function Resizer(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [active, setActive] = useState(false);
|
const [active, setActive] = useState(false);
|
||||||
|
const [initialPosition, setInitialPosition] = useState(null);
|
||||||
|
|
||||||
const startRef = useRef(0);
|
const startRef = useRef(0);
|
||||||
const posRef = useRef();
|
const posRef = useRef();
|
||||||
|
const timeoutRef = useRef();
|
||||||
|
const displayRef = useRef(display);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
displayRef.current = display;
|
||||||
|
}, [display]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (initialPosition === null && value > 0) {
|
||||||
|
setInitialPosition(value);
|
||||||
|
}
|
||||||
|
}, [initialPosition, value]);
|
||||||
|
|
||||||
function getEventPos(ev) {
|
function getEventPos(ev) {
|
||||||
return dir == 'x' ? ev.clientX : ev.clientY;
|
return dir == 'x' ? ev.clientX : ev.clientY;
|
||||||
}
|
}
|
||||||
|
|
||||||
const move = useCallback((ev) => {
|
const move = useCallback(
|
||||||
const newPos = posRef.current + getEventPos(ev) - startRef.current;
|
(ev) => {
|
||||||
if (
|
const newPos = posRef.current + getEventPos(ev) - startRef.current;
|
||||||
(!minValue || minValue <= newPos) &&
|
|
||||||
(!maxValue || maxValue >= newPos)
|
|
||||||
) {
|
|
||||||
setValue(newPos);
|
setValue(newPos);
|
||||||
onMove(newPos)
|
let nextDisplay;
|
||||||
}
|
|
||||||
}, []);
|
if (newPos <= leftThreshold) {
|
||||||
|
nextDisplay = 'chart';
|
||||||
|
} else if (containerWidth - newPos <= rightThreshold) {
|
||||||
|
nextDisplay = 'grid';
|
||||||
|
} else {
|
||||||
|
nextDisplay = 'all';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (displayRef.current !== nextDisplay) {
|
||||||
|
setDisplay(nextDisplay);
|
||||||
|
displayRef.current = nextDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
||||||
|
timeoutRef.current = setTimeout(() => onMove && onMove(newPos), 100);
|
||||||
|
},
|
||||||
|
[containerWidth, leftThreshold, rightThreshold, onMove],
|
||||||
|
);
|
||||||
|
|
||||||
const up = useCallback(() => {
|
const up = useCallback(() => {
|
||||||
document.body.style.cursor = '';
|
document.body.style.cursor = '';
|
||||||
@@ -69,6 +98,11 @@ function Resizer(props) {
|
|||||||
|
|
||||||
const down = useCallback(
|
const down = useCallback(
|
||||||
(ev) => {
|
(ev) => {
|
||||||
|
// Prevent dragging when in normal mode and only one view is visible
|
||||||
|
if (!compactMode && (display === 'grid' || display === 'chart')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
startRef.current = getEventPos(ev);
|
startRef.current = getEventPos(ev);
|
||||||
|
|
||||||
posRef.current = value;
|
posRef.current = value;
|
||||||
@@ -80,29 +114,40 @@ function Resizer(props) {
|
|||||||
window.addEventListener('mousemove', move);
|
window.addEventListener('mousemove', move);
|
||||||
window.addEventListener('mouseup', up);
|
window.addEventListener('mouseup', up);
|
||||||
},
|
},
|
||||||
[cursor, move, up, value],
|
[cursor, move, up, value, compactMode, display],
|
||||||
);
|
);
|
||||||
|
|
||||||
function handleExpandLeft() {
|
function resetToInitial() {
|
||||||
let newDisplay;
|
setDisplay('all');
|
||||||
if (compactMode) {
|
if (initialPosition !== null) {
|
||||||
newDisplay = display === 'chart' ? 'grid' : 'chart';
|
setValue(initialPosition);
|
||||||
} else {
|
if (onMove) onMove(initialPosition);
|
||||||
newDisplay = display === 'all' ? 'chart' : 'all';
|
|
||||||
}
|
}
|
||||||
setDisplay(newDisplay);
|
}
|
||||||
onDisplayChange(newDisplay);
|
|
||||||
|
function handleExpand(direction) {
|
||||||
|
if (compactMode) {
|
||||||
|
const newDisplay = display === 'chart' ? 'grid' : 'chart';
|
||||||
|
setDisplay(newDisplay);
|
||||||
|
onDisplayChange(newDisplay);
|
||||||
|
} else {
|
||||||
|
if (display === 'grid' || display === 'chart') {
|
||||||
|
resetToInitial();
|
||||||
|
onDisplayChange('all');
|
||||||
|
} else {
|
||||||
|
const newDisplay = direction === 'left' ? 'chart' : 'grid';
|
||||||
|
setDisplay(newDisplay);
|
||||||
|
onDisplayChange(newDisplay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleExpandLeft() {
|
||||||
|
handleExpand('left');
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleExpandRight() {
|
function handleExpandRight() {
|
||||||
let newDisplay;
|
handleExpand('right');
|
||||||
if (compactMode) {
|
|
||||||
newDisplay = display === 'grid' ? 'chart' : 'grid';
|
|
||||||
} else {
|
|
||||||
newDisplay = display === 'all' ? 'grid' : 'all';
|
|
||||||
}
|
|
||||||
setDisplay(newDisplay);
|
|
||||||
onDisplayChange(newDisplay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const b = useMemo(() => getBox(value), [value, position, size, dir]);
|
const b = useMemo(() => getBox(value), [value, position, size, dir]);
|
||||||
@@ -122,25 +167,21 @@ function Resizer(props) {
|
|||||||
onMouseDown={down}
|
onMouseDown={down}
|
||||||
style={{ width: b.size[0], height: b.size[1], cursor }}
|
style={{ width: b.size[0], height: b.size[1], cursor }}
|
||||||
>
|
>
|
||||||
<div className='wx-pFykzMlT wx-button-expand-box'>
|
<div className="wx-pFykzMlT wx-button-expand-box">
|
||||||
<div
|
<div className="wx-pFykzMlT wx-button-expand-content wx-button-expand-left">
|
||||||
className='wx-pFykzMlT wx-button-expand-content wx-button-expand-left'
|
|
||||||
>
|
|
||||||
<i
|
<i
|
||||||
className='wx-pFykzMlT wxi-menu-left'
|
className="wx-pFykzMlT wxi-menu-left"
|
||||||
onClick={handleExpandLeft}
|
onClick={handleExpandLeft}
|
||||||
></i>
|
></i>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div className="wx-pFykzMlT wx-button-expand-content wx-button-expand-right">
|
||||||
className='wx-pFykzMlT wx-button-expand-content wx-button-expand-right'
|
|
||||||
>
|
|
||||||
<i
|
<i
|
||||||
className='wx-pFykzMlT wxi-menu-right'
|
className="wx-pFykzMlT wxi-menu-right"
|
||||||
onClick={handleExpandRight}
|
onClick={handleExpandRight}
|
||||||
></i>
|
></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='wx-pFykzMlT wx-resizer-line'></div>
|
<div className="wx-pFykzMlT wx-resizer-line"></div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,50 +3,76 @@ import { Toolbar as WxToolbar } from '@svar-ui/react-toolbar';
|
|||||||
import { useStoreLater } from '@svar-ui/lib-react';
|
import { useStoreLater } from '@svar-ui/lib-react';
|
||||||
import {
|
import {
|
||||||
handleAction,
|
handleAction,
|
||||||
defaultToolbarButtons,
|
getToolbarButtons,
|
||||||
isHandledAction,
|
isHandledAction,
|
||||||
} from '@svar-ui/gantt-store';
|
} from '@svar-ui/gantt-store';
|
||||||
import { locale } from '@svar-ui/lib-dom';
|
import { locale } from '@svar-ui/lib-dom';
|
||||||
import { en } from '@svar-ui/gantt-locales';
|
import { en } from '@svar-ui/gantt-locales';
|
||||||
import { context } from '@svar-ui/react-core';
|
import { context } from '@svar-ui/react-core';
|
||||||
|
|
||||||
export default function Toolbar({
|
export default function Toolbar({ api = null, items = [] }) {
|
||||||
api = null,
|
|
||||||
items = [...defaultToolbarButtons],
|
|
||||||
}) {
|
|
||||||
const i18nCtx = useContext(context.i18n);
|
const i18nCtx = useContext(context.i18n);
|
||||||
const i18nLocal = useMemo(() => (i18nCtx ? i18nCtx : locale(en)), [i18nCtx]);
|
const i18nLocal = useMemo(() => (i18nCtx ? i18nCtx : locale(en)), [i18nCtx]);
|
||||||
const _ = useMemo(() => i18nLocal.getGroup('gantt'), [i18nLocal]);
|
const _ = useMemo(() => i18nLocal.getGroup('gantt'), [i18nLocal]);
|
||||||
|
|
||||||
const rSelected = useStoreLater(api, "_selected");
|
const _selected = useStoreLater(api, '_selected');
|
||||||
const rTasks = useStoreLater(api, "_tasks");
|
const undo = useStoreLater(api, 'undo');
|
||||||
|
const history = useStoreLater(api, 'history');
|
||||||
|
const splitTasks = useStoreLater(api, 'splitTasks');
|
||||||
|
|
||||||
|
const historyActions = ['undo', 'redo'];
|
||||||
|
|
||||||
const finalItems = useMemo(() => {
|
const finalItems = useMemo(() => {
|
||||||
return items.map((b) => {
|
const fullButtons = getToolbarButtons({ undo: true, splitTasks: true });
|
||||||
|
const buttons = items.length
|
||||||
|
? items
|
||||||
|
: getToolbarButtons({
|
||||||
|
undo,
|
||||||
|
splitTasks,
|
||||||
|
});
|
||||||
|
return buttons.map((b) => {
|
||||||
let item = { ...b, disabled: false };
|
let item = { ...b, disabled: false };
|
||||||
item.handler = isHandledAction(defaultToolbarButtons, item.id)
|
item.handler = isHandledAction(fullButtons, item.id)
|
||||||
? (it) => handleAction(api, it.id, null, _)
|
? (it) => handleAction(api, it.id, null, _)
|
||||||
: item.handler;
|
: item.handler;
|
||||||
if (item.text) item.text = _(item.text);
|
if (item.text) item.text = _(item.text);
|
||||||
if (item.menuText) item.menuText = _(item.menuText);
|
if (item.menuText) item.menuText = _(item.menuText);
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
}, [items, api, _]);
|
}, [items, api, _, undo, splitTasks]);
|
||||||
|
|
||||||
const buttons = useMemo(() => {
|
const buttons = useMemo(() => {
|
||||||
if (api) {
|
const finalButtons = [];
|
||||||
if (rSelected?.length) {
|
finalItems.forEach((item) => {
|
||||||
return finalItems.map((item) => {
|
const action = item.id;
|
||||||
if (!item.check) return item;
|
if (action === 'add-task') {
|
||||||
const isDisabled = rSelected.some(
|
finalButtons.push(item);
|
||||||
(task) => !item.check(task, rTasks),
|
} else if (!historyActions.includes(action)) {
|
||||||
);
|
if (!_selected?.length || !api) return;
|
||||||
return { ...item, disabled: isDisabled };
|
finalButtons.push({
|
||||||
|
...item,
|
||||||
|
disabled:
|
||||||
|
item.isDisabled &&
|
||||||
|
_selected.some((task) => item.isDisabled(task, api.getState())),
|
||||||
|
});
|
||||||
|
} else if (historyActions.includes(action)) {
|
||||||
|
finalButtons.push({
|
||||||
|
...item,
|
||||||
|
disabled: item.isDisabled(history),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return [{ ...finalItems[0], disabled: false }];
|
// filter out consecutive separators
|
||||||
}, [api, rSelected, rTasks, finalItems]);
|
return finalButtons.filter((button, index) => {
|
||||||
|
if (api && button.isHidden)
|
||||||
|
return !_selected.some((task) => button.isHidden(task, api.getState()));
|
||||||
|
if (button.comp === 'separator') {
|
||||||
|
const nextButton = finalButtons[index + 1];
|
||||||
|
if (!nextButton || nextButton.comp === 'separator') return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}, [api, _selected, history, finalItems]);
|
||||||
|
|
||||||
if (!i18nCtx) {
|
if (!i18nCtx) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
22
src/components/chart/BarSegments.css
Normal file
22
src/components/chart/BarSegments.css
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
.wx-segments.wx-GKbcLEGA {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.wx-segment.wx-GKbcLEGA {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.wx-segments.wx-GKbcLEGA::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 0;
|
||||||
|
border-top: 1px dashed #7f7f7f;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-progress-percent.wx-GKbcLEGA {
|
||||||
|
background-color: var(--wx-gantt-task-fill-color);
|
||||||
|
}
|
||||||
60
src/components/chart/BarSegments.jsx
Normal file
60
src/components/chart/BarSegments.jsx
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
import './BarSegments.css';
|
||||||
|
|
||||||
|
function BarSegments(props) {
|
||||||
|
const { task, type } = props;
|
||||||
|
|
||||||
|
function segmentStyle(i) {
|
||||||
|
const s = task.segments[i];
|
||||||
|
return {
|
||||||
|
left: `${s.$x}px`,
|
||||||
|
top: '0px',
|
||||||
|
width: `${s.$w}px`,
|
||||||
|
height: '100%',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSegProgress(segmentIndex) {
|
||||||
|
if (!task.progress) return 0;
|
||||||
|
|
||||||
|
const progress = (task.duration * task.progress) / 100;
|
||||||
|
const segments = task.segments;
|
||||||
|
let duration = 0,
|
||||||
|
i = 0,
|
||||||
|
result = null;
|
||||||
|
do {
|
||||||
|
const s = segments[i];
|
||||||
|
if (i === segmentIndex) {
|
||||||
|
if (duration > progress) result = 0;
|
||||||
|
else result = Math.min((progress - duration) / s.duration, 1) * 100;
|
||||||
|
}
|
||||||
|
duration += s.duration;
|
||||||
|
i++;
|
||||||
|
} while (result === null && i < segments.length);
|
||||||
|
return result || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="wx-segments wx-GKbcLEGA">
|
||||||
|
{task.segments.map((seg, i) => (
|
||||||
|
<div
|
||||||
|
key={i}
|
||||||
|
className={`wx-segment wx-bar wx-${type} wx-GKbcLEGA`}
|
||||||
|
data-segment={i}
|
||||||
|
style={segmentStyle(i)}
|
||||||
|
>
|
||||||
|
{task.progress ? (
|
||||||
|
<div className="wx-progress-wrapper">
|
||||||
|
<div
|
||||||
|
className="wx-progress-percent wx-GKbcLEGA"
|
||||||
|
style={{ width: `${getSegProgress(i)}%` }}
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
<div className="wx-content">{seg.text || ''}</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BarSegments;
|
||||||
@@ -17,7 +17,9 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-bar.wx-GKbcLEGA {
|
.wx-bar.wx-GKbcLEGA,
|
||||||
|
.wx-bar.wx-GKbcLEGA .wx-segment {
|
||||||
|
pointer-events: all;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border-radius: var(--wx-gantt-bar-border-radius);
|
border-radius: var(--wx-gantt-bar-border-radius);
|
||||||
@@ -37,22 +39,24 @@
|
|||||||
.wx-bar.wx-reorder-task.wx-GKbcLEGA {
|
.wx-bar.wx-reorder-task.wx-GKbcLEGA {
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
.wx-content.wx-GKbcLEGA {
|
.wx-bar.wx-GKbcLEGA .wx-content {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
.wx-task.wx-GKbcLEGA {
|
.wx-task:not(.wx-split).wx-GKbcLEGA,
|
||||||
|
.wx-task.wx-GKbcLEGA .wx-segment {
|
||||||
color: var(--wx-gantt-task-font-color);
|
color: var(--wx-gantt-task-font-color);
|
||||||
background-color: var(--wx-gantt-task-color);
|
background-color: var(--wx-gantt-task-color);
|
||||||
border: var(--wx-gantt-task-border);
|
border: var(--wx-gantt-task-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-task.wx-selected.wx-GKbcLEGA {
|
.wx-task.wx-selected:not(.wx-split).wx-GKbcLEGA {
|
||||||
border: 1px solid var(--wx-gantt-task-border-color);
|
border: 1px solid var(--wx-gantt-task-border-color);
|
||||||
box-shadow: var(--wx-gantt-bar-shadow);
|
box-shadow: var(--wx-gantt-bar-shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-task:hover.wx-GKbcLEGA {
|
.wx-task:not(.wx-split):hover.wx-GKbcLEGA,
|
||||||
|
.wx-task.wx-GKbcLEGA .wx-segment:hover {
|
||||||
box-shadow: var(--wx-gantt-bar-shadow);
|
box-shadow: var(--wx-gantt-bar-shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +75,7 @@
|
|||||||
box-shadow: var(--wx-gantt-bar-shadow);
|
box-shadow: var(--wx-gantt-bar-shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-milestone .wx-content.wx-GKbcLEGA {
|
.wx-milestone.wx-GKbcLEGA .wx-content {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -80,7 +84,7 @@
|
|||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-bar:not(.wx-milestone) .wx-content.wx-GKbcLEGA {
|
.wx-bar:not(.wx-milestone).wx-GKbcLEGA .wx-content {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
@@ -97,19 +101,19 @@
|
|||||||
border-color: var(--wx-gantt-milestone-color);
|
border-color: var(--wx-gantt-milestone-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-milestone .wx-text-out.wx-GKbcLEGA {
|
.wx-milestone.wx-GKbcLEGA .wx-text-out {
|
||||||
padding: 0 2px;
|
padding: 0 2px;
|
||||||
left: 100%;
|
left: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-milestone .wx-content.wx-GKbcLEGA {
|
.wx-milestone.wx-GKbcLEGA .wx-content {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: var(--wx-gantt-milestone-color);
|
background-color: var(--wx-gantt-milestone-color);
|
||||||
transform: rotate(45deg) scale(0.75);
|
transform: rotate(45deg) scale(0.75);
|
||||||
border-radius: var(--wx-gantt-milestone-border-radius);
|
border-radius: var(--wx-gantt-milestone-border-radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-progress-wrapper.wx-GKbcLEGA {
|
.wx-bar.wx-GKbcLEGA .wx-progress-wrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -118,7 +122,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-progress-percent.wx-GKbcLEGA {
|
.wx-bar.wx-GKbcLEGA .wx-progress-percent {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,14 +194,28 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wx-bar.wx-GKbcLEGA button.wx-button.wx-delete-button {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 4;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.wx-delete-button-icon {
|
||||||
|
display: block;
|
||||||
|
line-height: 14px;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
.wx-bar.wx-GKbcLEGA .wx-delete-button.wx-left,
|
||||||
.wx-link.wx-left.wx-GKbcLEGA {
|
.wx-link.wx-left.wx-GKbcLEGA {
|
||||||
left: -16px;
|
left: -16px;
|
||||||
}
|
}
|
||||||
|
.wx-bar.wx-GKbcLEGA .wx-delete-button.wx-right,
|
||||||
.wx-link.wx-right.wx-GKbcLEGA {
|
.wx-link.wx-right.wx-GKbcLEGA {
|
||||||
right: -16px;
|
right: -16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-link.wx-target:hover.wx-GKbcLEGA,
|
.wx-link.wx-target:hover.wx-GKbcLEGA,
|
||||||
.wx-link.wx-selected.wx-GKbcLEGA,
|
.wx-link.wx-selected.wx-GKbcLEGA,
|
||||||
.wx-bar:hover .wx-link.wx-target.wx-GKbcLEGA,
|
.wx-bar:hover .wx-link.wx-target.wx-GKbcLEGA,
|
||||||
@@ -206,11 +224,10 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wx-link.wx-selected.wx-GKbcLEGA {
|
.wx-bar:not(.wx-split).wx-GKbcLEGA .wx-link.wx-selected {
|
||||||
border-color: inherit;
|
border-color: inherit;
|
||||||
}
|
}
|
||||||
|
.wx-bar:not(.wx-split).wx-GKbcLEGA .wx-link.wx-selected .wx-inner {
|
||||||
.wx-link.wx-selected .wx-inner.wx-GKbcLEGA {
|
|
||||||
border-color: inherit;
|
border-color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,3 +252,55 @@
|
|||||||
outline: 1px solid var(--wx-color-primary);
|
outline: 1px solid var(--wx-color-primary);
|
||||||
outline-offset: 1.6px;
|
outline-offset: 1.6px;
|
||||||
}
|
}
|
||||||
|
/* critical path markers */
|
||||||
|
.wx-task.wx-critical.wx-GKbcLEGA {
|
||||||
|
background-color: var(--wx-gantt-task-critical-color);
|
||||||
|
}
|
||||||
|
.wx-task.wx-critical.wx-selected.wx-GKbcLEGA {
|
||||||
|
border: 1px solid var(--wx-gantt-task-critical-color);
|
||||||
|
}
|
||||||
|
.wx-task.wx-critical .wx-progress-percent {
|
||||||
|
background-color: var(--wx-gantt-task-critical-fill-color);
|
||||||
|
}
|
||||||
|
.wx-milestone.wx-critical.wx-GKbcLEGA .wx-content {
|
||||||
|
background-color: var(--wx-gantt-critical-color);
|
||||||
|
}
|
||||||
|
.wx-milestone.wx-critical.wx-GKbcLEGA {
|
||||||
|
border-color: var(--wx-gantt-critical-color);
|
||||||
|
}
|
||||||
|
.wx-summary.wx-critical.wx-GKbcLEGA {
|
||||||
|
background-color: var(--wx-gantt-summary-critical-color);
|
||||||
|
}
|
||||||
|
.wx-summary.wx-critical .wx-progress-percent {
|
||||||
|
background-color: var(--wx-gantt-summary-critical-fill-color);
|
||||||
|
}
|
||||||
|
.wx-summary.wx-critical.wx-selected.wx-GKbcLEGA {
|
||||||
|
border: 1px solid var(--wx-gantt-summary-critical-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*split tasks*/
|
||||||
|
.wx-split.wx-selected.wx-GKbcLEGA {
|
||||||
|
border-color: var(--wx-gantt-task-border-color);
|
||||||
|
}
|
||||||
|
.wx-bars.wx-GKbcLEGA .wx-split.wx-bar {
|
||||||
|
background: transparent;
|
||||||
|
border-color: transparent;
|
||||||
|
}
|
||||||
|
.wx-split.wx-GKbcLEGA .wx-link.wx-selected,
|
||||||
|
.wx-split.wx-GKbcLEGA .wx-link.wx-selected .wx-inner {
|
||||||
|
border-color: var(--wx-gantt-task-border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-critical.wx-GKbcLEGA .wx-segment {
|
||||||
|
background-color: var(--wx-gantt-task-critical-color);
|
||||||
|
}
|
||||||
|
.wx-critical.wx-selected.wx-GKbcLEGA .wx-segment {
|
||||||
|
border: 1px solid var(--wx-gantt-task-critical-color);
|
||||||
|
}
|
||||||
|
.wx-critical.wx-GKbcLEGA .wx-segment .wx-progress-percent {
|
||||||
|
background-color: var(--wx-gantt-task-critical-fill-color);
|
||||||
|
}
|
||||||
|
.wx-critical.wx-split.wx-GKbcLEGA .wx-link.wx-selected,
|
||||||
|
.wx-critical.wx-split.wx-GKbcLEGA .wx-link.wx-selected .wx-inner {
|
||||||
|
border-color: var(--wx-gantt-task-critical-color);
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ import { locate, locateID } from '@svar-ui/lib-dom';
|
|||||||
import { getID } from '../../helpers/locate';
|
import { getID } from '../../helpers/locate';
|
||||||
import storeContext from '../../context';
|
import storeContext from '../../context';
|
||||||
import { useStore, useStoreWithCounter } from '@svar-ui/lib-react';
|
import { useStore, useStoreWithCounter } from '@svar-ui/lib-react';
|
||||||
|
import { isSegmentMoveAllowed, extendDragOptions } from '@svar-ui/gantt-store';
|
||||||
|
import { Button } from '@svar-ui/react-core';
|
||||||
|
import Links from './Links.jsx';
|
||||||
|
import BarSegments from './BarSegments.jsx';
|
||||||
import './Bars.css';
|
import './Bars.css';
|
||||||
|
|
||||||
function Bars(props) {
|
function Bars(props) {
|
||||||
@@ -18,14 +22,18 @@ function Bars(props) {
|
|||||||
|
|
||||||
const api = useContext(storeContext);
|
const api = useContext(storeContext);
|
||||||
|
|
||||||
const [rTasksValue, rTasksCounter] = useStoreWithCounter(api, "_tasks");
|
const [rTasksValue, rTasksCounter] = useStoreWithCounter(api, '_tasks');
|
||||||
const [rLinksValue, rLinksCounter] = useStoreWithCounter(api, "_links");
|
const [rLinksValue, rLinksCounter] = useStoreWithCounter(api, '_links');
|
||||||
const areaValue = useStore(api, "area");
|
const areaValue = useStore(api, 'area');
|
||||||
const scalesValue = useStore(api, "_scales");
|
const scalesValue = useStore(api, '_scales');
|
||||||
const taskTypesValue = useStore(api, "taskTypes");
|
const taskTypesValue = useStore(api, 'taskTypes');
|
||||||
const baselinesValue = useStore(api, "baselines");
|
const baselinesValue = useStore(api, 'baselines');
|
||||||
const selectedValue = useStore(api, "_selected");
|
const selectedValue = useStore(api, '_selected');
|
||||||
const scrollTaskStore = useStore(api, "_scrollTask");
|
const scrollTaskStore = useStore(api, '_scrollTask');
|
||||||
|
const criticalPath = useStore(api, 'criticalPath');
|
||||||
|
const tree = useStore(api, 'tasks');
|
||||||
|
const schedule = useStore(api, 'schedule');
|
||||||
|
const splitTasks = useStore(api, 'splitTasks');
|
||||||
|
|
||||||
const tasks = useMemo(() => {
|
const tasks = useMemo(() => {
|
||||||
if (!areaValue || !Array.isArray(rTasksValue)) return [];
|
if (!areaValue || !Array.isArray(rTasksValue)) return [];
|
||||||
@@ -45,6 +53,8 @@ function Bars(props) {
|
|||||||
const [taskMove, setTaskMove] = useState(null);
|
const [taskMove, setTaskMove] = useState(null);
|
||||||
const progressFromRef = useRef(null);
|
const progressFromRef = useRef(null);
|
||||||
|
|
||||||
|
const [selectedLink, setSelectedLink] = useState(null);
|
||||||
|
|
||||||
const [touched, setTouched] = useState(undefined);
|
const [touched, setTouched] = useState(undefined);
|
||||||
const touchTimerRef = useRef(null);
|
const touchTimerRef = useRef(null);
|
||||||
|
|
||||||
@@ -66,8 +76,7 @@ function Bars(props) {
|
|||||||
}, [hasFocus, selectedValue]);
|
}, [hasFocus, selectedValue]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!scrollTaskStore)
|
if (!scrollTaskStore) return;
|
||||||
return;
|
|
||||||
if (hasFocus && scrollTaskStore) {
|
if (hasFocus && scrollTaskStore) {
|
||||||
const { id } = scrollTaskStore;
|
const { id } = scrollTaskStore;
|
||||||
const node = containerRef.current?.querySelector(
|
const node = containerRef.current?.querySelector(
|
||||||
@@ -102,13 +111,16 @@ function Bars(props) {
|
|||||||
|
|
||||||
const getMoveMode = useCallback(
|
const getMoveMode = useCallback(
|
||||||
(node, e, task) => {
|
(node, e, task) => {
|
||||||
|
if (e.target.classList.contains('wx-line')) return '';
|
||||||
if (!task) task = api.getTask(getID(node));
|
if (!task) task = api.getTask(getID(node));
|
||||||
if (task.type === 'milestone' || task.type == 'summary') return '';
|
if (task.type === 'milestone' || task.type === 'summary') return '';
|
||||||
|
|
||||||
const rect = node.getBoundingClientRect();
|
const segmentNode = locate(e, 'data-segment');
|
||||||
const p = (e.clientX - rect.left) / rect.width;
|
if (segmentNode) node = segmentNode;
|
||||||
let delta = 0.2 / (rect.width > 200 ? rect.width / 200 : 1);
|
|
||||||
|
|
||||||
|
const { left, width } = node.getBoundingClientRect();
|
||||||
|
const p = (e.clientX - left) / width;
|
||||||
|
let delta = 0.2 / (width > 200 ? width / 200 : 1);
|
||||||
if (p < delta) return 'start';
|
if (p < delta) return 'start';
|
||||||
if (p > 1 - delta) return 'end';
|
if (p > 1 - delta) return 'end';
|
||||||
return '';
|
return '';
|
||||||
@@ -122,7 +134,7 @@ function Bars(props) {
|
|||||||
const id = getID(node);
|
const id = getID(node);
|
||||||
const task = api.getTask(id);
|
const task = api.getTask(id);
|
||||||
const css = point.target.classList;
|
const css = point.target.classList;
|
||||||
|
if (point.target.closest('.wx-delete-button')) return;
|
||||||
if (!readonly) {
|
if (!readonly) {
|
||||||
if (css.contains('wx-progress-marker')) {
|
if (css.contains('wx-progress-marker')) {
|
||||||
const { progress } = api.getTask(id);
|
const { progress } = api.getTask(id);
|
||||||
@@ -138,19 +150,29 @@ function Bars(props) {
|
|||||||
} else {
|
} else {
|
||||||
const mode = getMoveMode(node, point, task) || 'move';
|
const mode = getMoveMode(node, point, task) || 'move';
|
||||||
|
|
||||||
setTaskMove({
|
const newTaskMove = {
|
||||||
id,
|
id,
|
||||||
mode,
|
mode,
|
||||||
x: clientX,
|
x: clientX,
|
||||||
dx: 0,
|
dx: 0,
|
||||||
l: task.$x,
|
l: task.$x,
|
||||||
w: task.$w,
|
w: task.$w,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (splitTasks && task.segments?.length) {
|
||||||
|
const segNode = locate(point, 'data-segment');
|
||||||
|
if (segNode) {
|
||||||
|
newTaskMove.segmentIndex = segNode.dataset['segment'] * 1;
|
||||||
|
extendDragOptions(task, newTaskMove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setTaskMove(newTaskMove);
|
||||||
}
|
}
|
||||||
startDrag();
|
startDrag();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[api, readonly, getMoveMode, startDrag],
|
[api, readonly, getMoveMode, startDrag, splitTasks],
|
||||||
);
|
);
|
||||||
|
|
||||||
const mousedown = useCallback(
|
const mousedown = useCallback(
|
||||||
@@ -162,7 +184,7 @@ function Bars(props) {
|
|||||||
|
|
||||||
down(node, e);
|
down(node, e);
|
||||||
},
|
},
|
||||||
[readonly, lengthUnitWidth, totalWidth, taskMove, linkFrom],
|
[down],
|
||||||
);
|
);
|
||||||
|
|
||||||
const touchstart = useCallback(
|
const touchstart = useCallback(
|
||||||
@@ -175,22 +197,32 @@ function Bars(props) {
|
|||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[readonly],
|
[down],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const onSelectLink = useCallback(
|
||||||
|
(id) => {
|
||||||
|
setSelectedLink(id && { ...rLinksValue.find((link) => link.id === id) });
|
||||||
|
},
|
||||||
|
[rLinksValue],
|
||||||
|
);
|
||||||
|
|
||||||
const up = useCallback(() => {
|
const up = useCallback(() => {
|
||||||
if (progressFromRef.current) {
|
if (progressFromRef.current) {
|
||||||
const { dx, id, marker, value } = progressFromRef.current;
|
const { dx, id, marker, value } = progressFromRef.current;
|
||||||
progressFromRef.current = null;
|
progressFromRef.current = null;
|
||||||
if (typeof value != 'undefined' && dx)
|
if (typeof value != 'undefined' && dx)
|
||||||
api.exec('update-task', { id, task: { progress: value } });
|
api.exec('update-task', {
|
||||||
|
id,
|
||||||
|
task: { progress: value },
|
||||||
|
inProgress: false,
|
||||||
|
});
|
||||||
marker.classList.remove('wx-progress-in-drag');
|
marker.classList.remove('wx-progress-in-drag');
|
||||||
|
|
||||||
ignoreNextClickRef.current = true;
|
ignoreNextClickRef.current = true;
|
||||||
endDrag();
|
endDrag();
|
||||||
} else if (taskMove) {
|
} else if (taskMove) {
|
||||||
const { id, mode, dx, l, w, start } = taskMove;
|
const { id, mode, dx, l, w, start, segment, index } = taskMove;
|
||||||
setTaskMove(null);
|
setTaskMove(null);
|
||||||
if (start) {
|
if (start) {
|
||||||
const diff = Math.round(dx / lengthUnitWidth);
|
const diff = Math.round(dx / lengthUnitWidth);
|
||||||
@@ -201,19 +233,23 @@ function Bars(props) {
|
|||||||
width: w,
|
width: w,
|
||||||
left: l,
|
left: l,
|
||||||
inProgress: false,
|
inProgress: false,
|
||||||
|
...(segment && { segmentIndex: index }),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let update = {};
|
let update = {};
|
||||||
let task = api.getTask(id);
|
let task = api.getTask(id);
|
||||||
if (mode == 'move') {
|
if (segment) task = task.segments[index];
|
||||||
|
|
||||||
|
if (mode === 'move') {
|
||||||
update.start = task.start;
|
update.start = task.start;
|
||||||
update.end = task.end;
|
update.end = task.end;
|
||||||
} else update[mode] = task[mode];
|
} else update[mode] = task[mode];
|
||||||
|
|
||||||
api.exec('update-task', {
|
api.exec('update-task', {
|
||||||
id,
|
id,
|
||||||
task: update,
|
|
||||||
diff,
|
diff,
|
||||||
|
task: update,
|
||||||
|
...(segment && { segmentIndex: index }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ignoreNextClickRef.current = true;
|
ignoreNextClickRef.current = true;
|
||||||
@@ -245,14 +281,18 @@ function Bars(props) {
|
|||||||
inProgress: true,
|
inProgress: true,
|
||||||
});
|
});
|
||||||
} else if (taskMove) {
|
} else if (taskMove) {
|
||||||
const { mode, l, w, x, id, start } = taskMove;
|
onSelectLink(null);
|
||||||
|
const { mode, l, w, x, id, start, segment, index } = taskMove;
|
||||||
|
const task = api.getTask(id);
|
||||||
const dx = clientX - x;
|
const dx = clientX - x;
|
||||||
if (
|
if (
|
||||||
(!start && Math.abs(dx) < 20) ||
|
(!start && Math.abs(dx) < 20) ||
|
||||||
(mode === 'start' && w - dx < lengthUnitWidth) ||
|
(mode === 'start' && w - dx < lengthUnitWidth) ||
|
||||||
(mode === 'end' && w + dx < lengthUnitWidth) ||
|
(mode === 'end' && w + dx < lengthUnitWidth) ||
|
||||||
(mode == 'move' &&
|
(mode === 'move' &&
|
||||||
((dx < 0 && l + dx < 0) || (dx > 0 && l + w + dx > totalWidth)))
|
((dx < 0 && l + dx < 0) ||
|
||||||
|
(dx > 0 && l + w + dx > totalWidth))) ||
|
||||||
|
(taskMove.segment && !isSegmentMoveAllowed(task, taskMove))
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -270,20 +310,18 @@ function Bars(props) {
|
|||||||
width = w;
|
width = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
let ev = {
|
api.exec('drag-task', {
|
||||||
id,
|
id,
|
||||||
width: width,
|
width: width,
|
||||||
left: left,
|
left: left,
|
||||||
inProgress: true,
|
inProgress: true,
|
||||||
};
|
...(segment && { segmentIndex: index }),
|
||||||
|
});
|
||||||
|
|
||||||
api.exec('drag-task', ev);
|
|
||||||
|
|
||||||
const task = api.getTask(id);
|
|
||||||
if (
|
if (
|
||||||
!nextTaskMove.start &&
|
!nextTaskMove.start &&
|
||||||
((mode == 'move' && task.$x == l) ||
|
((mode === 'move' && task.$x == l) ||
|
||||||
(mode != 'move' && task.$w == w))
|
(mode !== 'move' && task.$w == w))
|
||||||
) {
|
) {
|
||||||
ignoreNextClickRef.current = true;
|
ignoreNextClickRef.current = true;
|
||||||
up();
|
up();
|
||||||
@@ -292,15 +330,27 @@ function Bars(props) {
|
|||||||
nextTaskMove.start = true;
|
nextTaskMove.start = true;
|
||||||
setTaskMove(nextTaskMove);
|
setTaskMove(nextTaskMove);
|
||||||
} else {
|
} else {
|
||||||
const mnode = locate(e);
|
const taskNode = locate(e);
|
||||||
if (mnode) {
|
if (taskNode) {
|
||||||
const mode = getMoveMode(mnode, point);
|
const task = api.getTask(getID(taskNode));
|
||||||
mnode.style.cursor = mode && !readonly ? 'col-resize' : 'pointer';
|
const segNode = locate(e, 'data-segment');
|
||||||
|
const barNode = segNode || taskNode;
|
||||||
|
const mode = getMoveMode(barNode, point, task);
|
||||||
|
barNode.style.cursor = mode && !readonly ? 'col-resize' : 'pointer';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[api, readonly, taskMove, lengthUnitWidth, totalWidth, getMoveMode],
|
[
|
||||||
|
api,
|
||||||
|
readonly,
|
||||||
|
taskMove,
|
||||||
|
lengthUnitWidth,
|
||||||
|
totalWidth,
|
||||||
|
getMoveMode,
|
||||||
|
onSelectLink,
|
||||||
|
up,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
const mousemove = useCallback(
|
const mousemove = useCallback(
|
||||||
@@ -347,21 +397,22 @@ function Bars(props) {
|
|||||||
(e) => {
|
(e) => {
|
||||||
if (!readonly) {
|
if (!readonly) {
|
||||||
const id = locateID(e.target);
|
const id = locateID(e.target);
|
||||||
if (id && !e.target.classList.contains('wx-link'))
|
if (id && !e.target.classList.contains('wx-link')) {
|
||||||
api.exec('show-editor', { id });
|
const segmentIndex = locateID(e.target, 'data-segment');
|
||||||
|
api.exec('show-editor', {
|
||||||
|
id,
|
||||||
|
...(segmentIndex !== null && { segmentIndex }),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[api, readonly],
|
[api, readonly],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const types = ['e2s', 's2s', 'e2e', 's2e'];
|
const types = ['e2s', 's2s', 'e2e', 's2e'];
|
||||||
const getLinkType = useCallback(
|
const getLinkType = useCallback((fromStart, toStart) => {
|
||||||
(fromStart, toStart) => {
|
return types[(fromStart ? 1 : 0) + (toStart ? 0 : 2)];
|
||||||
return types[(fromStart ? 1 : 0) + (toStart ? 0 : 2)];
|
}, []);
|
||||||
},
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
|
|
||||||
const alreadyLinked = useCallback(
|
const alreadyLinked = useCallback(
|
||||||
(target, toStart) => {
|
(target, toStart) => {
|
||||||
@@ -413,17 +464,32 @@ function Bars(props) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else if (css.contains('wx-delete-button-icon')) {
|
||||||
|
api.exec('delete-link', { id: selectedLink.id });
|
||||||
|
setSelectedLink(null);
|
||||||
} else {
|
} else {
|
||||||
|
let segmentIndex;
|
||||||
|
const segmentNode = locate(e, 'data-segment');
|
||||||
|
if (segmentNode) segmentIndex = segmentNode.dataset.segment * 1;
|
||||||
api.exec('select-task', {
|
api.exec('select-task', {
|
||||||
id,
|
id,
|
||||||
toggle: e.ctrlKey || e.metaKey,
|
toggle: e.ctrlKey || e.metaKey,
|
||||||
range: e.shiftKey,
|
range: e.shiftKey,
|
||||||
|
segmentIndex,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeLinkMarker();
|
removeLinkMarker();
|
||||||
},
|
},
|
||||||
[api, linkFrom, rLinksCounter],
|
[
|
||||||
|
api,
|
||||||
|
linkFrom,
|
||||||
|
rLinksCounter,
|
||||||
|
selectedLink,
|
||||||
|
alreadyLinked,
|
||||||
|
getLinkType,
|
||||||
|
removeLinkMarker,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
const taskStyle = useCallback((task) => {
|
const taskStyle = useCallback((task) => {
|
||||||
@@ -454,15 +520,20 @@ function Bars(props) {
|
|||||||
[touched],
|
[touched],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const taskTypeIds = useMemo(
|
||||||
|
() => taskTypesValue.map((t) => t.id),
|
||||||
|
[taskTypesValue],
|
||||||
|
);
|
||||||
|
|
||||||
const taskTypeCss = useCallback(
|
const taskTypeCss = useCallback(
|
||||||
(type) => {
|
(type) => {
|
||||||
let css = taskTypesValue.some((t) => type === t.id) ? type : 'task';
|
let css = taskTypeIds.includes(type) ? type : 'task';
|
||||||
if (css !== 'task' && css !== 'milestone' && css !== 'summary')
|
if (!['task', 'milestone', 'summary'].includes(type)) {
|
||||||
css = `task ${css}`;
|
css = `task ${css}`;
|
||||||
|
}
|
||||||
return css;
|
return css;
|
||||||
},
|
},
|
||||||
[taskTypesValue],
|
[taskTypeIds],
|
||||||
);
|
);
|
||||||
|
|
||||||
const forward = useCallback(
|
const forward = useCallback(
|
||||||
@@ -472,6 +543,35 @@ function Bars(props) {
|
|||||||
[api],
|
[api],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isTaskCritical = useCallback(
|
||||||
|
(taskId) => {
|
||||||
|
return criticalPath && tree.byId(taskId).$critical;
|
||||||
|
},
|
||||||
|
[criticalPath, tree],
|
||||||
|
);
|
||||||
|
|
||||||
|
const isLinkMarkerVisible = useCallback(
|
||||||
|
(id) => {
|
||||||
|
if (schedule?.auto) {
|
||||||
|
const summaryIds = tree.getSummaryId(id, true);
|
||||||
|
const linkFromSummaryIds = tree.getSummaryId(linkFrom.id, true);
|
||||||
|
return (
|
||||||
|
linkFrom?.id &&
|
||||||
|
!(Array.isArray(summaryIds) ? summaryIds : [summaryIds]).includes(
|
||||||
|
linkFrom.id,
|
||||||
|
) &&
|
||||||
|
!(
|
||||||
|
Array.isArray(linkFromSummaryIds)
|
||||||
|
? linkFromSummaryIds
|
||||||
|
: [linkFromSummaryIds]
|
||||||
|
).includes(id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return linkFrom;
|
||||||
|
},
|
||||||
|
[schedule, tree, linkFrom],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="wx-GKbcLEGA wx-bars"
|
className="wx-GKbcLEGA wx-bars"
|
||||||
@@ -490,86 +590,124 @@ function Bars(props) {
|
|||||||
return false;
|
return false;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Links
|
||||||
|
onSelectLink={onSelectLink}
|
||||||
|
selectedLink={selectedLink}
|
||||||
|
readonly={readonly}
|
||||||
|
/>
|
||||||
{tasks.map((task) => {
|
{tasks.map((task) => {
|
||||||
if (task.$skip && task.$skip_baseline) return null;
|
if (task.$skip && task.$skip_baseline) return null;
|
||||||
const barClass =
|
const barClass =
|
||||||
`wx-bar wx-${taskTypeCss(task.type)}` +
|
`wx-bar wx-${taskTypeCss(task.type)}` +
|
||||||
(touched && taskMove && task.id === taskMove.id ? ' wx-touch' : '') +
|
(touched && taskMove && task.id === taskMove.id ? ' wx-touch' : '') +
|
||||||
(linkFrom && linkFrom.id === task.id ? ' wx-selected' : '') +
|
(linkFrom && linkFrom.id === task.id ? ' wx-selected' : '') +
|
||||||
(task.$reorder ? ' wx-reorder-task' : '');
|
(isTaskCritical(task.id) ? ' wx-critical' : '') +
|
||||||
|
(task.$reorder ? ' wx-reorder-task' : '') +
|
||||||
|
(splitTasks && task.segments ? ' wx-split' : '');
|
||||||
const leftLinkClass =
|
const leftLinkClass =
|
||||||
'wx-link wx-left' +
|
'wx-link wx-left' +
|
||||||
(linkFrom ? ' wx-visible' : '') +
|
(linkFrom ? ' wx-visible' : '') +
|
||||||
(!linkFrom || !alreadyLinked(task.id, true) ? ' wx-target' : '') +
|
(!linkFrom ||
|
||||||
|
(!alreadyLinked(task.id, true) && isLinkMarkerVisible(task.id))
|
||||||
|
? ' wx-target'
|
||||||
|
: '') +
|
||||||
(linkFrom && linkFrom.id === task.id && linkFrom.start
|
(linkFrom && linkFrom.id === task.id && linkFrom.start
|
||||||
? ' wx-selected'
|
? ' wx-selected'
|
||||||
: '');
|
: '') +
|
||||||
|
(isTaskCritical(task.id) ? ' wx-critical' : '');
|
||||||
const rightLinkClass =
|
const rightLinkClass =
|
||||||
'wx-link wx-right' +
|
'wx-link wx-right' +
|
||||||
(linkFrom ? ' wx-visible' : '') +
|
(linkFrom ? ' wx-visible' : '') +
|
||||||
(!linkFrom || !alreadyLinked(task.id, false) ? ' wx-target' : '') +
|
(!linkFrom ||
|
||||||
|
(!alreadyLinked(task.id, false) && isLinkMarkerVisible(task.id))
|
||||||
|
? ' wx-target'
|
||||||
|
: '') +
|
||||||
(linkFrom && linkFrom.id === task.id && !linkFrom.start
|
(linkFrom && linkFrom.id === task.id && !linkFrom.start
|
||||||
? ' wx-selected'
|
? ' wx-selected'
|
||||||
: '');
|
: '') +
|
||||||
|
(isTaskCritical(task.id) ? ' wx-critical' : '');
|
||||||
return (
|
return (
|
||||||
<Fragment key={task.id}>
|
<Fragment key={task.id}>
|
||||||
{!task.$skip && <div
|
{!task.$skip && (
|
||||||
className={'wx-GKbcLEGA ' + barClass}
|
<div
|
||||||
style={taskStyle(task)}
|
className={'wx-GKbcLEGA ' + barClass}
|
||||||
data-tooltip-id={task.id}
|
style={taskStyle(task)}
|
||||||
data-id={task.id}
|
data-tooltip-id={task.id}
|
||||||
tabIndex={focused === task.id ? 0 : -1}
|
data-id={task.id}
|
||||||
>
|
tabIndex={focused === task.id ? 0 : -1}
|
||||||
{!readonly ? (
|
>
|
||||||
<div className={'wx-GKbcLEGA ' + leftLinkClass}>
|
{!readonly ? (
|
||||||
<div className="wx-GKbcLEGA wx-inner"></div>
|
task.id === selectedLink?.target &&
|
||||||
</div>
|
selectedLink?.type[2] === 's' ? (
|
||||||
) : null}
|
<Button
|
||||||
|
type="danger"
|
||||||
{task.type !== 'milestone' ? (
|
css="wx-left wx-delete-button wx-delete-link"
|
||||||
<>
|
|
||||||
{task.progress ? (
|
|
||||||
<div className="wx-GKbcLEGA wx-progress-wrapper">
|
|
||||||
<div
|
|
||||||
className="wx-GKbcLEGA wx-progress-percent"
|
|
||||||
style={{ width: `${task.progress}%` }}
|
|
||||||
></div>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{!readonly ? (
|
|
||||||
<div
|
|
||||||
className="wx-GKbcLEGA wx-progress-marker"
|
|
||||||
style={{ left: `calc(${task.progress}% - 10px)` }}
|
|
||||||
>
|
>
|
||||||
{task.progress}
|
<i className="wxi-close wx-delete-button-icon"></i>
|
||||||
</div>
|
</Button>
|
||||||
) : null}
|
|
||||||
{TaskTemplate ? (
|
|
||||||
<TaskTemplate data={task} api={api} onAction={forward} />
|
|
||||||
) : (
|
) : (
|
||||||
<div className="wx-GKbcLEGA wx-content">
|
<div className={'wx-GKbcLEGA ' + leftLinkClass}>
|
||||||
{task.text || ''}
|
<div className="wx-GKbcLEGA wx-inner"></div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)
|
||||||
</>
|
) : null}
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<div className="wx-GKbcLEGA wx-content"></div>
|
|
||||||
{TaskTemplate ? (
|
|
||||||
<TaskTemplate data={task} api={api} onAction={forward} />
|
|
||||||
) : (
|
|
||||||
<div className="wx-GKbcLEGA wx-text-out">{task.text}</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!readonly ? (
|
{task.type !== 'milestone' ? (
|
||||||
<div className={'wx-GKbcLEGA ' + rightLinkClass}>
|
<>
|
||||||
<div className="wx-GKbcLEGA wx-inner"></div>
|
{task.progress && !(splitTasks && task.segments) ? (
|
||||||
</div>
|
<div className="wx-GKbcLEGA wx-progress-wrapper">
|
||||||
) : null}
|
<div
|
||||||
</div>
|
className="wx-GKbcLEGA wx-progress-percent"
|
||||||
}
|
style={{ width: `${task.progress}%` }}
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
{!readonly && !(splitTasks && task.segments) ? (
|
||||||
|
<div
|
||||||
|
className="wx-GKbcLEGA wx-progress-marker"
|
||||||
|
style={{ left: `calc(${task.progress}% - 10px)` }}
|
||||||
|
>
|
||||||
|
{task.progress}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
{TaskTemplate ? (
|
||||||
|
<TaskTemplate data={task} api={api} onAction={forward} />
|
||||||
|
) : splitTasks && task.segments ? (
|
||||||
|
<BarSegments task={task} type={taskTypeCss(task.type)} />
|
||||||
|
) : (
|
||||||
|
<div className="wx-GKbcLEGA wx-content">
|
||||||
|
{task.text || ''}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<div className="wx-GKbcLEGA wx-content"></div>
|
||||||
|
{TaskTemplate ? (
|
||||||
|
<TaskTemplate data={task} api={api} onAction={forward} />
|
||||||
|
) : (
|
||||||
|
<div className="wx-GKbcLEGA wx-text-out">{task.text}</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!readonly ? (
|
||||||
|
task.id === selectedLink?.target &&
|
||||||
|
selectedLink?.type[2] === 'e' ? (
|
||||||
|
<Button
|
||||||
|
type="danger"
|
||||||
|
css="wx-right wx-delete-button wx-delete-link"
|
||||||
|
>
|
||||||
|
<i className="wxi-close wx-delete-button-icon"></i>
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<div className={'wx-GKbcLEGA ' + rightLinkClass}>
|
||||||
|
<div className="wx-GKbcLEGA wx-inner"></div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{baselinesValue && !task.$skip_baseline ? (
|
{baselinesValue && !task.$skip_baseline ? (
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
import {
|
import { useContext, useEffect, useRef, useState } from 'react';
|
||||||
useContext,
|
|
||||||
useEffect,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from 'react';
|
|
||||||
import storeContext from '../../context';
|
import storeContext from '../../context';
|
||||||
import { grid } from '@svar-ui/gantt-store';
|
import { grid } from '@svar-ui/gantt-store';
|
||||||
import { useStore } from '@svar-ui/lib-react';
|
import { useStore } from '@svar-ui/lib-react';
|
||||||
|
|
||||||
|
|
||||||
function CellGrid({ borders = '' }) {
|
function CellGrid({ borders = '' }) {
|
||||||
const api = useContext(storeContext);
|
const api = useContext(storeContext);
|
||||||
const cellWidth = useStore(api, "cellWidth");
|
const cellWidth = useStore(api, 'cellWidth');
|
||||||
const cellHeight = useStore(api, "cellHeight");
|
const cellHeight = useStore(api, 'cellHeight');
|
||||||
|
|
||||||
const nodeRef = useRef(null);
|
const nodeRef = useRef(null);
|
||||||
const [color, setColor] = useState('#e4e4e4');
|
const [color, setColor] = useState('#e4e4e4');
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
transform: scaleX(-1);
|
transform: scaleX(-1);
|
||||||
}
|
|
||||||
.wx-default.wx-mR7v2Xag {
|
|
||||||
background: var(--wx-gantt-marker-color);
|
background: var(--wx-gantt-marker-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import {
|
|||||||
} from 'react';
|
} from 'react';
|
||||||
import CellGrid from './CellGrid.jsx';
|
import CellGrid from './CellGrid.jsx';
|
||||||
import Bars from './Bars.jsx';
|
import Bars from './Bars.jsx';
|
||||||
import Links from './Links.jsx';
|
|
||||||
import { hotkeys } from '@svar-ui/grid-store';
|
import { hotkeys } from '@svar-ui/grid-store';
|
||||||
import storeContext from '../../context';
|
import storeContext from '../../context';
|
||||||
import { useStore, useStoreWithCounter } from '@svar-ui/lib-react';
|
import { useStore, useStoreWithCounter } from '@svar-ui/lib-react';
|
||||||
import './Chart.css';
|
import './Chart.css';
|
||||||
import TimeScales from '../TimeScale.jsx';
|
import TimeScales from './TimeScale.jsx';
|
||||||
|
import { useRenderTime } from '../../helpers/debug.js';
|
||||||
|
|
||||||
function Chart(props) {
|
function Chart(props) {
|
||||||
const {
|
const {
|
||||||
@@ -27,15 +27,14 @@ function Chart(props) {
|
|||||||
|
|
||||||
const api = useContext(storeContext);
|
const api = useContext(storeContext);
|
||||||
|
|
||||||
const [selected, selectedCounter] = useStoreWithCounter(api, "_selected");
|
const [selected, selectedCounter] = useStoreWithCounter(api, '_selected');
|
||||||
const rScrollLeft = useStore(api, "scrollLeft");
|
const rScrollTop = useStore(api, 'scrollTop');
|
||||||
const rScrollTop = useStore(api, "scrollTop");
|
const cellHeight = useStore(api, 'cellHeight');
|
||||||
const cellHeight = useStore(api, "cellHeight");
|
const cellWidth = useStore(api, 'cellWidth');
|
||||||
const cellWidth = useStore(api, "cellWidth");
|
const scales = useStore(api, '_scales');
|
||||||
const scales = useStore(api, "_scales");
|
const markers = useStore(api, '_markers');
|
||||||
const markers = useStore(api, "_markers");
|
const rScrollTask = useStore(api, '_scrollTask');
|
||||||
const rScrollTask = useStore(api, "_scrollTask");
|
const zoom = useStore(api, 'zoom');
|
||||||
const zoom = useStore(api, "zoom");
|
|
||||||
|
|
||||||
const [chartHeight, setChartHeight] = useState();
|
const [chartHeight, setChartHeight] = useState();
|
||||||
const chartRef = useRef(null);
|
const chartRef = useRef(null);
|
||||||
@@ -95,7 +94,7 @@ function Chart(props) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dataRequest();
|
dataRequest();
|
||||||
}, [chartHeight, rScrollTop, rScrollLeft]);
|
}, [chartHeight, rScrollTop]);
|
||||||
|
|
||||||
const showTask = useCallback(
|
const showTask = useCallback(
|
||||||
(value) => {
|
(value) => {
|
||||||
@@ -110,21 +109,20 @@ function Chart(props) {
|
|||||||
const task = api.getTask(id);
|
const task = api.getTask(id);
|
||||||
if (task.$x + task.$w < el.scrollLeft) {
|
if (task.$x + task.$w < el.scrollLeft) {
|
||||||
api.exec('scroll-chart', { left: task.$x - (cellWidth || 0) });
|
api.exec('scroll-chart', { left: task.$x - (cellWidth || 0) });
|
||||||
el.scrollLeft = task.$x - (cellWidth || 0)
|
el.scrollLeft = task.$x - (cellWidth || 0);
|
||||||
} else if (task.$x >= clientWidth + el.scrollLeft) {
|
} else if (task.$x >= clientWidth + el.scrollLeft) {
|
||||||
const width = clientWidth < task.$w ? cellWidth || 0 : task.$w;
|
const width = clientWidth < task.$w ? cellWidth || 0 : task.$w;
|
||||||
api.exec('scroll-chart', { left: task.$x - clientWidth + width });
|
api.exec('scroll-chart', { left: task.$x - clientWidth + width });
|
||||||
el.scrollLeft = task.$x - clientWidth + width;
|
el.scrollLeft = task.$x - clientWidth + width;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[api, cellWidth, rScrollLeft],
|
[api, cellWidth],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
showTask(rScrollTask);
|
showTask(rScrollTask);
|
||||||
}, [rScrollTask]);
|
}, [rScrollTask]);
|
||||||
|
|
||||||
|
|
||||||
function onWheel(e) {
|
function onWheel(e) {
|
||||||
if (zoom && (e.ctrlKey || e.metaKey)) {
|
if (zoom && (e.ctrlKey || e.metaKey)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -156,10 +154,13 @@ function Chart(props) {
|
|||||||
: null;
|
: null;
|
||||||
}, [scales, highlightTime]);
|
}, [scales, highlightTime]);
|
||||||
|
|
||||||
const handleHotkey = useCallback((ev) => {
|
const handleHotkey = useCallback(
|
||||||
ev.eventSource = 'chart';
|
(ev) => {
|
||||||
api.exec('hotkey', ev);
|
ev.eventSource = 'chart';
|
||||||
}, [api]);
|
api.exec('hotkey', ev);
|
||||||
|
},
|
||||||
|
[api],
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const el = chartRef.current;
|
const el = chartRef.current;
|
||||||
@@ -201,7 +202,9 @@ function Chart(props) {
|
|||||||
return () => {
|
return () => {
|
||||||
node.removeEventListener('wheel', handler);
|
node.removeEventListener('wheel', handler);
|
||||||
};
|
};
|
||||||
}, [onWheel])
|
}, [onWheel]);
|
||||||
|
|
||||||
|
useRenderTime("chart");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -219,7 +222,7 @@ function Chart(props) {
|
|||||||
{markers.map((marker, i) => (
|
{markers.map((marker, i) => (
|
||||||
<div
|
<div
|
||||||
key={i}
|
key={i}
|
||||||
className={`wx-mR7v2Xag wx-marker ${marker.css || 'wx-default'}`}
|
className={`wx-mR7v2Xag wx-marker ${marker.css || ''}`}
|
||||||
style={{ left: `${marker.left}px` }}
|
style={{ left: `${marker.left}px` }}
|
||||||
>
|
>
|
||||||
<div className="wx-mR7v2Xag wx-content">{marker.text}</div>
|
<div className="wx-mR7v2Xag wx-content">{marker.text}</div>
|
||||||
@@ -256,18 +259,17 @@ function Chart(props) {
|
|||||||
|
|
||||||
{selected && selected.length
|
{selected && selected.length
|
||||||
? selected.map((obj, index) =>
|
? selected.map((obj, index) =>
|
||||||
obj.$y ? (
|
obj.$y ? (
|
||||||
<div
|
<div
|
||||||
key={obj.id}
|
key={obj.id}
|
||||||
className="wx-mR7v2Xag wx-selected"
|
className="wx-mR7v2Xag wx-selected"
|
||||||
data-id={obj.id}
|
data-id={obj.id}
|
||||||
style={selectStyle[index]}
|
style={selectStyle[index]}
|
||||||
></div>
|
></div>
|
||||||
) : null,
|
) : null,
|
||||||
)
|
)
|
||||||
: null}
|
: null}
|
||||||
|
|
||||||
<Links />
|
|
||||||
<Bars readonly={readonly} taskTemplate={taskTemplate} />
|
<Bars readonly={readonly} taskTemplate={taskTemplate} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,9 +10,28 @@
|
|||||||
user-select: auto;
|
user-select: auto;
|
||||||
pointer-events: stroke;
|
pointer-events: stroke;
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
|
||||||
stroke: var(--wx-gantt-link-color);
|
stroke: var(--wx-gantt-link-color);
|
||||||
stroke-width: 2;
|
stroke-width: 2;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
fill: transparent;
|
fill: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wx-line-selectable.wx-dkx3NwEn:hover {
|
||||||
|
stroke: var(--wx-gantt-link-color-hovered);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-line-selectable.wx-critical.wx-dkx3NwEn:hover {
|
||||||
|
stroke: var(--wx-gantt-link-critical-color-hovered);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-line-selectable.wx-dkx3NwEn {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-line.wx-line-selected.wx-dkx3NwEn {
|
||||||
|
stroke: var(--wx-color-danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-critical.wx-dkx3NwEn {
|
||||||
|
stroke: var(--wx-gantt-link-critical-color);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,21 +1,66 @@
|
|||||||
import { useContext } from 'react';
|
import { useCallback, useContext, useEffect, useRef } from 'react';
|
||||||
import storeContext from '../../context';
|
import storeContext from '../../context';
|
||||||
import { useStore } from '@svar-ui/lib-react';
|
import { useStore } from '@svar-ui/lib-react';
|
||||||
import './Links.css';
|
import './Links.css';
|
||||||
|
|
||||||
export default function Links() {
|
export default function Links({ onSelectLink, selectedLink, readonly }) {
|
||||||
const api = useContext(storeContext);
|
const api = useContext(storeContext);
|
||||||
const links = useStore(api,"_links");
|
const links = useStore(api, '_links');
|
||||||
|
const criticalPath = useStore(api, 'criticalPath');
|
||||||
|
|
||||||
|
const selectedLineRef = useRef(null);
|
||||||
|
|
||||||
|
const onClickOutside = useCallback(
|
||||||
|
(event) => {
|
||||||
|
const css = event?.target?.classList;
|
||||||
|
if (!css?.contains('wx-line') && !css?.contains('wx-delete-button')) {
|
||||||
|
onSelectLink(null);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[onSelectLink],
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!readonly && selectedLink && selectedLineRef.current) {
|
||||||
|
const handler = (event) => {
|
||||||
|
if (
|
||||||
|
selectedLineRef.current &&
|
||||||
|
!selectedLineRef.current.contains(event.target)
|
||||||
|
) {
|
||||||
|
onClickOutside(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener('click', handler);
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('click', handler);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, [readonly, selectedLink, onClickOutside]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<svg className="wx-dkx3NwEn wx-links">
|
<svg className="wx-dkx3NwEn wx-links">
|
||||||
{(links || []).map((link) => (
|
{(links || []).map((link) => {
|
||||||
|
const className =
|
||||||
|
'wx-dkx3NwEn wx-line' +
|
||||||
|
(criticalPath && link.$critical ? ' wx-critical' : '') +
|
||||||
|
(!readonly ? ' wx-line-selectable' : '');
|
||||||
|
return (
|
||||||
|
<polyline
|
||||||
|
className={className}
|
||||||
|
points={link.$p}
|
||||||
|
key={link.id}
|
||||||
|
onClick={() => !readonly && onSelectLink(link.id)}
|
||||||
|
data-link-id={link.id}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
{!readonly && selectedLink && (
|
||||||
<polyline
|
<polyline
|
||||||
className="wx-dkx3NwEn wx-line"
|
ref={selectedLineRef}
|
||||||
points={link.$p}
|
className="wx-dkx3NwEn wx-line wx-line-selected wx-line-selectable wx-delete-link"
|
||||||
key={link.id}
|
points={selectedLink.$p}
|
||||||
/>
|
/>
|
||||||
))}
|
)}
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
30
src/components/chart/TimeScale.css
Normal file
30
src/components/chart/TimeScale.css
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
.wx-scale.wx-ZkvhDKir {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
background-color: var(--wx-background);
|
||||||
|
box-shadow: var(--wx-timescale-shadow);
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-row.wx-ZkvhDKir,
|
||||||
|
.wx-cell.wx-ZkvhDKir {
|
||||||
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-row.wx-ZkvhDKir {
|
||||||
|
border-bottom: var(--wx-gantt-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-cell.wx-ZkvhDKir {
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border-right: var(--wx-timescale-border);
|
||||||
|
font: var(--wx-timescale-font);
|
||||||
|
color: var(--wx-timescale-font-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wx-cell.wx-weekend.wx-ZkvhDKir {
|
||||||
|
background: var(--wx-gantt-holiday-background);
|
||||||
|
color: var(--wx-gantt-holiday-color);
|
||||||
|
}
|
||||||
42
src/components/chart/TimeScale.jsx
Normal file
42
src/components/chart/TimeScale.jsx
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import { useContext } from 'react';
|
||||||
|
import storeContext from '../../context';
|
||||||
|
import { useStore } from '@svar-ui/lib-react';
|
||||||
|
import './TimeScale.css';
|
||||||
|
|
||||||
|
function TimeScale(props) {
|
||||||
|
const { highlightTime } = props;
|
||||||
|
|
||||||
|
const api = useContext(storeContext);
|
||||||
|
const scales = useStore(api, '_scales');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="wx-ZkvhDKir wx-scale" style={{ width: scales.width }}>
|
||||||
|
{(scales?.rows || []).map((row, rowIdx) => (
|
||||||
|
<div
|
||||||
|
className="wx-ZkvhDKir wx-row"
|
||||||
|
style={{ height: `${row.height}px` }}
|
||||||
|
key={rowIdx}
|
||||||
|
>
|
||||||
|
{(row.cells || []).map((cell, cellIdx) => {
|
||||||
|
const extraClass = highlightTime
|
||||||
|
? highlightTime(cell.date, cell.unit)
|
||||||
|
: '';
|
||||||
|
const className =
|
||||||
|
'wx-cell ' + (cell.css || '') + ' ' + (extraClass || '');
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={'wx-ZkvhDKir ' + className}
|
||||||
|
style={{ width: `${cell.width}px` }}
|
||||||
|
key={cellIdx}
|
||||||
|
>
|
||||||
|
{cell.value}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TimeScale;
|
||||||
@@ -18,6 +18,10 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wx-link-lag.wx-j93aYGQf {
|
||||||
|
width: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
.wx-wrapper.wx-j93aYGQf {
|
.wx-wrapper.wx-j93aYGQf {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect, useMemo, useContext } from 'react';
|
import { useState, useEffect, useMemo, useContext } from 'react';
|
||||||
import { Field, Combo } from '@svar-ui/react-core';
|
import { Field, Combo, Text } from '@svar-ui/react-core';
|
||||||
import { context } from '@svar-ui/react-core';
|
import { context } from '@svar-ui/react-core';
|
||||||
import { useStore } from '@svar-ui/lib-react';
|
import { useStore } from '@svar-ui/lib-react';
|
||||||
import './Links.css';
|
import './Links.css';
|
||||||
@@ -8,8 +8,11 @@ export default function Links({ api, autoSave, onLinksChange }) {
|
|||||||
const i18n = useContext(context.i18n);
|
const i18n = useContext(context.i18n);
|
||||||
const _ = i18n.getGroup('gantt');
|
const _ = i18n.getGroup('gantt');
|
||||||
|
|
||||||
const activeTask = useStore(api,"activeTask");
|
const activeTask = useStore(api, 'activeTask');
|
||||||
const links = useStore(api,"_links");
|
const _activeTask = useStore(api, '_activeTask');
|
||||||
|
const links = useStore(api, '_links');
|
||||||
|
const schedule = useStore(api, 'schedule');
|
||||||
|
const unscheduledTasks = useStore(api, 'unscheduledTasks');
|
||||||
|
|
||||||
const [linksData, setLinksData] = useState();
|
const [linksData, setLinksData] = useState();
|
||||||
|
|
||||||
@@ -63,12 +66,11 @@ export default function Links({ api, autoSave, onLinksChange }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleChange(ev, id) {
|
function handleChange(id, update) {
|
||||||
const value = ev.value;
|
|
||||||
if (autoSave) {
|
if (autoSave) {
|
||||||
api.exec('update-link', {
|
api.exec('update-link', {
|
||||||
id,
|
id,
|
||||||
link: { type: value },
|
link: update,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setLinksData((prev) =>
|
setLinksData((prev) =>
|
||||||
@@ -76,7 +78,7 @@ export default function Links({ api, autoSave, onLinksChange }) {
|
|||||||
...group,
|
...group,
|
||||||
data: group.data.map((item) =>
|
data: group.data.map((item) =>
|
||||||
item.link.id === id
|
item.link.id === id
|
||||||
? { ...item, link: { ...item.link, type: value } }
|
? { ...item, link: { ...item.link, ...update } }
|
||||||
: item,
|
: item,
|
||||||
),
|
),
|
||||||
})),
|
})),
|
||||||
@@ -87,7 +89,7 @@ export default function Links({ api, autoSave, onLinksChange }) {
|
|||||||
action: 'update-link',
|
action: 'update-link',
|
||||||
data: {
|
data: {
|
||||||
id,
|
id,
|
||||||
link: { type: value },
|
link: update,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -108,14 +110,31 @@ export default function Links({ api, autoSave, onLinksChange }) {
|
|||||||
{obj.task.text || ''}
|
{obj.task.text || ''}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
{schedule?.auto && obj.link.type === 'e2s' ? (
|
||||||
|
<td className="wx-j93aYGQf wx-cell wx-link-lag">
|
||||||
|
<Text
|
||||||
|
type="number"
|
||||||
|
placeholder={_('Lag')}
|
||||||
|
value={obj.link.lag}
|
||||||
|
disabled={
|
||||||
|
unscheduledTasks && _activeTask?.unscheduled
|
||||||
|
}
|
||||||
|
onChange={(ev) => {
|
||||||
|
if (!ev.input)
|
||||||
|
handleChange(obj.link.id, { lag: ev.value });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
) : null}
|
||||||
<td className="wx-j93aYGQf wx-cell">
|
<td className="wx-j93aYGQf wx-cell">
|
||||||
<div className="wx-j93aYGQf wx-wrapper">
|
<div className="wx-j93aYGQf wx-wrapper">
|
||||||
<Combo
|
<Combo
|
||||||
value={obj.link.type}
|
value={obj.link.type}
|
||||||
placeholder={_('Select link type')}
|
placeholder={_('Select link type')}
|
||||||
options={list}
|
options={list}
|
||||||
onChange={(e) => handleChange(e, obj.link.id)}
|
onChange={(ev) =>
|
||||||
|
handleChange(obj.link.id, { type: ev.value })
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{({ option }) => option.label}
|
{({ option }) => option.label}
|
||||||
</Combo>
|
</Combo>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
import { context } from '@svar-ui/react-core';
|
import { context } from '@svar-ui/react-core';
|
||||||
import { locateID, locateAttr } from '@svar-ui/lib-dom';
|
import { locateID, locateAttr } from '@svar-ui/lib-dom';
|
||||||
import { reorder } from '../../helpers/reorder';
|
import { reorder } from '../../helpers/reorder';
|
||||||
import { normalizeDates } from '@svar-ui/gantt-store';
|
import { prepareEditTask } from '@svar-ui/gantt-store';
|
||||||
import { Grid as WxGrid } from '@svar-ui/react-grid';
|
import { Grid as WxGrid } from '@svar-ui/react-grid';
|
||||||
import TextCell from './TextCell.jsx';
|
import TextCell from './TextCell.jsx';
|
||||||
import ActionCell from './ActionCell.jsx';
|
import ActionCell from './ActionCell.jsx';
|
||||||
@@ -18,7 +18,14 @@ import storeContext from '../../context';
|
|||||||
import './Grid.css';
|
import './Grid.css';
|
||||||
|
|
||||||
export default function Grid(props) {
|
export default function Grid(props) {
|
||||||
const { readonly, compactMode, width = 0, display = 'all', columnWidth: columnWidthProp = 0, onTableAPIChange } = props;
|
const {
|
||||||
|
readonly,
|
||||||
|
compactMode,
|
||||||
|
width = 0,
|
||||||
|
display = 'all',
|
||||||
|
columnWidth: columnWidthProp = 0,
|
||||||
|
onTableAPIChange,
|
||||||
|
} = props;
|
||||||
const [columnWidth, setColumnWidthProp] = useWritableProp(columnWidthProp);
|
const [columnWidth, setColumnWidthProp] = useWritableProp(columnWidthProp);
|
||||||
const [tableAPI, setTableAPI] = useState();
|
const [tableAPI, setTableAPI] = useState();
|
||||||
|
|
||||||
@@ -26,19 +33,19 @@ export default function Grid(props) {
|
|||||||
const _ = useMemo(() => i18n.getGroup('gantt'), [i18n]);
|
const _ = useMemo(() => i18n.getGroup('gantt'), [i18n]);
|
||||||
const api = useContext(storeContext);
|
const api = useContext(storeContext);
|
||||||
|
|
||||||
const scrollTopVal = useStore(api, "scrollTop");
|
const scrollTopVal = useStore(api, 'scrollTop');
|
||||||
const cellHeightVal = useStore(api, "cellHeight");
|
const cellHeightVal = useStore(api, 'cellHeight');
|
||||||
const scrollTask = useStore(api, "_scrollTask");
|
const scrollTask = useStore(api, '_scrollTask');
|
||||||
const selectedVal = useStore(api, "_selected");
|
const selectedVal = useStore(api, '_selected');
|
||||||
const areaVal = useStore(api, "area");
|
const areaVal = useStore(api, 'area');
|
||||||
const rTasksVal = useStore(api, "_tasks");
|
const rTasksVal = useStore(api, '_tasks');
|
||||||
const scalesVal = useStore(api, "_scales");
|
const scalesVal = useStore(api, '_scales');
|
||||||
const columnsVal = useStore(api, "columns");
|
const columnsVal = useStore(api, 'columns');
|
||||||
const sortVal = useStore(api, "_sort");
|
const sortVal = useStore(api, '_sort');
|
||||||
const durationUnitVal = useStore(api, "durationUnit");
|
const calendarVal = useStore(api, 'calendar');
|
||||||
|
const durationUnitVal = useStore(api, 'durationUnit');
|
||||||
|
const splitTasksVal = useStore(api, 'splitTasks');
|
||||||
|
|
||||||
const touchYRef = useRef(null);
|
|
||||||
const scrollRef = useRef(true);
|
|
||||||
const [dragTask, setDragTask] = useState(null);
|
const [dragTask, setDragTask] = useState(null);
|
||||||
|
|
||||||
const tasks = useMemo(() => {
|
const tasks = useMemo(() => {
|
||||||
@@ -61,7 +68,7 @@ export default function Grid(props) {
|
|||||||
api.exec(action, { id, mode: !task.open });
|
api.exec(action, { id, mode: !task.open });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[tasks]
|
[tasks],
|
||||||
);
|
);
|
||||||
|
|
||||||
const onClick = useCallback(
|
const onClick = useCallback(
|
||||||
@@ -102,8 +109,6 @@ export default function Grid(props) {
|
|||||||
return () => ro.disconnect();
|
return () => ro.disconnect();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const lastDetailRef = useRef(null);
|
const lastDetailRef = useRef(null);
|
||||||
|
|
||||||
const reorderTasks = useCallback(
|
const reorderTasks = useCallback(
|
||||||
@@ -222,7 +227,6 @@ export default function Grid(props) {
|
|||||||
return {};
|
return {};
|
||||||
}, [allTasks, sortVal]);
|
}, [allTasks, sortVal]);
|
||||||
|
|
||||||
|
|
||||||
const checkFlex = useCallback(() => {
|
const checkFlex = useCallback(() => {
|
||||||
return cols.some((c) => c.flexgrow && !c.hidden);
|
return cols.some((c) => c.flexgrow && !c.hidden);
|
||||||
}, []); // cols defined later; will use latest value when invoked
|
}, []); // cols defined later; will use latest value when invoked
|
||||||
@@ -271,7 +275,6 @@ export default function Grid(props) {
|
|||||||
return filteredColumns;
|
return filteredColumns;
|
||||||
}, [display, cols, hasFlexCol, columnWidth, width, gridWidth]);
|
}, [display, cols, hasFlexCol, columnWidth, width, gridWidth]);
|
||||||
|
|
||||||
|
|
||||||
const setColumnWidth = useCallback(
|
const setColumnWidth = useCallback(
|
||||||
(resized) => {
|
(resized) => {
|
||||||
if (!checkFlex()) {
|
if (!checkFlex()) {
|
||||||
@@ -307,41 +310,11 @@ export default function Grid(props) {
|
|||||||
[api, readonly], // cols is defined later; relies on latest value at call time
|
[api, readonly], // cols is defined later; relies on latest value at call time
|
||||||
);
|
);
|
||||||
|
|
||||||
const endScroll = useCallback(() => {
|
|
||||||
scrollRef.current = false;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const onTouchstart = useCallback(
|
|
||||||
(e) => {
|
|
||||||
scrollRef.current = true;
|
|
||||||
touchYRef.current = e.touches[0].clientY + (scrollTopVal ?? 0);
|
|
||||||
},
|
|
||||||
[scrollTopVal],
|
|
||||||
);
|
|
||||||
|
|
||||||
const onTouchmove = useCallback(
|
|
||||||
(e) => {
|
|
||||||
if (scrollRef.current) {
|
|
||||||
const delta = (touchYRef.current ?? 0) - e.touches[0].clientY;
|
|
||||||
api.exec('scroll-chart', { top: delta });
|
|
||||||
e.preventDefault();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[api],
|
|
||||||
);
|
|
||||||
|
|
||||||
const sel = useMemo(
|
const sel = useMemo(
|
||||||
() => (Array.isArray(selectedVal) ? selectedVal.map((o) => o.id) : []),
|
() => (Array.isArray(selectedVal) ? selectedVal.map((o) => o.id) : []),
|
||||||
[selectedVal],
|
[selectedVal],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const handler = () => endScroll();
|
|
||||||
window.addEventListener('touchend', handler);
|
|
||||||
return () => window.removeEventListener('touchend', handler);
|
|
||||||
}, [endScroll]);
|
|
||||||
|
|
||||||
const setScrollOffset = useCallback(() => {
|
const setScrollOffset = useCallback(() => {
|
||||||
if (tableRef.current && allTasks !== null) {
|
if (tableRef.current && allTasks !== null) {
|
||||||
const body = tableRef.current.querySelector('.wx-body');
|
const body = tableRef.current.querySelector('.wx-body');
|
||||||
@@ -387,7 +360,6 @@ export default function Grid(props) {
|
|||||||
column: focusCell.column,
|
column: focusCell.column,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [scrollTask, tableAPI]);
|
}, [scrollTask, tableAPI]);
|
||||||
|
|
||||||
const startReorder = useCallback(
|
const startReorder = useCallback(
|
||||||
@@ -438,13 +410,12 @@ export default function Grid(props) {
|
|||||||
if (!node) return;
|
if (!node) return;
|
||||||
const action = reorder(node, {
|
const action = reorder(node, {
|
||||||
start: startReorder,
|
start: startReorder,
|
||||||
touchStart: endScroll,
|
|
||||||
end: endReorder,
|
end: endReorder,
|
||||||
move: moveReorder,
|
move: moveReorder,
|
||||||
getTask: api.getTask,
|
getTask: api.getTask,
|
||||||
});
|
});
|
||||||
return action.destroy;
|
return action.destroy;
|
||||||
}, [api, startReorder, endScroll, endReorder, moveReorder]);
|
}, [api, startReorder, endReorder, moveReorder]);
|
||||||
|
|
||||||
const handleHotkey = useCallback(
|
const handleHotkey = useCallback(
|
||||||
(ev) => {
|
(ev) => {
|
||||||
@@ -479,69 +450,88 @@ export default function Grid(props) {
|
|||||||
adjustColumns,
|
adjustColumns,
|
||||||
setColumnWidth,
|
setColumnWidth,
|
||||||
tasks,
|
tasks,
|
||||||
|
calendarVal,
|
||||||
durationUnitVal,
|
durationUnitVal,
|
||||||
onTableAPIChange
|
splitTasksVal,
|
||||||
|
onTableAPIChange,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
setHandlersState();
|
setHandlersState();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setHandlersState();
|
setHandlersState();
|
||||||
}, [setTableAPI, handleHotkey, sortVal, api, adjustColumns, setColumnWidth, tasks, durationUnitVal, onTableAPIChange]);
|
}, [
|
||||||
|
setTableAPI,
|
||||||
|
handleHotkey,
|
||||||
|
sortVal,
|
||||||
|
api,
|
||||||
|
adjustColumns,
|
||||||
|
setColumnWidth,
|
||||||
|
tasks,
|
||||||
|
calendarVal,
|
||||||
|
durationUnitVal,
|
||||||
|
splitTasksVal,
|
||||||
|
onTableAPIChange,
|
||||||
|
]);
|
||||||
|
|
||||||
const init = useCallback(
|
const init = useCallback((tapi) => {
|
||||||
(tapi) => {
|
setTableAPI(tapi);
|
||||||
setTableAPI(tapi);
|
tapi.intercept('hotkey', (ev) => handlersStateRef.current.handleHotkey(ev));
|
||||||
tapi.intercept('hotkey', (ev) => handlersStateRef.current.handleHotkey(ev));
|
tapi.intercept('scroll', () => false);
|
||||||
tapi.intercept('scroll', () => false);
|
tapi.intercept('select-row', () => false);
|
||||||
tapi.intercept('select-row', () => false);
|
tapi.intercept('sort-rows', (e) => {
|
||||||
tapi.intercept('sort-rows', (e) => {
|
const sortVal = handlersStateRef.current.sortVal;
|
||||||
const sortVal = handlersStateRef.current.sortVal;
|
const { key, add } = e;
|
||||||
const { key, add } = e;
|
const keySort = sortVal ? sortVal.find((s) => s.key === key) : null;
|
||||||
const keySort = sortVal ? sortVal.find((s) => s.key === key) : null;
|
let order = 'asc';
|
||||||
let order = 'asc';
|
if (keySort) order = !keySort || keySort.order === 'asc' ? 'desc' : 'asc';
|
||||||
if (keySort)
|
|
||||||
order = !keySort || keySort.order === 'asc' ? 'desc' : 'asc';
|
|
||||||
|
|
||||||
api.exec('sort-tasks', {
|
api.exec('sort-tasks', {
|
||||||
key,
|
key,
|
||||||
order,
|
order,
|
||||||
add,
|
add,
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
tapi.on('resize-column', () => {
|
||||||
|
handlersStateRef.current.setColumnWidth(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
tapi.on('hide-column', (ev) => {
|
||||||
|
if (!ev.mode) handlersStateRef.current.adjustColumns();
|
||||||
|
handlersStateRef.current.setColumnWidth();
|
||||||
|
});
|
||||||
|
|
||||||
|
tapi.intercept('update-cell', (e) => {
|
||||||
|
const { id, column, value } = e;
|
||||||
|
const task = handlersStateRef.current.tasks.find((t) => t.id === id);
|
||||||
|
|
||||||
|
if (task) {
|
||||||
|
const update = { ...task };
|
||||||
|
let v = value;
|
||||||
|
if (v && !isNaN(v) && !(v instanceof Date)) v *= 1;
|
||||||
|
update[column] = v;
|
||||||
|
|
||||||
|
prepareEditTask(
|
||||||
|
update,
|
||||||
|
{
|
||||||
|
calendar: handlersStateRef.current.calendarVal,
|
||||||
|
durationUnit: handlersStateRef.current.durationUnitVal,
|
||||||
|
splitTasks: handlersStateRef.current.splitTasksVal,
|
||||||
|
},
|
||||||
|
column,
|
||||||
|
);
|
||||||
|
|
||||||
|
api.exec('update-task', {
|
||||||
|
id: id,
|
||||||
|
task: update,
|
||||||
});
|
});
|
||||||
return false;
|
}
|
||||||
});
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
tapi.on('resize-column', () => {
|
onTableAPIChange && onTableAPIChange(tapi);
|
||||||
handlersStateRef.current.setColumnWidth(true);
|
}, []);
|
||||||
});
|
|
||||||
|
|
||||||
tapi.on('hide-column', (ev) => {
|
|
||||||
if (!ev.mode) handlersStateRef.current.adjustColumns();
|
|
||||||
handlersStateRef.current.setColumnWidth();
|
|
||||||
});
|
|
||||||
|
|
||||||
tapi.intercept('update-cell', (e) => {
|
|
||||||
const { id, column, value } = e;
|
|
||||||
const task = handlersStateRef.current.tasks.find((t) => t.id === id);
|
|
||||||
|
|
||||||
if (task) {
|
|
||||||
const update = { ...task };
|
|
||||||
let v = value;
|
|
||||||
if (v && !isNaN(v) && !(v instanceof Date)) v *= 1;
|
|
||||||
update[column] = v;
|
|
||||||
|
|
||||||
normalizeDates(update, handlersStateRef.current.durationUnitVal, true, column);
|
|
||||||
|
|
||||||
api.exec('update-task', {
|
|
||||||
id: id,
|
|
||||||
task: update,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
onTableAPIChange && onTableAPIChange(tapi);
|
|
||||||
}, [],
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -553,8 +543,6 @@ export default function Grid(props) {
|
|||||||
ref={tableRef}
|
ref={tableRef}
|
||||||
style={tableStyle}
|
style={tableStyle}
|
||||||
className="wx-rHj6070p wx-table"
|
className="wx-rHj6070p wx-table"
|
||||||
onTouchStart={onTouchstart}
|
|
||||||
onTouchMove={onTouchmove}
|
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onDoubleClick={onDblClick}
|
onDoubleClick={onDblClick}
|
||||||
>
|
>
|
||||||
|
|||||||
40
src/helpers/debug.js
Normal file
40
src/helpers/debug.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { useRef, useEffect } from 'react';
|
||||||
|
|
||||||
|
const renderMetrics = new Map();
|
||||||
|
|
||||||
|
export function useRenderTime(label) {
|
||||||
|
const startTime = useRef(null);
|
||||||
|
const renderCount = useRef(0);
|
||||||
|
const rafRef = useRef(null);
|
||||||
|
|
||||||
|
const enabled =
|
||||||
|
typeof window !== 'undefined' && window.__RENDER_METRICS_ENABLED__;
|
||||||
|
|
||||||
|
if (startTime.current === null) {
|
||||||
|
startTime.current = performance.now();
|
||||||
|
}
|
||||||
|
renderCount.current++;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!enabled) return;
|
||||||
|
|
||||||
|
cancelAnimationFrame(rafRef.current);
|
||||||
|
|
||||||
|
rafRef.current = requestAnimationFrame(() => {
|
||||||
|
const metric = {
|
||||||
|
label,
|
||||||
|
time: performance.now() - startTime.current,
|
||||||
|
renders: renderCount.current,
|
||||||
|
timestamp: Date.now(),
|
||||||
|
};
|
||||||
|
|
||||||
|
renderMetrics.set(label, metric);
|
||||||
|
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent('render-metric', { detail: metric }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => cancelAnimationFrame(rafRef.current);
|
||||||
|
});
|
||||||
|
}
|
||||||
73
src/helpers/prepareConfig.js
Normal file
73
src/helpers/prepareConfig.js
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
import { dateToString } from '@svar-ui/lib-dom';
|
||||||
|
|
||||||
|
export function getUnitFormats(_) {
|
||||||
|
return {
|
||||||
|
year: '%Y',
|
||||||
|
quarter: `${_('Q')} %Q`,
|
||||||
|
month: '%M',
|
||||||
|
week: `${_('Week')} %w`,
|
||||||
|
day: '%M %j',
|
||||||
|
hour: '%H:%i',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeFormatter(value, calendarLocale) {
|
||||||
|
return typeof value === 'function'
|
||||||
|
? value
|
||||||
|
: dateToString(value, calendarLocale);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function prepareScales(scales, calendarLocale) {
|
||||||
|
return scales.map(({ format, ...scale }) => ({
|
||||||
|
...scale,
|
||||||
|
format: normalizeFormatter(format, calendarLocale),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function prepareFormats(calendarLocale, _) {
|
||||||
|
const formats = getUnitFormats(_);
|
||||||
|
for (let unit in formats) {
|
||||||
|
formats[unit] = dateToString(formats[unit], calendarLocale);
|
||||||
|
}
|
||||||
|
return formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function prepareColumns(columns, calendarLocale) {
|
||||||
|
if (!columns || !columns.length) return columns;
|
||||||
|
const format = dateToString('%d-%m-%Y', calendarLocale);
|
||||||
|
|
||||||
|
return columns.map((col) => {
|
||||||
|
if (col.template) return col;
|
||||||
|
|
||||||
|
if (col.id === 'start' || col.id == 'end') {
|
||||||
|
return {
|
||||||
|
...col,
|
||||||
|
//store locale template for unscheduled tasks
|
||||||
|
_template: (b) => format(b),
|
||||||
|
template: (b) => format(b),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (col.id === 'duration') {
|
||||||
|
return {
|
||||||
|
...col,
|
||||||
|
_template: (b) => b,
|
||||||
|
template: (b) => b,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return col;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function prepareZoom(zoom, calendarLocale) {
|
||||||
|
if (!zoom.levels) {
|
||||||
|
return zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...zoom,
|
||||||
|
levels: zoom.levels.map((level) => ({
|
||||||
|
...level,
|
||||||
|
scales: prepareScales(level.scales, calendarLocale),
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import Gantt from './components/Gantt.jsx';
|
import Gantt from './components/Gantt.jsx';
|
||||||
import Fullscreen from './components/Fullscreen.jsx';
|
|
||||||
import Toolbar from './components/Toolbar.jsx';
|
import Toolbar from './components/Toolbar.jsx';
|
||||||
import ContextMenu from './components/ContextMenu.jsx';
|
import ContextMenu from './components/ContextMenu.jsx';
|
||||||
import Editor from './components/Editor.jsx';
|
import Editor from './components/Editor.jsx';
|
||||||
@@ -17,6 +16,9 @@ export {
|
|||||||
defaultMenuOptions,
|
defaultMenuOptions,
|
||||||
defaultColumns,
|
defaultColumns,
|
||||||
defaultTaskTypes,
|
defaultTaskTypes,
|
||||||
|
getEditorItems,
|
||||||
|
getToolbarButtons,
|
||||||
|
getMenuOptions,
|
||||||
registerScaleUnit,
|
registerScaleUnit,
|
||||||
} from '@svar-ui/gantt-store';
|
} from '@svar-ui/gantt-store';
|
||||||
|
|
||||||
@@ -24,7 +26,6 @@ export { registerEditorItem } from '@svar-ui/react-editor';
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
Gantt,
|
Gantt,
|
||||||
Fullscreen,
|
|
||||||
ContextMenu,
|
ContextMenu,
|
||||||
HeaderMenu,
|
HeaderMenu,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
|
|||||||
@@ -9,23 +9,31 @@
|
|||||||
var(--wx-font-family);
|
var(--wx-font-family);
|
||||||
--wx-gantt-bar-border-radius: 50px;
|
--wx-gantt-bar-border-radius: 50px;
|
||||||
--wx-gantt-milestone-border-radius: 3px;
|
--wx-gantt-milestone-border-radius: 3px;
|
||||||
|
--wx-gantt-critical-color: #de3a3a;
|
||||||
|
|
||||||
--wx-gantt-task-color: #448aff;
|
--wx-gantt-task-color: #448aff;
|
||||||
--wx-gantt-task-font-color: #fff;
|
--wx-gantt-task-font-color: #fff;
|
||||||
--wx-gantt-task-fill-color: #246cd9;
|
--wx-gantt-task-fill-color: #246cd9;
|
||||||
--wx-gantt-task-border-color: #448aff;
|
--wx-gantt-task-border-color: #448aff;
|
||||||
--wx-gantt-task-border: 1px solid #246cd9;
|
--wx-gantt-task-border: 1px solid #246cd9;
|
||||||
|
--wx-gantt-task-critical-color: var(--wx-gantt-critical-color);
|
||||||
|
--wx-gantt-task-critical-fill-color: #c83434;
|
||||||
|
|
||||||
--wx-gantt-summary-color: #1de9b6;
|
--wx-gantt-summary-color: #1de9b6;
|
||||||
--wx-gantt-summary-font-color: #5f5f5f;
|
--wx-gantt-summary-font-color: #5f5f5f;
|
||||||
--wx-gantt-summary-fill-color: #00d19a;
|
--wx-gantt-summary-fill-color: #00d19a;
|
||||||
--wx-gantt-summary-border-color: #1de9b6;
|
--wx-gantt-summary-border-color: #1de9b6;
|
||||||
--wx-gantt-summary-border: 1px solid #00d19a;
|
--wx-gantt-summary-border: 1px solid #00d19a;
|
||||||
|
--wx-gantt-summary-critical-color: #d9306f;
|
||||||
|
--wx-gantt-summary-critical-fill-color: #c32b64;
|
||||||
|
|
||||||
--wx-gantt-milestone-color: #d33daf;
|
--wx-gantt-milestone-color: #d33daf;
|
||||||
|
|
||||||
--wx-gantt-select-color: rgb(201, 244, 240);
|
--wx-gantt-select-color: rgb(201, 244, 240);
|
||||||
--wx-gantt-link-color: #87a4bc;
|
--wx-gantt-link-color: #87a4bc;
|
||||||
|
--wx-gantt-link-color-hovered: #6e777d;
|
||||||
|
--wx-gantt-link-critical-color: var(--wx-gantt-critical-color);
|
||||||
|
--wx-gantt-link-critical-color-hovered: #b22e2e;
|
||||||
--wx-gantt-link-marker-background: #f0f0f0;
|
--wx-gantt-link-marker-background: #f0f0f0;
|
||||||
--wx-gantt-link-marker-color: #87a4bc;
|
--wx-gantt-link-marker-color: #87a4bc;
|
||||||
|
|
||||||
@@ -52,7 +60,6 @@
|
|||||||
/* timescale */
|
/* timescale */
|
||||||
--wx-timescale-font: 500 12px Roboto;
|
--wx-timescale-font: 500 12px Roboto;
|
||||||
--wx-timescale-font-color: #a6a6a6;
|
--wx-timescale-font-color: #a6a6a6;
|
||||||
--wx-timescale-text-transform: uppercase;
|
|
||||||
--wx-timescale-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1),
|
--wx-timescale-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1),
|
||||||
0px 1px 2px rgba(0, 0, 0, 0.1);
|
0px 1px 2px rgba(0, 0, 0, 0.1);
|
||||||
--wx-timescale-border: 1px solid transparent;
|
--wx-timescale-border: 1px solid transparent;
|
||||||
@@ -87,23 +94,31 @@
|
|||||||
var(--wx-font-family);
|
var(--wx-font-family);
|
||||||
--wx-gantt-bar-border-radius: 50px;
|
--wx-gantt-bar-border-radius: 50px;
|
||||||
--wx-gantt-milestone-border-radius: 3px;
|
--wx-gantt-milestone-border-radius: 3px;
|
||||||
|
--wx-gantt-critical-color: #de3a3a;
|
||||||
|
|
||||||
--wx-gantt-task-color: #448aff;
|
--wx-gantt-task-color: #448aff;
|
||||||
--wx-gantt-task-font-color: #fff;
|
--wx-gantt-task-font-color: #fff;
|
||||||
--wx-gantt-task-fill-color: #246cd9;
|
--wx-gantt-task-fill-color: #246cd9;
|
||||||
--wx-gantt-task-border-color: #448aff;
|
--wx-gantt-task-border-color: #448aff;
|
||||||
--wx-gantt-task-border: 1px solid #246cd9;
|
--wx-gantt-task-border: 1px solid #246cd9;
|
||||||
|
--wx-gantt-task-critical-color: var(--wx-gantt-critical-color);
|
||||||
|
--wx-gantt-task-critical-fill-color: #c83434;
|
||||||
|
|
||||||
--wx-gantt-summary-color: #1de9b6;
|
--wx-gantt-summary-color: #1de9b6;
|
||||||
--wx-gantt-summary-font-color: #5f5f5f;
|
--wx-gantt-summary-font-color: #5f5f5f;
|
||||||
--wx-gantt-summary-fill-color: #00d19a;
|
--wx-gantt-summary-fill-color: #00d19a;
|
||||||
--wx-gantt-summary-border-color: #1de9b6;
|
--wx-gantt-summary-border-color: #1de9b6;
|
||||||
--wx-gantt-summary-border: 1px solid #00d19a;
|
--wx-gantt-summary-border: 1px solid #00d19a;
|
||||||
|
--wx-gantt-summary-critical-color: #d9306f;
|
||||||
|
--wx-gantt-summary-critical-fill-color: #c32b64;
|
||||||
|
|
||||||
--wx-gantt-milestone-color: #d33daf;
|
--wx-gantt-milestone-color: #d33daf;
|
||||||
|
|
||||||
--wx-gantt-select-color: rgb(201, 244, 240);
|
--wx-gantt-select-color: rgb(201, 244, 240);
|
||||||
--wx-gantt-link-color: #87a4bc;
|
--wx-gantt-link-color: #87a4bc;
|
||||||
|
--wx-gantt-link-color-hovered: #6e777d;
|
||||||
|
--wx-gantt-link-critical-color: var(--wx-gantt-critical-color);
|
||||||
|
--wx-gantt-link-critical-color-hovered: #b22e2e;
|
||||||
--wx-gantt-link-marker-background: #f0f0f0;
|
--wx-gantt-link-marker-background: #f0f0f0;
|
||||||
--wx-gantt-link-marker-color: #87a4bc;
|
--wx-gantt-link-marker-color: #87a4bc;
|
||||||
|
|
||||||
@@ -130,7 +145,6 @@
|
|||||||
/* timescale */
|
/* timescale */
|
||||||
--wx-timescale-font: 500 12px Roboto;
|
--wx-timescale-font: 500 12px Roboto;
|
||||||
--wx-timescale-font-color: #a6a6a6;
|
--wx-timescale-font-color: #a6a6a6;
|
||||||
--wx-timescale-text-transform: uppercase;
|
|
||||||
--wx-timescale-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1),
|
--wx-timescale-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1),
|
||||||
0px 1px 2px rgba(0, 0, 0, 0.1);
|
0px 1px 2px rgba(0, 0, 0, 0.1);
|
||||||
--wx-timescale-border: 1px solid transparent;
|
--wx-timescale-border: 1px solid transparent;
|
||||||
|
|||||||
@@ -9,23 +9,31 @@
|
|||||||
var(--wx-font-family);
|
var(--wx-font-family);
|
||||||
--wx-gantt-bar-border-radius: 3px;
|
--wx-gantt-bar-border-radius: 3px;
|
||||||
--wx-gantt-milestone-border-radius: 3px;
|
--wx-gantt-milestone-border-radius: 3px;
|
||||||
|
--wx-gantt-critical-color: #de3a3a;
|
||||||
|
|
||||||
--wx-gantt-task-color: #3983eb;
|
--wx-gantt-task-color: #3983eb;
|
||||||
--wx-gantt-task-font-color: #fff;
|
--wx-gantt-task-font-color: #fff;
|
||||||
--wx-gantt-task-fill-color: #1f6bd9;
|
--wx-gantt-task-fill-color: #1f6bd9;
|
||||||
--wx-gantt-task-border-color: #1f6bd9;
|
--wx-gantt-task-border-color: #1f6bd9;
|
||||||
--wx-gantt-task-border: 1px solid transparent;
|
--wx-gantt-task-border: 1px solid transparent;
|
||||||
|
--wx-gantt-task-critical-color: var(--wx-gantt-critical-color);
|
||||||
|
--wx-gantt-task-critical-fill-color: #c83434;
|
||||||
|
|
||||||
--wx-gantt-summary-color: #00ba94;
|
--wx-gantt-summary-color: #00ba94;
|
||||||
--wx-gantt-summary-font-color: #ffffff;
|
--wx-gantt-summary-font-color: #ffffff;
|
||||||
--wx-gantt-summary-fill-color: #099f81;
|
--wx-gantt-summary-fill-color: #099f81;
|
||||||
--wx-gantt-summary-border-color: #099f81;
|
--wx-gantt-summary-border-color: #099f81;
|
||||||
--wx-gantt-summary-border: 1px solid transparent;
|
--wx-gantt-summary-border: 1px solid transparent;
|
||||||
|
--wx-gantt-summary-critical-color: #d9306f;
|
||||||
|
--wx-gantt-summary-critical-fill-color: #c32b64;
|
||||||
|
|
||||||
--wx-gantt-milestone-color: #ad44ab;
|
--wx-gantt-milestone-color: #ad44ab;
|
||||||
|
|
||||||
--wx-gantt-select-color: #eaedf5;
|
--wx-gantt-select-color: #eaedf5;
|
||||||
--wx-gantt-link-color: #9fa1ae;
|
--wx-gantt-link-color: #9fa1ae;
|
||||||
|
--wx-gantt-link-color-hovered: #6e777d;
|
||||||
|
--wx-gantt-link-critical-color: var(--wx-gantt-critical-color);
|
||||||
|
--wx-gantt-link-critical-color-hovered: #b22e2e;
|
||||||
--wx-gantt-link-marker-background: #eaedf5;
|
--wx-gantt-link-marker-background: #eaedf5;
|
||||||
--wx-gantt-link-marker-color: #9fa1ae;
|
--wx-gantt-link-marker-color: #9fa1ae;
|
||||||
|
|
||||||
@@ -54,7 +62,6 @@
|
|||||||
--wx-timescale-font: var(--wx-font-weight-md) var(--wx-font-size-sm)
|
--wx-timescale-font: var(--wx-font-weight-md) var(--wx-font-size-sm)
|
||||||
var(--wx-font-family);
|
var(--wx-font-family);
|
||||||
--wx-timescale-font-color: var(--wx-color-font);
|
--wx-timescale-font-color: var(--wx-color-font);
|
||||||
--wx-timescale-text-transform: uppercase;
|
|
||||||
--wx-timescale-shadow: none;
|
--wx-timescale-shadow: none;
|
||||||
--wx-timescale-border: var(--wx-gantt-border);
|
--wx-timescale-border: var(--wx-gantt-border);
|
||||||
|
|
||||||
|
|||||||
@@ -11,18 +11,23 @@
|
|||||||
var(--wx-font-family);
|
var(--wx-font-family);
|
||||||
--wx-gantt-bar-border-radius: 3px;
|
--wx-gantt-bar-border-radius: 3px;
|
||||||
--wx-gantt-milestone-border-radius: 3px;
|
--wx-gantt-milestone-border-radius: 3px;
|
||||||
|
--wx-gantt-critical-color: #de3a3a;
|
||||||
|
|
||||||
--wx-gantt-task-color: #37a9ef;
|
--wx-gantt-task-color: #37a9ef;
|
||||||
--wx-gantt-task-font-color: #ffffffe5;
|
--wx-gantt-task-font-color: #ffffffe5;
|
||||||
--wx-gantt-task-fill-color: #098cdc;
|
--wx-gantt-task-fill-color: #098cdc;
|
||||||
--wx-gantt-task-border-color: #098cdc;
|
--wx-gantt-task-border-color: #098cdc;
|
||||||
--wx-gantt-task-border: 1px solid transparent;
|
--wx-gantt-task-border: 1px solid transparent;
|
||||||
|
--wx-gantt-task-critical-color: var(--wx-gantt-critical-color);
|
||||||
|
--wx-gantt-task-critical-fill-color: #c83434;
|
||||||
|
|
||||||
--wx-gantt-summary-color: #00ba94;
|
--wx-gantt-summary-color: #00ba94;
|
||||||
--wx-gantt-summary-font-color: #ffffffe5;
|
--wx-gantt-summary-font-color: #ffffffe5;
|
||||||
--wx-gantt-summary-fill-color: #099f81;
|
--wx-gantt-summary-fill-color: #099f81;
|
||||||
--wx-gantt-summary-border-color: #099f81;
|
--wx-gantt-summary-border-color: #099f81;
|
||||||
--wx-gantt-summary-border: 1px solid transparent;
|
--wx-gantt-summary-border: 1px solid transparent;
|
||||||
|
--wx-gantt-summary-critical-color: #d9306f;
|
||||||
|
--wx-gantt-summary-critical-fill-color: #c32b64;
|
||||||
|
|
||||||
--wx-gantt-progress-marker-height: 26px;
|
--wx-gantt-progress-marker-height: 26px;
|
||||||
--wx-gantt-progress-border-color: #4b5359;
|
--wx-gantt-progress-border-color: #4b5359;
|
||||||
@@ -37,6 +42,9 @@
|
|||||||
|
|
||||||
--wx-gantt-select-color: #384047;
|
--wx-gantt-select-color: #384047;
|
||||||
--wx-gantt-link-color: #9fa1ae;
|
--wx-gantt-link-color: #9fa1ae;
|
||||||
|
--wx-gantt-link-color-hovered: #c8c7cf;
|
||||||
|
--wx-gantt-link-critical-color: var(--wx-gantt-critical-color);
|
||||||
|
--wx-gantt-link-critical-color-hovered: #b22e2e;
|
||||||
--wx-gantt-link-marker-background: #384047;
|
--wx-gantt-link-marker-background: #384047;
|
||||||
--wx-gantt-link-marker-color: #9fa1ae;
|
--wx-gantt-link-marker-color: #9fa1ae;
|
||||||
|
|
||||||
@@ -57,7 +65,6 @@
|
|||||||
--wx-timescale-font: var(--wx-font-weight-md) var(--wx-font-size-sm)
|
--wx-timescale-font: var(--wx-font-weight-md) var(--wx-font-size-sm)
|
||||||
var(--wx-font-family);
|
var(--wx-font-family);
|
||||||
--wx-timescale-font-color: var(--wx-color-font);
|
--wx-timescale-font-color: var(--wx-color-font);
|
||||||
--wx-timescale-text-transform: uppercase;
|
|
||||||
--wx-timescale-shadow: none;
|
--wx-timescale-shadow: none;
|
||||||
--wx-timescale-border: var(--wx-border);
|
--wx-timescale-border: var(--wx-border);
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
...rollupOptions,
|
...rollupOptions,
|
||||||
external: [
|
external: [
|
||||||
...rollupOptions.external,
|
...rollupOptions.external,
|
||||||
/^@wx\//, // matches all modules starting with "@svar-ui/"
|
/^@wx\//, // matches all modules starting with "@wx/"
|
||||||
/^@svar-ui\//, // matches all modules starting with "@svar-ui/"
|
/^@svar-ui\//, // matches all modules starting with "@wx/"
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,6 +66,7 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
return {
|
return {
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
build: {
|
build: {
|
||||||
|
sourcemap: true,
|
||||||
lib: {
|
lib: {
|
||||||
//eslint-disable-next-line no-undef
|
//eslint-disable-next-line no-undef
|
||||||
entry: resolve(__dirname, 'src/index.js'),
|
entry: resolve(__dirname, 'src/index.js'),
|
||||||
|
|||||||
36
whatsnew.md
36
whatsnew.md
@@ -1,3 +1,39 @@
|
|||||||
|
## Version 2.4.3
|
||||||
|
|
||||||
|
Community license changed from GPL to MIT
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
- Ability to remove links from Chart UI
|
||||||
|
- Locale-based scale formatting
|
||||||
|
|
||||||
|
### Pro edition features
|
||||||
|
|
||||||
|
- Basic auto scheduling
|
||||||
|
- Handling of invalid links
|
||||||
|
- Critical path calculation
|
||||||
|
- Global calendar to define working schedule
|
||||||
|
- Unscheduled tasks
|
||||||
|
- Vertical markers on timeline
|
||||||
|
- Baselines
|
||||||
|
- Split tasks
|
||||||
|
- Undo/redo
|
||||||
|
|
||||||
|
### Updates
|
||||||
|
|
||||||
|
- Resizer line can be dragged to expand current display mode
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- Summary task size is sometimes incorrect while dragging
|
||||||
|
- ContextMenu css cannot be set
|
||||||
|
- Editing tasks breakes dynamic width of narrow scales cells
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
- Scales format string is changed from date-fns to SVAR locale
|
||||||
|
- Fullscreen helper is moved to SVAR Svelte Core
|
||||||
|
|
||||||
## Version 2.3.4
|
## Version 2.3.4
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|||||||
Reference in New Issue
Block a user