@onehat/ui 0.3.331 → 0.3.333
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.
package/package.json
CHANGED
|
@@ -70,18 +70,20 @@ export default function ColumnSelectorWindow(props) {
|
|
|
70
70
|
{
|
|
71
71
|
header: 'Show',
|
|
72
72
|
fieldName: 'is_shown',
|
|
73
|
-
|
|
73
|
+
isSortable: false,
|
|
74
74
|
isEditable: false,
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
isReorderable: false,
|
|
76
|
+
isResizable: false,
|
|
77
77
|
w: '50px',
|
|
78
78
|
renderer: (datum) => {
|
|
79
79
|
const
|
|
80
80
|
[ix, header] = datum,
|
|
81
81
|
columnConfig = localColumnsConfig.current[ix],
|
|
82
|
-
isHidden = columnConfig.isHidden
|
|
82
|
+
isHidden = columnConfig.isHidden,
|
|
83
|
+
isHidable = columnConfig.isHidable;
|
|
83
84
|
return <CheckboxButton
|
|
84
85
|
isChecked={!isHidden}
|
|
86
|
+
isDisabled={!isHidable}
|
|
85
87
|
onPress={() => {
|
|
86
88
|
if (isHidden) {
|
|
87
89
|
onShowColumn(ix);
|
|
@@ -95,10 +97,10 @@ export default function ColumnSelectorWindow(props) {
|
|
|
95
97
|
{
|
|
96
98
|
header: 'Column',
|
|
97
99
|
fieldName: 1, // ix
|
|
98
|
-
|
|
100
|
+
isSortable: false,
|
|
99
101
|
isEditable: false,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
isReorderable: false,
|
|
103
|
+
isResizable: false,
|
|
102
104
|
flex: 3,
|
|
103
105
|
}
|
|
104
106
|
]}
|
|
@@ -14,9 +14,6 @@ import {
|
|
|
14
14
|
SELECTION_MODE_SINGLE,
|
|
15
15
|
SELECTION_MODE_MULTI,
|
|
16
16
|
} from '../../Constants/Selection.js';
|
|
17
|
-
import {
|
|
18
|
-
v4 as uuid,
|
|
19
|
-
} from 'uuid';
|
|
20
17
|
import {
|
|
21
18
|
DROP_POSITION_BEFORE,
|
|
22
19
|
DROP_POSITION_AFTER,
|
|
@@ -92,6 +89,7 @@ function GridComponent(props) {
|
|
|
92
89
|
|
|
93
90
|
columnsConfig = [], // json configurations for each column
|
|
94
91
|
columnProps = {},
|
|
92
|
+
defaultHiddenColumns = [],
|
|
95
93
|
getRowProps = (item) => {
|
|
96
94
|
return {
|
|
97
95
|
borderBottomWidth: 1,
|
|
@@ -836,10 +834,11 @@ function GridComponent(props) {
|
|
|
836
834
|
const
|
|
837
835
|
defaults = {
|
|
838
836
|
isEditable: false,
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
isHidden:
|
|
837
|
+
isReorderable: true,
|
|
838
|
+
isResizable: true,
|
|
839
|
+
isSortable: true,
|
|
840
|
+
isHidden: inArray(columnConfig.id, defaultHiddenColumns),
|
|
841
|
+
isHidable: true,
|
|
843
842
|
isOver: false,
|
|
844
843
|
},
|
|
845
844
|
config = _.assign({}, defaults, columnConfig);
|
|
@@ -147,7 +147,7 @@ export default function GridHeaderRow(props) {
|
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
// Verify index can actually be used
|
|
150
|
-
if (typeof localColumnsConfig[newIx] === 'undefined' || !localColumnsConfig[newIx].
|
|
150
|
+
if (typeof localColumnsConfig[newIx] === 'undefined' || !localColumnsConfig[newIx].isReorderable) {
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -222,7 +222,7 @@ export default function GridHeaderRow(props) {
|
|
|
222
222
|
});
|
|
223
223
|
|
|
224
224
|
// Verify index can actually be used
|
|
225
|
-
if (typeof localColumnsConfig[newIx] === 'undefined' || !localColumnsConfig[newIx].
|
|
225
|
+
if (typeof localColumnsConfig[newIx] === 'undefined' || !localColumnsConfig[newIx].isReorderable) {
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
228
|
|
|
@@ -296,17 +296,17 @@ export default function GridHeaderRow(props) {
|
|
|
296
296
|
let {
|
|
297
297
|
fieldName,
|
|
298
298
|
header = _.upperFirst(fieldName),
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
isReorderable: configIsReorderable,
|
|
300
|
+
isResizable: configIsResizable,
|
|
301
|
+
isSortable,
|
|
302
302
|
w,
|
|
303
303
|
flex,
|
|
304
304
|
isOver = false,
|
|
305
305
|
isHidden = false,
|
|
306
306
|
} = config,
|
|
307
|
-
isSorter =
|
|
308
|
-
isReorderable = canColumnsReorder &&
|
|
309
|
-
isResizable = canColumnsResize &&
|
|
307
|
+
isSorter = isSortable && canColumnsSort && sortField === fieldName,
|
|
308
|
+
isReorderable = canColumnsReorder && configIsReorderable,
|
|
309
|
+
isResizable = canColumnsResize && configIsResizable,
|
|
310
310
|
propsToPass = {
|
|
311
311
|
borderRightWidth: 2,
|
|
312
312
|
borderRightColor: '#fff',
|
|
@@ -351,7 +351,7 @@ export default function GridHeaderRow(props) {
|
|
|
351
351
|
if (isBlocked.current) { // withDraggable initiates block
|
|
352
352
|
return;
|
|
353
353
|
}
|
|
354
|
-
if (
|
|
354
|
+
if (isSortable && canColumnsSort) {
|
|
355
355
|
onSort(config, e);
|
|
356
356
|
}
|
|
357
357
|
}}
|