pgo-ui 1.1.12 → 1.1.14
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/index.es.js +30 -36
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/App.vue +16 -0
- package/src/components/pgo/CopyTextBox.vue +1 -1
package/dist/index.es.js
CHANGED
|
@@ -4288,70 +4288,64 @@ const pt = (n, e) => {
|
|
|
4288
4288
|
},
|
|
4289
4289
|
emits: ["copy", "copy-success", "copy-error"],
|
|
4290
4290
|
setup(n, { emit: e }) {
|
|
4291
|
-
const t = n, s = e, a = B(!1), r = Re("snackbar", null)
|
|
4292
|
-
en: "eng-font",
|
|
4293
|
-
// or whatever your English font is
|
|
4294
|
-
dv: "faruma"
|
|
4295
|
-
// Dhivehi font
|
|
4296
|
-
// Add more languages as needed
|
|
4297
|
-
}[c] || "";
|
|
4291
|
+
const t = n, s = e, a = B(!1), r = Re("snackbar", null);
|
|
4298
4292
|
I(() => {
|
|
4299
4293
|
const {
|
|
4300
|
-
text:
|
|
4294
|
+
text: d,
|
|
4301
4295
|
// showIcon,
|
|
4302
|
-
showSuccessMessage:
|
|
4303
|
-
successMessage:
|
|
4304
|
-
successDuration:
|
|
4305
|
-
...
|
|
4296
|
+
showSuccessMessage: c,
|
|
4297
|
+
successMessage: u,
|
|
4298
|
+
successDuration: f,
|
|
4299
|
+
...h
|
|
4306
4300
|
} = t;
|
|
4307
|
-
return
|
|
4301
|
+
return h;
|
|
4308
4302
|
});
|
|
4309
|
-
const
|
|
4310
|
-
|
|
4311
|
-
},
|
|
4312
|
-
if (!(t.disabled || !
|
|
4303
|
+
const i = I(() => t.text || t.label || ""), o = (d) => {
|
|
4304
|
+
d && d.stopPropagation && d.stopPropagation(), l();
|
|
4305
|
+
}, l = async () => {
|
|
4306
|
+
if (!(t.disabled || !i.value))
|
|
4313
4307
|
try {
|
|
4314
|
-
if (await navigator.clipboard.writeText(
|
|
4308
|
+
if (await navigator.clipboard.writeText(i.value), a.value = !0, setTimeout(() => {
|
|
4315
4309
|
a.value = !1;
|
|
4316
4310
|
}, t.successDuration), t.showSuccessMessage && r) {
|
|
4317
|
-
const
|
|
4311
|
+
const d = t.successMessage || `Copied: ${i.value}`;
|
|
4318
4312
|
r.show({
|
|
4319
|
-
message:
|
|
4313
|
+
message: d,
|
|
4320
4314
|
variant: "success",
|
|
4321
4315
|
duration: t.successDuration
|
|
4322
4316
|
});
|
|
4323
4317
|
} else
|
|
4324
4318
|
console.log("No snackbar available or showSuccessMessage is false");
|
|
4325
|
-
s("copy",
|
|
4326
|
-
} catch (
|
|
4327
|
-
console.error("Clipboard API failed:",
|
|
4319
|
+
s("copy", i.value), s("copy-success", i.value);
|
|
4320
|
+
} catch (d) {
|
|
4321
|
+
console.error("Clipboard API failed:", d);
|
|
4328
4322
|
try {
|
|
4329
|
-
const
|
|
4330
|
-
|
|
4331
|
-
const
|
|
4332
|
-
if (document.body.removeChild(
|
|
4323
|
+
const c = document.createElement("textarea");
|
|
4324
|
+
c.value = i.value, c.style.position = "fixed", c.style.left = "-999999px", c.style.top = "-999999px", document.body.appendChild(c), c.focus(), c.select();
|
|
4325
|
+
const u = document.execCommand("copy");
|
|
4326
|
+
if (document.body.removeChild(c), u)
|
|
4333
4327
|
a.value = !0, setTimeout(() => {
|
|
4334
4328
|
a.value = !1;
|
|
4335
|
-
}, t.successDuration), s("copy-success",
|
|
4329
|
+
}, t.successDuration), s("copy-success", i.value);
|
|
4336
4330
|
else
|
|
4337
4331
|
throw new Error("execCommand failed");
|
|
4338
|
-
} catch (
|
|
4339
|
-
console.error("Fallback copy also failed:",
|
|
4332
|
+
} catch (c) {
|
|
4333
|
+
console.error("Fallback copy also failed:", c), s("copy-error", c), r && r.show({
|
|
4340
4334
|
message: "Failed to copy text",
|
|
4341
4335
|
variant: "error"
|
|
4342
4336
|
});
|
|
4343
4337
|
}
|
|
4344
4338
|
}
|
|
4345
4339
|
};
|
|
4346
|
-
return (
|
|
4347
|
-
const
|
|
4340
|
+
return (d, c) => {
|
|
4341
|
+
const u = Ui("tooltip");
|
|
4348
4342
|
return Ze((A(), M("div", {
|
|
4349
|
-
class: q(["cursor-pointer hover:text-gray-800 font-normal "
|
|
4350
|
-
onClick:
|
|
4343
|
+
class: q(["cursor-pointer hover:text-gray-800 font-normal font-en"]),
|
|
4344
|
+
onClick: o
|
|
4351
4345
|
}, [
|
|
4352
4346
|
Se(ne(n.text), 1)
|
|
4353
|
-
]
|
|
4354
|
-
[
|
|
4347
|
+
])), [
|
|
4348
|
+
[u, { en: "Copy", dv: "ކޮޕީ" }]
|
|
4355
4349
|
]);
|
|
4356
4350
|
};
|
|
4357
4351
|
}
|