sprintify-ui 0.8.15 → 0.8.17

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.
@@ -9618,16 +9618,20 @@ const BE = {
9618
9618
  size: { default: "base" },
9619
9619
  class: { type: [Array, String, null, Number, Boolean], default: "" }
9620
9620
  },
9621
- setup(n) {
9622
- const t = n, e = N(() => t.size == "xs" ? "md:p-3 p-2" : t.size == "sm" ? "md:p-4 p-3" : t.size == "lg" ? "md:p-8 p-6" : "md:p-6 px-4 py-5"), r = N(() => gt(
9621
+ emits: ["click"],
9622
+ setup(n, { emit: t }) {
9623
+ const e = t, r = () => {
9624
+ e("click");
9625
+ }, i = n, o = N(() => i.size == "xs" ? "md:p-3 p-2" : i.size == "sm" ? "md:p-4 p-3" : i.size == "lg" ? "md:p-8 p-6" : "md:p-6 px-4 py-5"), l = N(() => gt(
9623
9626
  "border-t border-slate-300 first:border-t-0",
9624
- e.value,
9625
- t.class
9627
+ o.value,
9628
+ i.class
9626
9629
  ));
9627
- return (i, o) => (I(), K("div", {
9628
- class: ce(C(r))
9630
+ return (a, s) => (I(), K("div", {
9631
+ class: ce(C(l)),
9632
+ onClick: r
9629
9633
  }, [
9630
- Re(i.$slots, "default")
9634
+ Re(a.$slots, "default")
9631
9635
  ], 2));
9632
9636
  }
9633
9637
  }), iS = {
@@ -32050,7 +32054,7 @@ const FI = ["onClick"], HI = { class: "px-2 flex items-center" }, qI = { class:
32050
32054
  props: {
32051
32055
  modelValue: {
32052
32056
  default: void 0,
32053
- type: [Array, null, void 0]
32057
+ type: [Array, String, Number, null, void 0]
32054
32058
  },
32055
32059
  url: {
32056
32060
  required: !0,
@@ -32118,26 +32122,27 @@ const FI = ["onClick"], HI = { class: "px-2 flex items-center" }, qI = { class:
32118
32122
  );
32119
32123
  }
32120
32124
  function d() {
32121
- if (!Array.isArray(r.modelValue)) {
32125
+ let f = r.modelValue;
32126
+ if ((typeof f == "string" || typeof f == "number") && (f = [f + ""]), !Array.isArray(f)) {
32122
32127
  a.value = [];
32123
32128
  return;
32124
32129
  }
32125
- if (r.modelValue.length == 0) {
32130
+ if (f.length == 0) {
32126
32131
  a.value = [];
32127
32132
  return;
32128
32133
  }
32129
- const f = r.modelValue.map((g) => g.toString());
32130
- a.value = a.value.filter((g) => f.includes(g[r.primaryKey] + ""));
32131
- const h = a.value.map((g) => g[r.primaryKey] + "");
32132
- let p = f.filter((g) => !h.includes(g));
32133
- p.length != 0 && (Array.isArray(r.currentModels) && p.forEach((g) => {
32134
- var v;
32135
- const m = (v = r.currentModels) == null ? void 0 : v.find((y) => y[r.primaryKey] == g);
32136
- m && (a.value.push(m), p = p.filter((y) => y != g));
32137
- }), p.length != 0 && r.showRouteUrl != null && i.get(r.showRouteUrl(p)).then((g) => {
32138
- const m = gg(g.data);
32139
- a.value = m.filter((v) => f.includes(v[r.primaryKey] + ""));
32140
- }).catch((g) => g));
32134
+ const h = f.map((m) => m.toString());
32135
+ a.value = a.value.filter((m) => h.includes(m[r.primaryKey] + ""));
32136
+ const p = a.value.map((m) => m[r.primaryKey] + "");
32137
+ let g = h.filter((m) => !p.includes(m));
32138
+ g.length != 0 && (Array.isArray(r.currentModels) && g.forEach((m) => {
32139
+ var y;
32140
+ const v = (y = r.currentModels) == null ? void 0 : y.find((b) => b[r.primaryKey] == m);
32141
+ v && (a.value.push(v), g = g.filter((b) => b != m));
32142
+ }), g.length != 0 && r.showRouteUrl != null && i.get(r.showRouteUrl(g)).then((m) => {
32143
+ const v = gg(m.data);
32144
+ a.value = v.filter((y) => h.includes(y[r.primaryKey] + ""));
32145
+ }).catch((m) => m));
32141
32146
  }
32142
32147
  return t({
32143
32148
  focus: () => {
@@ -5,13 +5,17 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
5
5
  }>, {
6
6
  size: string;
7
7
  class: string;
8
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
8
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ click: (...args: any[]) => void;
10
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
9
11
  size: "xs" | "sm" | "lg" | "base";
10
12
  class?: ClassNameValue;
11
13
  }>, {
12
14
  size: string;
13
15
  class: string;
14
- }>>>, {
16
+ }>>> & {
17
+ onClick?: ((...args: any[]) => any) | undefined;
18
+ }, {
15
19
  class: string | false | 0 | ClassNameValue[] | null;
16
20
  size: "xs" | "sm" | "lg" | "base";
17
21
  }, {}>, {
@@ -3,7 +3,7 @@ import { PropType } from 'vue';
3
3
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
4
4
  modelValue: {
5
5
  default: undefined;
6
- type: PropType<string[] | null | undefined>;
6
+ type: PropType<string | number | string[] | null | undefined>;
7
7
  };
8
8
  url: {
9
9
  required: true;
@@ -60,7 +60,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
60
60
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
61
61
  modelValue: {
62
62
  default: undefined;
63
- type: PropType<string[] | null | undefined>;
63
+ type: PropType<string | number | string[] | null | undefined>;
64
64
  };
65
65
  url: {
66
66
  required: true;
@@ -110,7 +110,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
110
110
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
111
111
  }, {
112
112
  required: boolean;
113
- modelValue: string[] | null | undefined;
113
+ modelValue: string | number | string[] | null | undefined;
114
114
  placeholder: string;
115
115
  disabled: boolean;
116
116
  hasError: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.8.15",
3
+ "version": "0.8.17",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <div :class="classes">
2
+ <div
3
+ :class="classes"
4
+ @click="onClick"
5
+ >
3
6
  <slot />
4
7
  </div>
5
8
  </template>
@@ -7,11 +10,16 @@
7
10
  <script lang="ts" setup>
8
11
  import { ClassNameValue, twMerge } from 'tailwind-merge';
9
12
 
10
-
11
13
  defineOptions({
12
14
  inheritAttrs: false,
13
15
  })
14
16
 
17
+ const emit = defineEmits(['click']);
18
+
19
+ const onClick = () => {
20
+ emit('click');
21
+ };
22
+
15
23
  const props = withDefaults(defineProps<{
16
24
  size: 'xs' | 'sm' | 'base' | 'lg',
17
25
  class?: ClassNameValue,
@@ -30,10 +30,7 @@ const Template = (args) => {
30
30
  return {
31
31
  components: { BaseHasMany, ShowValue, BaseAppSnackbars },
32
32
  setup() {
33
- const value = ref([
34
- "4",
35
- "6",
36
- ]);
33
+ const value = ref(4);
37
34
  const currentModels = ref([
38
35
  { id: 4, name: 'Todo 4 (local)' },
39
36
  { id: 6, name: 'Todo 6 (local)' },
@@ -55,7 +55,7 @@ import { getItems } from '@/utils/getApiData';
55
55
  const props = defineProps({
56
56
  modelValue: {
57
57
  default: undefined,
58
- type: [Array, null, undefined] as PropType<string[] | null | undefined>,
58
+ type: [Array, String, Number, null, undefined] as PropType<string[] | string | number | null | undefined>,
59
59
  },
60
60
  url: {
61
61
  required: true,
@@ -141,19 +141,25 @@ function onUpdate(newModels: RawOption[]) {
141
141
 
142
142
  function ensureModelsAreFilled() {
143
143
 
144
- if (!Array.isArray(props.modelValue)) {
144
+ let modelValueInternal = props.modelValue;
145
+
146
+ if (typeof modelValueInternal == 'string' || typeof modelValueInternal == 'number') {
147
+ modelValueInternal = [modelValueInternal + ''];
148
+ }
149
+
150
+ if (!Array.isArray(modelValueInternal)) {
145
151
  models.value = [];
146
152
  return;
147
153
  }
148
154
 
149
- if (props.modelValue.length == 0) {
155
+ if (modelValueInternal.length == 0) {
150
156
  models.value = [];
151
157
  return;
152
158
  }
153
159
 
154
160
  // Remove incorrect models
155
161
 
156
- const ids = props.modelValue.map((id: number | string) => id.toString());
162
+ const ids = modelValueInternal.map((id: number | string) => id.toString());
157
163
 
158
164
  models.value = models.value.filter((m) => ids.includes(m[props.primaryKey] + ''));
159
165