aio-table 7.0.0 → 7.0.1
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 +98 -11
- 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
|
|
|
@@ -1282,6 +1321,9 @@ class AIOTableCell extends _react.Component {
|
|
|
1282
1321
|
rowHeight,
|
|
1283
1322
|
getCellAttrs
|
|
1284
1323
|
} = this.context;
|
|
1324
|
+
let {
|
|
1325
|
+
striped
|
|
1326
|
+
} = this.props;
|
|
1285
1327
|
var style = {
|
|
1286
1328
|
height: rowHeight,
|
|
1287
1329
|
overflow: template ? undefined : 'hidden',
|
|
@@ -1292,6 +1334,13 @@ class AIOTableCell extends _react.Component {
|
|
|
1292
1334
|
style.padding = 0;
|
|
1293
1335
|
}
|
|
1294
1336
|
|
|
1337
|
+
if (typeof striped === 'string') {
|
|
1338
|
+
style.background = striped;
|
|
1339
|
+
} else if (Array.isArray(striped)) {
|
|
1340
|
+
style.background = striped[0];
|
|
1341
|
+
style.color = striped[1];
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1295
1344
|
let attrs = getCellAttrs(row, column);
|
|
1296
1345
|
return { ...style,
|
|
1297
1346
|
...attrs.style
|
|
@@ -1308,7 +1357,7 @@ class AIOTableCell extends _react.Component {
|
|
|
1308
1357
|
} = this.props;
|
|
1309
1358
|
let attrs = getCellAttrs(row, column);
|
|
1310
1359
|
|
|
1311
|
-
if (striped) {
|
|
1360
|
+
if (striped === true) {
|
|
1312
1361
|
className += ' striped';
|
|
1313
1362
|
}
|
|
1314
1363
|
|
|
@@ -1415,14 +1464,14 @@ class AIOTableCell extends _react.Component {
|
|
|
1415
1464
|
return value;
|
|
1416
1465
|
}
|
|
1417
1466
|
|
|
1418
|
-
if (!template.type) {
|
|
1419
|
-
return template;
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
1467
|
if (template.type === 'slider') {
|
|
1423
1468
|
return fn.getSliderCell(template, value);
|
|
1424
1469
|
}
|
|
1425
1470
|
|
|
1471
|
+
if (template.type === 'checkbox') {
|
|
1472
|
+
return fn.getCheckboxCell(template, value, row);
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1426
1475
|
if (template.type === 'options') {
|
|
1427
1476
|
return fn.getOptionsCell(template, row);
|
|
1428
1477
|
}
|
|
@@ -1440,6 +1489,8 @@ class AIOTableCell extends _react.Component {
|
|
|
1440
1489
|
if (template.type === 'gantt') {
|
|
1441
1490
|
return fn.getGanttCell(row, template);
|
|
1442
1491
|
}
|
|
1492
|
+
|
|
1493
|
+
return template;
|
|
1443
1494
|
}
|
|
1444
1495
|
|
|
1445
1496
|
getContent(row, column, value) {
|
|
@@ -2207,9 +2258,8 @@ function ATFN({
|
|
|
2207
2258
|
},
|
|
2208
2259
|
|
|
2209
2260
|
getOptionsCell({
|
|
2210
|
-
options
|
|
2211
|
-
|
|
2212
|
-
}) {
|
|
2261
|
+
options
|
|
2262
|
+
}, row) {
|
|
2213
2263
|
return /*#__PURE__*/_react.default.createElement(_aioButton.default, {
|
|
2214
2264
|
type: "select",
|
|
2215
2265
|
caret: false,
|
|
@@ -2229,6 +2279,42 @@ function ATFN({
|
|
|
2229
2279
|
});
|
|
2230
2280
|
},
|
|
2231
2281
|
|
|
2282
|
+
getCheckboxCell(template, value, row) {
|
|
2283
|
+
let {
|
|
2284
|
+
color,
|
|
2285
|
+
onChange,
|
|
2286
|
+
size = 24
|
|
2287
|
+
} = template;
|
|
2288
|
+
let style = {
|
|
2289
|
+
width: size,
|
|
2290
|
+
height: size
|
|
2291
|
+
};
|
|
2292
|
+
|
|
2293
|
+
if (!!value) {
|
|
2294
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
2295
|
+
style: style,
|
|
2296
|
+
viewBox: `0,0,24,24`,
|
|
2297
|
+
className: "aio-table-checkbox checked",
|
|
2298
|
+
onClick: () => onChange(row, false)
|
|
2299
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
2300
|
+
fill: color,
|
|
2301
|
+
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"
|
|
2302
|
+
}));
|
|
2303
|
+
} else {
|
|
2304
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
2305
|
+
style: style,
|
|
2306
|
+
viewBox: `0,0,24,24`,
|
|
2307
|
+
className: "aio-table-checkbox",
|
|
2308
|
+
onClick: () => onChange(row, true)
|
|
2309
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
2310
|
+
fill: color,
|
|
2311
|
+
"ng-attr-fill": "{{icon.color}}",
|
|
2312
|
+
"ng-attr-d": "{{icon.data}}",
|
|
2313
|
+
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"
|
|
2314
|
+
}));
|
|
2315
|
+
}
|
|
2316
|
+
},
|
|
2317
|
+
|
|
2232
2318
|
getGanttCell(row, template) {
|
|
2233
2319
|
let {
|
|
2234
2320
|
rtl
|
|
@@ -3605,6 +3691,7 @@ function ATFN({
|
|
|
3605
3691
|
getSliderCell: $$.getSliderCell,
|
|
3606
3692
|
getOptionsCell: $$.getOptionsCell,
|
|
3607
3693
|
getGanttCell: $$.getGanttCell,
|
|
3694
|
+
getCheckboxCell: $$.getCheckboxCell,
|
|
3608
3695
|
handleOutsideClick: $$.handleOutsideClick,
|
|
3609
3696
|
onScroll: $$.onScroll,
|
|
3610
3697
|
getCardRowCount: $$.getCardRowCount,
|