native-document 1.0.142 → 1.0.143
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.
|
@@ -14253,6 +14253,11 @@ var NativeComponents = (function (exports) {
|
|
|
14253
14253
|
return this;
|
|
14254
14254
|
};
|
|
14255
14255
|
|
|
14256
|
+
Column.prototype.props = function(props = {}) {
|
|
14257
|
+
this.$description.props = props;
|
|
14258
|
+
return this;
|
|
14259
|
+
};
|
|
14260
|
+
|
|
14256
14261
|
Column.prototype.pinned = function(orientation) {
|
|
14257
14262
|
this.$description.pinned = orientation;
|
|
14258
14263
|
return this;
|
|
@@ -14381,6 +14386,7 @@ var NativeComponents = (function (exports) {
|
|
|
14381
14386
|
noHeader: null,
|
|
14382
14387
|
cellProps: null,
|
|
14383
14388
|
headerProps: null,
|
|
14389
|
+
props
|
|
14384
14390
|
};
|
|
14385
14391
|
}
|
|
14386
14392
|
|
package/package.json
CHANGED
|
@@ -39,6 +39,11 @@ Column.prototype.hidden = function() {
|
|
|
39
39
|
return this;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
Column.prototype.props = function(props = {}) {
|
|
43
|
+
this.$description.props = props;
|
|
44
|
+
return this;
|
|
45
|
+
};
|
|
46
|
+
|
|
42
47
|
Column.prototype.pinned = function(orientation) {
|
|
43
48
|
this.$description.pinned = orientation;
|
|
44
49
|
return this;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {Table, THead, TBody, TRow, THeadCell, TBodyCell, Div, Span, ShowIf} from '../../../../../elements';
|
|
2
2
|
import './simple-table.css';
|
|
3
|
+
import {classPropertyAccumulator} from "../../../../../utils";
|
|
3
4
|
|
|
4
5
|
export default function SimpleTableRender($desc, instance) {
|
|
5
6
|
const props = instance.getEditableProps();
|
|
@@ -151,8 +152,10 @@ const buildRow = ($desc, visibleColumns, row) => {
|
|
|
151
152
|
? column.$description.render(value, row)
|
|
152
153
|
: value ?? '';
|
|
153
154
|
|
|
154
|
-
const extraProps = $desc.cellProps?.(value, row, column) || {};
|
|
155
|
-
const
|
|
155
|
+
const extraProps = column.$description.props || $desc.cellProps?.(value, row, column) || {};
|
|
156
|
+
const classProperty = classPropertyAccumulator(extraProps.class || {});
|
|
157
|
+
classProperty.add(column.$description.align ? `is-${column.$description.align}` : null)
|
|
158
|
+
const cell = TBodyCell({ ...extraProps, class: classProperty.value() },
|
|
156
159
|
content
|
|
157
160
|
);
|
|
158
161
|
if(column.$description.onClick) {
|
|
@@ -162,8 +165,10 @@ const buildRow = ($desc, visibleColumns, row) => {
|
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
const rowExtraProps = $desc.rowProps?.(row) || {};
|
|
168
|
+
const classProperty = classPropertyAccumulator(rowExtraProps.class || {});
|
|
169
|
+
classProperty.add('has-click', !!$desc.onRowClick)
|
|
165
170
|
|
|
166
|
-
const tr = TRow({ class:
|
|
171
|
+
const tr = TRow({ ...rowExtraProps, class: classProperty.value()}, cells);
|
|
167
172
|
|
|
168
173
|
if($desc.onRowClick) {
|
|
169
174
|
tr.nd.onClick(() => $desc.onRowClick(row));
|