@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,64 @@
|
|
|
1
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, mergeProps, normalizeClass, openBlock, ref, renderSlot, toDisplayString, watch } from "vue";
|
|
2
|
+
import { isString } from "@vinicunca/taman-core/utils";
|
|
3
|
+
import PIcon from "pohon-ui/components/Icon.vue";
|
|
4
|
+
//#region src/components/loading/taman-loading.vue
|
|
5
|
+
const _hoisted_1 = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "text-xs mt-4"
|
|
8
|
+
};
|
|
9
|
+
const DEFAULT_ICON_NAME = "svg-spinners:ring-resize";
|
|
10
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
11
|
+
__name: "taman-loading",
|
|
12
|
+
props: {
|
|
13
|
+
minLoadingTime: { default: 50 },
|
|
14
|
+
spinning: { type: Boolean },
|
|
15
|
+
text: {},
|
|
16
|
+
icon: { default: "svg-spinners:ring-resize" }
|
|
17
|
+
},
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const iconProps = computed(() => {
|
|
21
|
+
const icon = props.icon ?? DEFAULT_ICON_NAME;
|
|
22
|
+
if (isString(icon)) return { name: icon };
|
|
23
|
+
return {
|
|
24
|
+
...icon,
|
|
25
|
+
name: icon.name ?? DEFAULT_ICON_NAME
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
const showSpinner = ref(false);
|
|
29
|
+
const renderSpinner = ref(false);
|
|
30
|
+
let timer;
|
|
31
|
+
watch(() => props.spinning, (show) => {
|
|
32
|
+
if (!show) {
|
|
33
|
+
showSpinner.value = false;
|
|
34
|
+
timer && clearTimeout(timer);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
timer = setTimeout(() => {
|
|
38
|
+
showSpinner.value = true;
|
|
39
|
+
if (showSpinner.value) renderSpinner.value = true;
|
|
40
|
+
}, props.minLoadingTime);
|
|
41
|
+
}, { immediate: true });
|
|
42
|
+
function onTransitionEnd() {
|
|
43
|
+
if (!showSpinner.value) renderSpinner.value = false;
|
|
44
|
+
}
|
|
45
|
+
return (_ctx, _cache) => {
|
|
46
|
+
return openBlock(), createElementBlock("div", {
|
|
47
|
+
class: normalizeClass(["color-primary bg-background-elevated/75 flex-col-center size-full transition-all-500 left-0 top-0 absolute z-100 backdrop-blur-xs", {
|
|
48
|
+
"invisible pointer-events-none opacity-0": !showSpinner.value,
|
|
49
|
+
"pointer-events-auto": showSpinner.value
|
|
50
|
+
}]),
|
|
51
|
+
onTransitionend: onTransitionEnd
|
|
52
|
+
}, [
|
|
53
|
+
renderSpinner.value ? (openBlock(), createBlock(PIcon, mergeProps({
|
|
54
|
+
key: 0,
|
|
55
|
+
size: "32"
|
|
56
|
+
}, iconProps.value), null, 16)) : createCommentVNode("v-if", true),
|
|
57
|
+
__props.text ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(__props.text), 1)) : createCommentVNode("v-if", true),
|
|
58
|
+
renderSlot(_ctx.$slots, "default")
|
|
59
|
+
], 34);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
//#endregion
|
|
64
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TamanLoadingIcon } from "./types.js";
|
|
2
|
+
//#region src/components/loading/taman-loading.vue.d.ts
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
minLoadingTime?: number;
|
|
5
|
+
spinning?: boolean;
|
|
6
|
+
text?: string;
|
|
7
|
+
icon?: TamanLoadingIcon;
|
|
8
|
+
};
|
|
9
|
+
declare var __VLS_6: {};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_6) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
14
|
+
icon: TamanLoadingIcon;
|
|
15
|
+
minLoadingTime: number;
|
|
16
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { _default as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes } from "vue";
|
|
2
|
+
import { IconProps } from "pohon-ui";
|
|
3
|
+
//#region src/components/loading/types.d.ts
|
|
4
|
+
interface TamanLoadingIconProps {
|
|
5
|
+
name?: IconProps['name'];
|
|
6
|
+
mode?: IconProps['mode'];
|
|
7
|
+
size?: IconProps['size'];
|
|
8
|
+
customize?: IconProps['customize'];
|
|
9
|
+
class?: HTMLAttributes['class'];
|
|
10
|
+
}
|
|
11
|
+
type TamanLoadingIcon = string | TamanLoadingIconProps;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { TamanLoadingIcon, TamanLoadingIconProps };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, renderSlot, toDisplayString } from "vue";
|
|
2
|
+
import PAvatar from "pohon-ui/components/Avatar.vue";
|
|
3
|
+
//#region src/components/logo/taman-logo.vue
|
|
4
|
+
const _hoisted_1 = ["href"];
|
|
5
|
+
const _hoisted_2 = ["alt", "src"];
|
|
6
|
+
const _hoisted_3 = { class: "color-text font-600 text-nowrap truncate" };
|
|
7
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
8
|
+
name: "TamanLogo",
|
|
9
|
+
__name: "taman-logo",
|
|
10
|
+
props: {
|
|
11
|
+
collapsed: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
},
|
|
15
|
+
fullLogoHeight: {},
|
|
16
|
+
logoMode: {},
|
|
17
|
+
href: { default: "javascript:void 0" },
|
|
18
|
+
showText: { type: Boolean },
|
|
19
|
+
src: { default: "" },
|
|
20
|
+
srcDark: { default: "" },
|
|
21
|
+
text: {},
|
|
22
|
+
theme: { default: "light" }
|
|
23
|
+
},
|
|
24
|
+
setup(__props) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
/**
|
|
27
|
+
* Pick logo image based on theme
|
|
28
|
+
*/
|
|
29
|
+
const logoSrc = computed(() => {
|
|
30
|
+
if (props.theme === "dark" && props.srcDark) return props.srcDark;
|
|
31
|
+
return props.src;
|
|
32
|
+
});
|
|
33
|
+
const shouldUseFullLogo = computed(() => {
|
|
34
|
+
return props.logoMode === "full" && !props.collapsed;
|
|
35
|
+
});
|
|
36
|
+
const shouldShowText = computed(() => {
|
|
37
|
+
return props.showText && !props.collapsed && !shouldUseFullLogo.value && !!props.text;
|
|
38
|
+
});
|
|
39
|
+
const fullLogoStyle = computed(() => ({ height: typeof props.fullLogoHeight === "number" ? `${props.fullLogoHeight}px` : props.fullLogoHeight }));
|
|
40
|
+
return (_ctx, _cache) => {
|
|
41
|
+
return openBlock(), createElementBlock("a", {
|
|
42
|
+
href: __props.href,
|
|
43
|
+
class: normalizeClass(["text-lg leading-normal flex h-full items-center overflow-hidden", [shouldShowText.value ? "gap-2 px-3 justify-start" : "w-full p-0 justify-center"]])
|
|
44
|
+
}, [logoSrc.value && shouldUseFullLogo.value ? (openBlock(), createElementBlock("img", {
|
|
45
|
+
key: 0,
|
|
46
|
+
alt: __props.text,
|
|
47
|
+
src: logoSrc.value,
|
|
48
|
+
style: normalizeStyle(fullLogoStyle.value),
|
|
49
|
+
class: "w-full"
|
|
50
|
+
}, null, 12, _hoisted_2)) : logoSrc.value ? (openBlock(), createBlock(PAvatar, {
|
|
51
|
+
key: 1,
|
|
52
|
+
alt: __props.text,
|
|
53
|
+
src: logoSrc.value,
|
|
54
|
+
class: "pohon:rounded-none"
|
|
55
|
+
}, null, 8, ["alt", "src"])) : createCommentVNode("v-if", true), !__props.collapsed ? renderSlot(_ctx.$slots, "text", {}, () => [createElementVNode("span", _hoisted_3, toDisplayString(__props.text), 1)], void 0, 2) : createCommentVNode("v-if", true)], 10, _hoisted_1);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
//#endregion
|
|
60
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/components/logo/taman-logo.vue.d.ts
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
collapsed?: boolean;
|
|
4
|
+
fullLogoHeight?: number | string;
|
|
5
|
+
logoMode?: 'full' | 'icon';
|
|
6
|
+
href?: string;
|
|
7
|
+
showText?: boolean;
|
|
8
|
+
src?: string;
|
|
9
|
+
srcDark?: string;
|
|
10
|
+
text: string;
|
|
11
|
+
theme?: string;
|
|
12
|
+
};
|
|
13
|
+
declare var __VLS_6: {};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
text?: (props: typeof __VLS_6) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
|
+
theme: string;
|
|
19
|
+
collapsed: boolean;
|
|
20
|
+
href: string;
|
|
21
|
+
src: string;
|
|
22
|
+
srcDark: string;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { _default as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineComponent, h } from "vue";
|
|
2
|
+
import { isFunction, isPlainObject, isString } from "@vinicunca/taman-core/utils";
|
|
3
|
+
//#region src/components/render-content/render-content.vue
|
|
4
|
+
const _sfc_main = defineComponent({
|
|
5
|
+
name: "TamanRenderContent",
|
|
6
|
+
props: {
|
|
7
|
+
content: {
|
|
8
|
+
default: void 0,
|
|
9
|
+
type: [
|
|
10
|
+
Object,
|
|
11
|
+
String,
|
|
12
|
+
Function
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
renderBr: {
|
|
16
|
+
default: false,
|
|
17
|
+
type: Boolean
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(props, { attrs, slots }) {
|
|
21
|
+
return () => {
|
|
22
|
+
if (!props.content) return null;
|
|
23
|
+
if (!((isPlainObject(props.content) || isFunction(props.content)) && props.content !== null)) {
|
|
24
|
+
if (props.renderBr && isString(props.content)) {
|
|
25
|
+
const lines = props.content.split("\n");
|
|
26
|
+
const result = [];
|
|
27
|
+
for (const [i, line] of lines.entries()) result.push(h("p", { key: i }, line));
|
|
28
|
+
return result;
|
|
29
|
+
} else return props.content;
|
|
30
|
+
}
|
|
31
|
+
return h(props.content, {
|
|
32
|
+
...attrs,
|
|
33
|
+
props: {
|
|
34
|
+
...props,
|
|
35
|
+
...attrs
|
|
36
|
+
}
|
|
37
|
+
}, slots);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
//#endregion
|
|
42
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Component, PropType } from "vue";
|
|
2
|
+
//#region src/components/render-content/render-content.vue.d.ts
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
content: {
|
|
6
|
+
default: PropType<(() => any) | Component | string> | undefined;
|
|
7
|
+
type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
|
|
8
|
+
};
|
|
9
|
+
renderBr: {
|
|
10
|
+
default: boolean;
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
};
|
|
13
|
+
}>, () => string | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
18
|
+
content: {
|
|
19
|
+
default: PropType<(() => any) | Component | string> | undefined;
|
|
20
|
+
type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
|
|
21
|
+
};
|
|
22
|
+
renderBr: {
|
|
23
|
+
default: boolean;
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
};
|
|
26
|
+
}>> & Readonly<{}>, {
|
|
27
|
+
content: string | Function | Record<string, any>;
|
|
28
|
+
renderBr: boolean;
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { _default as default };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import _sfc_main$1 from "../../ui/scroll-area/scroll-bar.mjs";
|
|
2
|
+
import _sfc_main$2 from "../../ui/scroll-area/scroll-area.mjs";
|
|
3
|
+
import "../../ui/index.mjs";
|
|
4
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, normalizeClass, openBlock, ref, renderSlot, unref, withCtx } from "vue";
|
|
5
|
+
//#region src/components/scrollbar/scrollbar.vue
|
|
6
|
+
const ARRIVED_STATE_THRESHOLD_PIXELS = 1;
|
|
7
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
8
|
+
__name: "scrollbar",
|
|
9
|
+
props: {
|
|
10
|
+
class: {
|
|
11
|
+
type: [
|
|
12
|
+
Boolean,
|
|
13
|
+
null,
|
|
14
|
+
String,
|
|
15
|
+
Object,
|
|
16
|
+
Array
|
|
17
|
+
],
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
horizontal: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
scrollBarClass: { type: [
|
|
25
|
+
Boolean,
|
|
26
|
+
null,
|
|
27
|
+
String,
|
|
28
|
+
Object,
|
|
29
|
+
Array
|
|
30
|
+
] },
|
|
31
|
+
shadow: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
shadowBorder: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
shadowBottom: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true
|
|
42
|
+
},
|
|
43
|
+
shadowLeft: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
shadowRight: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
shadowTop: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
emits: ["scrollAt"],
|
|
57
|
+
setup(__props, { emit: __emit }) {
|
|
58
|
+
const props = __props;
|
|
59
|
+
const emits = __emit;
|
|
60
|
+
const isAtTop = ref(true);
|
|
61
|
+
const isAtRight = ref(false);
|
|
62
|
+
const isAtBottom = ref(false);
|
|
63
|
+
const isAtLeft = ref(true);
|
|
64
|
+
/**
|
|
65
|
+
* We have to check if the scroll amount is close enough to some threshold in order to
|
|
66
|
+
* more accurately calculate arrivedState. This is because scrollTop/scrollLeft are non-rounded
|
|
67
|
+
* numbers, while scrollHeight/scrollWidth and clientHeight/clientWidth are rounded.
|
|
68
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#determine_if_an_element_has_been_totally_scrolled
|
|
69
|
+
*/
|
|
70
|
+
const showShadowTop = computed(() => props.shadow && props.shadowTop);
|
|
71
|
+
const showShadowBottom = computed(() => props.shadow && props.shadowBottom);
|
|
72
|
+
const showShadowLeft = computed(() => props.shadow && props.shadowLeft);
|
|
73
|
+
const showShadowRight = computed(() => props.shadow && props.shadowRight);
|
|
74
|
+
const hasBothShadow = computed(() => {
|
|
75
|
+
return !isAtLeft.value && !isAtRight.value && showShadowLeft.value && showShadowRight.value;
|
|
76
|
+
});
|
|
77
|
+
function handleScroll(event) {
|
|
78
|
+
const target = event.target;
|
|
79
|
+
const scrollTop = target?.scrollTop ?? 0;
|
|
80
|
+
const scrollLeft = target?.scrollLeft ?? 0;
|
|
81
|
+
const clientHeight = target?.clientHeight ?? 0;
|
|
82
|
+
const clientWidth = target?.clientWidth ?? 0;
|
|
83
|
+
const scrollHeight = target?.scrollHeight ?? 0;
|
|
84
|
+
const scrollWidth = target?.scrollWidth ?? 0;
|
|
85
|
+
isAtTop.value = scrollTop <= 0;
|
|
86
|
+
isAtLeft.value = scrollLeft <= 0;
|
|
87
|
+
isAtBottom.value = Math.abs(scrollTop) + clientHeight >= scrollHeight - ARRIVED_STATE_THRESHOLD_PIXELS;
|
|
88
|
+
isAtRight.value = Math.abs(scrollLeft) + clientWidth >= scrollWidth - ARRIVED_STATE_THRESHOLD_PIXELS;
|
|
89
|
+
emits("scrollAt", {
|
|
90
|
+
bottom: isAtBottom.value,
|
|
91
|
+
left: isAtLeft.value,
|
|
92
|
+
right: isAtRight.value,
|
|
93
|
+
top: isAtTop.value
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return (_ctx, _cache) => {
|
|
97
|
+
return openBlock(), createBlock(unref(_sfc_main$2), {
|
|
98
|
+
class: normalizeClass([[props.class, {
|
|
99
|
+
"mask-linear-[90deg,transparent,#000_32px,#000_calc(100%-32px),transparent_100%]": hasBothShadow.value,
|
|
100
|
+
"not-[[data-both-shadow]]:mask-linear-[90deg,transparent,#000_32px]": !isAtLeft.value && showShadowLeft.value,
|
|
101
|
+
"not-[[data-both-shadow]]:mask-linear-[90deg,transparent,#000_32px,#000_calc(100%-32px),transparent_100%]": !isAtRight.value && showShadowRight.value
|
|
102
|
+
}], "taman-scrollbar relative"]),
|
|
103
|
+
"data-both-shadow": hasBothShadow.value || void 0,
|
|
104
|
+
"on-scroll": handleScroll
|
|
105
|
+
}, {
|
|
106
|
+
default: withCtx(() => [
|
|
107
|
+
showShadowTop.value ? (openBlock(), createElementBlock("div", {
|
|
108
|
+
key: 0,
|
|
109
|
+
class: normalizeClass([{
|
|
110
|
+
"opacity-100": !isAtTop.value,
|
|
111
|
+
"opacity-0": isAtTop.value,
|
|
112
|
+
"border-border border-t": __props.shadowBorder && !isAtTop.value
|
|
113
|
+
}, "will-change-[opacity] h-12 w-full pointer-events-none transition-opacity-300 ease-in-out top-0 absolute z-10 from-background-sidebar to-transparent bg-gradient-to-b"])
|
|
114
|
+
}, null, 2)) : createCommentVNode("v-if", true),
|
|
115
|
+
renderSlot(_ctx.$slots, "default"),
|
|
116
|
+
showShadowBottom.value ? (openBlock(), createElementBlock("div", {
|
|
117
|
+
key: 1,
|
|
118
|
+
class: normalizeClass([{
|
|
119
|
+
"opacity-100": !isAtTop.value && !isAtBottom.value,
|
|
120
|
+
"opacity-0": isAtBottom.value,
|
|
121
|
+
"border-border border-b": __props.shadowBorder && !isAtTop.value && !isAtBottom.value
|
|
122
|
+
}, "scrollbar-bottom-shadow will-change-[opacity] h-12 w-full pointer-events-none transition-opacity-300 ease-in-out bottom-0 absolute z-10"])
|
|
123
|
+
}, null, 2)) : createCommentVNode("v-if", true),
|
|
124
|
+
__props.horizontal ? (openBlock(), createBlock(unref(_sfc_main$1), {
|
|
125
|
+
key: 2,
|
|
126
|
+
class: normalizeClass(__props.scrollBarClass),
|
|
127
|
+
orientation: "horizontal"
|
|
128
|
+
}, null, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
129
|
+
]),
|
|
130
|
+
_: 3
|
|
131
|
+
}, 8, ["class", "data-both-shadow"]);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
//#endregion
|
|
136
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { HTMLAttributes } from "vue";
|
|
2
|
+
//#region src/components/scrollbar/scrollbar.vue.d.ts
|
|
3
|
+
interface Props {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
horizontal?: boolean;
|
|
6
|
+
scrollBarClass?: HTMLAttributes['class'];
|
|
7
|
+
shadow?: boolean;
|
|
8
|
+
shadowBorder?: boolean;
|
|
9
|
+
shadowBottom?: boolean;
|
|
10
|
+
shadowLeft?: boolean;
|
|
11
|
+
shadowRight?: boolean;
|
|
12
|
+
shadowTop?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare var __VLS_8: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
default?: (props: typeof __VLS_8) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
scrollAt: (args_0: {
|
|
20
|
+
bottom: boolean;
|
|
21
|
+
left: boolean;
|
|
22
|
+
right: boolean;
|
|
23
|
+
top: boolean;
|
|
24
|
+
}) => any;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
26
|
+
onScrollAt?: ((args_0: {
|
|
27
|
+
bottom: boolean;
|
|
28
|
+
left: boolean;
|
|
29
|
+
right: boolean;
|
|
30
|
+
top: boolean;
|
|
31
|
+
}) => any) | undefined;
|
|
32
|
+
}>, {
|
|
33
|
+
horizontal: boolean;
|
|
34
|
+
class: string | false | Record<string, any> | import("vue").ClassValue[] | null;
|
|
35
|
+
shadow: boolean;
|
|
36
|
+
shadowBorder: boolean;
|
|
37
|
+
shadowBottom: boolean;
|
|
38
|
+
shadowLeft: boolean;
|
|
39
|
+
shadowRight: boolean;
|
|
40
|
+
shadowTop: boolean;
|
|
41
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
42
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { _default as default };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { injectFormProps } from "../form.use-form-context.mjs";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, normalizeClass, openBlock, renderSlot, toDisplayString, toRaw, unref, useModel, watch, withCtx } from "vue";
|
|
3
|
+
import PButton from "pohon-ui/components/Button.vue";
|
|
4
|
+
import { isFunction, triggerWindowResize } from "@vinicunca/taman-core/utils";
|
|
5
|
+
import { useSimpleLocale } from "@vinicunca/taman-core/composables";
|
|
6
|
+
import PIcon from "pohon-ui/components/Icon.vue";
|
|
7
|
+
//#region src/form/components/form-actions.vue
|
|
8
|
+
const _hoisted_1 = ["aria-controls", "aria-expanded"];
|
|
9
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
10
|
+
__name: "form-actions",
|
|
11
|
+
props: /*@__PURE__*/ mergeModels({ gridId: {} }, {
|
|
12
|
+
"modelValue": {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false
|
|
15
|
+
},
|
|
16
|
+
"modelModifiers": {}
|
|
17
|
+
}),
|
|
18
|
+
emits: ["update:modelValue"],
|
|
19
|
+
setup(__props, { expose: __expose }) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const { $t } = useSimpleLocale();
|
|
22
|
+
const [rootProps, form] = injectFormProps();
|
|
23
|
+
const collapsed = useModel(__props, "modelValue");
|
|
24
|
+
const resetButtonOptions = computed(() => {
|
|
25
|
+
return {
|
|
26
|
+
content: `${$t.value("reset")}`,
|
|
27
|
+
show: true,
|
|
28
|
+
...unref(rootProps).resetButtonOptions
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
const submitButtonOptions = computed(() => {
|
|
32
|
+
return {
|
|
33
|
+
content: `${$t.value("submit")}`,
|
|
34
|
+
show: true,
|
|
35
|
+
...unref(rootProps).submitButtonOptions
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const isFormBusy = computed(() => form.meta.submitting || form.meta.validating);
|
|
39
|
+
const isFormDisabled = computed(() => Boolean(unref(rootProps).disabled));
|
|
40
|
+
const hasCollapsibleFields = computed(() => (unref(rootProps).schema ?? []).some((schema) => schema.collapsed === true));
|
|
41
|
+
async function handleSubmit(event) {
|
|
42
|
+
event?.preventDefault();
|
|
43
|
+
event?.stopPropagation();
|
|
44
|
+
const props = unref(rootProps);
|
|
45
|
+
if (!props.formApi) return;
|
|
46
|
+
await props.formApi.validateAndSubmit();
|
|
47
|
+
}
|
|
48
|
+
async function handleReset(event) {
|
|
49
|
+
event?.preventDefault();
|
|
50
|
+
event?.stopPropagation();
|
|
51
|
+
const props = unref(rootProps);
|
|
52
|
+
const values = toRaw(await props.formApi?.getValues()) ?? {};
|
|
53
|
+
if (isFunction(props.handleReset)) await props.handleReset?.(values);
|
|
54
|
+
else form.reset();
|
|
55
|
+
}
|
|
56
|
+
watch(() => collapsed.value, () => {
|
|
57
|
+
if (unref(rootProps).collapseTriggerResize) triggerWindowResize();
|
|
58
|
+
});
|
|
59
|
+
const actionWrapperClass = computed(() => {
|
|
60
|
+
const props = unref(rootProps);
|
|
61
|
+
const actionLayout = props.actionLayout || "rowEnd";
|
|
62
|
+
const actionPosition = props.actionPosition || "right";
|
|
63
|
+
const cls = [
|
|
64
|
+
"flex",
|
|
65
|
+
"items-center",
|
|
66
|
+
"gap-3",
|
|
67
|
+
props.compact ? "pb-2" : "pb-4",
|
|
68
|
+
"self-end",
|
|
69
|
+
"w-full",
|
|
70
|
+
props.actionWrapperClass
|
|
71
|
+
];
|
|
72
|
+
switch (actionLayout) {
|
|
73
|
+
case "newLine":
|
|
74
|
+
cls.push("col-span-full");
|
|
75
|
+
break;
|
|
76
|
+
case "rowEnd": cls.push("col-[-2/-1]");
|
|
77
|
+
}
|
|
78
|
+
switch (actionPosition) {
|
|
79
|
+
case "center":
|
|
80
|
+
cls.push("justify-center");
|
|
81
|
+
break;
|
|
82
|
+
case "left":
|
|
83
|
+
cls.push("justify-start");
|
|
84
|
+
break;
|
|
85
|
+
default: cls.push("justify-end");
|
|
86
|
+
}
|
|
87
|
+
return cls.join(" ");
|
|
88
|
+
});
|
|
89
|
+
__expose({
|
|
90
|
+
handleReset,
|
|
91
|
+
handleSubmit
|
|
92
|
+
});
|
|
93
|
+
return (_ctx, _cache) => {
|
|
94
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(actionWrapperClass.value) }, [
|
|
95
|
+
unref(rootProps).actionButtonsReverse ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
96
|
+
createCommentVNode(" Before submit button "),
|
|
97
|
+
renderSlot(_ctx.$slots, "submit-before"),
|
|
98
|
+
submitButtonOptions.value.show ? (openBlock(), createBlock(PButton, mergeProps({ key: 0 }, submitButtonOptions.value, {
|
|
99
|
+
disabled: isFormDisabled.value || isFormBusy.value || Boolean(submitButtonOptions.value.disabled),
|
|
100
|
+
loading: isFormBusy.value || Boolean(submitButtonOptions.value.loading),
|
|
101
|
+
onClick: handleSubmit
|
|
102
|
+
}), {
|
|
103
|
+
default: withCtx(() => [createTextVNode(toDisplayString(submitButtonOptions.value.content), 1)]),
|
|
104
|
+
_: 1
|
|
105
|
+
}, 16, ["disabled", "loading"])) : createCommentVNode("v-if", true)
|
|
106
|
+
], 64)) : createCommentVNode("v-if", true),
|
|
107
|
+
createCommentVNode(" Before reset button "),
|
|
108
|
+
renderSlot(_ctx.$slots, "reset-before"),
|
|
109
|
+
createCommentVNode("\n Reset is intentionally not gated on `isFormBusy` (unlike submit\n above): it never had a busy-state binding before form-level\n `disabled` existed, and a user should still be able to bail out of a\n form that is merely validating. Only `isFormDisabled` applies here.\n "),
|
|
110
|
+
resetButtonOptions.value.show ? (openBlock(), createBlock(PButton, mergeProps({ key: 1 }, resetButtonOptions.value, {
|
|
111
|
+
variant: "outline",
|
|
112
|
+
color: "neutral",
|
|
113
|
+
disabled: isFormDisabled.value || Boolean(resetButtonOptions.value.disabled),
|
|
114
|
+
onClick: handleReset
|
|
115
|
+
}), {
|
|
116
|
+
default: withCtx(() => [createTextVNode(toDisplayString(resetButtonOptions.value.content), 1)]),
|
|
117
|
+
_: 1
|
|
118
|
+
}, 16, ["disabled"])) : createCommentVNode("v-if", true),
|
|
119
|
+
!unref(rootProps).actionButtonsReverse ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
120
|
+
createCommentVNode(" Before submit button "),
|
|
121
|
+
renderSlot(_ctx.$slots, "submit-before"),
|
|
122
|
+
submitButtonOptions.value.show ? (openBlock(), createBlock(PButton, mergeProps({ key: 0 }, submitButtonOptions.value, {
|
|
123
|
+
disabled: isFormDisabled.value || isFormBusy.value || Boolean(submitButtonOptions.value.disabled),
|
|
124
|
+
loading: isFormBusy.value || Boolean(submitButtonOptions.value.loading),
|
|
125
|
+
onClick: handleSubmit
|
|
126
|
+
}), {
|
|
127
|
+
default: withCtx(() => [createTextVNode(toDisplayString(submitButtonOptions.value.content), 1)]),
|
|
128
|
+
_: 1
|
|
129
|
+
}, 16, ["disabled", "loading"])) : createCommentVNode("v-if", true)
|
|
130
|
+
], 64)) : createCommentVNode("v-if", true),
|
|
131
|
+
createCommentVNode(" Before expand button "),
|
|
132
|
+
renderSlot(_ctx.$slots, "expand-before"),
|
|
133
|
+
hasCollapsibleFields.value ? (openBlock(), createElementBlock("button", {
|
|
134
|
+
key: 3,
|
|
135
|
+
type: "button",
|
|
136
|
+
class: "form-collapse-trigger text-sm color-primary cursor-pointer inline-flex gap-1 items-center",
|
|
137
|
+
"aria-controls": props.gridId,
|
|
138
|
+
"aria-expanded": !collapsed.value,
|
|
139
|
+
onClick: _cache[0] || (_cache[0] = ($event) => collapsed.value = !collapsed.value)
|
|
140
|
+
}, [createElementVNode("span", null, toDisplayString(collapsed.value ? unref($t)("expand") : unref($t)("collapse")), 1), createVNode(PIcon, {
|
|
141
|
+
name: "lucide:chevron-down",
|
|
142
|
+
class: normalizeClass(["transition-transform", { "rotate-180": !collapsed.value }])
|
|
143
|
+
}, null, 8, ["class"])], 8, _hoisted_1)) : createCommentVNode("v-if", true),
|
|
144
|
+
createCommentVNode(" After expand button "),
|
|
145
|
+
renderSlot(_ctx.$slots, "expand-after")
|
|
146
|
+
], 2);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
//#endregion
|
|
151
|
+
export { _sfc_main as default };
|