ywana-core8 0.0.918 → 0.0.920

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.
@@ -1,5 +1,5 @@
1
1
  import 'material-design-icons-iconfont/dist/material-design-icons.css';
2
- import React, { useContext, useState, useEffect, Fragment, useRef, useMemo, useCallback, Children } from 'react';
2
+ import React, { useContext, useState, useEffect, useCallback, Fragment, useRef, useMemo, Children } from 'react';
3
3
  import RSwitch from 'react-switch';
4
4
  import moment$1 from 'moment';
5
5
  import { extendMoment } from 'moment-range';
@@ -414,24 +414,24 @@ var Button = function Button(_ref) {
414
414
  outlined = _ref.outlined,
415
415
  raised = _ref.raised,
416
416
  className = _ref.className;
417
- function click(event) {
417
+ var click = useCallback(function (event) {
418
418
  if (!disabled) {
419
419
  event.stopPropagation();
420
420
  event.preventDefault();
421
421
  if (action) action();
422
422
  }
423
- }
423
+ }, [disabled, action]);
424
424
  var style = raised ? 'raised' : outlined ? 'outlined' : 'normal';
425
425
  if (disabled) style = style + " disabled";
426
426
  return /*#__PURE__*/React.createElement("button", {
427
427
  className: "btn " + style + " " + className,
428
428
  onClick: click
429
- }, icon ? /*#__PURE__*/React.createElement(Icon, {
429
+ }, icon && /*#__PURE__*/React.createElement(Icon, {
430
430
  icon: icon,
431
431
  size: "small",
432
432
  clickable: true,
433
433
  action: click
434
- }) : null, /*#__PURE__*/React.createElement(Text, null, label));
434
+ }), /*#__PURE__*/React.createElement(Text, null, label));
435
435
  };
436
436
 
437
437
  /**
@@ -5705,6 +5705,146 @@ var UploadProgressBar = function UploadProgressBar(props) {
5705
5705
  }));
5706
5706
  };
5707
5707
 
5708
+ var Planner2 = function Planner2(_ref) {
5709
+ var from = _ref.from,
5710
+ to = _ref.to,
5711
+ _ref$lanes = _ref.lanes,
5712
+ lanes = _ref$lanes === void 0 ? [] : _ref$lanes,
5713
+ _ref$events = _ref.events,
5714
+ events = _ref$events === void 0 ? [] : _ref$events,
5715
+ _ref$cellWidth = _ref.cellWidth,
5716
+ cellWidth = _ref$cellWidth === void 0 ? 10 : _ref$cellWidth,
5717
+ _ref$rowHeaderWidth = _ref.rowHeaderWidth,
5718
+ rowHeaderWidth = _ref$rowHeaderWidth === void 0 ? 10 : _ref$rowHeaderWidth,
5719
+ EventRenderer = _ref.EventRenderer;
5720
+ var _useState = useState([]),
5721
+ days = _useState[0],
5722
+ setDays = _useState[1];
5723
+ var lastDay = new Date(to);
5724
+ useEffect(function () {
5725
+ var day = new Date(from);
5726
+ var nextDays = [];
5727
+ while (day <= lastDay) {
5728
+ nextDays.push({
5729
+ day: day.getDate(),
5730
+ weekday: day.toLocaleString('en-US', {
5731
+ weekday: 'short'
5732
+ }),
5733
+ month: day.toLocaleString('en-US', {
5734
+ month: 'short'
5735
+ }),
5736
+ monthNum: day.getMonth() + 1,
5737
+ year: day.getFullYear()
5738
+ });
5739
+ day.setDate(day.getDate() + 1);
5740
+ }
5741
+ setDays(nextDays);
5742
+ }, [from, to]);
5743
+ var uniqueMonths = Array.from(new Set(days.map(function (_ref2) {
5744
+ var month = _ref2.month;
5745
+ return month;
5746
+ })));
5747
+ var monthWidths = uniqueMonths.map(function (month) {
5748
+ var monthDays = days.filter(function (day) {
5749
+ return day.month === month;
5750
+ });
5751
+ return monthDays.length * cellWidth + "rem";
5752
+ });
5753
+ var dayWidth = cellWidth + "rem";
5754
+ var totalDaysWidth = days.length * cellWidth + rowHeaderWidth;
5755
+ return /*#__PURE__*/React.createElement("div", {
5756
+ className: "planner2-row"
5757
+ }, /*#__PURE__*/React.createElement("div", {
5758
+ className: "months-row",
5759
+ style: {
5760
+ display: 'flex',
5761
+ width: totalDaysWidth + "rem"
5762
+ }
5763
+ }, /*#__PURE__*/React.createElement("div", {
5764
+ className: "row-header",
5765
+ style: {
5766
+ width: rowHeaderWidth + "rem"
5767
+ }
5768
+ }), uniqueMonths.map(function (month, index) {
5769
+ return /*#__PURE__*/React.createElement("div", {
5770
+ className: "month-cell",
5771
+ key: month,
5772
+ style: {
5773
+ fontWeight: 'bold',
5774
+ minWidth: monthWidths[index]
5775
+ }
5776
+ }, /*#__PURE__*/React.createElement("div", {
5777
+ className: "month-name"
5778
+ }, month, " ", new Date(from).getFullYear()));
5779
+ })), /*#__PURE__*/React.createElement("div", {
5780
+ className: "days-row",
5781
+ style: {
5782
+ display: 'flex',
5783
+ width: totalDaysWidth + "rem"
5784
+ }
5785
+ }, /*#__PURE__*/React.createElement("div", {
5786
+ className: "row-header",
5787
+ style: {
5788
+ minWidth: rowHeaderWidth + "rem",
5789
+ maxWidth: rowHeaderWidth + "rem"
5790
+ }
5791
+ }), days.map(function (_ref3) {
5792
+ var day = _ref3.day,
5793
+ weekday = _ref3.weekday,
5794
+ month = _ref3.month;
5795
+ return /*#__PURE__*/React.createElement("div", {
5796
+ className: "day-cell",
5797
+ style: {
5798
+ minWidth: dayWidth,
5799
+ maxWidth: dayWidth
5800
+ },
5801
+ key: "day_" + month + "-" + day
5802
+ }, /*#__PURE__*/React.createElement("div", {
5803
+ className: "weekday"
5804
+ }, weekday.substring(0, 2)), /*#__PURE__*/React.createElement("div", {
5805
+ className: "daynum"
5806
+ }, day));
5807
+ })), lanes.map(function (lane, index) {
5808
+ var laneEvents = events.filter(function (event) {
5809
+ return event.lane === lane.id;
5810
+ });
5811
+ return /*#__PURE__*/React.createElement("div", {
5812
+ className: "content-row",
5813
+ style: {
5814
+ width: totalDaysWidth + "rem"
5815
+ }
5816
+ }, /*#__PURE__*/React.createElement("div", {
5817
+ className: "row-header",
5818
+ style: {
5819
+ width: rowHeaderWidth + "rem"
5820
+ }
5821
+ }, lane.title), days.map(function (_ref4) {
5822
+ var day = _ref4.day,
5823
+ month = _ref4.month,
5824
+ monthNum = _ref4.monthNum,
5825
+ year = _ref4.year;
5826
+ var dayDate = new Date(year, monthNum - 1, day);
5827
+ var dayEvents = laneEvents.filter(function (event) {
5828
+ var eventDate = new Date(event.date);
5829
+ return eventDate.getDate() === dayDate.getDate() && eventDate.getMonth() === dayDate.getMonth() && eventDate.getFullYear() === dayDate.getFullYear();
5830
+ });
5831
+ return /*#__PURE__*/React.createElement("div", {
5832
+ className: "content-cell",
5833
+ style: {
5834
+ minWidth: dayWidth,
5835
+ maxWidth: dayWidth
5836
+ },
5837
+ key: "content" + index + "_" + month + "-" + day
5838
+ }, dayEvents.map(function (event) {
5839
+ return /*#__PURE__*/React.createElement(EventRenderer, {
5840
+ key: event.id,
5841
+ event: event
5842
+ });
5843
+ }));
5844
+ }));
5845
+ }));
5846
+ };
5847
+
5708
5848
  /**
5709
5849
  * Password Editor
5710
5850
  */
@@ -11516,5 +11656,5 @@ var isFunction = function isFunction(value) {
11516
11656
  return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
11517
11657
  };
11518
11658
 
11519
- export { Accordion, ActionButton, Avatar, Button, Calendar, CheckBox, Chip, Chips, CircularProgress, CollectionAPI$1 as CollectionAPI, CollectionAPI as CollectionAPI2, CollectionContext$1 as CollectionContext, CollectionContext as CollectionContext2, CollectionEditor$2 as CollectionEditor, CollectionFilters$1 as CollectionFilters, CollectionPage$1 as CollectionPage, CollectionPage as CollectionPage2, CollectionTree, ColorField, Content, ContentEditor, ContentForm, ContentViewer, CreateContentDialog, DataTable, DateRange, Dialog, DropDown, DynamicForm, EditContentDialog, EmptyMessage, FORMATS$1 as FORMATS, FieldEditor, FileExplorer, FileExplorerView, FileGridItem, FilesGridView, FilesSearchBox, FilesTableView, FoldersTreeView, Form, HTTPClient, Header, Icon, ImageViewer, Kanban, KanbanCard, KanbanColumn, KanbanHeader, KanbanSwimlane, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, MonthCalendar, MultiSelector, Page, PageContext, PageProvider, PasswordEditor, PasswordField, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, Switch2, TASK_STATES, TEXTFORMATS, TYPES$1 as TYPES, Tab, TabbedContentEditor, TabbedTablePage, TabbedView, TableEditor$2 as TableEditor, TablePage, TablePage2, Tabs, TaskContext, TaskContextProvider, TaskMonitor, TaskProgress, Text, TextArea, TextField, Thumbnail, ToggleButton, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadDialog, UploadFile$1 as UploadFile, UploadForm, UploadIcon, Uploader, View, Viewer, WaitScreen, Wizard, WizardContext, isEmpty, isFunction };
11659
+ export { Accordion, ActionButton, Avatar, Button, Calendar, CheckBox, Chip, Chips, CircularProgress, CollectionAPI$1 as CollectionAPI, CollectionAPI as CollectionAPI2, CollectionContext$1 as CollectionContext, CollectionContext as CollectionContext2, CollectionEditor$2 as CollectionEditor, CollectionFilters$1 as CollectionFilters, CollectionPage$1 as CollectionPage, CollectionPage as CollectionPage2, CollectionTree, ColorField, Content, ContentEditor, ContentForm, ContentViewer, CreateContentDialog, DataTable, DateRange, Dialog, DropDown, DynamicForm, EditContentDialog, EmptyMessage, FORMATS$1 as FORMATS, FieldEditor, FileExplorer, FileExplorerView, FileGridItem, FilesGridView, FilesSearchBox, FilesTableView, FoldersTreeView, Form, HTTPClient, Header, Icon, ImageViewer, Kanban, KanbanCard, KanbanColumn, KanbanHeader, KanbanSwimlane, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, MonthCalendar, MultiSelector, Page, PageContext, PageProvider, PasswordEditor, PasswordField, Planner, Planner2, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, Switch2, TASK_STATES, TEXTFORMATS, TYPES$1 as TYPES, Tab, TabbedContentEditor, TabbedTablePage, TabbedView, TableEditor$2 as TableEditor, TablePage, TablePage2, Tabs, TaskContext, TaskContextProvider, TaskMonitor, TaskProgress, Text, TextArea, TextField, Thumbnail, ToggleButton, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadDialog, UploadFile$1 as UploadFile, UploadForm, UploadIcon, Uploader, View, Viewer, WaitScreen, Wizard, WizardContext, isEmpty, isFunction };
11520
11660
  //# sourceMappingURL=index.modern.js.map