econtrol-tools-calendar 1.0.5 → 1.0.6

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/README.md CHANGED
@@ -340,9 +340,9 @@ function handleQuickAddSaved(event: EventInput) {
340
340
  <template>
341
341
  <div class="devices-container">
342
342
  <SCalendar
343
- v-for="device in devices"
344
- :key="device.id"
345
- :device-id="device.id"
343
+ v-for="device in devices"
344
+ :key="device.id"
345
+ :device-id="device.id"
346
346
  :device-info="device"
347
347
  :events="deviceEvents[device.id] || []"
348
348
  :userid="currentUserId"
@@ -350,7 +350,7 @@ function handleQuickAddSaved(event: EventInput) {
350
350
  @event-updated="(event) => handleEventUpdated(device.id, event)"
351
351
  @event-deleted="(eventId) => handleEventDeleted(device.id, eventId)"
352
352
  @events-change="(events) => handleEventsChange(device.id, events)"
353
- />
353
+ />
354
354
  </div>
355
355
  </template>
356
356
 
@@ -392,7 +392,7 @@ function handleEventDeleted(deviceId: string, eventId: string) {
392
392
  deviceEvents.value[deviceId] = deviceEvents.value[deviceId].filter(
393
393
  (e) => e.id !== eventId
394
394
  );
395
- }
395
+ }
396
396
  }
397
397
 
398
398
  function handleEventsChange(deviceId: string, events: EventInput[]) {
package/dist/calendar.js CHANGED
@@ -5,7 +5,7 @@ import timeGridPlugin from "@fullcalendar/timegrid";
5
5
  import listPlugin from "@fullcalendar/list";
6
6
  import interactionPlugin from "@fullcalendar/interaction";
7
7
  import { ElMessage } from "element-plus";
8
- import { User, Clock, Calendar, Monitor, Document } from "@element-plus/icons-vue";
8
+ import { Clock, Calendar, User, Monitor, Document } from "@element-plus/icons-vue";
9
9
  var l77 = {
10
10
  code: "zh-cn",
11
11
  week: {
@@ -72,13 +72,17 @@ const _hoisted_23 = {
72
72
  const _hoisted_24 = { class: "detail-label" };
73
73
  const _hoisted_25 = { class: "detail-value description-text" };
74
74
  const _hoisted_26 = { class: "event-content" };
75
- const _hoisted_27 = { class: "event-time" };
76
- const _hoisted_28 = { class: "event-title" };
77
- const _hoisted_29 = {
75
+ const _hoisted_27 = {
78
76
  key: 0,
79
- class: "device-detail-content"
77
+ class: "my-event-marker"
80
78
  };
79
+ const _hoisted_28 = { class: "event-time" };
80
+ const _hoisted_29 = { class: "event-title" };
81
81
  const _hoisted_30 = {
82
+ key: 0,
83
+ class: "device-detail-content"
84
+ };
85
+ const _hoisted_31 = {
82
86
  key: 1,
83
87
  class: "device-detail-loading"
84
88
  };
@@ -100,6 +104,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
100
104
  setup(__props, { emit: __emit }) {
101
105
  const emit = __emit;
102
106
  const props = __props;
107
+ const calendarRef = ref(null);
103
108
  const dialogVisible = ref(false);
104
109
  const editingEvent = ref(null);
105
110
  const deviceDialogVisible = ref(false);
@@ -691,12 +696,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
691
696
  iconEl.className = "my-event-icon";
692
697
  iconEl.innerHTML = "★";
693
698
  iconEl.style.cssText = `
699
+ display: inline-flex;
700
+ align-items: center;
701
+ justify-content: center;
694
702
  position: absolute;
695
703
  left: 2px;
696
704
  top: 50%;
697
705
  transform: translateY(-50%);
698
706
  font-size: 8px;
699
707
  color: #fff;
708
+ background-color: #409eff;
709
+ border-radius: 2px;
710
+ width: 12px;
711
+ height: 12px;
700
712
  line-height: 1;
701
713
  z-index: 20;
702
714
  pointer-events: none;
@@ -813,6 +825,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
813
825
  }
814
826
  const startStr = formatFromISO(props.quickAddTimeRange.start);
815
827
  const endStr = formatFromISO(props.quickAddTimeRange.end);
828
+ if (calendarRef.value) {
829
+ try {
830
+ const calendarApi = calendarRef.value.getApi();
831
+ const currentView = calendarApi.view;
832
+ const quickAddStartDate = new Date(props.quickAddTimeRange.start);
833
+ const viewStart = new Date(currentView.activeStart);
834
+ const viewEnd = new Date(currentView.activeEnd);
835
+ const isInView = quickAddStartDate >= viewStart && quickAddStartDate < viewEnd;
836
+ if (!isInView) {
837
+ calendarApi.gotoDate(quickAddStartDate);
838
+ }
839
+ } catch (error) {
840
+ console.warn("无法获取日历 API:", error);
841
+ }
842
+ }
816
843
  if (isPastDateTime(startStr)) {
817
844
  ElMessage.warning("不能选择今天之前的时间进行预约");
818
845
  return;
@@ -1201,6 +1228,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1201
1228
  ])
1202
1229
  ]),
1203
1230
  createVNode(unref(FullCalendar), {
1231
+ ref_key: "calendarRef",
1232
+ ref: calendarRef,
1204
1233
  options: calendarOptions.value,
1205
1234
  class: "calendar"
1206
1235
  }, {
@@ -1298,17 +1327,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1298
1327
  }),
1299
1328
  default: withCtx(() => [
1300
1329
  createElementVNode("div", _hoisted_26, [
1301
- isMyEvent(arg.event) ? (openBlock(), createBlock(_component_el_icon, {
1302
- key: 0,
1303
- class: "my-event-marker"
1304
- }, {
1305
- default: withCtx(() => [
1306
- createVNode(unref(User))
1307
- ]),
1308
- _: 1
1309
- })) : createCommentVNode("", true),
1310
- createElementVNode("span", _hoisted_27, toDisplayString(arg.timeText), 1),
1311
- createElementVNode("span", _hoisted_28, toDisplayString(truncateTitle(arg.event.title, 10)), 1)
1330
+ isMyEvent(arg.event) ? (openBlock(), createElementBlock("span", _hoisted_27, "★")) : createCommentVNode("", true),
1331
+ createElementVNode("span", _hoisted_28, toDisplayString(arg.timeText), 1),
1332
+ createElementVNode("span", _hoisted_29, toDisplayString(truncateTitle(arg.event.title, 10)), 1)
1312
1333
  ])
1313
1334
  ]),
1314
1335
  _: 2
@@ -1467,7 +1488,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1467
1488
  })
1468
1489
  ]),
1469
1490
  default: withCtx(() => [
1470
- deviceInfo.value ? (openBlock(), createElementBlock("div", _hoisted_29, [
1491
+ deviceInfo.value ? (openBlock(), createElementBlock("div", _hoisted_30, [
1471
1492
  createVNode(_component_el_descriptions, {
1472
1493
  column: 1,
1473
1494
  border: ""
@@ -1531,7 +1552,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1531
1552
  ]),
1532
1553
  _: 1
1533
1554
  })
1534
- ])) : (openBlock(), createElementBlock("div", _hoisted_30, [
1555
+ ])) : (openBlock(), createElementBlock("div", _hoisted_31, [
1535
1556
  createVNode(_component_el_empty, { description: "暂无设备信息" })
1536
1557
  ]))
1537
1558
  ]),
@@ -1548,7 +1569,7 @@ const _export_sfc = (sfc, props) => {
1548
1569
  }
1549
1570
  return target;
1550
1571
  };
1551
- const SCalendarComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fb085ef2"]]);
1572
+ const SCalendarComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-03fbb1ab"]]);
1552
1573
  function getHolidays(year) {
1553
1574
  const holidays = {};
1554
1575
  if (year === 2026) {