x4js 1.5.15 → 1.5.16

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.
@@ -294,20 +294,24 @@ class TreeView extends layout_1.VLayout {
294
294
  }
295
295
  }
296
296
  set selection(id) {
297
- var _a;
298
- if ((_a = this.m_selection) === null || _a === void 0 ? void 0 : _a.el) {
299
- this.m_selection.el.removeClass('selected');
297
+ this.select(id, false);
298
+ }
299
+ /**
300
+ * idem selection = xx but with a notification
301
+ * @param id
302
+ */
303
+ select(id, notify = false) {
304
+ if (id === null || id === undefined) {
305
+ this._selectItem(null, null);
300
306
  }
301
- this.m_selection = null;
302
- if (id !== undefined) {
303
- const { node: sel } = this._getNode(id);
304
- if (sel) {
305
- this.m_selection = {
306
- id: id,
307
- el: sel
308
- };
309
- sel.addClass('selected');
310
- sel.scrollIntoView();
307
+ else {
308
+ if (isFunction(this.m_props.items)) {
309
+ this.m_defer_sel = id;
310
+ }
311
+ else {
312
+ let item = this.m_props.items.find((item) => item.id == id);
313
+ let citem = this._findItemWithId(item.id);
314
+ this._selectItem(item, citem, notify);
311
315
  }
312
316
  }
313
317
  }
@@ -29,4 +29,4 @@
29
29
  **/
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
31
  exports.x4js_version = void 0;
32
- exports.x4js_version = "1.5.15";
32
+ exports.x4js_version = "1.5.16";
@@ -290,19 +290,24 @@ export class TreeView extends VLayout {
290
290
  }
291
291
  }
292
292
  set selection(id) {
293
- if (this.m_selection?.el) {
294
- this.m_selection.el.removeClass('selected');
293
+ this.select(id, false);
294
+ }
295
+ /**
296
+ * idem selection = xx but with a notification
297
+ * @param id
298
+ */
299
+ select(id, notify = false) {
300
+ if (id === null || id === undefined) {
301
+ this._selectItem(null, null);
295
302
  }
296
- this.m_selection = null;
297
- if (id !== undefined) {
298
- const { node: sel } = this._getNode(id);
299
- if (sel) {
300
- this.m_selection = {
301
- id: id,
302
- el: sel
303
- };
304
- sel.addClass('selected');
305
- sel.scrollIntoView();
303
+ else {
304
+ if (isFunction(this.m_props.items)) {
305
+ this.m_defer_sel = id;
306
+ }
307
+ else {
308
+ let item = this.m_props.items.find((item) => item.id == id);
309
+ let citem = this._findItemWithId(item.id);
310
+ this._selectItem(item, citem, notify);
306
311
  }
307
312
  }
308
313
  }
@@ -26,4 +26,4 @@
26
26
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
- export const x4js_version = "1.5.15";
29
+ export const x4js_version = "1.5.16";
@@ -413,23 +413,26 @@ export class TreeView extends VLayout<TreeViewProps, TreeViewEventMap> {
413
413
  }
414
414
 
415
415
  set selection(id: any) {
416
+ this.select( id, false );
417
+ }
416
418
 
417
- if (this.m_selection?.el) {
418
- this.m_selection.el.removeClass('selected');
419
- }
420
-
421
- this.m_selection = null;
422
-
423
- if (id !== undefined) {
424
- const { node: sel } = this._getNode( id );
425
- if( sel ) {
426
- this.m_selection = {
427
- id: id,
428
- el: sel
429
- };
419
+ /**
420
+ * idem selection = xx but with a notification
421
+ * @param id
422
+ */
430
423
 
431
- sel.addClass('selected');
432
- sel.scrollIntoView( );
424
+ public select( id: any, notify = false ) {
425
+ if (id === null || id === undefined) {
426
+ this._selectItem(null, null);
427
+ }
428
+ else {
429
+ if (isFunction(this.m_props.items)) {
430
+ this.m_defer_sel = id;
431
+ }
432
+ else {
433
+ let item = this.m_props.items.find((item) => item.id == id);
434
+ let citem = this._findItemWithId(item.id);
435
+ this._selectItem(item, citem, notify );
433
436
  }
434
437
  }
435
438
  }
@@ -27,4 +27,4 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- export const x4js_version = "1.5.15";
30
+ export const x4js_version = "1.5.16";
@@ -105,6 +105,11 @@ export declare class TreeView extends VLayout<TreeViewProps, TreeViewEventMap> {
105
105
  forEach(cb: (node: TreeNode) => boolean | void): any;
106
106
  ensureVisible(id: any): void;
107
107
  set selection(id: any);
108
+ /**
109
+ * idem selection = xx but with a notification
110
+ * @param id
111
+ */
112
+ select(id: any, notify?: boolean): void;
108
113
  private _getNode;
109
114
  get selection(): any;
110
115
  getNodeWithId(id: any): TreeNode;
@@ -26,4 +26,4 @@
26
26
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
- export declare const x4js_version = "1.5.15";
29
+ export declare const x4js_version = "1.5.16";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.5.15",
3
+ "version": "1.5.16",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",