@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,116 @@
|
|
|
1
|
+
import _sfc_main$1 from "../render-content/render-content.mjs";
|
|
2
|
+
import "../render-content/index.mjs";
|
|
3
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, resolveDynamicComponent, unref, withCtx } from "vue";
|
|
4
|
+
import { isNumber } from "@vinicunca/taman-core/utils";
|
|
5
|
+
//#region src/components/descriptions/taman-description-cell.vue
|
|
6
|
+
const _hoisted_1 = { class: "flex" };
|
|
7
|
+
const COLON_CLASS = "after:content-[':']";
|
|
8
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
9
|
+
__name: "taman-description-cell",
|
|
10
|
+
props: {
|
|
11
|
+
bordered: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
},
|
|
15
|
+
colon: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: true
|
|
18
|
+
},
|
|
19
|
+
content: {
|
|
20
|
+
type: [
|
|
21
|
+
Function,
|
|
22
|
+
Number,
|
|
23
|
+
String,
|
|
24
|
+
null
|
|
25
|
+
],
|
|
26
|
+
default: null
|
|
27
|
+
},
|
|
28
|
+
contentStyle: { default: void 0 },
|
|
29
|
+
itemClass: {
|
|
30
|
+
type: [
|
|
31
|
+
Boolean,
|
|
32
|
+
null,
|
|
33
|
+
String,
|
|
34
|
+
Object,
|
|
35
|
+
Array
|
|
36
|
+
],
|
|
37
|
+
default: void 0
|
|
38
|
+
},
|
|
39
|
+
label: {
|
|
40
|
+
type: [
|
|
41
|
+
Function,
|
|
42
|
+
Number,
|
|
43
|
+
String,
|
|
44
|
+
null
|
|
45
|
+
],
|
|
46
|
+
default: null
|
|
47
|
+
},
|
|
48
|
+
labelStyle: { default: void 0 },
|
|
49
|
+
size: { default: "middle" },
|
|
50
|
+
span: { default: 1 },
|
|
51
|
+
tag: {},
|
|
52
|
+
type: {}
|
|
53
|
+
},
|
|
54
|
+
setup(__props) {
|
|
55
|
+
const props = __props;
|
|
56
|
+
const BORDERED_PADDING = {
|
|
57
|
+
large: "px-6 py-4",
|
|
58
|
+
middle: "px-4 py-2.5",
|
|
59
|
+
small: "px-3 py-2"
|
|
60
|
+
};
|
|
61
|
+
const PLAIN_PADDING = {
|
|
62
|
+
large: "pb-6",
|
|
63
|
+
middle: "pb-4",
|
|
64
|
+
small: "pb-2"
|
|
65
|
+
};
|
|
66
|
+
const hasLabel = computed(() => props.label !== null && props.label !== void 0);
|
|
67
|
+
const hasContent = computed(() => props.content !== null && props.content !== void 0);
|
|
68
|
+
const displayLabel = computed(() => {
|
|
69
|
+
if (props.label === null || props.label === void 0) return;
|
|
70
|
+
return isNumber(props.label) ? String(props.label) : props.label;
|
|
71
|
+
});
|
|
72
|
+
const displayContent = computed(() => {
|
|
73
|
+
if (props.content === null || props.content === void 0) return;
|
|
74
|
+
return isNumber(props.content) ? String(props.content) : props.content;
|
|
75
|
+
});
|
|
76
|
+
const cellClass = computed(() => {
|
|
77
|
+
if (props.bordered) return [
|
|
78
|
+
"border border-border align-top break-words",
|
|
79
|
+
BORDERED_PADDING[props.size],
|
|
80
|
+
props.type === "label" ? "bg-background-muted/50 text-start font-normal color-text" : "color-text",
|
|
81
|
+
props.itemClass
|
|
82
|
+
];
|
|
83
|
+
return [
|
|
84
|
+
"align-top",
|
|
85
|
+
PLAIN_PADDING[props.size],
|
|
86
|
+
props.itemClass
|
|
87
|
+
];
|
|
88
|
+
});
|
|
89
|
+
const labelClass = computed(() => ["mr-2 shrink-0 color-text-muted", props.colon && COLON_CLASS]);
|
|
90
|
+
return (_ctx, _cache) => {
|
|
91
|
+
return openBlock(), createBlock(resolveDynamicComponent(props.tag), {
|
|
92
|
+
class: normalizeClass(cellClass.value),
|
|
93
|
+
colspan: props.span
|
|
94
|
+
}, {
|
|
95
|
+
default: withCtx(() => [createCommentVNode(" Border mode: Each cell holds only a label or content "), props.bordered ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [hasLabel.value ? (openBlock(), createElementBlock("span", {
|
|
96
|
+
key: 0,
|
|
97
|
+
style: normalizeStyle(props.labelStyle)
|
|
98
|
+
}, [createVNode(unref(_sfc_main$1), { content: displayLabel.value }, null, 8, ["content"])], 4)) : createCommentVNode("v-if", true), hasContent.value ? (openBlock(), createElementBlock("span", {
|
|
99
|
+
key: 1,
|
|
100
|
+
style: normalizeStyle(props.contentStyle)
|
|
101
|
+
}, [createVNode(unref(_sfc_main$1), { content: displayContent.value }, null, 8, ["content"])], 4)) : createCommentVNode("v-if", true)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" Non-bordered mode: label + content container "), createElementVNode("div", _hoisted_1, [hasLabel.value ? (openBlock(), createElementBlock("span", {
|
|
102
|
+
key: 0,
|
|
103
|
+
class: normalizeClass(labelClass.value),
|
|
104
|
+
style: normalizeStyle(props.labelStyle)
|
|
105
|
+
}, [createVNode(unref(_sfc_main$1), { content: displayLabel.value }, null, 8, ["content"])], 6)) : createCommentVNode("v-if", true), hasContent.value ? (openBlock(), createElementBlock("span", {
|
|
106
|
+
key: 1,
|
|
107
|
+
class: "color-text break-words",
|
|
108
|
+
style: normalizeStyle(props.contentStyle)
|
|
109
|
+
}, [createVNode(unref(_sfc_main$1), { content: displayContent.value }, null, 8, ["content"])], 4)) : createCommentVNode("v-if", true)])], 2112))]),
|
|
110
|
+
_: 1
|
|
111
|
+
}, 8, ["class", "colspan"]);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
//#endregion
|
|
116
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import export_helper_default from "../../_virtual/_/plugin-vue/export-helper.mjs";
|
|
2
|
+
import { createCommentVNode, createElementBlock, openBlock } from "vue";
|
|
3
|
+
//#region src/components/descriptions/taman-description-item.vue
|
|
4
|
+
const _sfc_main = {};
|
|
5
|
+
function _sfc_render(_ctx, _cache) {
|
|
6
|
+
return openBlock(), createElementBlock("div", null, [createCommentVNode(" ")]);
|
|
7
|
+
}
|
|
8
|
+
var taman_description_item_default = /*#__PURE__*/ export_helper_default(_sfc_main, [["render", _sfc_render]]);
|
|
9
|
+
//#endregion
|
|
10
|
+
export { taman_description_item_default as default };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region src/components/descriptions/taman-description-item.vue.d.ts
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { _default as default };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import _sfc_main$1 from "./taman-description-cell.mjs";
|
|
2
|
+
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, renderList } from "vue";
|
|
3
|
+
//#region src/components/descriptions/taman-description-row.vue
|
|
4
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
5
|
+
__name: "taman-description-row",
|
|
6
|
+
props: {
|
|
7
|
+
bordered: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: false
|
|
10
|
+
},
|
|
11
|
+
colon: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: true
|
|
14
|
+
},
|
|
15
|
+
contentStyle: {},
|
|
16
|
+
labelStyle: {},
|
|
17
|
+
row: {},
|
|
18
|
+
size: { default: "middle" },
|
|
19
|
+
vertical: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(__props) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
function mergeStyle(base, override) {
|
|
27
|
+
if (!base && !override) return;
|
|
28
|
+
return {
|
|
29
|
+
...base,
|
|
30
|
+
...override
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" Vertical layout: label on its own line, content on its own line "), props.vertical ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(props.row, (item, index) => {
|
|
35
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
36
|
+
key: `label-${item.key ?? index}`,
|
|
37
|
+
tag: "th",
|
|
38
|
+
type: "label",
|
|
39
|
+
span: item.span ?? 1,
|
|
40
|
+
bordered: props.bordered,
|
|
41
|
+
colon: props.colon,
|
|
42
|
+
size: props.size,
|
|
43
|
+
label: item.label ?? null,
|
|
44
|
+
"item-class": item.class,
|
|
45
|
+
"label-style": mergeStyle(props.labelStyle, item.labelStyle)
|
|
46
|
+
}, null, 8, [
|
|
47
|
+
"span",
|
|
48
|
+
"bordered",
|
|
49
|
+
"colon",
|
|
50
|
+
"size",
|
|
51
|
+
"label",
|
|
52
|
+
"item-class",
|
|
53
|
+
"label-style"
|
|
54
|
+
]);
|
|
55
|
+
}), 128))]), createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(props.row, (item, index) => {
|
|
56
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
57
|
+
key: `content-${item.key ?? index}`,
|
|
58
|
+
tag: "td",
|
|
59
|
+
type: "content",
|
|
60
|
+
span: item.span ?? 1,
|
|
61
|
+
bordered: props.bordered,
|
|
62
|
+
size: props.size,
|
|
63
|
+
content: item.content ?? null,
|
|
64
|
+
"item-class": item.class,
|
|
65
|
+
"content-style": mergeStyle(props.contentStyle, item.contentStyle)
|
|
66
|
+
}, null, 8, [
|
|
67
|
+
"span",
|
|
68
|
+
"bordered",
|
|
69
|
+
"size",
|
|
70
|
+
"content",
|
|
71
|
+
"item-class",
|
|
72
|
+
"content-style"
|
|
73
|
+
]);
|
|
74
|
+
}), 128))])], 64)) : props.bordered ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" Horizontal + Border: Each item split into label (th) and content (td) "), createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(props.row, (item, index) => {
|
|
75
|
+
return openBlock(), createElementBlock(Fragment, { key: item.key ?? index }, [createVNode(_sfc_main$1, {
|
|
76
|
+
tag: "th",
|
|
77
|
+
type: "label",
|
|
78
|
+
span: 1,
|
|
79
|
+
bordered: true,
|
|
80
|
+
size: props.size,
|
|
81
|
+
label: item.label ?? null,
|
|
82
|
+
"item-class": item.class,
|
|
83
|
+
"label-style": mergeStyle(props.labelStyle, item.labelStyle)
|
|
84
|
+
}, null, 8, [
|
|
85
|
+
"size",
|
|
86
|
+
"label",
|
|
87
|
+
"item-class",
|
|
88
|
+
"label-style"
|
|
89
|
+
]), createVNode(_sfc_main$1, {
|
|
90
|
+
tag: "td",
|
|
91
|
+
type: "content",
|
|
92
|
+
span: (item.span ?? 1) * 2 - 1,
|
|
93
|
+
bordered: true,
|
|
94
|
+
size: props.size,
|
|
95
|
+
content: item.content ?? null,
|
|
96
|
+
"content-style": mergeStyle(props.contentStyle, item.contentStyle)
|
|
97
|
+
}, null, 8, [
|
|
98
|
+
"span",
|
|
99
|
+
"size",
|
|
100
|
+
"content",
|
|
101
|
+
"content-style"
|
|
102
|
+
])], 64);
|
|
103
|
+
}), 128))])], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" Horizontal + Non-bordered: Each item has one cell, label and content in the same column "), createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(props.row, (item, index) => {
|
|
104
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
105
|
+
key: item.key ?? index,
|
|
106
|
+
tag: "td",
|
|
107
|
+
type: "item",
|
|
108
|
+
span: item.span ?? 1,
|
|
109
|
+
colon: props.colon,
|
|
110
|
+
size: props.size,
|
|
111
|
+
label: item.label ?? null,
|
|
112
|
+
content: item.content ?? null,
|
|
113
|
+
"item-class": item.class,
|
|
114
|
+
"label-style": mergeStyle(props.labelStyle, item.labelStyle),
|
|
115
|
+
"content-style": mergeStyle(props.contentStyle, item.contentStyle)
|
|
116
|
+
}, null, 8, [
|
|
117
|
+
"span",
|
|
118
|
+
"colon",
|
|
119
|
+
"size",
|
|
120
|
+
"label",
|
|
121
|
+
"content",
|
|
122
|
+
"item-class",
|
|
123
|
+
"label-style",
|
|
124
|
+
"content-style"
|
|
125
|
+
]);
|
|
126
|
+
}), 128))])], 2112))], 2112);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
//#endregion
|
|
131
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _sfc_main$1 from "./taman-description-row.mjs";
|
|
2
|
+
import { calcRows, normalizeItems, parseItemsFromSlot, resolveColumn, useScreens } from "./use-taman-description.mjs";
|
|
3
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, normalizeClass, openBlock, renderList, renderSlot, toDisplayString, useSlots } from "vue";
|
|
4
|
+
//#region src/components/descriptions/taman-description.vue
|
|
5
|
+
const _hoisted_1 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "mb-5 flex gap-4 items-center justify-between"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_2 = { class: "text-base color-text font-600" };
|
|
10
|
+
const _hoisted_3 = { class: "color-text" };
|
|
11
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
12
|
+
name: "TamanDescription",
|
|
13
|
+
__name: "taman-description",
|
|
14
|
+
props: {
|
|
15
|
+
bordered: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
19
|
+
class: { type: [
|
|
20
|
+
Boolean,
|
|
21
|
+
null,
|
|
22
|
+
String,
|
|
23
|
+
Object,
|
|
24
|
+
Array
|
|
25
|
+
] },
|
|
26
|
+
colon: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: true
|
|
29
|
+
},
|
|
30
|
+
column: {},
|
|
31
|
+
contentStyle: {},
|
|
32
|
+
extra: {},
|
|
33
|
+
items: {},
|
|
34
|
+
labelStyle: {},
|
|
35
|
+
layout: { default: "horizontal" },
|
|
36
|
+
size: { default: "middle" },
|
|
37
|
+
title: {}
|
|
38
|
+
},
|
|
39
|
+
setup(__props) {
|
|
40
|
+
const props = __props;
|
|
41
|
+
const slots = useSlots();
|
|
42
|
+
const screens = useScreens();
|
|
43
|
+
const resolvedItems = computed(() => {
|
|
44
|
+
if (props.items && props.items.length > 0) return props.items;
|
|
45
|
+
const nodes = slots.default?.() ?? [];
|
|
46
|
+
return parseItemsFromSlot(nodes);
|
|
47
|
+
});
|
|
48
|
+
const mergedColumn = computed(() => resolveColumn(props.column, screens.value));
|
|
49
|
+
const mergedItems = computed(() => normalizeItems(resolvedItems.value, screens.value));
|
|
50
|
+
const rows = computed(() => calcRows(mergedItems.value, mergedColumn.value));
|
|
51
|
+
const hasHeader = computed(() => !!props.title || !!props.extra || !!slots.title || !!slots.extra);
|
|
52
|
+
const tableClass = computed(() => ["w-full table-auto border-collapse text-sm", !props.bordered && "[&>tbody>tr:last-child>td]:pb-0"]);
|
|
53
|
+
return (_ctx, _cache) => {
|
|
54
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(["w-full", [props.class]]) }, [hasHeader.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])]), createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "extra", {}, () => [createTextVNode(toDisplayString(__props.extra), 1)])])])) : createCommentVNode("v-if", true), createElementVNode("table", { class: normalizeClass(tableClass.value) }, [createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, index) => {
|
|
55
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
56
|
+
key: index,
|
|
57
|
+
row,
|
|
58
|
+
vertical: __props.layout === "vertical",
|
|
59
|
+
bordered: __props.bordered,
|
|
60
|
+
colon: __props.colon,
|
|
61
|
+
size: __props.size,
|
|
62
|
+
"label-style": __props.labelStyle,
|
|
63
|
+
"content-style": __props.contentStyle
|
|
64
|
+
}, null, 8, [
|
|
65
|
+
"row",
|
|
66
|
+
"vertical",
|
|
67
|
+
"bordered",
|
|
68
|
+
"colon",
|
|
69
|
+
"size",
|
|
70
|
+
"label-style",
|
|
71
|
+
"content-style"
|
|
72
|
+
]);
|
|
73
|
+
}), 128))])], 2)], 2);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
//#endregion
|
|
78
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CSSProperties, Component, HTMLAttributes } from "vue";
|
|
2
|
+
//#region src/components/descriptions/taman-description.types.d.ts
|
|
3
|
+
type TamanDescriptionsBreakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxxl';
|
|
4
|
+
type TamanScreenMap = Partial<Record<TamanDescriptionsBreakpoint, boolean>>;
|
|
5
|
+
type TamanDescriptionsLayout = 'horizontal' | 'vertical';
|
|
6
|
+
type TamanDescriptionsSize = 'large' | 'middle' | 'small';
|
|
7
|
+
type TamanDescriptionsColumn = number | Partial<Record<TamanDescriptionsBreakpoint, number>>;
|
|
8
|
+
type TamanDescriptionsItemSpan = 'filled' | number | Partial<Record<TamanDescriptionsBreakpoint, number>>;
|
|
9
|
+
type TamanDescriptionsRenderNode = (() => any) | Component | number | string;
|
|
10
|
+
interface TamanDescriptionsItemType {
|
|
11
|
+
content?: TamanDescriptionsRenderNode;
|
|
12
|
+
contentStyle?: CSSProperties;
|
|
13
|
+
key?: number | string;
|
|
14
|
+
label?: TamanDescriptionsRenderNode;
|
|
15
|
+
labelStyle?: CSSProperties;
|
|
16
|
+
span?: TamanDescriptionsItemSpan;
|
|
17
|
+
}
|
|
18
|
+
interface TamanDescriptionsProps {
|
|
19
|
+
bordered?: boolean;
|
|
20
|
+
class?: HTMLAttributes['class'];
|
|
21
|
+
colon?: boolean;
|
|
22
|
+
column?: TamanDescriptionsColumn;
|
|
23
|
+
contentStyle?: CSSProperties;
|
|
24
|
+
extra?: string;
|
|
25
|
+
items?: Array<TamanDescriptionsItemType>;
|
|
26
|
+
labelStyle?: CSSProperties;
|
|
27
|
+
layout?: TamanDescriptionsLayout;
|
|
28
|
+
size?: TamanDescriptionsSize;
|
|
29
|
+
title?: string;
|
|
30
|
+
}
|
|
31
|
+
interface TamanDescriptionsItemProps {
|
|
32
|
+
content?: TamanDescriptionsRenderNode;
|
|
33
|
+
contentStyle?: CSSProperties;
|
|
34
|
+
label?: TamanDescriptionsRenderNode;
|
|
35
|
+
labelStyle?: CSSProperties;
|
|
36
|
+
span?: TamanDescriptionsItemSpan;
|
|
37
|
+
}
|
|
38
|
+
interface TamanInternalDescriptionsItem {
|
|
39
|
+
_index?: number;
|
|
40
|
+
class?: HTMLAttributes['class'];
|
|
41
|
+
content?: TamanDescriptionsRenderNode;
|
|
42
|
+
contentStyle?: CSSProperties;
|
|
43
|
+
filled?: boolean;
|
|
44
|
+
key?: number | string;
|
|
45
|
+
label?: TamanDescriptionsRenderNode;
|
|
46
|
+
labelStyle?: CSSProperties;
|
|
47
|
+
span?: number;
|
|
48
|
+
style?: CSSProperties;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { TamanDescriptionsBreakpoint, TamanDescriptionsColumn, TamanDescriptionsItemProps, TamanDescriptionsItemSpan, TamanDescriptionsItemType, TamanDescriptionsLayout, TamanDescriptionsProps, TamanDescriptionsRenderNode, TamanDescriptionsSize, TamanInternalDescriptionsItem, TamanScreenMap };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TamanDescriptionsLayout, TamanDescriptionsProps, TamanDescriptionsSize } from "./taman-description.types.js";
|
|
2
|
+
//#region src/components/descriptions/taman-description.vue.d.ts
|
|
3
|
+
declare var __VLS_1: {}, __VLS_3: {};
|
|
4
|
+
type __VLS_Slots = {} & {
|
|
5
|
+
title?: (props: typeof __VLS_1) => any;
|
|
6
|
+
} & {
|
|
7
|
+
extra?: (props: typeof __VLS_3) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<TamanDescriptionsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TamanDescriptionsProps> & Readonly<{}>, {
|
|
10
|
+
layout: TamanDescriptionsLayout;
|
|
11
|
+
size: TamanDescriptionsSize;
|
|
12
|
+
bordered: boolean;
|
|
13
|
+
colon: boolean;
|
|
14
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { _default as default };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Fragment, computed } from "vue";
|
|
2
|
+
import { useBreakpoints } from "@vueuse/core";
|
|
3
|
+
import { isNumber } from "@vinicunca/taman-core/utils";
|
|
4
|
+
//#region src/components/descriptions/use-taman-description.ts
|
|
5
|
+
/** Default column count mapping */
|
|
6
|
+
const DEFAULT_COLUMN_MAP = {
|
|
7
|
+
lg: 3,
|
|
8
|
+
md: 3,
|
|
9
|
+
sm: 2,
|
|
10
|
+
xl: 3,
|
|
11
|
+
xs: 1,
|
|
12
|
+
xxl: 3,
|
|
13
|
+
xxxl: 4
|
|
14
|
+
};
|
|
15
|
+
/** Breakpoints largest-first; matchScreen uses first match in this order */
|
|
16
|
+
const RESPONSIVE_ARRAY = [
|
|
17
|
+
"xxxl",
|
|
18
|
+
"xxl",
|
|
19
|
+
"xl",
|
|
20
|
+
"lg",
|
|
21
|
+
"md",
|
|
22
|
+
"sm",
|
|
23
|
+
"xs"
|
|
24
|
+
];
|
|
25
|
+
/** Breakpoint pixel widths */
|
|
26
|
+
const BREAKPOINT_PX = {
|
|
27
|
+
sm: 576,
|
|
28
|
+
md: 768,
|
|
29
|
+
lg: 992,
|
|
30
|
+
xl: 1200,
|
|
31
|
+
xxl: 1600,
|
|
32
|
+
xxxl: 2e3
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* From breakpoint config, return the first matched value (largest breakpoint first)
|
|
36
|
+
*/
|
|
37
|
+
function matchScreen(screens, screenSizes) {
|
|
38
|
+
if (!screenSizes) return;
|
|
39
|
+
for (const breakpoint of RESPONSIVE_ARRAY) if (screens[breakpoint] && screenSizes[breakpoint] !== void 0) return screenSizes[breakpoint];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Watch viewport width, return the current matched breakpoint set
|
|
43
|
+
*/
|
|
44
|
+
function useScreens() {
|
|
45
|
+
const breakpoints = useBreakpoints(BREAKPOINT_PX);
|
|
46
|
+
return computed(() => ({
|
|
47
|
+
lg: breakpoints.lg.value,
|
|
48
|
+
md: breakpoints.md.value,
|
|
49
|
+
sm: breakpoints.sm.value,
|
|
50
|
+
xl: breakpoints.xl.value,
|
|
51
|
+
xs: !breakpoints.sm.value,
|
|
52
|
+
xxl: breakpoints.xxl.value,
|
|
53
|
+
xxxl: breakpoints.xxxl.value
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Calculate final column count: return fixed number directly, otherwise parse based on breakpoints
|
|
58
|
+
*/
|
|
59
|
+
function resolveColumn(column, screens) {
|
|
60
|
+
if (isNumber(column)) return column;
|
|
61
|
+
return matchScreen(screens, {
|
|
62
|
+
...DEFAULT_COLUMN_MAP,
|
|
63
|
+
...column
|
|
64
|
+
}) ?? 3;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Normalize items: parse span to number, 'filled' mark as filled
|
|
68
|
+
*/
|
|
69
|
+
function normalizeItems(items, screens) {
|
|
70
|
+
return items.map((item, index) => {
|
|
71
|
+
const { span, ...rest } = item;
|
|
72
|
+
if (span === "filled") return {
|
|
73
|
+
...rest,
|
|
74
|
+
_index: index,
|
|
75
|
+
filled: true
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
...rest,
|
|
79
|
+
_index: index,
|
|
80
|
+
span: isNumber(span) ? span : matchScreen(screens, span)
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Row packing algorithm: split list items into multiple rows based on column count and span,
|
|
86
|
+
* and fill the last item of each row to fill the column count.
|
|
87
|
+
* Fill the last item of each row to fill the column count.
|
|
88
|
+
*/
|
|
89
|
+
function calcRows(items, column) {
|
|
90
|
+
let rows = [];
|
|
91
|
+
let tmpRow = [];
|
|
92
|
+
let count = 0;
|
|
93
|
+
items.filter(Boolean).forEach((item) => {
|
|
94
|
+
const { filled, ...rest } = item;
|
|
95
|
+
if (filled) {
|
|
96
|
+
tmpRow.push(rest);
|
|
97
|
+
rows.push(tmpRow);
|
|
98
|
+
tmpRow = [];
|
|
99
|
+
count = 0;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const restSpan = column - count;
|
|
103
|
+
count += item.span || 1;
|
|
104
|
+
if (count >= column) {
|
|
105
|
+
tmpRow.push(count > column ? {
|
|
106
|
+
...rest,
|
|
107
|
+
span: restSpan
|
|
108
|
+
} : rest);
|
|
109
|
+
rows.push(tmpRow);
|
|
110
|
+
tmpRow = [];
|
|
111
|
+
count = 0;
|
|
112
|
+
} else tmpRow.push(rest);
|
|
113
|
+
});
|
|
114
|
+
if (tmpRow.length > 0) rows.push(tmpRow);
|
|
115
|
+
rows = rows.map((row) => {
|
|
116
|
+
const total = row.reduce((acc, item) => acc + (item.span || 1), 0);
|
|
117
|
+
if (total < column) {
|
|
118
|
+
const last = row[row.length - 1];
|
|
119
|
+
if (last) last.span = column - (total - (last.span || 1));
|
|
120
|
+
}
|
|
121
|
+
return row;
|
|
122
|
+
});
|
|
123
|
+
return rows;
|
|
124
|
+
}
|
|
125
|
+
/** Mark the component type as TamanDescriptionsItem, Makes it easy to identify from the slot vnode. */
|
|
126
|
+
const TAMAN_DESCRIPTIONS_ITEM_NAME = "TamanDescriptionsItem";
|
|
127
|
+
function isItemVNode(node) {
|
|
128
|
+
const type = node.type;
|
|
129
|
+
return !!type && (type.__isDescriptionsItem === true || type.name === "TamanDescriptionsItem");
|
|
130
|
+
}
|
|
131
|
+
function flattenVNodes(nodes) {
|
|
132
|
+
const result = [];
|
|
133
|
+
for (const node of nodes) if (node.type === Fragment && Array.isArray(node.children)) result.push(...flattenVNodes(node.children));
|
|
134
|
+
else if (node.type !== Comment) result.push(node);
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Parse items from the default slot vnode, support
|
|
139
|
+
* <TamanDescriptionsItem label="..." :span="2">content</TamanDescriptionsItem> syntax
|
|
140
|
+
*/
|
|
141
|
+
function parseItemsFromSlot(nodes) {
|
|
142
|
+
return flattenVNodes(nodes).filter((node) => isItemVNode(node)).map((node) => {
|
|
143
|
+
const props = node.props ?? {};
|
|
144
|
+
const children = node.children ?? {};
|
|
145
|
+
const labelSlot = typeof children.label === "function" ? children.label : void 0;
|
|
146
|
+
const contentDefaultSlot = typeof children.default === "function" ? children.default : void 0;
|
|
147
|
+
const contentSlot = typeof children.content === "function" ? children.content : contentDefaultSlot;
|
|
148
|
+
return {
|
|
149
|
+
class: props.class,
|
|
150
|
+
content: contentSlot ?? props.content,
|
|
151
|
+
contentStyle: props.contentStyle ?? props["content-style"],
|
|
152
|
+
key: node.key ?? void 0,
|
|
153
|
+
label: labelSlot ?? props.label,
|
|
154
|
+
labelStyle: props.labelStyle ?? props["label-style"],
|
|
155
|
+
span: props.span,
|
|
156
|
+
style: props.style
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
export { DEFAULT_COLUMN_MAP, TAMAN_DESCRIPTIONS_ITEM_NAME, calcRows, matchScreen, normalizeItems, parseItemsFromSlot, resolveColumn, useScreens };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, mergeProps, openBlock, toDisplayString, unref, useModel, withCtx } from "vue";
|
|
2
|
+
import PButton from "pohon-ui/components/Button.vue";
|
|
3
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
4
|
+
import { useForwardProps } from "@vinicunca/taman-core/composables";
|
|
5
|
+
import PFileUpload from "pohon-ui/components/FileUpload.vue";
|
|
6
|
+
//#region src/components/file-upload/taman-file-upload.vue
|
|
7
|
+
const _hoisted_1 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "mb-2 flex items-center justify-between"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_2 = { class: "font-bold" };
|
|
12
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
__name: "taman-file-upload",
|
|
15
|
+
props: /*@__PURE__*/ mergeModels({
|
|
16
|
+
label: {},
|
|
17
|
+
labelActions: {},
|
|
18
|
+
labelPreview: {},
|
|
19
|
+
labelAddMore: {},
|
|
20
|
+
as: {},
|
|
21
|
+
id: {},
|
|
22
|
+
name: {},
|
|
23
|
+
icon: {
|
|
24
|
+
type: [String, Boolean],
|
|
25
|
+
default: "lucide:image"
|
|
26
|
+
},
|
|
27
|
+
description: {},
|
|
28
|
+
color: {},
|
|
29
|
+
variant: {},
|
|
30
|
+
size: {},
|
|
31
|
+
layout: {},
|
|
32
|
+
position: {},
|
|
33
|
+
highlight: { type: Boolean },
|
|
34
|
+
accept: {},
|
|
35
|
+
multiple: { type: Boolean },
|
|
36
|
+
reset: { type: Boolean },
|
|
37
|
+
dropzone: { type: Boolean },
|
|
38
|
+
interactive: { type: Boolean },
|
|
39
|
+
required: { type: Boolean },
|
|
40
|
+
disabled: { type: Boolean },
|
|
41
|
+
fileIcon: {},
|
|
42
|
+
fileImage: { type: Boolean },
|
|
43
|
+
fileDelete: { type: [Boolean, Object] },
|
|
44
|
+
fileDeleteIcon: {},
|
|
45
|
+
preview: { type: Boolean },
|
|
46
|
+
class: {},
|
|
47
|
+
ui: {}
|
|
48
|
+
}, {
|
|
49
|
+
"modelValue": {},
|
|
50
|
+
"modelModifiers": {}
|
|
51
|
+
}),
|
|
52
|
+
emits: ["update:modelValue"],
|
|
53
|
+
setup(__props) {
|
|
54
|
+
const props = __props;
|
|
55
|
+
function toFileList(files) {
|
|
56
|
+
if (files == null) return [];
|
|
57
|
+
return Array.isArray(files) ? files : [files];
|
|
58
|
+
}
|
|
59
|
+
const modelValue = useModel(__props, "modelValue");
|
|
60
|
+
const rootProps = useForwardProps(reactiveOmit(props, "labelActions", "labelPreview", "labelAddMore"));
|
|
61
|
+
return (_ctx, _cache) => {
|
|
62
|
+
return openBlock(), createBlock(PFileUpload, mergeProps({
|
|
63
|
+
modelValue: modelValue.value,
|
|
64
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
|
|
65
|
+
}, unref(rootProps)), {
|
|
66
|
+
actions: withCtx(({ open }) => [createVNode(PButton, {
|
|
67
|
+
label: props.labelActions,
|
|
68
|
+
icon: "lucide:upload",
|
|
69
|
+
color: "neutral",
|
|
70
|
+
variant: "outline",
|
|
71
|
+
onClick: ($event) => open()
|
|
72
|
+
}, null, 8, ["label", "onClick"])]),
|
|
73
|
+
"files-top": withCtx(({ open, files }) => [toFileList(files).length ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("p", _hoisted_2, toDisplayString(props.labelPreview) + " (" + toDisplayString(toFileList(files).length) + ") ", 1), props.multiple ? (openBlock(), createBlock(PButton, {
|
|
74
|
+
key: 0,
|
|
75
|
+
icon: "lucide-plus",
|
|
76
|
+
label: props.labelAddMore,
|
|
77
|
+
class: "-my-2",
|
|
78
|
+
color: "neutral",
|
|
79
|
+
variant: "outline",
|
|
80
|
+
onClick: ($event) => open()
|
|
81
|
+
}, null, 8, ["label", "onClick"])) : createCommentVNode("v-if", true)])) : createCommentVNode("v-if", true)]),
|
|
82
|
+
_: 1
|
|
83
|
+
}, 16, ["modelValue"]);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
export { _sfc_main as default };
|