ywana-core8 0.0.241 → 0.0.242
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +240 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +186 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +240 -2
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +242 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/site/page.css +1 -0
- package/src/site/site.css +1 -0
- package/src/widgets/index.js +2 -1
package/dist/index.modern.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import 'material-design-icons-iconfont/dist/material-design-icons.css';
|
2
|
-
import React, { useContext, useState, useEffect, Fragment, useRef,
|
2
|
+
import React, { useContext, useState, useEffect, Fragment, useRef, useMemo, Children } from 'react';
|
3
3
|
import RSwitch from 'react-switch';
|
4
|
+
import moment from 'moment';
|
5
|
+
import { extendMoment } from 'moment-range';
|
4
6
|
import { NotificationContainer, NotificationManager } from 'react-notifications';
|
5
7
|
import 'react-notifications/lib/notifications.css';
|
6
8
|
import equal from 'deep-equal';
|
@@ -2321,6 +2323,242 @@ var WaitScreen = function WaitScreen() {
|
|
2321
2323
|
}));
|
2322
2324
|
};
|
2323
2325
|
|
2326
|
+
var ranges = extendMoment(moment);
|
2327
|
+
var DATE_RANGE = [{
|
2328
|
+
label: "Week",
|
2329
|
+
value: "week"
|
2330
|
+
}, {
|
2331
|
+
label: "Month",
|
2332
|
+
value: "month"
|
2333
|
+
}];
|
2334
|
+
/**
|
2335
|
+
* Planner
|
2336
|
+
*/
|
2337
|
+
|
2338
|
+
var Planner = function Planner(_ref) {
|
2339
|
+
var title = _ref.title,
|
2340
|
+
_ref$events = _ref.events,
|
2341
|
+
events = _ref$events === void 0 ? [] : _ref$events,
|
2342
|
+
_ref$lanes = _ref.lanes,
|
2343
|
+
lanes = _ref$lanes === void 0 ? [] : _ref$lanes,
|
2344
|
+
_ref$navigation = _ref.navigation,
|
2345
|
+
navigation = _ref$navigation === void 0 ? true : _ref$navigation;
|
2346
|
+
|
2347
|
+
var _useState = useState("month"),
|
2348
|
+
dateRange = _useState[0],
|
2349
|
+
setDateRange = _useState[1];
|
2350
|
+
|
2351
|
+
var _useState2 = useState("2021-02-26"),
|
2352
|
+
from = _useState2[0],
|
2353
|
+
setFrom = _useState2[1];
|
2354
|
+
|
2355
|
+
var _useState3 = useState("2021-04-01"),
|
2356
|
+
to = _useState3[0],
|
2357
|
+
setTo = _useState3[1];
|
2358
|
+
|
2359
|
+
useEffect(function () {
|
2360
|
+
var today = moment();
|
2361
|
+
var from_date = today.startOf(dateRange).format("YYYY-MM-DD");
|
2362
|
+
var to_date = today.endOf(dateRange).format("YYYY-MM-DD");
|
2363
|
+
setFrom(from_date);
|
2364
|
+
setTo(to_date);
|
2365
|
+
}, [dateRange]);
|
2366
|
+
|
2367
|
+
function next() {
|
2368
|
+
var actual = moment(from);
|
2369
|
+
var next = actual.add(1, dateRange);
|
2370
|
+
var from_date = next.startOf(dateRange).format("YYYY-MM-DD");
|
2371
|
+
var to_date = next.endOf(dateRange).format("YYYY-MM-DD");
|
2372
|
+
setFrom(from_date);
|
2373
|
+
setTo(to_date);
|
2374
|
+
}
|
2375
|
+
|
2376
|
+
function prev() {
|
2377
|
+
var actual = moment(from);
|
2378
|
+
var next = actual.subtract(1, dateRange);
|
2379
|
+
var from_date = next.startOf(dateRange).format("YYYY-MM-DD");
|
2380
|
+
var to_date = next.endOf(dateRange).format("YYYY-MM-DD");
|
2381
|
+
setFrom(from_date);
|
2382
|
+
setTo(to_date);
|
2383
|
+
}
|
2384
|
+
|
2385
|
+
var period = useMemo(function () {
|
2386
|
+
var start = ranges(from, "YYYY-MM-DD");
|
2387
|
+
var end = ranges(to, "YYYY-MM-DD");
|
2388
|
+
var range = ranges.range(start, end);
|
2389
|
+
var period = Array.from(range.by("day")).map(function (m) {
|
2390
|
+
return {
|
2391
|
+
year: m.year(),
|
2392
|
+
month: m.month(),
|
2393
|
+
day: m.date(),
|
2394
|
+
moment: m
|
2395
|
+
};
|
2396
|
+
});
|
2397
|
+
return period;
|
2398
|
+
}, [from, to]);
|
2399
|
+
var label = /*#__PURE__*/React.createElement(Text$1, {
|
2400
|
+
use: "headline6"
|
2401
|
+
}, title);
|
2402
|
+
return /*#__PURE__*/React.createElement("div", {
|
2403
|
+
className: "planner-box"
|
2404
|
+
}, navigation ? /*#__PURE__*/React.createElement(Header, {
|
2405
|
+
title: label
|
2406
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
2407
|
+
icon: "chevron_right",
|
2408
|
+
clickable: true,
|
2409
|
+
action: next
|
2410
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
2411
|
+
id: "to",
|
2412
|
+
type: "date",
|
2413
|
+
label: "To",
|
2414
|
+
value: to,
|
2415
|
+
onChange: function onChange(id, value) {
|
2416
|
+
return setTo(value);
|
2417
|
+
}
|
2418
|
+
}), /*#__PURE__*/React.createElement("div", {
|
2419
|
+
className: "expand"
|
2420
|
+
}), /*#__PURE__*/React.createElement(DropDown, {
|
2421
|
+
id: "ranges",
|
2422
|
+
label: "Date Range",
|
2423
|
+
options: DATE_RANGE,
|
2424
|
+
value: dateRange,
|
2425
|
+
onChange: function onChange(id, value) {
|
2426
|
+
return setDateRange(value);
|
2427
|
+
}
|
2428
|
+
}), /*#__PURE__*/React.createElement("div", {
|
2429
|
+
className: "expand"
|
2430
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
2431
|
+
id: "from",
|
2432
|
+
type: "date",
|
2433
|
+
label: "From",
|
2434
|
+
value: from,
|
2435
|
+
onChange: function onChange(id, value) {
|
2436
|
+
return setFrom(value);
|
2437
|
+
}
|
2438
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
2439
|
+
icon: "chevron_left",
|
2440
|
+
clickable: true,
|
2441
|
+
action: prev
|
2442
|
+
})) : null, /*#__PURE__*/React.createElement("main", {
|
2443
|
+
className: "planner"
|
2444
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2445
|
+
className: "column0"
|
2446
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2447
|
+
className: "column-header"
|
2448
|
+
}), lanes.map(function (lane) {
|
2449
|
+
return /*#__PURE__*/React.createElement("div", {
|
2450
|
+
className: "row-header"
|
2451
|
+
}, lane.label);
|
2452
|
+
})), /*#__PURE__*/React.createElement("div", {
|
2453
|
+
className: "rows"
|
2454
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2455
|
+
className: "row row0"
|
2456
|
+
}, period.map(function (date, index) {
|
2457
|
+
var first = index === 0 || date.day === 1 ? "first" : "";
|
2458
|
+
return /*#__PURE__*/React.createElement("div", {
|
2459
|
+
className: "column-header"
|
2460
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2461
|
+
className: "month-header " + first
|
2462
|
+
}, /*#__PURE__*/React.createElement(Text$1, {
|
2463
|
+
use: "overline"
|
2464
|
+
}, date.moment.format("MMM"))));
|
2465
|
+
})), /*#__PURE__*/React.createElement("div", {
|
2466
|
+
className: "row row1"
|
2467
|
+
}, period.map(function (date) {
|
2468
|
+
var isWekend = [0, 6].includes(date.moment.day());
|
2469
|
+
var weekend = isWekend ? "weekend" : "";
|
2470
|
+
return /*#__PURE__*/React.createElement("div", {
|
2471
|
+
className: "column-header"
|
2472
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2473
|
+
className: "date-header " + weekend
|
2474
|
+
}, /*#__PURE__*/React.createElement(Text$1, {
|
2475
|
+
use: "headline6"
|
2476
|
+
}, date.moment.format("DD")), "\xA0", /*#__PURE__*/React.createElement(Text$1, {
|
2477
|
+
use: "caption"
|
2478
|
+
}, date.moment.format("ddd"))));
|
2479
|
+
})), lanes.map(function (lane) {
|
2480
|
+
return /*#__PURE__*/React.createElement(PlannerRow, {
|
2481
|
+
lane: lane,
|
2482
|
+
events: events,
|
2483
|
+
period: period
|
2484
|
+
});
|
2485
|
+
}))));
|
2486
|
+
};
|
2487
|
+
/**
|
2488
|
+
* Planner Row
|
2489
|
+
*/
|
2490
|
+
|
2491
|
+
var PlannerRow = function PlannerRow(props) {
|
2492
|
+
var lane = props.lane,
|
2493
|
+
_props$events = props.events,
|
2494
|
+
events = _props$events === void 0 ? [] : _props$events,
|
2495
|
+
period = props.period;
|
2496
|
+
var rowEvents = events.filter(function (event) {
|
2497
|
+
return event.lane === lane.id;
|
2498
|
+
});
|
2499
|
+
return /*#__PURE__*/React.createElement("div", {
|
2500
|
+
className: "row"
|
2501
|
+
}, period.map(function (date) {
|
2502
|
+
var slotDate = new Date(date.year, date.month, date.day);
|
2503
|
+
slotDate.setHours(0, 0, 0);
|
2504
|
+
var cellEvents = rowEvents.filter(function (event) {
|
2505
|
+
var eventDate = new Date(event.date);
|
2506
|
+
eventDate.setHours(0, 0, 0);
|
2507
|
+
return eventDate.getTime() === slotDate.getTime();
|
2508
|
+
});
|
2509
|
+
return /*#__PURE__*/React.createElement(PlannerCell, {
|
2510
|
+
date: date,
|
2511
|
+
events: cellEvents
|
2512
|
+
});
|
2513
|
+
}));
|
2514
|
+
};
|
2515
|
+
/**
|
2516
|
+
* Planner Cell
|
2517
|
+
*/
|
2518
|
+
|
2519
|
+
|
2520
|
+
var PlannerCell = function PlannerCell(_ref3) {
|
2521
|
+
var lane = _ref3.lane,
|
2522
|
+
date = _ref3.date,
|
2523
|
+
onDrop = _ref3.onDrop;
|
2524
|
+
|
2525
|
+
var _useState4 = useState(false),
|
2526
|
+
dragOver = _useState4[0],
|
2527
|
+
setDragOver = _useState4[1];
|
2528
|
+
|
2529
|
+
function onDragOver(event) {
|
2530
|
+
if (!dragOver) setDragOver(true);
|
2531
|
+
event.stopPropagation();
|
2532
|
+
event.preventDefault();
|
2533
|
+
}
|
2534
|
+
|
2535
|
+
function onDragLeave(event) {
|
2536
|
+
setDragOver(false);
|
2537
|
+
event.stopPropagation();
|
2538
|
+
event.preventDefault();
|
2539
|
+
}
|
2540
|
+
|
2541
|
+
function drop(event) {
|
2542
|
+
event.stopPropagation();
|
2543
|
+
event.preventDefault();
|
2544
|
+
var id = event.dataTransfer.getData("text");
|
2545
|
+
if (onDrop) onDrop({
|
2546
|
+
id: id,
|
2547
|
+
lane: lane.id,
|
2548
|
+
date: date.moment.format("YYYY-MM-DD")
|
2549
|
+
});
|
2550
|
+
}
|
2551
|
+
|
2552
|
+
var isWekend = [0, 6].includes(date.moment.day());
|
2553
|
+
var weekend = isWekend ? "weekend" : "";
|
2554
|
+
return /*#__PURE__*/React.createElement("div", {
|
2555
|
+
className: "cell " + weekend,
|
2556
|
+
onDragOver: onDragOver,
|
2557
|
+
onDragLeave: onDragLeave,
|
2558
|
+
onDrop: drop
|
2559
|
+
}, "c");
|
2560
|
+
};
|
2561
|
+
|
2324
2562
|
/**
|
2325
2563
|
* Page Context
|
2326
2564
|
*/
|
@@ -5501,5 +5739,5 @@ var isFunction = function isFunction(value) {
|
|
5501
5739
|
return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
|
5502
5740
|
};
|
5503
5741
|
|
5504
|
-
export { Avatar, Button$1 as Button, CheckBox, Chip, Chips, CircularProgress, CollectionContext, CollectionEditor$1 as CollectionEditor, CollectionPage, Content, ContentEditor, ContentForm, CreateContentDialog$1 as CreateContentDialog, DataTable, Dialog, DropDown, EditContentDialog, FORMATS, FieldEditor, Form, HTTPClient, Header, Icon, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, Page, PageContext, PageProvider, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, TYPES, Tab, TabbedContentEditor, TablePage, Tabs, Text$1 as Text, TextArea, TextField, Thumbnail, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadButton, UploadDialog, UploadFile, Uploader, Viewer, WaitScreen, isFunction };
|
5742
|
+
export { Avatar, Button$1 as Button, CheckBox, Chip, Chips, CircularProgress, CollectionContext, CollectionEditor$1 as CollectionEditor, CollectionPage, Content, ContentEditor, ContentForm, CreateContentDialog$1 as CreateContentDialog, DataTable, Dialog, DropDown, EditContentDialog, FORMATS, FieldEditor, Form, HTTPClient, Header, Icon, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, Page, PageContext, PageProvider, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, TYPES, Tab, TabbedContentEditor, TablePage, Tabs, Text$1 as Text, TextArea, TextField, Thumbnail, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadButton, UploadDialog, UploadFile, Uploader, Viewer, WaitScreen, isFunction };
|
5505
5743
|
//# sourceMappingURL=index.modern.js.map
|