ywana-core8 0.0.824 → 0.0.826

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, { useState, useEffect, useContext, Fragment, useRef, useMemo, Children } from 'react';
2
+ import React, { useState, useEffect, useContext, Fragment, useRef, useMemo, useCallback, Children } from 'react';
3
3
  import RSwitch from 'react-switch';
4
4
  import moment$1 from 'moment';
5
5
  import { extendMoment } from 'moment-range';
@@ -7,6 +7,7 @@ import 'moment/locale/es';
7
7
  import ResumableJS from 'resumablejs';
8
8
  import { ReactNotifications, Store } from 'react-notifications-component';
9
9
  import 'react-notifications-component/dist/theme.css';
10
+ import axios from 'axios';
10
11
  import equal from 'deep-equal';
11
12
 
12
13
  /**
@@ -3425,11 +3426,15 @@ var Planner = function Planner(_ref) {
3425
3426
  setTo = _useState3[1];
3426
3427
 
3427
3428
  var thisMondayElement = useRef(null);
3428
- useEffect(function () {
3429
- if (thisMondayElement.current) {
3430
- showThisWeek();
3431
- }
3432
- }, [thisMondayElement]);
3429
+ var gotoMonday = useCallback(function (node) {
3430
+ var element = node;
3431
+ console.log("goto monday", element);
3432
+ if (element) element.scrollIntoView({
3433
+ behavior: 'smooth',
3434
+ block: 'start',
3435
+ inline: 'start'
3436
+ });
3437
+ }, []);
3433
3438
  useEffect(function () {
3434
3439
  var element = document.getElementById(focusEvent);
3435
3440
  if (element) element.scrollIntoView({
@@ -3471,6 +3476,7 @@ var Planner = function Planner(_ref) {
3471
3476
  function showThisWeek() {
3472
3477
  var element = thisMondayElement.current; //const element = document.querySelector(".thisMonday")
3473
3478
 
3479
+ console.log("Show this week", element);
3474
3480
  if (element) element.scrollIntoView({
3475
3481
  behavior: 'smooth',
3476
3482
  block: 'start',
@@ -3573,10 +3579,12 @@ var Planner = function Planner(_ref) {
3573
3579
  var isThisMonday = date.moment.isSame(weekStart);
3574
3580
  return /*#__PURE__*/React.createElement("div", {
3575
3581
  key: "column-" + date.moment.dayOfYear(),
3582
+ id: isThisMonday ? "thisMonday" : "",
3576
3583
  className: "column-header",
3577
3584
  ref: isThisMonday ? thisMondayElement : null
3578
3585
  }, /*#__PURE__*/React.createElement("div", {
3579
- className: "date-header " + weekend + " " + thisWeek
3586
+ className: "date-header " + weekend + " " + thisWeek,
3587
+ ref: isThisMonday ? gotoMonday : null
3580
3588
  }, /*#__PURE__*/React.createElement(Text, {
3581
3589
  use: "headline6"
3582
3590
  }, date.moment.format("DD")), "\xA0", /*#__PURE__*/React.createElement(Text, {
@@ -3786,7 +3794,7 @@ var UPLOAD_STATES = {
3786
3794
  * Upload File
3787
3795
  */
3788
3796
 
3789
- var UploadFile = function UploadFile(_ref) {
3797
+ var UploadFile$1 = function UploadFile(_ref) {
3790
3798
  var file = _ref.file;
3791
3799
  var icon = file.icon,
3792
3800
  name = file.name,
@@ -3822,7 +3830,7 @@ var UploadProgress = function UploadProgress(_ref) {
3822
3830
  state: file.uploadState,
3823
3831
  error: file.uploadError
3824
3832
  };
3825
- return /*#__PURE__*/React.createElement(UploadFile, {
3833
+ return /*#__PURE__*/React.createElement(UploadFile$1, {
3826
3834
  key: f.name,
3827
3835
  file: f
3828
3836
  });
@@ -5294,6 +5302,145 @@ var TaskInfo = function TaskInfo(props) {
5294
5302
  return editor(task);
5295
5303
  };
5296
5304
 
5305
+ /*
5306
+ * Upload Form
5307
+ */
5308
+
5309
+ var UploadForm = function UploadForm(props) {
5310
+ var _props$label = props.label,
5311
+ label = _props$label === void 0 ? "Browse" : _props$label,
5312
+ _props$text = props.text,
5313
+ text = _props$text === void 0 ? "Drag and drop here" : _props$text,
5314
+ url = props.url,
5315
+ _props$headers = props.headers,
5316
+ headers = _props$headers === void 0 ? {} : _props$headers,
5317
+ onSuccess = props.onSuccess,
5318
+ onError = props.onError;
5319
+
5320
+ var _useState = useState(null),
5321
+ file = _useState[0],
5322
+ setFile = _useState[1];
5323
+
5324
+ var _useState2 = useState(0),
5325
+ progress = _useState2[0],
5326
+ setProgress = _useState2[1];
5327
+
5328
+ useEffect(function () {
5329
+ if (file) {
5330
+ uploadFile(file);
5331
+ }
5332
+ }, [file]);
5333
+
5334
+ function onDragOver(e) {
5335
+ e.stopPropagation();
5336
+ e.preventDefault();
5337
+ }
5338
+
5339
+ function onDragEnter(e) {
5340
+ e.preventDefault();
5341
+ e.stopPropagation();
5342
+
5343
+ if (e.type === "dragenter" || e.type === "dragover") {
5344
+ console.log("dragenter");
5345
+ } else if (e.type === "dragleave") {
5346
+ console.log("dragleave");
5347
+ }
5348
+ }
5349
+
5350
+ function onFileDrop(e) {
5351
+ e.preventDefault();
5352
+ e.stopPropagation();
5353
+
5354
+ if (e.dataTransfer.files && e.dataTransfer.files[0]) {
5355
+ var files = e.dataTransfer.files;
5356
+ handleFiles(files);
5357
+ }
5358
+ }
5359
+
5360
+ function handleFiles(files) {
5361
+ var file = files[0];
5362
+ console.log("handleFiles", files, file);
5363
+ setFile(file);
5364
+ }
5365
+
5366
+ function handleFile(e) {
5367
+ var file = e.target.files[0];
5368
+ setFile(file);
5369
+ }
5370
+
5371
+ function uploadFile(file) {
5372
+ var formData = new FormData();
5373
+ formData.append('file', file);
5374
+ var config = {
5375
+ onUploadProgress: function onUploadProgress(progressEvent) {
5376
+ setProgress(Math.round(progressEvent.loaded / progressEvent.total * 100));
5377
+ },
5378
+ headers: _extends({
5379
+ 'content-type': 'multipart/form-data'
5380
+ }, headers)
5381
+ };
5382
+ axios.post(url, formData, config).then(function (response) {
5383
+ if (onSuccess) onSuccess(response);
5384
+ })["catch"](function (error) {
5385
+ if (onError) onError(error);
5386
+ });
5387
+ }
5388
+
5389
+ return /*#__PURE__*/React.createElement("div", {
5390
+ className: "upload-form",
5391
+ onDragEnter: onDragEnter,
5392
+ onDragOver: onDragOver,
5393
+ onDrop: onFileDrop
5394
+ }, /*#__PURE__*/React.createElement("div", {
5395
+ className: "upload-area"
5396
+ }, /*#__PURE__*/React.createElement("div", {
5397
+ className: "upload-area-text"
5398
+ }, text), /*#__PURE__*/React.createElement("label", {
5399
+ htmlFor: "upload"
5400
+ }, /*#__PURE__*/React.createElement("span", {
5401
+ className: "upload-label"
5402
+ }, label)), /*#__PURE__*/React.createElement("input", {
5403
+ id: "upload",
5404
+ type: "file",
5405
+ onChange: handleFile
5406
+ })), file ? /*#__PURE__*/React.createElement(UploadFile, {
5407
+ name: file.name,
5408
+ progress: progress
5409
+ }) : null);
5410
+ };
5411
+ /**
5412
+ * Upload File
5413
+ */
5414
+
5415
+ var UploadFile = function UploadFile(props) {
5416
+ var name = props.name,
5417
+ _props$progress = props.progress,
5418
+ progress = _props$progress === void 0 ? 0 : _props$progress;
5419
+ return /*#__PURE__*/React.createElement("div", {
5420
+ className: "upload-file"
5421
+ }, /*#__PURE__*/React.createElement("div", {
5422
+ className: "upload-file-info"
5423
+ }, /*#__PURE__*/React.createElement("label", null, name), /*#__PURE__*/React.createElement("span", null, progress, " %")), /*#__PURE__*/React.createElement(UploadProgressBar, {
5424
+ progress: progress
5425
+ }));
5426
+ };
5427
+ /**
5428
+ * Upload Progress Bar
5429
+ */
5430
+
5431
+
5432
+ var UploadProgressBar = function UploadProgressBar(props) {
5433
+ var progress = props.progress;
5434
+ return /*#__PURE__*/React.createElement("div", {
5435
+ className: "upload-progress-bar"
5436
+ }, /*#__PURE__*/React.createElement("div", {
5437
+ className: "upload-progress-bar-inner",
5438
+ style: {
5439
+ width: progress + "%"
5440
+ }
5441
+ }));
5442
+ };
5443
+
5297
5444
  /**
5298
5445
  * Password Editor
5299
5446
  */
@@ -11551,5 +11698,5 @@ var isFunction = function isFunction(value) {
11551
11698
  return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
11552
11699
  };
11553
11700
 
11554
- export { Accordion, Avatar, Button, Calendar, CheckBox, Chip, Chips, CircularProgress, 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, FilesGrid, Form, HTTPClient, Header, Icon, ImageViewer, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, MultiSelector, Page, PageContext, PageProvider, PasswordEditor, PasswordField, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, 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, UploadIcon, Uploader, View, Viewer, WaitScreen, Wizard, WizardContext, isEmpty, isFunction };
11701
+ export { Accordion, Avatar, Button, Calendar, CheckBox, Chip, Chips, CircularProgress, 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, FilesGrid, Form, HTTPClient, Header, Icon, ImageViewer, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, MultiSelector, Page, PageContext, PageProvider, PasswordEditor, PasswordField, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, 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 };
11555
11702
  //# sourceMappingURL=index.modern.js.map