@minilo/ui 0.0.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/README.md +44 -0
- package/minilo/dist/index.css +1 -0
- package/minilo/dist/index.full.js +7054 -0
- package/minilo/dist/index.full.min.js +2 -0
- package/minilo/dist/index.full.min.js.map +1 -0
- package/minilo/dist/index.full.min.mjs +2 -0
- package/minilo/dist/index.full.min.mjs.map +1 -0
- package/minilo/dist/index.full.mjs +7041 -0
- package/minilo/es/components/button/index.d.ts +47 -0
- package/minilo/es/components/button/index.mjs +6 -0
- package/minilo/es/components/button/index.vue.d.ts +29 -0
- package/minilo/es/components/button/index.vue.mjs +5 -0
- package/minilo/es/components/button/index.vue2.mjs +67 -0
- package/minilo/es/components/button/type.d.ts +10 -0
- package/minilo/es/components/button/type.mjs +1 -0
- package/minilo/es/components/chart/index.d.ts +49 -0
- package/minilo/es/components/chart/index.mjs +6 -0
- package/minilo/es/components/chart/index.vue.d.ts +33 -0
- package/minilo/es/components/chart/index.vue.mjs +5 -0
- package/minilo/es/components/chart/index.vue2.mjs +124 -0
- package/minilo/es/components/chart/type.d.ts +7 -0
- package/minilo/es/components/chart/type.mjs +1 -0
- package/minilo/es/components/detail/index.d.ts +37 -0
- package/minilo/es/components/detail/index.mjs +6 -0
- package/minilo/es/components/detail/index.vue.d.ts +23 -0
- package/minilo/es/components/detail/index.vue.mjs +5 -0
- package/minilo/es/components/detail/index.vue2.mjs +194 -0
- package/minilo/es/components/detail/renderLabel.vue.d.ts +8 -0
- package/minilo/es/components/detail/renderLabel.vue.mjs +5 -0
- package/minilo/es/components/detail/renderLabel.vue2.mjs +23 -0
- package/minilo/es/components/detail/renderTooltip.vue.d.ts +8 -0
- package/minilo/es/components/detail/renderTooltip.vue.mjs +5 -0
- package/minilo/es/components/detail/renderTooltip.vue2.mjs +23 -0
- package/minilo/es/components/detail/type.d.ts +27 -0
- package/minilo/es/components/detail/type.mjs +1 -0
- package/minilo/es/components/index.d.ts +7 -0
- package/minilo/es/components/index.mjs +7 -0
- package/minilo/es/components/number-range-input/index.d.ts +41 -0
- package/minilo/es/components/number-range-input/index.mjs +6 -0
- package/minilo/es/components/number-range-input/index.vue.d.ts +33 -0
- package/minilo/es/components/number-range-input/index.vue.mjs +5 -0
- package/minilo/es/components/number-range-input/index.vue2.mjs +150 -0
- package/minilo/es/components/number-range-input/props.d.ts +10 -0
- package/minilo/es/components/number-range-input/props.mjs +1 -0
- package/minilo/es/components/search/index.d.ts +586 -0
- package/minilo/es/components/search/index.mjs +6 -0
- package/minilo/es/components/search/index.vue.d.ts +750 -0
- package/minilo/es/components/search/index.vue.mjs +5 -0
- package/minilo/es/components/search/index.vue2.mjs +298 -0
- package/minilo/es/components/search/props.d.ts +107 -0
- package/minilo/es/components/search/props.mjs +55 -0
- package/minilo/es/components/search-table/index.d.ts +274 -0
- package/minilo/es/components/search-table/index.mjs +6 -0
- package/minilo/es/components/search-table/index.vue.d.ts +173 -0
- package/minilo/es/components/search-table/index.vue.mjs +5 -0
- package/minilo/es/components/search-table/index.vue2.mjs +195 -0
- package/minilo/es/components/search-table/props.d.ts +69 -0
- package/minilo/es/components/search-table/props.mjs +69 -0
- package/minilo/es/components/search-table/render.d.ts +11 -0
- package/minilo/es/components/search-table/render.mjs +19 -0
- package/minilo/es/components/virtual-list/index.d.ts +59 -0
- package/minilo/es/components/virtual-list/index.mjs +6 -0
- package/minilo/es/components/virtual-list/index.vue.d.ts +39 -0
- package/minilo/es/components/virtual-list/index.vue.mjs +5 -0
- package/minilo/es/components/virtual-list/index.vue2.mjs +421 -0
- package/minilo/es/components/virtual-list/type.d.ts +20 -0
- package/minilo/es/components/virtual-list/type.mjs +1 -0
- package/minilo/es/index.d.ts +1087 -0
- package/minilo/es/node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.17_typescript@5.8.3_/node_modules/@element-plus/icons-vue/dist/index.mjs +25 -0
- package/minilo/es/node_modules/.pnpm/@vueuse_core@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/core/index.mjs +73 -0
- package/minilo/es/node_modules/.pnpm/@vueuse_shared@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/shared/index.mjs +76 -0
- package/minilo/es/packages/utils/dist/func/common.mjs +14 -0
- package/minilo/es/packages/utils/dist/request/index.mjs +110 -0
- package/minilo/es/resolver/index.d.ts +8 -0
- package/minilo/es/resolver/index.mjs +26 -0
- package/minilo/es/utils/index.d.ts +28 -0
- package/minilo/es/utils/index.mjs +30 -0
- package/minilo/lib/components/button/index.d.ts +47 -0
- package/minilo/lib/components/button/index.js +11 -0
- package/minilo/lib/components/button/index.vue.d.ts +29 -0
- package/minilo/lib/components/button/index.vue.js +9 -0
- package/minilo/lib/components/button/index.vue2.js +71 -0
- package/minilo/lib/components/button/type.d.ts +10 -0
- package/minilo/lib/components/button/type.js +2 -0
- package/minilo/lib/components/chart/index.d.ts +49 -0
- package/minilo/lib/components/chart/index.js +11 -0
- package/minilo/lib/components/chart/index.vue.d.ts +33 -0
- package/minilo/lib/components/chart/index.vue.js +9 -0
- package/minilo/lib/components/chart/index.vue2.js +128 -0
- package/minilo/lib/components/chart/type.d.ts +7 -0
- package/minilo/lib/components/chart/type.js +2 -0
- package/minilo/lib/components/detail/index.d.ts +37 -0
- package/minilo/lib/components/detail/index.js +11 -0
- package/minilo/lib/components/detail/index.vue.d.ts +23 -0
- package/minilo/lib/components/detail/index.vue.js +9 -0
- package/minilo/lib/components/detail/index.vue2.js +198 -0
- package/minilo/lib/components/detail/renderLabel.vue.d.ts +8 -0
- package/minilo/lib/components/detail/renderLabel.vue.js +9 -0
- package/minilo/lib/components/detail/renderLabel.vue2.js +27 -0
- package/minilo/lib/components/detail/renderTooltip.vue.d.ts +8 -0
- package/minilo/lib/components/detail/renderTooltip.vue.js +9 -0
- package/minilo/lib/components/detail/renderTooltip.vue2.js +27 -0
- package/minilo/lib/components/detail/type.d.ts +27 -0
- package/minilo/lib/components/detail/type.js +2 -0
- package/minilo/lib/components/index.d.ts +7 -0
- package/minilo/lib/components/index.js +19 -0
- package/minilo/lib/components/number-range-input/index.d.ts +41 -0
- package/minilo/lib/components/number-range-input/index.js +11 -0
- package/minilo/lib/components/number-range-input/index.vue.d.ts +33 -0
- package/minilo/lib/components/number-range-input/index.vue.js +9 -0
- package/minilo/lib/components/number-range-input/index.vue2.js +154 -0
- package/minilo/lib/components/number-range-input/props.d.ts +10 -0
- package/minilo/lib/components/number-range-input/props.js +2 -0
- package/minilo/lib/components/search/index.d.ts +586 -0
- package/minilo/lib/components/search/index.js +11 -0
- package/minilo/lib/components/search/index.vue.d.ts +750 -0
- package/minilo/lib/components/search/index.vue.js +9 -0
- package/minilo/lib/components/search/index.vue2.js +302 -0
- package/minilo/lib/components/search/props.d.ts +107 -0
- package/minilo/lib/components/search/props.js +58 -0
- package/minilo/lib/components/search-table/index.d.ts +274 -0
- package/minilo/lib/components/search-table/index.js +11 -0
- package/minilo/lib/components/search-table/index.vue.d.ts +173 -0
- package/minilo/lib/components/search-table/index.vue.js +9 -0
- package/minilo/lib/components/search-table/index.vue2.js +199 -0
- package/minilo/lib/components/search-table/props.d.ts +69 -0
- package/minilo/lib/components/search-table/props.js +72 -0
- package/minilo/lib/components/search-table/render.d.ts +11 -0
- package/minilo/lib/components/search-table/render.js +23 -0
- package/minilo/lib/components/virtual-list/index.d.ts +59 -0
- package/minilo/lib/components/virtual-list/index.js +11 -0
- package/minilo/lib/components/virtual-list/index.vue.d.ts +39 -0
- package/minilo/lib/components/virtual-list/index.vue.js +9 -0
- package/minilo/lib/components/virtual-list/index.vue2.js +425 -0
- package/minilo/lib/components/virtual-list/type.d.ts +20 -0
- package/minilo/lib/components/virtual-list/type.js +2 -0
- package/minilo/lib/index.d.ts +1087 -0
- package/minilo/lib/node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.17_typescript@5.8.3_/node_modules/@element-plus/icons-vue/dist/index.js +27 -0
- package/minilo/lib/node_modules/.pnpm/@vueuse_core@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/core/index.js +84 -0
- package/minilo/lib/node_modules/.pnpm/@vueuse_shared@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/shared/index.js +83 -0
- package/minilo/lib/packages/utils/dist/func/common.js +16 -0
- package/minilo/lib/packages/utils/dist/request/index.js +120 -0
- package/minilo/lib/resolver/index.d.ts +8 -0
- package/minilo/lib/resolver/index.js +28 -0
- package/minilo/lib/utils/index.d.ts +28 -0
- package/minilo/lib/utils/index.js +34 -0
- package/minilo/theme-chalk/index.css +1 -0
- package/minilo/theme-chalk/ml-button.css +1 -0
- package/minilo/theme-chalk/ml-chart.css +1 -0
- package/minilo/theme-chalk/ml-detail.css +1 -0
- package/minilo/theme-chalk/ml-number-range-input.css +1 -0
- package/minilo/theme-chalk/ml-search-table.css +1 -0
- package/minilo/theme-chalk/ml-search.css +1 -0
- package/minilo/theme-chalk/ml-virtual-list.css +1 -0
- package/minilo/theme-chalk/src/button.scss +22 -0
- package/minilo/theme-chalk/src/chart.scss +11 -0
- package/minilo/theme-chalk/src/default/variable.scss +1 -0
- package/minilo/theme-chalk/src/detail.scss +9 -0
- package/minilo/theme-chalk/src/index.scss +12 -0
- package/minilo/theme-chalk/src/mixins/mixin.scss +273 -0
- package/minilo/theme-chalk/src/number-range-input.scss +9 -0
- package/minilo/theme-chalk/src/search-table.scss +47 -0
- package/minilo/theme-chalk/src/search.scss +20 -0
- package/minilo/theme-chalk/src/virtual-list.scss +49 -0
- package/package.json +107 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, createElementVNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
var warning_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
4
|
+
name: "Warning",
|
|
5
|
+
__name: "warning",
|
|
6
|
+
setup(__props) {
|
|
7
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
viewBox: "0 0 1024 1024"
|
|
10
|
+
}, [
|
|
11
|
+
createElementVNode("path", {
|
|
12
|
+
fill: "currentColor",
|
|
13
|
+
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768m48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0m-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
|
|
14
|
+
})
|
|
15
|
+
]));
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var warning_default = warning_vue_vue_type_script_setup_true_lang_default;
|
|
19
|
+
/*! Bundled license information:
|
|
20
|
+
|
|
21
|
+
@element-plus/icons-vue/dist/index.js:
|
|
22
|
+
(*! Element Plus Icons Vue v2.3.1 *)
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export { warning_default as Warning };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { tryOnScopeDispose, isClient } from '../../../../@vueuse_shared@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/shared/index.mjs';
|
|
2
|
+
export { createFilterWrapper, debounceFilter, noop, useDebounceFn } from '../../../../@vueuse_shared@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/shared/index.mjs';
|
|
3
|
+
import { computed, toValue, watch, shallowRef, getCurrentInstance, onMounted } from 'vue';
|
|
4
|
+
|
|
5
|
+
const defaultWindow = isClient ? window : void 0;
|
|
6
|
+
|
|
7
|
+
function unrefElement(elRef) {
|
|
8
|
+
var _a;
|
|
9
|
+
const plain = toValue(elRef);
|
|
10
|
+
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// @__NO_SIDE_EFFECTS__
|
|
14
|
+
function useMounted() {
|
|
15
|
+
const isMounted = shallowRef(false);
|
|
16
|
+
const instance = getCurrentInstance();
|
|
17
|
+
if (instance) {
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
isMounted.value = true;
|
|
20
|
+
}, instance);
|
|
21
|
+
}
|
|
22
|
+
return isMounted;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// @__NO_SIDE_EFFECTS__
|
|
26
|
+
function useSupported(callback) {
|
|
27
|
+
const isMounted = useMounted();
|
|
28
|
+
return computed(() => {
|
|
29
|
+
isMounted.value;
|
|
30
|
+
return Boolean(callback());
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function useResizeObserver(target, callback, options = {}) {
|
|
35
|
+
const { window = defaultWindow, ...observerOptions } = options;
|
|
36
|
+
let observer;
|
|
37
|
+
const isSupported = useSupported(() => window && "ResizeObserver" in window);
|
|
38
|
+
const cleanup = () => {
|
|
39
|
+
if (observer) {
|
|
40
|
+
observer.disconnect();
|
|
41
|
+
observer = void 0;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const targets = computed(() => {
|
|
45
|
+
const _targets = toValue(target);
|
|
46
|
+
return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
|
|
47
|
+
});
|
|
48
|
+
const stopWatch = watch(
|
|
49
|
+
targets,
|
|
50
|
+
(els) => {
|
|
51
|
+
cleanup();
|
|
52
|
+
if (isSupported.value && window) {
|
|
53
|
+
observer = new ResizeObserver(callback);
|
|
54
|
+
for (const _el of els) {
|
|
55
|
+
if (_el)
|
|
56
|
+
observer.observe(_el, observerOptions);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{ immediate: true, flush: "post" }
|
|
61
|
+
);
|
|
62
|
+
const stop = () => {
|
|
63
|
+
cleanup();
|
|
64
|
+
stopWatch();
|
|
65
|
+
};
|
|
66
|
+
tryOnScopeDispose(stop);
|
|
67
|
+
return {
|
|
68
|
+
isSupported,
|
|
69
|
+
stop
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { defaultWindow, isClient, tryOnScopeDispose, unrefElement, useMounted, useResizeObserver, useSupported };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { getCurrentScope, onScopeDispose, toValue } from 'vue';
|
|
2
|
+
|
|
3
|
+
function tryOnScopeDispose(fn) {
|
|
4
|
+
if (getCurrentScope()) {
|
|
5
|
+
onScopeDispose(fn);
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
12
|
+
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
13
|
+
const noop = () => {
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function createFilterWrapper(filter, fn) {
|
|
17
|
+
function wrapper(...args) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return wrapper;
|
|
23
|
+
}
|
|
24
|
+
function debounceFilter(ms, options = {}) {
|
|
25
|
+
let timer;
|
|
26
|
+
let maxTimer;
|
|
27
|
+
let lastRejector = noop;
|
|
28
|
+
const _clearTimeout = (timer2) => {
|
|
29
|
+
clearTimeout(timer2);
|
|
30
|
+
lastRejector();
|
|
31
|
+
lastRejector = noop;
|
|
32
|
+
};
|
|
33
|
+
let lastInvoker;
|
|
34
|
+
const filter = (invoke) => {
|
|
35
|
+
const duration = toValue(ms);
|
|
36
|
+
const maxDuration = toValue(options.maxWait);
|
|
37
|
+
if (timer)
|
|
38
|
+
_clearTimeout(timer);
|
|
39
|
+
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
40
|
+
if (maxTimer) {
|
|
41
|
+
_clearTimeout(maxTimer);
|
|
42
|
+
maxTimer = void 0;
|
|
43
|
+
}
|
|
44
|
+
return Promise.resolve(invoke());
|
|
45
|
+
}
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
lastRejector = options.rejectOnCancel ? reject : resolve;
|
|
48
|
+
lastInvoker = invoke;
|
|
49
|
+
if (maxDuration && !maxTimer) {
|
|
50
|
+
maxTimer = setTimeout(() => {
|
|
51
|
+
if (timer)
|
|
52
|
+
_clearTimeout(timer);
|
|
53
|
+
maxTimer = void 0;
|
|
54
|
+
resolve(lastInvoker());
|
|
55
|
+
}, maxDuration);
|
|
56
|
+
}
|
|
57
|
+
timer = setTimeout(() => {
|
|
58
|
+
if (maxTimer)
|
|
59
|
+
_clearTimeout(maxTimer);
|
|
60
|
+
maxTimer = void 0;
|
|
61
|
+
resolve(invoke());
|
|
62
|
+
}, duration);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
return filter;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// @__NO_SIDE_EFFECTS__
|
|
69
|
+
function useDebounceFn(fn, ms = 200, options = {}) {
|
|
70
|
+
return createFilterWrapper(
|
|
71
|
+
debounceFilter(ms, options),
|
|
72
|
+
fn
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { createFilterWrapper, debounceFilter, isClient, noop, tryOnScopeDispose, useDebounceFn };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function getNestedValue(obj, path, defaultValue) {
|
|
2
|
+
if (typeof obj !== "object" || obj === null || !path) {
|
|
3
|
+
return defaultValue;
|
|
4
|
+
}
|
|
5
|
+
const keys = path.split(".").filter((key) => key !== "");
|
|
6
|
+
return keys.reduce((current, key) => {
|
|
7
|
+
if (typeof current !== "object" || current === null) {
|
|
8
|
+
return defaultValue;
|
|
9
|
+
}
|
|
10
|
+
return current[key] !== void 0 ? current[key] : defaultValue;
|
|
11
|
+
}, obj);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getNestedValue };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import axios$1 from 'axios';
|
|
2
|
+
export * from 'axios';
|
|
3
|
+
import { ElMessage } from 'element-plus';
|
|
4
|
+
import { defu } from 'defu';
|
|
5
|
+
|
|
6
|
+
const initRequestInstance = (extendConfig = {}, interceptorsRequestFn = () => {
|
|
7
|
+
}, interceptorsResponseFn = () => {
|
|
8
|
+
}) => {
|
|
9
|
+
const axiosConfig = defu({}, extendConfig, {
|
|
10
|
+
baseURL: "/",
|
|
11
|
+
// 从环境变量获取基础URL
|
|
12
|
+
timeout: 1e4,
|
|
13
|
+
// 超时时间
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": "application/json;charset=utf-8"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const instance = axios$1.create(axiosConfig);
|
|
19
|
+
instance.interceptors.request.use(
|
|
20
|
+
(config) => {
|
|
21
|
+
interceptorsRequestFn(config);
|
|
22
|
+
addPendingRequest(config);
|
|
23
|
+
return config;
|
|
24
|
+
},
|
|
25
|
+
(error) => {
|
|
26
|
+
return Promise.reject(error);
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
instance.interceptors.response.use(
|
|
30
|
+
(response) => {
|
|
31
|
+
interceptorsResponseFn(response);
|
|
32
|
+
removePendingRequest(response.config);
|
|
33
|
+
const data = response.data;
|
|
34
|
+
console.log(data);
|
|
35
|
+
if (data.code === 200) {
|
|
36
|
+
return Promise.resolve({
|
|
37
|
+
...response,
|
|
38
|
+
...data,
|
|
39
|
+
data: data.data
|
|
40
|
+
});
|
|
41
|
+
} else {
|
|
42
|
+
ElMessage.error(data.msg || "\u8BF7\u6C42\u5931\u8D25");
|
|
43
|
+
return Promise.reject(new Error(data.msg || "\u8BF7\u6C42\u5931\u8D25"));
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
(error) => {
|
|
47
|
+
console.log("\u8BF7\u6C42\u53D1\u751F\u9519\u8BEF>>>>>>>>>>>>>>>>>>\uFF1A", error);
|
|
48
|
+
if (error.config) {
|
|
49
|
+
removePendingRequest(error.config);
|
|
50
|
+
}
|
|
51
|
+
if (axios$1.isCancel(error)) {
|
|
52
|
+
console.warn("\u8BF7\u6C42\u5DF2\u88AB\u53D6\u6D88:", error.message);
|
|
53
|
+
return Promise.reject(new Error("\u8BF7\u6C42\u5DF2\u88AB\u53D6\u6D88"));
|
|
54
|
+
}
|
|
55
|
+
if (!window.navigator.onLine) {
|
|
56
|
+
ElMessage.error("\u7F51\u7EDC\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC");
|
|
57
|
+
return Promise.reject(new Error("\u7F51\u7EDC\u8FDE\u63A5\u5DF2\u65AD\u5F00"));
|
|
58
|
+
}
|
|
59
|
+
const { response } = error;
|
|
60
|
+
if (response) {
|
|
61
|
+
switch (response.status) {
|
|
62
|
+
case 401:
|
|
63
|
+
ElMessage.error("\u8EAB\u4EFD\u9A8C\u8BC1\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55");
|
|
64
|
+
break;
|
|
65
|
+
case 403:
|
|
66
|
+
ElMessage.error("\u6CA1\u6709\u6743\u9650\u6267\u884C\u6B64\u64CD\u4F5C");
|
|
67
|
+
break;
|
|
68
|
+
case 404:
|
|
69
|
+
ElMessage.error("\u8BF7\u6C42\u7684\u8D44\u6E90\u4E0D\u5B58\u5728");
|
|
70
|
+
break;
|
|
71
|
+
case 500:
|
|
72
|
+
ElMessage.error("\u670D\u52A1\u5668\u5185\u90E8\u9519\u8BEF");
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
ElMessage.error(`\u8BF7\u6C42\u9519\u8BEF: ${response.status}`);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
ElMessage.error("\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");
|
|
79
|
+
}
|
|
80
|
+
return Promise.reject(error);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
return instance;
|
|
84
|
+
};
|
|
85
|
+
const pendingRequests = /* @__PURE__ */ new Map();
|
|
86
|
+
const generateRequestKey = (config) => {
|
|
87
|
+
const { method, url, params, data } = config;
|
|
88
|
+
const paramsStr = params ? JSON.stringify(params) : "";
|
|
89
|
+
const dataStr = data ? JSON.stringify(data) : "";
|
|
90
|
+
return `${method}-${url}-${paramsStr}-${dataStr}`;
|
|
91
|
+
};
|
|
92
|
+
const addPendingRequest = (config) => {
|
|
93
|
+
const requestKey = generateRequestKey(config);
|
|
94
|
+
if (pendingRequests.has(requestKey)) {
|
|
95
|
+
const cancelToken = pendingRequests.get(requestKey);
|
|
96
|
+
cancelToken.cancel(`\u91CD\u590D\u8BF7\u6C42\u88AB\u53D6\u6D88: ${config.url}`);
|
|
97
|
+
pendingRequests.delete(requestKey);
|
|
98
|
+
}
|
|
99
|
+
const source = axios$1.CancelToken.source();
|
|
100
|
+
config.cancelToken = source.token;
|
|
101
|
+
pendingRequests.set(requestKey, source);
|
|
102
|
+
};
|
|
103
|
+
const removePendingRequest = (config) => {
|
|
104
|
+
const requestKey = generateRequestKey(config);
|
|
105
|
+
if (pendingRequests.has(requestKey)) {
|
|
106
|
+
pendingRequests.delete(requestKey);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export { addPendingRequest, generateRequestKey, initRequestInstance, removePendingRequest };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const libraryNamePrefixUpperCase = "Ml";
|
|
2
|
+
const libraryName = "minilo";
|
|
3
|
+
function kebabCase(key) {
|
|
4
|
+
const result = key.replace(/([A-Z])/g, " $1").trim();
|
|
5
|
+
return result.split(" ").join("-").toLowerCase();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const MiniloUiResolver = () => {
|
|
9
|
+
console.log("MiniloUiResolver\u521D\u59CB\u5316");
|
|
10
|
+
return {
|
|
11
|
+
type: "component",
|
|
12
|
+
resolve: (name) => {
|
|
13
|
+
if (name.startsWith(libraryNamePrefixUpperCase)) {
|
|
14
|
+
const componentName = kebabCase(name.slice(2));
|
|
15
|
+
return {
|
|
16
|
+
name,
|
|
17
|
+
from: `@${libraryName}/ui/es/${componentName}`,
|
|
18
|
+
sideEffects: `@${libraryName}/ui/theme-chalk/ml-${componentName}`
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { MiniloUiResolver };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
export declare const libraryNamePrefix = "ml";
|
|
3
|
+
export declare const libraryNamePrefixUpperCase = "Ml";
|
|
4
|
+
export declare const libraryName = "minilo";
|
|
5
|
+
/**
|
|
6
|
+
* @description 组件注册函数
|
|
7
|
+
* @author xieshuhong
|
|
8
|
+
* @template T
|
|
9
|
+
* @param {T} comp
|
|
10
|
+
* @return {*}
|
|
11
|
+
*/
|
|
12
|
+
export declare const withInstall: <T extends Component>(comp: T) => T;
|
|
13
|
+
/**
|
|
14
|
+
* BEM命名规范工具函数
|
|
15
|
+
* @param {string} block - 必选,块名(如'button')
|
|
16
|
+
* @param {string|undefined} element - 可选,元素名(如'icon')
|
|
17
|
+
* @param {string|string[]|undefined} modifier - 可选,修饰符(如'primary'或['large', 'disabled'])
|
|
18
|
+
* @returns {string} 生成的class字符串
|
|
19
|
+
*/
|
|
20
|
+
export declare function bem(block?: string, element?: string, modifier?: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* @description 驼峰转 kabab
|
|
23
|
+
* @author xieshuhong
|
|
24
|
+
* @export
|
|
25
|
+
* @param {string} key
|
|
26
|
+
* @return {*}
|
|
27
|
+
*/
|
|
28
|
+
export declare function kebabCase(key: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const libraryNamePrefix = "ml";
|
|
2
|
+
const withInstall = (comp) => {
|
|
3
|
+
comp.install = (app) => {
|
|
4
|
+
const compName = comp.name;
|
|
5
|
+
if (!compName) return;
|
|
6
|
+
app.component(compName, comp);
|
|
7
|
+
};
|
|
8
|
+
return comp;
|
|
9
|
+
};
|
|
10
|
+
function bem(block = "", element = "", modifier = "") {
|
|
11
|
+
if (!block || typeof block !== "string") {
|
|
12
|
+
console.error("BEM: block\u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u4E14\u4E0D\u80FD\u4E3A\u7A7A");
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
let base = `${libraryNamePrefix}-${block}`;
|
|
16
|
+
if (element && typeof element === "string") {
|
|
17
|
+
base += `__${element}`;
|
|
18
|
+
}
|
|
19
|
+
if (!modifier) {
|
|
20
|
+
return base;
|
|
21
|
+
}
|
|
22
|
+
const modifiers = Array.isArray(modifier) ? modifier : [modifier];
|
|
23
|
+
const validModifiers = modifiers.filter((m) => typeof m === "string" && m.trim() !== "");
|
|
24
|
+
if (validModifiers.length === 0) {
|
|
25
|
+
return base;
|
|
26
|
+
}
|
|
27
|
+
return validModifiers.map((mod) => `${base}--${mod}`).join(" ");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { bem, libraryNamePrefix, withInstall };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const MlButton: {
|
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./type').MlButtonSelfProps> & Readonly<{
|
|
3
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
4
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
5
|
+
click: (...args: any[]) => void;
|
|
6
|
+
}, import('vue').PublicProps, {
|
|
7
|
+
time: number;
|
|
8
|
+
placement: string;
|
|
9
|
+
tip: string;
|
|
10
|
+
tipProps: Record<string, any>;
|
|
11
|
+
isDebounce: boolean;
|
|
12
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
13
|
+
P: {};
|
|
14
|
+
B: {};
|
|
15
|
+
D: {};
|
|
16
|
+
C: {};
|
|
17
|
+
M: {};
|
|
18
|
+
Defaults: {};
|
|
19
|
+
}, Readonly<import('./type').MlButtonSelfProps> & Readonly<{
|
|
20
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, {
|
|
22
|
+
time: number;
|
|
23
|
+
placement: string;
|
|
24
|
+
tip: string;
|
|
25
|
+
tipProps: Record<string, any>;
|
|
26
|
+
isDebounce: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
__isFragment?: never;
|
|
29
|
+
__isTeleport?: never;
|
|
30
|
+
__isSuspense?: never;
|
|
31
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('./type').MlButtonSelfProps> & Readonly<{
|
|
32
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
33
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
34
|
+
click: (...args: any[]) => void;
|
|
35
|
+
}, string, {
|
|
36
|
+
time: number;
|
|
37
|
+
placement: string;
|
|
38
|
+
tip: string;
|
|
39
|
+
tipProps: Record<string, any>;
|
|
40
|
+
isDebounce: boolean;
|
|
41
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
42
|
+
$slots: {
|
|
43
|
+
default?(_: {}): any;
|
|
44
|
+
default?(_: {}): any;
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
export default MlButton;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var index = require('../../utils/index.js');
|
|
6
|
+
var index_vue_vue_type_script_setup_true_lang = require('./index.vue2.js');
|
|
7
|
+
|
|
8
|
+
const MlButton = index.withInstall(index_vue_vue_type_script_setup_true_lang.default);
|
|
9
|
+
|
|
10
|
+
exports.MlButton = MlButton;
|
|
11
|
+
exports.default = MlButton;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MlButtonSelfProps as MlButtonProps } from './type';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
default?(_: {}): any;
|
|
7
|
+
};
|
|
8
|
+
refs: {};
|
|
9
|
+
rootEl: any;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
|
+
declare const __VLS_component: import('vue').DefineComponent<MlButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
13
|
+
click: (...args: any[]) => void;
|
|
14
|
+
}, string, import('vue').PublicProps, Readonly<MlButtonProps> & Readonly<{
|
|
15
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
time: number;
|
|
18
|
+
placement: string;
|
|
19
|
+
tip: string;
|
|
20
|
+
tipProps: Record<string, any>;
|
|
21
|
+
isDebounce: boolean;
|
|
22
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
26
|
+
new (): {
|
|
27
|
+
$slots: S;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var index = require('../../utils/index.js');
|
|
7
|
+
var elementPlus = require('element-plus');
|
|
8
|
+
|
|
9
|
+
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
10
|
+
...{
|
|
11
|
+
name: "MlButton"
|
|
12
|
+
},
|
|
13
|
+
__name: "index",
|
|
14
|
+
props: {
|
|
15
|
+
time: { type: Number, required: false, default: 1e3 },
|
|
16
|
+
tip: { type: String, required: false, default: "" },
|
|
17
|
+
placement: { type: String, required: false, default: "top" },
|
|
18
|
+
tipProps: { type: Object, required: false, default: () => ({}) },
|
|
19
|
+
isDebounce: { type: Boolean, required: false, default: true }
|
|
20
|
+
},
|
|
21
|
+
emits: ["click"],
|
|
22
|
+
setup(__props, { emit: __emit }) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const emits = __emit;
|
|
25
|
+
const record = vue.ref(0);
|
|
26
|
+
const handleClick = () => {
|
|
27
|
+
if (!props.isDebounce) return emits("click");
|
|
28
|
+
const newTime = /* @__PURE__ */ new Date();
|
|
29
|
+
if (newTime.getTime() - record.value > props.time) {
|
|
30
|
+
emits("click");
|
|
31
|
+
}
|
|
32
|
+
record.value = newTime.getTime();
|
|
33
|
+
};
|
|
34
|
+
return (_ctx, _cache) => {
|
|
35
|
+
return __props.tip ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), vue.mergeProps({
|
|
36
|
+
key: 0,
|
|
37
|
+
content: __props.tip,
|
|
38
|
+
placement: __props.placement
|
|
39
|
+
}, __props.tipProps), {
|
|
40
|
+
default: vue.withCtx(() => [
|
|
41
|
+
vue.createVNode(vue.unref(elementPlus.ElButton), vue.mergeProps(_ctx.$attrs, {
|
|
42
|
+
class: vue.unref(index.bem)("button", "tip"),
|
|
43
|
+
onClick: handleClick
|
|
44
|
+
}), {
|
|
45
|
+
default: vue.withCtx(() => [
|
|
46
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
47
|
+
]),
|
|
48
|
+
_: 3
|
|
49
|
+
/* FORWARDED */
|
|
50
|
+
}, 16, ["class"])
|
|
51
|
+
]),
|
|
52
|
+
_: 3
|
|
53
|
+
/* FORWARDED */
|
|
54
|
+
}, 16, ["content", "placement"])) : (vue.openBlock(), vue.createBlock(
|
|
55
|
+
vue.unref(elementPlus.ElButton),
|
|
56
|
+
vue.mergeProps({ key: 1 }, _ctx.$attrs, { onClick: handleClick }),
|
|
57
|
+
{
|
|
58
|
+
default: vue.withCtx(() => [
|
|
59
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
60
|
+
]),
|
|
61
|
+
_: 3
|
|
62
|
+
/* FORWARDED */
|
|
63
|
+
},
|
|
64
|
+
16
|
|
65
|
+
/* FULL_PROPS */
|
|
66
|
+
));
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
exports.default = _sfc_main;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ButtonProps } from 'element-plus';
|
|
2
|
+
import { Mutable } from 'element-plus/es/utils';
|
|
3
|
+
export interface MlButtonSelfProps {
|
|
4
|
+
time?: number;
|
|
5
|
+
tip?: string;
|
|
6
|
+
placement?: string;
|
|
7
|
+
tipProps?: Record<string, any>;
|
|
8
|
+
isDebounce?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type MlButtonProps = MlButtonSelfProps & Partial<Mutable<ButtonProps>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const MlChart: {
|
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./type').MlChartProps> & Readonly<{
|
|
3
|
+
[x: `on${Capitalize<string>}`]: ((...args: unknown[] & []) => any) | undefined;
|
|
4
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
5
|
+
[x: string]: ((...args: unknown[]) => any) | (() => any);
|
|
6
|
+
}, import('vue').PublicProps, {
|
|
7
|
+
options: Record<string, any>;
|
|
8
|
+
id: string;
|
|
9
|
+
theme: string;
|
|
10
|
+
isEmpty: boolean | ((options: Record<string, any>) => boolean);
|
|
11
|
+
description: string;
|
|
12
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
13
|
+
echartRef: HTMLDivElement;
|
|
14
|
+
}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
15
|
+
P: {};
|
|
16
|
+
B: {};
|
|
17
|
+
D: {};
|
|
18
|
+
C: {};
|
|
19
|
+
M: {};
|
|
20
|
+
Defaults: {};
|
|
21
|
+
}, Readonly<import('./type').MlChartProps> & Readonly<{
|
|
22
|
+
[x: `on${Capitalize<string>}`]: ((...args: unknown[] & []) => any) | undefined;
|
|
23
|
+
}>, {}, {}, {}, {}, {
|
|
24
|
+
options: Record<string, any>;
|
|
25
|
+
id: string;
|
|
26
|
+
theme: string;
|
|
27
|
+
isEmpty: boolean | ((options: Record<string, any>) => boolean);
|
|
28
|
+
description: string;
|
|
29
|
+
}>;
|
|
30
|
+
__isFragment?: never;
|
|
31
|
+
__isTeleport?: never;
|
|
32
|
+
__isSuspense?: never;
|
|
33
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('./type').MlChartProps> & Readonly<{
|
|
34
|
+
[x: `on${Capitalize<string>}`]: ((...args: unknown[] & []) => any) | undefined;
|
|
35
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
36
|
+
[x: string]: ((...args: unknown[]) => any) | (() => any);
|
|
37
|
+
}, string, {
|
|
38
|
+
options: Record<string, any>;
|
|
39
|
+
id: string;
|
|
40
|
+
theme: string;
|
|
41
|
+
isEmpty: boolean | ((options: Record<string, any>) => boolean);
|
|
42
|
+
description: string;
|
|
43
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
44
|
+
$slots: {
|
|
45
|
+
empty?(_: {}): any;
|
|
46
|
+
default?(_: {}): any;
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
export default MlChart;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var index = require('../../utils/index.js');
|
|
6
|
+
var index_vue_vue_type_script_setup_true_lang = require('./index.vue2.js');
|
|
7
|
+
|
|
8
|
+
const MlChart = index.withInstall(index_vue_vue_type_script_setup_true_lang.default);
|
|
9
|
+
|
|
10
|
+
exports.MlChart = MlChart;
|
|
11
|
+
exports.default = MlChart;
|