@shjjs/visual-ui 1.0.16 → 1.0.18

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.
Files changed (29) hide show
  1. package/es/commons/core/datasource/utils/axios.d.ts +70 -0
  2. package/es/commons/core/datasource/utils/axios.mjs +134 -0
  3. package/es/commons/core/datasource/utils/request.d.ts +1 -1
  4. package/es/commons/core/datasource/utils/request.mjs +1 -3
  5. package/es/components/commons-gaussian-splatting-view/index.vue.mjs +2 -2
  6. package/es/components/commons-gaussian-splatting-view/index.vue2.mjs +45 -46
  7. package/es/components/commons-product-model/index.vue.mjs +2 -2
  8. package/es/components/commons-product-model/index.vue2.mjs +58 -59
  9. package/es/components/commons-three-loader/index.vue.mjs +2 -2
  10. package/es/components/commons-three-loader/index.vue2.mjs +71 -72
  11. package/es/components/commons-three-loader3/index.vue.mjs +2 -2
  12. package/es/components/commons-three-loader3/index.vue2.mjs +45 -46
  13. package/es/components/text-over-number/index.vue.d.ts +16 -16
  14. package/es/widgets.css +1 -1
  15. package/lib/commons/core/datasource/utils/axios.js +1 -0
  16. package/lib/commons/core/datasource/utils/request.js +1 -1
  17. package/lib/components/commons-gaussian-splatting-view/index.vue.js +1 -1
  18. package/lib/components/commons-gaussian-splatting-view/index.vue2.js +1 -1
  19. package/lib/components/commons-product-model/index.vue.js +1 -1
  20. package/lib/components/commons-product-model/index.vue2.js +1 -1
  21. package/lib/components/commons-three-loader/index.vue.js +1 -1
  22. package/lib/components/commons-three-loader/index.vue2.js +1 -1
  23. package/lib/components/commons-three-loader3/index.vue.js +1 -1
  24. package/lib/components/commons-three-loader3/index.vue2.js +1 -1
  25. package/lib/widgets.css +1 -1
  26. package/package.json +1 -1
  27. package/es/commons/utils/babylon/ColorConvert.d.ts +0 -3
  28. package/es/commons/utils/babylon/ColorConvert.mjs +0 -21
  29. package/lib/commons/utils/babylon/ColorConvert.js +0 -1
@@ -0,0 +1,70 @@
1
+ import type { AxiosInstance, AxiosRequestConfig } from 'axios';
2
+ export declare type RestResult<T> = {
3
+ code: number;
4
+ msg: string;
5
+ data?: T;
6
+ };
7
+ export declare enum IContentType {
8
+ FormData = "multipart/form-data",
9
+ UrlEncoded = "application/x-www-form-urlencoded; charset=UTF-8",
10
+ Json = "application/json; charset=UTF-8",
11
+ Raw = "raw"
12
+ }
13
+ export declare class HttpRequest {
14
+ instance: AxiosInstance;
15
+ constructor();
16
+ /**
17
+ * GET 请求
18
+ * @param url
19
+ * @param config
20
+ * @returns
21
+ */
22
+ get<T = any>(url: string, config?: AxiosRequestConfig): Promise<RestResult<T>>;
23
+ /**
24
+ * POST 请求
25
+ * @param url 请求的URL
26
+ * @param data 发送的数据
27
+ * @param contentType 数据的内容类型
28
+ * @param config 额外的Axios配置
29
+ * @returns
30
+ */
31
+ post<T = any>(url: string, data?: any, config?: AxiosRequestConfig, contentType?: IContentType): Promise<RestResult<T>>;
32
+ /**
33
+ * PUT 请求
34
+ * @param url
35
+ * @param data
36
+ * @param config
37
+ * @returns
38
+ */
39
+ put<T = any>(url: string, data?: any, config?: AxiosRequestConfig, contentType?: IContentType): Promise<RestResult<T>>;
40
+ /**
41
+ * DELETE 请求
42
+ * @param url
43
+ * @param config
44
+ * @returns
45
+ */
46
+ delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<RestResult<T>>;
47
+ /**
48
+ * 文件上传
49
+ * @param url
50
+ * @param params
51
+ * @param config
52
+ * @returns
53
+ */
54
+ upload<T = any>(url: string, params?: any, config?: AxiosRequestConfig): Promise<RestResult<T>>;
55
+ /**
56
+ * blob文件下载
57
+ * @param url
58
+ * @param params
59
+ * @param config
60
+ * @returns
61
+ */
62
+ download<T = any>(url: string, params?: any, config?: AxiosRequestConfig): Promise<RestResult<T>>;
63
+ /**
64
+ * Custom 请求
65
+ * @param url
66
+ * @param config
67
+ * @returns
68
+ */
69
+ custom<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
70
+ }
@@ -0,0 +1,134 @@
1
+ var l = Object.defineProperty;
2
+ var u = (i, t, e) => t in i ? l(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var f = (i, t, e) => u(i, typeof t != "symbol" ? t + "" : t, e);
4
+ import d from "axios";
5
+ import { merge as p } from "lodash";
6
+ class T {
7
+ constructor() {
8
+ f(this, "instance");
9
+ this.instance = d.create();
10
+ }
11
+ /**
12
+ * GET 请求
13
+ * @param url
14
+ * @param config
15
+ * @returns
16
+ */
17
+ get(t, e) {
18
+ return this.instance.get(t, e);
19
+ }
20
+ /**
21
+ * POST 请求
22
+ * @param url 请求的URL
23
+ * @param data 发送的数据
24
+ * @param contentType 数据的内容类型
25
+ * @param config 额外的Axios配置
26
+ * @returns
27
+ */
28
+ post(t, e, a, o = "application/json; charset=UTF-8") {
29
+ const s = {
30
+ headers: {
31
+ "Content-Type": "application/json; charset=UTF-8"
32
+ /* Json */
33
+ }
34
+ };
35
+ if (o === "multipart/form-data") {
36
+ s.headers = {};
37
+ const n = new FormData();
38
+ for (const r in e)
39
+ n.append(r, e[r]);
40
+ e = n;
41
+ } else o === "application/x-www-form-urlencoded; charset=UTF-8" && (s.headers["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8", s.transformRequest = [(n) => {
42
+ const r = new URLSearchParams();
43
+ for (const c in n)
44
+ r.append(c, n[c]);
45
+ return r.toString();
46
+ }]);
47
+ return this.instance.post(t, e, p({}, s, a));
48
+ }
49
+ /**
50
+ * PUT 请求
51
+ * @param url
52
+ * @param data
53
+ * @param config
54
+ * @returns
55
+ */
56
+ put(t, e, a, o = "application/x-www-form-urlencoded; charset=UTF-8") {
57
+ const s = {
58
+ headers: {
59
+ "Content-Type": o
60
+ }
61
+ };
62
+ if (o === "multipart/form-data") {
63
+ s.headers = {};
64
+ const n = new FormData();
65
+ for (const r in e)
66
+ n.append(r, e[r]);
67
+ e = n;
68
+ } else o === "application/x-www-form-urlencoded; charset=UTF-8" && (s.headers["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8", s.transformRequest = [(n) => {
69
+ const r = new URLSearchParams();
70
+ for (const c in n)
71
+ r.append(c, n[c]);
72
+ return r.toString();
73
+ }]);
74
+ return this.instance.put(t, e, p({}, s, a));
75
+ }
76
+ /**
77
+ * DELETE 请求
78
+ * @param url
79
+ * @param config
80
+ * @returns
81
+ */
82
+ delete(t, e) {
83
+ const a = {
84
+ headers: {
85
+ "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
86
+ /* UrlEncoded */
87
+ }
88
+ };
89
+ return this.instance.delete(t, p({}, a, e));
90
+ }
91
+ /**
92
+ * 文件上传
93
+ * @param url
94
+ * @param params
95
+ * @param config
96
+ * @returns
97
+ */
98
+ upload(t, e, a) {
99
+ const o = {
100
+ headers: {
101
+ "Content-Type": "multipart/form-data"
102
+ }
103
+ };
104
+ return this.instance.post(t, e, a || o);
105
+ }
106
+ /**
107
+ * blob文件下载
108
+ * @param url
109
+ * @param params
110
+ * @param config
111
+ * @returns
112
+ */
113
+ download(t, e, a) {
114
+ const o = {
115
+ responseType: "blob",
116
+ headers: {
117
+ "Content-Type": "application/json"
118
+ }
119
+ };
120
+ return this.instance.post(t, e, a || o);
121
+ }
122
+ /**
123
+ * Custom 请求
124
+ * @param url
125
+ * @param config
126
+ * @returns
127
+ */
128
+ custom(t, e) {
129
+ return this.instance.get(t, e);
130
+ }
131
+ }
132
+ export {
133
+ T as HttpRequest
134
+ };
@@ -1,3 +1,3 @@
1
- import { HttpRequest, IContentType } from '@zerov/packages-request';
1
+ import { HttpRequest, IContentType } from './axios';
2
2
  export declare const httpRequest: HttpRequest;
3
3
  export { IContentType };
@@ -1,7 +1,5 @@
1
- import { HttpRequest as t } from "@zerov/packages-request";
2
- import { IContentType as n } from "@zerov/packages-request";
1
+ import { HttpRequest as t } from "./axios.mjs";
3
2
  const o = new t();
4
3
  export {
5
- n as IContentType,
6
4
  o as httpRequest
7
5
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./index.vue2.mjs";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-45048847"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c1aa323e"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };
@@ -1,26 +1,25 @@
1
- var k = Object.defineProperty;
2
- var A = (l, i, h) => i in l ? k(l, i, { enumerable: !0, configurable: !0, writable: !0, value: h }) : l[i] = h;
3
- var b = (l, i, h) => A(l, typeof i != "symbol" ? i + "" : i, h);
4
- import { defineComponent as M, watch as r, createElementBlock as E, openBlock as x, createElementVNode as G, createCommentVNode as P, normalizeClass as V, unref as B, ref as y, onMounted as F, onBeforeUnmount as N } from "vue";
1
+ var U = Object.defineProperty;
2
+ var W = (r, i, d) => i in r ? U(r, i, { enumerable: !0, configurable: !0, writable: !0, value: d }) : r[i] = d;
3
+ var b = (r, i, d) => W(r, typeof i != "symbol" ? i + "" : i, d);
4
+ import { defineComponent as D, watch as l, createElementBlock as x, openBlock as E, createElementVNode as F, createCommentVNode as k, normalizeClass as A, unref as B, ref as y, onMounted as G, onBeforeUnmount as H } from "vue";
5
5
  import "@babylonjs/loaders/glTF";
6
- import { useResizeObserver as q } from "@vueuse/core";
7
- import { Vector3 as m, Engine as Z, Scene as j, Color4 as v, Color3 as _, GaussianSplattingMesh as H, ArcRotateCamera as J, Tools as w } from "@babylonjs/core";
6
+ import { useResizeObserver as P } from "@vueuse/core";
7
+ import { Vector3 as m, Engine as V, Scene as N, Color4 as v, Color3 as _, GaussianSplattingMesh as q, ArcRotateCamera as Z, Tools as w } from "@babylonjs/core";
8
8
  import { cloneDeep as u, isEqual as c } from "lodash";
9
- import { hex2Color4 as D, hex2Color3 as T } from "../../commons/utils/babylon/ColorConvert.mjs";
10
- const K = { class: "zerov-widget" }, Q = {
9
+ const j = { class: "zerov-widget" }, J = {
11
10
  key: 0,
12
11
  ref: "babylonLoadingRef",
13
12
  class: "babylon-loading"
14
- }, X = M({ name: "zv-commons-gaussian-splatting-view" }), ne = /* @__PURE__ */ M({
15
- ...X,
13
+ }, K = D({ name: "zv-commons-gaussian-splatting-view" }), oe = /* @__PURE__ */ D({
14
+ ...K,
16
15
  props: {
17
16
  basicOption: {},
18
17
  basicEvents: {}
19
18
  },
20
- setup(l) {
21
- const i = l, h = (s, a) => {
22
- const d = y(), S = y(!0);
23
- class U {
19
+ setup(r) {
20
+ const i = r, d = (s, a) => {
21
+ const g = y(), S = y(!0);
22
+ class M {
24
23
  // eslint-disable-next-line no-useless-constructor
25
24
  constructor(e) {
26
25
  // optional, but needed due to interface definitions
@@ -28,10 +27,10 @@ const K = { class: "zerov-widget" }, Q = {
28
27
  this.loadingUIText = e;
29
28
  }
30
29
  displayLoadingUI() {
31
- d.value && (S.value = !0);
30
+ g.value && (S.value = !0);
32
31
  }
33
32
  hideLoadingUI() {
34
- d.value && (S.value = !1);
33
+ g.value && (S.value = !1);
35
34
  }
36
35
  }
37
36
  class L {
@@ -41,14 +40,14 @@ const K = { class: "zerov-widget" }, Q = {
41
40
  b(this, "gs");
42
41
  this.canvas = e, this.option = n, this.events = o;
43
42
  try {
44
- this.engine = new Z(this.canvas, !0, {}, !1), this.engine.loadingScreen = new U(""), window.addEventListener("resize", () => {
43
+ this.engine = new V(this.canvas, !0, {}, !1), this.engine.loadingScreen = new M(""), window.addEventListener("resize", () => {
45
44
  this.engine.resize();
46
45
  }), this.scene = this.createScene();
47
46
  } catch {
48
47
  }
49
48
  }
50
49
  createScene() {
51
- return this.engine.displayLoadingUI(), this.scene = new j(this.engine), this.option.scene.colorShow ? this.scene.clearColor = D(this.option.scene.color, new v(0, 0, 0, 0)) : this.scene.clearColor = new v(0, 0, 0, 0), this.scene.fogEnabled = this.option.scene.fogEnabled, this.scene.fogMode = this.option.scene.fogMode || 1, this.scene.fogColor = T(this.option.scene.fogColor, new _(1, 1, 1)), this.scene.fogEnd = this.option.scene.fogEnd || 60, this.scene.fogStart = this.option.scene.fogStart || 1, this.scene.fogDensity = this.option.scene.fogDensity || 0.1, this.createCamera(this.option.camera, this.scene), this.gs = new H("", null, this.scene), this.gs.loadFileAsync(this.option.meshs.url).then(() => {
50
+ return this.engine.displayLoadingUI(), this.scene = new N(this.engine), this.option.scene.colorShow ? this.scene.clearColor = v.FromHexString(this.option.scene.color || "#000000") : this.scene.clearColor = new v(0, 0, 0, 0), this.scene.fogEnabled = this.option.scene.fogEnabled, this.scene.fogMode = this.option.scene.fogMode || 1, this.scene.fogColor = _.FromHexString(this.option.scene.fogColor || "#ffffff"), this.scene.fogEnd = this.option.scene.fogEnd || 60, this.scene.fogStart = this.option.scene.fogStart || 1, this.scene.fogDensity = this.option.scene.fogDensity || 0.1, this.createCamera(this.option.camera, this.scene), this.gs = new q("", null, this.scene), this.gs.loadFileAsync(this.option.meshs.url).then(() => {
52
51
  this.setGSSize(this.option.meshs), setTimeout(() => {
53
52
  this.engine.hideLoadingUI();
54
53
  }, 100);
@@ -62,19 +61,19 @@ const K = { class: "zerov-widget" }, Q = {
62
61
  o.maximumWorld.z - o.minimumWorld.z
63
62
  ) || 1);
64
63
  this.gs.scaling = new m(f, f, f);
65
- const W = o.centerWorld;
66
- this.gs.position = this.gs.position.subtract(W.multiplyByFloats(f, f, f)), this.gs.rotation = new m(0, 0, 0);
64
+ const I = o.centerWorld;
65
+ this.gs.position = this.gs.position.subtract(I.multiplyByFloats(f, f, f)), this.gs.rotation = new m(0, 0, 0);
67
66
  } else {
68
67
  const { position: n, scaling: o, rotation: p } = e;
69
68
  this.gs.position.set(n[0] || 0, n[1] || 0, n[2] || 0), this.gs.scaling.set(o[0] || 1, o[1] || 1, o[2] || 1), this.gs.rotation = new m(p[0] || 0, p[1] || 0, p[2] || 0);
70
69
  }
71
70
  }
72
71
  updateScene(e) {
73
- e.colorShow ? this.scene.clearColor = D(e.color, new v(1, 1, 1, 1)) : this.scene.clearColor = new v(0, 0, 0, 0), this.scene.fogEnabled = e.fogEnabled, this.scene.fogMode = e.fogMode || 1, this.scene.fogColor = T(e.fogColor, new _(1, 1, 1)), this.scene.fogEnd = e.fogEnd || 60, this.scene.fogStart = e.fogStart || 1, this.scene.fogDensity = e.fogDensity || 0.1;
72
+ e.colorShow ? this.scene.clearColor = v.FromHexString(e.color || "#000000") : this.scene.clearColor = new v(0, 0, 0, 0), this.scene.fogEnabled = e.fogEnabled, this.scene.fogMode = e.fogMode || 1, this.scene.fogColor = _.FromHexString(e.fogColor || "#ffffff"), this.scene.fogEnd = e.fogEnd || 60, this.scene.fogStart = e.fogStart || 1, this.scene.fogDensity = e.fogDensity || 0.1;
74
73
  }
75
74
  createCamera(e, n) {
76
- const o = new J("", w.ToRadians(e.alpha || 90), w.ToRadians(e.beta || 75), e.radius || 1, new m(...e.target), n);
77
- o.attachControl(d.value, !0), o.useAutoRotationBehavior = e.autoRotation, o.wheelDeltaPercentage = e.wheelDeltaPercentage || 0.01, o.zoomToMouseLocation = e.zoomToMouseLocation, o.lowerRadiusLimit = e.lowerRadiusLimit, o.upperRadiusLimit = e.upperRadiusLimit, o.minZ = 0.01;
75
+ const o = new Z("", w.ToRadians(e.alpha || 90), w.ToRadians(e.beta || 75), e.radius || 1, new m(...e.target), n);
76
+ o.attachControl(g.value, !0), o.useAutoRotationBehavior = e.autoRotation, o.wheelDeltaPercentage = e.wheelDeltaPercentage || 0.01, o.zoomToMouseLocation = e.zoomToMouseLocation, o.lowerRadiusLimit = e.lowerRadiusLimit, o.upperRadiusLimit = e.upperRadiusLimit, o.minZ = 0.01;
78
77
  }
79
78
  updateCamera(e) {
80
79
  const n = this.scene.activeCamera;
@@ -89,58 +88,58 @@ const K = { class: "zerov-widget" }, Q = {
89
88
  this.scene && this.engine && (this.scene.dispose(), this.engine.dispose(), this.gs.dispose(), this.gs = null);
90
89
  }
91
90
  }
92
- const g = y();
93
- return F(() => {
94
- s.meshs && (g.value = new L(d.value, s, a).run(), q(d.value, (z) => {
95
- g.value && g.value.engine.resize();
91
+ const h = y();
92
+ return G(() => {
93
+ s.meshs && (h.value = new L(g.value, s, a).run(), P(g.value, (z) => {
94
+ h.value && h.value.engine.resize();
96
95
  }));
97
- }), N(() => {
98
- g.value && g.value.dispose();
96
+ }), H(() => {
97
+ h.value && h.value.dispose();
99
98
  }), {
100
- canvasRef: d,
101
- babylon: g,
99
+ canvasRef: g,
100
+ babylon: h,
102
101
  Babylon: L,
103
102
  babylonLoadingStatus: S
104
103
  };
105
- }, { babylon: t, Babylon: I, canvasRef: C, babylonLoadingStatus: R } = h(i.basicOption, i.basicEvents);
106
- return r(() => u(i.basicOption.scene), (s, a) => {
104
+ }, { babylon: t, Babylon: T, canvasRef: R, babylonLoadingStatus: C } = d(i.basicOption, i.basicEvents);
105
+ return l(() => u(i.basicOption.scene), (s, a) => {
107
106
  !c(s, a) && t.value && t.value.updateScene(s);
108
107
  }, {
109
108
  deep: !0
110
- }), r(() => u(i.basicOption.meshs.url), (s, a) => {
111
- !c(s, a) && t.value && (t.value.dispose(), t.value = new I(C.value, i.basicOption, i.basicEvents).run());
109
+ }), l(() => u(i.basicOption.meshs.url), (s, a) => {
110
+ !c(s, a) && t.value && (t.value.dispose(), t.value = new T(R.value, i.basicOption, i.basicEvents).run());
112
111
  }, {
113
112
  deep: !0
114
- }), r(() => u(i.basicOption.meshs.position), (s, a) => {
113
+ }), l(() => u(i.basicOption.meshs.position), (s, a) => {
115
114
  !c(s, a) && t.value && t.value.gs && t.value.gs.position.set(s[0], s[1], s[2]);
116
115
  }, {
117
116
  deep: !0
118
- }), r(() => u(i.basicOption.meshs.scaling), (s, a) => {
117
+ }), l(() => u(i.basicOption.meshs.scaling), (s, a) => {
119
118
  !c(s, a) && t.value && t.value.gs && t.value.gs.scaling.set(s[0], s[1], s[2]);
120
119
  }, {
121
120
  deep: !0
122
- }), r(() => u(i.basicOption.meshs.rotation), (s, a) => {
121
+ }), l(() => u(i.basicOption.meshs.rotation), (s, a) => {
123
122
  !c(s, a) && t.value && t.value.gs && (t.value.gs.rotation = new m(s[0], s[1], s[2]));
124
123
  }, {
125
124
  deep: !0
126
- }), r(() => u(i.basicOption.meshs.autoSize), (s, a) => {
125
+ }), l(() => u(i.basicOption.meshs.autoSize), (s, a) => {
127
126
  !c(s, a) && t.value && t.value.gs && t.value.setGSSize(i.basicOption.meshs);
128
127
  }, {
129
128
  deep: !0
130
- }), r(() => u(i.basicOption.camera), (s, a) => {
129
+ }), l(() => u(i.basicOption.camera), (s, a) => {
131
130
  !c(s, a) && t.value && t.value.updateCamera(s);
132
131
  }, {
133
132
  deep: !0
134
- }), (s, a) => (x(), E("div", K, [
135
- G("canvas", {
133
+ }), (s, a) => (E(), x("div", j, [
134
+ F("canvas", {
136
135
  ref_key: "canvasRef",
137
- ref: C,
138
- class: V(["widget", { show: !B(R) }])
136
+ ref: R,
137
+ class: A(["widget", { show: !B(C) }])
139
138
  }, null, 2),
140
- B(R) ? (x(), E("div", Q, " 正在加载模型... ", 512)) : P("", !0)
139
+ B(C) ? (E(), x("div", J, " 正在加载模型... ", 512)) : k("", !0)
141
140
  ]));
142
141
  }
143
142
  });
144
143
  export {
145
- ne as default
144
+ oe as default
146
145
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./index.vue2.mjs";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a31d8162"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-23340b2f"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };