mortise-tenon-design 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.mjs +9 -11
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/package.json.mjs +1 -1
- package/dist/es/src/expand/index.mjs.map +1 -1
- package/dist/es/src/expand/src/expand.css +1 -1
- package/dist/es/src/expand/src/expand.vue.mjs +1 -1
- package/dist/es/src/expand/src/expand.vue2.mjs +11 -12
- package/dist/es/src/expand/src/expand.vue2.mjs.map +1 -1
- package/dist/es/src/installer.mjs +9 -9
- package/dist/es/src/installer.mjs.map +1 -1
- package/dist/es/src/resize/index.mjs +8 -0
- package/dist/es/src/resize/index.mjs.map +1 -0
- package/dist/es/src/resize/src/resize.css +1 -0
- package/dist/es/src/resize/src/resize.vue.mjs +8 -0
- package/dist/es/src/resize/src/resize.vue.mjs.map +1 -0
- package/dist/es/src/resize/src/resize.vue2.mjs +84 -0
- package/dist/es/src/resize/src/resize.vue2.mjs.map +1 -0
- package/dist/es/src/sort/index.mjs.map +1 -1
- package/dist/es/src/sort/src/sort.mjs +25 -28
- package/dist/es/src/sort/src/sort.mjs.map +1 -1
- package/dist/es/src/table/index.mjs.map +1 -1
- package/dist/es/src/table/src/table.vue2.mjs +59 -77
- package/dist/es/src/table/src/table.vue2.mjs.map +1 -1
- package/dist/es/src/utils/install.mjs.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/package.json.js +1 -1
- package/dist/lib/src/expand/index.js.map +1 -1
- package/dist/lib/src/expand/src/expand.css +1 -1
- package/dist/lib/src/expand/src/expand.vue.js +1 -1
- package/dist/lib/src/expand/src/expand.vue2.js +1 -1
- package/dist/lib/src/expand/src/expand.vue2.js.map +1 -1
- package/dist/lib/src/installer.js +1 -1
- package/dist/lib/src/installer.js.map +1 -1
- package/dist/lib/src/{component-neo → resize}/index.js +2 -1
- package/dist/lib/src/resize/index.js.map +1 -0
- package/dist/lib/src/resize/src/resize.css +1 -0
- package/dist/lib/src/resize/src/resize.vue.js +2 -0
- package/dist/lib/src/resize/src/resize.vue.js.map +1 -0
- package/dist/lib/src/resize/src/resize.vue2.js +2 -0
- package/dist/lib/src/resize/src/resize.vue2.js.map +1 -0
- package/dist/lib/src/sort/index.js.map +1 -1
- package/dist/lib/src/sort/src/sort.js +1 -1
- package/dist/lib/src/sort/src/sort.js.map +1 -1
- package/dist/lib/src/table/index.js.map +1 -1
- package/dist/lib/src/table/src/table.vue2.js +1 -1
- package/dist/lib/src/table/src/table.vue2.js.map +1 -1
- package/dist/lib/src/utils/install.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/resize/index.d.ts +47 -0
- package/dist/types/resize/src/resize.d.ts +29 -0
- package/dist/types/resize/src/resize.vue.d.ts +34 -0
- package/global.d.ts +2 -2
- package/package.json +3 -2
- package/dist/es/src/component-neo/index.mjs +0 -9
- package/dist/es/src/component-neo/index.mjs.map +0 -1
- package/dist/es/src/component-neo/src/component-neo.vue.mjs +0 -34
- package/dist/es/src/component-neo/src/component-neo.vue.mjs.map +0 -1
- package/dist/es/src/component-neo/src/component-neo.vue2.mjs +0 -5
- package/dist/es/src/component-neo/src/component-neo.vue2.mjs.map +0 -1
- package/dist/es/src/component-neo/src/hooks/use-component-neo.mjs +0 -29
- package/dist/es/src/component-neo/src/hooks/use-component-neo.mjs.map +0 -1
- package/dist/es/src/component-neo/src/hooks/use-component-state.mjs +0 -36
- package/dist/es/src/component-neo/src/hooks/use-component-state.mjs.map +0 -1
- package/dist/lib/src/component-neo/index.js.map +0 -1
- package/dist/lib/src/component-neo/src/component-neo.vue.js +0 -2
- package/dist/lib/src/component-neo/src/component-neo.vue.js.map +0 -1
- package/dist/lib/src/component-neo/src/component-neo.vue2.js +0 -2
- package/dist/lib/src/component-neo/src/component-neo.vue2.js.map +0 -1
- package/dist/lib/src/component-neo/src/hooks/use-component-neo.js +0 -2
- package/dist/lib/src/component-neo/src/hooks/use-component-neo.js.map +0 -1
- package/dist/lib/src/component-neo/src/hooks/use-component-state.js +0 -2
- package/dist/lib/src/component-neo/src/hooks/use-component-state.js.map +0 -1
- package/dist/types/component-neo/index.d.ts +0 -48
- package/dist/types/component-neo/src/component-neo.d.ts +0 -9
- package/dist/types/component-neo/src/component-neo.vue.d.ts +0 -33
- package/dist/types/component-neo/src/hooks/use-component-neo.d.ts +0 -8
- package/dist/types/component-neo/src/hooks/use-component-state.d.ts +0 -30
package/dist/es/index.mjs
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
import t from "./src/installer.mjs";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import { MtSort as
|
5
|
-
import { MtTable as
|
6
|
-
import { useComponentNeo as s } from "./src/component-neo/src/hooks/use-component-neo.mjs";
|
2
|
+
import { MtExpand as p } from "./src/expand/index.mjs";
|
3
|
+
import { MtResize as m } from "./src/resize/index.mjs";
|
4
|
+
import { MtSort as a } from "./src/sort/index.mjs";
|
5
|
+
import { MtTable as M } from "./src/table/index.mjs";
|
7
6
|
export {
|
8
|
-
p as
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
t as default
|
13
|
-
s as useComponentNeo
|
7
|
+
p as MtExpand,
|
8
|
+
m as MtResize,
|
9
|
+
a as MtSort,
|
10
|
+
M as MtTable,
|
11
|
+
t as default
|
14
12
|
};
|
15
13
|
//# sourceMappingURL=index.mjs.map
|
package/dist/es/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
package/dist/es/package.json.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../src/expand/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\nimport Expand from './src/expand.vue';\n\nexport const MtExpand = withInstall(Expand);\n\nexport * from './src/expand';\n"],"names":["MtExpand","withInstall","Expand"],"mappings":";;
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/expand/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\nimport Expand from './src/expand.vue';\n\nexport const MtExpand = withInstall(Expand);\n\nexport * from './src/expand';\n"],"names":["MtExpand","withInstall","Expand"],"mappings":";;AAGO,MAAMA,IAAWC,EAAYC,CAAM;"}
|
@@ -1 +1 @@
|
|
1
|
-
.mt-expand[data-v-
|
1
|
+
.mt-expand[data-v-80e6c6dd]{overflow:hidden}.mt-expand-transition[data-v-80e6c6dd]{transition:height var(--662fdf4a) ease-in-out}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import o from "./expand.vue2.mjs";
|
2
2
|
/* empty css */
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
4
|
-
const d = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
4
|
+
const d = /* @__PURE__ */ t(o, [["__scopeId", "data-v-80e6c6dd"]]);
|
5
5
|
export {
|
6
6
|
d as default
|
7
7
|
};
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { defineComponent as
|
1
|
+
import { defineComponent as p, useCssVars as c, computed as o, ref as r, createElementBlock as f, openBlock as m, normalizeStyle as d, normalizeClass as v, renderSlot as g } from "vue";
|
2
2
|
import { useResizeObserver as R, useDebounceFn as x } from "@vueuse/core";
|
3
|
-
const h = /* @__PURE__ */
|
3
|
+
const h = /* @__PURE__ */ p({
|
4
4
|
name: "MtExpand",
|
5
5
|
__name: "expand",
|
6
6
|
props: {
|
@@ -9,23 +9,22 @@ const h = /* @__PURE__ */ c({
|
|
9
9
|
transitionTime: { default: 200 }
|
10
10
|
},
|
11
11
|
setup(i) {
|
12
|
-
|
13
|
-
"
|
12
|
+
c((t) => ({
|
13
|
+
"662fdf4a": l.value
|
14
14
|
}));
|
15
|
-
const
|
15
|
+
const e = i, l = o(() => `${e.transitionTime}ms`), a = r(), n = r(0);
|
16
16
|
R(a, x(() => {
|
17
|
-
|
18
|
-
n.value = ((e = a.value) == null ? void 0 : e.scrollHeight) || 0;
|
17
|
+
n.value = a.value?.scrollHeight || 0;
|
19
18
|
}, 200));
|
20
|
-
const s = o(() => n.value >
|
21
|
-
return (
|
19
|
+
const s = o(() => n.value > e.targetRange), u = o(() => !n.value && e.open ? {} : { height: `${!s.value || e.open ? n.value : e.targetRange}px` });
|
20
|
+
return (t, y) => (m(), f("div", {
|
22
21
|
ref_key: "contentRef",
|
23
22
|
ref: a,
|
24
|
-
class: v(["mt-expand", { "mt-expand-transition": !!
|
23
|
+
class: v(["mt-expand", { "mt-expand-transition": !!t.transitionTime }]),
|
25
24
|
style: d(u.value)
|
26
25
|
}, [
|
27
|
-
g(
|
28
|
-
open:
|
26
|
+
g(t.$slots, "default", {
|
27
|
+
open: t.open,
|
29
28
|
isOutRange: s.value
|
30
29
|
}, void 0, !0)
|
31
30
|
], 6));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"expand.vue2.mjs","sources":["../../../../../src/expand/src/expand.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ExpandProps } from './expand.ts';\nimport { useDebounceFn, useResizeObserver } from '@vueuse/core';\nimport { computed, ref } from 'vue';\n\ndefineOptions({ name: 'MtExpand' });\n\nconst props = withDefaults(defineProps<ExpandProps>(), {\n open: false,\n targetRange: 0,\n transitionTime: 200,\n});\n\nconst transitionDuration = computed(() => `${props.transitionTime}ms`);\n\n/** 容器实例 */\nconst contentRef = ref<HTMLDivElement>();\n/** 容器的范围 */\nconst contentRange = ref(0);\n// 监听容器变化\nuseResizeObserver(contentRef, useDebounceFn(() => {\n contentRange.value = contentRef.value?.scrollHeight || 0;\n}, 200));\n\n/** 是否超出目标范围 */\nconst isOutRange = computed(() => contentRange.value > props.targetRange);\n\n/** 展开或收起后容器样式 */\nconst contentStyle = computed(() => {\n if (!contentRange.value) {\n return {};\n }\n const size = !isOutRange.value || props.open ? contentRange.value : props.targetRange;\n return { height: `${size}px` };\n});\n</script>\n\n<template>\n <div\n ref=\"contentRef\"\n class=\"mt-expand\"\n :class=\"{ 'mt-expand-transition': !!transitionTime }\"\n :style=\"contentStyle\"\n >\n <slot :open=\"open\" :is-out-range=\"isOutRange\" />\n </div>\n</template>\n\n<style lang=\"scss\" scoped>\n.mt-expand {\n overflow: hidden;\n}\n\n.mt-expand-transition {\n transition: height v-bind(transitionDuration) ease-in-out;\n}\n</style>\n"],"names":["props","__props","transitionDuration","computed","contentRef","ref","contentRange","useResizeObserver","useDebounceFn","
|
1
|
+
{"version":3,"file":"expand.vue2.mjs","sources":["../../../../../src/expand/src/expand.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ExpandProps } from './expand.ts';\nimport { useDebounceFn, useResizeObserver } from '@vueuse/core';\nimport { computed, ref } from 'vue';\n\ndefineOptions({ name: 'MtExpand' });\n\nconst props = withDefaults(defineProps<ExpandProps>(), {\n open: false,\n targetRange: 0,\n transitionTime: 200,\n});\n\nconst transitionDuration = computed(() => `${props.transitionTime}ms`);\n\n/** 容器实例 */\nconst contentRef = ref<HTMLDivElement>();\n/** 容器的范围 */\nconst contentRange = ref(0);\n// 监听容器变化\nuseResizeObserver(contentRef, useDebounceFn(() => {\n contentRange.value = contentRef.value?.scrollHeight || 0;\n}, 200));\n\n/** 是否超出目标范围 */\nconst isOutRange = computed(() => contentRange.value > props.targetRange);\n\n/** 展开或收起后容器样式 */\nconst contentStyle = computed(() => {\n if (!contentRange.value && props.open) {\n return {};\n }\n const size = !isOutRange.value || props.open ? contentRange.value : props.targetRange;\n return { height: `${size}px` };\n});\n</script>\n\n<template>\n <div\n ref=\"contentRef\"\n class=\"mt-expand\"\n :class=\"{ 'mt-expand-transition': !!transitionTime }\"\n :style=\"contentStyle\"\n >\n <slot :open=\"open\" :is-out-range=\"isOutRange\" />\n </div>\n</template>\n\n<style lang=\"scss\" scoped>\n.mt-expand {\n overflow: hidden;\n}\n\n.mt-expand-transition {\n transition: height v-bind(transitionDuration) ease-in-out;\n}\n</style>\n"],"names":["props","__props","transitionDuration","computed","contentRef","ref","contentRange","useResizeObserver","useDebounceFn","isOutRange","contentStyle"],"mappings":";;;;;;;;;;;;;;AAOA,UAAMA,IAAQC,GAMRC,IAAqBC,EAAS,MAAM,GAAGH,EAAM,cAAc,IAAI,GAG/DI,IAAaC,EAAA,GAEbC,IAAeD,EAAI,CAAC;AAE1B,IAAAE,EAAkBH,GAAYI,EAAc,MAAM;AAChD,MAAAF,EAAa,QAAQF,EAAW,OAAO,gBAAgB;AAAA,IACzD,GAAG,GAAG,CAAC;AAGP,UAAMK,IAAaN,EAAS,MAAMG,EAAa,QAAQN,EAAM,WAAW,GAGlEU,IAAeP,EAAS,MACxB,CAACG,EAAa,SAASN,EAAM,OACxB,CAAA,IAGF,EAAE,QAAQ,GADJ,CAACS,EAAW,SAAST,EAAM,OAAOM,EAAa,QAAQN,EAAM,WAClD,KAAA,CACzB;;;;;;;;;;;;;;"}
|
@@ -1,24 +1,24 @@
|
|
1
|
-
import { version as
|
2
|
-
import { MtComponentNeo as m } from "./component-neo/index.mjs";
|
1
|
+
import { version as n } from "../package.json.mjs";
|
3
2
|
import { MtExpand as i } from "./expand/index.mjs";
|
3
|
+
import { MtResize as m } from "./resize/index.mjs";
|
4
4
|
import { MtSort as l } from "./sort/index.mjs";
|
5
5
|
import { MtTable as s } from "./table/index.mjs";
|
6
|
-
const
|
7
|
-
function f(
|
6
|
+
const r = Symbol("MT_INSTALLED_KEY");
|
7
|
+
function f(o = []) {
|
8
8
|
return {
|
9
|
-
version:
|
9
|
+
version: n,
|
10
10
|
install: (t) => {
|
11
|
-
t[
|
11
|
+
t[r] || (t[r] = !0, o.forEach((e) => t.use(e)));
|
12
12
|
}
|
13
13
|
};
|
14
14
|
}
|
15
|
-
const
|
16
|
-
m,
|
15
|
+
const S = f([
|
17
16
|
i,
|
17
|
+
m,
|
18
18
|
l,
|
19
19
|
s
|
20
20
|
]);
|
21
21
|
export {
|
22
|
-
|
22
|
+
S as default
|
23
23
|
};
|
24
24
|
//# sourceMappingURL=installer.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"installer.mjs","sources":["../../../src/installer.ts"],"sourcesContent":["import type { App, Component, Plugin } from 'vue';\nimport { version } from '../package.json';\nimport {
|
1
|
+
{"version":3,"file":"installer.mjs","sources":["../../../src/installer.ts"],"sourcesContent":["import type { App, Component, Plugin } from 'vue';\nimport { version } from '../package.json';\nimport { MtExpand } from './expand';\nimport { MtResize } from './resize';\nimport { MtSort } from './sort';\nimport { MtTable } from './table';\n\nconst INSTALLED_KEY = Symbol('MT_INSTALLED_KEY');\n\nfunction makeInstaller(components: Component[] = []) {\n const install = (app: App & { [INSTALLED_KEY]?: boolean }) => {\n if (app[INSTALLED_KEY]) { return; }\n\n app[INSTALLED_KEY] = true;\n components.forEach(c => app.use(c as Plugin));\n };\n\n return {\n version,\n install,\n };\n}\n\nconst installer = makeInstaller([\n MtExpand,\n MtResize,\n MtSort,\n MtTable,\n]);\n\nexport default installer;\n"],"names":["INSTALLED_KEY","makeInstaller","components","version","app","c","installer","MtExpand","MtResize","MtSort","MtTable"],"mappings":";;;;;AAOA,MAAMA,IAAgB,OAAO,kBAAkB;AAE/C,SAASC,EAAcC,IAA0B,IAAI;AAQnD,SAAO;AAAA,IACL,SAAAC;AAAA,IACA,SATc,CAACC,MAA6C;AAC5D,MAAIA,EAAIJ,CAAa,MAErBI,EAAIJ,CAAa,IAAI,IACrBE,EAAW,QAAQ,CAAAG,MAAKD,EAAI,IAAIC,CAAW,CAAC;AAAA,IAC9C;AAAA,EAIE;AAEJ;AAEA,MAAMC,IAAYL,EAAc;AAAA,EAC9BM;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AACF,CAAC;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/resize/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\r\nimport Resize from './src/resize.vue';\r\n\r\nexport const MtResize = withInstall(Resize);\r\n\r\nexport * from './src/resize';\r\n"],"names":["MtResize","withInstall","Resize"],"mappings":";;AAGO,MAAMA,IAAWC,EAAYC,CAAM;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
.mt-resize[data-v-d512c549]{position:relative;overflow:visible}.mt-resize .left-box[data-v-d512c549]{position:absolute;top:4px;left:-4px;width:8px;height:calc(100% - 8px);cursor:w-resize}.mt-resize .right-box[data-v-d512c549]{position:absolute;top:4px;right:-4px;width:8px;height:calc(100% - 8px);cursor:e-resize}.mt-resize .top-box[data-v-d512c549]{position:absolute;top:-4px;left:4px;width:calc(100% - 8px);height:8px;cursor:n-resize}.mt-resize .bottom-box[data-v-d512c549]{position:absolute;bottom:-4px;left:4px;width:calc(100% - 8px);height:8px;cursor:s-resize}.mt-resize .left-top-box[data-v-d512c549]{position:absolute;top:-4px;left:-4px;width:8px;height:8px;cursor:nw-resize}.mt-resize .right-top-box[data-v-d512c549]{position:absolute;top:-4px;right:-4px;width:8px;height:8px;cursor:ne-resize}.mt-resize .left-bottom-box[data-v-d512c549]{position:absolute;bottom:-4px;left:-4px;width:8px;height:8px;cursor:sw-resize}.mt-resize .right-bottom-box[data-v-d512c549]{position:absolute;right:-4px;bottom:-4px;width:8px;height:8px;cursor:se-resize}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resize.vue.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import { defineComponent as w, ref as b, computed as d, createElementBlock as o, openBlock as i, createCommentVNode as n, renderSlot as z, Fragment as P, withModifiers as r } from "vue";
|
2
|
+
import { domResize as A } from "dom-transform-tool";
|
3
|
+
const x = /* @__PURE__ */ w({
|
4
|
+
name: "MtResize",
|
5
|
+
__name: "resize",
|
6
|
+
props: {
|
7
|
+
disabled: { type: Boolean, default: !1 },
|
8
|
+
offset: {},
|
9
|
+
directions: { default: () => ["right"] },
|
10
|
+
lockAspectRatio: { type: Boolean, default: !1 },
|
11
|
+
grid: { default: () => [0.5, 0.5] }
|
12
|
+
},
|
13
|
+
emits: ["resize"],
|
14
|
+
setup(c, { emit: g }) {
|
15
|
+
const u = c, R = g, m = b(), k = b("");
|
16
|
+
function s(l, e) {
|
17
|
+
k.value = e, A({
|
18
|
+
event: l,
|
19
|
+
direction: e,
|
20
|
+
target: m.value,
|
21
|
+
offset: u.offset,
|
22
|
+
lockAspectRatio: u.lockAspectRatio,
|
23
|
+
grid: u.grid,
|
24
|
+
callback: (t, y) => {
|
25
|
+
R("resize", t, y);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
}
|
29
|
+
const p = d(() => u.directions.includes("left")), a = d(() => u.directions.includes("right")), f = d(() => u.directions.includes("top")), v = d(() => u.directions.includes("bottom"));
|
30
|
+
return (l, e) => (i(), o("div", {
|
31
|
+
ref_key: "contentRef",
|
32
|
+
ref: m,
|
33
|
+
class: "mt-resize"
|
34
|
+
}, [
|
35
|
+
l.disabled ? n("", !0) : (i(), o(P, { key: 0 }, [
|
36
|
+
p.value && !l.lockAspectRatio ? (i(), o("div", {
|
37
|
+
key: 0,
|
38
|
+
class: "left-box",
|
39
|
+
onPointerdown: e[0] || (e[0] = r((t) => s(t, "left"), ["stop", "prevent"]))
|
40
|
+
}, null, 32)) : n("", !0),
|
41
|
+
a.value && !l.lockAspectRatio ? (i(), o("div", {
|
42
|
+
key: 1,
|
43
|
+
class: "right-box",
|
44
|
+
onPointerdown: e[1] || (e[1] = r((t) => s(t, "right"), ["stop", "prevent"]))
|
45
|
+
}, null, 32)) : n("", !0),
|
46
|
+
f.value && !l.lockAspectRatio ? (i(), o("div", {
|
47
|
+
key: 2,
|
48
|
+
class: "top-box",
|
49
|
+
onPointerdown: e[2] || (e[2] = r((t) => s(t, "top"), ["stop", "prevent"]))
|
50
|
+
}, null, 32)) : n("", !0),
|
51
|
+
v.value && !l.lockAspectRatio ? (i(), o("div", {
|
52
|
+
key: 3,
|
53
|
+
class: "bottom-box",
|
54
|
+
onPointerdown: e[3] || (e[3] = r((t) => s(t, "bottom"), ["stop", "prevent"]))
|
55
|
+
}, null, 32)) : n("", !0),
|
56
|
+
p.value && f.value ? (i(), o("div", {
|
57
|
+
key: 4,
|
58
|
+
class: "left-top-box",
|
59
|
+
onPointerdown: e[4] || (e[4] = r((t) => s(t, "left-top"), ["stop", "prevent"]))
|
60
|
+
}, null, 32)) : n("", !0),
|
61
|
+
a.value && f.value ? (i(), o("div", {
|
62
|
+
key: 5,
|
63
|
+
class: "right-top-box",
|
64
|
+
onPointerdown: e[5] || (e[5] = r((t) => s(t, "right-top"), ["stop", "prevent"]))
|
65
|
+
}, null, 32)) : n("", !0),
|
66
|
+
p.value && v.value ? (i(), o("div", {
|
67
|
+
key: 6,
|
68
|
+
class: "left-bottom-box",
|
69
|
+
onPointerdown: e[6] || (e[6] = r((t) => s(t, "left-bottom"), ["stop", "prevent"]))
|
70
|
+
}, null, 32)) : n("", !0),
|
71
|
+
a.value && v.value ? (i(), o("div", {
|
72
|
+
key: 7,
|
73
|
+
class: "right-bottom-box",
|
74
|
+
onPointerdown: e[7] || (e[7] = r((t) => s(t, "right-bottom"), ["stop", "prevent"]))
|
75
|
+
}, null, 32)) : n("", !0)
|
76
|
+
], 64)),
|
77
|
+
z(l.$slots, "default", { direction: k.value }, void 0, !0)
|
78
|
+
], 512));
|
79
|
+
}
|
80
|
+
});
|
81
|
+
export {
|
82
|
+
x as default
|
83
|
+
};
|
84
|
+
//# sourceMappingURL=resize.vue2.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resize.vue2.mjs","sources":["../../../../../src/resize/src/resize.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { DomResizeContent, DomResizeDirection, DomResizeStyle } from 'dom-transform-tool';\r\nimport type { ResizeProps } from './resize';\r\nimport { domResize } from 'dom-transform-tool';\r\nimport { computed, ref } from 'vue';\r\n\r\ndefineOptions({ name: 'MtResize' });\r\n\r\nconst props = withDefaults(\r\n defineProps<ResizeProps>(),\r\n {\r\n disabled: false,\r\n directions: () => ['right'],\r\n lockAspectRatio: false,\r\n grid: () => [0.5, 0.5],\r\n },\r\n);\r\n\r\nconst emit = defineEmits<{\r\n (e: 'resize', content: DomResizeContent, style: DomResizeStyle): void\r\n}>();\r\n\r\n/** 元素实例 */\r\nconst contentRef = ref<HTMLDivElement>();\r\n/** 调整的方向 */\r\nconst resizeDirection = ref('');\r\n/** 调整函数 */\r\nfunction handleResize(event: PointerEvent, direction: DomResizeDirection) {\r\n resizeDirection.value = direction;\r\n domResize({\r\n event,\r\n direction,\r\n target: contentRef.value,\r\n offset: props.offset,\r\n lockAspectRatio: props.lockAspectRatio,\r\n grid: props.grid,\r\n callback: (content, style) => {\r\n emit('resize', content, style);\r\n },\r\n });\r\n};\r\n\r\nconst isLeftDir = computed(() => props.directions.includes('left'));\r\nconst isRightDir = computed(() => props.directions.includes('right'));\r\nconst isTopDir = computed(() => props.directions.includes('top'));\r\nconst isBottomDir = computed(() => props.directions.includes('bottom'));\r\n</script>\r\n\r\n<template>\r\n <div\r\n ref=\"contentRef\"\r\n class=\"mt-resize\"\r\n >\r\n <template v-if=\"!disabled\">\r\n <div v-if=\"isLeftDir && !lockAspectRatio\" class=\"left-box\" @pointerdown.stop.prevent=\"(e) => handleResize(e, 'left')\" />\r\n <div v-if=\"isRightDir && !lockAspectRatio\" class=\"right-box\" @pointerdown.stop.prevent=\"(e) => handleResize(e, 'right')\" />\r\n <div v-if=\"isTopDir && !lockAspectRatio\" class=\"top-box\" @pointerdown.stop.prevent=\"(e) => handleResize(e, 'top')\" />\r\n <div v-if=\"isBottomDir && !lockAspectRatio\" class=\"bottom-box\" @pointerdown.stop.prevent=\"(e) => handleResize(e, 'bottom')\" />\r\n <div v-if=\"isLeftDir && isTopDir\" class=\"left-top-box\" @pointerdown.stop.prevent=\"(e) => handleResize(e, 'left-top')\" />\r\n <div v-if=\"isRightDir && isTopDir\" class=\"right-top-box\" @pointerdown.stop.prevent=\"(e) => handleResize(e, 'right-top')\" />\r\n <div v-if=\"isLeftDir && isBottomDir\" class=\"left-bottom-box\" @pointerdown.stop.prevent=\"(e) => handleResize(e, 'left-bottom')\" />\r\n <div v-if=\"isRightDir && isBottomDir\" class=\"right-bottom-box\" @pointerdown.stop.prevent=\"(e) => handleResize(e, 'right-bottom')\" />\r\n </template>\r\n <slot :direction=\"resizeDirection\" />\r\n </div>\r\n</template>\r\n\r\n<style scoped lang=\"scss\">\r\n.mt-resize {\r\n position: relative;\r\n overflow: visible;\r\n\r\n .left-box {\r\n position: absolute;\r\n top: 4px;\r\n left: -4px;\r\n width: 8px;\r\n height: calc(100% - 8px);\r\n cursor: w-resize;\r\n }\r\n\r\n .right-box {\r\n position: absolute;\r\n top: 4px;\r\n right: -4px;\r\n width: 8px;\r\n height: calc(100% - 8px);\r\n cursor: e-resize;\r\n }\r\n\r\n .top-box {\r\n position: absolute;\r\n top: -4px;\r\n left: 4px;\r\n width: calc(100% - 8px);\r\n height: 8px;\r\n cursor: n-resize;\r\n }\r\n\r\n .bottom-box {\r\n position: absolute;\r\n bottom: -4px;\r\n left: 4px;\r\n width: calc(100% - 8px);\r\n height: 8px;\r\n cursor: s-resize;\r\n }\r\n\r\n .left-top-box {\r\n position: absolute;\r\n top: -4px;\r\n left: -4px;\r\n width: 8px;\r\n height: 8px;\r\n cursor: nw-resize;\r\n }\r\n\r\n .right-top-box {\r\n position: absolute;\r\n top: -4px;\r\n right: -4px;\r\n width: 8px;\r\n height: 8px;\r\n cursor: ne-resize;\r\n }\r\n\r\n .left-bottom-box {\r\n position: absolute;\r\n bottom: -4px;\r\n left: -4px;\r\n width: 8px;\r\n height: 8px;\r\n cursor: sw-resize;\r\n }\r\n\r\n .right-bottom-box {\r\n position: absolute;\r\n right: -4px;\r\n bottom: -4px;\r\n width: 8px;\r\n height: 8px;\r\n cursor: se-resize;\r\n }\r\n}\r\n</style>\r\n"],"names":["props","__props","emit","__emit","contentRef","ref","resizeDirection","handleResize","event","direction","domResize","content","style","isLeftDir","computed","isRightDir","isTopDir","isBottomDir"],"mappings":";;;;;;;;;;;;;;AAQA,UAAMA,IAAQC,GAURC,IAAOC,GAKPC,IAAaC,EAAA,GAEbC,IAAkBD,EAAI,EAAE;AAE9B,aAASE,EAAaC,GAAqBC,GAA+B;AACxE,MAAAH,EAAgB,QAAQG,GACxBC,EAAU;AAAA,QACR,OAAAF;AAAA,QACA,WAAAC;AAAA,QACA,QAAQL,EAAW;AAAA,QACnB,QAAQJ,EAAM;AAAA,QACd,iBAAiBA,EAAM;AAAA,QACvB,MAAMA,EAAM;AAAA,QACZ,UAAU,CAACW,GAASC,MAAU;AAC5B,UAAAV,EAAK,UAAUS,GAASC,CAAK;AAAA,QAC/B;AAAA,MAAA,CACD;AAAA,IACH;AAEA,UAAMC,IAAYC,EAAS,MAAMd,EAAM,WAAW,SAAS,MAAM,CAAC,GAC5De,IAAaD,EAAS,MAAMd,EAAM,WAAW,SAAS,OAAO,CAAC,GAC9DgB,IAAWF,EAAS,MAAMd,EAAM,WAAW,SAAS,KAAK,CAAC,GAC1DiB,IAAcH,EAAS,MAAMd,EAAM,WAAW,SAAS,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../src/sort/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\nimport Sort from './src/sort';\n\nexport const MtSort = withInstall(Sort);\n\nexport * from './src/sort';\n"],"names":["MtSort","withInstall","Sort"],"mappings":";;
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/sort/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\nimport Sort from './src/sort';\n\nexport const MtSort = withInstall(Sort);\n\nexport * from './src/sort';\n"],"names":["MtSort","withInstall","Sort"],"mappings":";;AAGO,MAAMA,IAASC,EAAYC,CAAI;"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { defineComponent as
|
2
|
-
const
|
1
|
+
import { defineComponent as u, computed as l } from "vue";
|
2
|
+
const d = u({
|
3
3
|
name: "MtSort",
|
4
4
|
props: {
|
5
5
|
/** 排序配置 */
|
@@ -13,42 +13,39 @@ const h = l({
|
|
13
13
|
default: "sort-key"
|
14
14
|
}
|
15
15
|
},
|
16
|
-
setup(
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
return u(t.keyName, e, t.sortList, r);
|
16
|
+
setup(r, { slots: o }) {
|
17
|
+
const n = l(() => {
|
18
|
+
const t = o.default?.() || [], e = f(r.keyName, t), s = Array.from(new Set(r.sortList)).map((i) => e[i]).filter(Boolean);
|
19
|
+
return a(r.keyName, t, r.sortList, s);
|
21
20
|
});
|
22
|
-
return () =>
|
21
|
+
return () => n.value;
|
23
22
|
}
|
24
23
|
});
|
25
|
-
function
|
26
|
-
return
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
o[n] ? console.warn(`<mt-sort> ${t}: ${n} repeat`) : o[n] = e;
|
24
|
+
function f(r, o, n = {}) {
|
25
|
+
return o.forEach((t) => {
|
26
|
+
const e = t.props?.[r];
|
27
|
+
if (e) {
|
28
|
+
n[e] ? console.warn(`<mt-sort> ${r}: ${e} repeat`) : n[e] = t;
|
31
29
|
return;
|
32
30
|
}
|
33
|
-
Array.isArray(
|
34
|
-
}),
|
31
|
+
Array.isArray(t.children) && f(r, t.children, n);
|
32
|
+
}), n;
|
35
33
|
}
|
36
|
-
function
|
37
|
-
const
|
38
|
-
return
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
n.push(f);
|
34
|
+
function a(r, o, n, t) {
|
35
|
+
const e = [];
|
36
|
+
return o.forEach((s) => {
|
37
|
+
const i = s.props?.[r];
|
38
|
+
if (i && n.includes(i)) {
|
39
|
+
const c = t.shift();
|
40
|
+
if (c) {
|
41
|
+
e.push(c);
|
45
42
|
return;
|
46
43
|
}
|
47
44
|
}
|
48
|
-
Array.isArray(
|
49
|
-
}),
|
45
|
+
Array.isArray(s.children) && (s = { ...s }, s.children = a(r, s.children, n, t)), e.push(s);
|
46
|
+
}), e;
|
50
47
|
}
|
51
48
|
export {
|
52
|
-
|
49
|
+
d as default
|
53
50
|
};
|
54
51
|
//# sourceMappingURL=sort.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sort.mjs","sources":["../../../../../src/sort/src/sort.ts"],"sourcesContent":["import type { PropType, VNode } from 'vue';\nimport { computed, defineComponent } from 'vue';\n\nexport interface SortProps {\n /** 排序配置 */\n sortList?: (string | number)[]\n /** 排序key名 */\n keyName?: string\n}\n\nexport default defineComponent({\n name: 'MtSort',\n props: {\n /** 排序配置 */\n sortList: {\n type: Array as PropType<(string | number)[]>,\n default: () => [],\n },\n /** 排序key名 */\n keyName: {\n type: String,\n default: 'sort-key',\n },\n },\n setup(props, { slots }) {\n const renderVNodes = computed(() => {\n const vNodeList = slots.default?.() || [];\n const sortVNodeMap = getVNodeMap(props.keyName, vNodeList);\n const sortVNodeList = Array.from(new Set(props.sortList)).map(key => sortVNodeMap[key]).filter(Boolean);\n return sortDefaultVNodes(props.keyName, vNodeList, props.sortList, sortVNodeList);\n });\n\n return () => renderVNodes.value;\n },\n});\n\n/** 获取插槽中需要排序的节点 */\nfunction getVNodeMap(keyName: string, vNodeList: VNode[], vNodeMap: Record<(string | number), VNode> = {}) {\n vNodeList.forEach((item) => {\n const sortKey = item.props?.[keyName];\n if (sortKey) {\n if (vNodeMap[sortKey]) {\n console.warn(`<mt-sort> ${keyName}: ${sortKey} repeat`);\n }\n else {\n vNodeMap[sortKey] = item;\n }\n return;\n }\n if (Array.isArray(item.children)) {\n getVNodeMap(keyName, item.children as VNode[], vNodeMap);\n }\n });\n return vNodeMap;\n}\n\n/** 根据排序后的节点跟换位置 */\nfunction sortDefaultVNodes(keyName: string, vNodeList: VNode[], sortList: (string | number)[], sortVNodeList: VNode[]) {\n const newList: VNode[] = [];\n vNodeList.forEach((vNode) => {\n const sortKey = vNode.props?.[keyName];\n if (sortKey && sortList.includes(sortKey)) {\n const sortVNode = sortVNodeList.shift();\n if (sortVNode) {\n newList.push(sortVNode);\n return;\n }\n }\n if (Array.isArray(vNode.children)) {\n vNode = { ...vNode }; // 避免修改原节点数据\n vNode.children = sortDefaultVNodes(keyName, vNode.children as VNode[], sortList, sortVNodeList);\n }\n newList.push(vNode);\n });\n return newList;\n}\n"],"names":["Sort","defineComponent","props","slots","renderVNodes","computed","vNodeList","
|
1
|
+
{"version":3,"file":"sort.mjs","sources":["../../../../../src/sort/src/sort.ts"],"sourcesContent":["import type { PropType, VNode } from 'vue';\nimport { computed, defineComponent } from 'vue';\n\nexport interface SortProps {\n /** 排序配置 */\n sortList?: (string | number)[]\n /** 排序key名 */\n keyName?: string\n}\n\nexport default defineComponent({\n name: 'MtSort',\n props: {\n /** 排序配置 */\n sortList: {\n type: Array as PropType<(string | number)[]>,\n default: () => [],\n },\n /** 排序key名 */\n keyName: {\n type: String,\n default: 'sort-key',\n },\n },\n setup(props, { slots }) {\n const renderVNodes = computed(() => {\n const vNodeList = slots.default?.() || [];\n const sortVNodeMap = getVNodeMap(props.keyName, vNodeList);\n const sortVNodeList = Array.from(new Set(props.sortList)).map(key => sortVNodeMap[key]).filter(Boolean);\n return sortDefaultVNodes(props.keyName, vNodeList, props.sortList, sortVNodeList);\n });\n\n return () => renderVNodes.value;\n },\n});\n\n/** 获取插槽中需要排序的节点 */\nfunction getVNodeMap(keyName: string, vNodeList: VNode[], vNodeMap: Record<(string | number), VNode> = {}) {\n vNodeList.forEach((item) => {\n const sortKey = item.props?.[keyName];\n if (sortKey) {\n if (vNodeMap[sortKey]) {\n console.warn(`<mt-sort> ${keyName}: ${sortKey} repeat`);\n }\n else {\n vNodeMap[sortKey] = item;\n }\n return;\n }\n if (Array.isArray(item.children)) {\n getVNodeMap(keyName, item.children as VNode[], vNodeMap);\n }\n });\n return vNodeMap;\n}\n\n/** 根据排序后的节点跟换位置 */\nfunction sortDefaultVNodes(keyName: string, vNodeList: VNode[], sortList: (string | number)[], sortVNodeList: VNode[]) {\n const newList: VNode[] = [];\n vNodeList.forEach((vNode) => {\n const sortKey = vNode.props?.[keyName];\n if (sortKey && sortList.includes(sortKey)) {\n const sortVNode = sortVNodeList.shift();\n if (sortVNode) {\n newList.push(sortVNode);\n return;\n }\n }\n if (Array.isArray(vNode.children)) {\n vNode = { ...vNode }; // 避免修改原节点数据\n vNode.children = sortDefaultVNodes(keyName, vNode.children as VNode[], sortList, sortVNodeList);\n }\n newList.push(vNode);\n });\n return newList;\n}\n"],"names":["Sort","defineComponent","props","slots","renderVNodes","computed","vNodeList","sortVNodeMap","getVNodeMap","sortVNodeList","key","sortDefaultVNodes","keyName","vNodeMap","item","sortKey","sortList","newList","vNode","sortVNode"],"mappings":";AAUA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO;AAAA;AAAA,IAEL,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS,MAAM,CAAA;AAAA,IAAC;AAAA;AAAA,IAGlB,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,MAAMC,GAAO,EAAE,OAAAC,KAAS;AACtB,UAAMC,IAAeC,EAAS,MAAM;AAClC,YAAMC,IAAYH,EAAM,UAAA,KAAe,CAAA,GACjCI,IAAeC,EAAYN,EAAM,SAASI,CAAS,GACnDG,IAAgB,MAAM,KAAK,IAAI,IAAIP,EAAM,QAAQ,CAAC,EAAE,IAAI,OAAOK,EAAaG,CAAG,CAAC,EAAE,OAAO,OAAO;AACtG,aAAOC,EAAkBT,EAAM,SAASI,GAAWJ,EAAM,UAAUO,CAAa;AAAA,IAClF,CAAC;AAED,WAAO,MAAML,EAAa;AAAA,EAC5B;AACF,CAAC;AAGD,SAASI,EAAYI,GAAiBN,GAAoBO,IAA6C,CAAA,GAAI;AACzG,SAAAP,EAAU,QAAQ,CAACQ,MAAS;AAC1B,UAAMC,IAAUD,EAAK,QAAQF,CAAO;AACpC,QAAIG,GAAS;AACX,MAAIF,EAASE,CAAO,IAClB,QAAQ,KAAK,aAAaH,CAAO,KAAKG,CAAO,SAAS,IAGtDF,EAASE,CAAO,IAAID;AAEtB;AAAA,IACF;AACA,IAAI,MAAM,QAAQA,EAAK,QAAQ,KAC7BN,EAAYI,GAASE,EAAK,UAAqBD,CAAQ;AAAA,EAE3D,CAAC,GACMA;AACT;AAGA,SAASF,EAAkBC,GAAiBN,GAAoBU,GAA+BP,GAAwB;AACrH,QAAMQ,IAAmB,CAAA;AACzB,SAAAX,EAAU,QAAQ,CAACY,MAAU;AAC3B,UAAMH,IAAUG,EAAM,QAAQN,CAAO;AACrC,QAAIG,KAAWC,EAAS,SAASD,CAAO,GAAG;AACzC,YAAMI,IAAYV,EAAc,MAAA;AAChC,UAAIU,GAAW;AACb,QAAAF,EAAQ,KAAKE,CAAS;AACtB;AAAA,MACF;AAAA,IACF;AACA,IAAI,MAAM,QAAQD,EAAM,QAAQ,MAC9BA,IAAQ,EAAE,GAAGA,EAAA,GACbA,EAAM,WAAWP,EAAkBC,GAASM,EAAM,UAAqBF,GAAUP,CAAa,IAEhGQ,EAAQ,KAAKC,CAAK;AAAA,EACpB,CAAC,GACMD;AACT;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../src/table/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\nimport Table from './src/table.vue';\n\nexport const MtTable = withInstall(Table);\n\nexport * from './src/table';\n"],"names":["MtTable","withInstall","Table"],"mappings":";;
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/table/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\nimport Table from './src/table.vue';\n\nexport const MtTable = withInstall(Table);\n\nexport * from './src/table';\n"],"names":["MtTable","withInstall","Table"],"mappings":";;AAGO,MAAMA,IAAUC,EAAYC,CAAK;"}
|
@@ -1,93 +1,75 @@
|
|
1
|
-
import { defineComponent as
|
2
|
-
const
|
1
|
+
import { defineComponent as K, computed as i, createElementBlock as o, openBlock as u, createElementVNode as C, Fragment as c, renderList as d, normalizeStyle as m, renderSlot as g, createTextVNode as v, toDisplayString as _ } from "vue";
|
2
|
+
const L = { class: "mt-table" }, M = ["colspan", "rowspan"], D = ["colspan", "rowspan"], N = /* @__PURE__ */ K({
|
3
3
|
name: "MtTable",
|
4
4
|
__name: "table",
|
5
5
|
props: {
|
6
6
|
data: { default: () => [] },
|
7
7
|
config: { default: () => [] }
|
8
8
|
},
|
9
|
-
setup(
|
10
|
-
const S =
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
return
|
19
|
-
}), K = i(() => {
|
20
|
-
const t = h.value.map((s) => s.columns.map((a) => {
|
21
|
-
var e;
|
22
|
-
return ((e = a.head) == null ? void 0 : e.colSpan) || 0;
|
23
|
-
}));
|
24
|
-
return f(t);
|
25
|
-
}), L = i(() => {
|
26
|
-
const t = y.value.map((s) => s.columns.map((a) => {
|
27
|
-
var e;
|
28
|
-
return ((e = a.cell) == null ? void 0 : e.colSpan) || 0;
|
29
|
-
}));
|
30
|
-
return f(t);
|
9
|
+
setup(k) {
|
10
|
+
const S = k, h = i(() => S.config.map((e) => ({ ...e, columns: e.columns.filter((l) => l.title) }))), y = i(() => S.config.map((e) => ({ ...e, columns: e.columns.filter((l) => l.dataKey) }))), b = i(() => {
|
11
|
+
const e = h.value.map((t) => t.columns.reduce((n, a) => n + (a.head?.colSpan || 1), 0)), l = y.value.map((t) => t.columns.reduce((n, a) => n + (a.cell?.colSpan || 1), 0));
|
12
|
+
return Math.max(...e, ...l);
|
13
|
+
}), $ = i(() => {
|
14
|
+
const e = h.value.map((l) => l.columns.map((t) => t.head?.colSpan || 0));
|
15
|
+
return f(e);
|
16
|
+
}), B = i(() => {
|
17
|
+
const e = y.value.map((l) => l.columns.map((t) => t.cell?.colSpan || 0));
|
18
|
+
return f(e);
|
31
19
|
});
|
32
|
-
function f(
|
33
|
-
return
|
34
|
-
const
|
35
|
-
let
|
36
|
-
return
|
20
|
+
function f(e) {
|
21
|
+
return e.map((l) => {
|
22
|
+
const t = l.filter(Boolean), n = t.reduce((r, p) => r + p, 0);
|
23
|
+
let a = l.length - t.length, s = b.value - n;
|
24
|
+
return l.map((r) => (!r && s > 0 && (r = Math.ceil(s / a), a--, s -= r), r));
|
37
25
|
});
|
38
26
|
}
|
39
|
-
return (
|
40
|
-
|
41
|
-
(u(!0), o(
|
42
|
-
key:
|
43
|
-
style: m(
|
27
|
+
return (e, l) => (u(), o("table", L, [
|
28
|
+
C("thead", null, [
|
29
|
+
(u(!0), o(c, null, d(h.value, (t, n) => (u(), o("tr", {
|
30
|
+
key: n,
|
31
|
+
style: m(t.headStyle)
|
44
32
|
}, [
|
45
|
-
(u(!0), o(
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
33
|
+
(u(!0), o(c, null, d(t.columns, (a, s) => (u(), o("th", {
|
34
|
+
key: `${a.title}-${s}`,
|
35
|
+
colspan: $.value[n][s],
|
36
|
+
rowspan: a.head?.rowSpan,
|
37
|
+
style: m(a.head?.style)
|
38
|
+
}, [
|
39
|
+
g(e.$slots, "header", {
|
40
|
+
column: a,
|
41
|
+
columnIndex: s,
|
42
|
+
row: t,
|
43
|
+
rowIndex: n
|
44
|
+
}, () => [
|
45
|
+
v(_(a.title), 1)
|
46
|
+
], !0)
|
47
|
+
], 12, M))), 128))
|
48
|
+
], 4))), 128))
|
49
|
+
]),
|
50
|
+
C("tbody", null, [
|
51
|
+
(u(!0), o(c, null, d(e.data, (t, n) => (u(), o(c, { key: n }, [
|
52
|
+
(u(!0), o(c, null, d(y.value, (a, s) => (u(), o("tr", {
|
53
|
+
key: s,
|
54
|
+
style: m(a.rowStyle)
|
55
|
+
}, [
|
56
|
+
(u(!0), o(c, null, d(a.columns, (r, p) => (u(), o("td", {
|
57
|
+
key: `${r.dataKey}-${p}`,
|
58
|
+
colspan: B.value[s][p],
|
59
|
+
rowspan: r.cell?.rowSpan,
|
60
|
+
style: m(r.cell?.style)
|
52
61
|
}, [
|
53
|
-
|
54
|
-
column:
|
55
|
-
columnIndex:
|
62
|
+
g(e.$slots, "cell", {
|
63
|
+
column: r,
|
64
|
+
columnIndex: p,
|
65
|
+
dataIndex: n,
|
66
|
+
record: t,
|
56
67
|
row: a,
|
57
|
-
rowIndex:
|
68
|
+
rowIndex: s
|
58
69
|
}, () => [
|
59
|
-
|
70
|
+
v(_(t[r.dataKey]), 1)
|
60
71
|
], !0)
|
61
|
-
], 12,
|
62
|
-
}), 128))
|
63
|
-
], 4))), 128))
|
64
|
-
]),
|
65
|
-
v("tbody", null, [
|
66
|
-
(u(!0), o(p, null, d(t.data, (a, e) => (u(), o(p, { key: e }, [
|
67
|
-
(u(!0), o(p, null, d(y.value, (n, l) => (u(), o("tr", {
|
68
|
-
key: l,
|
69
|
-
style: m(n.rowStyle)
|
70
|
-
}, [
|
71
|
-
(u(!0), o(p, null, d(n.columns, (r, c) => {
|
72
|
-
var C, g;
|
73
|
-
return u(), o("td", {
|
74
|
-
key: `${r.dataKey}-${c}`,
|
75
|
-
colspan: L.value[l][c],
|
76
|
-
rowspan: (C = r.cell) == null ? void 0 : C.rowSpan,
|
77
|
-
style: m((g = r.cell) == null ? void 0 : g.style)
|
78
|
-
}, [
|
79
|
-
_(t.$slots, "cell", {
|
80
|
-
column: r,
|
81
|
-
columnIndex: c,
|
82
|
-
dataIndex: e,
|
83
|
-
record: a,
|
84
|
-
row: n,
|
85
|
-
rowIndex: l
|
86
|
-
}, () => [
|
87
|
-
k(b(a[r.dataKey]), 1)
|
88
|
-
], !0)
|
89
|
-
], 12, N);
|
90
|
-
}), 128))
|
72
|
+
], 12, D))), 128))
|
91
73
|
], 4))), 128))
|
92
74
|
], 64))), 128))
|
93
75
|
])
|
@@ -95,6 +77,6 @@ const D = { class: "mt-table" }, E = ["colspan", "rowspan"], N = ["colspan", "ro
|
|
95
77
|
}
|
96
78
|
});
|
97
79
|
export {
|
98
|
-
|
80
|
+
N as default
|
99
81
|
};
|
100
82
|
//# sourceMappingURL=table.vue2.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"table.vue2.mjs","sources":["../../../../../src/table/src/table.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableProps } from './table';\nimport { computed } from 'vue';\n\ndefineOptions({ name: 'MtTable' });\n\nconst props = withDefaults(defineProps<TableProps>(), {\n data: () => [],\n config: () => [],\n});\n\n/** 表头配置 */\nconst headConfig = computed(() => {\n return props.config.map(rowItem => ({ ...rowItem, columns: rowItem.columns.filter(column => column.title) }));\n});\n\n/** 数据配置 */\nconst dataConfig = computed(() => {\n return props.config.map(rowItem => ({ ...rowItem, columns: rowItem.columns.filter(column => column.dataKey) }));\n});\n\n/** 最大列数 */\nconst maxColSpan = computed(() => {\n const handReduce = headConfig.value.map(item => item.columns.reduce((pre, cur) => pre + (cur.head?.colSpan || 1), 0));\n const cellReduce = dataConfig.value.map(item => item.columns.reduce((pre, cur) => pre + (cur.cell?.colSpan || 1), 0));\n return Math.max(...handReduce, ...cellReduce);\n});\n\n/** 表头列合并 */\nconst headColSpan = computed(() => {\n const colSpanList = headConfig.value.map(item => item.columns.map(column => column.head?.colSpan || 0));\n return getColSpanData(colSpanList);\n});\n\n/** 数据列合并 */\nconst dataColSpan = computed(() => {\n const colSpanList = dataConfig.value.map(item => item.columns.map(column => column.cell?.colSpan || 0));\n return getColSpanData(colSpanList);\n});\n\n/** 获取合并列数组 */\nfunction getColSpanData(colSpanList: number[][]) {\n return colSpanList.map((columns) => {\n const colSpanColumns = columns.filter(Boolean); // 已分配colSpan的列\n const beenColSpan = colSpanColumns.reduce((pur, cur) => pur + cur, 0); // 总colSpan\n let remainCount = columns.length - colSpanColumns.length; // 剩余未配置colSpan的列数\n let remainColSpan = maxColSpan.value - beenColSpan; // 剩余可分配的colSpan\n return columns.map((colSpan) => {\n if (!colSpan && remainColSpan > 0) {\n colSpan = Math.ceil(remainColSpan / remainCount); // 每列平均分配colSpan\n remainCount--;\n remainColSpan -= colSpan;\n }\n return colSpan;\n });\n });\n}\n</script>\n\n<template>\n <table class=\"mt-table\">\n <!-- 表头 -->\n <thead>\n <tr\n v-for=\"(row, rowIndex) in headConfig\"\n :key=\"rowIndex\"\n :style=\"row.headStyle\"\n >\n <template v-for=\"(column, columnIndex) in row.columns\" :key=\"`${column.title}-${columnIndex}`\">\n <th\n :colspan=\"headColSpan[rowIndex][columnIndex]\"\n :rowspan=\"column.head?.rowSpan\"\n :style=\"column.head?.style\"\n >\n <slot\n :column=\"column\"\n :column-index=\"columnIndex\"\n :row=\"row\"\n :row-index=\"rowIndex\"\n name=\"header\"\n >\n {{ column.title }}\n </slot>\n </th>\n </template>\n </tr>\n </thead>\n <!-- 表体 -->\n <tbody>\n <template\n v-for=\"(record, dataIndex) in data\"\n :key=\"dataIndex\"\n >\n <tr\n v-for=\"(row, rowIndex) in dataConfig\"\n :key=\"rowIndex\"\n :style=\"row.rowStyle\"\n >\n <template v-for=\"(column, columnIndex) in row.columns\" :key=\"`${column.dataKey}-${columnIndex}`\">\n <td\n :colspan=\"dataColSpan[rowIndex][columnIndex]\"\n :rowspan=\"column.cell?.rowSpan\"\n :style=\"column.cell?.style\"\n >\n <slot\n :column=\"column\"\n :column-index=\"columnIndex\"\n :data-index=\"dataIndex\"\n name=\"cell\"\n :record=\"record\"\n :row=\"row\"\n :row-index=\"rowIndex\"\n >\n {{ record[column.dataKey!] }}\n </slot>\n </td>\n </template>\n </tr>\n </template>\n </tbody>\n </table>\n</template>\n\n<style lang=\"scss\" scoped>\n.mt-table {\n width: 100%;\n max-width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n\n thead {\n tr {\n th {\n padding: 8px 16px;\n border: 1px #f0f0f0 solid;\n }\n }\n }\n\n tbody {\n tr {\n td {\n padding: 16px;\n border: 1px #f0f0f0 solid;\n }\n }\n }\n}\n</style>\n"],"names":["props","__props","headConfig","computed","rowItem","column","dataConfig","maxColSpan","handReduce","item","pre","cur","
|
1
|
+
{"version":3,"file":"table.vue2.mjs","sources":["../../../../../src/table/src/table.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableProps } from './table';\nimport { computed } from 'vue';\n\ndefineOptions({ name: 'MtTable' });\n\nconst props = withDefaults(defineProps<TableProps>(), {\n data: () => [],\n config: () => [],\n});\n\n/** 表头配置 */\nconst headConfig = computed(() => {\n return props.config.map(rowItem => ({ ...rowItem, columns: rowItem.columns.filter(column => column.title) }));\n});\n\n/** 数据配置 */\nconst dataConfig = computed(() => {\n return props.config.map(rowItem => ({ ...rowItem, columns: rowItem.columns.filter(column => column.dataKey) }));\n});\n\n/** 最大列数 */\nconst maxColSpan = computed(() => {\n const handReduce = headConfig.value.map(item => item.columns.reduce((pre, cur) => pre + (cur.head?.colSpan || 1), 0));\n const cellReduce = dataConfig.value.map(item => item.columns.reduce((pre, cur) => pre + (cur.cell?.colSpan || 1), 0));\n return Math.max(...handReduce, ...cellReduce);\n});\n\n/** 表头列合并 */\nconst headColSpan = computed(() => {\n const colSpanList = headConfig.value.map(item => item.columns.map(column => column.head?.colSpan || 0));\n return getColSpanData(colSpanList);\n});\n\n/** 数据列合并 */\nconst dataColSpan = computed(() => {\n const colSpanList = dataConfig.value.map(item => item.columns.map(column => column.cell?.colSpan || 0));\n return getColSpanData(colSpanList);\n});\n\n/** 获取合并列数组 */\nfunction getColSpanData(colSpanList: number[][]) {\n return colSpanList.map((columns) => {\n const colSpanColumns = columns.filter(Boolean); // 已分配colSpan的列\n const beenColSpan = colSpanColumns.reduce((pur, cur) => pur + cur, 0); // 总colSpan\n let remainCount = columns.length - colSpanColumns.length; // 剩余未配置colSpan的列数\n let remainColSpan = maxColSpan.value - beenColSpan; // 剩余可分配的colSpan\n return columns.map((colSpan) => {\n if (!colSpan && remainColSpan > 0) {\n colSpan = Math.ceil(remainColSpan / remainCount); // 每列平均分配colSpan\n remainCount--;\n remainColSpan -= colSpan;\n }\n return colSpan;\n });\n });\n}\n</script>\n\n<template>\n <table class=\"mt-table\">\n <!-- 表头 -->\n <thead>\n <tr\n v-for=\"(row, rowIndex) in headConfig\"\n :key=\"rowIndex\"\n :style=\"row.headStyle\"\n >\n <template v-for=\"(column, columnIndex) in row.columns\" :key=\"`${column.title}-${columnIndex}`\">\n <th\n :colspan=\"headColSpan[rowIndex][columnIndex]\"\n :rowspan=\"column.head?.rowSpan\"\n :style=\"column.head?.style\"\n >\n <slot\n :column=\"column\"\n :column-index=\"columnIndex\"\n :row=\"row\"\n :row-index=\"rowIndex\"\n name=\"header\"\n >\n {{ column.title }}\n </slot>\n </th>\n </template>\n </tr>\n </thead>\n <!-- 表体 -->\n <tbody>\n <template\n v-for=\"(record, dataIndex) in data\"\n :key=\"dataIndex\"\n >\n <tr\n v-for=\"(row, rowIndex) in dataConfig\"\n :key=\"rowIndex\"\n :style=\"row.rowStyle\"\n >\n <template v-for=\"(column, columnIndex) in row.columns\" :key=\"`${column.dataKey}-${columnIndex}`\">\n <td\n :colspan=\"dataColSpan[rowIndex][columnIndex]\"\n :rowspan=\"column.cell?.rowSpan\"\n :style=\"column.cell?.style\"\n >\n <slot\n :column=\"column\"\n :column-index=\"columnIndex\"\n :data-index=\"dataIndex\"\n name=\"cell\"\n :record=\"record\"\n :row=\"row\"\n :row-index=\"rowIndex\"\n >\n {{ record[column.dataKey!] }}\n </slot>\n </td>\n </template>\n </tr>\n </template>\n </tbody>\n </table>\n</template>\n\n<style lang=\"scss\" scoped>\n.mt-table {\n width: 100%;\n max-width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n\n thead {\n tr {\n th {\n padding: 8px 16px;\n border: 1px #f0f0f0 solid;\n }\n }\n }\n\n tbody {\n tr {\n td {\n padding: 16px;\n border: 1px #f0f0f0 solid;\n }\n }\n }\n}\n</style>\n"],"names":["props","__props","headConfig","computed","rowItem","column","dataConfig","maxColSpan","handReduce","item","pre","cur","cellReduce","headColSpan","colSpanList","getColSpanData","dataColSpan","columns","colSpanColumns","beenColSpan","pur","remainCount","remainColSpan","colSpan"],"mappings":";;;;;;;;;AAMA,UAAMA,IAAQC,GAMRC,IAAaC,EAAS,MACnBH,EAAM,OAAO,IAAI,CAAAI,OAAY,EAAE,GAAGA,GAAS,SAASA,EAAQ,QAAQ,OAAO,CAAAC,MAAUA,EAAO,KAAK,IAAI,CAC7G,GAGKC,IAAaH,EAAS,MACnBH,EAAM,OAAO,IAAI,CAAAI,OAAY,EAAE,GAAGA,GAAS,SAASA,EAAQ,QAAQ,OAAO,CAAAC,MAAUA,EAAO,OAAO,IAAI,CAC/G,GAGKE,IAAaJ,EAAS,MAAM;AAChC,YAAMK,IAAaN,EAAW,MAAM,IAAI,CAAAO,MAAQA,EAAK,QAAQ,OAAO,CAACC,GAAKC,MAAQD,KAAOC,EAAI,MAAM,WAAW,IAAI,CAAC,CAAC,GAC9GC,IAAaN,EAAW,MAAM,IAAI,CAAAG,MAAQA,EAAK,QAAQ,OAAO,CAACC,GAAKC,MAAQD,KAAOC,EAAI,MAAM,WAAW,IAAI,CAAC,CAAC;AACpH,aAAO,KAAK,IAAI,GAAGH,GAAY,GAAGI,CAAU;AAAA,IAC9C,CAAC,GAGKC,IAAcV,EAAS,MAAM;AACjC,YAAMW,IAAcZ,EAAW,MAAM,IAAI,CAAAO,MAAQA,EAAK,QAAQ,IAAI,CAAAJ,MAAUA,EAAO,MAAM,WAAW,CAAC,CAAC;AACtG,aAAOU,EAAeD,CAAW;AAAA,IACnC,CAAC,GAGKE,IAAcb,EAAS,MAAM;AACjC,YAAMW,IAAcR,EAAW,MAAM,IAAI,CAAAG,MAAQA,EAAK,QAAQ,IAAI,CAAAJ,MAAUA,EAAO,MAAM,WAAW,CAAC,CAAC;AACtG,aAAOU,EAAeD,CAAW;AAAA,IACnC,CAAC;AAGD,aAASC,EAAeD,GAAyB;AAC/C,aAAOA,EAAY,IAAI,CAACG,MAAY;AAClC,cAAMC,IAAiBD,EAAQ,OAAO,OAAO,GACvCE,IAAcD,EAAe,OAAO,CAACE,GAAKT,MAAQS,IAAMT,GAAK,CAAC;AACpE,YAAIU,IAAcJ,EAAQ,SAASC,EAAe,QAC9CI,IAAgBf,EAAW,QAAQY;AACvC,eAAOF,EAAQ,IAAI,CAACM,OACd,CAACA,KAAWD,IAAgB,MAC9BC,IAAU,KAAK,KAAKD,IAAgBD,CAAW,GAC/CA,KACAC,KAAiBC,IAEZA,EACR;AAAA,MACH,CAAC;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"install.mjs","sources":["../../../../src/utils/install.ts"],"sourcesContent":["import type { App, Component, Plugin } from 'vue';\n\nexport function withInstall<T extends Component>(comp: T) {\n (comp as T & Plugin).install = (app: App): void => {\n if (comp.name) {\n app.component(comp.name, comp);\n }\n };\n return comp;\n}\n"],"names":["withInstall","comp","app"],"mappings":"AAEO,SAASA,EAAiCC,GAAS;AACvD,SAAAA,EAAoB,UAAU,CAACC,MAAmB;AACjD,IAAID,EAAK,
|
1
|
+
{"version":3,"file":"install.mjs","sources":["../../../../src/utils/install.ts"],"sourcesContent":["import type { App, Component, Plugin } from 'vue';\n\nexport function withInstall<T extends Component>(comp: T) {\n (comp as T & Plugin).install = (app: App): void => {\n if (comp.name) {\n app.component(comp.name, comp);\n }\n };\n return comp;\n}\n"],"names":["withInstall","comp","app"],"mappings":"AAEO,SAASA,EAAiCC,GAAS;AACvD,SAAAA,EAAoB,UAAU,CAACC,MAAmB;AACjD,IAAID,EAAK,QACPC,EAAI,UAAUD,EAAK,MAAMA,CAAI;AAAA,EAEjC,GACOA;AACT;"}
|