sprintify-ui 0.10.17 → 0.10.19

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.
@@ -16784,11 +16784,11 @@ const Tr = /* @__PURE__ */ ne({
16784
16784
  __name: "BaseDraggable",
16785
16785
  props: {
16786
16786
  modelValue: {},
16787
- itemKey: {},
16788
- handle: {},
16789
- disabled: { type: Boolean }
16787
+ itemKey: { default: "id" },
16788
+ handle: { default: ".handle" },
16789
+ disabled: { type: Boolean, default: !1 }
16790
16790
  },
16791
- emits: ["update:modelValue"],
16791
+ emits: ["update:modelValue", "change", "end"],
16792
16792
  setup(t, { emit: n }) {
16793
16793
  const e = t, o = n, r = F(null);
16794
16794
  function a(u) {
@@ -16799,8 +16799,11 @@ const Tr = /* @__PURE__ */ ne({
16799
16799
  r.value && (l = Xe.create(r.value, {
16800
16800
  handle: e.handle,
16801
16801
  disabled: e.disabled,
16802
+ onChange: (u) => {
16803
+ o("change", u);
16804
+ },
16802
16805
  onEnd: (u) => {
16803
- if (u.oldIndex === void 0 || u.newIndex === void 0)
16806
+ if (o("end", u), u.oldIndex === void 0 || u.newIndex === void 0)
16804
16807
  return;
16805
16808
  const c = e.modelValue, p = s(
16806
16809
  c,
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  modelValue: any[];
3
3
  itemKey: string;
4
- handle: string;
4
+ handle?: string;
5
5
  disabled?: boolean;
6
6
  };
7
7
  declare const elementsRef: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
@@ -19,15 +19,31 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
19
19
  elementsRef: typeof elementsRef;
20
20
  getKey: typeof getKey;
21
21
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
22
+ end: (...args: any[]) => void;
23
+ change: (...args: any[]) => void;
22
24
  "update:modelValue": (...args: any[]) => void;
23
25
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
26
+ onEnd?: ((...args: any[]) => any) | undefined;
27
+ onChange?: ((...args: any[]) => any) | undefined;
24
28
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
25
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
+ }>, {
30
+ disabled: boolean;
31
+ itemKey: string;
32
+ handle: string;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
34
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
35
+ end: (...args: any[]) => void;
36
+ change: (...args: any[]) => void;
27
37
  "update:modelValue": (...args: any[]) => void;
28
38
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
39
+ onEnd?: ((...args: any[]) => any) | undefined;
40
+ onChange?: ((...args: any[]) => any) | undefined;
29
41
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
30
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
+ }>, {
43
+ disabled: boolean;
44
+ itemKey: string;
45
+ handle: string;
46
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
47
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
32
48
  export default _default;
33
49
  type __VLS_WithSlots<T, S> = T & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.10.17",
3
+ "version": "0.10.19",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && vue-tsc && vite build",
@@ -14,14 +14,18 @@
14
14
  import { uniqueId } from 'lodash';
15
15
  import Sortable from 'sortablejs';
16
16
 
17
- const props = defineProps<{
17
+ const props = withDefaults(defineProps<{
18
18
  modelValue: any[];
19
19
  itemKey: string;
20
- handle: string;
20
+ handle?: string;
21
21
  disabled?: boolean;
22
- }>();
22
+ }>(), {
23
+ itemKey: 'id',
24
+ handle: '.handle',
25
+ disabled: false,
26
+ });
23
27
 
24
- const emit = defineEmits(['update:modelValue']);
28
+ const emit = defineEmits(['update:modelValue', 'change', 'end']);
25
29
 
26
30
  const elementsRef = ref<HTMLElement | null>(null);
27
31
 
@@ -39,8 +43,13 @@ onMounted(() => {
39
43
  sortable = Sortable.create(elementsRef.value, {
40
44
  handle: props.handle,
41
45
  disabled: props.disabled,
46
+ onChange: (event) => {
47
+ emit('change', event);
48
+ },
42
49
  onEnd: (event) => {
43
50
 
51
+ emit('end', event);
52
+
44
53
  if (event.oldIndex === undefined || event.newIndex === undefined) {
45
54
  return;
46
55
  }