@vinicunca/taman-ui 0.1.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/README.md +95 -0
- package/dist/_virtual/_/plugin-vue/export-helper.mjs +8 -0
- package/dist/components/auth/index.d.ts +2 -0
- package/dist/components/auth/index.mjs +2 -0
- package/dist/components/auth/taman-auth-form.mjs +67 -0
- package/dist/components/auth/taman-auth-form.vue.d.ts +31 -0
- package/dist/components/back-to-top/index.mjs +2 -0
- package/dist/components/back-to-top/taman-back-to-top.mjs +70 -0
- package/dist/components/back-to-top/taman-back-to-top.vue.d.ts +18 -0
- package/dist/components/button/check-group-selection.mjs +17 -0
- package/dist/components/button/index.d.ts +4 -0
- package/dist/components/button/index.mjs +3 -0
- package/dist/components/button/taman-button-check-group.mjs +132 -0
- package/dist/components/button/taman-button-check-group.types.d.ts +22 -0
- package/dist/components/button/taman-button-check-group.vue.d.ts +41 -0
- package/dist/components/button/taman-button-icon.mjs +105 -0
- package/dist/components/button/taman-button-icon.vue.d.ts +17 -0
- package/dist/components/descriptions/index.d.ts +4 -0
- package/dist/components/descriptions/index.mjs +3 -0
- package/dist/components/descriptions/taman-description-cell.mjs +116 -0
- package/dist/components/descriptions/taman-description-item.mjs +10 -0
- package/dist/components/descriptions/taman-description-item.vue.d.ts +5 -0
- package/dist/components/descriptions/taman-description-row.mjs +131 -0
- package/dist/components/descriptions/taman-description.mjs +78 -0
- package/dist/components/descriptions/taman-description.types.d.ts +51 -0
- package/dist/components/descriptions/taman-description.vue.d.ts +23 -0
- package/dist/components/descriptions/use-taman-description.mjs +161 -0
- package/dist/components/file-upload/index.d.ts +3 -0
- package/dist/components/file-upload/index.mjs +2 -0
- package/dist/components/file-upload/taman-file-upload.mjs +88 -0
- package/dist/components/file-upload/taman-file-upload.types.d.ts +10 -0
- package/dist/components/file-upload/taman-file-upload.vue.d.ts +21 -0
- package/dist/components/full-screen/full-screen.mjs +27 -0
- package/dist/components/full-screen/full-screen.vue.d.ts +8 -0
- package/dist/components/full-screen/index.mjs +2 -0
- package/dist/components/icon/icon.mjs +27 -0
- package/dist/components/icon/icon.vue.d.ts +9 -0
- package/dist/components/icon/index.d.ts +2 -0
- package/dist/components/icon/index.mjs +2 -0
- package/dist/components/index.d.ts +34 -0
- package/dist/components/index.mjs +31 -0
- package/dist/components/input/index.d.ts +5 -0
- package/dist/components/input/index.mjs +4 -0
- package/dist/components/input/password-strength.d.ts +7 -0
- package/dist/components/input/password-strength.mjs +21 -0
- package/dist/components/input/taman-input-currency.mjs +76 -0
- package/dist/components/input/taman-input-currency.types.d.ts +8 -0
- package/dist/components/input/taman-input-currency.vue.d.ts +15 -0
- package/dist/components/input/taman-input-password.mjs +99 -0
- package/dist/components/input/taman-input-password.vue.d.ts +17 -0
- package/dist/components/input-date/format-calendar-input-value.mjs +26 -0
- package/dist/components/input-date/index.d.ts +3 -0
- package/dist/components/input-date/index.mjs +2 -0
- package/dist/components/input-date/taman-input-date.mjs +116 -0
- package/dist/components/input-date/taman-input-date.types.d.ts +14 -0
- package/dist/components/input-date/taman-input-date.vue.d.ts +21 -0
- package/dist/components/loading/index.d.ts +3 -0
- package/dist/components/loading/index.mjs +2 -0
- package/dist/components/loading/taman-loading.mjs +64 -0
- package/dist/components/loading/taman-loading.vue.d.ts +25 -0
- package/dist/components/loading/types.d.ts +13 -0
- package/dist/components/logo/index.mjs +2 -0
- package/dist/components/logo/taman-logo.mjs +60 -0
- package/dist/components/logo/taman-logo.vue.d.ts +32 -0
- package/dist/components/render-content/index.d.ts +2 -0
- package/dist/components/render-content/index.mjs +2 -0
- package/dist/components/render-content/render-content.mjs +42 -0
- package/dist/components/render-content/render-content.vue.d.ts +31 -0
- package/dist/components/scrollbar/index.d.ts +2 -0
- package/dist/components/scrollbar/index.mjs +2 -0
- package/dist/components/scrollbar/scrollbar.mjs +136 -0
- package/dist/components/scrollbar/scrollbar.vue.d.ts +50 -0
- package/dist/form/components/form-actions.mjs +151 -0
- package/dist/form/components/form-field-array.mjs +154 -0
- package/dist/form/components/form-field-array.types.d.ts +18 -0
- package/dist/form/form-render/form-render-field-collapsible.mjs +32 -0
- package/dist/form/form-render/form-render-field-control.mjs +44 -0
- package/dist/form/form-render/form-render-form-field.mjs +408 -0
- package/dist/form/form-render/form-render-form-label.mjs +46 -0
- package/dist/form/form-render/form-render-form.mjs +163 -0
- package/dist/form/form-render/form-render-group.mjs +89 -0
- package/dist/form/form-render/form-render.context.mjs +10 -0
- package/dist/form/form-render/form-render.dependencies.mjs +101 -0
- package/dist/form/form-render/form-render.helper.mjs +31 -0
- package/dist/form/form-render/form-render.schema.mjs +209 -0
- package/dist/form/form-render/index.mjs +4 -0
- package/dist/form/form.api.d.ts +54 -0
- package/dist/form/form.api.mjs +324 -0
- package/dist/form/form.built-ins.d.ts +36 -0
- package/dist/form/form.built-ins.mjs +48 -0
- package/dist/form/form.codec.d.ts +17 -0
- package/dist/form/form.codec.mjs +45 -0
- package/dist/form/form.config.d.ts +6 -0
- package/dist/form/form.config.mjs +43 -0
- package/dist/form/form.empty-value.d.ts +4 -0
- package/dist/form/form.empty-value.mjs +20 -0
- package/dist/form/form.field-name.mjs +25 -0
- package/dist/form/form.rule-registry.mjs +10 -0
- package/dist/form/form.runtime-field.mjs +56 -0
- package/dist/form/form.runtime.mjs +235 -0
- package/dist/form/form.schema-defaults.mjs +36 -0
- package/dist/form/form.types.d.ts +315 -0
- package/dist/form/form.use-delayed-flag.mjs +35 -0
- package/dist/form/form.use-form-context.mjs +44 -0
- package/dist/form/form.use-taman-form.d.ts +7 -0
- package/dist/form/form.use-taman-form.mjs +36 -0
- package/dist/form/index.d.ts +8 -0
- package/dist/form/index.mjs +6 -0
- package/dist/form/taman-use-form.mjs +146 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.mjs +56 -0
- package/dist/layout/components/index.mjs +6 -0
- package/dist/layout/components/taman-core-button-collapse.mjs +38 -0
- package/dist/layout/components/taman-core-button-fixed.mjs +29 -0
- package/dist/layout/components/taman-core-layout-content.mjs +50 -0
- package/dist/layout/components/taman-core-layout-footer.mjs +38 -0
- package/dist/layout/components/taman-core-layout-header.mjs +48 -0
- package/dist/layout/components/taman-core-layout-sidebar.mjs +319 -0
- package/dist/layout/components/taman-core-layout-tabbar.mjs +21 -0
- package/dist/layout/composables/use-layout.mjs +31 -0
- package/dist/layout/composables/use-sidebar-drag.mjs +103 -0
- package/dist/layout/header-scroll-state.mjs +9 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.mjs +2 -0
- package/dist/layout/taman-core-layout.d.ts +41 -0
- package/dist/layout/taman-core-layout.mjs +603 -0
- package/dist/layout/taman-core-layout.vue.d.ts +99 -0
- package/dist/menu/components/collapse-transition.mjs +82 -0
- package/dist/menu/components/index.mjs +5 -0
- package/dist/menu/components/normal-menu/index.d.ts +3 -0
- package/dist/menu/components/normal-menu/index.mjs +2 -0
- package/dist/menu/components/normal-menu/normal-menu.d.ts +11 -0
- package/dist/menu/components/normal-menu/normal-menu.mjs +50 -0
- package/dist/menu/components/normal-menu/normal-menu.vue.d.ts +19 -0
- package/dist/menu/components/taman-menu-badge-dot.mjs +23 -0
- package/dist/menu/components/taman-menu-badge.mjs +49 -0
- package/dist/menu/components/taman-menu-badge.vue.d.ts +9 -0
- package/dist/menu/components/taman-menu-item.mjs +124 -0
- package/dist/menu/components/taman-menu-root.mjs +250 -0
- package/dist/menu/components/taman-menu-sub-menu-content.mjs +83 -0
- package/dist/menu/components/taman-menu-sub-menu.mjs +216 -0
- package/dist/menu/composables/index.mjs +3 -0
- package/dist/menu/composables/use-menu-context.mjs +36 -0
- package/dist/menu/composables/use-menu-scroll.mjs +23 -0
- package/dist/menu/composables/use-menu.mjs +33 -0
- package/dist/menu/index.d.ts +7 -0
- package/dist/menu/index.mjs +5 -0
- package/dist/menu/menu.constants.mjs +5 -0
- package/dist/menu/menu.types.d.ts +63 -0
- package/dist/menu/menu.utils.mjs +27 -0
- package/dist/menu/taman-menu.mjs +41 -0
- package/dist/menu/taman-menu.vue.d.ts +12 -0
- package/dist/menu/taman-sub-menu.mjs +75 -0
- package/dist/popup/alert/alert-builder.d.ts +8 -0
- package/dist/popup/alert/alert-builder.mjs +98 -0
- package/dist/popup/alert/alert-overlay.mjs +55 -0
- package/dist/popup/alert/alert.d.ts +43 -0
- package/dist/popup/alert/alert.mjs +10 -0
- package/dist/popup/alert/alert.vue.d.ts +26 -0
- package/dist/popup/alert/alert2.mjs +238 -0
- package/dist/popup/alert/index.d.ts +4 -0
- package/dist/popup/alert/index.mjs +4 -0
- package/dist/popup/dialog/dialog.api.d.ts +23 -0
- package/dist/popup/dialog/dialog.api.mjs +133 -0
- package/dist/popup/dialog/dialog.mjs +336 -0
- package/dist/popup/dialog/dialog.types.d.ts +60 -0
- package/dist/popup/dialog/dialog.vue.d.ts +46 -0
- package/dist/popup/dialog/index.d.ts +4 -0
- package/dist/popup/dialog/index.mjs +3 -0
- package/dist/popup/dialog/use-dialog-draggable.mjs +93 -0
- package/dist/popup/dialog/use-taman-dialog.d.ts +13 -0
- package/dist/popup/dialog/use-taman-dialog.mjs +106 -0
- package/dist/popup/drawer/drawer.api.d.ts +23 -0
- package/dist/popup/drawer/drawer.api.mjs +124 -0
- package/dist/popup/drawer/drawer.mjs +277 -0
- package/dist/popup/drawer/drawer.types.d.ts +56 -0
- package/dist/popup/drawer/drawer.vue.d.ts +47 -0
- package/dist/popup/drawer/index.d.ts +4 -0
- package/dist/popup/drawer/index.mjs +3 -0
- package/dist/popup/drawer/use-taman-drawer.d.ts +13 -0
- package/dist/popup/drawer/use-taman-drawer.mjs +109 -0
- package/dist/popup/index.d.ts +13 -0
- package/dist/popup/index.mjs +11 -0
- package/dist/tabs/components/index.mjs +2 -0
- package/dist/tabs/components/taman-tabs.mjs +158 -0
- package/dist/tabs/components/widgets/index.d.ts +4 -0
- package/dist/tabs/components/widgets/index.mjs +4 -0
- package/dist/tabs/components/widgets/tool-more.mjs +45 -0
- package/dist/tabs/components/widgets/tool-more.vue.d.ts +7 -0
- package/dist/tabs/components/widgets/tool-refresh.mjs +25 -0
- package/dist/tabs/components/widgets/tool-refresh.vue.d.ts +9 -0
- package/dist/tabs/components/widgets/tool-screen.mjs +29 -0
- package/dist/tabs/components/widgets/tool-screen.vue.d.ts +12 -0
- package/dist/tabs/index.d.ts +8 -0
- package/dist/tabs/index.mjs +6 -0
- package/dist/tabs/strict-context-menu.d.ts +10 -0
- package/dist/tabs/tabs.types.d.ts +30 -0
- package/dist/tabs/taman-tabs-view.mjs +101 -0
- package/dist/tabs/taman-tabs-view.vue.d.ts +18 -0
- package/dist/tabs/use-tabs-drag.mjs +69 -0
- package/dist/tabs/use-tabs-view-scroll.mjs +114 -0
- package/dist/ui/alert-dialog/alert-dialog-action.mjs +21 -0
- package/dist/ui/alert-dialog/alert-dialog-action.vue.d.ts +16 -0
- package/dist/ui/alert-dialog/alert-dialog-cancel.mjs +21 -0
- package/dist/ui/alert-dialog/alert-dialog-cancel.vue.d.ts +16 -0
- package/dist/ui/alert-dialog/alert-dialog-content.mjs +111 -0
- package/dist/ui/alert-dialog/alert-dialog-content.vue.d.ts +49 -0
- package/dist/ui/alert-dialog/alert-dialog-description.mjs +30 -0
- package/dist/ui/alert-dialog/alert-dialog-description.vue.d.ts +20 -0
- package/dist/ui/alert-dialog/alert-dialog-footer.mjs +14 -0
- package/dist/ui/alert-dialog/alert-dialog-footer.vue.d.ts +15 -0
- package/dist/ui/alert-dialog/alert-dialog-header.mjs +14 -0
- package/dist/ui/alert-dialog/alert-dialog-header.vue.d.ts +15 -0
- package/dist/ui/alert-dialog/alert-dialog-overlay.mjs +29 -0
- package/dist/ui/alert-dialog/alert-dialog-root.mjs +23 -0
- package/dist/ui/alert-dialog/alert-dialog-root.vue.d.ts +23 -0
- package/dist/ui/alert-dialog/alert-dialog-title.mjs +30 -0
- package/dist/ui/alert-dialog/alert-dialog-title.vue.d.ts +20 -0
- package/dist/ui/alert-dialog/alert-dialog-trigger.mjs +21 -0
- package/dist/ui/alert-dialog/alert-dialog-trigger.vue.d.ts +16 -0
- package/dist/ui/alert-dialog/index.d.ts +10 -0
- package/dist/ui/alert-dialog/index.mjs +10 -0
- package/dist/ui/dialog/dialog-close.mjs +21 -0
- package/dist/ui/dialog/dialog-close.vue.d.ts +16 -0
- package/dist/ui/dialog/dialog-content.mjs +111 -0
- package/dist/ui/dialog/dialog-content.vue.d.ts +51 -0
- package/dist/ui/dialog/dialog-description.mjs +31 -0
- package/dist/ui/dialog/dialog-description.vue.d.ts +20 -0
- package/dist/ui/dialog/dialog-footer.mjs +14 -0
- package/dist/ui/dialog/dialog-footer.vue.d.ts +15 -0
- package/dist/ui/dialog/dialog-header.mjs +14 -0
- package/dist/ui/dialog/dialog-header.vue.d.ts +15 -0
- package/dist/ui/dialog/dialog-overlay.mjs +34 -0
- package/dist/ui/dialog/dialog-overlay.vue.d.ts +14 -0
- package/dist/ui/dialog/dialog-root.mjs +24 -0
- package/dist/ui/dialog/dialog-root.vue.d.ts +23 -0
- package/dist/ui/dialog/dialog-title.mjs +31 -0
- package/dist/ui/dialog/dialog-title.vue.d.ts +20 -0
- package/dist/ui/dialog/dialog-trigger.mjs +21 -0
- package/dist/ui/dialog/dialog-trigger.vue.d.ts +16 -0
- package/dist/ui/dialog/index.d.ts +10 -0
- package/dist/ui/dialog/index.mjs +10 -0
- package/dist/ui/dialog/use-dialog-state-events.mjs +60 -0
- package/dist/ui/form/form-control.mjs +27 -0
- package/dist/ui/form/form-control.vue.d.ts +15 -0
- package/dist/ui/form/form-description.mjs +27 -0
- package/dist/ui/form/form-description.vue.d.ts +19 -0
- package/dist/ui/form/form-field.mjs +37 -0
- package/dist/ui/form/form-field.vue.d.ts +27 -0
- package/dist/ui/form/form-item.mjs +27 -0
- package/dist/ui/form/form-item.vue.d.ts +19 -0
- package/dist/ui/form/form-label.mjs +41 -0
- package/dist/ui/form/form-label.vue.d.ts +20 -0
- package/dist/ui/form/form-message.mjs +28 -0
- package/dist/ui/form/form-message.vue.d.ts +9 -0
- package/dist/ui/form/index.d.ts +8 -0
- package/dist/ui/form/index.mjs +8 -0
- package/dist/ui/form/injection-keys.d.ts +13 -0
- package/dist/ui/form/injection-keys.mjs +5 -0
- package/dist/ui/form/use-form-field.mjs +27 -0
- package/dist/ui/index.d.ts +42 -0
- package/dist/ui/index.mjs +42 -0
- package/dist/ui/label/index.d.ts +2 -0
- package/dist/ui/label/index.mjs +2 -0
- package/dist/ui/label/label.mjs +31 -0
- package/dist/ui/label/label.vue.d.ts +20 -0
- package/dist/ui/scroll-area/index.d.ts +3 -0
- package/dist/ui/scroll-area/index.mjs +3 -0
- package/dist/ui/scroll-area/scroll-area.mjs +47 -0
- package/dist/ui/scroll-area/scroll-area.vue.d.ts +21 -0
- package/dist/ui/scroll-area/scroll-bar.mjs +38 -0
- package/dist/ui/scroll-area/scroll-bar.vue.d.ts +12 -0
- package/dist/ui/sheet/index.d.ts +8 -0
- package/dist/ui/sheet/index.mjs +8 -0
- package/dist/ui/sheet/sheet-close.mjs +21 -0
- package/dist/ui/sheet/sheet-close.vue.d.ts +16 -0
- package/dist/ui/sheet/sheet-content.mjs +105 -0
- package/dist/ui/sheet/sheet-content.vue.d.ts +48 -0
- package/dist/ui/sheet/sheet-description.mjs +30 -0
- package/dist/ui/sheet/sheet-description.vue.d.ts +20 -0
- package/dist/ui/sheet/sheet-footer.mjs +14 -0
- package/dist/ui/sheet/sheet-footer.vue.d.ts +15 -0
- package/dist/ui/sheet/sheet-header.mjs +14 -0
- package/dist/ui/sheet/sheet-header.vue.d.ts +15 -0
- package/dist/ui/sheet/sheet-overlay.mjs +32 -0
- package/dist/ui/sheet/sheet-root.mjs +24 -0
- package/dist/ui/sheet/sheet-root.vue.d.ts +23 -0
- package/dist/ui/sheet/sheet-title.mjs +31 -0
- package/dist/ui/sheet/sheet-title.vue.d.ts +20 -0
- package/dist/ui/sheet/sheet.variants.d.ts +27 -0
- package/dist/ui/sheet/sheet.variants.mjs +12 -0
- package/dist/unocss/content.d.ts +4 -0
- package/dist/unocss/content.mjs +9 -0
- package/dist/unocss/index.d.ts +2 -0
- package/dist/unocss/index.mjs +2 -0
- package/package.json +78 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import _sfc_main$1 from "../../components/render-content/render-content.mjs";
|
|
2
|
+
import _sfc_main$2 from "../../components/button/taman-button-icon.mjs";
|
|
3
|
+
import _sfc_main$3 from "../../components/loading/taman-loading.mjs";
|
|
4
|
+
import _sfc_main$4 from "../../ui/alert-dialog/alert-dialog-action.mjs";
|
|
5
|
+
import _sfc_main$5 from "../../ui/alert-dialog/alert-dialog-cancel.mjs";
|
|
6
|
+
import _sfc_main$6 from "../../ui/alert-dialog/alert-dialog-content.mjs";
|
|
7
|
+
import _sfc_main$7 from "../../ui/alert-dialog/alert-dialog-description.mjs";
|
|
8
|
+
import _sfc_main$8 from "../../ui/alert-dialog/alert-dialog-root.mjs";
|
|
9
|
+
import _sfc_main$9 from "../../ui/alert-dialog/alert-dialog-title.mjs";
|
|
10
|
+
import "../../index.mjs";
|
|
11
|
+
import { provideAlertContext } from "./alert.mjs";
|
|
12
|
+
import { computed, createBlock, createCommentVNode, createElementVNode, createTextVNode, createVNode, defineComponent, h, mergeModels, nextTick, normalizeClass, openBlock, ref, resolveDynamicComponent, toDisplayString, unref, useModel, withCtx } from "vue";
|
|
13
|
+
import PButton from "pohon-ui/components/Button.vue";
|
|
14
|
+
import { isString } from "@vinicunca/taman-core/utils";
|
|
15
|
+
import { useOverlayZIndex, useSimpleLocale } from "@vinicunca/taman-core/composables";
|
|
16
|
+
import PIcon from "pohon-ui/components/Icon.vue";
|
|
17
|
+
import { usePreferences } from "@vinicunca/taman-core/preferences";
|
|
18
|
+
//#region src/popup/alert/alert.vue
|
|
19
|
+
const _hoisted_1 = { class: "flex items-center" };
|
|
20
|
+
const _hoisted_2 = { class: "flex-auto" };
|
|
21
|
+
const _hoisted_3 = { class: "m-4 min-h-7.5" };
|
|
22
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
23
|
+
__name: "alert",
|
|
24
|
+
props: /*@__PURE__*/ mergeModels({
|
|
25
|
+
beforeClose: {},
|
|
26
|
+
bordered: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: true
|
|
29
|
+
},
|
|
30
|
+
buttonAlign: { default: "end" },
|
|
31
|
+
cancelText: {},
|
|
32
|
+
centered: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true
|
|
35
|
+
},
|
|
36
|
+
confirmText: {},
|
|
37
|
+
containerClass: {},
|
|
38
|
+
content: {},
|
|
39
|
+
contentClass: {},
|
|
40
|
+
contentMasking: { type: Boolean },
|
|
41
|
+
escapeKeyClose: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true
|
|
44
|
+
},
|
|
45
|
+
footer: {},
|
|
46
|
+
icon: {},
|
|
47
|
+
overlayBlur: {},
|
|
48
|
+
showCancel: { type: Boolean },
|
|
49
|
+
title: {}
|
|
50
|
+
}, {
|
|
51
|
+
"open": {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
"openModifiers": {}
|
|
56
|
+
}),
|
|
57
|
+
emits: /*@__PURE__*/ mergeModels([
|
|
58
|
+
"closed",
|
|
59
|
+
"confirm",
|
|
60
|
+
"opened"
|
|
61
|
+
], ["update:open"]),
|
|
62
|
+
setup(__props, { emit: __emit }) {
|
|
63
|
+
const props = __props;
|
|
64
|
+
const emits = __emit;
|
|
65
|
+
const { globalEscapeShortcutKey } = usePreferences();
|
|
66
|
+
const open = useModel(__props, "open");
|
|
67
|
+
const { $t } = useSimpleLocale();
|
|
68
|
+
const isConfirm = ref(false);
|
|
69
|
+
const zIndex = useOverlayZIndex(open);
|
|
70
|
+
function onAlertClosed() {
|
|
71
|
+
emits("closed", isConfirm.value);
|
|
72
|
+
isConfirm.value = false;
|
|
73
|
+
}
|
|
74
|
+
function onEscapeKeyDown(event) {
|
|
75
|
+
isConfirm.value = false;
|
|
76
|
+
if (!props.escapeKeyClose && !globalEscapeShortcutKey.value) event.preventDefault();
|
|
77
|
+
}
|
|
78
|
+
const getIconRender = computed(() => {
|
|
79
|
+
let iconRender = null;
|
|
80
|
+
if (props.icon) {
|
|
81
|
+
if (isString(props.icon)) switch (props.icon) {
|
|
82
|
+
case "error":
|
|
83
|
+
iconRender = h(PIcon, {
|
|
84
|
+
name: "lucide:x-circle",
|
|
85
|
+
class: "color-error"
|
|
86
|
+
});
|
|
87
|
+
break;
|
|
88
|
+
case "info":
|
|
89
|
+
iconRender = h(PIcon, {
|
|
90
|
+
name: "lucide:info",
|
|
91
|
+
class: "color-info"
|
|
92
|
+
});
|
|
93
|
+
break;
|
|
94
|
+
case "question":
|
|
95
|
+
iconRender = h(PIcon, {
|
|
96
|
+
name: "lucide:help-circle",
|
|
97
|
+
class: "color-info"
|
|
98
|
+
});
|
|
99
|
+
break;
|
|
100
|
+
case "success":
|
|
101
|
+
iconRender = h(PIcon, {
|
|
102
|
+
name: "lucide:check-circle",
|
|
103
|
+
class: "color-success"
|
|
104
|
+
});
|
|
105
|
+
break;
|
|
106
|
+
case "warning":
|
|
107
|
+
iconRender = h(PIcon, {
|
|
108
|
+
name: "lucide:alert-circle",
|
|
109
|
+
class: "color-warning"
|
|
110
|
+
});
|
|
111
|
+
break;
|
|
112
|
+
default: iconRender = null;
|
|
113
|
+
}
|
|
114
|
+
} else iconRender = props.icon ?? null;
|
|
115
|
+
return iconRender;
|
|
116
|
+
});
|
|
117
|
+
function doCancel() {
|
|
118
|
+
handleCancel();
|
|
119
|
+
handleOpenChange(false);
|
|
120
|
+
}
|
|
121
|
+
function doConfirm() {
|
|
122
|
+
handleConfirm();
|
|
123
|
+
handleOpenChange(false);
|
|
124
|
+
}
|
|
125
|
+
provideAlertContext({
|
|
126
|
+
doCancel,
|
|
127
|
+
doConfirm
|
|
128
|
+
});
|
|
129
|
+
function handleConfirm() {
|
|
130
|
+
isConfirm.value = true;
|
|
131
|
+
emits("confirm");
|
|
132
|
+
}
|
|
133
|
+
function handleCancel() {
|
|
134
|
+
isConfirm.value = false;
|
|
135
|
+
}
|
|
136
|
+
const loading = ref(false);
|
|
137
|
+
async function handleOpenChange(val) {
|
|
138
|
+
await nextTick();
|
|
139
|
+
if (!val && props.beforeClose) {
|
|
140
|
+
loading.value = true;
|
|
141
|
+
try {
|
|
142
|
+
if (await props.beforeClose({ isConfirm: isConfirm.value }) !== false) open.value = false;
|
|
143
|
+
} finally {
|
|
144
|
+
loading.value = false;
|
|
145
|
+
}
|
|
146
|
+
} else open.value = val;
|
|
147
|
+
}
|
|
148
|
+
return (_ctx, _cache) => {
|
|
149
|
+
return openBlock(), createBlock(unref(_sfc_main$8), {
|
|
150
|
+
open: open.value,
|
|
151
|
+
"onUpdate:open": handleOpenChange
|
|
152
|
+
}, {
|
|
153
|
+
default: withCtx(() => [createVNode(unref(_sfc_main$6), {
|
|
154
|
+
open: open.value,
|
|
155
|
+
centered: __props.centered,
|
|
156
|
+
"overlay-blur": __props.overlayBlur,
|
|
157
|
+
"z-index": unref(zIndex),
|
|
158
|
+
class: normalizeClass(["flex flex-col max-h-[80%] inset-x-0 sm:(rounded-$taman-radius max-w-[80%] w-130)", [__props.containerClass, {
|
|
159
|
+
"border border-border": __props.bordered,
|
|
160
|
+
"shadow-3xl": !__props.bordered
|
|
161
|
+
}]]),
|
|
162
|
+
onOpened: _cache[0] || (_cache[0] = ($event) => emits("opened")),
|
|
163
|
+
onClosed: onAlertClosed,
|
|
164
|
+
onEscapeKeyDown: _cache[1] || (_cache[1] = ($event) => onEscapeKeyDown($event))
|
|
165
|
+
}, {
|
|
166
|
+
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(["p-3 flex-1 relative overflow-y-auto", __props.contentClass]) }, [
|
|
167
|
+
__props.title ? (openBlock(), createBlock(unref(_sfc_main$9), { key: 0 }, {
|
|
168
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [
|
|
169
|
+
(openBlock(), createBlock(resolveDynamicComponent(getIconRender.value), { class: "mr-2" })),
|
|
170
|
+
createElementVNode("span", _hoisted_2, toDisplayString(unref($t)(__props.title)), 1),
|
|
171
|
+
__props.showCancel ? (openBlock(), createBlock(unref(_sfc_main$5), {
|
|
172
|
+
key: 0,
|
|
173
|
+
"as-child": ""
|
|
174
|
+
}, {
|
|
175
|
+
default: withCtx(() => [createVNode(unref(_sfc_main$2), {
|
|
176
|
+
disabled: loading.value,
|
|
177
|
+
icon: "lucide:x",
|
|
178
|
+
onClick: handleCancel
|
|
179
|
+
}, null, 8, ["disabled"])]),
|
|
180
|
+
_: 1
|
|
181
|
+
})) : createCommentVNode("v-if", true)
|
|
182
|
+
])]),
|
|
183
|
+
_: 1
|
|
184
|
+
})) : createCommentVNode("v-if", true),
|
|
185
|
+
createVNode(unref(_sfc_main$7), null, {
|
|
186
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_3, [createVNode(unref(_sfc_main$1), {
|
|
187
|
+
content: __props.content,
|
|
188
|
+
"render-br": ""
|
|
189
|
+
}, null, 8, ["content"])]), loading.value && __props.contentMasking ? (openBlock(), createBlock(unref(_sfc_main$3), {
|
|
190
|
+
key: 0,
|
|
191
|
+
spinning: loading.value
|
|
192
|
+
}, null, 8, ["spinning"])) : createCommentVNode("v-if", true)]),
|
|
193
|
+
_: 1
|
|
194
|
+
}),
|
|
195
|
+
createElementVNode("div", { class: normalizeClass(["flex gap-x-2 items-center justify-end", `justify-${__props.buttonAlign}`]) }, [
|
|
196
|
+
createVNode(unref(_sfc_main$1), { content: __props.footer }, null, 8, ["content"]),
|
|
197
|
+
__props.showCancel ? (openBlock(), createBlock(unref(_sfc_main$5), {
|
|
198
|
+
key: 0,
|
|
199
|
+
"as-child": ""
|
|
200
|
+
}, {
|
|
201
|
+
default: withCtx(() => [createVNode(PButton, {
|
|
202
|
+
disabled: loading.value,
|
|
203
|
+
variant: "outline",
|
|
204
|
+
color: "neutral",
|
|
205
|
+
onClick: handleCancel
|
|
206
|
+
}, {
|
|
207
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.cancelText || unref($t)("cancel")), 1)]),
|
|
208
|
+
_: 1
|
|
209
|
+
}, 8, ["disabled"])]),
|
|
210
|
+
_: 1
|
|
211
|
+
})) : createCommentVNode("v-if", true),
|
|
212
|
+
createVNode(unref(_sfc_main$4), { "as-child": "" }, {
|
|
213
|
+
default: withCtx(() => [createVNode(PButton, {
|
|
214
|
+
loading: loading.value,
|
|
215
|
+
onClick: handleConfirm
|
|
216
|
+
}, {
|
|
217
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.confirmText || unref($t)("confirm")), 1)]),
|
|
218
|
+
_: 1
|
|
219
|
+
}, 8, ["loading"])]),
|
|
220
|
+
_: 1
|
|
221
|
+
})
|
|
222
|
+
], 2)
|
|
223
|
+
], 2)]),
|
|
224
|
+
_: 1
|
|
225
|
+
}, 8, [
|
|
226
|
+
"open",
|
|
227
|
+
"centered",
|
|
228
|
+
"overlay-blur",
|
|
229
|
+
"z-index",
|
|
230
|
+
"class"
|
|
231
|
+
])]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 8, ["open"]);
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
//#endregion
|
|
238
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AlertBeforeCloseScope, AlertPromptProps, IconType, TamanAlertProps, useAlertContext } from "./alert.js";
|
|
2
|
+
import { clearAllAlerts, tamanAlert, tamanConfirm, tamanPrompt } from "./alert-builder.js";
|
|
3
|
+
import _default from "./alert.vue.js";
|
|
4
|
+
export { _default as Alert, type AlertBeforeCloseScope, type AlertPromptProps, type IconType, type TamanAlertProps, clearAllAlerts, tamanAlert, tamanConfirm, tamanPrompt, useAlertContext };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { useAlertContext } from "./alert.mjs";
|
|
2
|
+
import _sfc_main from "./alert2.mjs";
|
|
3
|
+
import { clearAllAlerts, tamanAlert, tamanConfirm, tamanPrompt } from "./alert-builder.mjs";
|
|
4
|
+
export { _sfc_main as Alert, clearAllAlerts, tamanAlert, tamanConfirm, tamanPrompt, useAlertContext };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DialogApiOptions, DialogState } from "./dialog.types.js";
|
|
2
|
+
import { Store } from "@vinicunca/taman-core/store";
|
|
3
|
+
//#region src/popup/dialog/dialog.api.d.ts
|
|
4
|
+
declare class DialogApi<TData = unknown> {
|
|
5
|
+
sharedData: Record<'payload', TData | undefined>;
|
|
6
|
+
store: Store<DialogState>;
|
|
7
|
+
private api;
|
|
8
|
+
private state;
|
|
9
|
+
constructor(options?: DialogApiOptions);
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
getData(): TData | undefined;
|
|
12
|
+
lock(isLocked?: boolean): this;
|
|
13
|
+
onCancel(): void;
|
|
14
|
+
onClosed(): void;
|
|
15
|
+
onConfirm(): void;
|
|
16
|
+
onOpened(): void;
|
|
17
|
+
open(): void;
|
|
18
|
+
setData(payload: TData): this;
|
|
19
|
+
setState(stateOrFn: ((prev: DialogState) => Partial<DialogState>) | Partial<DialogState>): this;
|
|
20
|
+
unlock(): this;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { DialogApi };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { bindMethods, isFunction } from "@vinicunca/taman-core/utils";
|
|
2
|
+
import { Store } from "@vinicunca/taman-core/store";
|
|
3
|
+
//#region src/popup/dialog/dialog.api.ts
|
|
4
|
+
var DialogApi = class {
|
|
5
|
+
sharedData = { payload: void 0 };
|
|
6
|
+
store;
|
|
7
|
+
api;
|
|
8
|
+
state;
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
const { connectedComponent: _, onBeforeClose, onCancel, onClosed, onConfirm, onOpenChange, onOpened, ...storeState } = options;
|
|
11
|
+
const defaultState = {
|
|
12
|
+
bordered: true,
|
|
13
|
+
centered: false,
|
|
14
|
+
class: "",
|
|
15
|
+
closable: true,
|
|
16
|
+
closeOnClickModal: true,
|
|
17
|
+
closeOnPressEscape: true,
|
|
18
|
+
confirmDisabled: false,
|
|
19
|
+
confirmLoading: false,
|
|
20
|
+
contentClass: "",
|
|
21
|
+
destroyOnClose: true,
|
|
22
|
+
draggable: false,
|
|
23
|
+
overflow: false,
|
|
24
|
+
footer: true,
|
|
25
|
+
footerClass: "",
|
|
26
|
+
fullscreen: false,
|
|
27
|
+
fullscreenButton: true,
|
|
28
|
+
header: true,
|
|
29
|
+
headerClass: "",
|
|
30
|
+
isOpen: false,
|
|
31
|
+
loading: false,
|
|
32
|
+
modal: true,
|
|
33
|
+
openAutoFocus: false,
|
|
34
|
+
showCancelButton: true,
|
|
35
|
+
showConfirmButton: true,
|
|
36
|
+
title: "",
|
|
37
|
+
animationType: "slide"
|
|
38
|
+
};
|
|
39
|
+
this.store = new Store({
|
|
40
|
+
...defaultState,
|
|
41
|
+
...storeState
|
|
42
|
+
});
|
|
43
|
+
this.store.subscribe((state) => {
|
|
44
|
+
const prevIsOpen = this.state?.isOpen;
|
|
45
|
+
this.state = state;
|
|
46
|
+
if (state?.isOpen !== prevIsOpen) this.api.onOpenChange?.(!!state?.isOpen);
|
|
47
|
+
});
|
|
48
|
+
this.state = this.store.state;
|
|
49
|
+
this.api = {
|
|
50
|
+
onBeforeClose,
|
|
51
|
+
onCancel,
|
|
52
|
+
onClosed,
|
|
53
|
+
onConfirm,
|
|
54
|
+
onOpenChange,
|
|
55
|
+
onOpened
|
|
56
|
+
};
|
|
57
|
+
bindMethods(this);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Close dialog
|
|
61
|
+
* @description When closing the dialog, the onBeforeClose hook function is called. If onBeforeClose returns false, the dialog will not be closed. Otherwise, the pending open() promise resolves with `result`.
|
|
62
|
+
*/
|
|
63
|
+
async close() {
|
|
64
|
+
if (await this.api.onBeforeClose?.() ?? true) this.store.setState((prev) => ({
|
|
65
|
+
...prev,
|
|
66
|
+
isOpen: false
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
getData() {
|
|
70
|
+
return this.sharedData.payload;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Lock dialog state (used for waiting state during submission)
|
|
74
|
+
* @description The locked state will disable the default cancel button, use spinner to cover the dialog content, hide the close button, prevent manual closing of the dialog, and mark the default submit button as loading state
|
|
75
|
+
* @param isLocked Whether to lock
|
|
76
|
+
*/
|
|
77
|
+
lock(isLocked = true) {
|
|
78
|
+
return this.setState({ submitting: isLocked });
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Cancel operation
|
|
82
|
+
*/
|
|
83
|
+
onCancel() {
|
|
84
|
+
if (this.api.onCancel) this.api.onCancel?.();
|
|
85
|
+
else this.close();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Callback after close animation completes
|
|
89
|
+
*/
|
|
90
|
+
onClosed() {
|
|
91
|
+
if (!this.state.isOpen) this.api.onClosed?.();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Confirm operation
|
|
95
|
+
*/
|
|
96
|
+
onConfirm() {
|
|
97
|
+
this.api.onConfirm?.();
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Callback after open animation completes
|
|
101
|
+
*/
|
|
102
|
+
onOpened() {
|
|
103
|
+
if (this.state.isOpen) this.api.onOpened?.();
|
|
104
|
+
}
|
|
105
|
+
open() {
|
|
106
|
+
this.store.setState((prev) => ({
|
|
107
|
+
...prev,
|
|
108
|
+
isOpen: true,
|
|
109
|
+
submitting: false
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
setData(payload) {
|
|
113
|
+
this.sharedData.payload = payload;
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
setState(stateOrFn) {
|
|
117
|
+
if (isFunction(stateOrFn)) this.store.setState(stateOrFn);
|
|
118
|
+
else this.store.setState((prev) => ({
|
|
119
|
+
...prev,
|
|
120
|
+
...stateOrFn
|
|
121
|
+
}));
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Unlock dialog state
|
|
126
|
+
* @description Unlock the state set by the lock method, which is an alias for lock(false)
|
|
127
|
+
*/
|
|
128
|
+
unlock() {
|
|
129
|
+
return this.lock(false);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
export { DialogApi };
|