@star-insure/sdk 2.0.7 → 2.0.9
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/common/Pagination.d.ts +2 -1
- package/dist/components/common/SimplePagination.d.ts +3 -2
- package/dist/components/tables/Table.d.ts +2 -2
- package/dist/components/tables/TableBody.d.ts +2 -2
- package/dist/components/tables/TableCell.d.ts +2 -2
- package/dist/components/tables/TableHead.d.ts +2 -2
- package/dist/components/tables/TableHeader.d.ts +2 -2
- package/dist/components/tables/TableRow.d.ts +2 -2
- package/dist/sdk.cjs.development.js +61 -27
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +61 -27
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/common/Pagination.tsx +6 -2
- package/src/components/common/SimplePagination.tsx +101 -60
- package/src/components/tables/Table.tsx +3 -3
- package/src/components/tables/TableBody.tsx +4 -3
- package/src/components/tables/TableCell.tsx +3 -3
- package/src/components/tables/TableHead.tsx +4 -3
- package/src/components/tables/TableHeader.tsx +3 -2
- package/src/components/tables/TableRow.tsx +4 -3
package/dist/sdk.esm.js
CHANGED
|
@@ -714,6 +714,21 @@ function _extends() {
|
|
|
714
714
|
return _extends.apply(this, arguments);
|
|
715
715
|
}
|
|
716
716
|
|
|
717
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
718
|
+
if (source == null) return {};
|
|
719
|
+
var target = {};
|
|
720
|
+
var sourceKeys = Object.keys(source);
|
|
721
|
+
var key, i;
|
|
722
|
+
|
|
723
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
724
|
+
key = sourceKeys[i];
|
|
725
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
726
|
+
target[key] = source[key];
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
return target;
|
|
730
|
+
}
|
|
731
|
+
|
|
717
732
|
var initialData = {
|
|
718
733
|
id: undefined,
|
|
719
734
|
status: 'new',
|
|
@@ -1151,10 +1166,12 @@ function Pagination(_ref) {
|
|
|
1151
1166
|
var meta = _ref.meta,
|
|
1152
1167
|
className = _ref.className,
|
|
1153
1168
|
_ref$showPerPageSelec = _ref.showPerPageSelector,
|
|
1154
|
-
showPerPageSelector = _ref$showPerPageSelec === void 0 ? false : _ref$showPerPageSelec
|
|
1169
|
+
showPerPageSelector = _ref$showPerPageSelec === void 0 ? false : _ref$showPerPageSelec,
|
|
1170
|
+
defaultValue = _ref.defaultValue;
|
|
1155
1171
|
var current_page = meta.current_page,
|
|
1156
1172
|
total = meta.total,
|
|
1157
1173
|
per_page = meta.per_page;
|
|
1174
|
+
var perPageValue = defaultValue != null ? defaultValue : per_page;
|
|
1158
1175
|
var page_count = Math.ceil(total / per_page);
|
|
1159
1176
|
|
|
1160
1177
|
function getNextPageLink() {
|
|
@@ -1211,7 +1228,7 @@ function Pagination(_ref) {
|
|
|
1211
1228
|
})), "Prev"), React__default.createElement("div", {
|
|
1212
1229
|
className: "flex gap-6 items-center"
|
|
1213
1230
|
}, React__default.createElement("p", null, "Page ", current_page, " of ", page_count), showPerPageSelector ? React__default.createElement("select", {
|
|
1214
|
-
value:
|
|
1231
|
+
value: perPageValue,
|
|
1215
1232
|
onChange: handlePerPageChange
|
|
1216
1233
|
}, React__default.createElement("option", {
|
|
1217
1234
|
value: "10"
|
|
@@ -1243,11 +1260,13 @@ function SimplePagination(_ref) {
|
|
|
1243
1260
|
var meta = _ref.meta,
|
|
1244
1261
|
className = _ref.className,
|
|
1245
1262
|
_ref$showPerPageSelec = _ref.showPerPageSelector,
|
|
1246
|
-
showPerPageSelector = _ref$showPerPageSelec === void 0 ? false : _ref$showPerPageSelec
|
|
1263
|
+
showPerPageSelector = _ref$showPerPageSelec === void 0 ? false : _ref$showPerPageSelec,
|
|
1264
|
+
defaultValue = _ref.defaultValue;
|
|
1247
1265
|
var current_page = meta.current_page,
|
|
1248
1266
|
per_page = meta.per_page,
|
|
1249
1267
|
to = meta.to,
|
|
1250
1268
|
from = meta.from;
|
|
1269
|
+
var perPageValue = defaultValue != null ? defaultValue : per_page;
|
|
1251
1270
|
var results_on_page = to - from + 1;
|
|
1252
1271
|
var has_more_pages = results_on_page === per_page;
|
|
1253
1272
|
|
|
@@ -1305,7 +1324,7 @@ function SimplePagination(_ref) {
|
|
|
1305
1324
|
})), "Prev"), React__default.createElement("div", {
|
|
1306
1325
|
className: "flex gap-6 items-center"
|
|
1307
1326
|
}, React__default.createElement("p", null, "Page ", current_page), showPerPageSelector ? React__default.createElement("select", {
|
|
1308
|
-
value:
|
|
1327
|
+
value: perPageValue,
|
|
1309
1328
|
onChange: handlePerPageChange
|
|
1310
1329
|
}, React__default.createElement("option", {
|
|
1311
1330
|
value: "10"
|
|
@@ -1450,17 +1469,20 @@ function Modal(_ref) {
|
|
|
1450
1469
|
})))), React__default.createElement("div", null, children))))));
|
|
1451
1470
|
}
|
|
1452
1471
|
|
|
1472
|
+
var _excluded = ["children"];
|
|
1453
1473
|
function Table(_ref) {
|
|
1454
|
-
var children = _ref.children
|
|
1474
|
+
var children = _ref.children,
|
|
1475
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1476
|
+
|
|
1455
1477
|
return React__default.createElement("div", {
|
|
1456
1478
|
className: "-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8 text-sm"
|
|
1457
1479
|
}, React__default.createElement("div", {
|
|
1458
1480
|
className: "inline-block min-w-full py-2 align-middle md:px-6 lg:px-8"
|
|
1459
1481
|
}, React__default.createElement("div", {
|
|
1460
1482
|
className: "overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg"
|
|
1461
|
-
}, React__default.createElement("table", {
|
|
1483
|
+
}, React__default.createElement("table", Object.assign({}, props, {
|
|
1462
1484
|
className: "min-w-full divide-y divide-gray-300"
|
|
1463
|
-
}, children))));
|
|
1485
|
+
}), children))));
|
|
1464
1486
|
}
|
|
1465
1487
|
|
|
1466
1488
|
function TableActions(_ref) {
|
|
@@ -1472,35 +1494,43 @@ function TableActions(_ref) {
|
|
|
1472
1494
|
}, children);
|
|
1473
1495
|
}
|
|
1474
1496
|
|
|
1497
|
+
var _excluded$1 = ["children", "className"];
|
|
1475
1498
|
function TableBody(_ref) {
|
|
1476
1499
|
var children = _ref.children,
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1500
|
+
className = _ref.className,
|
|
1501
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1502
|
+
|
|
1503
|
+
return React__default.createElement("tbody", Object.assign({}, props, {
|
|
1504
|
+
className: cn(className, 'divide-y divide-gray-200 bg-white')
|
|
1505
|
+
}), children);
|
|
1482
1506
|
}
|
|
1483
1507
|
|
|
1508
|
+
var _excluded$2 = ["children", "className", "condensed"];
|
|
1484
1509
|
function TableCell(_ref) {
|
|
1485
1510
|
var children = _ref.children,
|
|
1486
1511
|
className = _ref.className,
|
|
1487
|
-
condensed = _ref.condensed
|
|
1488
|
-
|
|
1512
|
+
condensed = _ref.condensed,
|
|
1513
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1514
|
+
|
|
1515
|
+
return React__default.createElement("td", Object.assign({}, props, {
|
|
1489
1516
|
className: cn(className, 'px-3 py-3 text-sm text-gray-500', {
|
|
1490
1517
|
'w-0 whitespace-nowrap': condensed
|
|
1491
1518
|
})
|
|
1492
|
-
}, children);
|
|
1519
|
+
}), children);
|
|
1493
1520
|
}
|
|
1494
1521
|
|
|
1522
|
+
var _excluded$3 = ["children", "className"];
|
|
1495
1523
|
function TableHead(_ref) {
|
|
1496
1524
|
var children = _ref.children,
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1525
|
+
className = _ref.className,
|
|
1526
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
1527
|
+
|
|
1528
|
+
return React__default.createElement("thead", Object.assign({}, props, {
|
|
1529
|
+
className: cn(className, 'px-3 py-4 text-sm text-white bg-gray-600')
|
|
1530
|
+
}), children);
|
|
1502
1531
|
}
|
|
1503
1532
|
|
|
1533
|
+
var _excluded$4 = ["children", "className", "sort", "textAlign", "condensed"];
|
|
1504
1534
|
function TableHeader(_ref) {
|
|
1505
1535
|
var children = _ref.children,
|
|
1506
1536
|
_ref$className = _ref.className,
|
|
@@ -1508,7 +1538,8 @@ function TableHeader(_ref) {
|
|
|
1508
1538
|
sort = _ref.sort,
|
|
1509
1539
|
_ref$textAlign = _ref.textAlign,
|
|
1510
1540
|
textAlign = _ref$textAlign === void 0 ? 'left' : _ref$textAlign,
|
|
1511
|
-
condensed = _ref.condensed
|
|
1541
|
+
condensed = _ref.condensed,
|
|
1542
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
1512
1543
|
|
|
1513
1544
|
var _React$useState = React__default.useState(''),
|
|
1514
1545
|
sortLink = _React$useState[0],
|
|
@@ -1531,11 +1562,11 @@ function TableHeader(_ref) {
|
|
|
1531
1562
|
}
|
|
1532
1563
|
}, []);
|
|
1533
1564
|
var textAlignClass = textAlign === 'center' && 'text-center justify-center' || textAlign === 'right' && 'text-right justify-end' || 'text-left justify-between';
|
|
1534
|
-
return React__default.createElement("th", {
|
|
1565
|
+
return React__default.createElement("th", Object.assign({}, props, {
|
|
1535
1566
|
className: cn(className, 'py-3.5 px-3 text-sm font-semibold text-left', {
|
|
1536
1567
|
'w-0 whitespace-nowrap': condensed
|
|
1537
1568
|
})
|
|
1538
|
-
}, React__default.createElement("div", {
|
|
1569
|
+
}), React__default.createElement("div", {
|
|
1539
1570
|
className: "flex items-center gap-3 " + textAlignClass
|
|
1540
1571
|
}, children, sort && React__default.createElement(Link, {
|
|
1541
1572
|
href: sortLink
|
|
@@ -1553,17 +1584,20 @@ function TableHeader(_ref) {
|
|
|
1553
1584
|
})))));
|
|
1554
1585
|
}
|
|
1555
1586
|
|
|
1587
|
+
var _excluded$5 = ["children", "className", "onClick"];
|
|
1556
1588
|
function TableRow(_ref) {
|
|
1557
1589
|
var children = _ref.children,
|
|
1558
1590
|
_ref$className = _ref.className,
|
|
1559
1591
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1560
1592
|
_ref$onClick = _ref.onClick,
|
|
1561
|
-
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick
|
|
1593
|
+
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
1594
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
1595
|
+
|
|
1562
1596
|
var bgClass = className.includes('bg') ? '' : 'bg-white even:bg-gray-50';
|
|
1563
|
-
return React__default.createElement("tr", {
|
|
1564
|
-
className: className
|
|
1597
|
+
return React__default.createElement("tr", Object.assign({}, props, {
|
|
1598
|
+
className: cn(className, bgClass, 'hover:bg-gray-100'),
|
|
1565
1599
|
onClick: onClick
|
|
1566
|
-
}, children);
|
|
1600
|
+
}), children);
|
|
1567
1601
|
}
|
|
1568
1602
|
|
|
1569
1603
|
function DateOfBirthField(_ref) {
|