econtrol-tools-calendar 1.0.1 → 1.0.2
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 +36 -9
- package/dist/calendar.js +9 -8
- package/dist/calendar.js.map +1 -1
- package/dist/calendar.umd.cjs +9 -8
- package/dist/calendar.umd.cjs.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/style.css +138 -138
- package/package.json +1 -1
- /package/dist/components/{FullCalendarDemo.vue.d.ts → S-Calendar.vue.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -28,9 +28,11 @@ yarn add econtrol-tools-calendar
|
|
|
28
28
|
|
|
29
29
|
### 基本使用
|
|
30
30
|
|
|
31
|
+
如果已经通过 `app.use(SCalendar)` 全局注册了组件,可以直接使用:
|
|
32
|
+
|
|
31
33
|
```vue
|
|
32
34
|
<template>
|
|
33
|
-
<
|
|
35
|
+
<SCalendar
|
|
34
36
|
:events="events"
|
|
35
37
|
:userid="currentUserId"
|
|
36
38
|
:device-id="deviceId"
|
|
@@ -45,7 +47,6 @@ yarn add econtrol-tools-calendar
|
|
|
45
47
|
<script setup lang="ts">
|
|
46
48
|
import { ref } from "vue";
|
|
47
49
|
import { ElMessage } from "element-plus";
|
|
48
|
-
import { FullCalendarDemo } from "econtrol-tools-calendar";
|
|
49
50
|
import type { EventInput } from "@fullcalendar/core";
|
|
50
51
|
import "econtrol-tools-calendar/style.css";
|
|
51
52
|
// 注意:还需要导入 Element Plus 的样式
|
|
@@ -100,22 +101,48 @@ function handleEventsChange(newEvents: EventInput[]) {
|
|
|
100
101
|
</script>
|
|
101
102
|
```
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
**注意**:如果没有全局注册组件,需要导入组件:
|
|
105
|
+
|
|
106
|
+
```vue
|
|
107
|
+
<script setup lang="ts">
|
|
108
|
+
import { SCalendarComponent } from "econtrol-tools-calendar";
|
|
109
|
+
// ... 其他代码
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<template>
|
|
113
|
+
<SCalendarComponent
|
|
114
|
+
:events="events"
|
|
115
|
+
:userid="currentUserId"
|
|
116
|
+
:device-id="deviceId"
|
|
117
|
+
:holidays="holidays"
|
|
118
|
+
@event-added="handleEventAdded"
|
|
119
|
+
@event-updated="handleEventUpdated"
|
|
120
|
+
@event-deleted="handleEventDeleted"
|
|
121
|
+
@events-change="handleEventsChange"
|
|
122
|
+
/>
|
|
123
|
+
</template>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 全局注册组件(推荐)
|
|
127
|
+
|
|
128
|
+
使用插件方式全局注册组件:
|
|
104
129
|
|
|
105
130
|
```typescript
|
|
106
131
|
import { createApp } from "vue";
|
|
107
132
|
import App from "./App.vue";
|
|
108
133
|
import ElementPlus from "element-plus";
|
|
109
134
|
import "element-plus/dist/index.css";
|
|
110
|
-
import
|
|
135
|
+
import SCalendar from "econtrol-tools-calendar";
|
|
111
136
|
import "econtrol-tools-calendar/style.css";
|
|
112
137
|
|
|
113
138
|
const app = createApp(App);
|
|
114
139
|
app.use(ElementPlus); // 需要先注册 Element Plus
|
|
115
|
-
app.use(
|
|
140
|
+
app.use(SCalendar); // 全局注册 SCalendar 组件
|
|
116
141
|
app.mount("#app");
|
|
117
142
|
```
|
|
118
143
|
|
|
144
|
+
注册后,可以在任何组件中直接使用 `<SCalendar />`,无需再次导入。
|
|
145
|
+
|
|
119
146
|
## 📖 API 文档
|
|
120
147
|
|
|
121
148
|
### Props
|
|
@@ -196,7 +223,7 @@ interface EventInput {
|
|
|
196
223
|
```vue
|
|
197
224
|
<template>
|
|
198
225
|
<div>
|
|
199
|
-
<
|
|
226
|
+
<SCalendar
|
|
200
227
|
:is-occupied="isOccupied"
|
|
201
228
|
:allow-overlap="allowOverlap"
|
|
202
229
|
:userid="currentUserId"
|
|
@@ -219,7 +246,7 @@ interface EventInput {
|
|
|
219
246
|
<script setup lang="ts">
|
|
220
247
|
import { ref } from "vue";
|
|
221
248
|
import { ElMessage } from "element-plus";
|
|
222
|
-
import {
|
|
249
|
+
import { SCalendarComponent, getHolidays } from "econtrol-tools-calendar";
|
|
223
250
|
import type { EventInput } from "@fullcalendar/core";
|
|
224
251
|
import "econtrol-tools-calendar/style.css";
|
|
225
252
|
import "element-plus/dist/index.css";
|
|
@@ -312,7 +339,7 @@ function handleQuickAddSaved(event: EventInput) {
|
|
|
312
339
|
```vue
|
|
313
340
|
<template>
|
|
314
341
|
<div class="devices-container">
|
|
315
|
-
<
|
|
342
|
+
<SCalendar
|
|
316
343
|
v-for="device in devices"
|
|
317
344
|
:key="device.id"
|
|
318
345
|
:device-id="device.id"
|
|
@@ -329,7 +356,7 @@ function handleQuickAddSaved(event: EventInput) {
|
|
|
329
356
|
|
|
330
357
|
<script setup lang="ts">
|
|
331
358
|
import { ref } from "vue";
|
|
332
|
-
import {
|
|
359
|
+
import { SCalendarComponent } from "econtrol-tools-calendar";
|
|
333
360
|
import type { EventInput } from "@fullcalendar/core";
|
|
334
361
|
|
|
335
362
|
const devices = ref([
|
package/dist/calendar.js
CHANGED
|
@@ -83,7 +83,7 @@ const _hoisted_30 = {
|
|
|
83
83
|
class: "device-detail-loading"
|
|
84
84
|
};
|
|
85
85
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
86
|
-
__name: "
|
|
86
|
+
__name: "S-Calendar",
|
|
87
87
|
props: {
|
|
88
88
|
isOccupied: { type: Boolean, default: false },
|
|
89
89
|
allowOverlap: { type: Boolean, default: true },
|
|
@@ -1534,7 +1534,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
1534
1534
|
}
|
|
1535
1535
|
return target;
|
|
1536
1536
|
};
|
|
1537
|
-
const
|
|
1537
|
+
const SCalendarComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9e494e20"]]);
|
|
1538
1538
|
function getHolidays(year) {
|
|
1539
1539
|
const holidays = {};
|
|
1540
1540
|
if (year === 2026) {
|
|
@@ -1585,15 +1585,16 @@ function formatDate(date) {
|
|
|
1585
1585
|
const day = String(date.getDate()).padStart(2, "0");
|
|
1586
1586
|
return `${year}-${month}-${day}`;
|
|
1587
1587
|
}
|
|
1588
|
-
|
|
1589
|
-
app
|
|
1590
|
-
|
|
1588
|
+
const SCalendar = {
|
|
1589
|
+
install(app) {
|
|
1590
|
+
app.component("SCalendar", SCalendarComponent);
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1591
1593
|
export {
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
+
SCalendarComponent,
|
|
1595
|
+
SCalendar as default,
|
|
1594
1596
|
formatDate,
|
|
1595
1597
|
getHolidays,
|
|
1596
|
-
install,
|
|
1597
1598
|
isHoliday
|
|
1598
1599
|
};
|
|
1599
1600
|
//# sourceMappingURL=calendar.js.map
|