v-nuxt-ui 0.1.26 → 0.1.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.
Files changed (51) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/date-picker/index.d.vue.ts +1 -2
  3. package/dist/runtime/components/date-picker/index.vue +1 -1
  4. package/dist/runtime/components/date-picker/index.vue.d.ts +1 -2
  5. package/dist/runtime/components/sys/calendar/board.d.vue.ts +3 -0
  6. package/dist/runtime/components/sys/calendar/board.vue +222 -0
  7. package/dist/runtime/components/sys/calendar/board.vue.d.ts +3 -0
  8. package/dist/runtime/components/sys/company/CreateModal.d.vue.ts +1 -1
  9. package/dist/runtime/components/sys/company/CreateModal.vue +1 -1
  10. package/dist/runtime/components/sys/company/CreateModal.vue.d.ts +1 -1
  11. package/dist/runtime/components/sys/department/CreateModal.d.vue.ts +1 -1
  12. package/dist/runtime/components/sys/department/CreateModal.vue +1 -1
  13. package/dist/runtime/components/sys/department/CreateModal.vue.d.ts +1 -1
  14. package/dist/runtime/components/sys/issue-record/CreateModal.d.vue.ts +13 -0
  15. package/dist/runtime/components/sys/issue-record/CreateModal.vue +23 -0
  16. package/dist/runtime/components/sys/issue-record/CreateModal.vue.d.ts +13 -0
  17. package/dist/runtime/components/sys/issue-record/Table.d.vue.ts +3 -0
  18. package/dist/runtime/components/sys/issue-record/Table.vue +32 -0
  19. package/dist/runtime/components/sys/issue-record/Table.vue.d.ts +3 -0
  20. package/dist/runtime/components/sys/job-title/CreateModal.d.vue.ts +1 -1
  21. package/dist/runtime/components/sys/job-title/CreateModal.vue +1 -1
  22. package/dist/runtime/components/sys/job-title/CreateModal.vue.d.ts +1 -1
  23. package/dist/runtime/components/sys/menu/CreateModal.d.vue.ts +1 -1
  24. package/dist/runtime/components/sys/menu/CreateModal.vue +1 -1
  25. package/dist/runtime/components/sys/menu/CreateModal.vue.d.ts +1 -1
  26. package/dist/runtime/components/sys/role/CreateModal.d.vue.ts +1 -1
  27. package/dist/runtime/components/sys/role/CreateModal.vue +1 -1
  28. package/dist/runtime/components/sys/role/CreateModal.vue.d.ts +1 -1
  29. package/dist/runtime/components/sys/user/CreateModal.d.vue.ts +1 -1
  30. package/dist/runtime/components/sys/user/CreateModal.vue +1 -1
  31. package/dist/runtime/components/sys/user/CreateModal.vue.d.ts +1 -1
  32. package/dist/runtime/composables/api/sys/index.d.ts +2 -0
  33. package/dist/runtime/composables/api/sys/index.js +2 -0
  34. package/dist/runtime/composables/api/sys/useCalendarApi.d.ts +10 -0
  35. package/dist/runtime/composables/api/sys/useCalendarApi.js +8 -0
  36. package/dist/runtime/composables/api/sys/useIssueRecordApi.d.ts +2 -0
  37. package/dist/runtime/composables/api/sys/useIssueRecordApi.js +3 -0
  38. package/dist/runtime/composables/useDate.d.ts +2 -2
  39. package/dist/runtime/composables/useDate.js +5 -0
  40. package/dist/runtime/constants/calendar.d.ts +8 -0
  41. package/dist/runtime/constants/calendar.js +13 -0
  42. package/dist/runtime/constants/index.d.ts +1 -0
  43. package/dist/runtime/constants/index.js +1 -0
  44. package/dist/runtime/types/cmds/calendar.d.ts +4 -0
  45. package/dist/runtime/types/cmds/calendar.js +0 -0
  46. package/dist/runtime/types/cmds/index.d.ts +1 -0
  47. package/dist/runtime/types/cmds/index.js +1 -0
  48. package/dist/runtime/types/models/sys.d.ts +7 -0
  49. package/dist/runtime/types/time.d.ts +6 -0
  50. package/dist/runtime/types/time.js +7 -0
  51. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "dependencies": [
8
8
  "@nuxt/ui"
9
9
  ],
10
- "version": "0.1.26",
10
+ "version": "0.1.28",
11
11
  "builder": {
12
12
  "@nuxt/module-builder": "1.0.2",
13
13
  "unbuild": "3.6.1"
@@ -1,7 +1,6 @@
1
1
  import type { ButtonProps } from '@nuxt/ui';
2
2
  import type { DateRange, DateValue } from 'reka-ui';
3
- import type { TimeUnit } from '#v/constants';
4
- import type { DateShortcut } from '#v/types';
3
+ import type { DateShortcut, TimeUnit } from '#v/types';
5
4
  type __VLS_Props = {
6
5
  size?: ButtonProps['size'];
7
6
  loading?: ButtonProps['loading'];
@@ -12,7 +12,7 @@ const props = defineProps({
12
12
  loading: { type: Boolean, required: false },
13
13
  range: { type: Boolean, required: false },
14
14
  placeholder: { type: String, required: false },
15
- timeUnit: { type: null, required: false },
15
+ timeUnit: { type: String, required: false },
16
16
  leadingIcon: { type: null, required: false },
17
17
  shortcuts: { type: Array, required: false },
18
18
  peerButtons: { type: Array, required: false }
@@ -1,7 +1,6 @@
1
1
  import type { ButtonProps } from '@nuxt/ui';
2
2
  import type { DateRange, DateValue } from 'reka-ui';
3
- import type { TimeUnit } from '#v/constants';
4
- import type { DateShortcut } from '#v/types';
3
+ import type { DateShortcut, TimeUnit } from '#v/types';
5
4
  type __VLS_Props = {
6
5
  size?: ButtonProps['size'];
7
6
  loading?: ButtonProps['loading'];
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,222 @@
1
+ <script setup>
2
+ import { useDate, useFetching, useSubmitting } from "#v/composables";
3
+ import { useCalendarApi } from "#v/composables/api/sys/useCalendarApi";
4
+ import { TIME_ZONE, dateFormat, calendarEventTypeOptions } from "#v/constants";
5
+ import { CalendarEventType } from "#v/types";
6
+ import { endOfMonth, now, startOfMonth } from "@internationalized/date";
7
+ import { useToast } from "@nuxt/ui/runtime/composables/useToast.js";
8
+ import { ref, computed, watch } from "vue";
9
+ const apiGroup = useCalendarApi();
10
+ const dateUtil = useDate();
11
+ const toast = useToast();
12
+ const panelDate = ref(now(TIME_ZONE));
13
+ const calendars = ref([]);
14
+ const calendarTypeMap = computed(() => {
15
+ const map = {};
16
+ for (const calendar of calendars.value) {
17
+ map[dateUtil.isoUtcStringToDayjs(calendar.date).format(dateFormat)] = calendar.type;
18
+ }
19
+ return map;
20
+ });
21
+ const { fetching, startFetching, endFetching } = useFetching();
22
+ const fetchCalendars = async () => {
23
+ const start = startOfMonth(panelDate.value).subtract({ days: 7 });
24
+ const end = endOfMonth(panelDate.value).add({ days: 7 });
25
+ try {
26
+ startFetching();
27
+ const { data } = await apiGroup.list({
28
+ whereQuery: {
29
+ items: [
30
+ {
31
+ field: "date",
32
+ opr: "range_gte_lte",
33
+ value: {
34
+ start: start.toAbsoluteString(),
35
+ end: end.toAbsoluteString()
36
+ }
37
+ },
38
+ { field: "type", opr: "ne", value: CalendarEventType.NONE }
39
+ ]
40
+ }
41
+ });
42
+ if (data.value.data) {
43
+ mergeCalendars(data.value.data.list);
44
+ }
45
+ } finally {
46
+ endFetching();
47
+ }
48
+ };
49
+ const mergeCalendars = (newModels) => {
50
+ const newCalendars = [...calendars.value];
51
+ for (const newModel of newModels) {
52
+ const index = newCalendars.findIndex((m) => m.date === newModel.date);
53
+ if (index !== -1) {
54
+ newCalendars[index] = newModel;
55
+ } else {
56
+ newCalendars.push(newModel);
57
+ }
58
+ }
59
+ calendars.value = newCalendars.filter((calendar) => calendar.type !== CalendarEventType.NONE);
60
+ };
61
+ const selectedDates = ref();
62
+ const calendarEventType = ref(CalendarEventType.HOLIDAY);
63
+ const { submitting, startSubmitting, endSubmitting } = useSubmitting();
64
+ const onSubmit = async () => {
65
+ if (selectedDates.value?.length === 0 || calendarEventType.value === void 0) {
66
+ toast.add({
67
+ color: "warning",
68
+ title: "\u63D0\u4EA4\u5931\u8D25",
69
+ description: "\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u65E5\u671F\u5E76\u9009\u62E9\u8282\u5047\u65E5\u7C7B\u578B"
70
+ });
71
+ return;
72
+ }
73
+ try {
74
+ startSubmitting();
75
+ const { data } = await apiGroup.batchSave({
76
+ dates: selectedDates.value?.map((date) => dateUtil.dateValueToDayjs(date)?.toISOString() ?? "") ?? [],
77
+ type: calendarEventType.value
78
+ });
79
+ if (data.value.data) {
80
+ mergeCalendars(data.value.data.list);
81
+ selectedDates.value = [];
82
+ }
83
+ } finally {
84
+ endSubmitting();
85
+ }
86
+ };
87
+ watch(
88
+ panelDate,
89
+ () => {
90
+ fetchCalendars();
91
+ },
92
+ { immediate: true }
93
+ );
94
+ </script>
95
+
96
+ <template>
97
+ <div class="flex flex-col items-center gap-3">
98
+ <div class="flex flex-col items-center">
99
+ <UButton
100
+ label="节假日设置"
101
+ size="xl"
102
+ icon="i-lucide-calendar-days"
103
+ variant="link"
104
+ color="primary"
105
+ />
106
+ <div class="text-dimmed text-sm">
107
+ 选择一个或多个日期并选择节假日类型,然后点提交
108
+ </div>
109
+ </div>
110
+ <div class="flex flex-col md:flex-row items-center md:items-start gap-3 md:gap-4">
111
+ <UCard class="h-fit w-fit">
112
+ <UCalendar
113
+ v-model="selectedDates"
114
+ multiple
115
+ disable-days-outside-current-view
116
+ :fixed-weeks="false"
117
+ :disabled="fetching || submitting"
118
+ :next-year="{
119
+ onClick: () => {
120
+ panelDate = panelDate.add({ years: 1 });
121
+ }
122
+ }"
123
+ :prev-year="{
124
+ onClick: () => {
125
+ panelDate = panelDate.subtract({ years: 1 });
126
+ }
127
+ }"
128
+ :next-month="{
129
+ onClick: () => {
130
+ panelDate = panelDate.add({ months: 1 });
131
+ }
132
+ }"
133
+ :prev-month="{
134
+ onClick: () => {
135
+ panelDate = panelDate.subtract({ months: 1 });
136
+ }
137
+ }"
138
+ >
139
+ <template #day="{ day }">
140
+ <UChip
141
+ :show="calendarTypeMap[dateUtil.dateValueToDayjs(day)?.format(dateFormat) ?? ''] !== void 0"
142
+ size="2xs"
143
+ :color="calendarEventTypeOptions.find((item2) => item2.value === calendarTypeMap[dateUtil.dateValueToDayjs(day)?.format(dateFormat) ?? ''])?.color ?? 'primary'"
144
+ >
145
+ {{ day.day }}
146
+ </UChip>
147
+ </template>
148
+ </UCalendar>
149
+ </UCard>
150
+ <UCard class="min-w-64 h-fit">
151
+ <div class="flex flex-col gap-3 sm:gap-4">
152
+ <UFormField label="已选日期" required>
153
+ <div v-if="(selectedDates?.length ?? 0) > 0" class="grid grid-cols-3 gap-1">
154
+ <UBadge
155
+ v-for="(date, i) in selectedDates"
156
+ :key="i"
157
+ variant="subtle"
158
+ :label="dateUtil.dateValueToDayjs(date)?.format(dateFormat) ?? ''"
159
+ >
160
+ <template #trailing>
161
+ <UIcon
162
+ name="i-lucide-x"
163
+ class="cursor-pointer"
164
+ @click="() => {
165
+ const newValue = [...selectedDates ?? []];
166
+ newValue.splice(i, 1);
167
+ selectedDates = newValue;
168
+ }"
169
+ />
170
+ </template>
171
+ </UBadge>
172
+ <UButton
173
+ label="清除"
174
+ variant="ghost"
175
+ size="xs"
176
+ icon="i-lucide-timer-reset"
177
+ @click="selectedDates = []"
178
+ />
179
+ </div>
180
+ <div v-else>
181
+ /
182
+ </div>
183
+ </UFormField>
184
+ <UFormField label="节假日类型" required>
185
+ <URadioGroup
186
+ v-model="calendarEventType"
187
+ :items="calendarEventTypeOptions"
188
+ >
189
+ <template #label="{ item }">
190
+ <div class="flex items-center gap-2">
191
+ <span>{{ item.label }}</span>
192
+ <span
193
+ v-if="item.value !== CalendarEventType.NONE"
194
+ class="inline-block size-2 rounded-full"
195
+ :class="`bg-(--color-light) dark:bg-(--color-dark)`"
196
+ :style="{
197
+ '--color-light': `var(--ui-${String(item.color)})`,
198
+ '--color-dark': `var(--ui-${String(item.color)})`
199
+ }"
200
+ />
201
+ </div>
202
+ </template>
203
+ </URadioGroup>
204
+ </UFormField>
205
+ </div>
206
+
207
+ <template #footer>
208
+ <div class="flex justify-end">
209
+ <UButton
210
+ label="提交"
211
+ color="primary"
212
+ icon="i-lucide-upload"
213
+ :loading="submitting"
214
+ :disabled="(selectedDates?.length ?? 0) === 0 || calendarEventType === void 0 || submitting"
215
+ @click="onSubmit"
216
+ />
217
+ </div>
218
+ </template>
219
+ </UCard>
220
+ </div>
221
+ </div>
222
+ </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -1,4 +1,4 @@
1
- import type { Company } from 'v-nuxt-ui/types';
1
+ import type { Company } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: Company;
4
4
  };
@@ -3,7 +3,7 @@ import * as z from "zod";
3
3
  import FormCreateModalTemplateWithApi from "#v/components/form/create-modal-template/WithApi.vue";
4
4
  import { useCompanyApi } from "#v/composables";
5
5
  defineProps({
6
- model: { type: null, required: true }
6
+ model: { type: Object, required: true }
7
7
  });
8
8
  const emit = defineEmits(["close", "save"]);
9
9
  </script>
@@ -1,4 +1,4 @@
1
- import type { Company } from 'v-nuxt-ui/types';
1
+ import type { Company } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: Company;
4
4
  };
@@ -1,4 +1,4 @@
1
- import type { Department } from 'v-nuxt-ui/types';
1
+ import type { Department } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: Department;
4
4
  };
@@ -4,7 +4,7 @@ import FormCreateModalTemplate from "#v/components/form/create-modal-template/in
4
4
  import { useCompanyApi, useDepartmentApi, useFormSubmission, useFormValues, useUserApi } from "#v/composables";
5
5
  import { toRef, watch } from "vue";
6
6
  const props = defineProps({
7
- model: { type: null, required: true }
7
+ model: { type: Object, required: true }
8
8
  });
9
9
  const emit = defineEmits(["close", "save"]);
10
10
  const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0 });
@@ -1,4 +1,4 @@
1
- import type { Department } from 'v-nuxt-ui/types';
1
+ import type { Department } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: Department;
4
4
  };
@@ -0,0 +1,13 @@
1
+ import type { IssueRecord } from '#v/types';
2
+ type __VLS_Props = {
3
+ model: IssueRecord;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: IssueRecord) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: IssueRecord) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import * as z from "zod";
3
+ import FormCreateModalTemplateWithApi from "#v/components/form/create-modal-template/WithApi.vue";
4
+ import { useIssueRecordApi } from "#v/composables";
5
+ defineProps({
6
+ model: { type: Object, required: true }
7
+ });
8
+ const emit = defineEmits(["close", "save"]);
9
+ </script>
10
+
11
+ <template>
12
+ <FormCreateModalTemplateWithApi
13
+ title="改进建议"
14
+ description="您可以针对该网页提出任何改进建议或直接联系chenrn@mail.veken.com"
15
+ :on-close="(ok) => emit('close', ok)"
16
+ :on-save="(model) => emit('save', model)"
17
+ :fields="[
18
+ { name: 'description', type: 'textarea', label: '\u63CF\u8FF0', colSpan: '24', zodType: z.string() }
19
+ ]"
20
+ :model-value="model"
21
+ :api-group="useIssueRecordApi"
22
+ />
23
+ </template>
@@ -0,0 +1,13 @@
1
+ import type { IssueRecord } from '#v/types';
2
+ type __VLS_Props = {
3
+ model: IssueRecord;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: IssueRecord) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: IssueRecord) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,32 @@
1
+ <script setup>
2
+ import { getOprColumns } from "#v/constants";
3
+ import { useOverlay } from "@nuxt/ui/composables";
4
+ import { useIssueRecordApi } from "#v/composables";
5
+ import SysIssueRecordsCreateModal from "./CreateModal.vue";
6
+ import TablePage from "#v/components/table/Page.vue";
7
+ const overlay = useOverlay();
8
+ const createModal = overlay.create(SysIssueRecordsCreateModal);
9
+ const columns = [
10
+ {
11
+ accessorKey: "description",
12
+ header: "\u63CF\u8FF0",
13
+ filterOption: {
14
+ type: "input"
15
+ }
16
+ },
17
+ ...getOprColumns()
18
+ ];
19
+ </script>
20
+
21
+ <template>
22
+ <TablePage
23
+ name="sys-issue-record"
24
+ cn-name="改进建议"
25
+ :use-api-group="useIssueRecordApi"
26
+ :biz-columns="columns"
27
+ :extra-order-query-options="[
28
+ { field: 'createdAt', label: '\u521B\u5EFA\u65F6\u95F4', defaultOpr: 'desc' }
29
+ ]"
30
+ @edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
31
+ />
32
+ </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -1,4 +1,4 @@
1
- import type { JobTitle } from 'v-nuxt-ui/types';
1
+ import type { JobTitle } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: JobTitle;
4
4
  };
@@ -3,7 +3,7 @@ import * as z from "zod";
3
3
  import FormCreateModalTemplateWithApi from "#v/components/form/create-modal-template/WithApi.vue";
4
4
  import { useJobTitleApi } from "#v/composables";
5
5
  defineProps({
6
- model: { type: null, required: true }
6
+ model: { type: Object, required: true }
7
7
  });
8
8
  const emit = defineEmits(["close", "save"]);
9
9
  </script>
@@ -1,4 +1,4 @@
1
- import type { JobTitle } from 'v-nuxt-ui/types';
1
+ import type { JobTitle } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: JobTitle;
4
4
  };
@@ -1,4 +1,4 @@
1
- import type { Menu } from 'v-nuxt-ui/types';
1
+ import type { Menu } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: Menu;
4
4
  };
@@ -5,7 +5,7 @@ import { useMenuApi, useFormSubmission, useFormValues } from "#v/composables";
5
5
  import { toRef } from "vue";
6
6
  import { menuTypeOptions } from "#v/constants";
7
7
  const props = defineProps({
8
- model: { type: null, required: true }
8
+ model: { type: Object, required: true }
9
9
  });
10
10
  const emit = defineEmits(["close", "save"]);
11
11
  const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0, disabled: false, isAdmin: false });
@@ -1,4 +1,4 @@
1
- import type { Menu } from 'v-nuxt-ui/types';
1
+ import type { Menu } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: Menu;
4
4
  };
@@ -1,4 +1,4 @@
1
- import type { Role } from 'v-nuxt-ui/types';
1
+ import type { Role } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: Role;
4
4
  };
@@ -5,7 +5,7 @@ import { useFormSubmission, useFormValues, useMenuApi, useRoleApi } from "#v/com
5
5
  import { computed, onMounted, ref, toRef } from "vue";
6
6
  import { treeifyOptions } from "#v/utils";
7
7
  const props = defineProps({
8
- model: { type: null, required: true }
8
+ model: { type: Object, required: true }
9
9
  });
10
10
  const emit = defineEmits(["close", "save"]);
11
11
  const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0, disabled: false, isAdmin: false });
@@ -1,4 +1,4 @@
1
- import type { Role } from 'v-nuxt-ui/types';
1
+ import type { Role } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: Role;
4
4
  };
@@ -1,4 +1,4 @@
1
- import type { User } from 'v-nuxt-ui/types';
1
+ import type { User } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: User;
4
4
  };
@@ -6,7 +6,7 @@ import FormCreateModalTemplate from "#v/components/form/create-modal-template/in
6
6
  import { loginTypeOptions, genderOptions, Gender } from "#v/constants";
7
7
  import * as z from "zod";
8
8
  const props = defineProps({
9
- model: { type: null, required: true }
9
+ model: { type: Object, required: true }
10
10
  });
11
11
  const emit = defineEmits(["close", "save"]);
12
12
  const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0, needFillWh: false, isAdmin: false });
@@ -1,4 +1,4 @@
1
- import type { User } from 'v-nuxt-ui/types';
1
+ import type { User } from '#v/types';
2
2
  type __VLS_Props = {
3
3
  model: User;
4
4
  };
@@ -1,3 +1,5 @@
1
+ export * from './useIssueRecordApi.js';
2
+ export * from './useCalendarApi.js';
1
3
  export * from './useAuthApi.js';
2
4
  export * from './useCompanyApi.js';
3
5
  export * from './useDepartmentApi.js';
@@ -1,3 +1,5 @@
1
+ export * from "./useIssueRecordApi.js";
2
+ export * from "./useCalendarApi.js";
1
3
  export * from "./useAuthApi.js";
2
4
  export * from "./useCompanyApi.js";
3
5
  export * from "./useDepartmentApi.js";
@@ -0,0 +1,10 @@
1
+ import type { PageResult, Calendar, CalendarsSavePayload, ApiGroup, RequestResult } from '#v/types';
2
+ import type { UseFetchOptions } from 'nuxt/app';
3
+ import type { Ref } from 'vue';
4
+ type CalendarApi = {
5
+ batchSave: (payload: CalendarsSavePayload, customOptions?: UseFetchOptions<PageResult<Calendar>>) => Promise<{
6
+ data: Ref<RequestResult<PageResult<Calendar>>>;
7
+ }>;
8
+ } & ApiGroup<Calendar>;
9
+ export declare const useCalendarApi: () => CalendarApi;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ import { createSharedComposable } from "@vueuse/core";
2
+ import { useApi, usePostFetch } from "../useApi.js";
3
+ export const useCalendarApi = createSharedComposable(() => ({
4
+ ...useApi("/calendars"),
5
+ batchSave: (payload, customOptions = {}) => {
6
+ return usePostFetch(`/calendars/batch-save`, payload, customOptions);
7
+ }
8
+ }));
@@ -0,0 +1,2 @@
1
+ import type { IssueRecord } from '#v/types';
2
+ export declare const useIssueRecordApi: () => import("#v/types").ApiGroup<IssueRecord>;
@@ -0,0 +1,3 @@
1
+ import { createSharedComposable } from "@vueuse/core";
2
+ import { useApi } from "../useApi.js";
3
+ export const useIssueRecordApi = createSharedComposable(() => useApi("/sys/issues"));
@@ -1,11 +1,11 @@
1
1
  import { type DateValue } from '@internationalized/date';
2
2
  import dayjs from 'dayjs';
3
- import type { TimeUnit } from '#v/constants';
4
3
  import type { DateRange } from 'reka-ui';
5
- import type { DateShortcut } from '#v/types';
4
+ import type { DateShortcut, TimeUnit } from '#v/types';
6
5
  export declare const useDate: () => {
7
6
  dayjsToDateValue: (date: dayjs.Dayjs | null | undefined) => DateValue | undefined;
8
7
  isoUtcStringToDateValue: (isoString: string | null | undefined) => DateValue | undefined;
8
+ isoUtcStringToDayjs: (isoString: string | null | undefined) => dayjs.Dayjs | undefined;
9
9
  dateValueToDayjs: (dateValue: DateValue | null | undefined) => dayjs.Dayjs | undefined;
10
10
  formatTimeUnit: (dateValue: DateValue | null | undefined, unit: TimeUnit) => string;
11
11
  getRecentDateRange: (days: number) => DateRange;
@@ -11,6 +11,10 @@ const _useDate = () => {
11
11
  if (!isoString) return void 0;
12
12
  return dayjsToDateValue(dayjs(isoString));
13
13
  };
14
+ const isoUtcStringToDayjs = (isoString) => {
15
+ if (!isoString) return void 0;
16
+ return dayjs(isoString);
17
+ };
14
18
  const dateValueToDayjs = (dateValue) => {
15
19
  if (!dateValue) return void 0;
16
20
  return dayjs(toZoned(dateValue, TIME_ZONE).toAbsoluteString()).tz(TIME_ZONE);
@@ -135,6 +139,7 @@ const _useDate = () => {
135
139
  return {
136
140
  dayjsToDateValue,
137
141
  isoUtcStringToDateValue,
142
+ isoUtcStringToDayjs,
138
143
  dateValueToDayjs,
139
144
  formatTimeUnit,
140
145
  getRecentDateRange,
@@ -0,0 +1,8 @@
1
+ import { CalendarEventType } from '#v/types';
2
+ import type { ChipProps } from '@nuxt/ui';
3
+ export declare const calendarEventTypeOptions: {
4
+ label: string;
5
+ value: CalendarEventType;
6
+ color: ChipProps['color'];
7
+ }[];
8
+ export declare const calendarEventTypeShortNameMap: Map<CalendarEventType, string>;
@@ -0,0 +1,13 @@
1
+ import { CalendarEventType } from "#v/types";
2
+ export const calendarEventTypeOptions = [
3
+ { label: "\u56FD\u5BB6\u6CD5\u5B9A\u5047", value: CalendarEventType.HOLIDAY, color: "primary" },
4
+ { label: "\u516C\u53F8\u8C03\u6574\u5047", value: CalendarEventType.ADJUSTRED, color: "warning" },
5
+ { label: "\u5468\u672B\u4F11\u606F\u65E5", value: CalendarEventType.WEEKEND, color: "success" },
6
+ { label: "\u65E0", value: CalendarEventType.NONE, color: "neutral" }
7
+ ];
8
+ export const calendarEventTypeShortNameMap = /* @__PURE__ */ new Map([
9
+ [CalendarEventType.NONE, "\u73ED"],
10
+ [CalendarEventType.HOLIDAY, "\u5047"],
11
+ [CalendarEventType.ADJUSTRED, "\u8C03"],
12
+ [CalendarEventType.WEEKEND, "\u4F11"]
13
+ ]);
@@ -4,3 +4,4 @@ export * from './options.js';
4
4
  export * from './time.js';
5
5
  export * from './menu.js';
6
6
  export * from './user.js';
7
+ export * from './calendar.js';
@@ -4,3 +4,4 @@ export * from "./options.js";
4
4
  export * from "./time.js";
5
5
  export * from "./menu.js";
6
6
  export * from "./user.js";
7
+ export * from "./calendar.js";
@@ -0,0 +1,4 @@
1
+ export type CalendarsSavePayload = {
2
+ dates: string[];
3
+ type: number;
4
+ };
File without changes
@@ -1,3 +1,4 @@
1
1
  export * from './login.js';
2
2
  export * from './sys.js';
3
3
  export * from './user.js';
4
+ export * from './calendar.js';
@@ -1,3 +1,4 @@
1
1
  export * from "./login.js";
2
2
  export * from "./sys.js";
3
3
  export * from "./user.js";
4
+ export * from "./calendar.js";
@@ -82,3 +82,10 @@ export type RowRecord = {
82
82
  oldValue?: string;
83
83
  newValue?: string;
84
84
  } & BaseModel;
85
+ export type Calendar = {
86
+ date?: string;
87
+ type?: number;
88
+ } & BaseModel;
89
+ export type IssueRecord = {
90
+ description?: string;
91
+ } & BaseModel;
@@ -1 +1,7 @@
1
1
  export type TimeUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
2
+ export declare enum CalendarEventType {
3
+ NONE = 0,
4
+ HOLIDAY = 1,
5
+ ADJUSTRED = 2,
6
+ WEEKEND = 3
7
+ }
@@ -0,0 +1,7 @@
1
+ export var CalendarEventType = /* @__PURE__ */ ((CalendarEventType2) => {
2
+ CalendarEventType2[CalendarEventType2["NONE"] = 0] = "NONE";
3
+ CalendarEventType2[CalendarEventType2["HOLIDAY"] = 1] = "HOLIDAY";
4
+ CalendarEventType2[CalendarEventType2["ADJUSTRED"] = 2] = "ADJUSTRED";
5
+ CalendarEventType2[CalendarEventType2["WEEKEND"] = 3] = "WEEKEND";
6
+ return CalendarEventType2;
7
+ })(CalendarEventType || {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v-nuxt-ui",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "Veken UI Component Library - Reusable Nuxt UI components, composables, and utilities for enterprise applications",
5
5
  "type": "module",
6
6
  "style": "./dist/runtime/index.css",