@nocobase/plugin-calendar 2.1.0-alpha.2 → 2.1.0-alpha.20

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.
@@ -0,0 +1,68 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { CollectionBlockModel } from '@nocobase/client';
10
+ import { MultiRecordResource } from '@nocobase/flow-engine';
11
+ import React from 'react';
12
+ type CalendarCollectionField = {
13
+ name: string;
14
+ title?: string;
15
+ interface?: string;
16
+ type?: string;
17
+ uiSchema?: {
18
+ title?: string;
19
+ type?: string;
20
+ };
21
+ };
22
+ export declare class CalendarBlockModel extends CollectionBlockModel {
23
+ static scene: import("@nocobase/client").BlockSceneType;
24
+ customModelClasses: {
25
+ CollectionActionGroupModel: string;
26
+ };
27
+ static filterCollection(collection: any): boolean;
28
+ get calendarPlugin(): any;
29
+ getTitleInterfaces(): string[];
30
+ getColorInterfaces(): string[];
31
+ getDateFieldTypes(): any[];
32
+ getCollectionFields(): CalendarCollectionField[];
33
+ getTitleFieldOptions(): {
34
+ label: string;
35
+ value: string;
36
+ }[];
37
+ getColorFieldOptions(): {
38
+ label: string;
39
+ value: string;
40
+ }[];
41
+ getDateFieldOptions(): {
42
+ label: string;
43
+ value: string;
44
+ }[];
45
+ getDefaultTitleFieldName(): any;
46
+ getDefaultStartFieldName(): string;
47
+ getDefaultEndFieldName(): string;
48
+ getDefaultView(): any;
49
+ getEventOpenMode(): "dialog" | "drawer" | "embed";
50
+ getWeekStart(): 1 | 0;
51
+ getFieldNames(): {
52
+ id: string;
53
+ title: any;
54
+ start: any;
55
+ end: any;
56
+ colorFieldName: any;
57
+ };
58
+ createResource(): MultiRecordResource<unknown>;
59
+ renderComponent(): React.JSX.Element;
60
+ getQuickCreateAction(): any;
61
+ getEventViewAction(): any;
62
+ getPopupActionUid(actionKey: 'quickCreateAction' | 'eventViewAction'): string;
63
+ syncPopupActionOpenMode(action: any): Promise<void>;
64
+ ensurePopupAction(actionKey: 'quickCreateAction' | 'eventViewAction'): Promise<any>;
65
+ openQuickCreate(slotInfo: any): Promise<void>;
66
+ openEvent(record: any): Promise<void>;
67
+ }
68
+ export {};
@@ -0,0 +1,47 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { ActionModel, CollectionActionGroupModel } from '@nocobase/client';
10
+ import React from 'react';
11
+ export declare class CalendarCollectionActionGroupModel extends CollectionActionGroupModel {
12
+ }
13
+ export declare class CalendarTodayActionModel extends ActionModel {
14
+ static scene: "collection";
15
+ defaultProps: {
16
+ type: "default";
17
+ title: string;
18
+ };
19
+ render(): React.JSX.Element;
20
+ }
21
+ export declare class CalendarNavActionModel extends ActionModel {
22
+ static scene: "collection";
23
+ enableEditTooltip: boolean;
24
+ enableEditTitle: boolean;
25
+ enableEditIcon: boolean;
26
+ enableEditType: boolean;
27
+ enableEditDanger: boolean;
28
+ render(): React.JSX.Element;
29
+ }
30
+ export declare class CalendarTitleActionModel extends ActionModel {
31
+ static scene: "collection";
32
+ enableEditTooltip: boolean;
33
+ enableEditTitle: boolean;
34
+ enableEditIcon: boolean;
35
+ enableEditType: boolean;
36
+ enableEditDanger: boolean;
37
+ render(): React.JSX.Element;
38
+ }
39
+ export declare class CalendarViewSelectActionModel extends ActionModel {
40
+ static scene: "collection";
41
+ enableEditTooltip: boolean;
42
+ enableEditTitle: boolean;
43
+ enableEditIcon: boolean;
44
+ enableEditType: boolean;
45
+ enableEditDanger: boolean;
46
+ render(): React.JSX.Element;
47
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { AddNewActionModel, ViewActionModel } from '@nocobase/client';
10
+ export declare const createCalendarQuickCreateActionOptions: (uid?: string) => {
11
+ uid: string;
12
+ use: string;
13
+ };
14
+ export declare const createCalendarEventViewActionOptions: (uid?: string) => {
15
+ uid: string;
16
+ use: string;
17
+ };
18
+ export declare class CalendarQuickCreateActionModel extends AddNewActionModel {
19
+ defaultPopupTitle: string;
20
+ }
21
+ export declare class CalendarEventViewActionModel extends ViewActionModel {
22
+ defaultPopupTitle: string;
23
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ import { View } from 'react-big-calendar';
11
+ interface Event {
12
+ id: string;
13
+ colorFieldValue: string;
14
+ title: string;
15
+ rawTitle?: string;
16
+ start: Date;
17
+ end: Date;
18
+ }
19
+ type CalendarBlockProps = {
20
+ actionBar?: React.ReactNode;
21
+ collection: any;
22
+ dataSource: any[];
23
+ defaultView?: View;
24
+ fieldNames: {
25
+ colorFieldName: string;
26
+ start: string;
27
+ end: string;
28
+ id: string;
29
+ title: string;
30
+ };
31
+ getBackgroundColor?: (value: string) => string | null;
32
+ getFontColor?: (value: string) => string | null;
33
+ onSelectEvent?: (payload: {
34
+ event: Event;
35
+ record: any;
36
+ }) => void;
37
+ onSelectSlot?: (payload: any) => void;
38
+ rangeLoadEnabled?: boolean;
39
+ resource?: any;
40
+ showLunar?: boolean;
41
+ weekStart?: number;
42
+ };
43
+ export declare const CalendarBlock: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<CalendarBlockProps>>;
44
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ type CalendarHeaderProps = {
11
+ date: Date;
12
+ label: string;
13
+ drilldownView?: string;
14
+ onDrillDown?: () => void;
15
+ showLunar?: boolean;
16
+ type?: 'week' | 'month';
17
+ localizer?: any;
18
+ locale?: string;
19
+ };
20
+ export declare const CalendarHeader: ({ date, label, drilldownView, onDrillDown, showLunar, type, localizer, locale, }: CalendarHeaderProps) => React.JSX.Element;
21
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ type CalendarToolbarProps = {
11
+ date: Date;
12
+ label: string;
13
+ onNavigate: (action: string) => void;
14
+ onView: (view: string) => void;
15
+ view: string;
16
+ views: string[];
17
+ showLunar?: boolean;
18
+ };
19
+ export declare const CalendarToolbar: ({ date, label, onNavigate, onView, view, views, showLunar }: CalendarToolbarProps) => React.JSX.Element;
20
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ import type { View } from 'react-big-calendar';
11
+ export type CalendarNavigationAction = 'TODAY' | 'PREV' | 'NEXT';
12
+ export type CalendarViewContextValue = {
13
+ date: Date;
14
+ label: string;
15
+ navigate: (action: CalendarNavigationAction) => void;
16
+ showLunar?: boolean;
17
+ view: View;
18
+ views: View[];
19
+ setView: (view: View) => void;
20
+ };
21
+ export declare const CalendarViewProvider: React.Provider<CalendarViewContextValue>;
22
+ export declare const useCalendarViewContext: () => CalendarViewContextValue;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export * from './CalendarBlock';
10
+ export * from './CalendarHeader';
11
+ export * from './CalendarToolbar';
12
+ export * from './CalendarViewContext';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ declare const _default: (props?: any) => import("@nocobase/client/es/schema-component/antd/__builtins__").UseComponentStyleResult;
10
+ export default _default;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export * from './CalendarBlockModel';
10
+ export * from './actions/CalendarActionModels';
11
+ export * from './actions/CalendarPopupModels';
@@ -0,0 +1,44 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import dayjs from 'dayjs';
10
+ export declare const CALENDAR_RANGE_FILTER_GROUP = "__calendar_view_range__";
11
+ export type CalendarVisibleRange = {
12
+ start: Date;
13
+ end: Date;
14
+ };
15
+ export declare const normalizeCalendarFieldPath: (fieldPath?: string | string[]) => string;
16
+ export declare const parseCalendarWeekStart: (weekStart?: number | string) => 1 | 0;
17
+ export declare const getCalendarVisibleRange: (value: Date | string, view?: 'month' | 'week' | 'day' | string, weekStart?: number | string) => CalendarVisibleRange;
18
+ export declare const formatDate: (date: dayjs.Dayjs) => string;
19
+ export declare const createCalendarRangeFilter: (fieldNames: {
20
+ start?: string | string[];
21
+ end?: string | string[];
22
+ }, range: CalendarVisibleRange) => {
23
+ [x: string]: {
24
+ $gte: string;
25
+ $lte: string;
26
+ };
27
+ } | {
28
+ $or: ({
29
+ [x: string]: {
30
+ $gte: string;
31
+ $lte: string;
32
+ };
33
+ } | {
34
+ $and: ({
35
+ [x: string]: {
36
+ $lte: string;
37
+ };
38
+ } | {
39
+ [x: string]: {
40
+ $gte: string;
41
+ };
42
+ })[];
43
+ })[];
44
+ };
@@ -8,16 +8,16 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.2",
11
+ "@nocobase/client": "2.1.0-alpha.20",
12
12
  "react": "18.2.0",
13
13
  "react-i18next": "11.18.6",
14
- "@nocobase/server": "2.1.0-alpha.2",
15
- "@nocobase/test": "2.1.0-alpha.2",
14
+ "@nocobase/server": "2.1.0-alpha.20",
15
+ "@nocobase/test": "2.1.0-alpha.20",
16
16
  "@ant-design/icons": "5.6.1",
17
17
  "@formily/react": "2.3.7",
18
18
  "dayjs": "1.11.13",
19
- "lodash": "4.17.21",
20
- "@nocobase/flow-engine": "2.1.0-alpha.2",
19
+ "lodash": "4.18.1",
20
+ "@nocobase/flow-engine": "2.1.0-alpha.20",
21
21
  "antd": "5.24.2",
22
22
  "react-dom": "18.2.0",
23
23
  "antd-style": "3.7.1",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-calendar",
3
- "version": "2.1.0-alpha.2",
3
+ "version": "2.1.0-alpha.20",
4
4
  "displayName": "Calendar",
5
5
  "displayName.ru-RU": "Календарь",
6
6
  "displayName.zh-CN": "日历",
7
7
  "description": "Provides callendar collection template and block for managing date data, typically for date/time related information such as events, appointments, tasks, and so on.",
8
8
  "description.ru-RU": "Предоставляет шаблон коллекции календаря и блок для управления данными дат — такими как события, встречи, задачи и другие связанные с датой/временем данные.",
9
9
  "description.zh-CN": "提供日历数据表模板和区块,用于管理日期数据,通常用于事件、约会、任务等与日期/时间相关的信息。",
10
- "license": "AGPL-3.0",
10
+ "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/calendar",
13
13
  "homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/calendar",
@@ -39,7 +39,7 @@
39
39
  "url": "git+https://github.com/nocobase/nocobase.git",
40
40
  "directory": "packages/plugins/calendar"
41
41
  },
42
- "gitHead": "01afd1b928c72c072947533fb12a61b06e45c985",
42
+ "gitHead": "3d1535db6bf93ca23257faf474afee0d565f54c6",
43
43
  "keywords": [
44
44
  "Collections",
45
45
  "Blocks"
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- (self.webpackChunk_nocobase_plugin_calendar=self.webpackChunk_nocobase_plugin_calendar||[]).push([["453"],{606:function(e,t,n){"use strict";var r=n(561).default;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"add",{enumerable:!0,get:function(){return u.add}}),t.ceil=function(e,t){var n=u.startOf(e,t);return u.eq(n,e)?n:u.add(n,1,t)},t.diff=function(e,t,n){return n&&"milliseconds"!==n?Math.round(Math.abs(+u.startOf(e,n)/o[n]-+u.startOf(t,n)/o[n])):Math.abs(+e-+t)},t.duration=function(e,t,n,r){return"day"===n&&(n="date"),Math.abs(u[n](e,void 0,r)-u[n](t,void 0,r))},Object.defineProperty(t,"endOf",{enumerable:!0,get:function(){return u.endOf}}),Object.defineProperty(t,"eq",{enumerable:!0,get:function(){return u.eq}}),t.eqTime=function(e,t){return u.hours(e)===u.hours(t)&&u.minutes(e)===u.minutes(t)&&u.seconds(e)===u.seconds(t)},t.firstVisibleDay=i,Object.defineProperty(t,"gt",{enumerable:!0,get:function(){return u.gt}}),Object.defineProperty(t,"gte",{enumerable:!0,get:function(){return u.gte}}),Object.defineProperty(t,"hours",{enumerable:!0,get:function(){return u.hours}}),Object.defineProperty(t,"inRange",{enumerable:!0,get:function(){return u.inRange}}),t.isJustDate=function(e){return 0===u.hours(e)&&0===u.minutes(e)&&0===u.seconds(e)&&0===u.milliseconds(e)},t.lastVisibleDay=s,Object.defineProperty(t,"lt",{enumerable:!0,get:function(){return u.lt}}),Object.defineProperty(t,"lte",{enumerable:!0,get:function(){return u.lte}}),Object.defineProperty(t,"max",{enumerable:!0,get:function(){return u.max}}),t.merge=function(e,t){return null==t&&null==e?null:(null==t&&(t=new Date),null==e&&(e=new Date),e=u.startOf(e,"day"),e=u.hours(e,u.hours(t)),e=u.minutes(e,u.minutes(t)),e=u.seconds(e,u.seconds(t)),u.milliseconds(e,u.milliseconds(t)))},Object.defineProperty(t,"milliseconds",{enumerable:!0,get:function(){return u.milliseconds}}),Object.defineProperty(t,"min",{enumerable:!0,get:function(){return u.min}}),Object.defineProperty(t,"minutes",{enumerable:!0,get:function(){return u.minutes}}),Object.defineProperty(t,"month",{enumerable:!0,get:function(){return u.month}}),t.monthsInYear=function(e){var t=new Date(e,0,1);return a.map(function(e){return u.month(t,e)})},Object.defineProperty(t,"neq",{enumerable:!0,get:function(){return u.neq}}),t.range=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"day",r=e,o=[];u.lte(r,t,n);)o.push(r),r=u.add(r,1,n);return o},Object.defineProperty(t,"seconds",{enumerable:!0,get:function(){return u.seconds}}),Object.defineProperty(t,"startOf",{enumerable:!0,get:function(){return u.startOf}}),t.today=function(){return u.startOf(new Date,"day")},t.tomorrow=function(){return u.add(u.startOf(new Date,"day"),1,"day")},t.total=function(e,t){var n=e.getTime(),r=1;switch(t){case"week":r*=7;case"day":r*=24;case"hours":r*=60;case"minutes":r*=60;case"seconds":r*=1e3}return n/r},t.visibleDays=function(e,t){for(var n=i(e,t),r=s(e,t),o=[];u.lte(n,r,"day");)o.push(n),n=u.add(n,1,"day");return o},t.week=function(e){var t=new Date(e);return t.setHours(0,0,0),t.setDate(t.getDate()+4-(t.getDay()||7)),Math.ceil(((t-new Date(t.getFullYear(),0,1))/864e5+1)/7)},t.yesterday=function(){return u.add(u.startOf(new Date,"day"),-1,"day")};var u=r(n(63)),o={seconds:1e3,minutes:6e4,hours:36e5,day:864e5},a=[0,1,2,3,4,5,6,7,8,9,10,11];function i(e,t){var n=u.startOf(e,"month");return u.startOf(n,"week",t.startOfWeek())}function s(e,t){var n=u.endOf(e,"month");return u.endOf(n,"week",t.startOfWeek())}},561:function(e,t,n){var r=n(265).default;function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}e.exports=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=r(e)&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&({}).hasOwnProperty.call(e,i)){var s=a?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o},e.exports.__esModule=!0,e.exports.default=e.exports},265:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}}]);