@hypericon/mico 0.3.15 → 0.3.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.
@@ -69,6 +69,8 @@ function createTree() {
69
69
  return;
70
70
  if (!ev.dataTransfer)
71
71
  return;
72
+ if (node.draggable === false)
73
+ return;
72
74
  attrs.enableLogging && console.log(`start dragging`, node.data);
73
75
  ev.dataTransfer.setData(DATA_TRANSFER_TYPE, JSON.stringify(node.data));
74
76
  ev.dataTransfer.effectAllowed = "move";
@@ -164,7 +166,7 @@ function createTree() {
164
166
  (0, mithril_1.default)(".mico-tree-label", {
165
167
  class: `${targettingDragClass}`,
166
168
  style: "position: relative; flex: 1 1 0%; overflow-x: hidden;",
167
- draggable: enableReordering,
169
+ draggable: enableReordering && (node.draggable !== false),
168
170
  onclick: (ev) => {
169
171
  var _a;
170
172
  this.handleClick(ev, node);
@@ -2,6 +2,8 @@ import m from "mithril";
2
2
  export interface TreeNode<T extends object = {}> {
3
3
  label: string | m.Vnode<any>;
4
4
  expanded: boolean;
5
+ /** Optionally disable dragging where it would otherwise be enabled */
6
+ draggable?: boolean;
5
7
  children?: TreeNode<T>[];
6
8
  data: T;
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypericon/mico",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "UI components and utilities with Mithril",
5
5
  "author": "Ed Johnson, Hypericon Ltd",
6
6
  "license": "MIT",