xframelib 1.1.8 → 1.1.9

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 CHANGED
@@ -242,6 +242,57 @@ app.config.globalProperties.$AppURL=process.env.APP_URL;
242
242
 
243
243
 
244
244
 
245
+ - **XWindowWidgetTemplate.vue 示例widget代码**
246
+
247
+ > from v1.1.9 , @close="doClosePanel" is removed
248
+
249
+ ```vue
250
+ <template>
251
+ <XWindow v-show="isShow" top="10px" left="10px" nWidth="300px" nHeight="400px" title="XWindowWidget模版"
252
+ icon="img/basicimage/arcgis_img.png" :hasMax="true"pid="widgetID" @loaded="loadedHandle" >
253
+ <span>这是XWindowWidget模版,窗体的内容示例</span>
254
+ </XWindow>
255
+ </template>
256
+
257
+ <script lang="ts" setup>
258
+ import { onMounted, ref } from 'vue';
259
+ import { Global, XWindow, XWindowManager,WindowsMap,MinWindowMap } from 'xframelib';
260
+ const widgetID = ref('xwindowWidgetTemplate');
261
+ let windowID = '';
262
+ //获取到窗体的id
263
+ function loadedHandle(panelData) {
264
+ windowID = panelData.id;
265
+ }
266
+ // 从v1.1.9版本移除
267
+ // function doClosePanel(panelData) {
268
+ // widgetID.value = panelData.pid;
269
+ // if (panelData.pid) {
270
+ // Global.LayoutManager?.unloadWidget(widgetID.value);
271
+ // }
272
+ // }
273
+ onMounted(() => {
274
+ //最小化后,定时打开widget
275
+ setTimeout(() => {
276
+ const tmpLayoutManager = Global.getLayoutManager(widgetID.value);
277
+ tmpLayoutManager?.changeWidgetVisible(widgetID.value, true);
278
+ }, 8000);
279
+ })
280
+ /**
281
+ * 对外暴露接口
282
+ */
283
+ const isShow = ref(true);
284
+ function changeVisible(isVisible: boolean = false) {
285
+ isShow.value = isVisible;
286
+ if (windowID && isVisible)
287
+ XWindowManager.openWindowPanel(windowID);
288
+ }
289
+ defineExpose({ changeVisible, isShow });
290
+ </script>
291
+ <style lang="scss" scoped></style>
292
+ ```
293
+
294
+
295
+
245
296
  ## Application Examples
246
297
 
247
298
  ![Development Template](https://zorrowm.github.io/npm/xframelib.png)
@@ -378,10 +378,10 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
378
378
  };
379
379
  let s = this.ttlAutopurge ? (t, e) => {
380
380
  if (i?.[t] && (clearTimeout(i[t]), i[t] = void 0), e && 0 !== e && i) {
381
- let s = setTimeout(() => {
382
- this.#C(t) && this.#L(this.#u[t], "expire");
381
+ let h = setTimeout(() => {
382
+ this.#C(t) ? (this.#L(this.#u[t], "expire"), i[t] = void 0) : s(t, r(t));
383
383
  }, e + 1);
384
- s.unref && s.unref(), i[t] = s;
384
+ h.unref && h.unref(), i[t] = h;
385
385
  }
386
386
  } : () => {};
387
387
  this.#G = (i, s) => {
@@ -400,12 +400,15 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
400
400
  }
401
401
  return t;
402
402
  };
403
- this.getRemainingTTL = (i) => {
404
- let s = this.#c.get(i);
405
- if (void 0 === s) return 0;
406
- let r = t[s], o = e[s];
407
- return r && o ? r - ((h || n()) - o) : Infinity;
408
- }, this.#C = (i) => {
403
+ this.getRemainingTTL = (t) => {
404
+ let e = this.#c.get(t);
405
+ return void 0 === e ? 0 : r(e);
406
+ };
407
+ let r = (i) => {
408
+ let s = t[i], r = e[i];
409
+ return s && r ? s - ((h || n()) - r) : Infinity;
410
+ };
411
+ this.#C = (i) => {
409
412
  let s = e[i], r = t[i];
410
413
  return !!r && !!s && (h || n()) - s > r;
411
414
  };
@@ -782,7 +785,7 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
782
785
  let i = !1;
783
786
  if (0 !== this.#a) {
784
787
  let s = this.#c.get(t);
785
- if (void 0 !== s) if (this.#z?.[s] && (clearTimeout(this.#z?.[s]), this.#z[s] = void 0), i = !0, 1 === this.#a) this.#J(e);
788
+ if (void 0 !== s) if (this.#z?.[s] && (clearTimeout(this.#z[s]), this.#z[s] = void 0), i = !0, 1 === this.#a) this.#J(e);
786
789
  else {
787
790
  this.#U(s);
788
791
  let i = this.#f[s];
@@ -0,0 +1,2 @@
1
+ export * from './useTime';
2
+ export * from './useWidget';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @description 获取本地时间,年月日 时分秒 星期几
3
+ */
4
+ export declare function useTime(): {
5
+ year: import('vue').Ref<number, number>;
6
+ month: import('vue').Ref<number, number>;
7
+ day: import('vue').Ref<number, number>;
8
+ hour: import('vue').Ref<string | number, string | number>;
9
+ minute: import('vue').Ref<string | number, string | number>;
10
+ second: import('vue').Ref<number, number>;
11
+ week: import('vue').Ref<string, string>;
12
+ };
@@ -0,0 +1,74 @@
1
+ export interface Widget {
2
+ name: string;
3
+ key?: string;
4
+ component?: any;
5
+ autoDisable?: boolean;
6
+ disableOther?: boolean | string[];
7
+ group?: string;
8
+ visible?: boolean;
9
+ data?: any;
10
+ meta?: any;
11
+ }
12
+ /**
13
+ * 用于Widget内部控制,和Widget间通信的
14
+ * (思想来源:Mars3D)
15
+ * @returns
16
+ */
17
+ export declare function useWidget(): {
18
+ currentWidget: {
19
+ /**
20
+ * 当前widget实例对象
21
+ */
22
+ instance: import('vue').ComponentInternalInstance | null;
23
+ /**
24
+ * widget ID标识
25
+ */
26
+ wid: any;
27
+ /**
28
+ * widget配置
29
+ */
30
+ widgetConfig: any;
31
+ /**
32
+ * 当前widget所属的LayoutManager对象
33
+ */
34
+ layoutManager: import('..').LayoutManager | undefined;
35
+ /**
36
+ * 对外绑定回调函数
37
+ * @param callback
38
+ */
39
+ onUpdate(callback: any): void;
40
+ };
41
+ /**
42
+ * 获取LayoutManager
43
+ * @param layoutID 默认空,为当前对应LayoutManager
44
+ * @returns
45
+ */
46
+ getLayoutManager(layoutID?: string): import('..').LayoutManager | undefined;
47
+ /**
48
+ * 改变widget的可见性
49
+ * @param visible
50
+ * @param widgetID 默认为当前的widgetid,可插入其他widgetID
51
+ */
52
+ setVisible(visible?: boolean, widgetID?: string): void;
53
+ /**
54
+ * 出发对应widget的onUpdate
55
+ * @param widgetID
56
+ * @param args
57
+ */
58
+ updateWidget(widgetID?: string, args?: any): void;
59
+ /**
60
+ * 获取widget的当前激活状态
61
+ * (是否加载,是否可见)
62
+ * @param widgetID 默认空,为当前widgetid
63
+ * @returns
64
+ */
65
+ isActivate: (widgetID?: string) => boolean | undefined;
66
+ /**
67
+ * 激活指定 widget模块
68
+ * ( 加载或卸载 )
69
+ * @param widOption
70
+ * @param needLoad 加载还是卸载
71
+ */
72
+ activate: (widOption?: string | string[], needLoad?: boolean) => void;
73
+ disable: (option: string | string[]) => void;
74
+ };