aio-table 7.0.0 → 7.0.3
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/index.css +4 -2
- package/index.js +103 -13
- package/package.json +1 -1
package/index.css
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
font-size:14px;
|
|
12
12
|
overflow: hidden;
|
|
13
13
|
height:500px;
|
|
14
|
+
width:100%;
|
|
14
15
|
}
|
|
15
16
|
.aio-table.rtl{
|
|
16
17
|
direction:rtl;
|
|
@@ -125,7 +126,9 @@
|
|
|
125
126
|
justify-content: center;
|
|
126
127
|
width:fit-content;
|
|
127
128
|
}
|
|
128
|
-
|
|
129
|
+
.aio-table-checkbox{
|
|
130
|
+
fill:dodgerblue;
|
|
131
|
+
}
|
|
129
132
|
.aio-table.rtl .aio-table-cell{
|
|
130
133
|
box-shadow: -3px 4px 6px -2px rgba(0,0,0,0.1);
|
|
131
134
|
}
|
|
@@ -471,7 +474,6 @@ select.aio-table-paging-button{
|
|
|
471
474
|
border-right:8px solid transparent;
|
|
472
475
|
}
|
|
473
476
|
.aio-table-card{
|
|
474
|
-
background:#fff;
|
|
475
477
|
position:relative;
|
|
476
478
|
display:flex;
|
|
477
479
|
box-sizing: border-box;
|
package/index.js
CHANGED
|
@@ -121,6 +121,9 @@ class AIOTable extends _react.Component {
|
|
|
121
121
|
let {
|
|
122
122
|
freezeSize
|
|
123
123
|
} = this.state;
|
|
124
|
+
let {
|
|
125
|
+
cardTemplate
|
|
126
|
+
} = this.props;
|
|
124
127
|
let freezeMode = freezeColumns.length !== 0 && unFreezeColumns.length !== 0;
|
|
125
128
|
let rows = this.getRows(sorts, freezeMode);
|
|
126
129
|
this.rows = rows;
|
|
@@ -151,7 +154,9 @@ class AIOTable extends _react.Component {
|
|
|
151
154
|
columns: unFreezeColumns,
|
|
152
155
|
tableIndex: 1,
|
|
153
156
|
type: "unFreezeCells"
|
|
154
|
-
}))
|
|
157
|
+
})), cardTemplate && /*#__PURE__*/_react.default.createElement(AIOTableUnit, {
|
|
158
|
+
rows: rows
|
|
159
|
+
}));
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
getRows(sorts, freezeMode) {
|
|
@@ -617,7 +622,26 @@ class AIOTableUnit extends _react.Component {
|
|
|
617
622
|
this.dom = /*#__PURE__*/(0, _react.createRef)();
|
|
618
623
|
}
|
|
619
624
|
|
|
625
|
+
getCardStyle() {
|
|
626
|
+
let {
|
|
627
|
+
columnGap,
|
|
628
|
+
rowGap
|
|
629
|
+
} = this.context;
|
|
630
|
+
return {
|
|
631
|
+
gridColumnGap: columnGap,
|
|
632
|
+
gridRowGap: rowGap
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
|
|
620
636
|
getStyle() {
|
|
637
|
+
if (this.context.cardTemplate) {
|
|
638
|
+
return this.getCardStyle();
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
return this.getGridStyle();
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
getGridStyle() {
|
|
621
645
|
var {
|
|
622
646
|
rowGap,
|
|
623
647
|
columnGap
|
|
@@ -804,7 +828,8 @@ class AIOTableUnit extends _react.Component {
|
|
|
804
828
|
cardTemplate,
|
|
805
829
|
cardRowCount,
|
|
806
830
|
search,
|
|
807
|
-
searchText
|
|
831
|
+
searchText,
|
|
832
|
+
indent
|
|
808
833
|
} = this.context;
|
|
809
834
|
var {
|
|
810
835
|
tableIndex,
|
|
@@ -855,7 +880,21 @@ class AIOTableUnit extends _react.Component {
|
|
|
855
880
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
856
881
|
key: rowIndex + '-' + tableIndex,
|
|
857
882
|
className: "aio-table-card"
|
|
858
|
-
},
|
|
883
|
+
}, row.row._level !== 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
884
|
+
style: {
|
|
885
|
+
width: row.row._level * indent,
|
|
886
|
+
border: '1px solid',
|
|
887
|
+
height: '100%',
|
|
888
|
+
position: 'relative'
|
|
889
|
+
}
|
|
890
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
891
|
+
style: {
|
|
892
|
+
background: 'yellow',
|
|
893
|
+
width: '100%',
|
|
894
|
+
positon: 'absolute',
|
|
895
|
+
height: '100%'
|
|
896
|
+
}
|
|
897
|
+
})), cardTemplate(row.row, () => fn.toggleRow(row.row)));
|
|
859
898
|
}), rows && rows.length === 0 && fn.getNoData(columns), !rows && fn.getLoading());
|
|
860
899
|
}
|
|
861
900
|
|
|
@@ -953,7 +992,10 @@ class AIOTableUnit extends _react.Component {
|
|
|
953
992
|
SetState({
|
|
954
993
|
focused: cellId
|
|
955
994
|
}, 'cellonClick');
|
|
956
|
-
setTimeout(() =>
|
|
995
|
+
setTimeout(() => {
|
|
996
|
+
let dom = (0, _jquery.default)(`[data-cell-id = ${cellId}]`).find('.aio-table-input');
|
|
997
|
+
dom.focus().select();
|
|
998
|
+
}, 10);
|
|
957
999
|
}
|
|
958
1000
|
},
|
|
959
1001
|
striped: this.renderIndex % 2 === 0 && striped,
|
|
@@ -1282,6 +1324,9 @@ class AIOTableCell extends _react.Component {
|
|
|
1282
1324
|
rowHeight,
|
|
1283
1325
|
getCellAttrs
|
|
1284
1326
|
} = this.context;
|
|
1327
|
+
let {
|
|
1328
|
+
striped
|
|
1329
|
+
} = this.props;
|
|
1285
1330
|
var style = {
|
|
1286
1331
|
height: rowHeight,
|
|
1287
1332
|
overflow: template ? undefined : 'hidden',
|
|
@@ -1292,6 +1337,13 @@ class AIOTableCell extends _react.Component {
|
|
|
1292
1337
|
style.padding = 0;
|
|
1293
1338
|
}
|
|
1294
1339
|
|
|
1340
|
+
if (typeof striped === 'string') {
|
|
1341
|
+
style.background = striped;
|
|
1342
|
+
} else if (Array.isArray(striped)) {
|
|
1343
|
+
style.background = striped[0];
|
|
1344
|
+
style.color = striped[1];
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1295
1347
|
let attrs = getCellAttrs(row, column);
|
|
1296
1348
|
return { ...style,
|
|
1297
1349
|
...attrs.style
|
|
@@ -1308,7 +1360,7 @@ class AIOTableCell extends _react.Component {
|
|
|
1308
1360
|
} = this.props;
|
|
1309
1361
|
let attrs = getCellAttrs(row, column);
|
|
1310
1362
|
|
|
1311
|
-
if (striped) {
|
|
1363
|
+
if (striped === true) {
|
|
1312
1364
|
className += ' striped';
|
|
1313
1365
|
}
|
|
1314
1366
|
|
|
@@ -1409,20 +1461,20 @@ class AIOTableCell extends _react.Component {
|
|
|
1409
1461
|
let {
|
|
1410
1462
|
fn
|
|
1411
1463
|
} = this.context;
|
|
1412
|
-
let template = typeof column.template === 'function' ? column.template(row, column) : column.template;
|
|
1464
|
+
let template = typeof column.template === 'function' ? column.template(row, column, value) : column.template;
|
|
1413
1465
|
|
|
1414
1466
|
if (!template) {
|
|
1415
1467
|
return value;
|
|
1416
1468
|
}
|
|
1417
1469
|
|
|
1418
|
-
if (!template.type) {
|
|
1419
|
-
return template;
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
1470
|
if (template.type === 'slider') {
|
|
1423
1471
|
return fn.getSliderCell(template, value);
|
|
1424
1472
|
}
|
|
1425
1473
|
|
|
1474
|
+
if (template.type === 'checkbox') {
|
|
1475
|
+
return fn.getCheckboxCell(template, value, row);
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1426
1478
|
if (template.type === 'options') {
|
|
1427
1479
|
return fn.getOptionsCell(template, row);
|
|
1428
1480
|
}
|
|
@@ -1440,6 +1492,8 @@ class AIOTableCell extends _react.Component {
|
|
|
1440
1492
|
if (template.type === 'gantt') {
|
|
1441
1493
|
return fn.getGanttCell(row, template);
|
|
1442
1494
|
}
|
|
1495
|
+
|
|
1496
|
+
return template;
|
|
1443
1497
|
}
|
|
1444
1498
|
|
|
1445
1499
|
getContent(row, column, value) {
|
|
@@ -2207,9 +2261,8 @@ function ATFN({
|
|
|
2207
2261
|
},
|
|
2208
2262
|
|
|
2209
2263
|
getOptionsCell({
|
|
2210
|
-
options
|
|
2211
|
-
|
|
2212
|
-
}) {
|
|
2264
|
+
options
|
|
2265
|
+
}, row) {
|
|
2213
2266
|
return /*#__PURE__*/_react.default.createElement(_aioButton.default, {
|
|
2214
2267
|
type: "select",
|
|
2215
2268
|
caret: false,
|
|
@@ -2229,6 +2282,42 @@ function ATFN({
|
|
|
2229
2282
|
});
|
|
2230
2283
|
},
|
|
2231
2284
|
|
|
2285
|
+
getCheckboxCell(template, value, row) {
|
|
2286
|
+
let {
|
|
2287
|
+
color,
|
|
2288
|
+
onChange,
|
|
2289
|
+
size = 24
|
|
2290
|
+
} = template;
|
|
2291
|
+
let style = {
|
|
2292
|
+
width: size,
|
|
2293
|
+
height: size
|
|
2294
|
+
};
|
|
2295
|
+
|
|
2296
|
+
if (!!value) {
|
|
2297
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
2298
|
+
style: style,
|
|
2299
|
+
viewBox: `0,0,24,24`,
|
|
2300
|
+
className: "aio-table-checkbox checked",
|
|
2301
|
+
onClick: () => onChange(row, false)
|
|
2302
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
2303
|
+
fill: color,
|
|
2304
|
+
d: "M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z"
|
|
2305
|
+
}));
|
|
2306
|
+
} else {
|
|
2307
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
2308
|
+
style: style,
|
|
2309
|
+
viewBox: `0,0,24,24`,
|
|
2310
|
+
className: "aio-table-checkbox",
|
|
2311
|
+
onClick: () => onChange(row, true)
|
|
2312
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
2313
|
+
fill: color,
|
|
2314
|
+
"ng-attr-fill": "{{icon.color}}",
|
|
2315
|
+
"ng-attr-d": "{{icon.data}}",
|
|
2316
|
+
d: "M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z"
|
|
2317
|
+
}));
|
|
2318
|
+
}
|
|
2319
|
+
},
|
|
2320
|
+
|
|
2232
2321
|
getGanttCell(row, template) {
|
|
2233
2322
|
let {
|
|
2234
2323
|
rtl
|
|
@@ -3605,6 +3694,7 @@ function ATFN({
|
|
|
3605
3694
|
getSliderCell: $$.getSliderCell,
|
|
3606
3695
|
getOptionsCell: $$.getOptionsCell,
|
|
3607
3696
|
getGanttCell: $$.getGanttCell,
|
|
3697
|
+
getCheckboxCell: $$.getCheckboxCell,
|
|
3608
3698
|
handleOutsideClick: $$.handleOutsideClick,
|
|
3609
3699
|
onScroll: $$.onScroll,
|
|
3610
3700
|
getCardRowCount: $$.getCardRowCount,
|