Add appointment management with a calendar
This commit is contained in:
20
lib/fullcalendar/moment/LICENSE.txt
Normal file
20
lib/fullcalendar/moment/LICENSE.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2019 Adam Shaw
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
8
lib/fullcalendar/moment/README.md
Normal file
8
lib/fullcalendar/moment/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
# FullCalendar Moment Plugin
|
||||
|
||||
A connector to the MomentJS date library
|
||||
|
||||
[View the docs »](https://fullcalendar.io/docs/moment-plugins)
|
||||
|
||||
This package was created from the [FullCalendar monorepo »](https://github.com/fullcalendar/fullcalendar)
|
||||
14
lib/fullcalendar/moment/main.d.ts
vendored
Normal file
14
lib/fullcalendar/moment/main.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// Generated by dts-bundle v0.7.3-fork.1
|
||||
// Dependencies for this module:
|
||||
// ../../../../../moment
|
||||
// ../../../../../@fullcalendar/core
|
||||
|
||||
declare module '@fullcalendar/moment' {
|
||||
import * as momentNs from 'moment';
|
||||
import { Calendar, Duration } from '@fullcalendar/core';
|
||||
export function toMoment(date: Date, calendar: Calendar): momentNs.Moment;
|
||||
export function toDuration(fcDuration: Duration): momentNs.Duration;
|
||||
const _default: import("@fullcalendar/core").PluginDef;
|
||||
export default _default;
|
||||
}
|
||||
|
||||
102
lib/fullcalendar/moment/main.esm.js
Normal file
102
lib/fullcalendar/moment/main.esm.js
Normal file
@@ -0,0 +1,102 @@
|
||||
/*!
|
||||
FullCalendar Moment Plugin v4.4.2
|
||||
Docs & License: https://fullcalendar.io/
|
||||
(c) 2019 Adam Shaw
|
||||
*/
|
||||
|
||||
import * as momentNs from 'moment';
|
||||
import { createPlugin, Calendar } from '@fullcalendar/core';
|
||||
|
||||
var moment = momentNs; // the directly callable function
|
||||
function toMoment(date, calendar) {
|
||||
if (!(calendar instanceof Calendar)) {
|
||||
throw new Error('must supply a Calendar instance');
|
||||
}
|
||||
return convertToMoment(date, calendar.dateEnv.timeZone, null, calendar.dateEnv.locale.codes[0]);
|
||||
}
|
||||
function toDuration(fcDuration) {
|
||||
return moment.duration(fcDuration); // moment accepts all the props that fc.Duration already has!
|
||||
}
|
||||
function formatWithCmdStr(cmdStr, arg) {
|
||||
var cmd = parseCmdStr(cmdStr);
|
||||
if (arg.end) {
|
||||
var startMom = convertToMoment(arg.start.array, arg.timeZone, arg.start.timeZoneOffset, arg.localeCodes[0]);
|
||||
var endMom = convertToMoment(arg.end.array, arg.timeZone, arg.end.timeZoneOffset, arg.localeCodes[0]);
|
||||
return formatRange(cmd, createMomentFormatFunc(startMom), createMomentFormatFunc(endMom), arg.separator);
|
||||
}
|
||||
return convertToMoment(arg.date.array, arg.timeZone, arg.date.timeZoneOffset, arg.localeCodes[0]).format(cmd.whole); // TODO: test for this
|
||||
}
|
||||
var main = createPlugin({
|
||||
cmdFormatter: formatWithCmdStr
|
||||
});
|
||||
function createMomentFormatFunc(mom) {
|
||||
return function (cmdStr) {
|
||||
return cmdStr ? mom.format(cmdStr) : ''; // because calling with blank string results in ISO8601 :(
|
||||
};
|
||||
}
|
||||
function convertToMoment(input, timeZone, timeZoneOffset, locale) {
|
||||
var mom;
|
||||
if (timeZone === 'local') {
|
||||
mom = moment(input);
|
||||
}
|
||||
else if (timeZone === 'UTC') {
|
||||
mom = moment.utc(input);
|
||||
}
|
||||
else if (moment.tz) {
|
||||
mom = moment.tz(input, timeZone);
|
||||
}
|
||||
else {
|
||||
mom = moment.utc(input);
|
||||
if (timeZoneOffset != null) {
|
||||
mom.utcOffset(timeZoneOffset);
|
||||
}
|
||||
}
|
||||
mom.locale(locale);
|
||||
return mom;
|
||||
}
|
||||
function parseCmdStr(cmdStr) {
|
||||
var parts = cmdStr.match(/^(.*?)\{(.*)\}(.*)$/); // TODO: lookbehinds for escape characters
|
||||
if (parts) {
|
||||
var middle = parseCmdStr(parts[2]);
|
||||
return {
|
||||
head: parts[1],
|
||||
middle: middle,
|
||||
tail: parts[3],
|
||||
whole: parts[1] + middle.whole + parts[3]
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
head: null,
|
||||
middle: null,
|
||||
tail: null,
|
||||
whole: cmdStr
|
||||
};
|
||||
}
|
||||
}
|
||||
function formatRange(cmd, formatStart, formatEnd, separator) {
|
||||
if (cmd.middle) {
|
||||
var startHead = formatStart(cmd.head);
|
||||
var startMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
||||
var startTail = formatStart(cmd.tail);
|
||||
var endHead = formatEnd(cmd.head);
|
||||
var endMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
||||
var endTail = formatEnd(cmd.tail);
|
||||
if (startHead === endHead && startTail === endTail) {
|
||||
return startHead +
|
||||
(startMiddle === endMiddle ? startMiddle : startMiddle + separator + endMiddle) +
|
||||
startTail;
|
||||
}
|
||||
}
|
||||
var startWhole = formatStart(cmd.whole);
|
||||
var endWhole = formatEnd(cmd.whole);
|
||||
if (startWhole === endWhole) {
|
||||
return startWhole;
|
||||
}
|
||||
else {
|
||||
return startWhole + separator + endWhole;
|
||||
}
|
||||
}
|
||||
|
||||
export default main;
|
||||
export { toDuration, toMoment };
|
||||
110
lib/fullcalendar/moment/main.js
Normal file
110
lib/fullcalendar/moment/main.js
Normal file
@@ -0,0 +1,110 @@
|
||||
/*!
|
||||
FullCalendar Moment Plugin v4.4.2
|
||||
Docs & License: https://fullcalendar.io/
|
||||
(c) 2019 Adam Shaw
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('moment'), require('@fullcalendar/core')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'moment', '@fullcalendar/core'], factory) :
|
||||
(global = global || self, factory(global.FullCalendarMoment = {}, global.moment, global.FullCalendar));
|
||||
}(this, function (exports, momentNs, core) { 'use strict';
|
||||
|
||||
var moment = momentNs; // the directly callable function
|
||||
function toMoment(date, calendar) {
|
||||
if (!(calendar instanceof core.Calendar)) {
|
||||
throw new Error('must supply a Calendar instance');
|
||||
}
|
||||
return convertToMoment(date, calendar.dateEnv.timeZone, null, calendar.dateEnv.locale.codes[0]);
|
||||
}
|
||||
function toDuration(fcDuration) {
|
||||
return moment.duration(fcDuration); // moment accepts all the props that fc.Duration already has!
|
||||
}
|
||||
function formatWithCmdStr(cmdStr, arg) {
|
||||
var cmd = parseCmdStr(cmdStr);
|
||||
if (arg.end) {
|
||||
var startMom = convertToMoment(arg.start.array, arg.timeZone, arg.start.timeZoneOffset, arg.localeCodes[0]);
|
||||
var endMom = convertToMoment(arg.end.array, arg.timeZone, arg.end.timeZoneOffset, arg.localeCodes[0]);
|
||||
return formatRange(cmd, createMomentFormatFunc(startMom), createMomentFormatFunc(endMom), arg.separator);
|
||||
}
|
||||
return convertToMoment(arg.date.array, arg.timeZone, arg.date.timeZoneOffset, arg.localeCodes[0]).format(cmd.whole); // TODO: test for this
|
||||
}
|
||||
var main = core.createPlugin({
|
||||
cmdFormatter: formatWithCmdStr
|
||||
});
|
||||
function createMomentFormatFunc(mom) {
|
||||
return function (cmdStr) {
|
||||
return cmdStr ? mom.format(cmdStr) : ''; // because calling with blank string results in ISO8601 :(
|
||||
};
|
||||
}
|
||||
function convertToMoment(input, timeZone, timeZoneOffset, locale) {
|
||||
var mom;
|
||||
if (timeZone === 'local') {
|
||||
mom = moment(input);
|
||||
}
|
||||
else if (timeZone === 'UTC') {
|
||||
mom = moment.utc(input);
|
||||
}
|
||||
else if (moment.tz) {
|
||||
mom = moment.tz(input, timeZone);
|
||||
}
|
||||
else {
|
||||
mom = moment.utc(input);
|
||||
if (timeZoneOffset != null) {
|
||||
mom.utcOffset(timeZoneOffset);
|
||||
}
|
||||
}
|
||||
mom.locale(locale);
|
||||
return mom;
|
||||
}
|
||||
function parseCmdStr(cmdStr) {
|
||||
var parts = cmdStr.match(/^(.*?)\{(.*)\}(.*)$/); // TODO: lookbehinds for escape characters
|
||||
if (parts) {
|
||||
var middle = parseCmdStr(parts[2]);
|
||||
return {
|
||||
head: parts[1],
|
||||
middle: middle,
|
||||
tail: parts[3],
|
||||
whole: parts[1] + middle.whole + parts[3]
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
head: null,
|
||||
middle: null,
|
||||
tail: null,
|
||||
whole: cmdStr
|
||||
};
|
||||
}
|
||||
}
|
||||
function formatRange(cmd, formatStart, formatEnd, separator) {
|
||||
if (cmd.middle) {
|
||||
var startHead = formatStart(cmd.head);
|
||||
var startMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
||||
var startTail = formatStart(cmd.tail);
|
||||
var endHead = formatEnd(cmd.head);
|
||||
var endMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
||||
var endTail = formatEnd(cmd.tail);
|
||||
if (startHead === endHead && startTail === endTail) {
|
||||
return startHead +
|
||||
(startMiddle === endMiddle ? startMiddle : startMiddle + separator + endMiddle) +
|
||||
startTail;
|
||||
}
|
||||
}
|
||||
var startWhole = formatStart(cmd.whole);
|
||||
var endWhole = formatEnd(cmd.whole);
|
||||
if (startWhole === endWhole) {
|
||||
return startWhole;
|
||||
}
|
||||
else {
|
||||
return startWhole + separator + endWhole;
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = main;
|
||||
exports.toDuration = toDuration;
|
||||
exports.toMoment = toMoment;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
6
lib/fullcalendar/moment/main.min.js
vendored
Normal file
6
lib/fullcalendar/moment/main.min.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
FullCalendar Moment Plugin v4.4.2
|
||||
Docs & License: https://fullcalendar.io/
|
||||
(c) 2019 Adam Shaw
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("moment"),require("@fullcalendar/core")):"function"==typeof define&&define.amd?define(["exports","moment","@fullcalendar/core"],t):t((e=e||self).FullCalendarMoment={},e.moment,e.FullCalendar)}(this,(function(e,t,n){"use strict";var r=t;var a=n.createPlugin({cmdFormatter:function(e,t){var n=function e(t){var n=t.match(/^(.*?)\{(.*)\}(.*)$/);if(n){var r=e(n[2]);return{head:n[1],middle:r,tail:n[3],whole:n[1]+r.whole+n[3]}}return{head:null,middle:null,tail:null,whole:t}}(e);if(t.end){var r=l(t.start.array,t.timeZone,t.start.timeZoneOffset,t.localeCodes[0]),a=l(t.end.array,t.timeZone,t.end.timeZoneOffset,t.localeCodes[0]);return function e(t,n,r,a){if(t.middle){var o=n(t.head),l=e(t.middle,n,r,a),u=n(t.tail),i=r(t.head),d=e(t.middle,n,r,a),f=r(t.tail);if(o===i&&u===f)return o+(l===d?l:l+a+d)+u}var c=n(t.whole),m=r(t.whole);return c===m?c:c+a+m}(n,o(r),o(a),t.separator)}return l(t.date.array,t.timeZone,t.date.timeZoneOffset,t.localeCodes[0]).format(n.whole)}});function o(e){return function(t){return t?e.format(t):""}}function l(e,t,n,a){var o;return"local"===t?o=r(e):"UTC"===t?o=r.utc(e):r.tz?o=r.tz(e,t):(o=r.utc(e),null!=n&&o.utcOffset(n)),o.locale(a),o}e.default=a,e.toDuration=function(e){return r.duration(e)},e.toMoment=function(e,t){if(!(t instanceof n.Calendar))throw new Error("must supply a Calendar instance");return l(e,t.dateEnv.timeZone,null,t.dateEnv.locale.codes[0])},Object.defineProperty(e,"__esModule",{value:!0})}));
|
||||
34
lib/fullcalendar/moment/package.json
Normal file
34
lib/fullcalendar/moment/package.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@fullcalendar/moment",
|
||||
"version": "4.4.2",
|
||||
"title": "FullCalendar Moment Plugin",
|
||||
"description": "A connector to the MomentJS date library",
|
||||
"keywords": [
|
||||
"calendar",
|
||||
"event",
|
||||
"full-sized"
|
||||
],
|
||||
"homepage": "https://fullcalendar.io/",
|
||||
"docs": "https://fullcalendar.io/docs/moment-plugins",
|
||||
"bugs": "https://fullcalendar.io/reporting-bugs",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fullcalendar/fullcalendar.git",
|
||||
"homepage": "https://github.com/fullcalendar/fullcalendar"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Adam Shaw",
|
||||
"email": "arshaw@arshaw.com",
|
||||
"url": "http://arshaw.com/"
|
||||
},
|
||||
"copyright": "2019 Adam Shaw",
|
||||
"peerDependencies": {
|
||||
"@fullcalendar/core": "~4.4.0",
|
||||
"moment": "^2.24.0"
|
||||
},
|
||||
"main": "main.js",
|
||||
"module": "main.esm.js",
|
||||
"unpkg": "main.min.js",
|
||||
"types": "main.d.ts"
|
||||
}
|
||||
Reference in New Issue
Block a user