@coreui/react 4.2.3 → 4.3.0
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/dist/components/table/CTable.d.ts +81 -2
- package/dist/components/table/CTableDataCell.d.ts +3 -3
- package/dist/components/table/CTableHeaderCell.d.ts +2 -2
- package/dist/index.es.js +111 -65
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +111 -65
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/popover/CPopover.tsx +5 -0
- package/src/components/table/CTable.tsx +185 -10
- package/src/components/table/CTableDataCell.tsx +8 -5
- package/src/components/table/CTableHeaderCell.tsx +2 -2
package/dist/index.js
CHANGED
|
@@ -7944,6 +7944,9 @@ var CPopover = function (_a) {
|
|
|
7944
7944
|
],
|
|
7945
7945
|
placement: placement,
|
|
7946
7946
|
}), styles = _j.styles, attributes = _j.attributes;
|
|
7947
|
+
React.useEffect(function () {
|
|
7948
|
+
setVisible(visible);
|
|
7949
|
+
}, [visible]);
|
|
7947
7950
|
var getTransitionClass = function (state) {
|
|
7948
7951
|
return state === 'entering'
|
|
7949
7952
|
? 'fade'
|
|
@@ -8160,65 +8163,50 @@ CSpinner.propTypes = {
|
|
|
8160
8163
|
};
|
|
8161
8164
|
CSpinner.displayName = 'CSpinner';
|
|
8162
8165
|
|
|
8163
|
-
var
|
|
8166
|
+
var CTableHead = React.forwardRef(function (_a, ref) {
|
|
8164
8167
|
var _b;
|
|
8165
|
-
var children = _a.children,
|
|
8166
|
-
var _className = classNames(
|
|
8167
|
-
_b["align-".concat(align)] = align,
|
|
8168
|
-
_b["caption-".concat(caption)] = caption,
|
|
8169
|
-
_b["border-".concat(borderColor)] = borderColor,
|
|
8170
|
-
_b['table-bordered'] = bordered,
|
|
8171
|
-
_b['table-borderless'] = borderless,
|
|
8168
|
+
var children = _a.children, className = _a.className, color = _a.color, rest = __rest(_a, ["children", "className", "color"]);
|
|
8169
|
+
var _className = classNames((_b = {},
|
|
8172
8170
|
_b["table-".concat(color)] = color,
|
|
8173
|
-
_b['table-hover'] = hover,
|
|
8174
|
-
_b['table-sm'] = small,
|
|
8175
|
-
_b['table-striped'] = striped,
|
|
8176
8171
|
_b), className);
|
|
8177
|
-
return
|
|
8178
|
-
React__default["default"].createElement("table", __assign({ className: _className ? _className : undefined }, rest, { ref: ref }), children))) : (React__default["default"].createElement("table", __assign({ className: _className ? _className : undefined }, rest, { ref: ref }), children));
|
|
8172
|
+
return (React__default["default"].createElement("thead", __assign({ className: _className ? _className : undefined }, rest, { ref: ref }), children));
|
|
8179
8173
|
});
|
|
8180
|
-
|
|
8181
|
-
align: propTypes.exports.oneOf(['bottom', 'middle', 'top']),
|
|
8182
|
-
borderColor: propTypes.exports.string,
|
|
8183
|
-
bordered: propTypes.exports.bool,
|
|
8184
|
-
borderless: propTypes.exports.bool,
|
|
8185
|
-
caption: propTypes.exports.oneOf(['top']),
|
|
8174
|
+
CTableHead.propTypes = {
|
|
8186
8175
|
children: propTypes.exports.node,
|
|
8187
8176
|
className: propTypes.exports.string,
|
|
8188
8177
|
color: colorPropType,
|
|
8189
|
-
hover: propTypes.exports.bool,
|
|
8190
|
-
responsive: propTypes.exports.oneOfType([
|
|
8191
|
-
propTypes.exports.bool,
|
|
8192
|
-
propTypes.exports.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
|
|
8193
|
-
]),
|
|
8194
|
-
small: propTypes.exports.bool,
|
|
8195
|
-
striped: propTypes.exports.bool,
|
|
8196
8178
|
};
|
|
8197
|
-
|
|
8179
|
+
CTableHead.displayName = 'CTableHead';
|
|
8198
8180
|
|
|
8199
|
-
var
|
|
8181
|
+
var CTableHeaderCell = React.forwardRef(function (_a, ref) {
|
|
8200
8182
|
var _b;
|
|
8201
8183
|
var children = _a.children, className = _a.className, color = _a.color, rest = __rest(_a, ["children", "className", "color"]);
|
|
8202
8184
|
var _className = classNames((_b = {},
|
|
8203
8185
|
_b["table-".concat(color)] = color,
|
|
8204
8186
|
_b), className);
|
|
8205
|
-
return (React__default["default"].createElement("
|
|
8187
|
+
return (React__default["default"].createElement("th", __assign({ className: _className ? _className : undefined }, rest, { ref: ref }), children));
|
|
8206
8188
|
});
|
|
8207
|
-
|
|
8189
|
+
CTableHeaderCell.propTypes = {
|
|
8208
8190
|
children: propTypes.exports.node,
|
|
8209
8191
|
className: propTypes.exports.string,
|
|
8210
8192
|
color: colorPropType,
|
|
8211
8193
|
};
|
|
8212
|
-
|
|
8194
|
+
CTableHeaderCell.displayName = 'CTableHeaderCell';
|
|
8213
8195
|
|
|
8214
|
-
var
|
|
8215
|
-
var
|
|
8216
|
-
|
|
8196
|
+
var CTableBody = React.forwardRef(function (_a, ref) {
|
|
8197
|
+
var _b;
|
|
8198
|
+
var children = _a.children, className = _a.className, color = _a.color, rest = __rest(_a, ["children", "className", "color"]);
|
|
8199
|
+
var _className = classNames((_b = {},
|
|
8200
|
+
_b["table-".concat(color)] = color,
|
|
8201
|
+
_b), className);
|
|
8202
|
+
return (React__default["default"].createElement("tbody", __assign({ className: _className ? _className : undefined }, rest, { ref: ref }), children));
|
|
8217
8203
|
});
|
|
8218
|
-
|
|
8204
|
+
CTableBody.propTypes = {
|
|
8219
8205
|
children: propTypes.exports.node,
|
|
8206
|
+
className: propTypes.exports.string,
|
|
8207
|
+
color: colorPropType,
|
|
8220
8208
|
};
|
|
8221
|
-
|
|
8209
|
+
CTableBody.displayName = 'CTableBody';
|
|
8222
8210
|
|
|
8223
8211
|
var CTableDataCell = React.forwardRef(function (_a, ref) {
|
|
8224
8212
|
var _b;
|
|
@@ -8228,7 +8216,8 @@ var CTableDataCell = React.forwardRef(function (_a, ref) {
|
|
|
8228
8216
|
_b['table-active'] = active,
|
|
8229
8217
|
_b["table-".concat(color)] = color,
|
|
8230
8218
|
_b), className);
|
|
8231
|
-
|
|
8219
|
+
var Component = rest.scope ? 'th' : 'td';
|
|
8220
|
+
return (React__default["default"].createElement(Component, __assign({ className: _className ? _className : undefined }, rest, { ref: ref }), children));
|
|
8232
8221
|
});
|
|
8233
8222
|
CTableDataCell.propTypes = {
|
|
8234
8223
|
active: propTypes.exports.bool,
|
|
@@ -8239,69 +8228,126 @@ CTableDataCell.propTypes = {
|
|
|
8239
8228
|
};
|
|
8240
8229
|
CTableDataCell.displayName = 'CTableDataCell';
|
|
8241
8230
|
|
|
8242
|
-
var
|
|
8231
|
+
var CTableRow = React.forwardRef(function (_a, ref) {
|
|
8243
8232
|
var _b;
|
|
8244
|
-
var children = _a.children, className = _a.className, color = _a.color, rest = __rest(_a, ["children", "className", "color"]);
|
|
8233
|
+
var children = _a.children, active = _a.active, align = _a.align, className = _a.className, color = _a.color, rest = __rest(_a, ["children", "active", "align", "className", "color"]);
|
|
8245
8234
|
var _className = classNames((_b = {},
|
|
8235
|
+
_b["align-".concat(align)] = align,
|
|
8236
|
+
_b['table-active'] = active,
|
|
8246
8237
|
_b["table-".concat(color)] = color,
|
|
8247
8238
|
_b), className);
|
|
8248
|
-
return (React__default["default"].createElement("
|
|
8239
|
+
return (React__default["default"].createElement("tr", __assign({ className: _className ? _className : undefined }, rest, { ref: ref }), children));
|
|
8249
8240
|
});
|
|
8250
|
-
|
|
8241
|
+
CTableRow.propTypes = {
|
|
8242
|
+
active: propTypes.exports.bool,
|
|
8243
|
+
align: propTypes.exports.oneOf(['bottom', 'middle', 'top']),
|
|
8251
8244
|
children: propTypes.exports.node,
|
|
8252
8245
|
className: propTypes.exports.string,
|
|
8253
8246
|
color: colorPropType,
|
|
8254
8247
|
};
|
|
8255
|
-
|
|
8248
|
+
CTableRow.displayName = 'CTableRow';
|
|
8256
8249
|
|
|
8257
|
-
var
|
|
8250
|
+
var CTableFoot = React.forwardRef(function (_a, ref) {
|
|
8258
8251
|
var _b;
|
|
8259
8252
|
var children = _a.children, className = _a.className, color = _a.color, rest = __rest(_a, ["children", "className", "color"]);
|
|
8260
8253
|
var _className = classNames((_b = {},
|
|
8261
8254
|
_b["table-".concat(color)] = color,
|
|
8262
8255
|
_b), className);
|
|
8263
|
-
return (React__default["default"].createElement("
|
|
8256
|
+
return (React__default["default"].createElement("tfoot", __assign({ className: _className ? _className : undefined }, rest, { ref: ref }), children));
|
|
8264
8257
|
});
|
|
8265
|
-
|
|
8258
|
+
CTableFoot.propTypes = {
|
|
8266
8259
|
children: propTypes.exports.node,
|
|
8267
8260
|
className: propTypes.exports.string,
|
|
8268
8261
|
color: colorPropType,
|
|
8269
8262
|
};
|
|
8270
|
-
|
|
8263
|
+
CTableFoot.displayName = 'CTableFoot';
|
|
8271
8264
|
|
|
8272
|
-
var
|
|
8273
|
-
var
|
|
8274
|
-
|
|
8275
|
-
var _className = classNames((_b = {},
|
|
8276
|
-
_b["table-".concat(color)] = color,
|
|
8277
|
-
_b), className);
|
|
8278
|
-
return (React__default["default"].createElement("th", __assign({ className: _className ? _className : undefined }, rest, { ref: ref }), children));
|
|
8265
|
+
var CTableCaption = React.forwardRef(function (_a, ref) {
|
|
8266
|
+
var children = _a.children, props = __rest(_a, ["children"]);
|
|
8267
|
+
return (React__default["default"].createElement("caption", __assign({}, props, { ref: ref }), children));
|
|
8279
8268
|
});
|
|
8280
|
-
|
|
8269
|
+
CTableCaption.propTypes = {
|
|
8281
8270
|
children: propTypes.exports.node,
|
|
8282
|
-
className: propTypes.exports.string,
|
|
8283
|
-
color: colorPropType,
|
|
8284
8271
|
};
|
|
8285
|
-
|
|
8272
|
+
CTableCaption.displayName = 'CTableCaption';
|
|
8286
8273
|
|
|
8287
|
-
var
|
|
8274
|
+
var CTable = React.forwardRef(function (_a, ref) {
|
|
8288
8275
|
var _b;
|
|
8289
|
-
var children = _a.children,
|
|
8290
|
-
var _className = classNames((_b = {},
|
|
8276
|
+
var children = _a.children, align = _a.align, borderColor = _a.borderColor, bordered = _a.bordered, borderless = _a.borderless, caption = _a.caption, captionTop = _a.captionTop, className = _a.className, color = _a.color, columns = _a.columns, footer = _a.footer, hover = _a.hover, _c = _a.items, items = _c === void 0 ? [] : _c, responsive = _a.responsive, small = _a.small, striped = _a.striped, stripedColumns = _a.stripedColumns, tableFootProps = _a.tableFootProps, tableHeadProps = _a.tableHeadProps, rest = __rest(_a, ["children", "align", "borderColor", "bordered", "borderless", "caption", "captionTop", "className", "color", "columns", "footer", "hover", "items", "responsive", "small", "striped", "stripedColumns", "tableFootProps", "tableHeadProps"]);
|
|
8277
|
+
var _className = classNames('table', (_b = {},
|
|
8291
8278
|
_b["align-".concat(align)] = align,
|
|
8292
|
-
_b[
|
|
8279
|
+
_b["border-".concat(borderColor)] = borderColor,
|
|
8280
|
+
_b["caption-top"] = captionTop || caption === 'top',
|
|
8281
|
+
_b['table-bordered'] = bordered,
|
|
8282
|
+
_b['table-borderless'] = borderless,
|
|
8293
8283
|
_b["table-".concat(color)] = color,
|
|
8284
|
+
_b['table-hover'] = hover,
|
|
8285
|
+
_b['table-sm'] = small,
|
|
8286
|
+
_b['table-striped'] = striped,
|
|
8287
|
+
_b['table-striped-columns'] = stripedColumns,
|
|
8294
8288
|
_b), className);
|
|
8295
|
-
|
|
8289
|
+
var rawColumnNames = columns
|
|
8290
|
+
? columns.map(function (column) {
|
|
8291
|
+
if (typeof column === 'object')
|
|
8292
|
+
return column.key;
|
|
8293
|
+
else
|
|
8294
|
+
return column;
|
|
8295
|
+
})
|
|
8296
|
+
: Object.keys(items[0] || {}).filter(function (el) { return el.charAt(0) !== '_'; });
|
|
8297
|
+
var pretifyName = function (name) {
|
|
8298
|
+
return name
|
|
8299
|
+
.replace(/[-_.]/g, ' ')
|
|
8300
|
+
.replace(/ +/g, ' ')
|
|
8301
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
8302
|
+
.split(' ')
|
|
8303
|
+
.map(function (word) { return word.charAt(0).toUpperCase() + word.slice(1); })
|
|
8304
|
+
.join(' ');
|
|
8305
|
+
};
|
|
8306
|
+
var label = function (column) {
|
|
8307
|
+
return typeof column === 'object'
|
|
8308
|
+
? column.label !== undefined
|
|
8309
|
+
? column.label
|
|
8310
|
+
: pretifyName(column.key)
|
|
8311
|
+
: pretifyName(column);
|
|
8312
|
+
};
|
|
8313
|
+
var Table = function () { return (React__default["default"].createElement("table", __assign({ className: _className }, rest, { ref: ref }),
|
|
8314
|
+
((caption && caption !== 'top') || captionTop) && (React__default["default"].createElement(CTableCaption, null, caption || captionTop)),
|
|
8315
|
+
columns && (React__default["default"].createElement(CTableHead, __assign({}, tableHeadProps),
|
|
8316
|
+
React__default["default"].createElement(CTableRow, null, columns.map(function (column, index) { return (React__default["default"].createElement(CTableHeaderCell, __assign({}, (column._props && __assign({}, column._props)), (column._style && { style: __assign({}, column._style) }), { key: index }), label(column))); })))),
|
|
8317
|
+
items && (React__default["default"].createElement(CTableBody, null, items.map(function (item, index) { return (React__default["default"].createElement(CTableRow, __assign({}, (item._props && __assign({}, item._props)), { key: index }), rawColumnNames.map(function (colName, index) {
|
|
8318
|
+
return item[colName] ? (React__default["default"].createElement(CTableDataCell, __assign({}, (item._cellProps && __assign(__assign({}, (item._cellProps['all'] && __assign({}, item._cellProps['all']))), (item._cellProps[colName] && __assign({}, item._cellProps[colName])))), { key: index }), item[colName])) : null;
|
|
8319
|
+
}))); }))),
|
|
8320
|
+
children,
|
|
8321
|
+
footer && (React__default["default"].createElement(CTableFoot, __assign({}, tableFootProps),
|
|
8322
|
+
React__default["default"].createElement(CTableRow, null, footer.map(function (item, index) { return (React__default["default"].createElement(CTableDataCell, __assign({}, (item._props && __assign({}, item._props)), { key: index }), typeof item === 'object' ? item.label : item)); })))))); };
|
|
8323
|
+
return responsive ? (React__default["default"].createElement("div", { className: typeof responsive === 'boolean' ? 'table-responsive' : "table-responsive-".concat(responsive) },
|
|
8324
|
+
React__default["default"].createElement(Table, null))) : (React__default["default"].createElement(Table, null));
|
|
8296
8325
|
});
|
|
8297
|
-
|
|
8298
|
-
active: propTypes.exports.bool,
|
|
8326
|
+
CTable.propTypes = {
|
|
8299
8327
|
align: propTypes.exports.oneOf(['bottom', 'middle', 'top']),
|
|
8328
|
+
borderColor: propTypes.exports.string,
|
|
8329
|
+
bordered: propTypes.exports.bool,
|
|
8330
|
+
borderless: propTypes.exports.bool,
|
|
8331
|
+
caption: propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.oneOf(['top'])]),
|
|
8332
|
+
captionTop: propTypes.exports.string,
|
|
8300
8333
|
children: propTypes.exports.node,
|
|
8301
8334
|
className: propTypes.exports.string,
|
|
8302
8335
|
color: colorPropType,
|
|
8336
|
+
columns: propTypes.exports.array,
|
|
8337
|
+
footer: propTypes.exports.array,
|
|
8338
|
+
hover: propTypes.exports.bool,
|
|
8339
|
+
items: propTypes.exports.array,
|
|
8340
|
+
responsive: propTypes.exports.oneOfType([
|
|
8341
|
+
propTypes.exports.bool,
|
|
8342
|
+
propTypes.exports.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
|
|
8343
|
+
]),
|
|
8344
|
+
small: propTypes.exports.bool,
|
|
8345
|
+
striped: propTypes.exports.bool,
|
|
8346
|
+
stripedColumns: propTypes.exports.bool,
|
|
8347
|
+
tableFootProps: propTypes.exports.shape(__assign({}, CTableFoot.propTypes)),
|
|
8348
|
+
tableHeadProps: propTypes.exports.shape(__assign({}, CTableHead.propTypes)),
|
|
8303
8349
|
};
|
|
8304
|
-
|
|
8350
|
+
CTable.displayName = 'CTable';
|
|
8305
8351
|
|
|
8306
8352
|
var CTabContent = React.forwardRef(function (_a, ref) {
|
|
8307
8353
|
var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
|