@xh/hoist 72.0.0-SNAPSHOT.1737748132453 → 72.0.0-SNAPSHOT.1737749290997

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.
@@ -53,14 +53,14 @@ export const [JsonSearchPanel, jsonSearchPanel] = hoistCmp.withFactory<JsonBlobM
53
53
  }),
54
54
  panel({
55
55
  mask: impl.nodeLoadTask,
56
- tbar: nodeTbar({model: impl}),
56
+ tbar: readerTbar({model: impl}),
57
57
  bbar: nodeBbar({
58
58
  omit: !impl.asPathList,
59
59
  model: impl
60
60
  }),
61
61
  item: jsonInput({
62
62
  model: impl,
63
- bind: 'matchingNodes',
63
+ bind: 'readerContent',
64
64
  flex: 1,
65
65
  width: '100%',
66
66
  readonly: true,
@@ -161,30 +161,37 @@ const helpButton = hoistCmp.factory({
161
161
  }
162
162
  });
163
163
 
164
- const nodeTbar = hoistCmp.factory<JsonSearchPanelImplModel>(({model}) => {
165
- return toolbar(
166
- buttonGroupInput({
167
- model,
168
- bind: 'pathOrValue',
169
- minimal: true,
170
- outlined: true,
171
- items: [
172
- button({
173
- text: 'Path',
174
- value: 'path'
175
- }),
176
- button({
177
- text: 'Value',
178
- value: 'value'
179
- })
180
- ]
181
- }),
182
- filler(),
183
- box({
184
- omit: !model.matchingNodeCount,
185
- item: `${model.matchingNodeCount} ${model.matchingNodeCount === 1 ? 'match' : 'matches'}`
186
- })
187
- );
164
+ const readerTbar = hoistCmp.factory<JsonSearchPanelImplModel>(({model}) => {
165
+ return toolbar({
166
+ items: [
167
+ buttonGroupInput({
168
+ model,
169
+ bind: 'readerContentType',
170
+ minimal: true,
171
+ outlined: true,
172
+ disabled: !model.selectedRecord,
173
+ items: [
174
+ button({
175
+ text: 'Document',
176
+ value: 'document'
177
+ }),
178
+ button({
179
+ text: 'Matching Paths',
180
+ value: 'paths'
181
+ }),
182
+ button({
183
+ text: 'Matching Values',
184
+ value: 'values'
185
+ })
186
+ ]
187
+ }),
188
+ filler(),
189
+ box({
190
+ omit: !model.matchingNodeCount,
191
+ item: `${model.matchingNodeCount} ${model.matchingNodeCount === 1 ? 'match' : 'matches'}`
192
+ })
193
+ ]
194
+ });
188
195
  });
189
196
 
190
197
  const nodeBbar = hoistCmp.factory<JsonSearchPanelImplModel>(({model}) => {
@@ -22,13 +22,13 @@ export class JsonSearchPanelImplModel extends HoistModel {
22
22
 
23
23
  @bindable.ref error = null;
24
24
  @bindable path: string = '';
25
- @bindable pathOrValue: 'path' | 'value' = 'value';
25
+ @bindable readerContentType: 'document' | 'paths' | 'values' = 'values';
26
26
  @bindable pathFormat: 'XPath' | 'JSONPath' = 'XPath';
27
- @bindable matchingNodes: string = '';
27
+ @bindable readerContent: string = '';
28
28
  @bindable matchingNodeCount: number = 0;
29
29
 
30
30
  get asPathList(): boolean {
31
- return this.pathOrValue === 'path';
31
+ return this.readerContentType === 'paths';
32
32
  }
33
33
 
34
34
  get queryBuffer(): number {
@@ -43,6 +43,10 @@ export class JsonSearchPanelImplModel extends HoistModel {
43
43
  return this.componentProps.matchingNodesUrl;
44
44
  }
45
45
 
46
+ get selectedRecord() {
47
+ return this.gridModel.selectedRecord;
48
+ }
49
+
46
50
  get gridModelConfig() {
47
51
  return this.componentProps.gridModelConfig;
48
52
  }
@@ -69,8 +73,8 @@ export class JsonSearchPanelImplModel extends HoistModel {
69
73
  }
70
74
  },
71
75
  {
72
- track: () => [this.gridModel.selectedRecord, this.pathOrValue, this.pathFormat],
73
- run: () => this.loadJsonNodesAsync(),
76
+ track: () => [this.selectedRecord, this.readerContentType, this.pathFormat],
77
+ run: () => this.loadreaderContentTypeAsync(),
74
78
  debounce: 300
75
79
  }
76
80
  );
@@ -98,10 +102,17 @@ export class JsonSearchPanelImplModel extends HoistModel {
98
102
  }
99
103
  }
100
104
 
101
- private async loadJsonNodesAsync() {
102
- if (!this.gridModel.selectedRecord) {
105
+ private async loadreaderContentTypeAsync() {
106
+ if (!this.selectedRecord) {
103
107
  this.matchingNodeCount = 0;
104
- this.matchingNodes = '';
108
+ this.readerContent = '';
109
+ return;
110
+ }
111
+
112
+ const {json} = this.selectedRecord.data;
113
+
114
+ if (this.readerContentType === 'document') {
115
+ this.readerContent = JSON.stringify(JSON.parse(json), null, 2);
105
116
  return;
106
117
  }
107
118
 
@@ -109,8 +120,8 @@ export class JsonSearchPanelImplModel extends HoistModel {
109
120
  url: this.matchingNodesUrl,
110
121
  params: {
111
122
  path: this.path,
112
- asPathList: this.pathOrValue === 'path',
113
- json: this.gridModel.selectedRecord.data.json
123
+ asPathList: this.readerContentType === 'paths',
124
+ json
114
125
  }
115
126
  }).linkTo(this.nodeLoadTask);
116
127
 
@@ -118,7 +129,7 @@ export class JsonSearchPanelImplModel extends HoistModel {
118
129
  if (this.asPathList && this.pathFormat === 'XPath') {
119
130
  nodes = nodes.map(it => this.convertToPath(it));
120
131
  }
121
- this.matchingNodes = JSON.stringify(nodes, null, 2);
132
+ this.readerContent = JSON.stringify(nodes, null, 2);
122
133
  }
123
134
 
124
135
  private convertToPath(JSONPath: string): string {
@@ -10,18 +10,19 @@ export declare class JsonSearchPanelImplModel extends HoistModel {
10
10
  nodeLoadTask: TaskObserver;
11
11
  error: any;
12
12
  path: string;
13
- pathOrValue: 'path' | 'value';
13
+ readerContentType: 'document' | 'paths' | 'values';
14
14
  pathFormat: 'XPath' | 'JSONPath';
15
- matchingNodes: string;
15
+ readerContent: string;
16
16
  matchingNodeCount: number;
17
17
  get asPathList(): boolean;
18
18
  get queryBuffer(): number;
19
19
  get docSearchUrl(): string;
20
20
  get matchingNodesUrl(): string;
21
+ get selectedRecord(): import("../../../data").StoreRecord;
21
22
  get gridModelConfig(): any;
22
23
  constructor();
23
24
  onLinked(): void;
24
25
  loadJsonDocsAsync(): Promise<void>;
25
- private loadJsonNodesAsync;
26
+ private loadreaderContentTypeAsync;
26
27
  private convertToPath;
27
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "72.0.0-SNAPSHOT.1737748132453",
3
+ "version": "72.0.0-SNAPSHOT.1737749290997",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",