@bagelink/vue 1.2.124 → 1.2.126
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,3 +1,4 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
1
2
|
import { ModeType } from '../../../utils/calendar/typings';
|
|
2
3
|
import { WEEK_START_DAY } from '../../../utils/calendar/time';
|
|
3
4
|
type __VLS_Props = {
|
|
@@ -8,7 +9,7 @@ type __VLS_Props = {
|
|
|
8
9
|
firstDayOfWeek?: WEEK_START_DAY;
|
|
9
10
|
locale?: string;
|
|
10
11
|
enableTime?: boolean;
|
|
11
|
-
highlightedDates?: (string | Date)[]
|
|
12
|
+
highlightedDates?: MaybeRefOrGetter<(string | Date)[]>;
|
|
12
13
|
};
|
|
13
14
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
15
|
"update:modelValue": (...args: any[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/DatePicker.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatePicker.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/DatePicker.vue"],"names":[],"mappings":"AAwgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAG/D,OAAa,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAEnE,KAAK,WAAW,GAAG;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,CAAA;CACtD,CAAC;;;;;;UALM,QAAQ;YAEN,MAAM;gBACF,OAAO;oBAFH,cAAc;;AAssBjC,wBASG"}
|
package/dist/index.cjs
CHANGED
|
@@ -14967,6 +14967,7 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
|
|
|
14967
14967
|
setup(__props, { emit: __emit }) {
|
|
14968
14968
|
const props2 = __props;
|
|
14969
14969
|
const emit2 = __emit;
|
|
14970
|
+
const computedHighlightedDates = vue.computed(() => vue.toValue(props2.highlightedDates));
|
|
14970
14971
|
const currentMonth = vue.ref(/* @__PURE__ */ new Date());
|
|
14971
14972
|
const currentView = vue.ref("days");
|
|
14972
14973
|
const time = new Time(props2.firstDayOfWeek, props2.locale);
|
|
@@ -15063,16 +15064,16 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
|
|
|
15063
15064
|
const isNotInMonth2 = (date2) => {
|
|
15064
15065
|
return time.isTrailingOrLeadingDate(date2, currentMonth.value.getMonth());
|
|
15065
15066
|
};
|
|
15066
|
-
const isHighlighted2 = (date2) => {
|
|
15067
|
-
if (!date2 || !Array.isArray(
|
|
15067
|
+
const isHighlighted2 = vue.computed(() => (date2) => {
|
|
15068
|
+
if (!date2 || !Array.isArray(computedHighlightedDates.value) || !computedHighlightedDates.value.length) {
|
|
15068
15069
|
return false;
|
|
15069
15070
|
}
|
|
15070
|
-
return
|
|
15071
|
+
return computedHighlightedDates.value.some((highlightedDate) => {
|
|
15071
15072
|
const parsedDate = parseDate(highlightedDate);
|
|
15072
15073
|
if (!parsedDate) return false;
|
|
15073
15074
|
return date2.getFullYear() === parsedDate.getFullYear() && date2.getMonth() === parsedDate.getMonth() && date2.getDate() === parsedDate.getDate();
|
|
15074
15075
|
});
|
|
15075
|
-
};
|
|
15076
|
+
});
|
|
15076
15077
|
return {
|
|
15077
15078
|
currentMonthDays: currentMonthDays2,
|
|
15078
15079
|
currentMonthValue: currentMonthValue2,
|
|
@@ -15314,7 +15315,7 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
|
|
|
15314
15315
|
};
|
|
15315
15316
|
}
|
|
15316
15317
|
});
|
|
15317
|
-
const DatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-
|
|
15318
|
+
const DatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-16646325"]]);
|
|
15318
15319
|
const _hoisted_1$I = ["title"];
|
|
15319
15320
|
const _hoisted_2$w = { key: 0 };
|
|
15320
15321
|
const _hoisted_3$r = {
|
package/dist/index.mjs
CHANGED
|
@@ -14965,6 +14965,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
14965
14965
|
setup(__props, { emit: __emit }) {
|
|
14966
14966
|
const props2 = __props;
|
|
14967
14967
|
const emit2 = __emit;
|
|
14968
|
+
const computedHighlightedDates = computed(() => toValue(props2.highlightedDates));
|
|
14968
14969
|
const currentMonth = ref(/* @__PURE__ */ new Date());
|
|
14969
14970
|
const currentView = ref("days");
|
|
14970
14971
|
const time = new Time(props2.firstDayOfWeek, props2.locale);
|
|
@@ -15061,16 +15062,16 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
15061
15062
|
const isNotInMonth2 = (date2) => {
|
|
15062
15063
|
return time.isTrailingOrLeadingDate(date2, currentMonth.value.getMonth());
|
|
15063
15064
|
};
|
|
15064
|
-
const isHighlighted2 = (date2) => {
|
|
15065
|
-
if (!date2 || !Array.isArray(
|
|
15065
|
+
const isHighlighted2 = computed(() => (date2) => {
|
|
15066
|
+
if (!date2 || !Array.isArray(computedHighlightedDates.value) || !computedHighlightedDates.value.length) {
|
|
15066
15067
|
return false;
|
|
15067
15068
|
}
|
|
15068
|
-
return
|
|
15069
|
+
return computedHighlightedDates.value.some((highlightedDate) => {
|
|
15069
15070
|
const parsedDate = parseDate(highlightedDate);
|
|
15070
15071
|
if (!parsedDate) return false;
|
|
15071
15072
|
return date2.getFullYear() === parsedDate.getFullYear() && date2.getMonth() === parsedDate.getMonth() && date2.getDate() === parsedDate.getDate();
|
|
15072
15073
|
});
|
|
15073
|
-
};
|
|
15074
|
+
});
|
|
15074
15075
|
return {
|
|
15075
15076
|
currentMonthDays: currentMonthDays2,
|
|
15076
15077
|
currentMonthValue: currentMonthValue2,
|
|
@@ -15312,7 +15313,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
15312
15313
|
};
|
|
15313
15314
|
}
|
|
15314
15315
|
});
|
|
15315
|
-
const DatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-
|
|
15316
|
+
const DatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-16646325"]]);
|
|
15316
15317
|
const _hoisted_1$I = ["title"];
|
|
15317
15318
|
const _hoisted_2$w = { key: 0 };
|
|
15318
15319
|
const _hoisted_3$r = {
|
package/dist/style.css
CHANGED
|
@@ -1494,87 +1494,87 @@ pre code.hljs {
|
|
|
1494
1494
|
outline-color: var(--input-bg);
|
|
1495
1495
|
}
|
|
1496
1496
|
|
|
1497
|
-
.calendar-container[data-v-
|
|
1497
|
+
.calendar-container[data-v-16646325] {
|
|
1498
1498
|
max-width: 90vw;
|
|
1499
1499
|
}
|
|
1500
|
-
.calendar-section[data-v-
|
|
1500
|
+
.calendar-section[data-v-16646325] {
|
|
1501
1501
|
min-width: 280px;
|
|
1502
1502
|
}
|
|
1503
|
-
.calendar-grid[data-v-
|
|
1503
|
+
.calendar-grid[data-v-16646325] {
|
|
1504
1504
|
grid-template-columns: repeat(7, 1fr);
|
|
1505
1505
|
}
|
|
1506
|
-
.month-grid[data-v-
|
|
1506
|
+
.month-grid[data-v-16646325] {
|
|
1507
1507
|
grid-template-columns: repeat(3, 1fr);
|
|
1508
1508
|
grid-template-rows: repeat(4, 1fr);
|
|
1509
1509
|
}
|
|
1510
|
-
.year-grid[data-v-
|
|
1510
|
+
.year-grid[data-v-16646325] {
|
|
1511
1511
|
grid-template-columns: repeat(3, 1fr);
|
|
1512
1512
|
grid-template-rows: repeat(6, 1fr);
|
|
1513
1513
|
}
|
|
1514
|
-
.month-item[data-v-
|
|
1515
|
-
.year-item[data-v-
|
|
1514
|
+
.month-item[data-v-16646325],
|
|
1515
|
+
.year-item[data-v-16646325] {
|
|
1516
1516
|
background: none;
|
|
1517
1517
|
color: var(--bgl-text-color);
|
|
1518
1518
|
}
|
|
1519
|
-
.month-item[data-v-
|
|
1520
|
-
.year-item[data-v-
|
|
1519
|
+
.month-item[data-v-16646325]:hover:not(.disabled),
|
|
1520
|
+
.year-item[data-v-16646325]:hover:not(.disabled) {
|
|
1521
1521
|
background: var(--bgl-box-bg);
|
|
1522
1522
|
filter: var(--bgl-hover-filter);
|
|
1523
1523
|
}
|
|
1524
|
-
.month-item[data-v-
|
|
1525
|
-
.year-item[data-v-
|
|
1524
|
+
.month-item[data-v-16646325]:active:not(.disabled),
|
|
1525
|
+
.year-item[data-v-16646325]:active:not(.disabled) {
|
|
1526
1526
|
background: var(--bgl-box-bg);
|
|
1527
1527
|
filter: var(--bgl-active-filter);
|
|
1528
1528
|
}
|
|
1529
|
-
.month-item.selected[data-v-
|
|
1530
|
-
.year-item.selected[data-v-
|
|
1529
|
+
.month-item.selected[data-v-16646325],
|
|
1530
|
+
.year-item.selected[data-v-16646325] {
|
|
1531
1531
|
background-color: var(--bgl-primary);
|
|
1532
1532
|
color: white;
|
|
1533
1533
|
}
|
|
1534
|
-
.month-item.disabled[data-v-
|
|
1535
|
-
.year-item.disabled[data-v-
|
|
1534
|
+
.month-item.disabled[data-v-16646325],
|
|
1535
|
+
.year-item.disabled[data-v-16646325] {
|
|
1536
1536
|
opacity: 0.6;
|
|
1537
1537
|
filter: grayscale(0.3);
|
|
1538
1538
|
}
|
|
1539
|
-
.day[data-v-
|
|
1539
|
+
.day[data-v-16646325] {
|
|
1540
1540
|
border: none;
|
|
1541
1541
|
background: none;
|
|
1542
1542
|
color: var(--bgl-text-color);
|
|
1543
1543
|
}
|
|
1544
|
-
.day[data-v-
|
|
1544
|
+
.day[data-v-16646325]:hover:not(.disabled) {
|
|
1545
1545
|
background-color: var(--input-bg);
|
|
1546
1546
|
color: var(--bgl-text-color);
|
|
1547
1547
|
outline: 1px solid var(--border-color);
|
|
1548
1548
|
}
|
|
1549
|
-
.day:hover:not(.disabled).selected[data-v-
|
|
1549
|
+
.day:hover:not(.disabled).selected[data-v-16646325] {
|
|
1550
1550
|
filter: var(--bgl-hover-filter);
|
|
1551
1551
|
background-color: var(--bgl-primary);
|
|
1552
1552
|
color: var(--bgl-white);
|
|
1553
1553
|
}
|
|
1554
|
-
.day.selected[data-v-
|
|
1554
|
+
.day.selected[data-v-16646325] {
|
|
1555
1555
|
background-color: var(--bgl-primary);
|
|
1556
1556
|
color: var(--bgl-white);
|
|
1557
1557
|
}
|
|
1558
|
-
.day.today[data-v-
|
|
1558
|
+
.day.today[data-v-16646325]:not(.selected) {
|
|
1559
1559
|
border: 1px solid var(--bgl-primary);
|
|
1560
1560
|
}
|
|
1561
|
-
.day.disabled[data-v-
|
|
1561
|
+
.day.disabled[data-v-16646325] {
|
|
1562
1562
|
opacity: 0.6;
|
|
1563
1563
|
filter: grayscale(0.3);
|
|
1564
1564
|
cursor: not-allowed;
|
|
1565
1565
|
}
|
|
1566
|
-
.day.not-in-month[data-v-
|
|
1566
|
+
.day.not-in-month[data-v-16646325] {
|
|
1567
1567
|
opacity: 0.4;
|
|
1568
1568
|
}
|
|
1569
|
-
.day.highlighted[data-v-
|
|
1569
|
+
.day.highlighted[data-v-16646325]:not(.selected) {
|
|
1570
1570
|
background-color: var(--bgl-secondary-light, rgba(var(--bgl-primary-rgb, 0, 123, 255), 0.15));
|
|
1571
1571
|
font-weight: 500;
|
|
1572
1572
|
}
|
|
1573
|
-
.day.highlighted.selected[data-v-
|
|
1573
|
+
.day.highlighted.selected[data-v-16646325] {
|
|
1574
1574
|
/* Add a subtle ring effect for dates that are both selected and highlighted */
|
|
1575
1575
|
box-shadow: 0 0 0 2px var(--bgl-secondary, rgba(var(--bgl-primary-rgb, 0, 123, 255), 0.5));
|
|
1576
1576
|
}
|
|
1577
|
-
.day.highlighted[data-v-
|
|
1577
|
+
.day.highlighted[data-v-16646325]:not(.selected):hover {
|
|
1578
1578
|
background-color: var(--bgl-secondary-light-hover, rgba(var(--bgl-primary-rgb, 0, 123, 255), 0.25));
|
|
1579
1579
|
}
|
|
1580
1580
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { MaybeRefOrGetter } from 'vue'
|
|
2
3
|
import type { ModeType } from '../../../utils/calendar/typings'
|
|
3
4
|
import { Btn, NumberInput } from '@bagelink/vue'
|
|
4
|
-
import { computed, ref } from 'vue'
|
|
5
|
+
import { computed, ref, toValue } from 'vue'
|
|
5
6
|
import Time, { WEEK_START_DAY } from '../../../utils/calendar/time'
|
|
6
7
|
|
|
7
8
|
const props = withDefaults(
|
|
@@ -13,7 +14,7 @@ const props = withDefaults(
|
|
|
13
14
|
firstDayOfWeek?: WEEK_START_DAY
|
|
14
15
|
locale?: string
|
|
15
16
|
enableTime?: boolean
|
|
16
|
-
highlightedDates?: (string | Date)[]
|
|
17
|
+
highlightedDates?: MaybeRefOrGetter<(string | Date)[]>
|
|
17
18
|
}>(),
|
|
18
19
|
{
|
|
19
20
|
mode: () => ({ mode: 'day' }),
|
|
@@ -25,6 +26,8 @@ const props = withDefaults(
|
|
|
25
26
|
|
|
26
27
|
const emit = defineEmits(['update:modelValue'])
|
|
27
28
|
|
|
29
|
+
const computedHighlightedDates = $computed(() => toValue(props.highlightedDates))
|
|
30
|
+
|
|
28
31
|
// State
|
|
29
32
|
const currentMonth = ref(new Date())
|
|
30
33
|
const currentView = ref('days')
|
|
@@ -161,12 +164,12 @@ function useCalendarView() {
|
|
|
161
164
|
* @param date The date to check
|
|
162
165
|
* @returns True if the date should be highlighted
|
|
163
166
|
*/
|
|
164
|
-
const isHighlighted = (date?: Date): boolean => {
|
|
165
|
-
if (!date || !Array.isArray(
|
|
167
|
+
const isHighlighted = computed(() => (date?: Date): boolean => {
|
|
168
|
+
if (!date || !Array.isArray(computedHighlightedDates) || !computedHighlightedDates.length) {
|
|
166
169
|
return false
|
|
167
170
|
}
|
|
168
171
|
|
|
169
|
-
return
|
|
172
|
+
return computedHighlightedDates.some((highlightedDate) => {
|
|
170
173
|
const parsedDate = parseDate(highlightedDate)
|
|
171
174
|
if (!parsedDate) return false
|
|
172
175
|
|
|
@@ -175,7 +178,7 @@ function useCalendarView() {
|
|
|
175
178
|
&& date.getMonth() === parsedDate.getMonth()
|
|
176
179
|
&& date.getDate() === parsedDate.getDate()
|
|
177
180
|
})
|
|
178
|
-
}
|
|
181
|
+
})
|
|
179
182
|
|
|
180
183
|
return {
|
|
181
184
|
currentMonthDays,
|