mortise-tenon-design 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.mjs +13 -0
- package/{es/core/build-design → dist/es}/package.json.mjs +1 -1
- package/{es/components → dist/es/src}/expand/index.mjs +0 -1
- package/dist/es/src/expand/index.mjs.map +1 -0
- package/dist/es/src/expand/src/expand.css +1 -0
- package/{es/components → dist/es/src}/expand/src/expand.vue.mjs +2 -2
- package/dist/es/src/expand/src/expand.vue2.mjs +36 -0
- package/dist/es/src/expand/src/expand.vue2.mjs.map +1 -0
- package/dist/es/src/installer.mjs +24 -0
- package/dist/es/src/installer.mjs.map +1 -0
- package/dist/es/src/resize/index.mjs +7 -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 -0
- package/dist/es/src/sort/src/sort.mjs +51 -0
- package/dist/es/src/sort/src/sort.mjs.map +1 -0
- package/{es/components → dist/es/src}/table/index.mjs +0 -1
- package/dist/es/src/table/index.mjs.map +1 -0
- package/dist/es/src/table/src/table.css +1 -0
- package/{es/components → dist/es/src}/table/src/table.vue.mjs +1 -1
- package/dist/es/src/table/src/table.vue2.mjs +82 -0
- package/dist/es/src/table/src/table.vue2.mjs.map +1 -0
- package/dist/es/src/utils/install.mjs.map +1 -0
- package/dist/lib/index.js +2 -0
- package/{lib/core/build-design → dist/lib}/package.json.js +1 -1
- package/{lib/components → dist/lib/src}/expand/index.js +0 -1
- package/dist/lib/src/expand/index.js.map +1 -0
- package/dist/lib/src/expand/src/expand.css +1 -0
- package/{lib/components → dist/lib/src}/expand/src/expand.vue.js +1 -1
- package/dist/lib/src/expand/src/expand.vue2.js +2 -0
- package/dist/lib/src/expand/src/expand.vue2.js.map +1 -0
- package/dist/lib/src/installer.js +2 -0
- package/dist/lib/src/installer.js.map +1 -0
- package/{lib/components/component-neo → dist/lib/src/resize}/index.js +1 -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 -0
- package/dist/lib/src/sort/src/sort.js +2 -0
- package/dist/lib/src/sort/src/sort.js.map +1 -0
- package/{lib/components → dist/lib/src}/table/index.js +0 -1
- package/dist/lib/src/table/index.js.map +1 -0
- package/dist/lib/src/table/src/table.css +1 -0
- package/{lib/components → dist/lib/src}/table/src/table.vue.js +1 -1
- package/dist/lib/src/table/src/table.vue2.js +2 -0
- package/dist/lib/src/table/src/table.vue2.js.map +1 -0
- package/dist/lib/src/utils/install.js.map +1 -0
- package/dist/types/expand/src/expand.d.ts +17 -0
- package/{types → 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 +11 -11
- package/package.json +8 -9
- package/es/components/component-neo/index.mjs +0 -9
- package/es/components/component-neo/index.mjs.map +0 -1
- package/es/components/component-neo/src/component-neo.vue.mjs +0 -34
- package/es/components/component-neo/src/component-neo.vue.mjs.map +0 -1
- package/es/components/component-neo/src/component-neo.vue2.mjs +0 -5
- package/es/components/component-neo/src/component-neo.vue2.mjs.map +0 -1
- package/es/components/component-neo/src/hooks/use-component-neo.mjs +0 -31
- package/es/components/component-neo/src/hooks/use-component-neo.mjs.map +0 -1
- package/es/components/component-neo/src/hooks/use-component-state.mjs +0 -36
- package/es/components/component-neo/src/hooks/use-component-state.mjs.map +0 -1
- package/es/components/expand/index.mjs.map +0 -1
- package/es/components/expand/src/expand.css +0 -1
- package/es/components/expand/src/expand.vue2.mjs +0 -41
- package/es/components/expand/src/expand.vue2.mjs.map +0 -1
- package/es/components/index.mjs +0 -13
- package/es/components/installer.mjs +0 -24
- package/es/components/installer.mjs.map +0 -1
- package/es/components/sort/index.mjs.map +0 -1
- package/es/components/sort/src/sort.mjs +0 -54
- package/es/components/sort/src/sort.mjs.map +0 -1
- package/es/components/table/index.mjs.map +0 -1
- package/es/components/table/src/table.css +0 -1
- package/es/components/table/src/table.vue2.mjs +0 -100
- package/es/components/table/src/table.vue2.mjs.map +0 -1
- package/es/components/utils/install.mjs.map +0 -1
- package/es/index.mjs +0 -15
- package/es/index.mjs.map +0 -1
- package/lib/components/component-neo/index.js.map +0 -1
- package/lib/components/component-neo/src/component-neo.vue.js +0 -2
- package/lib/components/component-neo/src/component-neo.vue.js.map +0 -1
- package/lib/components/component-neo/src/component-neo.vue2.js +0 -2
- package/lib/components/component-neo/src/component-neo.vue2.js.map +0 -1
- package/lib/components/component-neo/src/hooks/use-component-neo.js +0 -2
- package/lib/components/component-neo/src/hooks/use-component-neo.js.map +0 -1
- package/lib/components/component-neo/src/hooks/use-component-state.js +0 -2
- package/lib/components/component-neo/src/hooks/use-component-state.js.map +0 -1
- package/lib/components/expand/index.js.map +0 -1
- package/lib/components/expand/src/expand.css +0 -1
- package/lib/components/expand/src/expand.vue2.js +0 -2
- package/lib/components/expand/src/expand.vue2.js.map +0 -1
- package/lib/components/index.js +0 -2
- package/lib/components/installer.js +0 -2
- package/lib/components/installer.js.map +0 -1
- package/lib/components/sort/index.js.map +0 -1
- package/lib/components/sort/src/sort.js +0 -2
- package/lib/components/sort/src/sort.js.map +0 -1
- package/lib/components/table/index.js.map +0 -1
- package/lib/components/table/src/table.css +0 -1
- package/lib/components/table/src/table.vue2.js +0 -2
- package/lib/components/table/src/table.vue2.js.map +0 -1
- package/lib/components/utils/install.js.map +0 -1
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
- package/types/component-neo/index.d.ts +0 -50
- package/types/component-neo/src/component-neo.d.ts +0 -9
- package/types/component-neo/src/component-neo.vue.d.ts +0 -35
- package/types/component-neo/src/hooks/use-component-neo.d.ts +0 -8
- package/types/component-neo/src/hooks/use-component-state.d.ts +0 -30
- package/types/expand/src/expand.d.ts +0 -8
- /package/{es → dist/es}/_virtual/_plugin-vue_export-helper.mjs +0 -0
- /package/{es → dist/es}/_virtual/_plugin-vue_export-helper.mjs.map +0 -0
- /package/{es/components → dist/es}/index.mjs.map +0 -0
- /package/{es/core/build-design → dist/es}/package.json.mjs.map +0 -0
- /package/{es/components → dist/es/src}/expand/src/expand.vue.mjs.map +0 -0
- /package/{es/components → dist/es/src}/sort/index.mjs +0 -0
- /package/{es/components → dist/es/src}/table/src/table.vue.mjs.map +0 -0
- /package/{es/components → dist/es/src}/utils/install.mjs +0 -0
- /package/{lib → dist/lib}/_virtual/_plugin-vue_export-helper.js +0 -0
- /package/{lib → dist/lib}/_virtual/_plugin-vue_export-helper.js.map +0 -0
- /package/{lib/components → dist/lib}/index.js.map +0 -0
- /package/{lib/core/build-design → dist/lib}/package.json.js.map +0 -0
- /package/{lib/components → dist/lib/src}/expand/src/expand.vue.js.map +0 -0
- /package/{lib/components → dist/lib/src}/sort/index.js +0 -0
- /package/{lib/components → dist/lib/src}/table/src/table.vue.js.map +0 -0
- /package/{lib/components → dist/lib/src}/utils/install.js +0 -0
- /package/{types → dist/types}/expand/index.d.ts +0 -0
- /package/{types → dist/types}/expand/src/expand.vue.d.ts +0 -0
- /package/{types → dist/types}/installer.d.ts +0 -0
- /package/{types → dist/types}/sort/index.d.ts +0 -0
- /package/{types → dist/types}/sort/src/sort.d.ts +0 -0
- /package/{types → dist/types}/table/index.d.ts +0 -0
- /package/{types → dist/types}/table/src/table.d.ts +0 -0
- /package/{types → dist/types}/table/src/table.vue.d.ts +0 -0
- /package/{types → dist/types}/utils/install.d.ts +0 -0
@@ -1,100 +0,0 @@
|
|
1
|
-
import { defineComponent as M, computed as i, createElementBlock as o, openBlock as u, createElementVNode as v, Fragment as p, renderList as d, normalizeStyle as m, renderSlot as _, createTextVNode as k, toDisplayString as b } from "vue";
|
2
|
-
const D = { class: "mt-table" }, E = ["colspan", "rowspan"], N = ["colspan", "rowspan"], T = /* @__PURE__ */ M({
|
3
|
-
name: "MtTable",
|
4
|
-
__name: "table",
|
5
|
-
props: {
|
6
|
-
data: { default: () => [] },
|
7
|
-
config: { default: () => [] }
|
8
|
-
},
|
9
|
-
setup($) {
|
10
|
-
const S = $, h = i(() => S.config.map((t) => ({ ...t, columns: t.columns.filter((s) => s.title) }))), y = i(() => S.config.map((t) => ({ ...t, columns: t.columns.filter((s) => s.dataKey) }))), B = i(() => {
|
11
|
-
const t = h.value.map((a) => a.columns.reduce((e, n) => {
|
12
|
-
var l;
|
13
|
-
return e + (((l = n.head) == null ? void 0 : l.colSpan) || 1);
|
14
|
-
}, 0)), s = y.value.map((a) => a.columns.reduce((e, n) => {
|
15
|
-
var l;
|
16
|
-
return e + (((l = n.cell) == null ? void 0 : l.colSpan) || 1);
|
17
|
-
}, 0));
|
18
|
-
return Math.max(...t, ...s);
|
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);
|
31
|
-
});
|
32
|
-
function f(t) {
|
33
|
-
return t.map((s) => {
|
34
|
-
const a = s.filter(Boolean), e = a.reduce((r, c) => r + c, 0);
|
35
|
-
let n = s.length - a.length, l = B.value - e;
|
36
|
-
return s.map((r) => (!r && l > 0 && (r = Math.ceil(l / n), n--, l -= r), r));
|
37
|
-
});
|
38
|
-
}
|
39
|
-
return (t, s) => (u(), o("table", D, [
|
40
|
-
v("thead", null, [
|
41
|
-
(u(!0), o(p, null, d(h.value, (a, e) => (u(), o("tr", {
|
42
|
-
key: e,
|
43
|
-
style: m(a.headStyle)
|
44
|
-
}, [
|
45
|
-
(u(!0), o(p, null, d(a.columns, (n, l) => {
|
46
|
-
var r, c;
|
47
|
-
return u(), o("th", {
|
48
|
-
key: `${n.title}-${l}`,
|
49
|
-
colspan: K.value[e][l],
|
50
|
-
rowspan: (r = n.head) == null ? void 0 : r.rowSpan,
|
51
|
-
style: m((c = n.head) == null ? void 0 : c.style)
|
52
|
-
}, [
|
53
|
-
_(t.$slots, "header", {
|
54
|
-
column: n,
|
55
|
-
columnIndex: l,
|
56
|
-
row: a,
|
57
|
-
rowIndex: e
|
58
|
-
}, () => [
|
59
|
-
k(b(n.title), 1)
|
60
|
-
], !0)
|
61
|
-
], 12, E);
|
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))
|
91
|
-
], 4))), 128))
|
92
|
-
], 64))), 128))
|
93
|
-
])
|
94
|
-
]));
|
95
|
-
}
|
96
|
-
});
|
97
|
-
export {
|
98
|
-
T as default
|
99
|
-
};
|
100
|
-
//# sourceMappingURL=table.vue2.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"table.vue2.mjs","sources":["../../../../../../packages/components/table/src/table.vue"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { TableProps } from './table';\r\nimport { computed } from 'vue';\r\n\r\ndefineOptions({ name: 'MtTable' });\r\n\r\nconst props = withDefaults(defineProps<TableProps>(), {\r\n data: () => [],\r\n config: () => [],\r\n});\r\n\r\n/** 表头配置 */\r\nconst headConfig = computed(() => {\r\n return props.config.map(rowItem => ({ ...rowItem, columns: rowItem.columns.filter(column => column.title) }));\r\n});\r\n\r\n/** 数据配置 */\r\nconst dataConfig = computed(() => {\r\n return props.config.map(rowItem => ({ ...rowItem, columns: rowItem.columns.filter(column => column.dataKey) }));\r\n});\r\n\r\n/** 最大列数 */\r\nconst maxColSpan = computed(() => {\r\n const handReduce = headConfig.value.map(item => item.columns.reduce((pre, cur) => pre + (cur.head?.colSpan || 1), 0));\r\n const cellReduce = dataConfig.value.map(item => item.columns.reduce((pre, cur) => pre + (cur.cell?.colSpan || 1), 0));\r\n return Math.max(...handReduce, ...cellReduce);\r\n});\r\n\r\n/** 表头列合并 */\r\nconst headColSpan = computed(() => {\r\n const colSpanList = headConfig.value.map(item => item.columns.map(column => column.head?.colSpan || 0));\r\n return getColSpanData(colSpanList);\r\n});\r\n\r\n/** 数据列合并 */\r\nconst dataColSpan = computed(() => {\r\n const colSpanList = dataConfig.value.map(item => item.columns.map(column => column.cell?.colSpan || 0));\r\n return getColSpanData(colSpanList);\r\n});\r\n\r\n/** 获取合并列数组 */\r\nfunction getColSpanData(colSpanList: number[][]) {\r\n return colSpanList.map((columns) => {\r\n const colSpanColumns = columns.filter(Boolean); // 已分配colSpan的列\r\n const beenColSpan = colSpanColumns.reduce((pur, cur) => pur + cur, 0); // 总colSpan\r\n let remainCount = columns.length - colSpanColumns.length; // 剩余未配置colSpan的列数\r\n let remainColSpan = maxColSpan.value - beenColSpan; // 剩余可分配的colSpan\r\n return columns.map((colSpan) => {\r\n if (!colSpan && remainColSpan > 0) {\r\n colSpan = Math.ceil(remainColSpan / remainCount); // 每列平均分配colSpan\r\n remainCount--;\r\n remainColSpan -= colSpan;\r\n }\r\n return colSpan;\r\n });\r\n });\r\n}\r\n</script>\r\n\r\n<template>\r\n <table class=\"mt-table\">\r\n <!-- 表头 -->\r\n <thead>\r\n <tr\r\n v-for=\"(row, rowIndex) in headConfig\"\r\n :key=\"rowIndex\"\r\n :style=\"row.headStyle\"\r\n >\r\n <template v-for=\"(column, columnIndex) in row.columns\" :key=\"`${column.title}-${columnIndex}`\">\r\n <th\r\n :colspan=\"headColSpan[rowIndex][columnIndex]\"\r\n :rowspan=\"column.head?.rowSpan\"\r\n :style=\"column.head?.style\"\r\n >\r\n <slot\r\n :column=\"column\"\r\n :column-index=\"columnIndex\"\r\n :row=\"row\"\r\n :row-index=\"rowIndex\"\r\n name=\"header\"\r\n >\r\n {{ column.title }}\r\n </slot>\r\n </th>\r\n </template>\r\n </tr>\r\n </thead>\r\n <!-- 表体 -->\r\n <tbody>\r\n <template\r\n v-for=\"(record, dataIndex) in data\"\r\n :key=\"dataIndex\"\r\n >\r\n <tr\r\n v-for=\"(row, rowIndex) in dataConfig\"\r\n :key=\"rowIndex\"\r\n :style=\"row.rowStyle\"\r\n >\r\n <template v-for=\"(column, columnIndex) in row.columns\" :key=\"`${column.dataKey}-${columnIndex}`\">\r\n <td\r\n :colspan=\"dataColSpan[rowIndex][columnIndex]\"\r\n :rowspan=\"column.cell?.rowSpan\"\r\n :style=\"column.cell?.style\"\r\n >\r\n <slot\r\n :column=\"column\"\r\n :column-index=\"columnIndex\"\r\n :data-index=\"dataIndex\"\r\n name=\"cell\"\r\n :record=\"record\"\r\n :row=\"row\"\r\n :row-index=\"rowIndex\"\r\n >\r\n {{ record[column.dataKey!] }}\r\n </slot>\r\n </td>\r\n </template>\r\n </tr>\r\n </template>\r\n </tbody>\r\n </table>\r\n</template>\r\n\r\n<style lang=\"scss\" scoped>\r\n.mt-table {\r\n width: 100%;\r\n max-width: 100%;\r\n border-spacing: 0;\r\n border-collapse: collapse;\r\n\r\n thead {\r\n tr {\r\n th {\r\n padding: 8px 16px;\r\n border: 1px #f0f0f0 solid;\r\n }\r\n }\r\n }\r\n\r\n tbody {\r\n tr {\r\n td {\r\n padding: 16px;\r\n border: 1px #f0f0f0 solid;\r\n }\r\n }\r\n }\r\n}\r\n</style>\r\n"],"names":["props","__props","headConfig","computed","rowItem","column","dataConfig","maxColSpan","handReduce","item","pre","cur","_a","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;;AAAQ,eAAAD,OAAOE,IAAAD,EAAI,SAAJ,gBAAAC,EAAU,YAAW;AAAA,SAAI,CAAC,CAAC,GAC9GC,IAAaP,EAAW,MAAM,IAAI,CAAAG,MAAQA,EAAK,QAAQ,OAAO,CAACC,GAAKC;;AAAQ,eAAAD,OAAOE,IAAAD,EAAI,SAAJ,gBAAAC,EAAU,YAAW;AAAA,SAAI,CAAC,CAAC;AACpH,aAAO,KAAK,IAAI,GAAGJ,GAAY,GAAGK,CAAU;AAAA,IAAA,CAC7C,GAGKC,IAAcX,EAAS,MAAM;AACjC,YAAMY,IAAcb,EAAW,MAAM,IAAI,CAAQO,MAAAA,EAAK,QAAQ,IAAI,CAAUJ,MAAA;;AAAA,iBAAAO,IAAAP,EAAO,SAAP,gBAAAO,EAAa,YAAW;AAAA,OAAC,CAAC;AACtG,aAAOI,EAAeD,CAAW;AAAA,IAAA,CAClC,GAGKE,IAAcd,EAAS,MAAM;AACjC,YAAMY,IAAcT,EAAW,MAAM,IAAI,CAAQG,MAAAA,EAAK,QAAQ,IAAI,CAAUJ,MAAA;;AAAA,iBAAAO,IAAAP,EAAO,SAAP,gBAAAO,EAAa,YAAW;AAAA,OAAC,CAAC;AACtG,aAAOI,EAAeD,CAAW;AAAA,IAAA,CAClC;AAGD,aAASC,EAAeD,GAAyB;AACxC,aAAAA,EAAY,IAAI,CAACG,MAAY;AAC5B,cAAAC,IAAiBD,EAAQ,OAAO,OAAO,GACvCE,IAAcD,EAAe,OAAO,CAACE,GAAKV,MAAQU,IAAMV,GAAK,CAAC;AAChE,YAAAW,IAAcJ,EAAQ,SAASC,EAAe,QAC9CI,IAAgBhB,EAAW,QAAQa;AAChC,eAAAF,EAAQ,IAAI,CAACM,OACd,CAACA,KAAWD,IAAgB,MACpBC,IAAA,KAAK,KAAKD,IAAgBD,CAAW,GAC/CA,KACiBC,KAAAC,IAEZA,EACR;AAAA,MAAA,CACF;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"install.mjs","sources":["../../../../../packages/components/utils/install.ts"],"sourcesContent":["import type { App, Component, Plugin } from 'vue';\r\n\r\nexport function withInstall<T extends Component>(comp: T) {\r\n (comp as T & Plugin).install = (app: App): void => {\r\n if (comp.name) {\r\n app.component(comp.name, comp);\r\n }\r\n };\r\n return comp;\r\n}\r\n"],"names":["withInstall","comp","app"],"mappings":"AAEO,SAASA,EAAiCC,GAAS;AACvD,SAAAA,EAAoB,UAAU,CAACC,MAAmB;AACjD,IAAID,EAAK,QACHC,EAAA,UAAUD,EAAK,MAAMA,CAAI;AAAA,EAEjC,GACOA;AACT;"}
|
package/es/index.mjs
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
import { default as e } from "./components/installer.mjs";
|
2
|
-
import { MtComponentNeo as p } from "./components/component-neo/index.mjs";
|
3
|
-
import { MtExpand as f } from "./components/expand/index.mjs";
|
4
|
-
import { MtSort as n } from "./components/sort/index.mjs";
|
5
|
-
import { MtTable as a } from "./components/table/index.mjs";
|
6
|
-
import { useComponentNeo as l } from "./components/component-neo/src/hooks/use-component-neo.mjs";
|
7
|
-
export {
|
8
|
-
p as MtComponentNeo,
|
9
|
-
f as MtExpand,
|
10
|
-
n as MtSort,
|
11
|
-
a as MtTable,
|
12
|
-
e as default,
|
13
|
-
l as useComponentNeo
|
14
|
-
};
|
15
|
-
//# sourceMappingURL=index.mjs.map
|
package/es/index.mjs.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/components/component-neo/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\r\nimport ComponentNeo from './src/component-neo.vue';\r\n\r\nexport const MtComponentNeo = withInstall(ComponentNeo);\r\n\r\nexport * from './src/component-neo';\r\nexport * from './src/hooks/use-component-neo';\r\n"],"names":["MtComponentNeo","withInstall","ComponentNeo"],"mappings":"4NAGa,MAAAA,EAAiBC,cAAYC,EAAY,OAAA"}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),_=require("./hooks/use-component-state.js"),A=e.defineComponent({name:"MtComponentNeo",inheritAttrs:!1,__name:"component-neo",props:{uniqueId:{default:""},is:{}},emits:["toggleComponent"],setup(l,{expose:i,emit:v}){const c=l,d=v,{initComponent:f}=_.useComponentState(),{componentRef:u,componentNeo:C,componentAttrs:s,componentSlots:g}=f(c.uniqueId),a=o=>u.value=o,y=e.useAttrs(),m=e.computed(()=>{const o={};for(const n in s.value)typeof s.value[n]<"u"&&(o[n]=e.unref(s.value[n]));return Object.assign(o,y)}),t=e.computed(()=>C.value||c.is),p=e.computed(()=>t.value?e.h(t.value,m.value,g.value):e.h(e.Comment,"ComponentNeo is empty")),r=e.computed(()=>typeof t.value=="object"&&"name"in t.value?t.value.name:void 0);return e.watch(t,async()=>{await e.nextTick(),d("toggleComponent",r.value,u.value)}),i({componentRef:u}),(o,n)=>e.renderSlot(o.$slots,"default",{Component:p.value,compRef:a,attrs:m.value,compName:r.value},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value),{ref:a}))])}});exports.default=A;
|
2
|
-
//# sourceMappingURL=component-neo.vue.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"component-neo.vue.js","sources":["../../../../../../packages/components/component-neo/src/component-neo.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { ComponentNeoProps } from './component-neo';\r\nimport { Comment, computed, h, nextTick, unref, useAttrs, watch } from 'vue';\r\nimport { useComponentState } from './hooks/use-component-state';\r\n\r\ndefineOptions({ name: 'MtComponentNeo', inheritAttrs: false });\r\n\r\nconst props = withDefaults(\r\n defineProps<ComponentNeoProps>(),\r\n { uniqueId: '', onToggle: () => { } },\r\n);\r\n\r\nconst emit = defineEmits<{\r\n (e: 'toggleComponent', name?: string, ref?: any): void\r\n}>();\r\n\r\nconst { initComponent } = useComponentState();\r\nconst { componentRef, componentNeo, componentAttrs, componentSlots } = initComponent(props.uniqueId);\r\nconst compRef = (el: Element) => componentRef.value = el;\r\n\r\nconst commonAttrs = useAttrs();\r\n/** 结合注入的属性和公共属性 */\r\nconst compAttrs = computed(() => {\r\n const newAttrs: Record<string, unknown> = {};\r\n // 仅传入有值的属性\r\n for (const key in componentAttrs.value) {\r\n if (typeof componentAttrs.value[key] !== 'undefined') {\r\n newAttrs[key] = unref(componentAttrs.value[key]); // 支持ref数据转入\r\n }\r\n }\r\n return Object.assign(newAttrs, commonAttrs);\r\n});\r\n\r\nconst compInstance = computed(() => componentNeo.value || props.is);\r\n\r\nconst compVNode = computed(() => {\r\n return !compInstance.value ? h(Comment, 'ComponentNeo is empty') : h(compInstance.value, compAttrs.value, componentSlots.value);\r\n});\r\n\r\nconst compName = computed(() => {\r\n return typeof compInstance.value === 'object' && 'name' in compInstance.value ? compInstance.value.name : undefined;\r\n});\r\n\r\n// 监听组件切换,触发回调\r\nwatch(compInstance, async () => {\r\n await nextTick();\r\n emit('toggleComponent', compName.value, componentRef.value);\r\n});\r\n\r\ndefineExpose({ componentRef });\r\n</script>\r\n\r\n<template>\r\n <!-- eslint-disable-next-line vue/attribute-hyphenation -->\r\n <slot :Component=\"compVNode\" :compRef=\"compRef\" :attrs=\"compAttrs\" :compName=\"compName\">\r\n <component :is=\"compVNode\" :ref=\"compRef\" />\r\n </slot>\r\n</template>\r\n"],"names":["props","__props","emit","__emit","initComponent","useComponentState","componentRef","componentNeo","componentAttrs","componentSlots","compRef","el","commonAttrs","useAttrs","compAttrs","computed","newAttrs","key","unref","compInstance","compVNode","h","Comment","compName","watch","nextTick","__expose"],"mappings":"0VAOA,MAAMA,EAAQC,EAKRC,EAAOC,EAIP,CAAE,cAAAC,CAAc,EAAIC,oBAAkB,EACtC,CAAE,aAAAC,EAAc,aAAAC,EAAc,eAAAC,EAAgB,eAAAC,GAAmBL,EAAcJ,EAAM,QAAQ,EAC7FU,EAAWC,GAAgBL,EAAa,MAAQK,EAEhDC,EAAcC,EAAAA,SAAS,EAEvBC,EAAYC,EAAAA,SAAS,IAAM,CAC/B,MAAMC,EAAoC,CAAC,EAEhC,UAAAC,KAAOT,EAAe,MAC3B,OAAOA,EAAe,MAAMS,CAAG,EAAM,MACvCD,EAASC,CAAG,EAAIC,EAAAA,MAAMV,EAAe,MAAMS,CAAG,CAAC,GAG5C,OAAA,OAAO,OAAOD,EAAUJ,CAAW,CAAA,CAC3C,EAEKO,EAAeJ,EAAAA,SAAS,IAAMR,EAAa,OAASP,EAAM,EAAE,EAE5DoB,EAAYL,EAAAA,SAAS,IACjBI,EAAa,MAA8CE,IAAEF,EAAa,MAAOL,EAAU,MAAOL,EAAe,KAAK,EAAjGY,EAAAA,EAAEC,EAAAA,QAAS,uBAAuB,CAChE,EAEKC,EAAWR,EAAAA,SAAS,IACjB,OAAOI,EAAa,OAAU,UAAY,SAAUA,EAAa,MAAQA,EAAa,MAAM,KAAO,MAC3G,EAGDK,OAAAA,EAAA,MAAML,EAAc,SAAY,CAC9B,MAAMM,WAAS,EACfvB,EAAK,kBAAmBqB,EAAS,MAAOjB,EAAa,KAAK,CAAA,CAC3D,EAEYoB,EAAA,CAAE,aAAApB,EAAc"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"component-neo.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("vue"),C=require("./use-component-state.js");function v(r=""){const{setComponent:u,getComponent:a}=C.useComponentState();async function i(t,c,p){var l;try{const s=typeof t=="function"?(await t()).default:t,n={};for(let e in c){const o=c[e];e.startsWith("vModel:")?(e=e.replace("vModel:",""),n[e]=o,n[`onUpdate:${e}`]=f=>{"value"in o&&(o.value=f)}):n[e]=o}return u(r,{comp:s,attrs:n,slots:p||{}}),await m.nextTick(),(l=a(r))==null?void 0:l.Instance.value}catch(s){console.error(s)}}return{getComponentRef:()=>{var t;return(t=a(r))==null?void 0:t.Instance.value},toggleComponent:i}}exports.useComponentNeo=v;
|
2
|
-
//# sourceMappingURL=use-component-neo.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"use-component-neo.js","sources":["../../../../../../../packages/components/component-neo/src/hooks/use-component-neo.ts"],"sourcesContent":["import type { VNode } from 'vue';\r\nimport type { ComponentSlots, InstanceComponent } from '../component-neo';\r\nimport { nextTick } from 'vue';\r\nimport { useComponentState } from './use-component-state';\r\n\r\nexport type ImportComponentFn = () => Promise<Record<string, any>>;\r\nexport type DynamicComponent = InstanceComponent | ImportComponentFn | VNode;\r\n\r\nexport function useComponentNeo(uniqueId = '') {\r\n const { setComponent, getComponent } = useComponentState();\r\n\r\n /**\r\n * 切换渲染的组件\r\n * @param comp 组件,可传入两种类型,1.import动态导入 2.组件类型 3.VNode\r\n * @param attrs 组件属性,可使用`on事件`方式添加事件方法,属性支持Ref类型进行绑定以实现动态变化, 支持通过{'vModal:value': value}方式双向绑定数据\r\n * @param slots 组件插槽\r\n */\r\n async function toggleComponent(comp?: DynamicComponent, attrs?: Record<string, any>, slots?: ComponentSlots) {\r\n try {\r\n const renderComp = typeof comp === 'function' ? (await (comp as ImportComponentFn)()).default : comp;\r\n const renderAttrs: Record<string, unknown> = {};\r\n for (let key in attrs) {\r\n const bindValue = attrs[key];\r\n // 兼容vModel\r\n if (key.startsWith('vModel:')) {\r\n key = key.replace('vModel:', '');\r\n renderAttrs[key] = bindValue;\r\n renderAttrs[`onUpdate:${key}`] = (value: unknown) => {\r\n if ('value' in bindValue) {\r\n bindValue.value = value;\r\n }\r\n };\r\n }\r\n else {\r\n renderAttrs[key] = bindValue;\r\n }\r\n }\r\n setComponent(uniqueId, { comp: renderComp, attrs: renderAttrs, slots: slots || {} });\r\n await nextTick();\r\n return getComponent(uniqueId)?.Instance.value;\r\n }\r\n catch (e) {\r\n console.error(e);\r\n }\r\n }\r\n return {\r\n getComponentRef: () => getComponent(uniqueId)?.Instance.value,\r\n toggleComponent,\r\n };\r\n};\r\n"],"names":["useComponentNeo","uniqueId","setComponent","getComponent","useComponentState","toggleComponent","comp","attrs","slots","renderComp","renderAttrs","key","bindValue","value","nextTick","_a","e"],"mappings":"6IAQgB,SAAAA,EAAgBC,EAAW,GAAI,CAC7C,KAAM,CAAE,aAAAC,EAAc,aAAAC,CAAa,EAAIC,oBAAkB,EAQ1C,eAAAC,EAAgBC,EAAyBC,EAA6BC,EAAwB,OACvG,GAAA,CACF,MAAMC,EAAa,OAAOH,GAAS,YAAc,MAAOA,EAAA,GAA8B,QAAUA,EAC1FI,EAAuC,CAAC,EAC9C,QAASC,KAAOJ,EAAO,CACf,MAAAK,EAAYL,EAAMI,CAAG,EAEvBA,EAAI,WAAW,SAAS,GACpBA,EAAAA,EAAI,QAAQ,UAAW,EAAE,EAC/BD,EAAYC,CAAG,EAAIC,EACnBF,EAAY,YAAYC,CAAG,EAAE,EAAKE,GAAmB,CAC/C,UAAWD,IACbA,EAAU,MAAQC,EAEtB,GAGAH,EAAYC,CAAG,EAAIC,CACrB,CAEW,OAAAV,EAAAD,EAAU,CAAE,KAAMQ,EAAY,MAAOC,EAAa,MAAOF,GAAS,CAAA,EAAI,EACnF,MAAMM,WAAS,GACRC,EAAAZ,EAAaF,CAAQ,IAArB,YAAAc,EAAwB,SAAS,YAEnCC,EAAG,CACR,QAAQ,MAAMA,CAAC,CAAA,CACjB,CAEK,MAAA,CACL,gBAAiB,IAAA,OAAM,OAAAD,EAAAZ,EAAaF,CAAQ,IAArB,YAAAc,EAAwB,SAAS,OACxD,gBAAAV,CACF,CACF"}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@vueuse/core"),n=require("vue"),v=i.createGlobalState(()=>{const a=new Map,s=new Map;function f(t=""){let e=s.get(t);e||(e={Instance:n.ref(),comp:n.shallowRef(),attrs:n.ref({}),slots:n.ref({})},s.set(t,e),n.onBeforeUnmount(()=>p(t)));const o=a.get(t);return o&&(e.comp.value=o.comp,e.attrs.value=o.attrs,e.slots.value=o.slots),{componentRef:e.Instance,componentNeo:e.comp,componentAttrs:e.attrs,componentSlots:e.slots}}function r(t=""){return s.get(t)}function p(t=""){a.delete(t),s.delete(t)}function u(t="",e){const{comp:o,attrs:l,slots:m}=e,c=r(t);c&&(c.comp.value=o,c.attrs.value=l,c.slots.value=m),a.set(t,{comp:o,attrs:l,slots:m})}return{initComponent:f,setComponent:u,getComponent:r,removeComponent:p}});exports.useComponentState=v;
|
2
|
-
//# sourceMappingURL=use-component-state.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"use-component-state.js","sources":["../../../../../../../packages/components/component-neo/src/hooks/use-component-state.ts"],"sourcesContent":["import type { Ref, ShallowRef, VNode } from 'vue';\r\nimport type { ComponentSlots, InstanceComponent } from '../component-neo';\r\nimport { createGlobalState } from '@vueuse/core';\r\nimport { onBeforeUnmount, ref, shallowRef } from 'vue';\r\n\r\ninterface ComponentRefsType {\r\n /** 引用实例 */\r\n Instance: Ref<any>\r\n /** 组件 */\r\n comp: ShallowRef<InstanceComponent | VNode | undefined>\r\n /** 属性 */\r\n attrs: Ref<Record<string, unknown>>\r\n /** 插槽 */\r\n slots: Ref<ComponentSlots>\r\n}\r\n\r\ninterface ComponentData {\r\n comp?: InstanceComponent | VNode\r\n attrs: Record<string, unknown>\r\n slots: ComponentSlots\r\n}\r\n\r\n/** 组件状态 */\r\nexport const useComponentState = createGlobalState(() => {\r\n /** 缓存组件数据,组件未实例化时,可先缓存后赋值 */\r\n const dataBufferMap = new Map<string, ComponentData>();\r\n /** 实例化后的组件 */\r\n const componentRefsMap = new Map<string, ComponentRefsType>();\r\n /** 初始化组件 */\r\n function initComponent(uniqueId = '') {\r\n let componentRefs = componentRefsMap.get(uniqueId);\r\n if (!componentRefs) {\r\n componentRefs = {\r\n Instance: ref(),\r\n comp: shallowRef<InstanceComponent | VNode>(),\r\n attrs: ref<Record<string, unknown>>({}),\r\n slots: ref<ComponentSlots>({}),\r\n };\r\n componentRefsMap.set(uniqueId, componentRefs);\r\n onBeforeUnmount(() => removeComponent(uniqueId));\r\n }\r\n // 使用缓存数据初始化数据\r\n const bufferData = dataBufferMap.get(uniqueId);\r\n if (bufferData) {\r\n componentRefs.comp.value = bufferData.comp;\r\n componentRefs.attrs.value = bufferData.attrs;\r\n componentRefs.slots.value = bufferData.slots;\r\n }\r\n\r\n return {\r\n componentRef: componentRefs.Instance,\r\n componentNeo: componentRefs.comp,\r\n componentAttrs: componentRefs.attrs,\r\n componentSlots: componentRefs.slots,\r\n };\r\n }\r\n\r\n /** 获取实例 */\r\n function getComponent(uniqueId = '') {\r\n return componentRefsMap.get(uniqueId);\r\n }\r\n\r\n /** 移除实例 */\r\n function removeComponent(uniqueId = '') {\r\n dataBufferMap.delete(uniqueId);\r\n componentRefsMap.delete(uniqueId);\r\n }\r\n\r\n /** 设置组件数据 */\r\n function setComponent(uniqueId = '', args: ComponentData) {\r\n const { comp, attrs, slots } = args;\r\n const componentRefs = getComponent(uniqueId);\r\n if (componentRefs) {\r\n componentRefs.comp.value = comp;\r\n componentRefs.attrs.value = attrs;\r\n componentRefs.slots.value = slots;\r\n }\r\n dataBufferMap.set(uniqueId, { comp, attrs, slots });\r\n }\r\n\r\n return { initComponent, setComponent, getComponent, removeComponent };\r\n});\r\n"],"names":["useComponentState","createGlobalState","dataBufferMap","componentRefsMap","initComponent","uniqueId","componentRefs","ref","shallowRef","onBeforeUnmount","removeComponent","bufferData","getComponent","setComponent","args","comp","attrs","slots"],"mappings":"iIAuBaA,EAAoBC,oBAAkB,IAAM,CAEjD,MAAAC,MAAoB,IAEpBC,MAAuB,IAEpB,SAAAC,EAAcC,EAAW,GAAI,CAChC,IAAAC,EAAgBH,EAAiB,IAAIE,CAAQ,EAC5CC,IACaA,EAAA,CACd,SAAUC,EAAAA,IAAI,EACd,KAAMC,EAAAA,WAAsC,EAC5C,MAAOD,EAA6B,IAAA,EAAE,EACtC,MAAOA,EAAoB,IAAA,CAAE,CAAA,CAC/B,EACiBJ,EAAA,IAAIE,EAAUC,CAAa,EAC5BG,kBAAA,IAAMC,EAAgBL,CAAQ,CAAC,GAG3C,MAAAM,EAAaT,EAAc,IAAIG,CAAQ,EAC7C,OAAIM,IACYL,EAAA,KAAK,MAAQK,EAAW,KACxBL,EAAA,MAAM,MAAQK,EAAW,MACzBL,EAAA,MAAM,MAAQK,EAAW,OAGlC,CACL,aAAcL,EAAc,SAC5B,aAAcA,EAAc,KAC5B,eAAgBA,EAAc,MAC9B,eAAgBA,EAAc,KAChC,CAAA,CAIO,SAAAM,EAAaP,EAAW,GAAI,CAC5B,OAAAF,EAAiB,IAAIE,CAAQ,CAAA,CAI7B,SAAAK,EAAgBL,EAAW,GAAI,CACtCH,EAAc,OAAOG,CAAQ,EAC7BF,EAAiB,OAAOE,CAAQ,CAAA,CAIzB,SAAAQ,EAAaR,EAAW,GAAIS,EAAqB,CACxD,KAAM,CAAE,KAAAC,EAAM,MAAAC,EAAO,MAAAC,CAAU,EAAAH,EACzBR,EAAgBM,EAAaP,CAAQ,EACvCC,IACFA,EAAc,KAAK,MAAQS,EAC3BT,EAAc,MAAM,MAAQU,EAC5BV,EAAc,MAAM,MAAQW,GAE9Bf,EAAc,IAAIG,EAAU,CAAE,KAAAU,EAAM,MAAAC,EAAO,MAAAC,EAAO,CAAA,CAGpD,MAAO,CAAE,cAAAb,EAAe,aAAAS,EAAc,aAAAD,EAAc,gBAAAF,CAAgB,CACtE,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/components/expand/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\r\nimport Expand from './src/expand.vue';\r\n\r\nexport const MtExpand = withInstall(Expand);\r\n\r\nexport * from './src/expand';\r\n"],"names":["MtExpand","withInstall","Expand"],"mappings":"wJAGaA,EAAWC,cAAYC,EAAM,OAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
.mt-expand[data-v-60128610]{overflow:hidden}.mt-expand-transition[data-v-60128610]{transition:height var(--2863d212) ease-in-out}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=require("@vueuse/core"),d=require("lodash-es"),p=e.defineComponent({name:"MtExpand",__name:"expand",props:{open:{type:Boolean,default:!1},targetRange:{default:0},transitionTime:{default:200}},setup(i){e.useCssVars(t=>({"2863d212":u.value}));const n=i,u=e.computed(()=>`${n.transitionTime}ms`),o=e.ref(0),s=e.computed(()=>o.value>n.targetRange),l=e.computed(()=>({height:`${!s.value||n.open?o.value:n.targetRange}px`})),a=e.ref(),r=d.debounce(()=>{var t;o.value=(t=a.value)==null?void 0:t.offsetHeight},n.transitionTime);return c.useResizeObserver(a,r),e.onMounted(()=>{r()}),(t,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["mt-expand",{"mt-expand-transition":!!t.transitionTime}]),style:e.normalizeStyle(l.value)},[e.createElementVNode("div",{ref_key:"contentRef",ref:a},[e.renderSlot(t.$slots,"default",{open:t.open,isOutRange:s.value},void 0,!0)],512)],6))}});exports.default=p;
|
2
|
-
//# sourceMappingURL=expand.vue2.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"expand.vue2.js","sources":["../../../../../../packages/components/expand/src/expand.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { ExpandProps } from './expand.ts';\r\nimport { useResizeObserver } from '@vueuse/core';\r\nimport { debounce } from 'lodash-es';\r\nimport { computed, onMounted, ref } from 'vue';\r\n\r\ndefineOptions({ name: 'MtExpand' });\r\n\r\nconst props = withDefaults(defineProps<ExpandProps>(), {\r\n open: false,\r\n targetRange: 0,\r\n transitionTime: 200,\r\n});\r\n\r\nconst transitionDuration = computed(() => `${props.transitionTime}ms`);\r\n\r\n/** 内容的范围 */\r\nconst contentRange = ref(0);\r\n\r\n/** 是否超出目标范围 */\r\nconst isOutRange = computed(() => contentRange.value > props.targetRange);\r\n\r\n/** 展开或收起后内容样式 */\r\nconst contentStyle = computed(() => {\r\n const size = !isOutRange.value || props.open ? contentRange.value : props.targetRange;\r\n return { height: `${size}px` };\r\n});\r\n\r\n/** 内容实例 */\r\nconst contentRef = ref();\r\n\r\n/** 获取内容实际范围 */\r\nconst getContentRange = debounce(() => {\r\n contentRange.value = contentRef.value?.offsetHeight;\r\n}, props.transitionTime);\r\n\r\n// 监听内容高度变化\r\nuseResizeObserver(contentRef, getContentRange);\r\n\r\n// 初始化内容\r\nonMounted(() => {\r\n getContentRange();\r\n});\r\n</script>\r\n\r\n<template>\r\n <div\r\n class=\"mt-expand\"\r\n :class=\"{ 'mt-expand-transition': !!transitionTime }\"\r\n :style=\"contentStyle\"\r\n >\r\n <div ref=\"contentRef\">\r\n <slot :open=\"open\" :is-out-range=\"isOutRange\" />\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<style lang=\"scss\" scoped>\r\n.mt-expand {\r\n overflow: hidden;\r\n}\r\n\r\n.mt-expand-transition {\r\n transition: height v-bind(transitionDuration) ease-in-out;\r\n}\r\n</style>\r\n"],"names":["props","__props","transitionDuration","computed","contentRange","ref","isOutRange","contentStyle","contentRef","getContentRange","debounce","_a","useResizeObserver","onMounted"],"mappings":"sXAQA,MAAMA,EAAQC,EAMRC,EAAqBC,EAAAA,SAAS,IAAM,GAAGH,EAAM,cAAc,IAAI,EAG/DI,EAAeC,MAAI,CAAC,EAGpBC,EAAaH,EAAAA,SAAS,IAAMC,EAAa,MAAQJ,EAAM,WAAW,EAGlEO,EAAeJ,EAAAA,SAAS,KAErB,CAAE,OAAQ,GADJ,CAACG,EAAW,OAASN,EAAM,KAAOI,EAAa,MAAQJ,EAAM,WAClD,IAAK,EAC9B,EAGKQ,EAAaH,EAAAA,IAAI,EAGjBI,EAAkBC,EAAAA,SAAS,IAAM,OACxBN,EAAA,OAAQO,EAAAH,EAAW,QAAX,YAAAG,EAAkB,YAAA,EACtCX,EAAM,cAAc,EAGvBY,OAAAA,EAAA,kBAAkBJ,EAAYC,CAAe,EAG7CI,EAAAA,UAAU,IAAM,CACEJ,EAAA,CAAA,CACjB"}
|
package/lib/components/index.js
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./installer.js"),t=require("./component-neo/index.js"),n=require("./expand/index.js"),o=require("./sort/index.js"),r=require("./table/index.js");exports.default=e.default;exports.MtComponentNeo=t.MtComponentNeo;exports.MtExpand=n.MtExpand;exports.MtSort=o.MtSort;exports.MtTable=r.MtTable;
|
2
|
-
//# sourceMappingURL=index.js.map
|
@@ -1,2 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../core/build-design/package.json.js"),s=require("./component-neo/index.js"),u=require("./expand/index.js"),l=require("./sort/index.js"),c=require("./table/index.js"),t=Symbol("MT_INSTALLED_KEY");function a(n=[]){const r=e=>{e[t]||(e[t]=!0,n.forEach(o=>e.use(o)))};return{version:i.version,install:r}}const d=a([s.MtComponentNeo,u.MtExpand,l.MtSort,c.MtTable]);exports.default=d;
|
2
|
-
//# sourceMappingURL=installer.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"installer.js","sources":["../../../../packages/components/installer.ts"],"sourcesContent":["import type { App, Component, Plugin } from 'vue';\r\nimport { version } from '../core/build-design/package.json';\r\nimport { MtComponentNeo } from './component-neo';\r\nimport { MtExpand } from './expand';\r\nimport { MtSort } from './sort';\r\nimport { MtTable } from './table';\r\n\r\nconst INSTALLED_KEY = Symbol('MT_INSTALLED_KEY');\r\n\r\nfunction makeInstaller(components: Component[] = []) {\r\n const install = (app: App & { [INSTALLED_KEY]?: boolean }) => {\r\n if (app[INSTALLED_KEY])\r\n return;\r\n\r\n app[INSTALLED_KEY] = true;\r\n components.forEach(c => app.use(c as Plugin));\r\n };\r\n\r\n return {\r\n version,\r\n install,\r\n };\r\n}\r\n\r\nconst installer = makeInstaller([\r\n MtComponentNeo,\r\n MtExpand,\r\n MtSort,\r\n MtTable,\r\n]);\r\n\r\nexport default installer;\r\n"],"names":["INSTALLED_KEY","makeInstaller","components","install","app","c","version","installer","MtComponentNeo","MtExpand","MtSort","MtTable"],"mappings":"oSAOMA,EAAgB,OAAO,kBAAkB,EAE/C,SAASC,EAAcC,EAA0B,GAAI,CAC7C,MAAAC,EAAWC,GAA6C,CACxDA,EAAIJ,CAAa,IAGrBI,EAAIJ,CAAa,EAAI,GACrBE,EAAW,QAAQG,GAAKD,EAAI,IAAIC,CAAW,CAAC,EAC9C,EAEO,MAAA,CAAA,QACLC,EAAA,QACA,QAAAH,CACF,CACF,CAEA,MAAMI,EAAYN,EAAc,CAC9BO,EAAA,eACAC,EAAA,SACAC,EAAA,OACAC,EAAAA,OACF,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/components/sort/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\r\nimport Sort from './src/sort';\r\n\r\nexport const MtSort = withInstall(Sort);\r\n\r\nexport * from './src/sort';\r\n"],"names":["MtSort","withInstall","Sort"],"mappings":"kJAGaA,EAASC,cAAYC,EAAI,OAAA"}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),d=a.defineComponent({name:"MtSort",props:{sortList:{type:Array,default:()=>[]},keyName:{type:String,default:"sort-key"}},setup(e,{slots:s}){const o=a.computed(()=>{var u;const t=((u=s.default)==null?void 0:u.call(s))||[],n=f(e.keyName,t),r=Array.from(new Set(e.sortList)).map(i=>n[i]).filter(Boolean);return l(e.keyName,t,e.sortList,r)});return()=>o.value}});function f(e,s,o={}){return s.forEach(t=>{var r;const n=(r=t.props)==null?void 0:r[e];if(n){o[n]?console.warn(`<mt-sort> ${e}: ${n} repeat`):o[n]=t;return}Array.isArray(t.children)&&f(e,t.children,o)}),o}function l(e,s,o,t){const n=[];return s.forEach(r=>{var i;const u=(i=r.props)==null?void 0:i[e];if(u&&o.includes(u)){const c=t.shift();if(c){n.push(c);return}}Array.isArray(r.children)&&(r={...r},r.children=l(e,r.children,o,t)),n.push(r)}),n}exports.default=d;
|
2
|
-
//# sourceMappingURL=sort.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"sort.js","sources":["../../../../../../packages/components/sort/src/sort.ts"],"sourcesContent":["import type { PropType, VNode } from 'vue';\r\nimport { computed, defineComponent } from 'vue';\r\n\r\nexport interface SortProps {\r\n /** 排序配置 */\r\n sortList?: (string | number)[]\r\n /** 排序key名 */\r\n keyName?: string\r\n}\r\n\r\nexport default defineComponent({\r\n name: 'MtSort',\r\n props: {\r\n /** 排序配置 */\r\n sortList: {\r\n type: Array as PropType<(string | number)[]>,\r\n default: () => [],\r\n },\r\n /** 排序key名 */\r\n keyName: {\r\n type: String,\r\n default: 'sort-key',\r\n },\r\n },\r\n setup(props, { slots }) {\r\n const renderVNodes = computed(() => {\r\n const vNodeList = slots.default?.() || [];\r\n const sortVNodeMap = getVNodeMap(props.keyName, vNodeList);\r\n const sortVNodeList = Array.from(new Set(props.sortList)).map(key => sortVNodeMap[key]).filter(Boolean);\r\n return sortDefaultVNodes(props.keyName, vNodeList, props.sortList, sortVNodeList);\r\n });\r\n\r\n return () => renderVNodes.value;\r\n },\r\n});\r\n\r\n/** 获取插槽中需要排序的节点 */\r\nfunction getVNodeMap(keyName: string, vNodeList: VNode[], vNodeMap: Record<(string | number), VNode> = {}) {\r\n vNodeList.forEach((item) => {\r\n const sortKey = item.props?.[keyName];\r\n if (sortKey) {\r\n if (vNodeMap[sortKey]) {\r\n console.warn(`<mt-sort> ${keyName}: ${sortKey} repeat`);\r\n }\r\n else {\r\n vNodeMap[sortKey] = item;\r\n }\r\n return;\r\n }\r\n if (Array.isArray(item.children)) {\r\n getVNodeMap(keyName, item.children as VNode[], vNodeMap);\r\n }\r\n });\r\n return vNodeMap;\r\n}\r\n\r\n/** 根据排序后的节点跟换位置 */\r\nfunction sortDefaultVNodes(keyName: string, vNodeList: VNode[], sortList: (string | number)[], sortVNodeList: VNode[]) {\r\n const newList: VNode[] = [];\r\n vNodeList.forEach((vNode) => {\r\n const sortKey = vNode.props?.[keyName];\r\n if (sortKey && sortList.includes(sortKey)) {\r\n const sortVNode = sortVNodeList.shift();\r\n if (sortVNode) {\r\n newList.push(sortVNode);\r\n return;\r\n }\r\n }\r\n if (Array.isArray(vNode.children)) {\r\n vNode = { ...vNode }; // 避免修改原节点数据\r\n vNode.children = sortDefaultVNodes(keyName, vNode.children as VNode[], sortList, sortVNodeList);\r\n }\r\n newList.push(vNode);\r\n });\r\n return newList;\r\n}\r\n"],"names":["Sort","defineComponent","props","slots","renderVNodes","computed","vNodeList","_a","sortVNodeMap","getVNodeMap","sortVNodeList","key","sortDefaultVNodes","keyName","vNodeMap","item","sortKey","sortList","newList","vNode","sortVNode"],"mappings":"mIAUAA,EAAeC,kBAAgB,CAC7B,KAAM,SACN,MAAO,CAEL,SAAU,CACR,KAAM,MACN,QAAS,IAAM,CAAA,CACjB,EAEA,QAAS,CACP,KAAM,OACN,QAAS,UAAA,CAEb,EACA,MAAMC,EAAO,CAAE,MAAAC,GAAS,CAChB,MAAAC,EAAeC,EAAAA,SAAS,IAAM,OAClC,MAAMC,IAAYC,EAAAJ,EAAM,UAAN,YAAAI,EAAA,KAAAJ,KAAqB,CAAC,EAClCK,EAAeC,EAAYP,EAAM,QAASI,CAAS,EACnDI,EAAgB,MAAM,KAAK,IAAI,IAAIR,EAAM,QAAQ,CAAC,EAAE,OAAWM,EAAaG,CAAG,CAAC,EAAE,OAAO,OAAO,EACtG,OAAOC,EAAkBV,EAAM,QAASI,EAAWJ,EAAM,SAAUQ,CAAa,CAAA,CACjF,EAED,MAAO,IAAMN,EAAa,KAAA,CAE9B,CAAC,EAGD,SAASK,EAAYI,EAAiBP,EAAoBQ,EAA6C,CAAA,EAAI,CAC/F,OAAAR,EAAA,QAASS,GAAS,OACpB,MAAAC,GAAUT,EAAAQ,EAAK,QAAL,YAAAR,EAAaM,GAC7B,GAAIG,EAAS,CACPF,EAASE,CAAO,EAClB,QAAQ,KAAK,aAAaH,CAAO,KAAKG,CAAO,SAAS,EAGtDF,EAASE,CAAO,EAAID,EAEtB,MAAA,CAEE,MAAM,QAAQA,EAAK,QAAQ,GACjBN,EAAAI,EAASE,EAAK,SAAqBD,CAAQ,CACzD,CACD,EACMA,CACT,CAGA,SAASF,EAAkBC,EAAiBP,EAAoBW,EAA+BP,EAAwB,CACrH,MAAMQ,EAAmB,CAAC,EAChB,OAAAZ,EAAA,QAASa,GAAU,OACrB,MAAAH,GAAUT,EAAAY,EAAM,QAAN,YAAAZ,EAAcM,GAC9B,GAAIG,GAAWC,EAAS,SAASD,CAAO,EAAG,CACnC,MAAAI,EAAYV,EAAc,MAAM,EACtC,GAAIU,EAAW,CACbF,EAAQ,KAAKE,CAAS,EACtB,MAAA,CACF,CAEE,MAAM,QAAQD,EAAM,QAAQ,IACtBA,EAAA,CAAE,GAAGA,CAAM,EACnBA,EAAM,SAAWP,EAAkBC,EAASM,EAAM,SAAqBF,EAAUP,CAAa,GAEhGQ,EAAQ,KAAKC,CAAK,CAAA,CACnB,EACMD,CACT"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/components/table/index.ts"],"sourcesContent":["import { withInstall } from '../utils/install';\r\nimport Table from './src/table.vue';\r\n\r\nexport const MtTable = withInstall(Table);\r\n\r\nexport * from './src/table';\r\n"],"names":["MtTable","withInstall","Table"],"mappings":"uJAGaA,EAAUC,cAAYC,EAAK,OAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
.mt-table[data-v-46d3894f]{width:100%;max-width:100%;border-spacing:0;border-collapse:collapse}.mt-table thead tr th[data-v-46d3894f]{padding:8px 16px;border:1px #f0f0f0 solid}.mt-table tbody tr td[data-v-46d3894f]{padding:16px;border:1px #f0f0f0 solid}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g={class:"mt-table"},f=["colspan","rowspan"],E=["colspan","rowspan"],v=e.defineComponent({name:"MtTable",__name:"table",props:{data:{default:()=>[]},config:{default:()=>[]}},setup(y){const m=y,u=e.computed(()=>m.config.map(l=>({...l,columns:l.columns.filter(c=>c.title)}))),p=e.computed(()=>m.config.map(l=>({...l,columns:l.columns.filter(c=>c.dataKey)}))),S=e.computed(()=>{const l=u.value.map(n=>n.columns.reduce((t,o)=>{var a;return t+(((a=o.head)==null?void 0:a.colSpan)||1)},0)),c=p.value.map(n=>n.columns.reduce((t,o)=>{var a;return t+(((a=o.cell)==null?void 0:a.colSpan)||1)},0));return Math.max(...l,...c)}),B=e.computed(()=>{const l=u.value.map(c=>c.columns.map(n=>{var t;return((t=n.head)==null?void 0:t.colSpan)||0}));return i(l)}),h=e.computed(()=>{const l=p.value.map(c=>c.columns.map(n=>{var t;return((t=n.cell)==null?void 0:t.colSpan)||0}));return i(l)});function i(l){return l.map(c=>{const n=c.filter(Boolean),t=n.reduce((r,s)=>r+s,0);let o=c.length-n.length,a=S.value-t;return c.map(r=>(!r&&a>0&&(r=Math.ceil(a/o),o--,a-=r),r))})}return(l,c)=>(e.openBlock(),e.createElementBlock("table",g,[e.createElementVNode("thead",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(n,t)=>(e.openBlock(),e.createElementBlock("tr",{key:t,style:e.normalizeStyle(n.headStyle)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(o,a)=>{var r,s;return e.openBlock(),e.createElementBlock("th",{key:`${o.title}-${a}`,colspan:B.value[t][a],rowspan:(r=o.head)==null?void 0:r.rowSpan,style:e.normalizeStyle((s=o.head)==null?void 0:s.style)},[e.renderSlot(l.$slots,"header",{column:o,columnIndex:a,row:n,rowIndex:t},()=>[e.createTextVNode(e.toDisplayString(o.title),1)],!0)],12,f)}),128))],4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.data,(n,t)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(o,a)=>(e.openBlock(),e.createElementBlock("tr",{key:a,style:e.normalizeStyle(o.rowStyle)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columns,(r,s)=>{var d,k;return e.openBlock(),e.createElementBlock("td",{key:`${r.dataKey}-${s}`,colspan:h.value[a][s],rowspan:(d=r.cell)==null?void 0:d.rowSpan,style:e.normalizeStyle((k=r.cell)==null?void 0:k.style)},[e.renderSlot(l.$slots,"cell",{column:r,columnIndex:s,dataIndex:t,record:n,row:o,rowIndex:a},()=>[e.createTextVNode(e.toDisplayString(n[r.dataKey]),1)],!0)],12,E)}),128))],4))),128))],64))),128))])]))}});exports.default=v;
|
2
|
-
//# sourceMappingURL=table.vue2.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"table.vue2.js","sources":["../../../../../../packages/components/table/src/table.vue"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { TableProps } from './table';\r\nimport { computed } from 'vue';\r\n\r\ndefineOptions({ name: 'MtTable' });\r\n\r\nconst props = withDefaults(defineProps<TableProps>(), {\r\n data: () => [],\r\n config: () => [],\r\n});\r\n\r\n/** 表头配置 */\r\nconst headConfig = computed(() => {\r\n return props.config.map(rowItem => ({ ...rowItem, columns: rowItem.columns.filter(column => column.title) }));\r\n});\r\n\r\n/** 数据配置 */\r\nconst dataConfig = computed(() => {\r\n return props.config.map(rowItem => ({ ...rowItem, columns: rowItem.columns.filter(column => column.dataKey) }));\r\n});\r\n\r\n/** 最大列数 */\r\nconst maxColSpan = computed(() => {\r\n const handReduce = headConfig.value.map(item => item.columns.reduce((pre, cur) => pre + (cur.head?.colSpan || 1), 0));\r\n const cellReduce = dataConfig.value.map(item => item.columns.reduce((pre, cur) => pre + (cur.cell?.colSpan || 1), 0));\r\n return Math.max(...handReduce, ...cellReduce);\r\n});\r\n\r\n/** 表头列合并 */\r\nconst headColSpan = computed(() => {\r\n const colSpanList = headConfig.value.map(item => item.columns.map(column => column.head?.colSpan || 0));\r\n return getColSpanData(colSpanList);\r\n});\r\n\r\n/** 数据列合并 */\r\nconst dataColSpan = computed(() => {\r\n const colSpanList = dataConfig.value.map(item => item.columns.map(column => column.cell?.colSpan || 0));\r\n return getColSpanData(colSpanList);\r\n});\r\n\r\n/** 获取合并列数组 */\r\nfunction getColSpanData(colSpanList: number[][]) {\r\n return colSpanList.map((columns) => {\r\n const colSpanColumns = columns.filter(Boolean); // 已分配colSpan的列\r\n const beenColSpan = colSpanColumns.reduce((pur, cur) => pur + cur, 0); // 总colSpan\r\n let remainCount = columns.length - colSpanColumns.length; // 剩余未配置colSpan的列数\r\n let remainColSpan = maxColSpan.value - beenColSpan; // 剩余可分配的colSpan\r\n return columns.map((colSpan) => {\r\n if (!colSpan && remainColSpan > 0) {\r\n colSpan = Math.ceil(remainColSpan / remainCount); // 每列平均分配colSpan\r\n remainCount--;\r\n remainColSpan -= colSpan;\r\n }\r\n return colSpan;\r\n });\r\n });\r\n}\r\n</script>\r\n\r\n<template>\r\n <table class=\"mt-table\">\r\n <!-- 表头 -->\r\n <thead>\r\n <tr\r\n v-for=\"(row, rowIndex) in headConfig\"\r\n :key=\"rowIndex\"\r\n :style=\"row.headStyle\"\r\n >\r\n <template v-for=\"(column, columnIndex) in row.columns\" :key=\"`${column.title}-${columnIndex}`\">\r\n <th\r\n :colspan=\"headColSpan[rowIndex][columnIndex]\"\r\n :rowspan=\"column.head?.rowSpan\"\r\n :style=\"column.head?.style\"\r\n >\r\n <slot\r\n :column=\"column\"\r\n :column-index=\"columnIndex\"\r\n :row=\"row\"\r\n :row-index=\"rowIndex\"\r\n name=\"header\"\r\n >\r\n {{ column.title }}\r\n </slot>\r\n </th>\r\n </template>\r\n </tr>\r\n </thead>\r\n <!-- 表体 -->\r\n <tbody>\r\n <template\r\n v-for=\"(record, dataIndex) in data\"\r\n :key=\"dataIndex\"\r\n >\r\n <tr\r\n v-for=\"(row, rowIndex) in dataConfig\"\r\n :key=\"rowIndex\"\r\n :style=\"row.rowStyle\"\r\n >\r\n <template v-for=\"(column, columnIndex) in row.columns\" :key=\"`${column.dataKey}-${columnIndex}`\">\r\n <td\r\n :colspan=\"dataColSpan[rowIndex][columnIndex]\"\r\n :rowspan=\"column.cell?.rowSpan\"\r\n :style=\"column.cell?.style\"\r\n >\r\n <slot\r\n :column=\"column\"\r\n :column-index=\"columnIndex\"\r\n :data-index=\"dataIndex\"\r\n name=\"cell\"\r\n :record=\"record\"\r\n :row=\"row\"\r\n :row-index=\"rowIndex\"\r\n >\r\n {{ record[column.dataKey!] }}\r\n </slot>\r\n </td>\r\n </template>\r\n </tr>\r\n </template>\r\n </tbody>\r\n </table>\r\n</template>\r\n\r\n<style lang=\"scss\" scoped>\r\n.mt-table {\r\n width: 100%;\r\n max-width: 100%;\r\n border-spacing: 0;\r\n border-collapse: collapse;\r\n\r\n thead {\r\n tr {\r\n th {\r\n padding: 8px 16px;\r\n border: 1px #f0f0f0 solid;\r\n }\r\n }\r\n }\r\n\r\n tbody {\r\n tr {\r\n td {\r\n padding: 16px;\r\n border: 1px #f0f0f0 solid;\r\n }\r\n }\r\n }\r\n}\r\n</style>\r\n"],"names":["props","__props","headConfig","computed","rowItem","column","dataConfig","maxColSpan","handReduce","item","pre","cur","_a","cellReduce","headColSpan","colSpanList","getColSpanData","dataColSpan","columns","colSpanColumns","beenColSpan","pur","remainCount","remainColSpan","colSpan"],"mappings":"0TAMA,MAAMA,EAAQC,EAMRC,EAAaC,EAAAA,SAAS,IACnBH,EAAM,OAAO,IAAII,IAAY,CAAE,GAAGA,EAAS,QAASA,EAAQ,QAAQ,OAAOC,GAAUA,EAAO,KAAK,GAAI,CAC7G,EAGKC,EAAaH,EAAAA,SAAS,IACnBH,EAAM,OAAO,IAAII,IAAY,CAAE,GAAGA,EAAS,QAASA,EAAQ,QAAQ,OAAOC,GAAUA,EAAO,OAAO,GAAI,CAC/G,EAGKE,EAAaJ,EAAAA,SAAS,IAAM,CAChC,MAAMK,EAAaN,EAAW,MAAM,IAAIO,GAAQA,EAAK,QAAQ,OAAO,CAACC,EAAKC,WAAQ,OAAAD,KAAOE,EAAAD,EAAI,OAAJ,YAAAC,EAAU,UAAW,IAAI,CAAC,CAAC,EAC9GC,EAAaP,EAAW,MAAM,IAAIG,GAAQA,EAAK,QAAQ,OAAO,CAACC,EAAKC,WAAQ,OAAAD,KAAOE,EAAAD,EAAI,OAAJ,YAAAC,EAAU,UAAW,IAAI,CAAC,CAAC,EACpH,OAAO,KAAK,IAAI,GAAGJ,EAAY,GAAGK,CAAU,CAAA,CAC7C,EAGKC,EAAcX,EAAAA,SAAS,IAAM,CACjC,MAAMY,EAAcb,EAAW,MAAM,IAAYO,GAAAA,EAAK,QAAQ,IAAcJ,GAAA,OAAA,QAAAO,EAAAP,EAAO,OAAP,YAAAO,EAAa,UAAW,EAAC,CAAC,EACtG,OAAOI,EAAeD,CAAW,CAAA,CAClC,EAGKE,EAAcd,EAAAA,SAAS,IAAM,CACjC,MAAMY,EAAcT,EAAW,MAAM,IAAYG,GAAAA,EAAK,QAAQ,IAAcJ,GAAA,OAAA,QAAAO,EAAAP,EAAO,OAAP,YAAAO,EAAa,UAAW,EAAC,CAAC,EACtG,OAAOI,EAAeD,CAAW,CAAA,CAClC,EAGD,SAASC,EAAeD,EAAyB,CACxC,OAAAA,EAAY,IAAKG,GAAY,CAC5B,MAAAC,EAAiBD,EAAQ,OAAO,OAAO,EACvCE,EAAcD,EAAe,OAAO,CAACE,EAAKV,IAAQU,EAAMV,EAAK,CAAC,EAChE,IAAAW,EAAcJ,EAAQ,OAASC,EAAe,OAC9CI,EAAgBhB,EAAW,MAAQa,EAChC,OAAAF,EAAQ,IAAKM,IACd,CAACA,GAAWD,EAAgB,IACpBC,EAAA,KAAK,KAAKD,EAAgBD,CAAW,EAC/CA,IACiBC,GAAAC,GAEZA,EACR,CAAA,CACF,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"install.js","sources":["../../../../../packages/components/utils/install.ts"],"sourcesContent":["import type { App, Component, Plugin } from 'vue';\r\n\r\nexport function withInstall<T extends Component>(comp: T) {\r\n (comp as T & Plugin).install = (app: App): void => {\r\n if (comp.name) {\r\n app.component(comp.name, comp);\r\n }\r\n };\r\n return comp;\r\n}\r\n"],"names":["withInstall","comp","app"],"mappings":"gFAEO,SAASA,EAAiCC,EAAS,CACvD,OAAAA,EAAoB,QAAWC,GAAmB,CAC7CD,EAAK,MACHC,EAAA,UAAUD,EAAK,KAAMA,CAAI,CAEjC,EACOA,CACT"}
|
package/lib/index.js
DELETED
@@ -1,2 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./components/installer.js"),t=require("./components/component-neo/index.js"),o=require("./components/expand/index.js"),n=require("./components/sort/index.js"),r=require("./components/table/index.js"),u=require("./components/component-neo/src/hooks/use-component-neo.js");exports.default=e.default;exports.MtComponentNeo=t.MtComponentNeo;exports.MtExpand=o.MtExpand;exports.MtSort=n.MtSort;exports.MtTable=r.MtTable;exports.useComponentNeo=u.useComponentNeo;
|
2
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
@@ -1,50 +0,0 @@
|
|
1
|
-
export declare const MtComponentNeo: {
|
2
|
-
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('.').ComponentNeoProps> & Readonly<{
|
3
|
-
onToggleComponent?: ((name?: string | undefined, ref?: any) => any) | undefined;
|
4
|
-
}>, {
|
5
|
-
componentRef: import('vue').Ref<any, any>;
|
6
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
7
|
-
toggleComponent: (name?: string | undefined, ref?: any) => any;
|
8
|
-
}, import('vue').PublicProps, {
|
9
|
-
uniqueId: string;
|
10
|
-
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
11
|
-
P: {};
|
12
|
-
B: {};
|
13
|
-
D: {};
|
14
|
-
C: {};
|
15
|
-
M: {};
|
16
|
-
Defaults: {};
|
17
|
-
}, Readonly<import('.').ComponentNeoProps> & Readonly<{
|
18
|
-
onToggleComponent?: ((name?: string | undefined, ref?: any) => any) | undefined;
|
19
|
-
}>, {
|
20
|
-
componentRef: import('vue').Ref<any, any>;
|
21
|
-
}, {}, {}, {}, {
|
22
|
-
uniqueId: string;
|
23
|
-
}>;
|
24
|
-
__isFragment?: never;
|
25
|
-
__isTeleport?: never;
|
26
|
-
__isSuspense?: never;
|
27
|
-
} & import('vue').ComponentOptionsBase<Readonly<import('.').ComponentNeoProps> & Readonly<{
|
28
|
-
onToggleComponent?: ((name?: string | undefined, ref?: any) => any) | undefined;
|
29
|
-
}>, {
|
30
|
-
componentRef: import('vue').Ref<any, any>;
|
31
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
32
|
-
toggleComponent: (name?: string | undefined, ref?: any) => any;
|
33
|
-
}, string, {
|
34
|
-
uniqueId: string;
|
35
|
-
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
36
|
-
$slots: {
|
37
|
-
default?(_: {
|
38
|
-
Component: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
39
|
-
[key: string]: any;
|
40
|
-
}>;
|
41
|
-
compRef: (el: Element) => Element;
|
42
|
-
attrs: Record<string, unknown> & {
|
43
|
-
[x: string]: unknown;
|
44
|
-
};
|
45
|
-
compName: any;
|
46
|
-
}): any;
|
47
|
-
};
|
48
|
-
});
|
49
|
-
export * from './src/component-neo';
|
50
|
-
export * from './src/hooks/use-component-neo';
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { Component, DefineComponent, VNode } from 'vue';
|
2
|
-
export interface ComponentNeoProps {
|
3
|
-
/** 唯一标识 */
|
4
|
-
uniqueId?: string;
|
5
|
-
/** 渲染的组件 */
|
6
|
-
is?: string | Component;
|
7
|
-
}
|
8
|
-
export type InstanceComponent = DefineComponent<any, any, any, any, any, any, any, any, any, any>;
|
9
|
-
export type ComponentSlots = Record<string, (arg: any) => VNode>;
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import { ComponentNeoProps } from './component-neo';
|
2
|
-
declare function __VLS_template(): {
|
3
|
-
attrs: Partial<{}>;
|
4
|
-
slots: {
|
5
|
-
default?(_: {
|
6
|
-
Component: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
7
|
-
[key: string]: any;
|
8
|
-
}>;
|
9
|
-
compRef: (el: Element) => Element;
|
10
|
-
attrs: Record<string, unknown> & {
|
11
|
-
[x: string]: unknown;
|
12
|
-
};
|
13
|
-
compName: any;
|
14
|
-
}): any;
|
15
|
-
};
|
16
|
-
refs: {};
|
17
|
-
rootEl: any;
|
18
|
-
};
|
19
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
20
|
-
declare const __VLS_component: import('vue').DefineComponent<ComponentNeoProps, {
|
21
|
-
componentRef: import('vue').Ref<any, any>;
|
22
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
23
|
-
toggleComponent: (name?: string | undefined, ref?: any) => any;
|
24
|
-
}, string, import('vue').PublicProps, Readonly<ComponentNeoProps> & Readonly<{
|
25
|
-
onToggleComponent?: ((name?: string | undefined, ref?: any) => any) | undefined;
|
26
|
-
}>, {
|
27
|
-
uniqueId: string;
|
28
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
29
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
30
|
-
export default _default;
|
31
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
32
|
-
new (): {
|
33
|
-
$slots: S;
|
34
|
-
};
|
35
|
-
};
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { VNode } from 'vue';
|
2
|
-
import { ComponentSlots, InstanceComponent } from '../component-neo';
|
3
|
-
export type ImportComponentFn = () => Promise<Record<string, any>>;
|
4
|
-
export type DynamicComponent = InstanceComponent | ImportComponentFn | VNode;
|
5
|
-
export declare function useComponentNeo(uniqueId?: string): {
|
6
|
-
getComponentRef: () => any;
|
7
|
-
toggleComponent: (comp?: DynamicComponent, attrs?: Record<string, any>, slots?: ComponentSlots) => Promise<any>;
|
8
|
-
};
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { Ref, ShallowRef, VNode } from 'vue';
|
2
|
-
import { ComponentSlots, InstanceComponent } from '../component-neo';
|
3
|
-
interface ComponentRefsType {
|
4
|
-
/** 引用实例 */
|
5
|
-
Instance: Ref<any>;
|
6
|
-
/** 组件 */
|
7
|
-
comp: ShallowRef<InstanceComponent | VNode | undefined>;
|
8
|
-
/** 属性 */
|
9
|
-
attrs: Ref<Record<string, unknown>>;
|
10
|
-
/** 插槽 */
|
11
|
-
slots: Ref<ComponentSlots>;
|
12
|
-
}
|
13
|
-
interface ComponentData {
|
14
|
-
comp?: InstanceComponent | VNode;
|
15
|
-
attrs: Record<string, unknown>;
|
16
|
-
slots: ComponentSlots;
|
17
|
-
}
|
18
|
-
/** 组件状态 */
|
19
|
-
export declare const useComponentState: () => {
|
20
|
-
initComponent: (uniqueId?: string) => {
|
21
|
-
componentRef: Ref<any, any>;
|
22
|
-
componentNeo: ShallowRef<any>;
|
23
|
-
componentAttrs: Ref<Record<string, unknown>, Record<string, unknown>>;
|
24
|
-
componentSlots: Ref<ComponentSlots, ComponentSlots>;
|
25
|
-
};
|
26
|
-
setComponent: (uniqueId: string | undefined, args: ComponentData) => void;
|
27
|
-
getComponent: (uniqueId?: string) => ComponentRefsType | undefined;
|
28
|
-
removeComponent: (uniqueId?: string) => void;
|
29
|
-
};
|
30
|
-
export {};
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|