ywana-core8 0.0.909 → 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 +202 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +131 -10
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +202 -20
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +202 -19
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/widgets/calendar/Calendar.css +131 -10
- package/src/widgets/calendar/Calendar.js +188 -19
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,44 +3307,43 @@ 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"
|
3265
|
-
}, /*#__PURE__*/React.createElement("nav", null, /*#__PURE__*/React.createElement("label", null, " ", monthName, " ", year), /*#__PURE__*/React.createElement(Button, {
|
3321
|
+
className: "month-calendar"
|
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
|
-
raised: true,
|
3268
3324
|
action: prev
|
3269
3325
|
}), /*#__PURE__*/React.createElement(Button, {
|
3270
|
-
label: "
|
3326
|
+
label: "Today",
|
3271
3327
|
outlined: true,
|
3272
3328
|
action: today
|
3273
3329
|
}), /*#__PURE__*/React.createElement(Button, {
|
3274
3330
|
icon: "chevron_right",
|
3275
|
-
raised: true,
|
3276
3331
|
action: next
|
3277
3332
|
})), /*#__PURE__*/React.createElement("header", null, /*#__PURE__*/React.createElement("div", {
|
3278
3333
|
className: "week-day-cell"
|
3279
|
-
}, "
|
3334
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Mon")), /*#__PURE__*/React.createElement("div", {
|
3280
3335
|
className: "week-day-cell"
|
3281
|
-
}, "
|
3336
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Tue")), /*#__PURE__*/React.createElement("div", {
|
3282
3337
|
className: "week-day-cell"
|
3283
|
-
}, "
|
3338
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Wed")), /*#__PURE__*/React.createElement("div", {
|
3284
3339
|
className: "week-day-cell"
|
3285
|
-
}, "
|
3340
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Thu")), /*#__PURE__*/React.createElement("div", {
|
3286
3341
|
className: "week-day-cell"
|
3287
|
-
}, "
|
3342
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Fri")), /*#__PURE__*/React.createElement("div", {
|
3288
3343
|
className: "week-day-cell"
|
3289
|
-
}, "
|
3344
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Sat")), /*#__PURE__*/React.createElement("div", {
|
3290
3345
|
className: "week-day-cell"
|
3291
|
-
}, "
|
3346
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Sun"))), /*#__PURE__*/React.createElement("main", null, cells.map(function (cell) {
|
3292
3347
|
return /*#__PURE__*/React.createElement(DayCell, {
|
3293
3348
|
key: cell.day,
|
3294
3349
|
cell: cell
|
@@ -3300,9 +3355,9 @@ var DayCell = function DayCell(props) {
|
|
3300
3355
|
cell = _props$cell === void 0 ? [] : _props$cell,
|
3301
3356
|
children = props.children;
|
3302
3357
|
var day = cell.day,
|
3303
|
-
events = cell.events
|
3358
|
+
events = cell.events,
|
3359
|
+
sameMonthStyle = cell.sameMonthStyle;
|
3304
3360
|
var todayStyle = day.isSame(moment(), 'day') ? 'today' : '';
|
3305
|
-
var sameMonthStyle = day.isSame(moment(), 'month') ? '' : 'other-month';
|
3306
3361
|
return /*#__PURE__*/React.createElement("div", {
|
3307
3362
|
className: "day-cell " + todayStyle + " " + sameMonthStyle
|
3308
3363
|
}, /*#__PURE__*/React.createElement("header", null, day.format("DD")), /*#__PURE__*/React.createElement("main", null, events.map(function (event) {
|
@@ -3312,6 +3367,10 @@ var DayCell = function DayCell(props) {
|
|
3312
3367
|
}, children);
|
3313
3368
|
})));
|
3314
3369
|
};
|
3370
|
+
|
3371
|
+
/**
|
3372
|
+
* Event
|
3373
|
+
*/
|
3315
3374
|
var Event = function Event(props) {
|
3316
3375
|
var event = props.event,
|
3317
3376
|
children = props.children;
|
@@ -3329,6 +3388,129 @@ var Event = function Event(props) {
|
|
3329
3388
|
}
|
3330
3389
|
};
|
3331
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
|
+
|
3332
3514
|
var ranges = extendMoment(moment$1);
|
3333
3515
|
var DATE_RANGE = [{
|
3334
3516
|
label: "Week",
|
@@ -11308,5 +11490,5 @@ var isFunction = function isFunction(value) {
|
|
11308
11490
|
return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
|
11309
11491
|
};
|
11310
11492
|
|
11311
|
-
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 };
|
11312
11494
|
//# sourceMappingURL=index.modern.js.map
|