@unsource/ui 2.1.4 → 2.2.0

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 (31) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +6 -2
  3. package/dist/runtime/components/UnAuth.d.vue.ts +34 -0
  4. package/dist/runtime/components/UnAuth.vue +326 -0
  5. package/dist/runtime/components/UnAuth.vue.d.ts +34 -0
  6. package/dist/runtime/components/UnAuthInputs.d.vue.ts +23 -0
  7. package/dist/runtime/components/UnAuthInputs.vue +86 -0
  8. package/dist/runtime/components/UnAuthInputs.vue.d.ts +23 -0
  9. package/dist/runtime/components/UnAuthShortHand.d.vue.ts +8 -0
  10. package/dist/runtime/components/UnAuthShortHand.vue +19 -0
  11. package/dist/runtime/components/UnAuthShortHand.vue.d.ts +8 -0
  12. package/dist/runtime/components/UnCodeInput.d.vue.ts +6 -0
  13. package/dist/runtime/components/UnCodeInput.vue +31 -0
  14. package/dist/runtime/components/UnCodeInput.vue.d.ts +6 -0
  15. package/dist/runtime/components/UnFormItem.vue +2 -3
  16. package/dist/runtime/components/UnIRDatePicker.vue +1 -1
  17. package/dist/runtime/components/UnInput.d.vue.ts +2 -2
  18. package/dist/runtime/components/UnInput.vue.d.ts +2 -2
  19. package/dist/runtime/components/UnLog.vue +2 -0
  20. package/dist/runtime/components/UnMap.vue +42 -24
  21. package/dist/runtime/components/UnMultiUploader.vue +47 -44
  22. package/dist/runtime/components/UnNormalInput.d.vue.ts +51 -0
  23. package/dist/runtime/components/UnNormalInput.vue +110 -0
  24. package/dist/runtime/components/UnNormalInput.vue.d.ts +51 -0
  25. package/dist/runtime/components/UnSelect.vue +17 -5
  26. package/dist/runtime/components/UnTimer.d.vue.ts +16 -0
  27. package/dist/runtime/components/UnTimer.vue +31 -0
  28. package/dist/runtime/components/UnTimer.vue.d.ts +16 -0
  29. package/dist/runtime/components/UnUploadFile.vue +38 -25
  30. package/dist/runtime/composables/reuseable.d.ts +3 -3
  31. package/package.json +7 -7
@@ -1,12 +1,12 @@
1
1
  import type { Input } from '../types/models.js';
2
2
  type __VLS_Props = {
3
3
  disabled?: boolean;
4
- Input?: Input;
4
+ Input?: Partial<Input>;
5
5
  Type?: Input['type'];
6
6
  isError?: boolean;
7
7
  index?: number;
8
8
  };
9
- declare const Input: Input | undefined;
9
+ declare const Input: Partial<Input> | undefined;
10
10
  type __VLS_ModelProps = {
11
11
  modelValue?: any;
12
12
  };
@@ -1,12 +1,12 @@
1
1
  import type { Input } from '../types/models.js';
2
2
  type __VLS_Props = {
3
3
  disabled?: boolean;
4
- Input?: Input;
4
+ Input?: Partial<Input>;
5
5
  Type?: Input['type'];
6
6
  isError?: boolean;
7
7
  index?: number;
8
8
  };
9
- declare const Input: Input | undefined;
9
+ declare const Input: Partial<Input> | undefined;
10
10
  type __VLS_ModelProps = {
11
11
  modelValue?: any;
12
12
  };
@@ -15,6 +15,8 @@
15
15
  </template>
16
16
 
17
17
  <script setup>
18
+ import VueJsonPretty from "vue-json-pretty";
19
+ import "vue-json-pretty/lib/styles.css";
18
20
  defineProps({
19
21
  data: {
20
22
  type: [Number, Object, Array, String, Boolean],
@@ -2,33 +2,51 @@
2
2
  <ClientOnly>
3
3
  <div class="relative h-full z-1">
4
4
  <NeshanMap
5
- ref="map"
6
- :mapKey="NESHAN_WEB_KEY"
7
- :service-key="NESHAN_API_KEY"
8
- class="h-100"
9
- :poi="true"
10
- :traffic="true"
11
- default-type="dreamy-gold"
12
- :zoom="15"
13
- :hide-search-container="true"
14
- :hide-layers="true"
15
- :cluster="true"
16
- :center="center"
17
- :reverse-on-click="false"
18
- :popup-on-marker-hover="false"
5
+ ref="map"
6
+ :map-key="NESHAN_WEB_KEY"
7
+ :service-key="NESHAN_API_KEY"
8
+ class="h-100"
9
+ :poi="true"
10
+ :traffic="true"
11
+ default-type="dreamy-gold"
12
+ :zoom="15"
13
+ :hide-search-container="true"
14
+ :hide-layers="true"
15
+ :cluster="true"
16
+ :center="center"
17
+ :reverse-on-click="false"
18
+ :popup-on-marker-hover="false"
19
19
  />
20
20
  <div
21
- class="absolute left-1/50 top-1/40 flex flex-col rounded-2xl gap-1 items-center select-none
22
- text-primary-500 children:(bg-primary w-8 h-8 p-1 flex justify-center items-center rounded-2xl cursor-pointer) z-[999999]">
23
- <TheNuxtIcon @click="zoom(1)" name="solar:add-square-line-duotone"/>
24
- <TheNuxtIcon @click="zoom(-1)" name="solar:minus-square-line-duotone"/>
25
- <TheNuxtIcon v-if="isSupported && !readonly" @click="setCenterFromLoc" name="solar:gps-line-duotone"/>
26
- <a v-if="readonly" :href="geo">
27
- <TheNuxtIcon name="solar:share-line-duotone"/>
21
+ class="absolute left-1/50 top-1/40 flex flex-col rounded-2xl gap-1 items-center select-none
22
+ text-primary-500 children:(bg-primary w-8 h-8 p-1 flex justify-center items-center rounded-2xl cursor-pointer) z-[999999]"
23
+ >
24
+ <UnNuxtIcon
25
+ name="solar:add-square-line-duotone"
26
+ @click="zoom(1)"
27
+ />
28
+ <UnNuxtIcon
29
+ name="solar:minus-square-line-duotone"
30
+ @click="zoom(-1)"
31
+ />
32
+ <UnNuxtIcon
33
+ v-if="isSupported && !readonly"
34
+ name="solar:gps-line-duotone"
35
+ @click="setCenterFromLoc"
36
+ />
37
+ <a
38
+ v-if="readonly"
39
+ :href="geo"
40
+ >
41
+ <UnNuxtIcon name="solar:share-line-duotone" />
28
42
  </a>
29
43
  </div>
30
- <TheNuxtIcon v-if="!readonly" :name="`${marker || 'my-icon:home-marker'}`" icon-type="img"
31
- class="!absolute right-1/2 bottom-1/2 transform translate-x-1/2"/>
44
+ <UnNuxtIcon
45
+ v-if="!readonly"
46
+ :name="`${marker || 'my-icon:home-marker'}`"
47
+ icon-type="img"
48
+ class="!absolute right-1/2 bottom-1/2 transform translate-x-1/2"
49
+ />
32
50
  </div>
33
51
  </ClientOnly>
34
52
  </template>
@@ -39,7 +57,7 @@ import { Feature } from "ol";
39
57
  import { Vector } from "ol/layer";
40
58
  import { Vector as SourceVector } from "ol/source";
41
59
  import { Style, Icon, Stroke, Fill } from "ol/style";
42
- import { Geometry, Point, Circle as GeomCircle } from "ol/geom";
60
+ import { Point, Circle as GeomCircle } from "ol/geom";
43
61
  import { fromLonLat, transform } from "ol/proj";
44
62
  import Big from "big.js";
45
63
  const emit = defineEmits(["select-point"]);
@@ -1,75 +1,78 @@
1
1
  <template>
2
2
  <form
3
- class="flex gap-4 items-stretch text-base text-primary-500 min-h-16"
4
- @submit.prevent="upload"
5
- @dragover.prevent
6
- @dragenter="hovered = true"
7
- @dragleave="hovered = false"
8
- @drop.stop.prevent="drop"
3
+ class="flex gap-4 items-stretch text-base text-primary-500 min-h-16"
4
+ @submit.prevent="upload"
5
+ @dragover.prevent
6
+ @dragenter="hovered = true"
7
+ @dragleave="hovered = false"
8
+ @drop.stop.prevent="drop"
9
9
  >
10
10
  <input
11
- v-if="!max || files?.length < max"
12
- id="image"
13
- type="file"
14
- alt="uploadImage"
15
- hidden
16
- :accept="accept"
17
- multiple
18
- @change="upload($event.target)"
19
- />
11
+ v-if="!max || files?.length < max"
12
+ id="image"
13
+ type="file"
14
+ alt="uploadImage"
15
+ hidden
16
+ :accept="accept"
17
+ multiple
18
+ @change="upload($event.target)"
19
+ >
20
20
  <label
21
- v-if="false"
22
- for="image"
23
- class="flex flex-row items-center justify-center gap-2 bg-box rounded-lg w-57 outline-1 outline-dashed outline-offset-6 my-2 mr-2 cursor-pointer border-border border-1"
24
- :class="[
21
+ v-if="false"
22
+ for="image"
23
+ class="flex flex-row items-center justify-center gap-2 bg-box rounded-lg w-57 outline-1 outline-dashed outline-offset-6 my-2 mr-2 cursor-pointer border-border border-1"
24
+ :class="[
25
25
  hovered ? 'outline-danger text-danger' : 'outline-primary text-primary-500',
26
26
  uploaderClass
27
27
  ]"
28
28
  >
29
29
  <i class="flex justify-center items-center svg:(w-8 h-8)">
30
- <TheNuxtIcon name="solar:gallery-add-line-duotone"/>
30
+ <UnNuxtIcon name="solar:gallery-add-line-duotone" />
31
31
  </i>
32
32
  <b>{{ label || $t("\u0622\u067E\u0644\u0648\u062F \u062A\u0635\u0648\u06CC\u0631") }}</b>
33
33
  </label>
34
34
  <transition-group
35
- name="list"
36
- tag="div"
37
- class="flex flex-row flex-wrap gap-4 items-stretch"
38
- :class="filesClass"
35
+ name="list"
36
+ tag="div"
37
+ class="flex flex-row flex-wrap gap-4 items-stretch"
38
+ :class="filesClass"
39
39
  >
40
40
  <label
41
- key="label"
42
- for="image"
43
- class="flex flex-row items-center justify-center gap-2 bg-box rounded-lg w-57 outline-1 outline-dashed outline-offset-6 my-2 mr-2 cursor-pointer border-border border-1"
44
- :class="[
41
+ key="label"
42
+ for="image"
43
+ class="flex flex-row items-center justify-center gap-2 bg-box rounded-lg w-57 outline-1 outline-dashed outline-offset-6 my-2 mr-2 cursor-pointer border-border border-1"
44
+ :class="[
45
45
  hovered ? 'outline-danger text-danger' : 'outline-primary text-primary-500',
46
46
  uploaderClass
47
- ]">
47
+ ]"
48
+ >
48
49
  <i class="flex justify-center items-center svg:(w-8 h-8)">
49
- <TheNuxtIcon name="solar:gallery-add-line-duotone"/>
50
+ <UnNuxtIcon name="solar:gallery-add-line-duotone" />
50
51
  </i>
51
52
  <b>{{ label || $t("\u0622\u067E\u0644\u0648\u062F \u062A\u0635\u0648\u06CC\u0631") }}</b>
52
53
  </label>
53
54
  <div
54
- v-for="(image, index) in files"
55
- :key="index"
56
- class="bg-box rounded-lg aspect-square w-16 overflow-hidden relative border-(1 solid)"
57
- :class="[
55
+ v-for="(image, index) in files"
56
+ :key="index"
57
+ class="bg-box rounded-lg aspect-square w-16 overflow-hidden relative border-(1 solid)"
58
+ :class="[
58
59
  selected === index && selectable ? 'border-primary' : 'border-transparent'
59
60
  ]"
60
61
  >
61
62
  <img
62
- :src="image"
63
- :alt="index"
64
- class="w-full h-full object-cover"
63
+ :src="image"
64
+ :alt="index"
65
+ class="w-full h-full object-cover"
66
+ >
67
+ <div
68
+ v-if="selectable"
69
+ class="absolute inset-0 bg-white bg-opacity-50 svg:(w-6 h-6) opacity-30 transition duration-300 cursor-pointer hover:(opacity-100)"
70
+ @click.self="emit('select', index)"
65
71
  />
66
- <div v-if="selectable"
67
- class="absolute inset-0 bg-white bg-opacity-50 svg:(w-6 h-6) opacity-30 transition duration-300 cursor-pointer hover:(opacity-100)"
68
- @click.self="emit('select', index)">
69
- </div>
70
- <TheNuxtIcon name="solar:gallery-remove-line-duotone"
71
- class="z-1 !absolute left-0 bottom-0 hover:(text-danger) cursor-pointer w-6 h-6"
72
- @click="deleteImage(index)"
72
+ <UnNuxtIcon
73
+ name="solar:gallery-remove-line-duotone"
74
+ class="z-1 !absolute left-0 bottom-0 hover:(text-danger) cursor-pointer w-6 h-6"
75
+ @click="deleteImage(index)"
73
76
  />
74
77
  </div>
75
78
  </transition-group>
@@ -0,0 +1,51 @@
1
+ interface Props {
2
+ className?: string;
3
+ valueClassName?: string;
4
+ focusClassName?: string;
5
+ labelClass?: string;
6
+ prependIcon?: string;
7
+ prependIconType?: string;
8
+ appendIcon?: string;
9
+ appendIconType?: string;
10
+ appendIconClass?: string;
11
+ appendText?: string;
12
+ inputType?: string;
13
+ placeholder?: string;
14
+ label?: string;
15
+ password?: boolean;
16
+ date?: boolean;
17
+ disabled?: boolean;
18
+ inputMode?: string;
19
+ iconColor?: string;
20
+ bgStyle?: string;
21
+ handler?: any;
22
+ focusable?: boolean;
23
+ }
24
+ type __VLS_Props = Props;
25
+ type __VLS_ModelProps = {
26
+ modelValue?: any;
27
+ };
28
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
29
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {
30
+ date: boolean;
31
+ password: boolean;
32
+ appendIcon: string;
33
+ label: string;
34
+ inputType: string;
35
+ placeholder: string;
36
+ disabled: boolean;
37
+ focusable: boolean;
38
+ className: string;
39
+ valueClassName: string;
40
+ focusClassName: string;
41
+ labelClass: string;
42
+ prependIcon: string;
43
+ appendIconType: string;
44
+ appendIconClass: string;
45
+ appendText: string;
46
+ inputMode: string;
47
+ iconColor: string;
48
+ bgStyle: string;
49
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
50
+ declare const _default: typeof __VLS_export;
51
+ export default _default;
@@ -0,0 +1,110 @@
1
+ <template>
2
+ <div class="flex flex-col gap-1.5 ">
3
+ <p
4
+ v-if="label"
5
+ :class="labelClass"
6
+ >
7
+ {{ label }}
8
+ </p>
9
+ <div
10
+ v-on-click-outside="() => focused = false"
11
+ class="flex relative px-3 py-1 gap-1 h-12 items-center bg-white"
12
+ :class="[value && !focused ? valueClassName : focused ? focusClassName : bgStyle, className]"
13
+ >
14
+ <UnNuxtIcon
15
+ v-if="prependIcon"
16
+ :name="prependIcon"
17
+ :icon-type="prependIconType"
18
+ :class="[iconColor ? iconColor : 'text-gray-400']"
19
+ />
20
+ <UnIRDatePicker
21
+ v-if="date"
22
+ v-model="value"
23
+ format="YYYY-MM-DD[T]HH:mm:ssZ"
24
+ class="text-text"
25
+ display-format="jDD jMMMM jYYYY"
26
+ :placeholder="placeholder"
27
+ />
28
+ <input
29
+ v-if="InputType !== 'textarea'"
30
+ v-model="value"
31
+ dir="rtl"
32
+ :type="InputType"
33
+ :inputmode="inputMode"
34
+ class="flex-grow bg-white placeholder-gray-200 text-text-head font-300 text-sm"
35
+ :disabled="disabled"
36
+ :placeholder="!focused ? placeholder : value || ''"
37
+ @focus="date ? InputType = 'date' : focused = true"
38
+ >
39
+ <textarea
40
+ v-else
41
+ v-model="value"
42
+ :placeholder="placeholder"
43
+ :disabled="disabled"
44
+ class="border-none text-sm font-400 grow c-gray-900 placeholder:(c-gray-400) outline-none bg-white h-24"
45
+ @focus="date ? InputType = 'date' : ''"
46
+ @blur="date ? InputType = 'text' : ''"
47
+ />
48
+ <UnNuxtIcon
49
+ v-if="password"
50
+ :name="InputType === 'text' ? 'eye-slash' : 'eye'"
51
+ icon-type="svg"
52
+ class="!text-gray-200 cursor-pointer"
53
+ @click="InputType = InputType === 'text' ? 'password' : 'text'"
54
+ />
55
+ <UnNuxtIcon
56
+ v-if="appendIcon"
57
+ :name="appendIcon"
58
+ :icon-type="appendIconType"
59
+ :class="[iconColor ? iconColor : 'text-gray-400', appendIconClass]"
60
+ class="!svg:(w-3 h-3) bg-bg bg-opacity-30 justify-center rounded-full"
61
+ @click="$emit('append')"
62
+ />
63
+ <p
64
+ v-if="appendText"
65
+ dir="ltr"
66
+ class="font-400 text-xs text-text-head whitespace-nowrap"
67
+ >
68
+ {{ appendText }}
69
+ </p>
70
+ </div>
71
+ </div>
72
+ </template>
73
+
74
+ <script setup>
75
+ import { vOnClickOutside } from "@vueuse/components";
76
+ import { ref } from "#imports";
77
+ const props = defineProps({
78
+ className: { type: String, required: false, default: "rounded-2xl bg-bg" },
79
+ valueClassName: { type: String, required: false, default: "border-(1 solid gray-200) bg-bg" },
80
+ focusClassName: { type: String, required: false, default: "border-(2 solid primary-500) !bg-bg" },
81
+ labelClass: { type: String, required: false, default: "text-(xs text-head) font-400 leading-6" },
82
+ prependIcon: { type: String, required: false, default: "" },
83
+ prependIconType: { type: String, required: false },
84
+ appendIcon: { type: String, required: false, default: "" },
85
+ appendIconType: { type: String, required: false, default: "svg" },
86
+ appendIconClass: { type: String, required: false, default: "" },
87
+ appendText: { type: String, required: false, default: "" },
88
+ inputType: { type: String, required: false, default: "text" },
89
+ placeholder: { type: String, required: false, default: "" },
90
+ label: { type: String, required: false, default: "" },
91
+ password: { type: Boolean, required: false, default: false },
92
+ date: { type: Boolean, required: false, default: false },
93
+ disabled: { type: Boolean, required: false, default: false },
94
+ inputMode: { type: String, required: false, default: "" },
95
+ iconColor: { type: String, required: false, default: "" },
96
+ bgStyle: { type: String, required: false, default: "bg-bg border-(1 solid gray-200)" },
97
+ handler: { type: null, required: false },
98
+ focusable: { type: Boolean, required: false, default: false }
99
+ });
100
+ defineEmits(["append", "update:modelValue"]);
101
+ const value = defineModel();
102
+ const focused = ref(false);
103
+ const InputType = ref(props.inputType);
104
+ </script>
105
+
106
+ <style>
107
+ input {
108
+ outline: none;
109
+ }
110
+ </style>
@@ -0,0 +1,51 @@
1
+ interface Props {
2
+ className?: string;
3
+ valueClassName?: string;
4
+ focusClassName?: string;
5
+ labelClass?: string;
6
+ prependIcon?: string;
7
+ prependIconType?: string;
8
+ appendIcon?: string;
9
+ appendIconType?: string;
10
+ appendIconClass?: string;
11
+ appendText?: string;
12
+ inputType?: string;
13
+ placeholder?: string;
14
+ label?: string;
15
+ password?: boolean;
16
+ date?: boolean;
17
+ disabled?: boolean;
18
+ inputMode?: string;
19
+ iconColor?: string;
20
+ bgStyle?: string;
21
+ handler?: any;
22
+ focusable?: boolean;
23
+ }
24
+ type __VLS_Props = Props;
25
+ type __VLS_ModelProps = {
26
+ modelValue?: any;
27
+ };
28
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
29
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {
30
+ date: boolean;
31
+ password: boolean;
32
+ appendIcon: string;
33
+ label: string;
34
+ inputType: string;
35
+ placeholder: string;
36
+ disabled: boolean;
37
+ focusable: boolean;
38
+ className: string;
39
+ valueClassName: string;
40
+ focusClassName: string;
41
+ labelClass: string;
42
+ prependIcon: string;
43
+ appendIconType: string;
44
+ appendIconClass: string;
45
+ appendText: string;
46
+ inputMode: string;
47
+ iconColor: string;
48
+ bgStyle: string;
49
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
50
+ declare const _default: typeof __VLS_export;
51
+ export default _default;
@@ -5,10 +5,11 @@
5
5
  >
6
6
  <div
7
7
  v-if="!inline"
8
+ :id
8
9
  name="header"
9
10
  :class="customClass.header"
10
11
  class="bg-white h-12 rounded-2xl flex flex-row gap-1 items-center px-2 py-1 cursor-pointer text-black-1 relative"
11
- @click="!readonly && !inline ? show = !show : ''"
12
+ @click="!readonly && !inline ? toggle() : ''"
12
13
  >
13
14
  <UnNuxtIcon
14
15
  v-if="icon"
@@ -39,11 +40,11 @@
39
40
  <div
40
41
  v-on-click-outside="close"
41
42
  name="wrapper"
42
- :style="dropdownStyles"
43
+ :style="!isMobile && !inline && dropdownStyles"
43
44
  class="z-1000 md:mt-3 rounded-2xl w-full min-w-fit text-base flex flex-col items-stretch overflow-y-auto scrollbar-thin"
44
45
  :class="[
45
46
  customClass.wrapper,
46
- inline ? 'relative' : 'absolute',
47
+ inline ? 'relative' : 'absolute <md:(bg-black/10 fixed inset-0 backdrop-blur-xs justify-end)',
47
48
  light ? 'bg-white' : 'bg-border',
48
49
  inline ? '' : Searchable ? 'md:max-h-230px' : 'md:max-h-160px'
49
50
  ]"
@@ -108,7 +109,8 @@
108
109
 
109
110
  <script setup>
110
111
  import { vOnClickOutside } from "@vueuse/components";
111
- import { _get, computed, isEqual, nextTick, ref, watch } from "#imports";
112
+ import { _get, computed, isEqual, nextTick, ref, useDevice, useId, watch } from "#imports";
113
+ const { isMobile } = useDevice();
112
114
  const { valueKey, items, multi, searchable, customClass = {} } = defineProps({
113
115
  placeholder: { type: String, required: false },
114
116
  icon: { type: String, required: false },
@@ -121,6 +123,7 @@ const { valueKey, items, multi, searchable, customClass = {} } = defineProps({
121
123
  inline: { type: Boolean, required: false },
122
124
  customClass: { type: Object, required: false }
123
125
  });
126
+ const id = useId();
124
127
  const value = defineModel({ type: null });
125
128
  const show = ref(false);
126
129
  const search = ref("");
@@ -129,9 +132,18 @@ const searchedOptions = computed(() => {
129
132
  if (!search.value) return items;
130
133
  return items.filter((option) => Label(option).title?.toLowerCase().includes?.(search.value?.toLowerCase()?.trim()));
131
134
  });
132
- const close = () => {
135
+ const close = (e = {}) => {
136
+ const name = e?.target?.id;
137
+ const pname = e?.target?.parentElement?.id;
138
+ const ppname = e?.target?.parentElement?.parentElement?.id;
139
+ console.log(e);
140
+ if ([name, pname, ppname].includes(id)) return;
133
141
  show.value = false;
134
142
  };
143
+ const toggle = () => {
144
+ console.log("aaa");
145
+ show.value = !show.value;
146
+ };
135
147
  const dropdownStyles = ref({});
136
148
  const Value = (option) => valueKey ? _get(option, valueKey, option) : option;
137
149
  const Label = (option) => typeof option === "string" ? { title: option } : option;
@@ -0,0 +1,16 @@
1
+ type __VLS_Props = {
2
+ time: string;
3
+ };
4
+ type __VLS_ModelProps = {
5
+ modelValue?: any;
6
+ };
7
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
9
+ timestamp: import("vue").ShallowRef<number>;
10
+ pause: import("@vueuse/shared").Fn;
11
+ resume: import("@vueuse/shared").Fn;
12
+ diff: import("vue").ComputedRef<number>;
13
+ isExpired: import("vue").ComputedRef<boolean>;
14
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <time
3
+ dir="ltr"
4
+ class="text-center font-black text-base text-primary-500 "
5
+ >
6
+ {{ diff > d ? Math.floor(diff / d) + ":" : "" }}
7
+ {{ diff > h ? Math.floor(diff % d / h) + ":" : "" }}
8
+ {{ diff > m ? Math.floor(diff % h / m) + ":" : "" }}
9
+ {{ Math.floor(diff % m) }}
10
+ </time>
11
+ </template>
12
+
13
+ <script setup>
14
+ import { computed, moment, useTimestamp, watch } from "#imports";
15
+ const props = defineProps({
16
+ time: { type: String, required: true }
17
+ });
18
+ const m = 60;
19
+ const h = 60 * m;
20
+ const d = 24 * h;
21
+ defineEmits(["complete"]);
22
+ const value = defineModel();
23
+ const { timestamp, pause, resume } = useTimestamp({ controls: true, interval: 330 });
24
+ const diff = computed(() => (moment(props.time).valueOf() - timestamp.value) / 1e3);
25
+ const isExpired = computed(() => diff.value <= 0);
26
+ value.value = isExpired.value;
27
+ watch(isExpired, () => {
28
+ value.value = isExpired.value;
29
+ });
30
+ defineExpose({ timestamp, pause, resume, diff, isExpired });
31
+ </script>
@@ -0,0 +1,16 @@
1
+ type __VLS_Props = {
2
+ time: string;
3
+ };
4
+ type __VLS_ModelProps = {
5
+ modelValue?: any;
6
+ };
7
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
9
+ timestamp: import("vue").ShallowRef<number>;
10
+ pause: import("@vueuse/shared").Fn;
11
+ resume: import("@vueuse/shared").Fn;
12
+ diff: import("vue").ComputedRef<number>;
13
+ isExpired: import("vue").ComputedRef<boolean>;
14
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;