@oneb/ui-vue 0.3.31 → 0.4.0
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/ChevronLeftIcon-7505e081.cjs +1 -0
- package/dist/ChevronLeftIcon-bb9adb5b.js +20 -0
- package/dist/ChevronRightIcon-2992cf0d.cjs +1 -0
- package/dist/ChevronRightIcon-b0585768.js +20 -0
- package/dist/ChevronUpIcon-64a673e1.cjs +1 -0
- package/dist/{ChevronRightIcon-4549a26b.js → ChevronUpIcon-c43f27a9.js} +2 -19
- package/dist/InformationCircleIcon-2f6097a0.js +20 -0
- package/dist/InformationCircleIcon-d6b67d5d.cjs +1 -0
- package/dist/MagnifyingGlassIcon-adf871ba.cjs +1 -0
- package/dist/MagnifyingGlassIcon-ca213d3d.js +20 -0
- package/dist/{NoSymbolIcon-e58a9aee.js → NoSymbolIcon-b3470a26.js} +8 -25
- package/dist/{NoSymbolIcon-5d326416.cjs → NoSymbolIcon-e84375bb.cjs} +1 -1
- package/dist/OneDropdownAuto.vue_vue_type_script_setup_true_lang-2c508e8a.js +79 -0
- package/dist/OneDropdownAuto.vue_vue_type_script_setup_true_lang-bf923b04.cjs +1 -0
- package/dist/OneFormInput.vue_vue_type_script_setup_true_lang-b89117e7.js +521 -0
- package/dist/OneFormInput.vue_vue_type_script_setup_true_lang-f6f7cd96.cjs +1 -0
- package/dist/OneHelpMenu-6ec63535.cjs +1 -0
- package/dist/{OneHelpMenu-73817f8a.js → OneHelpMenu-d5182c78.js} +118 -213
- package/dist/OneMarkdown.vue_vue_type_script_setup_true_lang-05266fc3.cjs +1 -0
- package/dist/OneMarkdown.vue_vue_type_script_setup_true_lang-bb2219c7.js +18 -0
- package/dist/OneModal-02a9a173.js +189 -0
- package/dist/OneModal-0e92c039.cjs +1 -0
- package/dist/OneTooltip.vue_vue_type_script_setup_true_lang-c492c128.js +25 -0
- package/dist/OneTooltip.vue_vue_type_script_setup_true_lang-e83a81ea.cjs +1 -0
- package/dist/SpinnerIcon-01be39fe.cjs +1 -0
- package/dist/{SpinnerIcon-74648c98.js → SpinnerIcon-516264ba.js} +5 -6
- package/dist/button/index.cjs +1 -1
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +3 -4
- package/dist/checkbox/checkbox.d.ts +5 -0
- package/dist/checkbox/index.cjs +1 -1
- package/dist/checkbox/index.js +40 -34
- package/dist/chips/OneChips.vue.d.ts +2 -0
- package/dist/chips/chips.d.ts +25 -0
- package/dist/chips/index.cjs +1 -0
- package/dist/chips/index.d.ts +3 -0
- package/dist/chips/index.js +62 -0
- package/dist/clipboard-494e1513.cjs +1 -0
- package/dist/clipboard-733b79a1.js +22 -0
- package/dist/common/OneDetailsList.vue.d.ts +2 -0
- package/dist/common/OneDetailsRow.vue.d.ts +2 -0
- package/dist/common/index.cjs +1 -1
- package/dist/common/index.d.ts +2 -0
- package/dist/common/index.js +68 -16
- package/dist/composables/index.cjs +1 -0
- package/dist/composables/index.d.ts +18 -0
- package/dist/composables/index.js +91 -0
- package/dist/composables/useAsyncMethod.d.ts +17 -0
- package/dist/composables/useAsyncSelect.d.ts +26 -0
- package/dist/composables/useConfirm.d.ts +27 -0
- package/dist/composables/useCursorList.d.ts +42 -0
- package/dist/composables/useDebouncedRef.d.ts +6 -0
- package/dist/composables/useFileUpload.d.ts +21 -0
- package/dist/composables/useFormSubmit.d.ts +23 -0
- package/dist/composables/useIsMobile.d.ts +8 -0
- package/dist/confirm/OneConfirmHost.vue.d.ts +2 -0
- package/dist/confirm/confirm.d.ts +10 -0
- package/dist/confirm/index.cjs +1 -0
- package/dist/confirm/index.d.ts +5 -0
- package/dist/confirm/index.js +59 -0
- package/dist/cursorList/OneCursorList.vue.d.ts +2 -0
- package/dist/cursorList/index.cjs +1 -0
- package/dist/cursorList/index.d.ts +3 -0
- package/dist/cursorList/index.js +78 -0
- package/dist/dataTable/index.cjs +1 -1
- package/dist/dataTable/index.js +256 -301
- package/dist/dateTime/OneDateTime.vue.d.ts +2 -0
- package/dist/dateTime/dateTime.d.ts +43 -0
- package/dist/dateTime/index.cjs +1 -0
- package/dist/dateTime/index.d.ts +3 -0
- package/dist/dateTime/index.js +66 -0
- package/dist/dropdown/index.cjs +1 -1
- package/dist/dropdown/index.js +302 -376
- package/dist/dropdown-5cb64ab7.cjs +1 -0
- package/dist/dropdown-c81fb945.js +101 -0
- package/dist/entityPicker/index.cjs +1 -1
- package/dist/entityPicker/index.js +57 -57
- package/dist/entityPicker/useEntityModal.d.ts +7 -3
- package/dist/errorsPage/OneCrashScreen.vue.d.ts +2 -0
- package/dist/errorsPage/OneErrorHero.vue.d.ts +2 -0
- package/dist/errorsPage/OneNotFoundPage.vue.d.ts +2 -0
- package/dist/errorsPage/OneServerErrorPage.vue.d.ts +2 -0
- package/dist/errorsPage/OneSnakeGame.vue.d.ts +2 -0
- package/dist/errorsPage/createAppErrorHandler.d.ts +24 -0
- package/dist/errorsPage/errorsType.d.ts +5 -0
- package/dist/errorsPage/index.cjs +1 -1
- package/dist/errorsPage/index.d.ts +8 -0
- package/dist/errorsPage/index.js +557 -28
- package/dist/errorsPage/useCrashState.d.ts +10 -0
- package/dist/fileUpload/OneDropzone.vue.d.ts +2 -0
- package/dist/fileUpload/OneFileUpload.vue.d.ts +2 -0
- package/dist/fileUpload/fileUpload.d.ts +17 -0
- package/dist/fileUpload/index.cjs +1 -0
- package/dist/fileUpload/index.d.ts +6 -0
- package/dist/fileUpload/index.js +228 -0
- package/dist/filterBuilder/OneFilterBuilder.vue.d.ts +2 -0
- package/dist/filterBuilder/OneFilterGroup.vue.d.ts +2 -0
- package/dist/filterBuilder/OneFilterRule.vue.d.ts +2 -0
- package/dist/filterBuilder/filterBuilder.d.ts +17 -0
- package/dist/filterBuilder/index.cjs +1 -0
- package/dist/filterBuilder/index.d.ts +5 -0
- package/dist/filterBuilder/index.js +257 -0
- package/dist/form/form.d.ts +1 -1
- package/dist/form/index.cjs +1 -1
- package/dist/form/index.js +66 -574
- package/dist/i18n/index.cjs +1 -1
- package/dist/i18n/index.js +99 -15
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +243 -104
- package/dist/indicators/OneStatCard.vue.d.ts +2 -0
- package/dist/indicators/index.cjs +1 -1
- package/dist/indicators/index.d.ts +1 -0
- package/dist/indicators/index.js +66 -29
- package/dist/infobox/index.cjs +1 -1
- package/dist/infobox/index.js +4 -3
- package/dist/label/index.cjs +1 -1
- package/dist/label/index.js +5 -5
- package/dist/layout/OneAuthLayout.vue.d.ts +2 -0
- package/dist/layout/OneBackButton.vue.d.ts +2 -0
- package/dist/layout/OneBreadcrumbs.vue.d.ts +2 -0
- package/dist/layout/OneEmptyLayout.vue.d.ts +6 -0
- package/dist/layout/OneGridLayout.vue.d.ts +2 -0
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.d.ts +6 -1
- package/dist/layout/index.js +1057 -765
- package/dist/layout/layout.d.ts +11 -0
- package/dist/modal/OneModalHost.vue.d.ts +2 -0
- package/dist/modal/index.cjs +1 -1
- package/dist/modal/index.d.ts +3 -0
- package/dist/modal/index.js +84 -27
- package/dist/modal/modal.d.ts +9 -0
- package/dist/modal/useModalStack.d.ts +20 -0
- package/dist/notifications/OneNotificationItem.vue.d.ts +2 -0
- package/dist/notifications/OneNotificationsBell.vue.d.ts +2 -0
- package/dist/notifications/OneNotificationsPanel.vue.d.ts +2 -0
- package/dist/notifications/index.cjs +1 -0
- package/dist/notifications/index.d.ts +7 -0
- package/dist/notifications/index.js +477 -0
- package/dist/notifications/notifications.d.ts +53 -0
- package/dist/notifications/useNotifyfeed.d.ts +32 -0
- package/dist/periodPicker/index.cjs +1 -1
- package/dist/periodPicker/index.js +126 -139
- package/dist/popover/OnePopover.vue.d.ts +2 -0
- package/dist/popover/index.cjs +1 -0
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/index.js +102 -0
- package/dist/popover/popover.d.ts +31 -0
- package/dist/progress/OneProgress.vue.d.ts +2 -0
- package/dist/progress/index.cjs +1 -0
- package/dist/progress/index.d.ts +3 -0
- package/dist/progress/index.js +74 -0
- package/dist/progress/progress.d.ts +32 -0
- package/dist/searchInput/OneSearchInput.vue.d.ts +2 -0
- package/dist/searchInput/index.cjs +1 -0
- package/dist/searchInput/index.d.ts +3 -0
- package/dist/searchInput/index.js +103 -0
- package/dist/searchInput/searchInput.d.ts +39 -0
- package/dist/settings/OneSettingsLayout.vue.d.ts +2 -0
- package/dist/settings/OneSettingsRow.vue.d.ts +2 -0
- package/dist/settings/OneSettingsSection.vue.d.ts +2 -0
- package/dist/settings/index.cjs +1 -0
- package/dist/settings/index.d.ts +4 -0
- package/dist/settings/index.js +116 -0
- package/dist/spinner/OneSpinner.vue.d.ts +2 -0
- package/dist/spinner/index.cjs +1 -0
- package/dist/spinner/index.d.ts +3 -0
- package/dist/spinner/index.js +30 -0
- package/dist/spinner/spinner.d.ts +10 -0
- package/dist/stageBadge/OneStageBadge.vue.d.ts +2 -0
- package/dist/stageBadge/index.cjs +1 -0
- package/dist/stageBadge/index.d.ts +3 -0
- package/dist/stageBadge/index.js +126 -0
- package/dist/stageBadge/stageBadge.d.ts +64 -0
- package/dist/stepper/OneStepper.vue.d.ts +2 -0
- package/dist/stepper/index.cjs +1 -0
- package/dist/stepper/index.d.ts +3 -0
- package/dist/stepper/index.js +53 -0
- package/dist/stepper/stepper.d.ts +24 -0
- package/dist/style.css +1 -1
- package/dist/switch/index.cjs +1 -1
- package/dist/switch/index.js +3 -4
- package/dist/tabs/OneTab.vue.d.ts +2 -0
- package/dist/tabs/OneTabs.vue.d.ts +2 -0
- package/dist/tabs/index.cjs +1 -0
- package/dist/tabs/index.d.ts +4 -0
- package/dist/tabs/index.js +64 -0
- package/dist/tabs/tabs.d.ts +7 -0
- package/dist/toast/OneMascotToast.vue.d.ts +2 -0
- package/dist/toast/RabbitIcon.vue.d.ts +2 -0
- package/dist/toast/index.cjs +1 -1
- package/dist/toast/index.d.ts +4 -0
- package/dist/toast/index.js +139 -73
- package/dist/toast/useMascotToast.d.ts +12 -0
- package/dist/tooltip/OneTooltip.vue.d.ts +2 -0
- package/dist/tooltip/index.cjs +2 -2
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +33 -30
- package/dist/useConfirm-6344b49d.cjs +1 -0
- package/dist/useConfirm-74e99a5c.js +23 -0
- package/dist/useCursorList-5c1b57aa.js +62 -0
- package/dist/useCursorList-e1cb41e7.cjs +1 -0
- package/dist/useElementWidth-b36a7ce9.js +40 -0
- package/dist/useElementWidth-b3e53f48.cjs +1 -0
- package/dist/useFileUpload-228dbc07.js +24 -0
- package/dist/useFileUpload-f47622bb.cjs +1 -0
- package/dist/useIsMobile-7b1f08cf.cjs +1 -0
- package/dist/useIsMobile-98fc0cf9.js +7 -0
- package/dist/useMediaQuery-1d87df02.cjs +1 -0
- package/dist/useMediaQuery-77a19b18.js +37 -0
- package/dist/useModal-6a5d870b.js +30 -0
- package/dist/useModal-aa6f4a57.cjs +1 -0
- package/dist/userList/OneUserInviteModal.vue.d.ts +2 -0
- package/dist/userList/OneUserList.vue.d.ts +2 -0
- package/dist/userList/OneUserListItem.vue.d.ts +2 -0
- package/dist/userList/index.cjs +1 -0
- package/dist/userList/index.d.ts +4 -0
- package/dist/userList/index.js +559 -0
- package/dist/utils/clipboard.d.ts +6 -0
- package/dist/utils/format.d.ts +17 -0
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +125 -0
- package/dist/utils/string.d.ts +25 -0
- package/dist/utils/versionChecker.d.ts +26 -0
- package/package.json +221 -23
- package/dist/ChevronRightIcon-7a2f0c20.cjs +0 -1
- package/dist/OneHelpMenu-c6e88d8f.cjs +0 -1
- package/dist/OneMarkdown.vue_vue_type_style_index_0_lang-0ea8fbf8.cjs +0 -1
- package/dist/OneMarkdown.vue_vue_type_style_index_0_lang-4ed993c7.js +0 -1
- package/dist/SpinnerIcon-ccb6f3fc.cjs +0 -1
- package/dist/SpinnerIcon.vue_vue_type_style_index_0_lang-0ea8fbf8.cjs +0 -1
- package/dist/SpinnerIcon.vue_vue_type_style_index_0_lang-4ed993c7.js +0 -1
- package/dist/useModal-0c73777f.cjs +0 -1
- package/dist/useModal-7fe9444b.js +0 -194
package/dist/common/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../SpinnerIcon-01be39fe.cjs"),u=require("../OneAvatar.vue_vue_type_script_setup_true_lang-2d9f44f1.cjs"),d=require("../OneMarkdown.vue_vue_type_script_setup_true_lang-05266fc3.cjs"),e=require("vue"),p=require("../ChevronRightIcon-2992cf0d.cjs");require("../_plugin-vue_export-helper-f246444f.cjs");require("vue-markdown-render");const m={key:0,class:"text-xs font-semibold uppercase text-secondary-base pb-1"},_=e.defineComponent({__name:"OneDetailsList",props:{title:{type:String,default:""}},setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("div",null,[t.title?(e.openBlock(),e.createElementBlock("div",m,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.renderSlot(o.$slots,"default")])]))}}),k={class:"text-secondary-content shrink-0"},v=e.defineComponent({__name:"OneDetailsRow",props:{label:{type:String,required:!0},to:{type:[Object,String],default:void 0}},emits:["click"],setup(t,{emit:o}){const l=t,a=o,s=e.getCurrentInstance(),n=e.computed(()=>{var r;return l.to!=null||typeof((r=s==null?void 0:s.vnode.props)==null?void 0:r.onClick)=="function"}),i=()=>{n.value&&a("click")};return(r,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.to?"router-link":"div"),{to:t.to,class:e.normalizeClass(["flex items-center justify-between gap-4 py-3 border-b border-secondary-stroke last:border-b-0 text-sm",n.value?"cursor-pointer":""]),"data-test":n.value?"details-row-link":void 0,onClick:i},{default:e.withCtx(()=>[e.createElementVNode("span",k,e.toDisplayString(t.label),1),e.createElementVNode("span",{class:e.normalizeClass(["flex items-center justify-end gap-1 min-w-0 text-right",n.value?"text-primary-base":""])},[e.renderSlot(r.$slots,"default"),n.value?(e.openBlock(),e.createBlock(e.unref(p.render),{key:0,class:"w-4 h-4 shrink-0"})):e.createCommentVNode("",!0)],2)]),_:3},8,["to","class","data-test"]))}});exports.OneSpinnerIcon=c.SpinnerIcon;exports.OneAvatar=u._sfc_main;exports.OneMarkdown=d._sfc_main;exports.OneDetailsList=_;exports.OneDetailsRow=v;
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as OneAvatar } from './OneAvatar.vue';
|
|
2
2
|
export { default as OneMarkdown } from './OneMarkdown.vue';
|
|
3
3
|
export { default as OneSpinnerIcon } from './SpinnerIcon.vue';
|
|
4
|
+
export { default as OneDetailsList } from './OneDetailsList.vue';
|
|
5
|
+
export { default as OneDetailsRow } from './OneDetailsRow.vue';
|
|
4
6
|
export type { AvatarProps } from './avatar';
|
package/dist/common/index.js
CHANGED
|
@@ -1,25 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
import "../SpinnerIcon.vue_vue_type_style_index_0_lang-4ed993c7.js";
|
|
1
|
+
import { S as N } from "../SpinnerIcon-516264ba.js";
|
|
2
|
+
import { _ as V } from "../OneAvatar.vue_vue_type_script_setup_true_lang-08ab80dd.js";
|
|
3
|
+
import { _ as z } from "../OneMarkdown.vue_vue_type_script_setup_true_lang-bb2219c7.js";
|
|
4
|
+
import { defineComponent as u, openBlock as o, createElementBlock as i, toDisplayString as m, createCommentVNode as p, createElementVNode as a, renderSlot as f, getCurrentInstance as b, computed as v, createBlock as c, resolveDynamicComponent as x, normalizeClass as d, withCtx as h, unref as _ } from "vue";
|
|
5
|
+
import { r as g } from "../ChevronRightIcon-b0585768.js";
|
|
7
6
|
import "../_plugin-vue_export-helper-dad06003.js";
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import "vue-markdown-render";
|
|
8
|
+
const w = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "text-xs font-semibold uppercase text-secondary-base pb-1"
|
|
11
|
+
}, B = /* @__PURE__ */ u({
|
|
12
|
+
__name: "OneDetailsList",
|
|
10
13
|
props: {
|
|
11
|
-
|
|
14
|
+
title: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
}
|
|
12
18
|
},
|
|
13
19
|
setup(e) {
|
|
14
|
-
return (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
return (r, l) => (o(), i("div", null, [
|
|
21
|
+
e.title ? (o(), i("div", w, m(e.title), 1)) : p("", !0),
|
|
22
|
+
a("div", null, [
|
|
23
|
+
f(r.$slots, "default")
|
|
24
|
+
])
|
|
18
25
|
]));
|
|
19
26
|
}
|
|
27
|
+
}), C = { class: "text-secondary-content shrink-0" }, E = /* @__PURE__ */ u({
|
|
28
|
+
__name: "OneDetailsRow",
|
|
29
|
+
props: {
|
|
30
|
+
label: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: !0
|
|
33
|
+
},
|
|
34
|
+
to: {
|
|
35
|
+
type: [Object, String],
|
|
36
|
+
default: void 0
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
emits: ["click"],
|
|
40
|
+
setup(e, { emit: r }) {
|
|
41
|
+
const l = e, k = r, s = b(), t = v(
|
|
42
|
+
() => {
|
|
43
|
+
var n;
|
|
44
|
+
return l.to != null || typeof ((n = s == null ? void 0 : s.vnode.props) == null ? void 0 : n.onClick) == "function";
|
|
45
|
+
}
|
|
46
|
+
), y = () => {
|
|
47
|
+
t.value && k("click");
|
|
48
|
+
};
|
|
49
|
+
return (n, O) => (o(), c(x(e.to ? "router-link" : "div"), {
|
|
50
|
+
to: e.to,
|
|
51
|
+
class: d(["flex items-center justify-between gap-4 py-3 border-b border-secondary-stroke last:border-b-0 text-sm", t.value ? "cursor-pointer" : ""]),
|
|
52
|
+
"data-test": t.value ? "details-row-link" : void 0,
|
|
53
|
+
onClick: y
|
|
54
|
+
}, {
|
|
55
|
+
default: h(() => [
|
|
56
|
+
a("span", C, m(e.label), 1),
|
|
57
|
+
a("span", {
|
|
58
|
+
class: d(["flex items-center justify-end gap-1 min-w-0 text-right", t.value ? "text-primary-base" : ""])
|
|
59
|
+
}, [
|
|
60
|
+
f(n.$slots, "default"),
|
|
61
|
+
t.value ? (o(), c(_(g), {
|
|
62
|
+
key: 0,
|
|
63
|
+
class: "w-4 h-4 shrink-0"
|
|
64
|
+
})) : p("", !0)
|
|
65
|
+
], 2)
|
|
66
|
+
]),
|
|
67
|
+
_: 3
|
|
68
|
+
}, 8, ["to", "class", "data-test"]));
|
|
69
|
+
}
|
|
20
70
|
});
|
|
21
71
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
72
|
+
V as OneAvatar,
|
|
73
|
+
B as OneDetailsList,
|
|
74
|
+
E as OneDetailsRow,
|
|
75
|
+
z as OneMarkdown,
|
|
76
|
+
N as OneSpinnerIcon
|
|
25
77
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../useElementWidth-b3e53f48.cjs"),v=require("../useMediaQuery-1d87df02.cjs"),r=require("vue"),h=require("../useConfirm-6344b49d.cjs"),g=require("../useIsMobile-7b1f08cf.cjs"),L=require("../useFileUpload-f47622bb.cjs"),S=require("../useCursorList-e1cb41e7.cjs"),M=(a,t=500,n=!1)=>{const s=r.ref(a);let u;return r.customRef((l,e)=>({get(){return l(),s.value},set(i){const o=()=>{s.value=i,e()};if(n&&u===void 0&&o(),clearTimeout(u),i===""||i==null){o();return}u=setTimeout(o,t)}}))};function q(a,t={}){const n=r.ref(!1),s=r.ref(null),u=r.ref(void 0);return{isLoading:n,error:s,data:u,invoke:(...e)=>(n.value=!0,a(...e).then(i=>(u.value=i,s.value=null,i)).catch(i=>{var o;throw s.value=i,u.value=void 0,(o=t.onError)==null||o.call(t,i),i}).finally(()=>{n.value=!1}))}}function C(a,t={}){const n=r.reactive({isLoading:!1,error:null,validation:{}}),s=(...l)=>n.isLoading?Promise.reject(new Error("Submit is pending")):(n.isLoading=!0,n.error=null,n.validation={},a(...l).then(e=>{var i;return(i=t.onSuccess)==null||i.call(t,e),e}).catch(e=>{var i;throw n.error=e,(e==null?void 0:e.cause)==="validation"?n.validation=e.data||{}:(e==null?void 0:e.name)==="ValidationError"&&e.errors instanceof Object?n.validation=e.errors:(i=t.onError)==null||i.call(t,e),e}).finally(()=>{n.isLoading=!1})),u=r.toRefs(n);return{isLoading:u.isLoading,error:u.error,validation:u.validation,isInvalid:r.computed(()=>Object.keys(n.validation).length>0),send:s}}function E(a,t={}){const n=r.ref([]),s=r.ref(!1);let u=0,l,e="";const i=c=>{const d=++u;s.value=!0,a({search:c}).then(f=>{d===u&&(n.value=f)}).catch(f=>{var m;d===u&&((m=t.onError)==null||m.call(t,f))}).finally(()=>{d===u&&(s.value=!1)})},o=c=>{e=c,clearTimeout(l),l=setTimeout(()=>i(c),t.debounceMs??333)},y=()=>i(e);return t.immediate!==!1&&i(""),{items:n,isLoading:s,onSearch:o,reload:y}}exports.useElementWidth=b.useElementWidth;exports.useResizeObserver=b.useResizeObserver;exports.breakpointValues=v.breakpointValues;exports.useBreakpoint=v.useBreakpoint;exports.useMediaQuery=v.useMediaQuery;exports.useConfirm=h.useConfirm;exports.useConfirmState=h.useConfirmState;exports.useIsMobile=g.useIsMobile;exports.useFileUpload=L.useFileUpload;exports.useCursorList=S.useCursorList;exports.useAsyncMethod=q;exports.useAsyncSelect=E;exports.useDebouncedRef=M;exports.useFormSubmit=C;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { useElementWidth } from './useElementWidth';
|
|
2
|
+
export { useMediaQuery, useBreakpoint, breakpointValues } from './useMediaQuery';
|
|
3
|
+
export type { Breakpoint } from './useMediaQuery';
|
|
4
|
+
export { useResizeObserver } from './useResizeObserver';
|
|
5
|
+
export { useDebouncedRef } from './useDebouncedRef';
|
|
6
|
+
export { useAsyncMethod } from './useAsyncMethod';
|
|
7
|
+
export type { UseAsyncMethodOptions, UseAsyncMethodReturn } from './useAsyncMethod';
|
|
8
|
+
export { useFormSubmit } from './useFormSubmit';
|
|
9
|
+
export type { UseFormSubmitOptions, UseFormSubmitReturn, ValidationBag } from './useFormSubmit';
|
|
10
|
+
export { useConfirm, useConfirmState } from './useConfirm';
|
|
11
|
+
export type { ConfirmOptions } from './useConfirm';
|
|
12
|
+
export { useIsMobile } from './useIsMobile';
|
|
13
|
+
export { useFileUpload } from './useFileUpload';
|
|
14
|
+
export type { UseFileUploadOptions, UseFileUploadReturn } from './useFileUpload';
|
|
15
|
+
export { useAsyncSelect } from './useAsyncSelect';
|
|
16
|
+
export type { UseAsyncSelectOptions, UseAsyncSelectReturn } from './useAsyncSelect';
|
|
17
|
+
export { useCursorList } from './useCursorList';
|
|
18
|
+
export type { CursorPage, CursorListQuery, UseCursorListOptions, UseCursorListReturn } from './useCursorList';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { u as R, a as j } from "../useElementWidth-b36a7ce9.js";
|
|
2
|
+
import { b as C, a as I, u as O } from "../useMediaQuery-77a19b18.js";
|
|
3
|
+
import { ref as l, customRef as h, reactive as g, toRefs as b, computed as L } from "vue";
|
|
4
|
+
import { u as F, a as V } from "../useConfirm-74e99a5c.js";
|
|
5
|
+
import { u as z } from "../useIsMobile-98fc0cf9.js";
|
|
6
|
+
import { u as D } from "../useFileUpload-228dbc07.js";
|
|
7
|
+
import { u as Q } from "../useCursorList-5c1b57aa.js";
|
|
8
|
+
const x = (u, i = 500, a = !1) => {
|
|
9
|
+
const o = l(u);
|
|
10
|
+
let t;
|
|
11
|
+
return h((s, e) => ({
|
|
12
|
+
get() {
|
|
13
|
+
return s(), o.value;
|
|
14
|
+
},
|
|
15
|
+
set(n) {
|
|
16
|
+
const r = () => {
|
|
17
|
+
o.value = n, e();
|
|
18
|
+
};
|
|
19
|
+
if (a && t === void 0 && r(), clearTimeout(t), n === "" || n == null) {
|
|
20
|
+
r();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
t = setTimeout(r, i);
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
function E(u, i = {}) {
|
|
28
|
+
const a = l(!1), o = l(null), t = l(void 0);
|
|
29
|
+
return { isLoading: a, error: o, data: t, invoke: (...e) => (a.value = !0, u(...e).then((n) => (t.value = n, o.value = null, n)).catch((n) => {
|
|
30
|
+
var r;
|
|
31
|
+
throw o.value = n, t.value = void 0, (r = i.onError) == null || r.call(i, n), n;
|
|
32
|
+
}).finally(() => {
|
|
33
|
+
a.value = !1;
|
|
34
|
+
})) };
|
|
35
|
+
}
|
|
36
|
+
function S(u, i = {}) {
|
|
37
|
+
const a = g({
|
|
38
|
+
isLoading: !1,
|
|
39
|
+
error: null,
|
|
40
|
+
validation: {}
|
|
41
|
+
}), o = (...s) => a.isLoading ? Promise.reject(new Error("Submit is pending")) : (a.isLoading = !0, a.error = null, a.validation = {}, u(...s).then((e) => {
|
|
42
|
+
var n;
|
|
43
|
+
return (n = i.onSuccess) == null || n.call(i, e), e;
|
|
44
|
+
}).catch((e) => {
|
|
45
|
+
var n;
|
|
46
|
+
throw a.error = e, (e == null ? void 0 : e.cause) === "validation" ? a.validation = e.data || {} : (e == null ? void 0 : e.name) === "ValidationError" && e.errors instanceof Object ? a.validation = e.errors : (n = i.onError) == null || n.call(i, e), e;
|
|
47
|
+
}).finally(() => {
|
|
48
|
+
a.isLoading = !1;
|
|
49
|
+
})), t = b(a);
|
|
50
|
+
return {
|
|
51
|
+
isLoading: t.isLoading,
|
|
52
|
+
error: t.error,
|
|
53
|
+
validation: t.validation,
|
|
54
|
+
isInvalid: L(() => Object.keys(a.validation).length > 0),
|
|
55
|
+
send: o
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function k(u, i = {}) {
|
|
59
|
+
const a = l([]), o = l(!1);
|
|
60
|
+
let t = 0, s, e = "";
|
|
61
|
+
const n = (c) => {
|
|
62
|
+
const f = ++t;
|
|
63
|
+
o.value = !0, u({ search: c }).then((d) => {
|
|
64
|
+
f === t && (a.value = d);
|
|
65
|
+
}).catch((d) => {
|
|
66
|
+
var m;
|
|
67
|
+
f === t && ((m = i.onError) == null || m.call(i, d));
|
|
68
|
+
}).finally(() => {
|
|
69
|
+
f === t && (o.value = !1);
|
|
70
|
+
});
|
|
71
|
+
}, r = (c) => {
|
|
72
|
+
e = c, clearTimeout(s), s = setTimeout(() => n(c), i.debounceMs ?? 333);
|
|
73
|
+
}, v = () => n(e);
|
|
74
|
+
return i.immediate !== !1 && n(""), { items: a, isLoading: o, onSearch: r, reload: v };
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
C as breakpointValues,
|
|
78
|
+
E as useAsyncMethod,
|
|
79
|
+
k as useAsyncSelect,
|
|
80
|
+
I as useBreakpoint,
|
|
81
|
+
F as useConfirm,
|
|
82
|
+
V as useConfirmState,
|
|
83
|
+
Q as useCursorList,
|
|
84
|
+
x as useDebouncedRef,
|
|
85
|
+
R as useElementWidth,
|
|
86
|
+
D as useFileUpload,
|
|
87
|
+
S as useFormSubmit,
|
|
88
|
+
z as useIsMobile,
|
|
89
|
+
O as useMediaQuery,
|
|
90
|
+
j as useResizeObserver
|
|
91
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export interface UseAsyncMethodOptions {
|
|
3
|
+
/** Called on failure — plug the app's notify/toast here. The error is rethrown regardless. */
|
|
4
|
+
onError?: (error: unknown) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface UseAsyncMethodReturn<T, A extends unknown[]> {
|
|
7
|
+
isLoading: Ref<boolean>;
|
|
8
|
+
error: Ref<unknown>;
|
|
9
|
+
data: Ref<T | undefined>;
|
|
10
|
+
invoke: (...args: A) => Promise<T>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Wraps an async function with loading/error/data state.
|
|
14
|
+
* Ported from the vizor/finance/invoice/warehouse useAsyncMethod family,
|
|
15
|
+
* decoupled from the app-specific notify layer via opts.onError.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useAsyncMethod<T, A extends unknown[]>(handler: (...args: A) => Promise<T>, opts?: UseAsyncMethodOptions): UseAsyncMethodReturn<T, A>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export interface UseAsyncSelectOptions {
|
|
3
|
+
/** Debounce for search reloads, ms (default 333). */
|
|
4
|
+
debounceMs?: number;
|
|
5
|
+
/** Load once immediately with an empty search (default true). */
|
|
6
|
+
immediate?: boolean;
|
|
7
|
+
onError?: (error: unknown) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface UseAsyncSelectReturn<T> {
|
|
10
|
+
items: Ref<T[]>;
|
|
11
|
+
isLoading: Ref<boolean>;
|
|
12
|
+
/** Wire to OneDropdownSelect's @search. */
|
|
13
|
+
onSearch: (term: string) => void;
|
|
14
|
+
reload: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Async item source for OneDropdownSelect (which already emits `search` and
|
|
18
|
+
* accepts `items` + `isLoading`). Replaces the hand-rolled async wrappers
|
|
19
|
+
* around selects in staff/voicecall/invoice/warehouse/billing.
|
|
20
|
+
*
|
|
21
|
+
* const select = useAsyncSelect((q) => rpc.searchClients(q))
|
|
22
|
+
* <OneDropdownSelect :items="select.items.value" :is-loading="select.isLoading.value" @search="select.onSearch" />
|
|
23
|
+
*/
|
|
24
|
+
export declare function useAsyncSelect<T = Record<string, unknown>>(load: (query: {
|
|
25
|
+
search: string;
|
|
26
|
+
}) => Promise<T[]>, opts?: UseAsyncSelectOptions): UseAsyncSelectReturn<T>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export interface ConfirmOptions {
|
|
3
|
+
title?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
okLabel?: string;
|
|
6
|
+
cancelLabel?: string;
|
|
7
|
+
/** Renders the accept button in the danger variant. */
|
|
8
|
+
danger?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface PendingConfirm {
|
|
11
|
+
options: ConfirmOptions;
|
|
12
|
+
resolve: (accepted: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Promise-based confirm. `confirm(opts)` resolves true/false once the user
|
|
16
|
+
* accepts or cancels in the host component (OneConfirmHost renders it).
|
|
17
|
+
*/
|
|
18
|
+
export declare function useConfirm(): {
|
|
19
|
+
confirm: (options?: ConfirmOptions) => Promise<boolean>;
|
|
20
|
+
};
|
|
21
|
+
/** Internal state accessor used by OneConfirmHost (and tests). */
|
|
22
|
+
export declare function useConfirmState(): {
|
|
23
|
+
current: Ref<PendingConfirm | null>;
|
|
24
|
+
accept: () => void;
|
|
25
|
+
cancel: () => void;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Ref, ComputedRef } from 'vue';
|
|
2
|
+
export interface CursorPage<T = unknown> {
|
|
3
|
+
items: T[];
|
|
4
|
+
next_cursor: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface CursorListQuery {
|
|
7
|
+
cursor?: string | null;
|
|
8
|
+
search?: string;
|
|
9
|
+
period?: unknown;
|
|
10
|
+
filter?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface UseCursorListOptions<T> {
|
|
13
|
+
/** Skip the eager initial load. */
|
|
14
|
+
lazy?: boolean;
|
|
15
|
+
/** Map each raw item before exposing it. */
|
|
16
|
+
mapItem?: (item: unknown) => T;
|
|
17
|
+
/** Map a raw loader response into { items, next_cursor }. */
|
|
18
|
+
mapResponse?: (res: unknown) => CursorPage;
|
|
19
|
+
/** Reported for next-page failures (initial-load failures land in `error`). */
|
|
20
|
+
onError?: (error: unknown) => void;
|
|
21
|
+
/** Debounce for search/period/filter reloads (default 333ms, as in vizor). */
|
|
22
|
+
debounceMs?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface UseCursorListReturn<T> {
|
|
25
|
+
isLoading: Ref<boolean>;
|
|
26
|
+
isLoadingNext: Ref<boolean>;
|
|
27
|
+
items: ComputedRef<T[]>;
|
|
28
|
+
error: Ref<unknown>;
|
|
29
|
+
nextCursor: ComputedRef<string | null>;
|
|
30
|
+
hasNext: ComputedRef<boolean>;
|
|
31
|
+
searchQuery: Ref<string>;
|
|
32
|
+
period: Ref<unknown>;
|
|
33
|
+
filter: Record<string, unknown>;
|
|
34
|
+
load: () => void;
|
|
35
|
+
next: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Cursor/keyset pagination list loader. Ported from the vizor variant
|
|
39
|
+
* (the richest of the 5 copies: debounced search/period/filter + cache),
|
|
40
|
+
* decoupled from app-specific notify (opts.onError) and @vueuse.
|
|
41
|
+
*/
|
|
42
|
+
export declare function useCursorList<T = unknown>(key: string, loader: (query: CursorListQuery) => Promise<unknown>, opts?: UseCursorListOptions<T>): UseCursorListReturn<T>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debounced writable ref, ported from the identical copies in
|
|
3
|
+
* fin-bank/finance/wiki. Empty values ('' / null / undefined) are applied
|
|
4
|
+
* immediately so clearing a search input reacts instantly.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useDebouncedRef: <T>(initialValue: T, delay?: number, immediate?: boolean) => Ref<T>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export interface UseFileUploadOptions<R> {
|
|
3
|
+
onUploaded?: (result: R) => void;
|
|
4
|
+
onError?: (error: unknown) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface UseFileUploadReturn<R> {
|
|
7
|
+
isUploading: Ref<boolean>;
|
|
8
|
+
progress: Ref<number>;
|
|
9
|
+
error: Ref<unknown>;
|
|
10
|
+
upload: (file: File) => Promise<R | undefined>;
|
|
11
|
+
/** Wire straight to an <input type="file"> change event. */
|
|
12
|
+
onFileChange: (e: Event) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Upload-state wrapper around an app-provided request (the HTTP transport
|
|
16
|
+
* stays in the app, as agreed for the library). Ported from the voicecall/
|
|
17
|
+
* invoice/finance upload composables.
|
|
18
|
+
*
|
|
19
|
+
* const { upload, isUploading } = useFileUpload((file, onProgress) => api.upload(file, onProgress))
|
|
20
|
+
*/
|
|
21
|
+
export declare function useFileUpload<R = unknown>(request: (file: File, onProgress?: (percent: number) => void) => Promise<R>, opts?: UseFileUploadOptions<R>): UseFileUploadReturn<R>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
export type ValidationBag = Record<string, string[] | string>;
|
|
3
|
+
export interface UseFormSubmitOptions {
|
|
4
|
+
/** Called with the resolved value (invoice used this to ingest entities). */
|
|
5
|
+
onSuccess?: (result: unknown) => void;
|
|
6
|
+
/** Called on non-validation failure (invoice used this for billing_required). */
|
|
7
|
+
onError?: (error: unknown) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface UseFormSubmitReturn<T, A extends unknown[]> {
|
|
10
|
+
isLoading: Ref<boolean>;
|
|
11
|
+
error: Ref<unknown>;
|
|
12
|
+
validation: Ref<ValidationBag>;
|
|
13
|
+
isInvalid: ComputedRef<boolean>;
|
|
14
|
+
send: (...args: A) => Promise<T>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Form-submit state wrapper ported from the invoice/warehouse useFormSubmit
|
|
18
|
+
* family. Understands the two backend validation error shapes used across
|
|
19
|
+
* oneb apps: `err.cause === 'validation'` (err.data) and
|
|
20
|
+
* `err.name === 'ValidationError'` (err.errors). App-specific side effects
|
|
21
|
+
* (entity ingest, billing modal) are plugged via options.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useFormSubmit<T, A extends unknown[]>(method: (...args: A) => Promise<T>, opts?: UseFormSubmitOptions): UseFormSubmitReturn<T, A>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Reactive mobile detection. Replaces the invoice/warehouse useIsMobile
|
|
4
|
+
* (whose computed over matchMedia().matches evaluated only once) with the
|
|
5
|
+
* library's reactive useMediaQuery. Mobile = viewport narrower than
|
|
6
|
+
* `breakpointPx` (default 768, i.e. below the md breakpoint).
|
|
7
|
+
*/
|
|
8
|
+
export declare function useIsMobile(breakpointPx?: number): Ref<boolean>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue';
|
|
2
|
+
import type { TranslateFunction } from '../i18n/plugin';
|
|
3
|
+
export declare const confirmHostProps: {
|
|
4
|
+
/** Override the injected translate function. */
|
|
5
|
+
t: {
|
|
6
|
+
type: PropType<TranslateFunction>;
|
|
7
|
+
default: any;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type ConfirmHostProps = ExtractPropTypes<typeof confirmHostProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../useConfirm-6344b49d.cjs"),e=require("vue"),d=require("../OneModal-0e92c039.cjs"),r=require("../button/index.cjs"),m=require("../i18n/index.cjs");require("../useIsMobile-7b1f08cf.cjs");require("../useMediaQuery-1d87df02.cjs");require("../_plugin-vue_export-helper-f246444f.cjs");require("../SpinnerIcon-01be39fe.cjs");const c={t:{type:Function,default:void 0}},p={key:0,class:"p-4 text-sm text-secondary-base"},C={class:"flex justify-end gap-2 p-3 border-t"},k=e.defineComponent({__name:"OneConfirmHost",props:c,setup(a){const s=a,u=m.useOnebI18n(),n=e.computed(()=>s.t??u),{current:t,accept:l,cancel:o}=i.useConfirmState(),f={isOpen:e.computed(()=>t.value!==null),close:o};return(b,v)=>e.unref(t)?(e.openBlock(),e.createBlock(e.unref(d.OneModal),{key:0,useModal:f,title:e.unref(t).options.title??n.value("ui.confirm.Title"),size:"small"},{default:e.withCtx(()=>[e.unref(t).options.text?(e.openBlock(),e.createElementBlock("div",p,e.toDisplayString(e.unref(t).options.text),1)):e.createCommentVNode("",!0),e.createElementVNode("div",C,[e.createVNode(e.unref(r.OneButton),{variant:"secondary",label:e.unref(t).options.cancelLabel??n.value("ui.confirm.Cancel"),"data-test":"confirm-cancel",onClick:e.unref(o)},null,8,["label","onClick"]),e.createVNode(e.unref(r.OneButton),{variant:e.unref(t).options.danger?"danger":"primary",label:e.unref(t).options.okLabel??n.value("ui.confirm.Ok"),"data-test":"confirm-ok",onClick:e.unref(l)},null,8,["variant","label","onClick"])])]),_:1},8,["title"])):e.createCommentVNode("",!0)}});exports.useConfirm=i.useConfirm;exports.OneConfirmHost=k;exports.confirmHostProps=c;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as OneConfirmHost } from './OneConfirmHost.vue';
|
|
2
|
+
export { confirmHostProps } from './confirm';
|
|
3
|
+
export type { ConfirmHostProps } from './confirm';
|
|
4
|
+
export { useConfirm } from '../composables/useConfirm';
|
|
5
|
+
export type { ConfirmOptions } from '../composables/useConfirm';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { a as f } from "../useConfirm-74e99a5c.js";
|
|
2
|
+
import { u as I } from "../useConfirm-74e99a5c.js";
|
|
3
|
+
import { defineComponent as _, computed as a, unref as t, openBlock as r, createBlock as k, withCtx as C, createElementBlock as v, toDisplayString as b, createCommentVNode as i, createElementVNode as x, createVNode as s } from "vue";
|
|
4
|
+
import { O as y } from "../OneModal-02a9a173.js";
|
|
5
|
+
import { OneButton as c } from "../button/index.js";
|
|
6
|
+
import { useOnebI18n as O } from "../i18n/index.js";
|
|
7
|
+
import "../useIsMobile-98fc0cf9.js";
|
|
8
|
+
import "../useMediaQuery-77a19b18.js";
|
|
9
|
+
import "../_plugin-vue_export-helper-dad06003.js";
|
|
10
|
+
import "../SpinnerIcon-516264ba.js";
|
|
11
|
+
const g = {
|
|
12
|
+
/** Override the injected translate function. */
|
|
13
|
+
t: {
|
|
14
|
+
type: Function,
|
|
15
|
+
default: void 0
|
|
16
|
+
}
|
|
17
|
+
}, h = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "p-4 text-sm text-secondary-base"
|
|
20
|
+
}, B = { class: "flex justify-end gap-2 p-3 border-t" }, A = /* @__PURE__ */ _({
|
|
21
|
+
__name: "OneConfirmHost",
|
|
22
|
+
props: g,
|
|
23
|
+
setup(l) {
|
|
24
|
+
const m = l, p = O(), o = a(() => m.t ?? p), { current: e, accept: u, cancel: n } = f(), d = {
|
|
25
|
+
isOpen: a(() => e.value !== null),
|
|
26
|
+
close: n
|
|
27
|
+
};
|
|
28
|
+
return (H, N) => t(e) ? (r(), k(t(y), {
|
|
29
|
+
key: 0,
|
|
30
|
+
useModal: d,
|
|
31
|
+
title: t(e).options.title ?? o.value("ui.confirm.Title"),
|
|
32
|
+
size: "small"
|
|
33
|
+
}, {
|
|
34
|
+
default: C(() => [
|
|
35
|
+
t(e).options.text ? (r(), v("div", h, b(t(e).options.text), 1)) : i("", !0),
|
|
36
|
+
x("div", B, [
|
|
37
|
+
s(t(c), {
|
|
38
|
+
variant: "secondary",
|
|
39
|
+
label: t(e).options.cancelLabel ?? o.value("ui.confirm.Cancel"),
|
|
40
|
+
"data-test": "confirm-cancel",
|
|
41
|
+
onClick: t(n)
|
|
42
|
+
}, null, 8, ["label", "onClick"]),
|
|
43
|
+
s(t(c), {
|
|
44
|
+
variant: t(e).options.danger ? "danger" : "primary",
|
|
45
|
+
label: t(e).options.okLabel ?? o.value("ui.confirm.Ok"),
|
|
46
|
+
"data-test": "confirm-ok",
|
|
47
|
+
onClick: t(u)
|
|
48
|
+
}, null, 8, ["variant", "label", "onClick"])
|
|
49
|
+
])
|
|
50
|
+
]),
|
|
51
|
+
_: 1
|
|
52
|
+
}, 8, ["title"])) : i("", !0);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
A as OneConfirmHost,
|
|
57
|
+
g as confirmHostProps,
|
|
58
|
+
I as useConfirm
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../useCursorList-e1cb41e7.cjs"),e=require("vue"),m=require("../button/index.cjs"),y=require("../skeleton/index.cjs"),v=require("../i18n/index.cjs");require("../SpinnerIcon-01be39fe.cjs");require("../_plugin-vue_export-helper-f246444f.cjs");const f={class:"space-y-2 p-2"},k={class:"p-6 text-center text-sm text-gray-500"},g={key:0,class:"flex justify-center py-3"},B=e.defineComponent({__name:"OneCursorList",props:{list:{type:Object,required:!0},itemKey:{type:String,default:void 0},autoLoad:{type:Boolean,default:!1},t:{type:Function,default:void 0}},setup(t){const r=t,c=v.useOnebI18n(),u=e.computed(()=>r.t??c),s=e.ref(null);let n=null;return e.onMounted(()=>{!r.autoLoad||typeof IntersectionObserver>"u"||(n=new IntersectionObserver(o=>{o.some(l=>l.isIntersecting)&&r.list.next()}),s.value&&n.observe(s.value))}),e.onBeforeUnmount(()=>n==null?void 0:n.disconnect()),(o,l)=>(e.openBlock(),e.createElementBlock("div",null,[t.list.isLoading.value?e.renderSlot(o.$slots,"loading",{key:0},()=>[e.createElementVNode("div",f,[e.createVNode(e.unref(y.OneSkeleton),{count:3,height:"h-12"})])]):t.list.items.value.length===0?e.renderSlot(o.$slots,"empty",{key:1},()=>[e.createElementVNode("div",k,e.toDisplayString(u.value("ui.cursor_list.empty")),1)]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.list.items.value,(i,a)=>e.renderSlot(o.$slots,"item",{key:t.itemKey?String(i[t.itemKey]):a,item:i,index:a})),128)),e.createElementVNode("div",{ref_key:"sentinel",ref:s},null,512),t.list.hasNext.value?(e.openBlock(),e.createElementBlock("div",g,[e.createVNode(e.unref(m.OneButton),{variant:"secondary",size:"sm",label:u.value("ui.cursor_list.load_more"),"is-loading":t.list.isLoadingNext.value,"data-test":"load-more",onClick:l[0]||(l[0]=i=>t.list.next())},null,8,["label","is-loading"])])):e.createCommentVNode("",!0)],64))]))}});exports.useCursorList=d.useCursorList;exports.OneCursorList=B;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { u as T } from "../useCursorList-5c1b57aa.js";
|
|
2
|
+
import { defineComponent as p, computed as k, ref as L, onMounted as O, onBeforeUnmount as h, openBlock as s, createElementBlock as o, renderSlot as u, createElementVNode as d, createVNode as f, unref as y, toDisplayString as x, Fragment as v, renderList as b, createCommentVNode as C } from "vue";
|
|
3
|
+
import { OneButton as $ } from "../button/index.js";
|
|
4
|
+
import { OneSkeleton as B } from "../skeleton/index.js";
|
|
5
|
+
import { useOnebI18n as N } from "../i18n/index.js";
|
|
6
|
+
import "../SpinnerIcon-516264ba.js";
|
|
7
|
+
import "../_plugin-vue_export-helper-dad06003.js";
|
|
8
|
+
const S = { class: "space-y-2 p-2" }, I = { class: "p-6 text-center text-sm text-gray-500" }, j = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "flex justify-center py-3"
|
|
11
|
+
}, z = /* @__PURE__ */ p({
|
|
12
|
+
__name: "OneCursorList",
|
|
13
|
+
props: {
|
|
14
|
+
/** Return value of useCursorList. */
|
|
15
|
+
list: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: !0
|
|
18
|
+
},
|
|
19
|
+
/** Key field for v-for (falls back to index). */
|
|
20
|
+
itemKey: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: void 0
|
|
23
|
+
},
|
|
24
|
+
/** Load the next page automatically when the end scrolls into view. */
|
|
25
|
+
autoLoad: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !1
|
|
28
|
+
},
|
|
29
|
+
t: {
|
|
30
|
+
type: Function,
|
|
31
|
+
default: void 0
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
setup(e) {
|
|
35
|
+
const l = e, g = N(), m = k(() => l.t ?? g), r = L(null);
|
|
36
|
+
let t = null;
|
|
37
|
+
return O(() => {
|
|
38
|
+
!l.autoLoad || typeof IntersectionObserver > "u" || (t = new IntersectionObserver((n) => {
|
|
39
|
+
n.some((i) => i.isIntersecting) && l.list.next();
|
|
40
|
+
}), r.value && t.observe(r.value));
|
|
41
|
+
}), h(() => t == null ? void 0 : t.disconnect()), (n, i) => (s(), o("div", null, [
|
|
42
|
+
e.list.isLoading.value ? u(n.$slots, "loading", { key: 0 }, () => [
|
|
43
|
+
d("div", S, [
|
|
44
|
+
f(y(B), {
|
|
45
|
+
count: 3,
|
|
46
|
+
height: "h-12"
|
|
47
|
+
})
|
|
48
|
+
])
|
|
49
|
+
]) : e.list.items.value.length === 0 ? u(n.$slots, "empty", { key: 1 }, () => [
|
|
50
|
+
d("div", I, x(m.value("ui.cursor_list.empty")), 1)
|
|
51
|
+
]) : (s(), o(v, { key: 2 }, [
|
|
52
|
+
(s(!0), o(v, null, b(e.list.items.value, (a, c) => u(n.$slots, "item", {
|
|
53
|
+
key: e.itemKey ? String(a[e.itemKey]) : c,
|
|
54
|
+
item: a,
|
|
55
|
+
index: c
|
|
56
|
+
})), 128)),
|
|
57
|
+
d("div", {
|
|
58
|
+
ref_key: "sentinel",
|
|
59
|
+
ref: r
|
|
60
|
+
}, null, 512),
|
|
61
|
+
e.list.hasNext.value ? (s(), o("div", j, [
|
|
62
|
+
f(y($), {
|
|
63
|
+
variant: "secondary",
|
|
64
|
+
size: "sm",
|
|
65
|
+
label: m.value("ui.cursor_list.load_more"),
|
|
66
|
+
"is-loading": e.list.isLoadingNext.value,
|
|
67
|
+
"data-test": "load-more",
|
|
68
|
+
onClick: i[0] || (i[0] = (a) => e.list.next())
|
|
69
|
+
}, null, 8, ["label", "is-loading"])
|
|
70
|
+
])) : C("", !0)
|
|
71
|
+
], 64))
|
|
72
|
+
]));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
export {
|
|
76
|
+
z as OneCursorList,
|
|
77
|
+
T as useCursorList
|
|
78
|
+
};
|