@steedos-widgets/fullcalendar-scheduler 6.10.26 → 6.10.28

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,11 +1,17 @@
1
1
  {
2
2
  "packages": [
3
3
  {
4
- "package": "@steedos-widgets/fullcalendar-scheduler",
4
+ "package": "fullcalendar-scheduler",
5
5
  "urls": [
6
6
  "https://unpkg.steedos.cn/fullcalendar-scheduler@5.11.4/main.min.js",
7
7
  "https://unpkg.steedos.cn/fullcalendar-scheduler@5.11.4/locales-all.min.js",
8
- "https://unpkg.steedos.cn/fullcalendar-scheduler@5.11.4/main.min.css",
8
+ "https://unpkg.steedos.cn/fullcalendar-scheduler@5.11.4/main.min.css"
9
+ ],
10
+ "library": "FullCalendar"
11
+ },
12
+ {
13
+ "package": "@steedos-widgets/fullcalendar-scheduler",
14
+ "urls": [
9
15
  "http://127.0.0.1:8080/@steedos-widgets/fullcalendar-scheduler/dist/fullcalendar.umd.js",
10
16
  "http://127.0.0.1:8080/@steedos-widgets/fullcalendar-scheduler/dist/fullcalendar.umd.css"
11
17
  ],
package/dist/assets.json CHANGED
@@ -1,13 +1,19 @@
1
1
  {
2
2
  "packages": [
3
3
  {
4
- "package": "@steedos-widgets/fullcalendar-scheduler",
4
+ "package": "fullcalendar-scheduler",
5
5
  "urls": [
6
6
  "https://unpkg.com/fullcalendar-scheduler@5.11.4/main.min.js",
7
7
  "https://unpkg.com/fullcalendar-scheduler@5.11.4/locales-all.min.js",
8
- "https://unpkg.com/fullcalendar-scheduler@5.11.4/main.min.css",
9
- "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.26/dist/fullcalendar.umd.js",
10
- "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.26/dist/fullcalendar.umd.css"
8
+ "https://unpkg.com/fullcalendar-scheduler@5.11.4/main.min.css"
9
+ ],
10
+ "library": "FullCalendar"
11
+ },
12
+ {
13
+ "package": "@steedos-widgets/fullcalendar-scheduler",
14
+ "urls": [
15
+ "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.28/dist/fullcalendar.umd.js",
16
+ "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.28/dist/fullcalendar.umd.css"
11
17
  ],
12
18
  "library": "BuilderFullCalendarScheduler"
13
19
  }
@@ -18,10 +24,10 @@
18
24
  "npm": {
19
25
  "package": "@steedos-widgets/fullcalendar-scheduler"
20
26
  },
21
- "url": "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.26/dist/meta.js",
27
+ "url": "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.28/dist/meta.js",
22
28
  "urls": {
23
- "default": "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.26/dist/meta.js",
24
- "design": "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.26/dist/meta.js"
29
+ "default": "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.28/dist/meta.js",
30
+ "design": "https://unpkg.com/@steedos-widgets/fullcalendar-scheduler@6.10.28/dist/meta.js"
25
31
  }
26
32
  }
27
33
  ]
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import './Calendar.css';
3
- export declare const FullCalendar: ({ dispatchEvent: amisDispatchEvent, data: amisData, ...props }: {
3
+ export declare const AmisFullCalendar: ({ dispatchEvent: amisDispatchEvent, data: amisData, ...props }: {
4
4
  [x: string]: any;
5
5
  dispatchEvent: any;
6
6
  data: any;
@@ -1,21 +1,22 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
1
  (function (global, factory) {
3
- (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('amis-core')) : typeof define === 'function' && define.amd ? define(['exports', 'react', 'amis-core'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BuilderFullCalendarScheduler = {}, global.React, global.AmisCore));
4
- })(this, function (exports, React, AmisCore) {
5
- var global = window;
6
- function _interopDefaultLegacy(e) {
7
- return e && _typeof(e) === 'object' && 'default' in e ? e : {
8
- 'default': e
9
- };
10
- }
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('amis-core')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'amis-core'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BuilderFullCalendarScheduler = {}, global.React, global.AmisCore));
5
+ })(this, (function (exports, React, AmisCore) {
6
+ const global = window;
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
11
10
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
11
  var AmisCore__default = /*#__PURE__*/_interopDefaultLegacy(AmisCore);
13
12
 
14
13
  /******************************************************************************
15
14
  Copyright (c) Microsoft Corporation.
16
- Permission to use, copy, modify, and/or distribute this software for any
15
+
16
+ Permission to use, copy, modify, and/or distribute this software for any
17
17
  purpose with or without fee is hereby granted.
18
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
19
20
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20
21
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
21
22
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
@@ -25,305 +26,197 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
25
26
  ***************************************************************************** */
26
27
  /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
27
28
 
28
- var _extendStatics = function extendStatics(d, b) {
29
- _extendStatics = Object.setPrototypeOf || {
30
- __proto__: []
31
- } instanceof Array && function (d, b) {
32
- d.__proto__ = b;
33
- } || function (d, b) {
34
- for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
35
- };
36
- return _extendStatics(d, b);
29
+ var extendStatics = function(d, b) {
30
+ extendStatics = Object.setPrototypeOf ||
31
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
33
+ return extendStatics(d, b);
37
34
  };
35
+
38
36
  function __extends(d, b) {
39
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
40
- _extendStatics(d, b);
41
- function __() {
42
- this.constructor = d;
43
- }
37
+ if (typeof b !== "function" && b !== null)
38
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
39
+ extendStatics(d, b);
40
+ function __() { this.constructor = d; }
44
41
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45
42
  }
46
- var _assign = function __assign() {
47
- _assign = Object.assign || function __assign(t) {
48
- for (var s, i = 1, n = arguments.length; i < n; i++) {
49
- s = arguments[i];
50
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
51
- }
52
- return t;
43
+
44
+ var __assign = function() {
45
+ __assign = Object.assign || function __assign(t) {
46
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
47
+ s = arguments[i];
48
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
49
+ }
50
+ return t;
53
51
  };
54
- return _assign.apply(this, arguments);
52
+ return __assign.apply(this, arguments);
55
53
  };
54
+
56
55
  function __rest(s, e) {
57
56
  var t = {};
58
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
59
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
60
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
61
- }
57
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
58
+ t[p] = s[p];
59
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
60
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
61
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
62
+ t[p[i]] = s[p[i]];
63
+ }
62
64
  return t;
63
65
  }
66
+
64
67
  function __awaiter(thisArg, _arguments, P, generator) {
65
- function adopt(value) {
66
- return value instanceof P ? value : new P(function (resolve) {
67
- resolve(value);
68
- });
69
- }
68
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
70
69
  return new (P || (P = Promise))(function (resolve, reject) {
71
- function fulfilled(value) {
72
- try {
73
- step(generator.next(value));
74
- } catch (e) {
75
- reject(e);
76
- }
77
- }
78
- function rejected(value) {
79
- try {
80
- step(generator["throw"](value));
81
- } catch (e) {
82
- reject(e);
83
- }
84
- }
85
- function step(result) {
86
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
87
- }
88
- step((generator = generator.apply(thisArg, _arguments || [])).next());
70
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
71
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
72
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
73
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
89
74
  });
90
75
  }
76
+
91
77
  function __generator(thisArg, body) {
92
- var _ = {
93
- label: 0,
94
- sent: function sent() {
95
- if (t[0] & 1) throw t[1];
96
- return t[1];
97
- },
98
- trys: [],
99
- ops: []
100
- },
101
- f,
102
- y,
103
- t,
104
- g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
105
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () {
106
- return this;
107
- }), g;
108
- function verb(n) {
109
- return function (v) {
110
- return step([n, v]);
111
- };
112
- }
78
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
79
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
80
+ function verb(n) { return function (v) { return step([n, v]); }; }
113
81
  function step(op) {
114
- if (f) throw new TypeError("Generator is already executing.");
115
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
116
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
117
- if (y = 0, t) op = [op[0] & 2, t.value];
118
- switch (op[0]) {
119
- case 0:
120
- case 1:
121
- t = op;
122
- break;
123
- case 4:
124
- _.label++;
125
- return {
126
- value: op[1],
127
- done: false
128
- };
129
- case 5:
130
- _.label++;
131
- y = op[1];
132
- op = [0];
133
- continue;
134
- case 7:
135
- op = _.ops.pop();
136
- _.trys.pop();
137
- continue;
138
- default:
139
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
140
- _ = 0;
141
- continue;
142
- }
143
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
144
- _.label = op[1];
145
- break;
146
- }
147
- if (op[0] === 6 && _.label < t[1]) {
148
- _.label = t[1];
149
- t = op;
150
- break;
82
+ if (f) throw new TypeError("Generator is already executing.");
83
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
84
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
85
+ if (y = 0, t) op = [op[0] & 2, t.value];
86
+ switch (op[0]) {
87
+ case 0: case 1: t = op; break;
88
+ case 4: _.label++; return { value: op[1], done: false };
89
+ case 5: _.label++; y = op[1]; op = [0]; continue;
90
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
91
+ default:
92
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
93
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
94
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
95
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
96
+ if (t[2]) _.ops.pop();
97
+ _.trys.pop(); continue;
151
98
  }
152
- if (t && _.label < t[2]) {
153
- _.label = t[2];
154
- _.ops.push(op);
155
- break;
156
- }
157
- if (t[2]) _.ops.pop();
158
- _.trys.pop();
159
- continue;
160
- }
161
- op = body.call(thisArg, _);
162
- } catch (e) {
163
- op = [6, e];
164
- y = 0;
165
- } finally {
166
- f = t = 0;
167
- }
168
- if (op[0] & 5) throw op[1];
169
- return {
170
- value: op[0] ? op[1] : void 0,
171
- done: true
172
- };
99
+ op = body.call(thisArg, _);
100
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
101
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
173
102
  }
174
103
  }
104
+
175
105
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
176
106
  var e = new Error(message);
177
107
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
178
108
  };
179
- var DivWrapper = /** @class */function (_super) {
180
- __extends(DivWrapper, _super);
181
- function DivWrapper() {
182
- return _super !== null && _super.apply(this, arguments) || this;
183
- }
184
- DivWrapper.prototype.render = function () {
185
- var _a = this.props,
186
- children = _a.children,
187
- props = __rest(_a, ["children"]);
188
- return React__default["default"].createElement(React__default["default"].Fragment, _assign({}, props), children);
189
- };
190
- return DivWrapper;
191
- }(React__default["default"].Component);
192
- var FullCalendar = function FullCalendar(_a) {
193
- var amisDispatchEvent = _a.dispatchEvent,
194
- amisData = _a.data,
195
- props = __rest(_a, ["dispatchEvent", "data"]);
196
- if (!props.data) {
197
- props.data = {};
198
- }
199
- var calendarWrapperRef = React.useRef(null);
200
- // 1. 创建一个 ref 来引用将要渲染日历的 DOM 元素
201
- var calendarRef = React.useRef(null);
202
- // 2. 创建一个 ref 来存储 FullCalendar 实例
203
- var calendarInstance = React.useRef(null);
204
- var initialLocaleCode = 'zh-cn';
205
- var dispatchEvent = function dispatchEvent(action, value) {
206
- return __awaiter(void 0, void 0, void 0, function () {
207
- var rendererEvent;
208
- var _a;
209
- return __generator(this, function (_b) {
210
- switch (_b.label) {
211
- case 0:
212
- if (!amisDispatchEvent) return [2 /*return*/];
213
- return [4 /*yield*/, amisDispatchEvent(action, value ? AmisCore__default["default"].utils.createObject(amisData, value) : amisData,
214
- //为了解决dispatchevent不生效的问题, https://github.com/baidu/amis/issues/7488
215
- calendarWrapperRef.current)];
216
- case 1:
217
- rendererEvent = _b.sent();
218
- return [2 /*return*/, (_a = rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) !== null && _a !== void 0 ? _a : false];
219
- }
220
- });
221
- });
222
- };
223
- var handleGetEvents = function handleGetEvents(fetchInfo, successCallback, failureCallback) {
224
- // fix:控件初始 render 的时候,dispatchEvent未生效
225
- setTimeout(function () {
226
- dispatchEvent('getEvents', {
227
- fetchInfo: fetchInfo,
228
- successCallback: successCallback,
229
- failureCallback: failureCallback
230
- });
231
- }, 100);
232
- };
233
- var handleSelect = function handleSelect(event) {
234
- dispatchEvent('select', event);
235
- };
236
- var handleEventsSet = function handleEventsSet(event) {
237
- dispatchEvent('eventsSet', event);
238
- };
239
- var handleEventClick = function handleEventClick(event) {
240
- dispatchEvent('eventClick', event);
241
- };
242
- var handleEventAdd = function handleEventAdd(event) {
243
- dispatchEvent('eventAdd', event);
244
- };
245
- var handleEventChange = function handleEventChange(event) {
246
- dispatchEvent('eventChange', event);
247
- };
248
- var handleEventRemove = function handleEventRemove(event) {
249
- dispatchEvent('eventRemove', event);
250
- };
251
- var handleEventDidMount = function handleEventDidMount(event) {
252
- dispatchEvent('eventDidMount', event);
253
- };
254
- var handleEventWillUnmount = function handleEventWillUnmount(event) {
255
- dispatchEvent('eventWillUnmount', event);
256
- };
257
- var handleNoEventsDidMount = function handleNoEventsDidMount(event) {
258
- dispatchEvent('noEventsDidMount', event);
259
- };
260
- var handleNoEventsWillUnmount = function handleNoEventsWillUnmount(event) {
261
- dispatchEvent('noEventsWillUnmount', event);
262
- };
263
- var handleGetRresources = function handleGetRresources(fetchInfo, successCallback, failureCallback) {
264
- // fix:控件初始 render 的时候,dispatchEvent未生效
265
- setTimeout(function () {
266
- dispatchEvent('getRresources', {
267
- fetchInfo: fetchInfo,
268
- successCallback: successCallback,
269
- failureCallback: failureCallback
270
- });
271
- }, 100);
272
- };
273
- // useEffect 在组件挂载后运行
274
- React.useEffect(function () {
275
- // 检查全局 FullCalendar 对象是否可用
276
- if (window.FullCalendar && calendarRef.current) {
277
- // 确保 FullCalendar 实例不存在,避免重复初始化
278
- if (!calendarInstance.current) {
279
- // 3. 初始化 FullCalendar 实例,使用 resourceTimelineWeek 视图
280
- var calendar = new window.FullCalendar.Calendar(calendarRef.current, _assign({
281
- headerToolbar: {
282
- left: 'title',
283
- center: '',
284
- right: 'prev,next today dayGridMonth,timeGridWeek,timeGridDay,listWeek'
285
- },
286
- resources: handleGetRresources,
287
- resourceAreaWidth: "20%",
288
- locale: initialLocaleCode,
289
- editable: true,
290
- selectable: true,
291
- selectMirror: true,
292
- dayMaxEvents: true,
293
- initialView: 'dayGridMonth',
294
- events: handleGetEvents,
295
- select: handleSelect,
296
- eventClick: handleEventClick,
297
- eventsSet: handleEventsSet,
298
- eventAdd: handleEventAdd,
299
- eventChange: handleEventChange,
300
- eventRemove: handleEventRemove,
301
- eventDidMount: handleEventDidMount,
302
- eventWillUnmount: handleEventWillUnmount,
303
- noEventsDidMount: handleNoEventsDidMount,
304
- noEventsWillUnmount: handleNoEventsWillUnmount,
305
- forceEventDuration: true,
306
- schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives'
307
- }, props));
308
- // 4. 渲染日历
309
- calendar.render();
310
- // 5. 将实例存储到 ref 中,以便在卸载时销毁
311
- calendarInstance.current = calendar;
312
- dispatchEvent('setCalendarApi', {
313
- calendarApi: calendar
314
- });
315
- }
109
+
110
+ var DivWrapper = /** @class */ (function (_super) {
111
+ __extends(DivWrapper, _super);
112
+ function DivWrapper() {
113
+ return _super !== null && _super.apply(this, arguments) || this;
316
114
  }
317
- // 6. 清理函数:组件卸载时销毁 FullCalendar 实例
318
- return function () {
319
- if (calendarInstance.current) {
320
- calendarInstance.current.destroy();
321
- calendarInstance.current = null;
322
- }
115
+ DivWrapper.prototype.render = function () {
116
+ var _a = this.props, children = _a.children, props = __rest(_a, ["children"]);
117
+ return (React__default["default"].createElement(React__default["default"].Fragment, __assign({}, props), children));
323
118
  };
324
- }, []); // 空数组依赖项表示只在挂载和卸载时运行
325
- // forceEventDuration属性设置为true修正了把全天事件拖动变更到非全天事件时end为空造成的事件在画布上看不到的问题。
326
- return (
119
+ return DivWrapper;
120
+ }(React__default["default"].Component));
121
+ var AmisFullCalendar = function (_a) {
122
+ var amisDispatchEvent = _a.dispatchEvent, amisData = _a.data, props = __rest(_a, ["dispatchEvent", "data"]);
123
+ if (!props.data) {
124
+ props.data = {};
125
+ }
126
+ var calendarWrapperRef = React.useRef(null);
127
+ // 1. 创建一个 ref 来引用将要渲染日历的 DOM 元素
128
+ var calendarRef = React.useRef(null);
129
+ // 2. 创建一个 ref 来存储 FullCalendar 实例
130
+ var calendarInstance = React.useRef(null);
131
+ var initialLocaleCode = 'zh-cn';
132
+ var dispatchEvent = function (action, value) { return __awaiter(void 0, void 0, void 0, function () {
133
+ var rendererEvent;
134
+ var _a;
135
+ return __generator(this, function (_b) {
136
+ switch (_b.label) {
137
+ case 0:
138
+ if (!amisDispatchEvent)
139
+ return [2 /*return*/];
140
+ return [4 /*yield*/, amisDispatchEvent(action, value ? AmisCore__default["default"].utils.createObject(amisData, value) : amisData,
141
+ //为了解决dispatchevent不生效的问题, https://github.com/baidu/amis/issues/7488
142
+ calendarWrapperRef.current)];
143
+ case 1:
144
+ rendererEvent = _b.sent();
145
+ return [2 /*return*/, (_a = rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) !== null && _a !== void 0 ? _a : false];
146
+ }
147
+ });
148
+ }); };
149
+ var handleGetEvents = function (fetchInfo, successCallback, failureCallback) {
150
+ // fix:控件初始 render 的时候,dispatchEvent未生效
151
+ setTimeout(function () {
152
+ dispatchEvent('getEvents', { fetchInfo: fetchInfo, successCallback: successCallback, failureCallback: failureCallback });
153
+ }, 100);
154
+ };
155
+ var handleSelect = function (event) {
156
+ dispatchEvent('select', event);
157
+ };
158
+ var handleEventsSet = function (event) {
159
+ dispatchEvent('eventsSet', event);
160
+ };
161
+ var handleEventClick = function (event) {
162
+ dispatchEvent('eventClick', event);
163
+ };
164
+ var handleEventAdd = function (event) {
165
+ dispatchEvent('eventAdd', event);
166
+ };
167
+ var handleEventChange = function (event) {
168
+ dispatchEvent('eventChange', event);
169
+ };
170
+ var handleEventRemove = function (event) {
171
+ dispatchEvent('eventRemove', event);
172
+ };
173
+ var handleEventDidMount = function (event) {
174
+ dispatchEvent('eventDidMount', event);
175
+ };
176
+ var handleEventWillUnmount = function (event) {
177
+ dispatchEvent('eventWillUnmount', event);
178
+ };
179
+ var handleNoEventsDidMount = function (event) {
180
+ dispatchEvent('noEventsDidMount', event);
181
+ };
182
+ var handleNoEventsWillUnmount = function (event) {
183
+ dispatchEvent('noEventsWillUnmount', event);
184
+ };
185
+ var handleGetRresources = function (fetchInfo, successCallback, failureCallback) {
186
+ // fix:控件初始 render 的时候,dispatchEvent未生效
187
+ setTimeout(function () {
188
+ dispatchEvent('getRresources', { fetchInfo: fetchInfo, successCallback: successCallback, failureCallback: failureCallback });
189
+ }, 100);
190
+ };
191
+ // useEffect 在组件挂载后运行
192
+ React.useEffect(function () {
193
+ // 检查全局 FullCalendar 对象是否可用
194
+ if (window.FullCalendar && calendarRef.current) {
195
+ // 确保 FullCalendar 实例不存在,避免重复初始化
196
+ if (!calendarInstance.current) {
197
+ // 3. 初始化 FullCalendar 实例,使用 resourceTimelineWeek 视图
198
+ var calendar = new window.FullCalendar.Calendar(calendarRef.current, __assign({ headerToolbar: {
199
+ left: 'title',
200
+ center: '',
201
+ right: 'prev,next today dayGridMonth,timeGridWeek,timeGridDay,listWeek'
202
+ }, resources: handleGetRresources, resourceAreaWidth: "20%", locale: initialLocaleCode, editable: true, selectable: true, selectMirror: true, dayMaxEvents: true, initialView: 'dayGridMonth', events: handleGetEvents, select: handleSelect, eventClick: handleEventClick, eventsSet: handleEventsSet, eventAdd: handleEventAdd, eventChange: handleEventChange, eventRemove: handleEventRemove, eventDidMount: handleEventDidMount, eventWillUnmount: handleEventWillUnmount, noEventsDidMount: handleNoEventsDidMount, noEventsWillUnmount: handleNoEventsWillUnmount, forceEventDuration: true, schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives' }, props));
203
+ // 4. 渲染日历
204
+ calendar.render();
205
+ // 5. 将实例存储到 ref 中,以便在卸载时销毁
206
+ calendarInstance.current = calendar;
207
+ dispatchEvent('setCalendarApi', { calendarApi: calendar });
208
+ }
209
+ }
210
+ // 6. 清理函数:组件卸载时销毁 FullCalendar 实例
211
+ return function () {
212
+ if (calendarInstance.current) {
213
+ calendarInstance.current.destroy();
214
+ calendarInstance.current = null;
215
+ }
216
+ };
217
+ }, []); // 空数组依赖项表示只在挂载和卸载时运行
218
+ // forceEventDuration属性设置为true修正了把全天事件拖动变更到非全天事件时end为空造成的事件在画布上看不到的问题。
219
+ return (
327
220
  // <FullCalendarReact
328
221
  // // plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin, listPlugin]}
329
222
  // headerToolbar={{
@@ -353,17 +246,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
353
246
  // forceEventDuration={true}
354
247
  // {...props}
355
248
  // />
356
- React__default["default"].createElement(DivWrapper, _assign({
357
- id: 'calendar',
358
- ref: calendarWrapperRef
359
- }, props), React__default["default"].createElement("div", {
360
- id: 'calendar',
361
- ref: calendarRef
362
- }))
363
- );
249
+ React__default["default"].createElement(DivWrapper, __assign({ id: 'calendar', ref: calendarWrapperRef }, props),
250
+ React__default["default"].createElement("div", { id: 'calendar', ref: calendarRef })));
364
251
  };
365
- exports.FullCalendar = FullCalendar;
366
- Object.defineProperty(exports, '__esModule', {
367
- value: true
368
- });
369
- });
252
+
253
+ exports.AmisFullCalendar = AmisFullCalendar;
254
+
255
+ Object.defineProperty(exports, '__esModule', { value: true });
256
+
257
+ }));
package/dist/meta.d.ts CHANGED
@@ -1,9 +1,4 @@
1
1
  declare const _default: {
2
- componentList: {
3
- title: string;
4
- icon: string;
5
- children: any[];
6
- }[];
7
2
  components: any[];
8
3
  };
9
4
  export default _default;
package/dist/meta.js CHANGED
@@ -36,15 +36,15 @@
36
36
  };
37
37
 
38
38
  var config = {
39
- group: "华炎魔方",
40
- componentName: "FullCalendar",
39
+ group: "FullCalendar",
40
+ componentName: "AmisFullCalendar",
41
41
  title: "日程",
42
42
  docUrl: "",
43
43
  screenshot: "",
44
44
  npm: {
45
45
  package: "@steedos-widgets/fullcalendar-scheduler",
46
46
  version: "{{version}}",
47
- exportName: "FullCalendar",
47
+ exportName: "AmisFullCalendar",
48
48
  main: "",
49
49
  destructuring: true,
50
50
  subName: ""
@@ -75,7 +75,7 @@
75
75
  weight: 1,
76
76
  framework: "react"
77
77
  },
78
- plugin_disabled: {
78
+ plugin: {
79
79
  rendererName: config.amis.name,
80
80
  $schema: '/schemas/UnkownSchema.json',
81
81
  name: config.title,
@@ -144,15 +144,7 @@
144
144
  * @Description:
145
145
  */
146
146
  var components = [Calendar];
147
- var componentList = [
148
- {
149
- title: "华炎魔方",
150
- icon: "",
151
- children: [Calendar]
152
- }
153
- ];
154
147
  var meta = {
155
- componentList: componentList,
156
148
  components: components
157
149
  };
158
150
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import './Calendar.css';
3
- export declare const FullCalendar: ({ dispatchEvent: amisDispatchEvent, data: amisData, ...props }: {
3
+ export declare const AmisFullCalendar: ({ dispatchEvent: amisDispatchEvent, data: amisData, ...props }: {
4
4
  [x: string]: any;
5
5
  dispatchEvent: any;
6
6
  data: any;
@@ -1,9 +1,4 @@
1
1
  declare const _default: {
2
- componentList: {
3
- title: string;
4
- icon: string;
5
- children: any[];
6
- }[];
7
2
  components: any[];
8
3
  };
9
4
  export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@steedos-widgets/fullcalendar-scheduler",
3
3
  "private": false,
4
- "version": "6.10.26",
4
+ "version": "6.10.28",
5
5
  "main": "dist/fullcalendar.cjs.js",
6
6
  "module": "dist/fullcalendar.esm.js",
7
7
  "unpkg": "dist/fullcalendar.umd.js",
@@ -47,5 +47,5 @@
47
47
  "rollup-plugin-tslib-resolve-id": "^0.0.0",
48
48
  "rollup-plugin-visualizer": "^5.8.0"
49
49
  },
50
- "gitHead": "cfc140e86317274c3e27bcf93ae84354e19c691e"
50
+ "gitHead": "2ec556a4c11f49947fb644b0ff9d7e899f910c5a"
51
51
  }