@we-debug/plugin-appdata 0.44.0 → 0.44.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.44.2](https://github.com/dlhandsome/we-debug/compare/v0.44.1...v0.44.2) (2025-03-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fixed plugin appdata ([f961f60](https://github.com/dlhandsome/we-debug/commit/f961f60570c9cabecd9290448cd3a9ed1aa76f98))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.44.0](https://github.com/dlhandsome/we-debug/compare/v0.43.5...v0.44.0) (2025-03-10)
7
18
 
8
19
 
package/dist/index.js CHANGED
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  var APP_DATA_VIEW_CONFIG = {
4
15
  group: {
@@ -12,9 +23,9 @@ function getCurrentPage() {
12
23
  var pages = getCurrentPages();
13
24
  return pages.length > 0 ? pages[pages.length - 1] : null;
14
25
  }
15
- function getJsonViewOption(page, options) {
26
+ function getJsonView(weDebug, page, options) {
16
27
  var _a, _b;
17
- return {
28
+ return weDebug.createJsonView({
18
29
  data: (page === null || page === void 0 ? void 0 : page.data) || {},
19
30
  editable: (_a = options.editable) !== null && _a !== void 0 ? _a : true,
20
31
  expandLevel: (_b = options.expandLevel) !== null && _b !== void 0 ? _b : 1,
@@ -27,18 +38,17 @@ function getJsonViewOption(page, options) {
27
38
  page === null || page === void 0 ? void 0 : page.setData(changeData);
28
39
  }
29
40
  }
30
- };
41
+ });
31
42
  }
32
43
  AppDataPlugin.install = function (weDebug, options) {
33
- var jsonViewOptions = getJsonViewOption({}, options);
34
- var currentJsonView = weDebug.createJsonView(jsonViewOptions);
44
+ var currentJsonView = getJsonView(weDebug, {}, options);
35
45
  weDebug.addJsonView(currentJsonView, APP_DATA_VIEW_CONFIG);
36
46
  weDebug.event.on('debug:mask:show-modal', function () {
37
47
  var page = getCurrentPage();
38
48
  if (!page)
39
49
  return;
40
- var newJsonViewOptions = getJsonViewOption(page, options);
41
- weDebug.updateJsonView(newJsonViewOptions, APP_DATA_VIEW_CONFIG);
50
+ var newJsonView = getJsonView(weDebug, page, options);
51
+ weDebug.updateJsonView(__assign(__assign({}, newJsonView), { id: currentJsonView.id }), APP_DATA_VIEW_CONFIG);
42
52
  });
43
53
  };
44
54
  exports.default = AppDataPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@we-debug/plugin-appdata",
3
- "version": "0.44.0",
3
+ "version": "0.44.2",
4
4
  "description": "> TODO: description",
5
5
  "author": "Sail <505441575@qq.com>",
6
6
  "homepage": "https://github.com/dlhandsome/we-debug/tree/master/packages/runtime/plugin-appdata#readme",
@@ -20,5 +20,5 @@
20
20
  "bugs": {
21
21
  "url": "https://github.com/dlhandsome/we-debug/issues"
22
22
  },
23
- "gitHead": "d7451a394de645a2db8e32c81f07df47a6e5aa26"
23
+ "gitHead": "3a4399d3b313fcc56a5e77ab0631a5602b9341b6"
24
24
  }
package/src/index.ts CHANGED
@@ -20,8 +20,8 @@ function getCurrentPage(): WechatMiniprogram.Page.Instance<any, any> | null {
20
20
  return pages.length > 0 ? pages[pages.length - 1] : null;
21
21
  }
22
22
 
23
- function getJsonViewOption (page: WechatMiniprogram.Page.Instance<any, any> | null, options: IPluginInitOptions) {
24
- return {
23
+ function getJsonView (weDebug: IAnyObject, page: WechatMiniprogram.Page.Instance<any, any> | null, options: IPluginInitOptions) {
24
+ return weDebug.createJsonView({
25
25
  data: page?.data || {},
26
26
  editable: options.editable ?? true,
27
27
  expandLevel: options.expandLevel ?? 1,
@@ -34,21 +34,24 @@ function getJsonViewOption (page: WechatMiniprogram.Page.Instance<any, any> | nu
34
34
  page?.setData(changeData);
35
35
  }
36
36
  }
37
- }
37
+ })
38
38
  }
39
39
 
40
40
  AppDataPlugin.install = function (weDebug, options: IPluginInitOptions) {
41
41
  // 调试面板弹出时,触发规则更新
42
- const jsonViewOptions = getJsonViewOption({}, options);
43
- let currentJsonView = weDebug.createJsonView(jsonViewOptions);
42
+ const currentJsonView = getJsonView(weDebug, {}, options);
44
43
  weDebug.addJsonView(currentJsonView, APP_DATA_VIEW_CONFIG);
45
44
 
46
45
  weDebug.event.on('debug:mask:show-modal', () => {
47
46
  const page = getCurrentPage();
48
47
  if (!page) return;
48
+
49
+ const newJsonView = getJsonView(weDebug, page, options);
49
50
 
50
- const newJsonViewOptions = getJsonViewOption(page, options);
51
- weDebug.updateJsonView(newJsonViewOptions, APP_DATA_VIEW_CONFIG);
51
+ weDebug.updateJsonView({
52
+ ...newJsonView,
53
+ id: currentJsonView.id
54
+ }, APP_DATA_VIEW_CONFIG);
52
55
  });
53
56
  }
54
57