ywana-core8 0.0.241 → 0.0.245
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 +278 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +207 -3
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +278 -11
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +280 -13
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/property.css +21 -3
- package/src/html/property.js +19 -3
- package/src/html/property.test.js +23 -0
- package/src/html/textfield.js +3 -3
- package/src/html/textfield.test.js +12 -4
- package/src/site/page.css +1 -0
- package/src/site/site.css +1 -0
- package/src/widgets/index.js +2 -1
- package/src/widgets/login/LoginBox.test.js +11 -0
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';
|
@@ -697,16 +699,45 @@ var LinearProgress = function LinearProgress(props) {
|
|
697
699
|
*/
|
698
700
|
|
699
701
|
var Property = function Property(props) {
|
700
|
-
var
|
702
|
+
var id = props.id,
|
703
|
+
className = props.className,
|
704
|
+
label = props.label,
|
701
705
|
name = props.name,
|
702
|
-
|
706
|
+
initial = props.initial,
|
707
|
+
value = props.value,
|
708
|
+
_props$editable = props.editable,
|
709
|
+
editable = _props$editable === void 0 ? false : _props$editable,
|
710
|
+
onChange = props.onChange;
|
711
|
+
|
712
|
+
function change(event) {
|
713
|
+
if (onChange) {
|
714
|
+
var _value = event.target.value;
|
715
|
+
onChange(id, _value);
|
716
|
+
}
|
717
|
+
}
|
718
|
+
|
719
|
+
function clear() {
|
720
|
+
if (onChange) onChange(id, "");
|
721
|
+
}
|
722
|
+
|
703
723
|
return /*#__PURE__*/React.createElement("div", {
|
704
|
-
className: "property"
|
724
|
+
className: "property property-" + id + " " + className
|
705
725
|
}, /*#__PURE__*/React.createElement("div", {
|
706
726
|
className: "property-name"
|
707
|
-
}, name || label), /*#__PURE__*/React.createElement("div", {
|
727
|
+
}, name || label), initial ? /*#__PURE__*/React.createElement("div", {
|
728
|
+
className: "property-value"
|
729
|
+
}, initial) : null, /*#__PURE__*/React.createElement("div", {
|
708
730
|
className: "property-value"
|
709
|
-
},
|
731
|
+
}, editable ? /*#__PURE__*/React.createElement("input", {
|
732
|
+
type: "text",
|
733
|
+
value: value,
|
734
|
+
onChange: change
|
735
|
+
}) : value, editable && value.length > 0 ? /*#__PURE__*/React.createElement(Icon, {
|
736
|
+
icon: "close",
|
737
|
+
size: "small",
|
738
|
+
clickable: true,
|
739
|
+
action: clear
|
740
|
+
}) : null));
|
710
741
|
};
|
711
742
|
|
712
743
|
/**
|
@@ -1000,8 +1031,8 @@ var DropDown = function DropDown(props) {
|
|
1000
1031
|
options = _props$options === void 0 ? [] : _props$options,
|
1001
1032
|
value = props.value,
|
1002
1033
|
onChange = props.onChange,
|
1003
|
-
_props$
|
1004
|
-
|
1034
|
+
_props$predictive = props.predictive,
|
1035
|
+
predictive = _props$predictive === void 0 ? false : _props$predictive,
|
1005
1036
|
_props$readOnly3 = props.readOnly,
|
1006
1037
|
readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3;
|
1007
1038
|
|
@@ -1026,7 +1057,7 @@ var DropDown = function DropDown(props) {
|
|
1026
1057
|
}, [value]);
|
1027
1058
|
|
1028
1059
|
function change(id, value) {
|
1029
|
-
if (
|
1060
|
+
if (predictive) {
|
1030
1061
|
setLabel(value);
|
1031
1062
|
} else {
|
1032
1063
|
if (onChange) onChange(id, value);
|
@@ -1059,7 +1090,7 @@ var DropDown = function DropDown(props) {
|
|
1059
1090
|
var canShow = open == true && Array.isArray(options);
|
1060
1091
|
|
1061
1092
|
if (canShow) {
|
1062
|
-
var filterActive =
|
1093
|
+
var filterActive = predictive === true && label && label.length > 0;
|
1063
1094
|
var items = filterActive ? options.filter(function (option) {
|
1064
1095
|
return option.label.toUpperCase().indexOf(label.toUpperCase()) >= 0;
|
1065
1096
|
}) : options;
|
@@ -2321,6 +2352,242 @@ var WaitScreen = function WaitScreen() {
|
|
2321
2352
|
}));
|
2322
2353
|
};
|
2323
2354
|
|
2355
|
+
var ranges = extendMoment(moment);
|
2356
|
+
var DATE_RANGE = [{
|
2357
|
+
label: "Week",
|
2358
|
+
value: "week"
|
2359
|
+
}, {
|
2360
|
+
label: "Month",
|
2361
|
+
value: "month"
|
2362
|
+
}];
|
2363
|
+
/**
|
2364
|
+
* Planner
|
2365
|
+
*/
|
2366
|
+
|
2367
|
+
var Planner = function Planner(_ref) {
|
2368
|
+
var title = _ref.title,
|
2369
|
+
_ref$events = _ref.events,
|
2370
|
+
events = _ref$events === void 0 ? [] : _ref$events,
|
2371
|
+
_ref$lanes = _ref.lanes,
|
2372
|
+
lanes = _ref$lanes === void 0 ? [] : _ref$lanes,
|
2373
|
+
_ref$navigation = _ref.navigation,
|
2374
|
+
navigation = _ref$navigation === void 0 ? true : _ref$navigation;
|
2375
|
+
|
2376
|
+
var _useState = useState("month"),
|
2377
|
+
dateRange = _useState[0],
|
2378
|
+
setDateRange = _useState[1];
|
2379
|
+
|
2380
|
+
var _useState2 = useState("2021-02-26"),
|
2381
|
+
from = _useState2[0],
|
2382
|
+
setFrom = _useState2[1];
|
2383
|
+
|
2384
|
+
var _useState3 = useState("2021-04-01"),
|
2385
|
+
to = _useState3[0],
|
2386
|
+
setTo = _useState3[1];
|
2387
|
+
|
2388
|
+
useEffect(function () {
|
2389
|
+
var today = moment();
|
2390
|
+
var from_date = today.startOf(dateRange).format("YYYY-MM-DD");
|
2391
|
+
var to_date = today.endOf(dateRange).format("YYYY-MM-DD");
|
2392
|
+
setFrom(from_date);
|
2393
|
+
setTo(to_date);
|
2394
|
+
}, [dateRange]);
|
2395
|
+
|
2396
|
+
function next() {
|
2397
|
+
var actual = moment(from);
|
2398
|
+
var next = actual.add(1, dateRange);
|
2399
|
+
var from_date = next.startOf(dateRange).format("YYYY-MM-DD");
|
2400
|
+
var to_date = next.endOf(dateRange).format("YYYY-MM-DD");
|
2401
|
+
setFrom(from_date);
|
2402
|
+
setTo(to_date);
|
2403
|
+
}
|
2404
|
+
|
2405
|
+
function prev() {
|
2406
|
+
var actual = moment(from);
|
2407
|
+
var next = actual.subtract(1, dateRange);
|
2408
|
+
var from_date = next.startOf(dateRange).format("YYYY-MM-DD");
|
2409
|
+
var to_date = next.endOf(dateRange).format("YYYY-MM-DD");
|
2410
|
+
setFrom(from_date);
|
2411
|
+
setTo(to_date);
|
2412
|
+
}
|
2413
|
+
|
2414
|
+
var period = useMemo(function () {
|
2415
|
+
var start = ranges(from, "YYYY-MM-DD");
|
2416
|
+
var end = ranges(to, "YYYY-MM-DD");
|
2417
|
+
var range = ranges.range(start, end);
|
2418
|
+
var period = Array.from(range.by("day")).map(function (m) {
|
2419
|
+
return {
|
2420
|
+
year: m.year(),
|
2421
|
+
month: m.month(),
|
2422
|
+
day: m.date(),
|
2423
|
+
moment: m
|
2424
|
+
};
|
2425
|
+
});
|
2426
|
+
return period;
|
2427
|
+
}, [from, to]);
|
2428
|
+
var label = /*#__PURE__*/React.createElement(Text$1, {
|
2429
|
+
use: "headline6"
|
2430
|
+
}, title);
|
2431
|
+
return /*#__PURE__*/React.createElement("div", {
|
2432
|
+
className: "planner-box"
|
2433
|
+
}, navigation ? /*#__PURE__*/React.createElement(Header, {
|
2434
|
+
title: label
|
2435
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
2436
|
+
icon: "chevron_right",
|
2437
|
+
clickable: true,
|
2438
|
+
action: next
|
2439
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
2440
|
+
id: "to",
|
2441
|
+
type: "date",
|
2442
|
+
label: "To",
|
2443
|
+
value: to,
|
2444
|
+
onChange: function onChange(id, value) {
|
2445
|
+
return setTo(value);
|
2446
|
+
}
|
2447
|
+
}), /*#__PURE__*/React.createElement("div", {
|
2448
|
+
className: "expand"
|
2449
|
+
}), /*#__PURE__*/React.createElement(DropDown, {
|
2450
|
+
id: "ranges",
|
2451
|
+
label: "Date Range",
|
2452
|
+
options: DATE_RANGE,
|
2453
|
+
value: dateRange,
|
2454
|
+
onChange: function onChange(id, value) {
|
2455
|
+
return setDateRange(value);
|
2456
|
+
}
|
2457
|
+
}), /*#__PURE__*/React.createElement("div", {
|
2458
|
+
className: "expand"
|
2459
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
2460
|
+
id: "from",
|
2461
|
+
type: "date",
|
2462
|
+
label: "From",
|
2463
|
+
value: from,
|
2464
|
+
onChange: function onChange(id, value) {
|
2465
|
+
return setFrom(value);
|
2466
|
+
}
|
2467
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
2468
|
+
icon: "chevron_left",
|
2469
|
+
clickable: true,
|
2470
|
+
action: prev
|
2471
|
+
})) : null, /*#__PURE__*/React.createElement("main", {
|
2472
|
+
className: "planner"
|
2473
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2474
|
+
className: "column0"
|
2475
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2476
|
+
className: "column-header"
|
2477
|
+
}), lanes.map(function (lane) {
|
2478
|
+
return /*#__PURE__*/React.createElement("div", {
|
2479
|
+
className: "row-header"
|
2480
|
+
}, lane.label);
|
2481
|
+
})), /*#__PURE__*/React.createElement("div", {
|
2482
|
+
className: "rows"
|
2483
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2484
|
+
className: "row row0"
|
2485
|
+
}, period.map(function (date, index) {
|
2486
|
+
var first = index === 0 || date.day === 1 ? "first" : "";
|
2487
|
+
return /*#__PURE__*/React.createElement("div", {
|
2488
|
+
className: "column-header"
|
2489
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2490
|
+
className: "month-header " + first
|
2491
|
+
}, /*#__PURE__*/React.createElement(Text$1, {
|
2492
|
+
use: "overline"
|
2493
|
+
}, date.moment.format("MMM"))));
|
2494
|
+
})), /*#__PURE__*/React.createElement("div", {
|
2495
|
+
className: "row row1"
|
2496
|
+
}, period.map(function (date) {
|
2497
|
+
var isWekend = [0, 6].includes(date.moment.day());
|
2498
|
+
var weekend = isWekend ? "weekend" : "";
|
2499
|
+
return /*#__PURE__*/React.createElement("div", {
|
2500
|
+
className: "column-header"
|
2501
|
+
}, /*#__PURE__*/React.createElement("div", {
|
2502
|
+
className: "date-header " + weekend
|
2503
|
+
}, /*#__PURE__*/React.createElement(Text$1, {
|
2504
|
+
use: "headline6"
|
2505
|
+
}, date.moment.format("DD")), "\xA0", /*#__PURE__*/React.createElement(Text$1, {
|
2506
|
+
use: "caption"
|
2507
|
+
}, date.moment.format("ddd"))));
|
2508
|
+
})), lanes.map(function (lane) {
|
2509
|
+
return /*#__PURE__*/React.createElement(PlannerRow, {
|
2510
|
+
lane: lane,
|
2511
|
+
events: events,
|
2512
|
+
period: period
|
2513
|
+
});
|
2514
|
+
}))));
|
2515
|
+
};
|
2516
|
+
/**
|
2517
|
+
* Planner Row
|
2518
|
+
*/
|
2519
|
+
|
2520
|
+
var PlannerRow = function PlannerRow(props) {
|
2521
|
+
var lane = props.lane,
|
2522
|
+
_props$events = props.events,
|
2523
|
+
events = _props$events === void 0 ? [] : _props$events,
|
2524
|
+
period = props.period;
|
2525
|
+
var rowEvents = events.filter(function (event) {
|
2526
|
+
return event.lane === lane.id;
|
2527
|
+
});
|
2528
|
+
return /*#__PURE__*/React.createElement("div", {
|
2529
|
+
className: "row"
|
2530
|
+
}, period.map(function (date) {
|
2531
|
+
var slotDate = new Date(date.year, date.month, date.day);
|
2532
|
+
slotDate.setHours(0, 0, 0);
|
2533
|
+
var cellEvents = rowEvents.filter(function (event) {
|
2534
|
+
var eventDate = new Date(event.date);
|
2535
|
+
eventDate.setHours(0, 0, 0);
|
2536
|
+
return eventDate.getTime() === slotDate.getTime();
|
2537
|
+
});
|
2538
|
+
return /*#__PURE__*/React.createElement(PlannerCell, {
|
2539
|
+
date: date,
|
2540
|
+
events: cellEvents
|
2541
|
+
});
|
2542
|
+
}));
|
2543
|
+
};
|
2544
|
+
/**
|
2545
|
+
* Planner Cell
|
2546
|
+
*/
|
2547
|
+
|
2548
|
+
|
2549
|
+
var PlannerCell = function PlannerCell(_ref3) {
|
2550
|
+
var lane = _ref3.lane,
|
2551
|
+
date = _ref3.date,
|
2552
|
+
onDrop = _ref3.onDrop;
|
2553
|
+
|
2554
|
+
var _useState4 = useState(false),
|
2555
|
+
dragOver = _useState4[0],
|
2556
|
+
setDragOver = _useState4[1];
|
2557
|
+
|
2558
|
+
function onDragOver(event) {
|
2559
|
+
if (!dragOver) setDragOver(true);
|
2560
|
+
event.stopPropagation();
|
2561
|
+
event.preventDefault();
|
2562
|
+
}
|
2563
|
+
|
2564
|
+
function onDragLeave(event) {
|
2565
|
+
setDragOver(false);
|
2566
|
+
event.stopPropagation();
|
2567
|
+
event.preventDefault();
|
2568
|
+
}
|
2569
|
+
|
2570
|
+
function drop(event) {
|
2571
|
+
event.stopPropagation();
|
2572
|
+
event.preventDefault();
|
2573
|
+
var id = event.dataTransfer.getData("text");
|
2574
|
+
if (onDrop) onDrop({
|
2575
|
+
id: id,
|
2576
|
+
lane: lane.id,
|
2577
|
+
date: date.moment.format("YYYY-MM-DD")
|
2578
|
+
});
|
2579
|
+
}
|
2580
|
+
|
2581
|
+
var isWekend = [0, 6].includes(date.moment.day());
|
2582
|
+
var weekend = isWekend ? "weekend" : "";
|
2583
|
+
return /*#__PURE__*/React.createElement("div", {
|
2584
|
+
className: "cell " + weekend,
|
2585
|
+
onDragOver: onDragOver,
|
2586
|
+
onDragLeave: onDragLeave,
|
2587
|
+
onDrop: drop
|
2588
|
+
}, "c");
|
2589
|
+
};
|
2590
|
+
|
2324
2591
|
/**
|
2325
2592
|
* Page Context
|
2326
2593
|
*/
|
@@ -5501,5 +5768,5 @@ var isFunction = function isFunction(value) {
|
|
5501
5768
|
return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
|
5502
5769
|
};
|
5503
5770
|
|
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 };
|
5771
|
+
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
5772
|
//# sourceMappingURL=index.modern.js.map
|