@fmdevui/fm-dev 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/es/core/hook/useVxeTableOptionsHook.d.ts +3362 -0
- package/es/core/index.d.ts +2 -0
- package/es/core/ui/loading/index.d.ts +9 -0
- package/es/index.mjs +2 -0
- package/es/packages/core/hook/useVxeTableOptionsHook.mjs +83 -0
- package/es/packages/core/index.mjs +2 -0
- package/es/packages/core/ui/loading/index.mjs +40 -0
- package/index.js +2383 -182
- package/index.min.js +37 -23
- package/index.min.mjs +37 -23
- package/index.mjs +2384 -185
- package/lib/core/hook/useVxeTableOptionsHook.d.ts +3362 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/ui/loading/index.d.ts +9 -0
- package/lib/index.js +45 -41
- package/lib/packages/core/hook/useVxeTableOptionsHook.js +85 -0
- package/lib/packages/core/index.js +45 -41
- package/lib/packages/core/ui/loading/index.js +42 -0
- package/package.json +1 -1
package/es/core/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './ui/login';
|
|
2
|
+
export * from './ui/loading';
|
|
2
3
|
export * from './api';
|
|
3
4
|
export * from './directive';
|
|
4
5
|
export * from './locales';
|
|
@@ -6,4 +7,5 @@ export * from './stores';
|
|
|
6
7
|
export * from './utils';
|
|
7
8
|
export * from './auth';
|
|
8
9
|
export * from './hook/dateTimeShortCust';
|
|
10
|
+
export * from './hook/useVxeTableOptionsHook';
|
|
9
11
|
export * from './types';
|
package/es/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import installer from './defaults.mjs';
|
|
|
2
2
|
import './packages/core/index.mjs';
|
|
3
3
|
export { version } from './version.mjs';
|
|
4
4
|
export { FmLogin } from './packages/core/ui/login/index.mjs';
|
|
5
|
+
export { NextLoading } from './packages/core/ui/loading/index.mjs';
|
|
5
6
|
export { useBaseApi } from './packages/core/api/base/index.mjs';
|
|
6
7
|
export { feature, useSysApi } from './packages/core/api/sys/index.mjs';
|
|
7
8
|
export { useLoginApi } from './packages/core/api/login/index.mjs';
|
|
@@ -28,6 +29,7 @@ export { getFileUrl } from './packages/core/utils/comm/uploadfileurl.mjs';
|
|
|
28
29
|
export { PUB } from './packages/core/utils/const/index.mjs';
|
|
29
30
|
export { auth, authAll, auths, hAuth, hAuthAll, hAuths } from './packages/core/auth/index.mjs';
|
|
30
31
|
export { useDateTimeShortCust } from './packages/core/hook/dateTimeShortCust.mjs';
|
|
32
|
+
export { useVxeTable } from './packages/core/hook/useVxeTableOptionsHook.mjs';
|
|
31
33
|
|
|
32
34
|
const install = installer.install;
|
|
33
35
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { reactive } from 'vue';
|
|
2
|
+
import { dayjs } from 'element-plus';
|
|
3
|
+
import '../stores/index.mjs';
|
|
4
|
+
import { merge } from 'lodash-es';
|
|
5
|
+
import { useThemeConfig } from '../stores/themeConfig.mjs';
|
|
6
|
+
import { pinia } from '../stores/inpinia.mjs';
|
|
7
|
+
|
|
8
|
+
const vxeSize = useThemeConfig(pinia).themeConfig.globalComponentSize == "small" ? "mini" : useThemeConfig(pinia).themeConfig.globalComponentSize == "default" ? "small" : "medium";
|
|
9
|
+
const useVxeTable = (opt, extras) => {
|
|
10
|
+
opt.id = opt.id ? opt.id : String((/* @__PURE__ */ new Date()).getTime());
|
|
11
|
+
const options = reactive({
|
|
12
|
+
id: opt.id,
|
|
13
|
+
height: "auto",
|
|
14
|
+
autoResize: true,
|
|
15
|
+
size: vxeSize,
|
|
16
|
+
loading: false,
|
|
17
|
+
align: "center",
|
|
18
|
+
// 自动监听父元素的变化去重新计算表格(对于父元素可能存在动态变化、显示隐藏的容器中、列宽异常等场景中的可能会用到)
|
|
19
|
+
// data: [] as Array<T>,
|
|
20
|
+
columns: opt.columns,
|
|
21
|
+
showFooter: opt.showFooter,
|
|
22
|
+
footerData: opt.footerData,
|
|
23
|
+
footerMethod: opt.footerMethod,
|
|
24
|
+
toolbarConfig: {
|
|
25
|
+
size: vxeSize,
|
|
26
|
+
slots: { buttons: "toolbar_buttons", tools: "toolbar_tools" },
|
|
27
|
+
refresh: {
|
|
28
|
+
code: "query"
|
|
29
|
+
},
|
|
30
|
+
export: true,
|
|
31
|
+
print: true,
|
|
32
|
+
zoom: true,
|
|
33
|
+
custom: true
|
|
34
|
+
},
|
|
35
|
+
checkboxConfig: { range: true },
|
|
36
|
+
// sortConfig: { trigger: 'cell', remote: true },
|
|
37
|
+
exportConfig: {
|
|
38
|
+
remote: false,
|
|
39
|
+
// 设置使用服务端导出
|
|
40
|
+
filename: `${opt.name}\u5BFC\u51FA_${dayjs().format("YYMMDDHHmmss")}`
|
|
41
|
+
},
|
|
42
|
+
pagerConfig: {
|
|
43
|
+
enabled: true,
|
|
44
|
+
size: vxeSize,
|
|
45
|
+
pageSize: 50
|
|
46
|
+
},
|
|
47
|
+
printConfig: { sheetName: "" },
|
|
48
|
+
customConfig: {
|
|
49
|
+
storage: {
|
|
50
|
+
// 是否启用 localStorage 本地保存,会将列操作状态保留在本地(需要有 id)
|
|
51
|
+
visible: true,
|
|
52
|
+
// 启用显示/隐藏列状态
|
|
53
|
+
resizable: true
|
|
54
|
+
// 启用列宽状态
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
if (opt.data) {
|
|
59
|
+
options.data = opt.data;
|
|
60
|
+
} else {
|
|
61
|
+
options.proxyConfig = {
|
|
62
|
+
enabled: true,
|
|
63
|
+
autoLoad: false,
|
|
64
|
+
sort: true,
|
|
65
|
+
props: {
|
|
66
|
+
list: "data.result",
|
|
67
|
+
// 全量
|
|
68
|
+
result: "data.result.items",
|
|
69
|
+
// 分页
|
|
70
|
+
total: "data.result.total",
|
|
71
|
+
message: "data.message"
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (opt.sortConfig) {
|
|
76
|
+
options.sortConfig = opt.sortConfig;
|
|
77
|
+
} else {
|
|
78
|
+
options.sortConfig = { remote: true };
|
|
79
|
+
}
|
|
80
|
+
return extras ? merge(options, extras) : options;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { useVxeTable };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { FmLogin } from './ui/login/index.mjs';
|
|
2
|
+
export { NextLoading } from './ui/loading/index.mjs';
|
|
2
3
|
import './api/index.mjs';
|
|
3
4
|
export { directive } from './directive/index.mjs';
|
|
4
5
|
export { getCountryCode, i18n, iso_3166_1_CountryList, languageList, mergMessage, setupI18n } from './locales/index.mjs';
|
|
@@ -6,6 +7,7 @@ import './stores/index.mjs';
|
|
|
6
7
|
import './utils/index.mjs';
|
|
7
8
|
export { auth, authAll, auths, hAuth, hAuthAll, hAuths } from './auth/index.mjs';
|
|
8
9
|
export { useDateTimeShortCust } from './hook/dateTimeShortCust.mjs';
|
|
10
|
+
export { useVxeTable } from './hook/useVxeTableOptionsHook.mjs';
|
|
9
11
|
import './types/index.mjs';
|
|
10
12
|
export { useBaseApi } from './api/base/index.mjs';
|
|
11
13
|
export { feature, useSysApi } from './api/sys/index.mjs';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { nextTick } from 'vue';
|
|
2
|
+
|
|
3
|
+
const NextLoading = {
|
|
4
|
+
// 创建 loading
|
|
5
|
+
start: () => {
|
|
6
|
+
const bodys = document.body;
|
|
7
|
+
const div = document.createElement("div");
|
|
8
|
+
div.setAttribute("class", "loading-next");
|
|
9
|
+
const htmls = `
|
|
10
|
+
<div class="loading-next-box">
|
|
11
|
+
<div class="loading-next-box-warp">
|
|
12
|
+
<div class="loading-next-box-item"></div>
|
|
13
|
+
<div class="loading-next-box-item"></div>
|
|
14
|
+
<div class="loading-next-box-item"></div>
|
|
15
|
+
<div class="loading-next-box-item"></div>
|
|
16
|
+
<div class="loading-next-box-item"></div>
|
|
17
|
+
<div class="loading-next-box-item"></div>
|
|
18
|
+
<div class="loading-next-box-item"></div>
|
|
19
|
+
<div class="loading-next-box-item"></div>
|
|
20
|
+
<div class="loading-next-box-item"></div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
div.innerHTML = htmls;
|
|
25
|
+
bodys.insertBefore(div, bodys.childNodes[0]);
|
|
26
|
+
window.nextLoading = true;
|
|
27
|
+
},
|
|
28
|
+
// 移除 loading
|
|
29
|
+
done: (time = 0) => {
|
|
30
|
+
nextTick(() => {
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
window.nextLoading = false;
|
|
33
|
+
const el = document.querySelector(".loading-next");
|
|
34
|
+
el?.parentNode?.removeChild(el);
|
|
35
|
+
}, time);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { NextLoading };
|