fangguo-component 1.0.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/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/MInput-CO6YUVuZ.js +101 -0
- package/dist/MInput.css +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/cascader.css +1 -0
- package/dist/cascader.vue_vue_type_script_setup_true_lang-HFhhhQva.js +2268 -0
- package/dist/components/cascader/cascader/cascader.d.ts +49 -0
- package/dist/components/cascader/cascader/cascader.vue.d.ts +3734 -0
- package/dist/components/cascader/cascader/index.d.ts +6 -0
- package/dist/components/cascader/cascader-panel/config.d.ts +28 -0
- package/dist/components/cascader/cascader-panel/index.vue.d.ts +971 -0
- package/dist/components/cascader/cascader-panel/instance.d.ts +2 -0
- package/dist/components/cascader/cascader-panel/menu.vue.d.ts +659 -0
- package/dist/components/cascader/cascader-panel/node-content.d.ts +21 -0
- package/dist/components/cascader/cascader-panel/node.d.ts +85 -0
- package/dist/components/cascader/cascader-panel/node.vue.d.ts +481 -0
- package/dist/components/cascader/cascader-panel/store.d.ts +18 -0
- package/dist/components/cascader/cascader-panel/types.d.ts +36 -0
- package/dist/components/cascader/cascader-panel/utils.d.ts +4 -0
- package/dist/components/cascader/index.d.ts +4 -0
- package/dist/components/cascader/index.js +4 -0
- package/dist/components/cascader/utils/arrays.d.ts +5 -0
- package/dist/components/cascader/utils/browser.d.ts +3 -0
- package/dist/components/cascader/utils/dom/aria.d.ts +30 -0
- package/dist/components/cascader/utils/dom/event.d.ts +6 -0
- package/dist/components/cascader/utils/dom/index.d.ts +5 -0
- package/dist/components/cascader/utils/dom/position.d.ts +7 -0
- package/dist/components/cascader/utils/dom/scroll.d.ts +8 -0
- package/dist/components/cascader/utils/dom/style.d.ts +9 -0
- package/dist/components/cascader/utils/error.d.ts +3 -0
- package/dist/components/cascader/utils/functions.d.ts +1 -0
- package/dist/components/cascader/utils/i18n.d.ts +1 -0
- package/dist/components/cascader/utils/index.d.ts +13 -0
- package/dist/components/cascader/utils/objects.d.ts +8 -0
- package/dist/components/cascader/utils/raf.d.ts +2 -0
- package/dist/components/cascader/utils/rand.d.ts +10 -0
- package/dist/components/cascader/utils/strings.d.ts +6 -0
- package/dist/components/cascader/utils/types.d.ts +9 -0
- package/dist/components/cascader/utils/typescript.d.ts +12 -0
- package/dist/components/cascader/utils/vue/global-node.d.ts +3 -0
- package/dist/components/cascader/utils/vue/icon.d.ts +23 -0
- package/dist/components/cascader/utils/vue/index.d.ts +9 -0
- package/dist/components/cascader/utils/vue/install.d.ts +6 -0
- package/dist/components/cascader/utils/vue/props/index.d.ts +3 -0
- package/dist/components/cascader/utils/vue/props/runtime.d.ts +29 -0
- package/dist/components/cascader/utils/vue/props/types.d.ts +120 -0
- package/dist/components/cascader/utils/vue/props/util.d.ts +8 -0
- package/dist/components/cascader/utils/vue/refs.d.ts +3 -0
- package/dist/components/cascader/utils/vue/size.d.ts +2 -0
- package/dist/components/cascader/utils/vue/typescript.d.ts +5 -0
- package/dist/components/cascader/utils/vue/validator.d.ts +3 -0
- package/dist/components/cascader/utils/vue/vnode.d.ts +50 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +6 -0
- package/dist/components/mInput/MInput.vue.d.ts +28 -0
- package/dist/components/mInput/index.d.ts +2 -0
- package/dist/components/mInput/index.js +4 -0
- package/dist/components/mInput/types.d.ts +24 -0
- package/dist/directive/index.d.ts +1 -0
- package/dist/directive/index.js +4 -0
- package/dist/directive/loading/Loading.vue.d.ts +2 -0
- package/dist/directive/loading/index.d.ts +1 -0
- package/dist/directive/loading/index.js +4 -0
- package/dist/directive/loading/loading.d.ts +5 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/usePagination/index.d.ts +1 -0
- package/dist/hooks/usePagination/index.js +4 -0
- package/dist/hooks/usePagination/usePagination.d.ts +8 -0
- package/dist/index-CeWudY6u.js +8 -0
- package/dist/index-DihzpZcR.js +14 -0
- package/dist/index-DpPsTMp0.js +8 -0
- package/dist/index-wUcQXc_Z.js +10 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +55 -0
- package/dist/loading-DJVNc0eN.js +36 -0
- package/dist/loading.css +1 -0
- package/dist/shims.d.ts +20 -0
- package/dist/tools/Grid/Grid.d.ts +48 -0
- package/dist/tools/Grid/index.d.ts +1 -0
- package/dist/tools/Grid/index.js +217 -0
- package/dist/tools/common/common.d.ts +44 -0
- package/dist/tools/common/index.d.ts +1 -0
- package/dist/tools/common/index.js +5087 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +10 -0
- package/dist/usePagination-CwShBEjA.js +20 -0
- package/package.json +82 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { _ as o } from "./cascader.vue_vue_type_script_setup_true_lang-HFhhhQva.js";
|
|
2
|
+
import { M as e } from "./MInput-CO6YUVuZ.js";
|
|
3
|
+
const n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4
|
+
__proto__: null,
|
|
5
|
+
FgCascader: o,
|
|
6
|
+
FgMInput: e
|
|
7
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
8
|
+
export {
|
|
9
|
+
n as c
|
|
10
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import * as tools from './tools';
|
|
3
|
+
export * from './components';
|
|
4
|
+
export * from './tools';
|
|
5
|
+
export * from './directive';
|
|
6
|
+
export * from './hooks';
|
|
7
|
+
/** `app.use(默认导出, options)` 时的可选行为;不传则组件与指令都会注册(与历史行为一致) */
|
|
8
|
+
export interface FangguoInstallOptions {
|
|
9
|
+
/** 是否 `app.component` 注册全部导出组件,默认 `true` */
|
|
10
|
+
components?: boolean;
|
|
11
|
+
/** 是否 `app.directive` 注册全部导出指令,默认 `true` */
|
|
12
|
+
directives?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** 仅全局注册组件 */
|
|
15
|
+
export declare function installComponents(app: App): void;
|
|
16
|
+
/** 仅全局注册自定义指令 */
|
|
17
|
+
export declare function installDirectives(app: App): void;
|
|
18
|
+
declare const _default: {
|
|
19
|
+
usePagination: () => {
|
|
20
|
+
defaultSize: import('vue').Ref<number, number>;
|
|
21
|
+
originList: any;
|
|
22
|
+
page: import('vue').Ref<number, number>;
|
|
23
|
+
size: import('vue').Ref<number, number>;
|
|
24
|
+
total: import('vue').ComputedRef<any>;
|
|
25
|
+
list: import('vue').ComputedRef<any>;
|
|
26
|
+
};
|
|
27
|
+
aesEncrypt(word: any, keyWord?: string): any;
|
|
28
|
+
aesDecrypt(word: any, keyWord?: string): any;
|
|
29
|
+
createUuid: (len: number) => string;
|
|
30
|
+
formatBytes: (bytes: number, units: string[], isMerge?: boolean) => string | {
|
|
31
|
+
num: any;
|
|
32
|
+
unit: string;
|
|
33
|
+
};
|
|
34
|
+
mergeColumns: (defaultColumns: any, newColumns: any, prop?: string, filterKey?: string[] | null) => any[];
|
|
35
|
+
GridArea: typeof tools.GridArea;
|
|
36
|
+
install: (app: App, options?: FangguoInstallOptions) => void;
|
|
37
|
+
};
|
|
38
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var n = Object.getOwnPropertySymbols;
|
|
3
|
+
var c = Object.prototype.hasOwnProperty, f = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var i = (t, e, r) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, o = (t, e) => {
|
|
5
|
+
for (var r in e || (e = {}))
|
|
6
|
+
c.call(e, r) && i(t, r, e[r]);
|
|
7
|
+
if (n)
|
|
8
|
+
for (var r of n(e))
|
|
9
|
+
f.call(e, r) && i(t, r, e[r]);
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { c as m } from "./index-wUcQXc_Z.js";
|
|
13
|
+
import { t as u } from "./index-DihzpZcR.js";
|
|
14
|
+
import { d } from "./index-CeWudY6u.js";
|
|
15
|
+
import { h as p } from "./index-DpPsTMp0.js";
|
|
16
|
+
import { _ as M } from "./cascader.vue_vue_type_script_setup_true_lang-HFhhhQva.js";
|
|
17
|
+
import { l as O } from "./loading-DJVNc0eN.js";
|
|
18
|
+
import { M as A } from "./MInput-CO6YUVuZ.js";
|
|
19
|
+
import { GridArea as G } from "./tools/Grid/index.js";
|
|
20
|
+
import { aesDecrypt as L, aesEncrypt as P, createUuid as _, formatBytes as q, mergeColumns as w } from "./tools/common/index.js";
|
|
21
|
+
import { u as H } from "./usePagination-CwShBEjA.js";
|
|
22
|
+
function l(t) {
|
|
23
|
+
if (!t || typeof t != "object") return !1;
|
|
24
|
+
const e = t;
|
|
25
|
+
return "mounted" in e || "beforeMount" in e || "created" in e || "beforeUpdate" in e || "updated" in e || "beforeUnmount" in e || "unmounted" in e;
|
|
26
|
+
}
|
|
27
|
+
function x(t) {
|
|
28
|
+
Object.entries(m).forEach(([e, r]) => {
|
|
29
|
+
t.component(e, r);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function b(t) {
|
|
33
|
+
Object.entries(d).forEach(([e, r]) => {
|
|
34
|
+
e !== "install" && l(r) && t.directive(e, r);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const g = (t, e) => {
|
|
38
|
+
const { components: r = !0, directives: s = !0 } = e != null ? e : {};
|
|
39
|
+
r && x(t), s && b(t);
|
|
40
|
+
}, j = o(o({ install: g }, u), p);
|
|
41
|
+
export {
|
|
42
|
+
M as FgCascader,
|
|
43
|
+
O as FgLoading,
|
|
44
|
+
A as FgMInput,
|
|
45
|
+
G as GridArea,
|
|
46
|
+
L as aesDecrypt,
|
|
47
|
+
P as aesEncrypt,
|
|
48
|
+
_ as createUuid,
|
|
49
|
+
j as default,
|
|
50
|
+
q as formatBytes,
|
|
51
|
+
x as installComponents,
|
|
52
|
+
b as installDirectives,
|
|
53
|
+
w as mergeColumns,
|
|
54
|
+
H as usePagination
|
|
55
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { openBlock as e, createElementBlock as a, createElementVNode as i, createApp as c } from "vue";
|
|
2
|
+
import { _ as d } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
3
|
+
import './loading.css';const r = {}, p = { class: "absolute w-full h-[80vh] left-0 top-0 flex items-center justify-center v-loading" };
|
|
4
|
+
function v(t, o) {
|
|
5
|
+
return e(), a("div", p, [...o[0] || (o[0] = [
|
|
6
|
+
i("div", { class: "loading" }, [
|
|
7
|
+
i("div"),
|
|
8
|
+
i("div"),
|
|
9
|
+
i("div"),
|
|
10
|
+
i("div"),
|
|
11
|
+
i("div"),
|
|
12
|
+
i("div"),
|
|
13
|
+
i("div"),
|
|
14
|
+
i("div")
|
|
15
|
+
], -1)
|
|
16
|
+
])]);
|
|
17
|
+
}
|
|
18
|
+
const f = /* @__PURE__ */ d(r, [["render", v], ["__scopeId", "data-v-fe38093f"]]), n = (t) => {
|
|
19
|
+
t.originPosition || (t.style.position = "relative"), t == null || t.appendChild(t.instance.$el);
|
|
20
|
+
}, m = (t) => {
|
|
21
|
+
t.style.position = t.originPosition;
|
|
22
|
+
const o = t.instance.$el;
|
|
23
|
+
t != null && t.contains(o) && (t == null || t.removeChild(o));
|
|
24
|
+
}, g = {
|
|
25
|
+
mounted(t, o) {
|
|
26
|
+
t.originPosition = t.style.position;
|
|
27
|
+
const s = c(f).mount(document.createElement("div"));
|
|
28
|
+
t.instance = s, o.value && n(t);
|
|
29
|
+
},
|
|
30
|
+
updated(t, o) {
|
|
31
|
+
o.value !== o.oldValue && (o.value ? n(t) : m(t));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
g as l
|
|
36
|
+
};
|
package/dist/loading.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.loading[data-v-fe38093f],.loading>div[data-v-fe38093f]{position:relative;box-sizing:border-box;z-index:99999}.loading[data-v-fe38093f]{display:block;width:32px;height:32px;font-size:0;color:#4485f5}.loading>div[data-v-fe38093f]{position:absolute;top:50%;left:50%;display:inline-block;float:none;margin-top:-4px;margin-left:-4px;width:8px;height:8px;background-color:currentcolor;border:0 solid currentcolor;border-radius:100%;animation:ball-spin-clockwise-fe38093f 1s infinite ease-in-out}.loading>div[data-v-fe38093f]:nth-child(1){top:5%;left:50%;animation-delay:-.875s}.loading>div[data-v-fe38093f]:nth-child(2){top:18.1802%;left:81.8198%;animation-delay:-.75s}.loading>div[data-v-fe38093f]:nth-child(3){top:50%;left:95%;animation-delay:-.625s}.loading>div[data-v-fe38093f]:nth-child(4){top:81.8198%;left:81.8198%;animation-delay:-.5s}.loading>div[data-v-fe38093f]:nth-child(5){top:95%;left:50%;animation-delay:-.375s}.loading>div[data-v-fe38093f]:nth-child(6){top:81.8198%;left:18.1802%;animation-delay:-.25s}.loading>div[data-v-fe38093f]:nth-child(7){top:50%;left:5%;animation-delay:-.125s}.loading>div[data-v-fe38093f]:nth-child(8){top:18.1795%;left:18.1804%;animation-delay:0s}.loading.la-sm[data-v-fe38093f]{width:16px;height:16px}.loading.la-sm>div[data-v-fe38093f]{margin-top:-2px;margin-left:-2px;width:4px;height:4px}.loading.la-2x[data-v-fe38093f]{width:64px;height:64px}.loading.la-2x>div[data-v-fe38093f]{margin-top:-8px;margin-left:-8px;width:16px;height:16px}.loading.la-3x[data-v-fe38093f]{width:96px;height:96px}.loading.la-3x>div[data-v-fe38093f]{margin-top:-12px;margin-left:-12px;width:24px;height:24px}@keyframes ball-spin-clockwise-fe38093f{0%,to{opacity:1;transform:scale(1)}20%{opacity:1}80%{opacity:0;transform:scale(0)}}
|
package/dist/shims.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare module 'vue-virtual-scroller' {
|
|
2
|
+
import type { DefineComponent } from 'vue'
|
|
3
|
+
export const RecycleScroller: DefineComponent<any, any, any>
|
|
4
|
+
export const DynamicScroller: DefineComponent<any, any, any>
|
|
5
|
+
export const DynamicScrollerItem: DefineComponent<any, any, any>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare module 'type-fest' {
|
|
9
|
+
export type Entries<T> = [keyof T, T[keyof T]][]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module '*.scss' {
|
|
13
|
+
const content: string
|
|
14
|
+
export default content
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module 'element-plus/theme-chalk/src/cascader.scss' {
|
|
18
|
+
const content: string
|
|
19
|
+
export default content
|
|
20
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare class GridArea {
|
|
2
|
+
/** 横数 */
|
|
3
|
+
rows: number;
|
|
4
|
+
/** 列数 */
|
|
5
|
+
cols: number;
|
|
6
|
+
/** 所有格子数据 */
|
|
7
|
+
grid: any;
|
|
8
|
+
/** 当前选中的格子key值 */
|
|
9
|
+
currentSelectKey: null;
|
|
10
|
+
/** 当前选中的格子数据 */
|
|
11
|
+
currentSelectItem: any;
|
|
12
|
+
/** 后端返回原始数据 */
|
|
13
|
+
originData: any;
|
|
14
|
+
/** 字母集合 */
|
|
15
|
+
letters: string[];
|
|
16
|
+
/** 格子key值 */
|
|
17
|
+
keyName: string;
|
|
18
|
+
constructor(rows?: number, cols?: number, keyName?: string);
|
|
19
|
+
/** 初始化grid */
|
|
20
|
+
initGrid(data: any): void;
|
|
21
|
+
/** 改变格子横和列数 */
|
|
22
|
+
resizeGrid(newRows: any, newCols: any): void;
|
|
23
|
+
/** 向格子里添加数据
|
|
24
|
+
* @deprecated 已废弃
|
|
25
|
+
*/
|
|
26
|
+
addData({ data, warehouseId }: {
|
|
27
|
+
data: any;
|
|
28
|
+
warehouseId: any;
|
|
29
|
+
}): void;
|
|
30
|
+
/** 查找需要插入的格子
|
|
31
|
+
* @deprecated 已废弃
|
|
32
|
+
*/
|
|
33
|
+
findArea(warehouseId: any): any;
|
|
34
|
+
/** 格子选中/取消选中通过格子key */
|
|
35
|
+
selectCell(key: any, checked?: any): {
|
|
36
|
+
checked: any;
|
|
37
|
+
id: any;
|
|
38
|
+
key: any;
|
|
39
|
+
};
|
|
40
|
+
/** 格子选中/取消选中通过格子id */
|
|
41
|
+
selectCellById(id: any, checked?: boolean): void;
|
|
42
|
+
/** 取消所有选中 */
|
|
43
|
+
clearSelectCell(): void;
|
|
44
|
+
/** 更新格子数据 */
|
|
45
|
+
updateGridData(data: any): void;
|
|
46
|
+
/** 计算合计 */
|
|
47
|
+
calculateTotal(): any;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Grid';
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
var g = Object.defineProperty, f = Object.defineProperties;
|
|
2
|
+
var m = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var o = Object.getOwnPropertySymbols;
|
|
4
|
+
var Z = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var d = (h, e, t) => e in h ? g(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t, n = (h, e) => {
|
|
6
|
+
for (var t in e || (e = {}))
|
|
7
|
+
Z.call(e, t) && d(h, t, e[t]);
|
|
8
|
+
if (o)
|
|
9
|
+
for (var t of o(e))
|
|
10
|
+
y.call(e, t) && d(h, t, e[t]);
|
|
11
|
+
return h;
|
|
12
|
+
}, u = (h, e) => f(h, m(e));
|
|
13
|
+
var c = (h, e, t) => d(h, typeof e != "symbol" ? e + "" : e, t);
|
|
14
|
+
class S {
|
|
15
|
+
constructor(e = 3, t = 3, i = "name") {
|
|
16
|
+
/** 横数 */
|
|
17
|
+
c(this, "rows");
|
|
18
|
+
/** 列数 */
|
|
19
|
+
c(this, "cols");
|
|
20
|
+
/** 所有格子数据 */
|
|
21
|
+
c(this, "grid");
|
|
22
|
+
/** 当前选中的格子key值 */
|
|
23
|
+
c(this, "currentSelectKey");
|
|
24
|
+
/** 当前选中的格子数据 */
|
|
25
|
+
c(this, "currentSelectItem");
|
|
26
|
+
/** 后端返回原始数据 */
|
|
27
|
+
c(this, "originData");
|
|
28
|
+
/** 字母集合 */
|
|
29
|
+
// letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
30
|
+
c(this, "letters", [
|
|
31
|
+
"A",
|
|
32
|
+
"B",
|
|
33
|
+
"C",
|
|
34
|
+
"D",
|
|
35
|
+
"E",
|
|
36
|
+
"F",
|
|
37
|
+
"G",
|
|
38
|
+
"H",
|
|
39
|
+
"I",
|
|
40
|
+
"J",
|
|
41
|
+
"K",
|
|
42
|
+
"L",
|
|
43
|
+
"M",
|
|
44
|
+
"N",
|
|
45
|
+
"O",
|
|
46
|
+
"P",
|
|
47
|
+
"Q",
|
|
48
|
+
"R",
|
|
49
|
+
"S",
|
|
50
|
+
"T",
|
|
51
|
+
"U",
|
|
52
|
+
"V",
|
|
53
|
+
"W",
|
|
54
|
+
"X",
|
|
55
|
+
"Y",
|
|
56
|
+
"Z",
|
|
57
|
+
"ZA",
|
|
58
|
+
"ZB",
|
|
59
|
+
"ZC",
|
|
60
|
+
"ZD",
|
|
61
|
+
"ZE",
|
|
62
|
+
"ZF",
|
|
63
|
+
"ZG",
|
|
64
|
+
"ZH",
|
|
65
|
+
"ZI",
|
|
66
|
+
"ZJ",
|
|
67
|
+
"ZK",
|
|
68
|
+
"ZL",
|
|
69
|
+
"ZM",
|
|
70
|
+
"ZN",
|
|
71
|
+
"ZO",
|
|
72
|
+
"ZP",
|
|
73
|
+
"ZQ",
|
|
74
|
+
"ZR",
|
|
75
|
+
"ZS",
|
|
76
|
+
"ZT",
|
|
77
|
+
"ZU",
|
|
78
|
+
"ZV",
|
|
79
|
+
"ZW",
|
|
80
|
+
"ZX",
|
|
81
|
+
"ZY",
|
|
82
|
+
"ZZ"
|
|
83
|
+
]);
|
|
84
|
+
/** 格子key值 */
|
|
85
|
+
c(this, "keyName", "name");
|
|
86
|
+
this.rows = e, this.cols = t, this.grid = {}, this.currentSelectKey = null, this.currentSelectItem = null, this.keyName = i;
|
|
87
|
+
}
|
|
88
|
+
/** 初始化grid */
|
|
89
|
+
initGrid(e) {
|
|
90
|
+
this.rows = e.rows || 3, this.cols = e.cols || 3, this.originData = e, this.grid = {};
|
|
91
|
+
const t = e.gridList.findLast((i) => i[this.keyName] === this.currentSelectKey);
|
|
92
|
+
this.currentSelectKey = t ? t[this.keyName] : null, this.currentSelectItem = t || null;
|
|
93
|
+
for (let i = 0; i < this.rows; i++)
|
|
94
|
+
for (let r = 1; r <= this.cols; r++) {
|
|
95
|
+
const s = `${this.letters[i]}${r}`, l = e.gridList.findLast((a) => a[this.keyName] === s);
|
|
96
|
+
l ? (this.grid[l[this.keyName]] = u(n({}, l), {
|
|
97
|
+
checked: this.currentSelectKey === l[this.keyName]
|
|
98
|
+
}), r === 1 && (this.grid[l[this.keyName]].leftTag = this.letters[i]), this.letters[i] === "A" && (this.grid[l[this.keyName]].topTag = r)) : (this.grid[s] = {}, r === 1 && (this.grid[s].leftTag = this.letters[i]), this.letters[i] === "A" && (this.grid[s].topTag = r));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** 改变格子横和列数 */
|
|
102
|
+
resizeGrid(e, t) {
|
|
103
|
+
const i = {};
|
|
104
|
+
for (let r = 0; r < e; r++)
|
|
105
|
+
for (let s = 1; s <= t; s++) {
|
|
106
|
+
const l = `${this.letters[r]}${s}`;
|
|
107
|
+
this.grid[l] ? i[l] = this.grid[l] : (i[l] = {}, s === 1 && (i[l].leftTag = this.letters[r]), this.letters[r] === "A" && (i[l].topTag = s));
|
|
108
|
+
}
|
|
109
|
+
this.grid = i, this.rows = e, this.cols = t;
|
|
110
|
+
}
|
|
111
|
+
/** 向格子里添加数据
|
|
112
|
+
* @deprecated 已废弃
|
|
113
|
+
*/
|
|
114
|
+
addData({ data: e, warehouseId: t }) {
|
|
115
|
+
const i = (r) => {
|
|
116
|
+
const s = this.grid[r];
|
|
117
|
+
return s.data.length < s.maxNum ? (s.data.push(e), s.type = s.data.length === 0 ? 0 : s.data.length < s.maxNum ? 1 : 2, s.warehouseId || (s.warehouseId = t), this.selectCell(r, !0), !0) : !1;
|
|
118
|
+
};
|
|
119
|
+
if (this.currentSelectKey)
|
|
120
|
+
if (!this.grid[this.currentSelectKey].warehouseId)
|
|
121
|
+
i(this.currentSelectKey);
|
|
122
|
+
else if (this.grid[this.currentSelectKey].warehouseId == t)
|
|
123
|
+
i(this.currentSelectKey);
|
|
124
|
+
else {
|
|
125
|
+
let r = "";
|
|
126
|
+
for (const s in this.grid)
|
|
127
|
+
this.grid[s].warehouseId == t && (r = s);
|
|
128
|
+
if (r)
|
|
129
|
+
i(r);
|
|
130
|
+
else
|
|
131
|
+
for (const s in this.grid)
|
|
132
|
+
if (!this.grid[s].warehouseId && i(s))
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
let r = "";
|
|
137
|
+
for (const s in this.grid)
|
|
138
|
+
this.grid[s].warehouseId == t && (r = s);
|
|
139
|
+
if (r)
|
|
140
|
+
i(r);
|
|
141
|
+
else
|
|
142
|
+
for (const s in this.grid)
|
|
143
|
+
if (!this.grid[s].warehouseId && i(s))
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/** 查找需要插入的格子
|
|
148
|
+
* @deprecated 已废弃
|
|
149
|
+
*/
|
|
150
|
+
findArea(e) {
|
|
151
|
+
var i;
|
|
152
|
+
const t = Object.entries(this.grid).find(
|
|
153
|
+
(r) => r[1].warehouseId == e
|
|
154
|
+
);
|
|
155
|
+
if (t && t[1])
|
|
156
|
+
return this.selectCell(t[0], !0), t[1];
|
|
157
|
+
if (!this.currentSelectItem || (i = this.currentSelectItem) != null && i.warehouseId) {
|
|
158
|
+
const r = Object.entries(this.grid).find((s) => !s[1].warehouseId);
|
|
159
|
+
if (r[1])
|
|
160
|
+
return this.selectCell(r[0], !0), r[1];
|
|
161
|
+
} else
|
|
162
|
+
return this.currentSelectItem;
|
|
163
|
+
}
|
|
164
|
+
/** 格子选中/取消选中通过格子key */
|
|
165
|
+
selectCell(e, t) {
|
|
166
|
+
if (this.grid[e]) {
|
|
167
|
+
for (const i in this.grid)
|
|
168
|
+
i !== e && (this.grid[i].checked = !1);
|
|
169
|
+
return this.grid[e].checked = t || !this.grid[e].checked, this.currentSelectKey = this.grid[e].checked ? e : null, this.currentSelectItem = this.grid[e].checked ? this.grid[e] : null, {
|
|
170
|
+
checked: this.grid[e].checked,
|
|
171
|
+
id: this.grid[e].id,
|
|
172
|
+
key: e
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
checked: !1,
|
|
177
|
+
id: null,
|
|
178
|
+
key: null
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/** 格子选中/取消选中通过格子id */
|
|
182
|
+
selectCellById(e, t = !0) {
|
|
183
|
+
if (!e) return;
|
|
184
|
+
const i = this.originData.gridList.find((r) => r.id === e);
|
|
185
|
+
i && i[this.keyName] && this.selectCell(i[this.keyName], t);
|
|
186
|
+
}
|
|
187
|
+
/** 取消所有选中 */
|
|
188
|
+
clearSelectCell() {
|
|
189
|
+
for (const e in this.grid)
|
|
190
|
+
this.grid[e].checked = !1;
|
|
191
|
+
this.currentSelectKey = null, this.currentSelectItem = null;
|
|
192
|
+
}
|
|
193
|
+
/** 更新格子数据 */
|
|
194
|
+
updateGridData(e) {
|
|
195
|
+
const t = this.originData.gridList.find((i) => i.id === e.id);
|
|
196
|
+
if (t) {
|
|
197
|
+
const i = t[this.keyName];
|
|
198
|
+
this.grid[i] && (this.grid[i] = n(n({}, this.grid[i]), e));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** 计算合计 */
|
|
202
|
+
calculateTotal() {
|
|
203
|
+
return Object.values(this.grid).reduce(
|
|
204
|
+
(e, t) => (t.completeCount && (e.completeCount += t.completeCount), t.scanCount && (e.scanCount += t.scanCount), t.scanCount && (t.completeCount === t.scanCount ? (e.completeGridCount += 1, e.completeGridIdList.push(t.id)) : e.notCompleteGridCount += 1), e),
|
|
205
|
+
{
|
|
206
|
+
completeCount: 0,
|
|
207
|
+
scanCount: 0,
|
|
208
|
+
completeGridCount: 0,
|
|
209
|
+
notCompleteGridCount: 0,
|
|
210
|
+
completeGridIdList: []
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
export {
|
|
216
|
+
S as GridArea
|
|
217
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file common.ts 公共方法
|
|
3
|
+
* @description 公共方法、函数等
|
|
4
|
+
* @author xiao li
|
|
5
|
+
* @copyright 北溟有鱼
|
|
6
|
+
* @createDate 2023-05-16 14:02
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @function createUuid 生成随机id
|
|
10
|
+
* @description 随机uuid
|
|
11
|
+
* @return { String } uuid 随机的uuid
|
|
12
|
+
*/
|
|
13
|
+
export declare const createUuid: (len: number) => string;
|
|
14
|
+
/**
|
|
15
|
+
* 加密
|
|
16
|
+
* @word 要加密的内容
|
|
17
|
+
*/
|
|
18
|
+
export declare function aesEncrypt(word: any, keyWord?: string): any;
|
|
19
|
+
/**
|
|
20
|
+
* 解密
|
|
21
|
+
* @param word 要解密的内容
|
|
22
|
+
*/
|
|
23
|
+
export declare function aesDecrypt(word: any, keyWord?: string): any;
|
|
24
|
+
/**
|
|
25
|
+
* @function formatBytes 格式化字节大小为可读的字符串
|
|
26
|
+
* @param {number} bytes 字节大小1
|
|
27
|
+
* @param {string[]} units 可选的单位数组,默认为 ['B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB']
|
|
28
|
+
* @param {boolean} isMerge 是否合并显示
|
|
29
|
+
* @returns {{num: number, unit: string}} 未合并格式 格式化后的对象,包含格式化后的数值和单位
|
|
30
|
+
* @returns {string} 合并格式 格式化后的对象,包含格式化后的数值和单位
|
|
31
|
+
*/
|
|
32
|
+
export declare const formatBytes: (bytes: number, units: string[], isMerge?: boolean) => string | {
|
|
33
|
+
num: any;
|
|
34
|
+
unit: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @desc: // 合并列表columns
|
|
38
|
+
* @param {*} defaultColumns 默认Columns
|
|
39
|
+
* @param {*} newColumns 接口请求的Columns
|
|
40
|
+
* @param {*} prop 唯一健,用于区分Columns例如默认是prop,则prop相同都认为是更新,prop改变则认为是新增新的和删除旧的
|
|
41
|
+
* @param {*} filterKey 需要过滤key,不填默认Columns键值会更新接口请求的Columns,如果想保留接口设置过的字段,可以把这些字段填入
|
|
42
|
+
* @return {*}
|
|
43
|
+
*/
|
|
44
|
+
export declare const mergeColumns: (defaultColumns: any, newColumns: any, prop?: string, filterKey?: string[] | null) => any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './common';
|