@christianriedl/utils 1.0.89 → 1.0.91
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/dist/types.d.ts +2 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DatePicker.vue +15 -8
- package/src/views/SettingsPage.vue +1 -1
package/dist/types.d.ts
CHANGED
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,eAAe,GAA6B,MAAM,CAAC,WAAW,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,cAAc,GAA4B,MAAM,CAAC,UAAU,CAAC,CAAC;AAMzE,CAAC;AAEF,MAAM,CAAN,IAAY,QASX;AATD,WAAY,QAAQ;IAChB,6CAAW,CAAA;IACX,6CAAO,CAAA;IACP,6CAAO,CAAA;IACP,yCAAK,CAAA;IACL,uCAAI,CAAA;IACJ,iDAAS,CAAA;IACT,2CAAM,CAAA;IACN,2CAAM,CAAA;AACV,CAAC,EATW,QAAQ,KAAR,QAAQ,QASnB;AACD,MAAM,CAAN,IAAY,OAUX;AAVD,WAAY,OAAO;IACf,2CAAW,CAAA;IACX,yCAAM,CAAA;IACN,qCAAI,CAAA;IACJ,iCAAE,CAAA;IACF,6CAAQ,CAAA;IACR,+CAAS,CAAA;IACT,2CAAO,CAAA;IACP,2CAAO,CAAA;IACP,mCAAG,CAAA;AACP,CAAC,EAVW,OAAO,KAAP,OAAO,QAUlB;AACD,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,eAAe,GAA6B,MAAM,CAAC,WAAW,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,cAAc,GAA4B,MAAM,CA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AY,UAMX;AAND,WAAY,UAAU;IAClB,2CAAQ,CAAA;IACR,2CAAI,CAAA;IACJ,6CAAK,CAAA;IACL,uCAAE,CAAA;IACF,2CAAI,CAAA;AACR,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB"}
|
package/package.json
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import { inject, ref, onUnmounted, onMounted, watch } from 'vue';
|
|
3
3
|
import { Helper, EDirection, IAppState, appStateSymbol } from '@christianriedl/utils';
|
|
4
4
|
|
|
5
|
-
const props = defineProps<{ modelValue: Date, utc?: boolean }>();
|
|
5
|
+
const props = defineProps<{ modelValue: Date, utc?: boolean, steps?: number }>();
|
|
6
6
|
const emits = defineEmits<{ (e: 'update:modelValue', value: Date): void }>();
|
|
7
7
|
|
|
8
8
|
const appState = inject(appStateSymbol)!;
|
|
9
9
|
const dateFormatted = ref('');
|
|
10
10
|
|
|
11
|
-
let now = new Date(1970,1,1);
|
|
11
|
+
let now = new Date(1970, 1, 1);
|
|
12
|
+
const steps = props.steps ? props.steps : 1;
|
|
12
13
|
|
|
13
14
|
onMounted(() => { appState.navigate.value = onNavigate; });
|
|
14
15
|
onUnmounted(() => { appState.navigate.value = null });
|
|
@@ -35,16 +36,22 @@
|
|
|
35
36
|
setCurrent (new Date(dateFormatted.value));
|
|
36
37
|
}
|
|
37
38
|
function onNext() {
|
|
38
|
-
|
|
39
|
+
if (steps == 31)
|
|
40
|
+
setCurrent (new Date (now.getFullYear(), now.getMonth() + 1, now.getDate()))
|
|
41
|
+
else
|
|
42
|
+
setCurrent (new Date(now.getTime() + steps * 24 * 60 * 60 * 1000));
|
|
39
43
|
}
|
|
40
44
|
function onPrevious() {
|
|
41
|
-
|
|
45
|
+
if (steps == 31)
|
|
46
|
+
setCurrent(new Date(now.getFullYear(), now.getMonth() - 1, now.getDate()))
|
|
47
|
+
else
|
|
48
|
+
setCurrent(new Date(now.getTime() - steps * 24 * 60 * 60 * 1000));
|
|
42
49
|
}
|
|
43
50
|
function onNavigate(direction: EDirection): void {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
if (direction === EDirection.Left)
|
|
52
|
+
onPrevious();
|
|
53
|
+
if (direction === EDirection.Right)
|
|
54
|
+
onNext();
|
|
48
55
|
}
|
|
49
56
|
</script>
|
|
50
57
|
|