@bagelink/vue 0.0.188 → 0.0.190

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.
@@ -0,0 +1,153 @@
1
+ <template>
2
+ <div class="datetime-wrap">
3
+ <div class="date-wrap">
4
+ <VDatepicker
5
+ inline
6
+ week-start="0"
7
+ v-model="selectedDate"
8
+ :highlight-week-days="[6]"
9
+ :enable-time-picker="false"
10
+ :month-change-on-scroll="false"
11
+ v-bind="options"
12
+ >
13
+ <template #action-buttons/>
14
+ <template #action-preview/>
15
+ </VDatepicker>
16
+ </div>
17
+ <div class="time-wrap" v-if="showTimeWrap">
18
+ <template v-for="hr in hours" :key="hr">
19
+ <input type="radio" :id="`${hr}_${name}`" :name="name" :value="hr" v-model="selectedHour" >
20
+ <label :for="`${hr}_${name}`">{{ hr }}</label>
21
+ </template>
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <script setup lang="ts">
27
+ import VDatepicker from '@vuepic/vue-datepicker';
28
+ import '@vuepic/vue-datepicker/dist/main.css';
29
+
30
+ defineProps<{ name: string, options: Record<string, any>, showTimeWrap: boolean}>();
31
+ const selectedDate = $ref(null);
32
+ const selectedHour = $ref();
33
+
34
+ const hours = Array.from({ length: 18 }, (_, index) => {
35
+ const hour = Math.floor(index / 2) + 9;
36
+ const minute = index % 2 === 0 ? '00' : '30';
37
+ return `${hour}:${minute}`;
38
+ });
39
+ </script>
40
+ <style>
41
+ .datetime-wrap {
42
+ display: flex;
43
+ gap: 3rem;
44
+ padding: 1rem;
45
+ }
46
+
47
+ .time-wrap {
48
+ display: grid;
49
+ gap: 0.5rem;
50
+ grid-template-columns: 1fr 1fr;
51
+ width: 100%;
52
+ }
53
+
54
+ .time-wrap input {
55
+ display: none;
56
+ }
57
+
58
+ .time-wrap label {
59
+ background: var(--input-bg);
60
+ border-radius: var(--btn-border-radius);
61
+ line-height: calc(var(--btn-height) * 0.9);
62
+ display: block;
63
+ cursor: pointer;
64
+ transition: var(--bgl-transition);
65
+ text-align: center;
66
+ font-size: 16px;
67
+ color: var(--bgl-primary);
68
+ border: 1px solid var(--bgl-primary);
69
+ }
70
+
71
+ .time-wrap input[type="radio"]:checked+label {
72
+ background: var(--bgl-primary);
73
+ color: var(--bgl-white);
74
+ }
75
+
76
+ .time-wrap label:hover {
77
+ filter: var(--bgl-hover-filter);
78
+ }
79
+
80
+ .time-wrap label:active {
81
+ filter: var(--bgl-active-filter);
82
+ }
83
+
84
+ .dp__theme_light {
85
+ --dp-background-color: var(--bgl-white);
86
+ --dp-text-color: var(--bgl-black);
87
+ --dp-hover-color: var(--input-bg);
88
+ --dp-hover-text-color: var(--bgl-black);
89
+ --dp-hover-icon-color: var(--bgl-primary);
90
+ --dp-primary-color: var(--bgl-primary);
91
+ --dp-primary-disabled-color: var(--bgl-primary);
92
+ --dp-primary-text-color: var(--bgl-white);
93
+ --dp-secondary-color: var(--bgl-gray);
94
+ --dp-border-color: transparent;
95
+ --dp-menu-border-color: transparent;
96
+ --dp-scroll-bar-background: transparent;
97
+ --dp-scroll-bar-color: var(--bgl-gray);
98
+ --dp-icon-color: var(--bgl-gray);
99
+ --dp-highlight-color: var(--bgl-gray-light);
100
+ }
101
+
102
+ :root {
103
+ --dp-font-family: inherit;
104
+ --dp-cell-border-radius: 100%;
105
+ --dp-common-transition: all 200s ease-in;
106
+
107
+ --dp-cell-size: 40px;
108
+ /*Width and height of calendar cell*/
109
+ --dp-menu-min-width: 280px;
110
+ /*Adjust the min width of the menu*/
111
+ --dp-row-margin: 8px 0;
112
+ /*Adjust the spacing between rows in the calendar*/
113
+ }
114
+
115
+ .dp__calendar_header {
116
+ font-weight: 400;
117
+ padding: 10px 0 0;
118
+ margin-bottom: -10px;
119
+ }
120
+
121
+ .dp__calendar_row>div:last-child {
122
+ pointer-events: none;
123
+ }
124
+ .dp__outer_menu_wrap.dp--menu-wrapper{
125
+ filter: drop-shadow(0 0 20px var(--bgl-shadow));
126
+ }
127
+ .dp__input{
128
+ background: var(--input-bg);
129
+ border: none;
130
+ padding: 0.7rem;
131
+ border-radius: var(--input-border-radius);
132
+ color: var(--input-color);
133
+ min-width: calc(var(--input-height) * 3);
134
+ width: 100%;
135
+ }
136
+ .dp__input:focus-visible {
137
+ outline: none;
138
+ box-shadow: inset 0 0 10px #00000012;
139
+ }
140
+ @media screen and (max-width: 767px) {
141
+ .datetime-wrap {
142
+ flex-wrap: wrap;
143
+ padding: 0rem;
144
+ gap: 1rem;
145
+ justify-content: center;
146
+ }
147
+
148
+ :root {
149
+ --dp-menu-min-width: 200px;
150
+ --dp-cell-size: 35px;
151
+ }
152
+ }
153
+ </style>
@@ -20,3 +20,4 @@ export { default as Checkbox } from './Checkbox.vue';
20
20
  export { default as ColorPicker } from './ColorPicker.vue';
21
21
  export { default as DynamicLinkField } from './DynamicLinkField.vue';
22
22
  export { default as PlainText } from './PlainText.vue';
23
+ export { default as DatePicker } from './DatePicker.vue';
@@ -142,8 +142,8 @@ function animateCircle(e: DragEvent) {
142
142
 
143
143
  function emitValue() {
144
144
  // const fileValues = files.map((f) => f.serverFile?.id);
145
- const relationshipKey = props.context?.attrs?.relationshipKey;
146
- if (!computedMultiple) return props.context?.node.input(relationshipKey ? files[0].serverFile.id : files[0].serverFile);
145
+ const relationshipObjKey = props.context?.attrs?.relationshipObjKey;
146
+ if (!computedMultiple) return props.context?.node.input(relationshipObjKey ? files[0].serverFile.id : files[0].serverFile);
147
147
  // eslint-disable-next-line no-alert
148
148
  return alert('not implemented');
149
149
  }
@@ -202,8 +202,8 @@ async function addFiles(addedFiles: FileList) {
202
202
 
203
203
  onMounted(() => {
204
204
  dropZoneEl?.addEventListener('dragover', animateCircle);
205
- const relationshipKey = props.context?.attrs?.relationshipKey;
206
- const imageObj = relationshipKey ? props.context?.node?.parent?.value[relationshipKey] : props.context?.node?.value;
205
+ const relationshipObjKey = props.context?.attrs?.relationshipObjKey;
206
+ const imageObj = relationshipObjKey ? props.context?.node?.parent?.value[relationshipObjKey] : props.context?.node?.value;
207
207
  if (!computedMultiple && imageObj) {
208
208
  files.push({
209
209
  serverFile: imageObj,