ywana-core8 0.0.910 → 0.0.911
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 +193 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +129 -6
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +193 -9
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +193 -8
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/widgets/calendar/Calendar.css +129 -6
- package/src/widgets/calendar/Calendar.js +176 -7
package/dist/index.modern.js
CHANGED
@@ -3206,14 +3206,70 @@ var WaitScreen = function WaitScreen() {
|
|
3206
3206
|
|
3207
3207
|
moment$1.locale('es');
|
3208
3208
|
var moment = extendMoment(moment$1);
|
3209
|
+
|
3210
|
+
/**
|
3211
|
+
* Calendar
|
3212
|
+
*/
|
3209
3213
|
var Calendar = function Calendar(props) {
|
3210
3214
|
var _props$events = props.events,
|
3211
3215
|
events = _props$events === void 0 ? [] : _props$events,
|
3212
3216
|
children = props.children,
|
3213
3217
|
onChange = props.onChange;
|
3214
|
-
var _useState = useState(),
|
3215
|
-
|
3216
|
-
|
3218
|
+
var _useState = useState(props.range || "year"),
|
3219
|
+
range = _useState[0],
|
3220
|
+
setRange = _useState[1];
|
3221
|
+
function onChangeRange(range) {
|
3222
|
+
setRange(range);
|
3223
|
+
}
|
3224
|
+
return /*#__PURE__*/React.createElement("div", {
|
3225
|
+
className: "calendar"
|
3226
|
+
}, /*#__PURE__*/React.createElement(CalendarRangeControl, {
|
3227
|
+
range: range,
|
3228
|
+
onChange: onChangeRange
|
3229
|
+
}), range === "year" && /*#__PURE__*/React.createElement(YearCalendar, {
|
3230
|
+
events: events,
|
3231
|
+
onChange: onChange
|
3232
|
+
}, children), range === "month" && /*#__PURE__*/React.createElement(MonthCalendar, {
|
3233
|
+
events: events,
|
3234
|
+
onChange: onChange,
|
3235
|
+
onRange: onChangeRange
|
3236
|
+
}, children));
|
3237
|
+
};
|
3238
|
+
|
3239
|
+
/**
|
3240
|
+
* CalendarRangeControl
|
3241
|
+
*/
|
3242
|
+
var CalendarRangeControl = function CalendarRangeControl(props) {
|
3243
|
+
var range = props.range,
|
3244
|
+
onChange = props.onChange;
|
3245
|
+
return /*#__PURE__*/React.createElement("div", {
|
3246
|
+
className: "calendar-range-control"
|
3247
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
3248
|
+
label: "Year",
|
3249
|
+
outlined: range == "year",
|
3250
|
+
action: function action() {
|
3251
|
+
return onChange("year");
|
3252
|
+
}
|
3253
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
3254
|
+
label: "Month",
|
3255
|
+
outlined: range == "month",
|
3256
|
+
action: function action() {
|
3257
|
+
return onChange("month");
|
3258
|
+
}
|
3259
|
+
}));
|
3260
|
+
};
|
3261
|
+
|
3262
|
+
/**
|
3263
|
+
* MonthCalendar
|
3264
|
+
*/
|
3265
|
+
var MonthCalendar = function MonthCalendar(props) {
|
3266
|
+
var _props$events2 = props.events,
|
3267
|
+
events = _props$events2 === void 0 ? [] : _props$events2,
|
3268
|
+
children = props.children,
|
3269
|
+
onChange = props.onChange;
|
3270
|
+
var _useState2 = useState(),
|
3271
|
+
position = _useState2[0],
|
3272
|
+
setPosition = _useState2[1];
|
3217
3273
|
useEffect(function () {
|
3218
3274
|
var today = moment();
|
3219
3275
|
setPosition(today);
|
@@ -3251,17 +3307,18 @@ var Calendar = function Calendar(props) {
|
|
3251
3307
|
var days = Array.from(range.by('days'));
|
3252
3308
|
var cells = days.map(function (day) {
|
3253
3309
|
var eventsOfDay = events.filter(function (event) {
|
3254
|
-
console.log(event.date, day.format("YYYY-MM-DD"));
|
3255
3310
|
var eventDay = moment(event.date);
|
3256
3311
|
return eventDay.isSame(day, 'day');
|
3257
3312
|
});
|
3313
|
+
var sameMonthStyle = day.isSame(moment(position), 'month') ? '' : 'other-month';
|
3258
3314
|
return {
|
3259
3315
|
day: day,
|
3260
|
-
events: eventsOfDay
|
3316
|
+
events: eventsOfDay,
|
3317
|
+
sameMonthStyle: sameMonthStyle
|
3261
3318
|
};
|
3262
3319
|
});
|
3263
3320
|
return /*#__PURE__*/React.createElement("div", {
|
3264
|
-
className: "calendar"
|
3321
|
+
className: "month-calendar"
|
3265
3322
|
}, /*#__PURE__*/React.createElement("nav", null, /*#__PURE__*/React.createElement("label", null, " ", /*#__PURE__*/React.createElement(Text, null, monthName), " ", year), /*#__PURE__*/React.createElement(Button, {
|
3266
3323
|
icon: "chevron_left",
|
3267
3324
|
action: prev
|
@@ -3298,9 +3355,9 @@ var DayCell = function DayCell(props) {
|
|
3298
3355
|
cell = _props$cell === void 0 ? [] : _props$cell,
|
3299
3356
|
children = props.children;
|
3300
3357
|
var day = cell.day,
|
3301
|
-
events = cell.events
|
3358
|
+
events = cell.events,
|
3359
|
+
sameMonthStyle = cell.sameMonthStyle;
|
3302
3360
|
var todayStyle = day.isSame(moment(), 'day') ? 'today' : '';
|
3303
|
-
var sameMonthStyle = day.isSame(moment(), 'month') ? '' : 'other-month';
|
3304
3361
|
return /*#__PURE__*/React.createElement("div", {
|
3305
3362
|
className: "day-cell " + todayStyle + " " + sameMonthStyle
|
3306
3363
|
}, /*#__PURE__*/React.createElement("header", null, day.format("DD")), /*#__PURE__*/React.createElement("main", null, events.map(function (event) {
|
@@ -3310,6 +3367,10 @@ var DayCell = function DayCell(props) {
|
|
3310
3367
|
}, children);
|
3311
3368
|
})));
|
3312
3369
|
};
|
3370
|
+
|
3371
|
+
/**
|
3372
|
+
* Event
|
3373
|
+
*/
|
3313
3374
|
var Event = function Event(props) {
|
3314
3375
|
var event = props.event,
|
3315
3376
|
children = props.children;
|
@@ -3327,6 +3388,129 @@ var Event = function Event(props) {
|
|
3327
3388
|
}
|
3328
3389
|
};
|
3329
3390
|
|
3391
|
+
/**
|
3392
|
+
* YearCalendar
|
3393
|
+
*/
|
3394
|
+
var YearCalendar = function YearCalendar(props) {
|
3395
|
+
var _props$events3 = props.events,
|
3396
|
+
events = _props$events3 === void 0 ? [] : _props$events3,
|
3397
|
+
children = props.children,
|
3398
|
+
onChange = props.onChange;
|
3399
|
+
var _useState3 = useState(),
|
3400
|
+
position = _useState3[0],
|
3401
|
+
setPosition = _useState3[1];
|
3402
|
+
useEffect(function () {
|
3403
|
+
var today = moment();
|
3404
|
+
setPosition(today);
|
3405
|
+
}, []);
|
3406
|
+
useEffect(function () {
|
3407
|
+
if (position && onChange) {
|
3408
|
+
var _firstDayOfYear = position.clone().startOf('year');
|
3409
|
+
var firstDayOfRange = _firstDayOfYear.clone().startOf('isoweek');
|
3410
|
+
var _lastDayOfYear = position.clone().endOf('year');
|
3411
|
+
var lastDayOfRange = _lastDayOfYear.clone().endOf('isoweek');
|
3412
|
+
var range = moment.range(firstDayOfRange, lastDayOfRange);
|
3413
|
+
onChange(position, range);
|
3414
|
+
}
|
3415
|
+
}, [position]);
|
3416
|
+
function next() {
|
3417
|
+
var next = position.clone().add(1, 'year');
|
3418
|
+
setPosition(next);
|
3419
|
+
}
|
3420
|
+
function prev() {
|
3421
|
+
var prev = position.clone().subtract(1, 'year');
|
3422
|
+
setPosition(prev);
|
3423
|
+
}
|
3424
|
+
function today() {
|
3425
|
+
var today = moment();
|
3426
|
+
setPosition(today);
|
3427
|
+
}
|
3428
|
+
if (!position) return "...";
|
3429
|
+
var year = position.format("YYYY");
|
3430
|
+
var firstDayOfYear = moment(position).startOf('year');
|
3431
|
+
var lastDayOfYear = moment(position).endOf('year');
|
3432
|
+
var months = [];
|
3433
|
+
for (var currentMonth = moment(firstDayOfYear); currentMonth.isBefore(lastDayOfYear); currentMonth.add(1, 'month')) {
|
3434
|
+
months.push(moment(currentMonth));
|
3435
|
+
}
|
3436
|
+
var cells = months.map(function (month) {
|
3437
|
+
var firstDayOfMonth = month.clone().startOf('month');
|
3438
|
+
var firstDayOfRange = firstDayOfMonth.clone().startOf('isoweek');
|
3439
|
+
var lastDayOfMonth = month.clone().endOf('month');
|
3440
|
+
var lastDayOfRange = lastDayOfMonth.clone().endOf('isoweek');
|
3441
|
+
var range = moment.range(firstDayOfRange, lastDayOfRange);
|
3442
|
+
var days = Array.from(range.by('days'));
|
3443
|
+
var cells = days.map(function (day) {
|
3444
|
+
var eventsOfDay = events.filter(function (event) {
|
3445
|
+
var eventDay = moment(event.date);
|
3446
|
+
return eventDay.isSame(day, 'day');
|
3447
|
+
});
|
3448
|
+
var sameMonthStyle = day.isSame(moment(month), 'month') ? '' : 'other-month';
|
3449
|
+
return {
|
3450
|
+
day: day,
|
3451
|
+
events: eventsOfDay,
|
3452
|
+
sameMonthStyle: sameMonthStyle
|
3453
|
+
};
|
3454
|
+
});
|
3455
|
+
return {
|
3456
|
+
month: month,
|
3457
|
+
cells: cells
|
3458
|
+
};
|
3459
|
+
});
|
3460
|
+
return /*#__PURE__*/React.createElement("div", {
|
3461
|
+
className: "year-calendar"
|
3462
|
+
}, /*#__PURE__*/React.createElement("nav", null, /*#__PURE__*/React.createElement("label", null, " ", /*#__PURE__*/React.createElement(Text, null, year)), /*#__PURE__*/React.createElement(Button, {
|
3463
|
+
icon: "chevron_left",
|
3464
|
+
action: prev
|
3465
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
3466
|
+
label: "Today",
|
3467
|
+
outlined: true,
|
3468
|
+
action: today
|
3469
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
3470
|
+
icon: "chevron_right",
|
3471
|
+
action: next
|
3472
|
+
})), /*#__PURE__*/React.createElement("main", null, cells.map(function (cell) {
|
3473
|
+
return /*#__PURE__*/React.createElement(MonthCell, {
|
3474
|
+
key: cell.month,
|
3475
|
+
cell: cell
|
3476
|
+
}, children);
|
3477
|
+
})));
|
3478
|
+
};
|
3479
|
+
|
3480
|
+
/**
|
3481
|
+
* MonthCell
|
3482
|
+
*/
|
3483
|
+
var MonthCell = function MonthCell(props) {
|
3484
|
+
var _props$cell2 = props.cell,
|
3485
|
+
cell = _props$cell2 === void 0 ? [] : _props$cell2,
|
3486
|
+
children = props.children;
|
3487
|
+
var month = cell.month,
|
3488
|
+
cells = cell.cells;
|
3489
|
+
var monthName = month.format("MMMM");
|
3490
|
+
return /*#__PURE__*/React.createElement("div", {
|
3491
|
+
className: "month-cell"
|
3492
|
+
}, /*#__PURE__*/React.createElement("nav", null, monthName), /*#__PURE__*/React.createElement("header", null, /*#__PURE__*/React.createElement("div", {
|
3493
|
+
className: "week-day-cell"
|
3494
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Mon")), /*#__PURE__*/React.createElement("div", {
|
3495
|
+
className: "week-day-cell"
|
3496
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Tue")), /*#__PURE__*/React.createElement("div", {
|
3497
|
+
className: "week-day-cell"
|
3498
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Wed")), /*#__PURE__*/React.createElement("div", {
|
3499
|
+
className: "week-day-cell"
|
3500
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Thu")), /*#__PURE__*/React.createElement("div", {
|
3501
|
+
className: "week-day-cell"
|
3502
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Fri")), /*#__PURE__*/React.createElement("div", {
|
3503
|
+
className: "week-day-cell"
|
3504
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Sat")), /*#__PURE__*/React.createElement("div", {
|
3505
|
+
className: "week-day-cell"
|
3506
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Sun"))), /*#__PURE__*/React.createElement("main", null, cells.map(function (cell) {
|
3507
|
+
return /*#__PURE__*/React.createElement(DayCell, {
|
3508
|
+
key: cell.day,
|
3509
|
+
cell: cell
|
3510
|
+
}, children);
|
3511
|
+
})));
|
3512
|
+
};
|
3513
|
+
|
3330
3514
|
var ranges = extendMoment(moment$1);
|
3331
3515
|
var DATE_RANGE = [{
|
3332
3516
|
label: "Week",
|
@@ -11306,5 +11490,5 @@ var isFunction = function isFunction(value) {
|
|
11306
11490
|
return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
|
11307
11491
|
};
|
11308
11492
|
|
11309
|
-
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, 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 };
|
11493
|
+
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 };
|
11310
11494
|
//# sourceMappingURL=index.modern.js.map
|