@unsource/ui 2.1.4 → 2.1.5

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unsource-ui",
3
3
  "configKey": "unsourceUi",
4
- "version": "2.1.4",
4
+ "version": "2.1.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -56,10 +56,9 @@
56
56
  <UnSelect
57
57
  v-else-if="Type === 'select' && options?.length"
58
58
  v-model="modelValue"
59
- :options="options"
59
+ :items="options.map((e) => ({ title: e.title, value: e.key }))"
60
+ value-key="value"
60
61
  :light="true"
61
- value-key="key"
62
- label-key="title"
63
62
  :searchable="true"
64
63
  :disabled="item.disabled"
65
64
  :is-error
@@ -21,7 +21,7 @@
21
21
  value ? moment(value, format[type]).locale(locale).format(display[type]) : focused ? "" : placeholder
22
22
  }}
23
23
  </p>
24
- <TheNuxtIcon
24
+ <UnNuxtIcon
25
25
  name="solar:close-circle-bold-duotone"
26
26
  class="text-5 c-gray-400"
27
27
  @click.prevent.stop="emit('append')"
@@ -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>
@@ -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;
@@ -1,39 +1,52 @@
1
1
  <template>
2
2
  <form
3
- class="flex flex-col relative"
4
- @dragenter="hovered=true"
5
- @dragleave="hovered=false"
6
- @submit.prevent="upload"
7
- @dragover.prevent
8
- @drop.stop.prevent="drop">
3
+ class="flex flex-col relative"
4
+ @dragenter="hovered=true"
5
+ @dragleave="hovered=false"
6
+ @submit.prevent="upload"
7
+ @dragover.prevent
8
+ @drop.stop.prevent="drop"
9
+ >
9
10
  <label
10
- class="flex justify-center items-stretch bg-transparent rounded-2xl relative overflow-hidden cursor-pointer h-full"
11
- :class="{'p-2' : !value}">
11
+ class="flex justify-center items-stretch bg-transparent rounded-2xl relative overflow-hidden cursor-pointer h-full"
12
+ :class="{ 'p-2': !value }"
13
+ >
12
14
  <slot name="icon">
13
- <div v-if="!value || loading"
14
- class="flex flex-col justify-center items-center gap-3 p-2 border-(2 dashed) rounded-2xl grow"
15
- :class="label ? 'border-(primary-500)' : 'border-transparent' ">
16
- <TheNuxtIcon
17
- v-if="!loading"
18
- class="flex justify-center items-center text-primary-500 rounded-lg"
19
- :class="label ? 'text-3xl' : 'text-8xl'"
20
- :name="icon"/>
21
- <TheNuxtIcon v-else name="loading" icon-type="svg"/>
15
+ <div
16
+ v-if="!value || loading"
17
+ class="flex flex-col justify-center items-center gap-3 p-2 border-(2 dashed) rounded-2xl grow"
18
+ :class="label ? 'border-(primary-500)' : 'border-transparent' "
19
+ >
20
+ <UnNuxtIcon
21
+ v-if="!loading"
22
+ class="flex justify-center items-center text-primary-500 rounded-lg"
23
+ :class="label ? 'text-3xl' : 'text-8xl'"
24
+ :name="icon"
25
+ />
26
+ <UnNuxtIcon
27
+ v-else
28
+ name="loading"
29
+ icon-type="svg"
30
+ />
22
31
  <p class="text-(xs gray-400) font-extrabold text-center">
23
32
  {{ label }}
24
33
  </p>
25
34
  </div>
26
- <TheNuxtIcon
27
- v-else
28
- :name="value"
29
- class="object-contain bg-gray-100 rounded-lg !w-full !h-full"/>
35
+ <UnNuxtIcon
36
+ v-else
37
+ :name="value"
38
+ class="object-contain bg-gray-100 rounded-lg !w-full !h-full"
39
+ />
30
40
  </slot>
31
41
  <input
32
- :disabled="!disabled" :accept="accept"
33
- alt="uploadImage" hidden type="file"
34
- @change="upload($event.target)"/>
42
+ :disabled="!disabled"
43
+ :accept="accept"
44
+ alt="uploadImage"
45
+ hidden
46
+ type="file"
47
+ @change="upload($event.target)"
48
+ >
35
49
  </label>
36
-
37
50
  </form>
38
51
  </template>
39
52
 
@@ -24,9 +24,9 @@ export declare const useMeta: (v?: {
24
24
  handler?: () => any;
25
25
  }>;
26
26
  export declare const useReload: () => import("vue").Ref<number, number>;
27
- export declare const useUserId: () => import("nuxt/app").CookieRef<string | null | undefined>;
28
- export declare const useToken: () => import("nuxt/app").CookieRef<string | null | undefined>;
29
- export declare const useProviderId: () => import("nuxt/app").CookieRef<string | null | undefined>;
27
+ export declare const useUserId: () => import("#app").CookieRef<string | null | undefined>;
28
+ export declare const useToken: () => import("#app").CookieRef<string | null | undefined>;
29
+ export declare const useProviderId: () => import("#app").CookieRef<string | null | undefined>;
30
30
  export declare const useCurrentProductIndex: (products: ServiceSetting[], p: Partial<ServiceSetting>) => number;
31
31
  export declare const SettingToType: (setting: ServiceSetting) => ServiceSettingType;
32
32
  export declare const NotInProcessBooking: (e: Booking["status"]) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsource/ui",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "private": false,
5
5
  "description": "nuxt ui kit for unsource env",
6
6
  "repository": "https://github.com/alisa2142/unsource-ui",
@@ -27,8 +27,7 @@
27
27
  "prepack": "nuxt-module-build build",
28
28
  "dev": "npm run dev:prepare && nuxi dev playground",
29
29
  "dev:build": "nuxi build playground",
30
- "dev:prepare:main": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
31
- "dev:prepare": "nuxt-module-build build && nuxi prepare playground",
30
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
32
31
  "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
33
32
  "lint": "eslint .",
34
33
  "test": "vitest run",