@ramathibodi/nuxt-commons 4.0.22 → 4.0.24

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,13 @@
1
1
  export type DocumentTemplateImportMode = 'ask' | 'append' | 'replace';
2
2
  interface Props {
3
3
  title?: string;
4
- customCode?: boolean;
4
+ roleCustomCode?: string | string[];
5
5
  disableAdvanceMode?: boolean;
6
6
  templateScript?: string;
7
7
  toolbarColor?: string;
8
8
  editorWidth?: number | string;
9
+ dialogMaxWidth?: number | string;
10
+ dialogFullscreen?: boolean;
9
11
  outline?: boolean;
10
12
  initialData?: Record<string, any>;
11
13
  importable?: boolean;
@@ -20,13 +22,17 @@ interface Props {
20
22
  * Public props accepted by DocumentTemplateBuilderLiveView.
21
23
  *
22
24
  * Two surface modes are available from the live view's own bar (above the preview):
23
- * - **Design** (default) — the preview is a click target: clicking any rendered
24
- * field opens that item in the side panel. Inputs are not interactive.
25
+ * - **Design** (default) — the preview is a click target: clicking a rendered
26
+ * field selects it and pins its **edit overlay** (edit · move · duplicate ·
27
+ * delete); hovering a field shows the same overlay. The overlay's edit
28
+ * button, or a double-click on the field, opens the item editor **dialog**.
29
+ * Inputs are not interactive.
25
30
  * - **Preview** — the preview is a live, fillable form so you can try the
26
31
  * validations; the data typed is shown in the "Preview data" panel.
27
32
  *
28
33
  * Items with no visual (`FormHidden`, `Separator`) are reachable from the
29
- * **Outline** list, which also offers reordering for every item.
34
+ * **Outline** list (a click opens the editor dialog), which also offers
35
+ * reordering for every item.
30
36
  *
31
37
  * In Design mode every rendered field is also a drag handle: drop it on the
32
38
  * left / top half of another field to insert before it, on the right / bottom
@@ -36,27 +42,39 @@ interface Props {
36
42
  * per input type. Drag a card into the live view to insert a new item of that
37
43
  * type where it lands (the same before / after halves apply; anywhere else in
38
44
  * the preview appends), or click a card to add one after the selected item.
39
- * The new item opens in the editor so its label / variable can be filled in.
45
+ * The new item's settings dialog opens at once; cancelling it removes the
46
+ * item again, saving keeps it.
40
47
  */
41
48
  type __VLS_Props = Props;
49
+ /** Select (highlight + pin the edit overlay on) the item at `index`, or clear the selection with `null`. */
50
+ declare function selectItem(index: number | null): void;
51
+ /** Open the item editor dialog blank; saving inserts after the selected item, or at the end. */
42
52
  declare function openCreate(): void;
53
+ /** Select the item at `index` and open it in the item editor dialog. */
43
54
  declare function openEdit(index: number): void;
55
+ /** Close the item editor dialog (the selection is kept). An unsaved palette insert is removed. */
44
56
  declare function closeEditor(): void;
57
+ /** Remove the item at `index` straight away (no confirmation). */
58
+ declare function deleteItem(index: number): void;
45
59
  declare function deleteSelected(): void;
46
60
  /**
47
61
  * Move the item at `from` so it lands at index `to` (its index *after* the
48
- * move). The editor selection follows the moved item; a selected neighbour
49
- * that got shifted by the move keeps pointing at the same item.
62
+ * move). The selection follows the moved item; a selected neighbour that got
63
+ * shifted by the move keeps pointing at the same item.
50
64
  */
51
65
  declare function moveItemTo(from: number, to: number): boolean;
52
66
  declare function moveSelected(delta: number): void;
67
+ /** Insert a copy of the item at `index` right after it and select the copy. */
68
+ declare function duplicateItem(index: number): void;
53
69
  declare function duplicateSelected(): void;
54
70
  /**
55
71
  * Insert a fresh item of `inputType` at `index` (clamped; defaults to the
56
- * end) and open it in the editor. The item is seeded from `initialData` plus
57
- * a unique `variableName` and a default `inputLabel` (when the type needs
72
+ * end) and open its settings dialog. The item is seeded from `initialData`
73
+ * plus a unique `variableName` and a default `inputLabel` (when the type needs
58
74
  * them) so it renders in the preview right away — an item with no variable
59
75
  * name would compile to `v-model="data."` and blank the whole preview.
76
+ * Cancelling that dialog removes the item again; saving it (or any other
77
+ * structural edit, including another insert) keeps it.
60
78
  * Returns the index it landed at.
61
79
  */
62
80
  declare function insertInputType(inputType: string, index?: number): number;
@@ -76,28 +94,52 @@ declare var __VLS_20: {}, __VLS_28: {
76
94
  openCreate: typeof openCreate;
77
95
  openEdit: typeof openEdit;
78
96
  closeEditor: typeof closeEditor;
97
+ selectItem: typeof selectItem;
98
+ deleteItem: typeof deleteItem;
79
99
  deleteSelected: typeof deleteSelected;
80
100
  moveSelected: typeof moveSelected;
81
101
  moveItemTo: typeof moveItemTo;
102
+ duplicateItem: typeof duplicateItem;
82
103
  duplicateSelected: typeof duplicateSelected;
83
104
  insertInputType: typeof insertInputType;
84
105
  importItems: typeof importItems;
85
106
  convertToAdvanceMode: () => Promise<void>;
86
107
  };
87
- }, __VLS_197: {
108
+ }, __VLS_203: {
88
109
  operation: {
89
110
  openCreate: typeof openCreate;
90
111
  openEdit: typeof openEdit;
91
112
  closeEditor: typeof closeEditor;
113
+ selectItem: typeof selectItem;
114
+ deleteItem: typeof deleteItem;
92
115
  deleteSelected: typeof deleteSelected;
93
116
  moveSelected: typeof moveSelected;
94
117
  moveItemTo: typeof moveItemTo;
118
+ duplicateItem: typeof duplicateItem;
95
119
  duplicateSelected: typeof duplicateSelected;
96
120
  insertInputType: typeof insertInputType;
97
121
  importItems: typeof importItems;
98
122
  convertToAdvanceMode: () => Promise<void>;
99
123
  };
100
- }, __VLS_248: {
124
+ }, __VLS_224: {
125
+ index: number;
126
+ item: Record<string, any>;
127
+ operation: {
128
+ openCreate: typeof openCreate;
129
+ openEdit: typeof openEdit;
130
+ closeEditor: typeof closeEditor;
131
+ selectItem: typeof selectItem;
132
+ deleteItem: typeof deleteItem;
133
+ deleteSelected: typeof deleteSelected;
134
+ moveSelected: typeof moveSelected;
135
+ moveItemTo: typeof moveItemTo;
136
+ duplicateItem: typeof duplicateItem;
137
+ duplicateSelected: typeof duplicateSelected;
138
+ insertInputType: typeof insertInputType;
139
+ importItems: typeof importItems;
140
+ convertToAdvanceMode: () => Promise<void>;
141
+ };
142
+ }, __VLS_291: {
101
143
  insert: typeof insertInputType;
102
144
  disabled: boolean;
103
145
  };
@@ -106,23 +148,30 @@ type __VLS_Slots = {} & {
106
148
  } & {
107
149
  toolbarItems?: (props: typeof __VLS_28) => any;
108
150
  } & {
109
- empty?: (props: typeof __VLS_197) => any;
151
+ empty?: (props: typeof __VLS_203) => any;
152
+ } & {
153
+ itemOverlay?: (props: typeof __VLS_224) => any;
110
154
  } & {
111
- palette?: (props: typeof __VLS_248) => any;
155
+ palette?: (props: typeof __VLS_291) => any;
112
156
  };
113
157
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
114
158
  templateItems: import("vue").Ref<Record<string, any>[], Record<string, any>[]>;
115
159
  previewData: import("vue").Ref<Record<string, any>, Record<string, any>>;
116
160
  selectedIndex: import("vue").Ref<number | null, number | null>;
161
+ editingIndex: import("vue").Ref<number | null, number | null>;
162
+ dialogOpen: import("vue").Ref<boolean, boolean>;
117
163
  dragIndex: import("vue").Ref<number | null, number | null>;
118
164
  mode: import("vue").Ref<"design" | "preview", "design" | "preview">;
119
165
  operation: import("vue").Ref<{
120
166
  openCreate: typeof openCreate;
121
167
  openEdit: typeof openEdit;
122
168
  closeEditor: typeof closeEditor;
169
+ selectItem: typeof selectItem;
170
+ deleteItem: typeof deleteItem;
123
171
  deleteSelected: typeof deleteSelected;
124
172
  moveSelected: typeof moveSelected;
125
173
  moveItemTo: typeof moveItemTo;
174
+ duplicateItem: typeof duplicateItem;
126
175
  duplicateSelected: typeof duplicateSelected;
127
176
  insertInputType: typeof insertInputType;
128
177
  importItems: typeof importItems;
@@ -131,9 +180,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
131
180
  openCreate: typeof openCreate;
132
181
  openEdit: typeof openEdit;
133
182
  closeEditor: typeof closeEditor;
183
+ selectItem: typeof selectItem;
184
+ deleteItem: typeof deleteItem;
134
185
  deleteSelected: typeof deleteSelected;
135
186
  moveSelected: typeof moveSelected;
136
187
  moveItemTo: typeof moveItemTo;
188
+ duplicateItem: typeof duplicateItem;
137
189
  duplicateSelected: typeof duplicateSelected;
138
190
  insertInputType: typeof insertInputType;
139
191
  importItems: typeof importItems;
@@ -142,9 +194,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
142
194
  openCreate: typeof openCreate;
143
195
  openEdit: typeof openEdit;
144
196
  closeEditor: typeof closeEditor;
197
+ selectItem: typeof selectItem;
198
+ deleteItem: typeof deleteItem;
145
199
  deleteSelected: typeof deleteSelected;
146
200
  moveSelected: typeof moveSelected;
147
201
  moveItemTo: typeof moveItemTo;
202
+ duplicateItem: typeof duplicateItem;
148
203
  duplicateSelected: typeof duplicateSelected;
149
204
  insertInputType: typeof insertInputType;
150
205
  importItems: typeof importItems;
@@ -153,6 +208,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
153
208
  openCreate: typeof openCreate;
154
209
  openEdit: typeof openEdit;
155
210
  closeEditor: typeof closeEditor;
211
+ selectItem: typeof selectItem;
156
212
  moveItemTo: typeof moveItemTo;
157
213
  insertInputType: typeof insertInputType;
158
214
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -163,10 +219,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
163
219
  title: string;
164
220
  stringFields: string[];
165
221
  initialData: Record<string, any>;
166
- customCode: boolean;
222
+ roleCustomCode: string | string[];
167
223
  disableAdvanceMode: boolean;
168
224
  toolbarColor: string;
169
225
  editorWidth: number | string;
226
+ dialogMaxWidth: number | string;
227
+ dialogFullscreen: boolean;
170
228
  outline: boolean;
171
229
  importable: boolean;
172
230
  exportable: boolean;
@@ -1,11 +1,11 @@
1
1
  interface Props {
2
2
  data: Record<string, any>;
3
3
  rules?: Record<string, any>;
4
- customCode?: boolean;
4
+ roleCustomCode?: string | string[];
5
5
  }
6
6
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
7
7
  rules: Record<string, any>;
8
- customCode: boolean;
8
+ roleCustomCode: string | string[];
9
9
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
10
  declare const _default: typeof __VLS_export;
11
11
  export default _default;
@@ -14,10 +14,11 @@ import {
14
14
  } from "../../composables/document/templateInputTypes";
15
15
  import { autoActionHeader, templateToHeader } from "../../composables/document/templateFormTable";
16
16
  import { useRules } from "../../composables/utils/validation";
17
+ import { useUserPermission } from "../../composables/userPermission";
17
18
  const props = defineProps({
18
19
  data: { type: Object, required: true },
19
20
  rules: { type: Object, required: false, default: void 0 },
20
- customCode: { type: Boolean, required: false, default: false }
21
+ roleCustomCode: { type: [String, Array], required: false, default: "superadmin" }
21
22
  });
22
23
  const fallbackRules = useRules().rules;
23
24
  const rules = computed(() => props.rules ?? fallbackRules.value);
@@ -51,7 +52,9 @@ function printConfigPreview(printConfig) {
51
52
  return printConfigToAttributes(printConfig);
52
53
  }
53
54
  const inputTypes = computed(() => useDocumentTemplateInputTypes());
54
- const inputTypeChoice = computed(() => inputTypes.value.filter((t) => props.customCode || t.value !== "CustomCode").map((t) => ({ label: t.label, value: t.value })));
55
+ const permission = useUserPermission();
56
+ const canCustomCode = computed(() => permission.check(props.roleCustomCode));
57
+ const inputTypeChoice = computed(() => inputTypes.value.filter((t) => canCustomCode.value || t.value !== "CustomCode").map((t) => ({ label: t.label, value: t.value })));
55
58
  const requireOption = computed(() => inputTypes.value.filter((t) => t.requiresOptions).map((t) => t.value));
56
59
  const notRequireVariable = computed(() => inputTypes.value.filter((t) => t.needsVariableName === false).map((t) => t.value));
57
60
  const notRequireLabel = computed(() => inputTypes.value.filter((t) => t.needsLabel === false).map((t) => t.value));
@@ -139,7 +142,7 @@ const ruleOptions = (inputType) => (value) => {
139
142
  </form-table>
140
143
  </v-col>
141
144
  <v-col cols="12">
142
- <document-template-builder v-model="optionData.formTemplate" title="Form Template" :custom-code="customCode"></document-template-builder>
145
+ <document-template-builder v-model="optionData.formTemplate" title="Form Template" :role-custom-code="roleCustomCode"></document-template-builder>
143
146
  </v-col>
144
147
  </v-row>
145
148
  </template>
@@ -156,10 +159,10 @@ const ruleOptions = (inputType) => (value) => {
156
159
  </template>
157
160
  <template #items>
158
161
  <v-tabs-window-item value="itemTemplate">
159
- <document-template-builder v-model="optionData.itemTemplate" title="Item Template" :custom-code="customCode" disable-advance-mode></document-template-builder>
162
+ <document-template-builder v-model="optionData.itemTemplate" title="Item Template" :role-custom-code="roleCustomCode" disable-advance-mode></document-template-builder>
160
163
  </v-tabs-window-item>
161
164
  <v-tabs-window-item value="dataTemplate">
162
- <document-template-builder v-model="optionData.dataTemplate" title="Data Template" :custom-code="customCode" disable-advance-mode></document-template-builder>
165
+ <document-template-builder v-model="optionData.dataTemplate" title="Data Template" :role-custom-code="roleCustomCode" disable-advance-mode></document-template-builder>
163
166
  </v-tabs-window-item>
164
167
  <v-tabs-window-item value="header">
165
168
  <form-table v-model="optionData.headers" :headers="formTableHeaders" title="Headers">
@@ -1,11 +1,11 @@
1
1
  interface Props {
2
2
  data: Record<string, any>;
3
3
  rules?: Record<string, any>;
4
- customCode?: boolean;
4
+ roleCustomCode?: string | string[];
5
5
  }
6
6
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
7
7
  rules: Record<string, any>;
8
- customCode: boolean;
8
+ roleCustomCode: string | string[];
9
9
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
10
  declare const _default: typeof __VLS_export;
11
11
  export default _default;
@@ -34,12 +34,12 @@ const computedOther = computed(() => {
34
34
  const computeItems = computed(() => {
35
35
  return reject(props.items, { value: "other" });
36
36
  });
37
- watch(values, () => {
38
- emit("update:modelValue", [...values.value, valuesOther.value].filter(Boolean));
39
- }, { deep: true });
40
- watch(valuesOther, () => {
41
- emit("update:modelValue", [...values.value, valuesOther.value].filter(Boolean));
42
- });
37
+ function emitModelValue() {
38
+ const merged = valuesOther.value !== void 0 && valuesOther.value !== "" ? [...values.value, valuesOther.value] : [...values.value];
39
+ emit("update:modelValue", merged);
40
+ }
41
+ watch(values, emitModelValue, { deep: true });
42
+ watch(valuesOther, emitModelValue);
43
43
  watch(props.modelValue, () => {
44
44
  if (!props.modelValue) {
45
45
  values.value = [];
@@ -22,9 +22,9 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
22
22
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
23
23
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
24
24
  }>, {
25
- readonly: boolean;
26
25
  locale: "TH" | "EN";
27
26
  format: dateFormat | string;
27
+ readonly: boolean;
28
28
  dense: boolean;
29
29
  pickerOnly: boolean;
30
30
  defaultDate: boolean | string;
@@ -22,9 +22,9 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
22
22
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
23
23
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
24
24
  }>, {
25
- readonly: boolean;
26
25
  locale: "TH" | "EN";
27
26
  format: dateFormat | string;
27
+ readonly: boolean;
28
28
  dense: boolean;
29
29
  pickerOnly: boolean;
30
30
  defaultDate: boolean | string;
@@ -0,0 +1,25 @@
1
+ export type CalendarView = 'month' | 'week' | 'day' | 'list'
2
+ export type CalendarToolbarToken = 'today' | 'prev' | 'next' | 'title' | CalendarView
3
+
4
+ export interface CalendarEvent {
5
+ id?: string | number | null
6
+ title?: string | null
7
+ /** ISO string with offset, or a Date. */
8
+ start: string | Date
9
+ end?: string | Date | null
10
+ allDay?: boolean | null
11
+ color?: string | null
12
+ display?: 'auto' | 'background' | null
13
+ // `any`, not `unknown`, is deliberate: consumers (e.g. his-ui) read into this without a guard,
14
+ // such as `event.extendedProps.patient.name`, and `unknown` fails that under vue-tsc.
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ extendedProps?: Record<string, any> | null
17
+ }
18
+
19
+ export interface CalendarRange { start: Date, end: Date }
20
+
21
+ export interface CalendarToolbar {
22
+ left?: CalendarToolbarToken[]
23
+ center?: CalendarToolbarToken[]
24
+ right?: CalendarToolbarToken[]
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramathibodi/nuxt-commons",
3
- "version": "4.0.22",
3
+ "version": "4.0.24",
4
4
  "description": "Ramathibodi Nuxt modules for common components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,6 @@
27
27
  },
28
28
  "./components/*": "./dist/runtime/components/*.vue",
29
29
  "./components/*/*": "./dist/runtime/components/*/*.vue",
30
- "./lab/*": "./dist/runtime/labs/*.vue",
31
30
  "./lab/*/*": "./dist/runtime/labs/*/*.vue"
32
31
  },
33
32
  "main": "./dist/module.mjs",
@@ -73,13 +72,7 @@
73
72
  "@codemirror/lang-vue": "^0.1.3",
74
73
  "@codemirror/theme-one-dark": "^6.1.3",
75
74
  "@fortawesome/fontawesome-free": "^6.7.2",
76
- "@fullcalendar/core": "^6.1.20",
77
- "@fullcalendar/daygrid": "^6.1.20",
78
- "@fullcalendar/interaction": "^6.1.20",
79
- "@fullcalendar/list": "^6.1.20",
80
- "@fullcalendar/multimonth": "^6.1.20",
81
- "@fullcalendar/timegrid": "^6.1.20",
82
- "@fullcalendar/vue3": "^6.1.20",
75
+ "@fullcalendar/vue3": "^7.1.0",
83
76
  "@graphql-codegen/add": "^5.0.3",
84
77
  "@graphql-codegen/cli": "^6.1.3",
85
78
  "@graphql-codegen/plugin-helpers": "^6.1.1",
@@ -108,6 +101,7 @@
108
101
  "pdf-vue3": "^1.0.12",
109
102
  "prettier": "3.3.2",
110
103
  "print-js": "^1.6.0",
104
+ "temporal-polyfill": "^1.0.5",
111
105
  "tesseract.js": "^6.0.1",
112
106
  "uid": "^2.0.2",
113
107
  "vue": "^3.5.30",
@@ -1,35 +0,0 @@
1
- type Event = {
2
- id: string | undefined;
3
- title: string;
4
- start: string;
5
- end: string;
6
- color: string;
7
- detail?: string;
8
- props: Record<string, any> | any[];
9
- };
10
- interface CalendarProps {
11
- modelValue: Event[];
12
- locale?: 'th' | 'en';
13
- toolBarLeft?: string;
14
- toolBarCenter?: string;
15
- toolBarRight?: string;
16
- height?: string | number;
17
- selectViewDay?: string;
18
- mode: 'dayGridMonth' | 'timeGridDay';
19
- }
20
- declare const __VLS_export: import("vue").DefineComponent<CalendarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
- dialog: (...args: any[]) => void;
22
- select: (...args: any[]) => void;
23
- }, string, import("vue").PublicProps, Readonly<CalendarProps> & Readonly<{
24
- onDialog?: ((...args: any[]) => any) | undefined;
25
- onSelect?: ((...args: any[]) => any) | undefined;
26
- }>, {
27
- height: string | number;
28
- mode: "dayGridMonth" | "timeGridDay";
29
- locale: "th" | "en";
30
- toolBarLeft: string;
31
- toolBarCenter: string;
32
- toolBarRight: string;
33
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
- declare const _default: typeof __VLS_export;
35
- export default _default;
@@ -1,71 +0,0 @@
1
- <script setup>
2
- import FullCalendar from "@fullcalendar/vue3";
3
- import dayGridPlugin from "@fullcalendar/daygrid";
4
- import timeGridPlugin from "@fullcalendar/timegrid";
5
- import listPlugin from "@fullcalendar/list";
6
- import interactionPlugin from "@fullcalendar/interaction";
7
- import { ref, computed } from "vue";
8
- import {} from "@fullcalendar/core";
9
- const props = defineProps({
10
- modelValue: { type: Array, required: true },
11
- locale: { type: String, required: false, default: "th" },
12
- toolBarLeft: { type: String, required: false, default: "today prev,next" },
13
- toolBarCenter: { type: String, required: false, default: "title" },
14
- toolBarRight: { type: String, required: false, default: "timeGridDay,timeGridWeek,dayGridMonth" },
15
- height: { type: [String, Number], required: false, default: 1200 },
16
- selectViewDay: { type: String, required: false },
17
- mode: { type: String, required: true, default: "dayGridMonth" }
18
- });
19
- const emit = defineEmits(["select", "dialog"]);
20
- const buttonText = computed(() => {
21
- return {
22
- today: props.locale === "th" ? "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49" : "today",
23
- month: props.locale === "th" ? "\u0E40\u0E14\u0E37\u0E2D\u0E19" : "month",
24
- week: props.locale === "th" ? "\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C" : "week",
25
- day: props.locale === "th" ? "\u0E27\u0E31\u0E19" : "day",
26
- list: props.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "list",
27
- year: props.locale === "th" ? "\u0E1B\u0E35" : "year"
28
- };
29
- });
30
- const calendarRef = ref();
31
- const dateViewDay = ref({ date: "", props: {} });
32
- const handleDateClick = (info) => {
33
- emit("select", info.event);
34
- };
35
- const handleEventClick = (info) => {
36
- emit("dialog", true);
37
- emit("select", info.event);
38
- };
39
- const eventContentDay = (arg) => {
40
- const list = document.createElement("div");
41
- list.innerHTML = document.getElementById(arg.event.id.toString())?.innerHTML || "";
42
- return { domNodes: [list] };
43
- };
44
- const calendarOptions = ref({
45
- plugins: [dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin],
46
- initialView: props.mode,
47
- locale: props.locale,
48
- dayMaxEvents: true,
49
- timeZone: "UTC",
50
- headerToolbar: {
51
- left: props.toolBarLeft,
52
- center: props.toolBarCenter,
53
- right: props.toolBarRight
54
- },
55
- buttonText: buttonText.value,
56
- events: props.modelValue,
57
- initialDate: props.selectViewDay,
58
- dateClick: handleDateClick,
59
- eventClick: handleEventClick,
60
- nowIndicator: true,
61
- height: props.height,
62
- eventColor: "#378006"
63
- });
64
- </script>
65
-
66
- <template>
67
- <FullCalendar
68
- ref="calendarRef"
69
- :options="calendarOptions"
70
- />
71
- </template>
@@ -1,35 +0,0 @@
1
- type Event = {
2
- id: string | undefined;
3
- title: string;
4
- start: string;
5
- end: string;
6
- color: string;
7
- detail?: string;
8
- props: Record<string, any> | any[];
9
- };
10
- interface CalendarProps {
11
- modelValue: Event[];
12
- locale?: 'th' | 'en';
13
- toolBarLeft?: string;
14
- toolBarCenter?: string;
15
- toolBarRight?: string;
16
- height?: string | number;
17
- selectViewDay?: string;
18
- mode: 'dayGridMonth' | 'timeGridDay';
19
- }
20
- declare const __VLS_export: import("vue").DefineComponent<CalendarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
- dialog: (...args: any[]) => void;
22
- select: (...args: any[]) => void;
23
- }, string, import("vue").PublicProps, Readonly<CalendarProps> & Readonly<{
24
- onDialog?: ((...args: any[]) => any) | undefined;
25
- onSelect?: ((...args: any[]) => any) | undefined;
26
- }>, {
27
- height: string | number;
28
- mode: "dayGridMonth" | "timeGridDay";
29
- locale: "th" | "en";
30
- toolBarLeft: string;
31
- toolBarCenter: string;
32
- toolBarRight: string;
33
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
- declare const _default: typeof __VLS_export;
35
- export default _default;