sprintify-ui 0.4.1 → 0.4.2

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.
@@ -18963,6 +18963,10 @@ const w1 = { class: "absolute inset-0 flex h-full w-full items-center justify-ce
18963
18963
  default: "",
18964
18964
  type: String
18965
18965
  },
18966
+ showLoadingMask: {
18967
+ default: !0,
18968
+ type: Boolean
18969
+ },
18966
18970
  showNotificationOnError: {
18967
18971
  default: !0,
18968
18972
  type: Boolean
@@ -19079,7 +19083,7 @@ const w1 = { class: "absolute inset-0 flex h-full w-full items-center justify-ce
19079
19083
  "leave-to-class": "opacity-0"
19080
19084
  }, {
19081
19085
  default: _e(() => [
19082
- T(l) ? Be(O.$slots, "loading", { key: 0 }, () => [
19086
+ T(l) && t.showLoadingMask ? Be(O.$slots, "loading", { key: 0 }, () => [
19083
19087
  $("div", w1, [
19084
19088
  $("div", {
19085
19089
  class: pe(["absolute inset-0 h-full w-full", T(Yn)("bg-white opacity-80", t.twLoadingMask)])
@@ -21448,30 +21452,27 @@ const As = /* @__PURE__ */ Ee({
21448
21452
  type: Boolean
21449
21453
  }
21450
21454
  },
21451
- emits: ["remove", "update", "save:name"],
21455
+ emits: ["remove", "update"],
21452
21456
  setup(t, { emit: r }) {
21453
21457
  const e = t, n = le(800), o = le();
21454
21458
  gr(o, () => {
21455
- var p;
21456
- n.value = ((p = o.value) == null ? void 0 : p.clientWidth) ?? 800;
21459
+ var w;
21460
+ n.value = ((w = o.value) == null ? void 0 : w.clientWidth) ?? 800;
21457
21461
  });
21458
21462
  const a = U(() => n.value <= No.xs), l = U(() => No.sm >= n.value && n.value > No.xs), s = le("show"), u = U(() => e.media.name), c = U(() => e.media.file_name), h = U(() => "url" in e.media ? e.media.url : null), d = le();
21459
21463
  function f() {
21460
21464
  e.disabled || (s.value = "edit", setTimeout(() => {
21461
- var p, g;
21462
- (p = d.value) == null || p.focus(), (g = d.value) == null || g.select();
21465
+ var w, p;
21466
+ (w = d.value) == null || w.focus(), (p = d.value) == null || p.select();
21463
21467
  }, 100));
21464
21468
  }
21465
- function m(p) {
21466
- const g = p.target, b = Nt(e.media);
21467
- b.name = g.value ?? "";
21468
- const v = b.file_name.split(".").pop();
21469
- b.file_name = b.name + "." + v, r("update", b);
21470
- }
21471
- function w() {
21472
- s.value = "show", r("save:name");
21469
+ function m() {
21470
+ const w = d.value, p = Nt(e.media);
21471
+ p.name = (w == null ? void 0 : w.value) ?? "";
21472
+ const g = p.file_name.split(".").pop();
21473
+ p.file_name = p.name + "." + g, s.value = "show", r("update", p);
21473
21474
  }
21474
- return (p, g) => (P(), G("li", {
21475
+ return (w, p) => (P(), G("li", {
21475
21476
  ref_key: "itemRef",
21476
21477
  ref: o,
21477
21478
  class: pe(["group flex h-10 items-center justify-between", [T(a) ? "h-9" : "h-10"]])
@@ -21494,7 +21495,7 @@ const As = /* @__PURE__ */ Ee({
21494
21495
  type: "button",
21495
21496
  disabled: t.disabled,
21496
21497
  class: "flex h-10 items-center overflow-hidden",
21497
- onClick: g[0] || (g[0] = (b) => f())
21498
+ onClick: p[0] || (p[0] = (g) => f())
21498
21499
  }, [
21499
21500
  $("span", {
21500
21501
  class: pe(["mr-2 truncate", [(T(a), "text-sm")]])
@@ -21514,17 +21515,16 @@ const As = /* @__PURE__ */ Ee({
21514
21515
  type: "text",
21515
21516
  value: T(u),
21516
21517
  autofocus: "",
21517
- onInput: m,
21518
21518
  onKeydown: [
21519
- Hi(On(w, ["prevent"]), ["enter"]),
21520
- g[1] || (g[1] = Hi(On((b) => s.value = "show", ["prevent"]), ["escape"]))
21519
+ Hi(On(m, ["prevent"]), ["enter"]),
21520
+ p[1] || (p[1] = Hi(On((g) => s.value = "show", ["prevent"]), ["escape"]))
21521
21521
  ]
21522
21522
  }, null, 42, Qw),
21523
21523
  $("div", Jw, [
21524
21524
  $("button", {
21525
21525
  type: "button",
21526
21526
  class: pe(["h-10 shrink-0 pr-2 pl-3 text-blue-600", [(T(a), "text-sm")]]),
21527
- onClick: w
21527
+ onClick: m
21528
21528
  }, Oe(T($e)("sui.save")), 3)
21529
21529
  ])
21530
21530
  ])),
@@ -21534,7 +21534,7 @@ const As = /* @__PURE__ */ Ee({
21534
21534
  type: "button",
21535
21535
  disabled: t.disabled,
21536
21536
  class: "shrink-0 text-sm disabled:opacity-50",
21537
- onClick: g[2] || (g[2] = (b) => p.$emit("remove"))
21537
+ onClick: p[2] || (p[2] = (g) => w.$emit("remove"))
21538
21538
  }, [
21539
21539
  T(l) || T(a) ? (P(), De(T(Xe), {
21540
21540
  key: 0,
@@ -21578,7 +21578,7 @@ const As = /* @__PURE__ */ Ee({
21578
21578
  type: Boolean
21579
21579
  }
21580
21580
  },
21581
- emits: ["update:modelValue", "remove", "save:name"],
21581
+ emits: ["update:modelValue", "remove"],
21582
21582
  setup(t, { emit: r }) {
21583
21583
  const e = t;
21584
21584
  function n(a, l) {
@@ -21604,9 +21604,8 @@ const As = /* @__PURE__ */ Ee({
21604
21604
  draggable: t.draggable,
21605
21605
  disabled: t.disabled,
21606
21606
  onUpdate: (c) => n(u, c),
21607
- onRemove: (c) => a.$emit("remove", u),
21608
- "onSave:name": (c) => a.$emit("save:name", u, c)
21609
- }, null, 8, ["media", "show-remove", "draggable", "disabled", "onUpdate", "onRemove", "onSave:name"])
21607
+ onRemove: (c) => a.$emit("remove", u)
21608
+ }, null, 8, ["media", "show-remove", "draggable", "disabled", "onUpdate", "onRemove"])
21610
21609
  ])
21611
21610
  ]),
21612
21611
  _: 1
@@ -43,6 +43,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
43
43
  default: string;
44
44
  type: StringConstructor;
45
45
  };
46
+ showLoadingMask: {
47
+ default: boolean;
48
+ type: BooleanConstructor;
49
+ };
46
50
  showNotificationOnError: {
47
51
  default: boolean;
48
52
  type: BooleanConstructor;
@@ -97,6 +101,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
97
101
  default: string;
98
102
  type: StringConstructor;
99
103
  };
104
+ showLoadingMask: {
105
+ default: boolean;
106
+ type: BooleanConstructor;
107
+ };
100
108
  showNotificationOnError: {
101
109
  default: boolean;
102
110
  type: BooleanConstructor;
@@ -115,6 +123,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
115
123
  beforeSubmit: (next: NextFunction) => void;
116
124
  successHandler: (response: any) => void;
117
125
  twLoadingMask: string;
126
+ showLoadingMask: boolean;
118
127
  showNotificationOnError: boolean;
119
128
  showNotificationOnSuccess: boolean;
120
129
  }, {}>, {
@@ -18,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
18
18
  default: boolean;
19
19
  type: BooleanConstructor;
20
20
  };
21
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "remove" | "save:name")[], "update:modelValue" | "remove" | "save:name", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
21
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "remove")[], "update:modelValue" | "remove", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
22
22
  modelValue: {
23
23
  required: true;
24
24
  type: PropType<(UploadedFile | Media)[]>;
@@ -38,7 +38,6 @@ declare const _default: import("vue").DefineComponent<{
38
38
  }>> & {
39
39
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
40
40
  onRemove?: ((...args: any[]) => any) | undefined;
41
- "onSave:name"?: ((...args: any[]) => any) | undefined;
42
41
  }, {
43
42
  draggable: boolean;
44
43
  disabled: boolean;
@@ -18,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
18
18
  default: boolean;
19
19
  type: BooleanConstructor;
20
20
  };
21
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update" | "remove" | "save:name")[], "update" | "remove" | "save:name", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
21
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update" | "remove")[], "update" | "remove", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
22
22
  media: {
23
23
  required: true;
24
24
  type: PropType<UploadedFile | Media>;
@@ -38,7 +38,6 @@ declare const _default: import("vue").DefineComponent<{
38
38
  }>> & {
39
39
  onUpdate?: ((...args: any[]) => any) | undefined;
40
40
  onRemove?: ((...args: any[]) => any) | undefined;
41
- "onSave:name"?: ((...args: any[]) => any) | undefined;
42
41
  }, {
43
42
  draggable: boolean;
44
43
  disabled: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -20,7 +20,7 @@
20
20
  leave-to-class="opacity-0"
21
21
  >
22
22
  <slot
23
- v-if="loading"
23
+ v-if="loading && showLoadingMask"
24
24
  name="loading"
25
25
  >
26
26
  <div
@@ -37,7 +37,7 @@
37
37
  <path
38
38
  fill="currentColor"
39
39
  d="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"
40
- />
40
+ ></path>
41
41
  </svg>
42
42
  </div>
43
43
  </slot>
@@ -106,6 +106,10 @@ const props = defineProps({
106
106
  default: '',
107
107
  type: String,
108
108
  },
109
+ showLoadingMask: {
110
+ default: true,
111
+ type: Boolean,
112
+ },
109
113
  showNotificationOnError: {
110
114
  default: true,
111
115
  type: Boolean,
@@ -16,7 +16,6 @@
16
16
  :disabled="disabled"
17
17
  @update="onItemUpdate(index, $event)"
18
18
  @remove="$emit('remove', index)"
19
- @save:name="$emit('save:name', index, $event)"
20
19
  />
21
20
  </div>
22
21
  </template>
@@ -50,7 +49,7 @@ const props = defineProps({
50
49
  },
51
50
  });
52
51
 
53
- const emit = defineEmits(['update:modelValue', 'remove', 'save:name']);
52
+ const emit = defineEmits(['update:modelValue', 'remove']);
54
53
 
55
54
  function onItemUpdate(index: number, media: Media | UploadedFile) {
56
55
  const modelValue = cloneDeep(props.modelValue);
@@ -59,7 +59,6 @@
59
59
  type="text"
60
60
  :value="name"
61
61
  autofocus
62
- @input="onNameChange"
63
62
  @keydown.enter.prevent="saveName"
64
63
  @keydown.escape.prevent="viewMode = 'show'"
65
64
  >
@@ -132,7 +131,7 @@ import { t } from '@/i18n';
132
131
  import { useResizeObserver } from '@vueuse/core';
133
132
  import breakpoints from '../../config/breakpoints.json';
134
133
 
135
- const emit = defineEmits(['remove', 'update', 'save:name']);
134
+ const emit = defineEmits(['remove', 'update']);
136
135
 
137
136
  const props = defineProps({
138
137
  media: {
@@ -201,17 +200,13 @@ function editName() {
201
200
  }, 100);
202
201
  }
203
202
 
204
- function onNameChange(e: Event) {
205
- const target = e.target as HTMLInputElement;
203
+ function saveName() {
204
+ const target = inputRef.value;
206
205
  const media = cloneDeep(props.media);
207
- media.name = (target.value ?? '') as string;
206
+ media.name = (target?.value ?? '') as string;
208
207
  const ext = media.file_name.split('.').pop();
209
208
  media.file_name = media.name + '.' + ext;
210
- emit('update', media);
211
- }
212
-
213
- function saveName() {
214
209
  viewMode.value = 'show';
215
- emit('save:name');
210
+ emit('update', media);
216
211
  }
217
212
  </script>