native-document 1.0.140 → 1.0.142

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.
@@ -1,8 +1,8 @@
1
1
  import Widget from './widget/Widget';
2
2
  import {PluginsManager} from "../index";
3
- import { DevToolsPlugin } from "./plugin/dev-tools-plugin";
3
+ // import { DevToolsPlugin } from "./plugin/dev-tools-plugin";
4
4
 
5
- PluginsManager.add(DevToolsPlugin, 'Devtools');
5
+ // PluginsManager.add(DevToolsPlugin, 'Devtools');
6
6
 
7
7
  const Devtools = (function () {
8
8
 
@@ -14225,6 +14225,7 @@ var NativeComponents = (function (exports) {
14225
14225
  pinned: null,
14226
14226
  rowspan: null,
14227
14227
  sortable: null,
14228
+ onClick: null,
14228
14229
  props
14229
14230
  };
14230
14231
  }
@@ -14315,6 +14316,11 @@ var NativeComponents = (function (exports) {
14315
14316
  return this;
14316
14317
  };
14317
14318
 
14319
+ Column.prototype.onClick = function(handler) {
14320
+ this.$description.onClick = handler;
14321
+ return this;
14322
+ };
14323
+
14318
14324
  function ColumnGroup(title, props = {}) {
14319
14325
  this.$description = {
14320
14326
  header: title,
@@ -14372,6 +14378,7 @@ var NativeComponents = (function (exports) {
14372
14378
  empty: null,
14373
14379
  onRowClick: null,
14374
14380
  rowProps: null,
14381
+ noHeader: null,
14375
14382
  cellProps: null,
14376
14383
  headerProps: null,
14377
14384
  };
@@ -14417,6 +14424,11 @@ var NativeComponents = (function (exports) {
14417
14424
  return this;
14418
14425
  };
14419
14426
 
14427
+ SimpleTable.prototype.noHeader = function() {
14428
+ this.$description.noHeader = true;
14429
+ return this;
14430
+ };
14431
+
14420
14432
  SimpleTable.prototype.onRowClick = function(handler) {
14421
14433
  this.$description.onRowClick = handler;
14422
14434
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.140",
3
+ "version": "1.0.142",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -11,6 +11,7 @@ export default function Column(key, props = {}) {
11
11
  pinned: null,
12
12
  rowspan: null,
13
13
  sortable: null,
14
+ onClick: null,
14
15
  props
15
16
  };
16
17
  }
@@ -100,3 +101,8 @@ Column.prototype.value = function(value) {
100
101
  this.$description.value = value;
101
102
  return this;
102
103
  };
104
+
105
+ Column.prototype.onClick = function(handler) {
106
+ this.$description.onClick = handler;
107
+ return this;
108
+ };
@@ -17,6 +17,7 @@ export default function SimpleTable(props = {}) {
17
17
  empty: null,
18
18
  onRowClick: null,
19
19
  rowProps: null,
20
+ noHeader: null,
20
21
  cellProps: null,
21
22
  headerProps: null,
22
23
  };
@@ -62,6 +63,11 @@ SimpleTable.prototype.empty = function(content) {
62
63
  return this;
63
64
  };
64
65
 
66
+ SimpleTable.prototype.noHeader = function() {
67
+ this.$description.noHeader = true;
68
+ return this;
69
+ };
70
+
65
71
  SimpleTable.prototype.onRowClick = function(handler) {
66
72
  this.$description.onRowClick = handler;
67
73
  return this;
@@ -1,5 +1,4 @@
1
1
  import {ForEachArray, ShowIf, Div, Span, Img} from "../../../../elements";
2
- import {clear} from "@babel/traverse/lib/cache";
3
2
 
4
3
  export const buildErrors = ($desc) => {
5
4
  return ShowIf($desc.showErrors, () =>
@@ -15,7 +15,7 @@ import {
15
15
  import { $ } from "../../../../../index";
16
16
 
17
17
  export const buildTable = ($desc, instance, visibleColumns) => {
18
- const thead = buildTHead($desc, instance, visibleColumns);
18
+ const thead = $desc.noHeader ? null : buildTHead($desc, instance, visibleColumns);
19
19
  const tbody = buildTBody($desc, instance, visibleColumns);
20
20
 
21
21
  return Div({class: 'data-table-wrapper'}, [
@@ -313,7 +313,11 @@ export const buildRow = ($desc, instance, visibleColumns, row) => {
313
313
  }
314
314
  }
315
315
 
316
- return TBodyCell({ class: classes, }, content)
316
+ const cell = TBodyCell({ class: classes, }, content);
317
+ if($descCol.onClick) {
318
+ cell.nd.onClick((event) => {$descCol.onClick(row, event);});
319
+ }
320
+ return cell;
317
321
  });
318
322
 
319
323
  cells.push(dynamicCells);
@@ -10,7 +10,7 @@ export default function SimpleTableRender($desc, instance) {
10
10
  );
11
11
 
12
12
  return Table(instance.resolveProps(), [
13
- buildHead($desc, visibleColumns),
13
+ $desc.noHeader ? null : buildHead($desc, visibleColumns),
14
14
  buildBody($desc, instance, visibleColumns),
15
15
  ]);
16
16
  }
@@ -155,6 +155,9 @@ const buildRow = ($desc, visibleColumns, row) => {
155
155
  const cell = TBodyCell({ class: column.$description.align ? `is-${column.$description.align}` : null, ...extraProps,},
156
156
  content
157
157
  );
158
+ if(column.$description.onClick) {
159
+ cell.nd.onClick((event) => column.$description.onClick(row, event));
160
+ }
158
161
  cells.push(cell);
159
162
  }
160
163