@akinon/akitable 0.0.6 → 0.2.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.
Files changed (76) hide show
  1. package/dist/cjs/components/AntdTable/index.d.ts.map +1 -0
  2. package/dist/cjs/components/AntdTable/index.js +33 -0
  3. package/dist/cjs/components/Footer/index.css +6 -0
  4. package/dist/{components → cjs/components}/Footer/index.d.ts +1 -0
  5. package/dist/cjs/components/Footer/index.d.ts.map +1 -0
  6. package/dist/cjs/components/Footer/index.js +16 -0
  7. package/dist/cjs/components/Header/index.css +84 -0
  8. package/dist/{components → cjs/components}/Header/index.d.ts +1 -0
  9. package/dist/cjs/components/Header/index.d.ts.map +1 -0
  10. package/dist/cjs/components/Header/index.js +25 -0
  11. package/dist/cjs/components/HeaderActions/index.css +30 -0
  12. package/dist/{components → cjs/components}/HeaderActions/index.d.ts +1 -0
  13. package/dist/cjs/components/HeaderActions/index.d.ts.map +1 -0
  14. package/dist/cjs/components/HeaderActions/index.js +39 -0
  15. package/dist/cjs/components/Pagination/index.css +96 -0
  16. package/dist/{components → cjs/components}/Pagination/index.d.ts +1 -0
  17. package/dist/cjs/components/Pagination/index.d.ts.map +1 -0
  18. package/dist/cjs/components/Pagination/index.js +20 -0
  19. package/dist/cjs/components/index.d.ts.map +1 -0
  20. package/dist/cjs/components/index.js +13 -0
  21. package/dist/cjs/context/index.d.ts.map +1 -0
  22. package/dist/cjs/context/index.js +35 -0
  23. package/dist/cjs/index.css +28 -0
  24. package/dist/{index.d.ts → cjs/index.d.ts} +1 -0
  25. package/dist/cjs/index.d.ts.map +1 -0
  26. package/dist/cjs/index.js +96 -0
  27. package/dist/cjs/types.d.ts.map +1 -0
  28. package/dist/cjs/types.js +2 -0
  29. package/dist/esm/components/AntdTable/index.d.ts +6 -0
  30. package/dist/esm/components/AntdTable/index.d.ts.map +1 -0
  31. package/dist/esm/components/AntdTable/index.js +29 -0
  32. package/dist/esm/components/Footer/index.css +6 -0
  33. package/dist/esm/components/Footer/index.d.ts +4 -0
  34. package/dist/esm/components/Footer/index.d.ts.map +1 -0
  35. package/dist/esm/components/Footer/index.js +12 -0
  36. package/dist/esm/components/Header/index.css +84 -0
  37. package/dist/esm/components/Header/index.d.ts +10 -0
  38. package/dist/esm/components/Header/index.d.ts.map +1 -0
  39. package/dist/esm/components/Header/index.js +21 -0
  40. package/dist/esm/components/HeaderActions/index.css +30 -0
  41. package/dist/esm/components/HeaderActions/index.d.ts +9 -0
  42. package/dist/esm/components/HeaderActions/index.d.ts.map +1 -0
  43. package/dist/esm/components/HeaderActions/index.js +35 -0
  44. package/dist/esm/components/Pagination/index.css +96 -0
  45. package/dist/esm/components/Pagination/index.d.ts +4 -0
  46. package/dist/esm/components/Pagination/index.d.ts.map +1 -0
  47. package/dist/esm/components/Pagination/index.js +16 -0
  48. package/dist/esm/components/index.d.ts +6 -0
  49. package/dist/esm/components/index.d.ts.map +1 -0
  50. package/dist/esm/components/index.js +5 -0
  51. package/dist/esm/context/index.d.ts +25 -0
  52. package/dist/esm/context/index.d.ts.map +1 -0
  53. package/dist/esm/context/index.js +30 -0
  54. package/dist/esm/index.css +28 -0
  55. package/dist/esm/index.d.ts +19 -0
  56. package/dist/esm/index.d.ts.map +1 -0
  57. package/dist/esm/index.js +92 -0
  58. package/dist/esm/types.d.ts +18 -0
  59. package/dist/esm/types.d.ts.map +1 -0
  60. package/dist/esm/types.js +1 -0
  61. package/package.json +25 -18
  62. package/dist/components/AntdTable/index.d.ts.map +0 -1
  63. package/dist/components/Footer/index.d.ts.map +0 -1
  64. package/dist/components/Header/index.d.ts.map +0 -1
  65. package/dist/components/HeaderActions/index.d.ts.map +0 -1
  66. package/dist/components/Pagination/index.d.ts.map +0 -1
  67. package/dist/components/index.d.ts.map +0 -1
  68. package/dist/context/index.d.ts.map +0 -1
  69. package/dist/index.cjs +0 -2
  70. package/dist/index.d.ts.map +0 -1
  71. package/dist/index.js +0 -977
  72. package/dist/types.d.ts.map +0 -1
  73. /package/dist/{components → cjs/components}/AntdTable/index.d.ts +0 -0
  74. /package/dist/{components → cjs/components}/index.d.ts +0 -0
  75. /package/dist/{context → cjs/context}/index.d.ts +0 -0
  76. /package/dist/{types.d.ts → cjs/types.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AntdTable/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,cAAc,CAAC,KAAK,IAAI,IAAI,CACtC,UAAU,CAAC,KAAK,CAAC,EACjB,OAAO,GAAG,aAAa,GAAG,YAAY,GAAG,UAAU,CACpD,CAAC;AAEF,eAAO,MAAM,SAAS,uGA6BrB,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.AntdTable = void 0;
15
+ const ui_table_1 = require("@akinon/ui-table");
16
+ const react_1 = require("react");
17
+ const context_1 = require("../../context");
18
+ const AntdTable = (_a) => {
19
+ var { rowSelection } = _a, restProps = __rest(_a, ["rowSelection"]);
20
+ const { dispatch } = (0, context_1.useAkitableContext)();
21
+ const customRowSelection = rowSelection && Object.assign(Object.assign({}, rowSelection), { onChange: (selectedRowKeys, selectedRows) => {
22
+ // if akitable provides rowSelection.onChange, call it
23
+ if (rowSelection.onChange) {
24
+ rowSelection.onChange(selectedRowKeys, selectedRows, { type: 'all' });
25
+ }
26
+ dispatch({
27
+ type: 'SET_SELECTED_ROWS',
28
+ payload: selectedRows
29
+ });
30
+ } });
31
+ return (react_1.default.createElement(ui_table_1.Table, Object.assign({ bordered: true, pagination: false, rowSelection: customRowSelection }, restProps)));
32
+ };
33
+ exports.AntdTable = AntdTable;
@@ -0,0 +1,6 @@
1
+ .akitable-footer {
2
+ padding: 20px;
3
+ display: flex;
4
+ justify-content: flex-end;
5
+ align-items: center;
6
+ }
@@ -1,3 +1,4 @@
1
+ import './index.css';
1
2
  import React from 'react';
2
3
  export declare const AkitableFooter: () => React.JSX.Element;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Footer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,cAAc,yBAa1B,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AkitableFooter = void 0;
4
+ require("./index.css");
5
+ const ui_card_1 = require("@akinon/ui-card");
6
+ const react_1 = require("react");
7
+ const index_1 = require("../index");
8
+ const AkitableFooter = () => {
9
+ return (react_1.default.createElement(ui_card_1.Card, { style: {
10
+ borderTopLeftRadius: 0,
11
+ borderTopRightRadius: 0
12
+ } },
13
+ react_1.default.createElement("div", { className: "akitable-footer" },
14
+ react_1.default.createElement(index_1.AkitablePagination, null))));
15
+ };
16
+ exports.AkitableFooter = AkitableFooter;
@@ -0,0 +1,84 @@
1
+ .akitable-header {
2
+ padding: 20px 32px 16px;
3
+ display: flex;
4
+ justify-content: space-between;
5
+ gap: 16px;
6
+
7
+ /* Push pagination to the right
8
+ even if table actions are hidden. */
9
+ & .akinon-pagination {
10
+ margin-left: auto;
11
+ }
12
+
13
+ &__left-block {
14
+ flex: 1;
15
+ }
16
+
17
+ &__middle-block {
18
+ color: black;
19
+ }
20
+
21
+ &__right-block {
22
+ display: flex;
23
+ justify-content: flex-end;
24
+ align-items: flex-end;
25
+ flex-direction: column;
26
+ gap: 20px;
27
+ }
28
+
29
+ &__export-options {
30
+ display: flex;
31
+ align-items: center;
32
+ gap: 12px;
33
+ }
34
+
35
+ &__export-option {
36
+ cursor: pointer;
37
+ display: flex;
38
+ flex-direction: column;
39
+ justify-content: center;
40
+ align-items: center;
41
+ background-color: #4482ff;
42
+ color: white;
43
+ width: 36px;
44
+ height: 36px;
45
+ border-radius: 5px;
46
+ }
47
+
48
+ &__export-option-icon {
49
+ height: 16px;
50
+ & > i {
51
+ color: white;
52
+ margin: 0;
53
+ font-size: 10px;
54
+ font-weight: bold;
55
+
56
+ &::before {
57
+ color: white;
58
+ }
59
+ }
60
+ }
61
+
62
+ &__export-option-label {
63
+ font-weight: bold;
64
+ font-size: 11px;
65
+ user-select: none;
66
+ cursor: pointer;
67
+ }
68
+
69
+ &__info {
70
+ margin-bottom: 0.5rem;
71
+ }
72
+
73
+ &__title.akinon-typography {
74
+ font-size: 20px;
75
+ margin: 0.5rem 0 0.1rem;
76
+ font-weight: 700;
77
+ }
78
+
79
+ &__description.akinon-typography {
80
+ font-size: 13px;
81
+ color: #797979;
82
+ font-weight: 400;
83
+ }
84
+ }
@@ -1,3 +1,4 @@
1
+ import './index.css';
1
2
  import React from 'react';
2
3
  interface AkitableHeaderProps {
3
4
  title: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Header/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,8CAIxB,mBAAmB,sBA+BrB,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AkitableHeader = void 0;
4
+ require("./index.css");
5
+ const ui_card_1 = require("@akinon/ui-card");
6
+ const Typography = require("@akinon/ui-typography");
7
+ const react_1 = require("react");
8
+ const index_1 = require("../index");
9
+ const { Title, Text } = Typography;
10
+ const AkitableHeader = ({ title, description, headerMiddleBlock }) => {
11
+ return (react_1.default.createElement(ui_card_1.Card, { style: {
12
+ borderBottomLeftRadius: 0,
13
+ borderBottomRightRadius: 0
14
+ } },
15
+ react_1.default.createElement("div", { className: "akitable-header" },
16
+ react_1.default.createElement("div", { className: "akitable-header__left-block" },
17
+ react_1.default.createElement("div", { className: "akitable-header__info" },
18
+ react_1.default.createElement(Title, { className: "akitable-header__title", level: 5 }, title),
19
+ react_1.default.createElement(Text, { className: "akitable-header__description" }, description)),
20
+ react_1.default.createElement(index_1.HeaderActions, { placeholder: 'Please select an action', applyButtonLabel: 'Apply' })),
21
+ react_1.default.createElement("div", { className: "akitable-header__middle-block" }, headerMiddleBlock),
22
+ react_1.default.createElement("div", { className: "akitable-header__right-block" },
23
+ react_1.default.createElement(index_1.AkitablePagination, null)))));
24
+ };
25
+ exports.AkitableHeader = AkitableHeader;
@@ -0,0 +1,30 @@
1
+ .header-actions {
2
+ &__apply-button.akinon-btn {
3
+ font-weight: 600;
4
+ height: 40px;
5
+ }
6
+
7
+ .akinon-select-single:not(.akinon-select-customize-input)
8
+ .akinon-select-selector {
9
+ box-sizing: border-box;
10
+ height: 40px;
11
+ align-items: center;
12
+ border-radius: 5px;
13
+ border: solid 1px #c8daec;
14
+ width: 150px;
15
+ }
16
+
17
+ .akinon-select-focused:not(.akinon-select-disabled).akinon-select:not(
18
+ .akinon-select-customize-input
19
+ )
20
+ .akinon-select-selector {
21
+ border-right-width: 0 !important;
22
+ }
23
+
24
+ .akinon-select-arrow {
25
+ top: 70%;
26
+ }
27
+ .akinon-select-selector {
28
+ min-width: 220px;
29
+ }
30
+ }
@@ -1,3 +1,4 @@
1
+ import './index.css';
1
2
  import React from 'react';
2
3
  interface HeaderActionsProps {
3
4
  placeholder: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/HeaderActions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAMrB,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,UAAU,kBAAkB;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,sCAGvB,kBAAkB,kCAwDpB,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeaderActions = void 0;
4
+ require("./index.css");
5
+ const ui_button_1 = require("@akinon/ui-button");
6
+ const ui_select_1 = require("@akinon/ui-select");
7
+ const ui_space_1 = require("@akinon/ui-space");
8
+ const react_1 = require("react");
9
+ const context_1 = require("../../context");
10
+ const HeaderActions = ({ placeholder, applyButtonLabel }) => {
11
+ const [selectedActionIndex, setSelectedActionIndex] = (0, react_1.useState)(undefined);
12
+ const { state: { selectedRows }, headerActions } = (0, context_1.useAkitableContext)();
13
+ if (!headerActions)
14
+ return;
15
+ const actionOptions = headerActions.map((action, i) => {
16
+ return {
17
+ label: action.label,
18
+ value: i,
19
+ // do not check isSingleRequired in here but in action handler, since user can select multiple rows after selecting the action which will lead errors.
20
+ disabled: action.disabled
21
+ };
22
+ });
23
+ const handleActionApply = () => {
24
+ if (selectedActionIndex === undefined || selectedActionIndex === null)
25
+ return;
26
+ if ((selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) === 0)
27
+ return;
28
+ const selectedAction = headerActions[selectedActionIndex];
29
+ selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.handler(selectedRows);
30
+ };
31
+ const handleActionSelectChange = (value) => {
32
+ setSelectedActionIndex(value);
33
+ };
34
+ const isApplyButtonDisabled = selectedActionIndex === undefined || (selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) === 0;
35
+ return (react_1.default.createElement(ui_space_1.Space, { align: "baseline", className: "header-actions" },
36
+ react_1.default.createElement(ui_select_1.Select, { value: selectedActionIndex, onChange: handleActionSelectChange, options: actionOptions, placeholder: placeholder, className: "header-actions__select" }),
37
+ react_1.default.createElement(ui_button_1.Button, { disabled: isApplyButtonDisabled, className: "header-actions__apply-button", onClick: handleActionApply }, applyButtonLabel)));
38
+ };
39
+ exports.HeaderActions = HeaderActions;
@@ -0,0 +1,96 @@
1
+ .akitable-pagination-container {
2
+ display: flex;
3
+
4
+ .akinon-select-single:not(.akinon-select-customize-input)
5
+ .akinon-select-selector {
6
+ box-sizing: border-box;
7
+ height: 40px;
8
+ align-items: center;
9
+ border-radius: 5px;
10
+ border: solid 1px #c8daec;
11
+ }
12
+
13
+ &__pagination.akinon-pagination {
14
+ display: flex;
15
+ align-items: center;
16
+ border-radius: 5px;
17
+
18
+ li {
19
+ margin: 0;
20
+ }
21
+
22
+ .akinon-pagination-prev,
23
+ .akinon-pagination-next {
24
+ width: 36px;
25
+ border-radius: 5px;
26
+
27
+ & > button {
28
+ color: #788195;
29
+
30
+ &:hover,
31
+ &:focus {
32
+ color: #788195;
33
+ }
34
+ }
35
+ }
36
+
37
+ .akinon-pagination-simple-pager {
38
+ color: #9b9b9b;
39
+ height: 40px;
40
+ border: 1px solid #c8daec;
41
+ margin-inline-end: unset !important;
42
+ padding-inline-end: 8px !important;
43
+
44
+ & > input {
45
+ color: #062a4a;
46
+ font-weight: 600;
47
+ border: 1px solid #c8daec;
48
+ border-radius: 0;
49
+ box-shadow: inset 0 0 2px 2px #eef0f2;
50
+ background-color: #fbfcfd;
51
+
52
+ &:hover {
53
+ border: 1px solid #c8daec;
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+ .akinon-select-selector {
60
+ color: #9b9b9b !important;
61
+ }
62
+
63
+ /* override antd style
64
+ apply every direct */
65
+ .akinon-pagination-prev {
66
+ height: 40px !important;
67
+ border: 1px solid #c8daec !important;
68
+ border-right: none !important;
69
+ border-top-right-radius: 0% !important;
70
+ border-bottom-right-radius: 0% !important;
71
+ > * {
72
+ height: inherit !important;
73
+ }
74
+ }
75
+
76
+ .akinon-pagination-next {
77
+ height: 40px !important;
78
+ border: 1px solid #c8daec !important;
79
+ border-left: none !important;
80
+ border-top-left-radius: 0% !important;
81
+ border-bottom-left-radius: 0% !important;
82
+ > * {
83
+ height: inherit !important;
84
+ }
85
+ }
86
+ .akinon-pagination-slash {
87
+ margin-inline-end: 0px;
88
+ margin-inline-start: 12px;
89
+ }
90
+
91
+ .akinon-pagination-options {
92
+ height: 40px !important;
93
+ order: -1 !important; /* Places it at the beginning */
94
+ margin-right: 20px !important;
95
+ }
96
+ }
@@ -1,3 +1,4 @@
1
+ import './index.css';
1
2
  import React from 'react';
2
3
  export declare const AkitablePagination: () => React.JSX.Element;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Pagination/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,kBAAkB,yBA2B9B,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AkitablePagination = void 0;
4
+ require("./index.css");
5
+ const ui_pagination_1 = require("@akinon/ui-pagination");
6
+ const react_1 = require("react");
7
+ const context_1 = require("../../context");
8
+ const AkitablePagination = () => {
9
+ const { useAkitablePagination } = (0, context_1.useAkitableContext)();
10
+ const [pagination, setPagination] = useAkitablePagination;
11
+ const handlePaginationChange = (currentPage, pageSize) => {
12
+ setPagination(Object.assign(Object.assign({}, pagination), { currentPage,
13
+ pageSize }));
14
+ };
15
+ return (react_1.default.createElement("div", { className: "akitable-pagination-container" },
16
+ react_1.default.createElement(ui_pagination_1.Pagination, { className: "akitable-pagination-container__pagination", current: pagination.currentPage, total: pagination.totalDataLength, pageSize: pagination.pageSize, onChange: handlePaginationChange, simple: true, locale: {
17
+ items_per_page: pagination.paginationLabel || 'per page'
18
+ } })));
19
+ };
20
+ exports.AkitablePagination = AkitablePagination;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AkitablePagination = exports.HeaderActions = exports.AkitableHeader = exports.AkitableFooter = exports.AntdTable = void 0;
4
+ var AntdTable_1 = require("./AntdTable");
5
+ Object.defineProperty(exports, "AntdTable", { enumerable: true, get: function () { return AntdTable_1.AntdTable; } });
6
+ var Footer_1 = require("./Footer");
7
+ Object.defineProperty(exports, "AkitableFooter", { enumerable: true, get: function () { return Footer_1.AkitableFooter; } });
8
+ var Header_1 = require("./Header");
9
+ Object.defineProperty(exports, "AkitableHeader", { enumerable: true, get: function () { return Header_1.AkitableHeader; } });
10
+ var HeaderActions_1 = require("./HeaderActions");
11
+ Object.defineProperty(exports, "HeaderActions", { enumerable: true, get: function () { return HeaderActions_1.HeaderActions; } });
12
+ var Pagination_1 = require("./Pagination");
13
+ Object.defineProperty(exports, "AkitablePagination", { enumerable: true, get: function () { return Pagination_1.AkitablePagination; } });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,QAAQ,EAAc,MAAM,OAAO,CAAC;AAGnE,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAE/E,KAAK,KAAK,GAAG,SAAS,CAAC;AAMvB,MAAM,MAAM,4BAA4B,GAAG;IACzC,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,aAAa,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,EAAE,KAAK,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CACxC,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,4BAA4B,EAAE,UAAU,CAAC,GAAG;IAC7E,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;CACpC,CAAC;AAIF,eAAO,MAAM,uBAAuB,uDAIjC,4BAA4B,sBA8B9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,uBAU9B,CAAC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAkitableContext = exports.AkitableContextProvider = void 0;
4
+ const react_1 = require("react");
5
+ const use_immer_1 = require("use-immer");
6
+ const AkitableContext = (0, react_1.createContext)(undefined);
7
+ const AkitableContextProvider = ({ useAkitablePagination, headerActions, children }) => {
8
+ const initialState = {
9
+ selectedRows: []
10
+ };
11
+ const [state, dispatch] = (0, use_immer_1.useImmerReducer)((draft, action) => {
12
+ switch (action.type) {
13
+ case 'RESET':
14
+ return initialState;
15
+ case 'SET_SELECTED_ROWS':
16
+ draft.selectedRows = action.payload;
17
+ return;
18
+ }
19
+ }, initialState);
20
+ return (react_1.default.createElement(AkitableContext.Provider, { value: {
21
+ state,
22
+ dispatch,
23
+ useAkitablePagination,
24
+ headerActions
25
+ } }, children));
26
+ };
27
+ exports.AkitableContextProvider = AkitableContextProvider;
28
+ const useAkitableContext = () => {
29
+ const context = (0, react_1.useContext)(AkitableContext);
30
+ if (context === undefined) {
31
+ throw new Error('useAkitableContext must be used within a AkitableContextProvider');
32
+ }
33
+ return context;
34
+ };
35
+ exports.useAkitableContext = useAkitableContext;
@@ -0,0 +1,28 @@
1
+ .akitable-container {
2
+ border-radius: 10px;
3
+ width: 100%;
4
+
5
+ .row-action {
6
+ width: 40px;
7
+ height: 40px;
8
+ display: flex;
9
+ border: 1px solid rgba(0, 47, 255, 0.273);
10
+ border-radius: 7px;
11
+ align-items: center;
12
+ justify-content: center;
13
+ margin-right: 5px;
14
+
15
+ i:before {
16
+ color: rgba(34, 34, 34, 0.713);
17
+ }
18
+ }
19
+
20
+ .akinon-table-wrapper {
21
+ .akinon-table-thead > tr > th {
22
+ color: var(--color-ebonyClay-375);
23
+ font-size: 0.75rem;
24
+ font-weight: 500;
25
+ padding: 6px 28px;
26
+ }
27
+ }
28
+ }
@@ -1,3 +1,4 @@
1
+ import './index.css';
1
2
  import * as React from 'react';
2
3
  import type { AntdTableProps } from './components/AntdTable';
3
4
  import type { AnyObject, HeaderAction, UseAkitablePagination } from './types';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE9E,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,aAAa,CAAC,KAAK,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG;IAEzD,KAAK,EAAE,MAAM,CAAC;IAEd,WAAW,EAAE,MAAM,CAAC;IAEpB,qBAAqB,EAAE,qBAAqB,CAAC;IAE7C,aAAa,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;IAEtC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACrC,CAAC;AACF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,qKA4FpB,CAAC"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Akitable = void 0;
15
+ require("./index.css");
16
+ const ui_theme_1 = require("@akinon/ui-theme");
17
+ const antd_1 = require("antd");
18
+ const React = require("react");
19
+ const components_1 = require("./components");
20
+ const context_1 = require("./context");
21
+ /**
22
+ * Akitable component
23
+ * @param {AkitableProps} props
24
+ * @returns {React.ReactElement}
25
+ */
26
+ const Akitable = (_a) => {
27
+ var { useAkitablePagination, title, description, headerActions, headerMiddleBlock } = _a, restProps = __rest(_a, ["useAkitablePagination", "title", "description", "headerActions", "headerMiddleBlock"]);
28
+ return (React.createElement("div", { className: "akitable-container" },
29
+ React.createElement(antd_1.ConfigProvider, { prefixCls: "akinon", theme: {
30
+ components: {
31
+ Checkbox: {
32
+ colorBgBase: ui_theme_1.theme.colors.neutral['50'],
33
+ algorithm: antd_1.theme.defaultAlgorithm
34
+ },
35
+ Card: {
36
+ paddingLG: 0,
37
+ colorBgContainer: ui_theme_1.theme.colors.neutral['50'],
38
+ colorBgBase: ui_theme_1.theme.colors.neutral['50'],
39
+ colorTextBase: ui_theme_1.theme.colors.neutral['950'],
40
+ algorithm: antd_1.theme.defaultAlgorithm
41
+ },
42
+ Typography: {
43
+ colorTextHeading: ui_theme_1.theme.colors.neutral['950'],
44
+ colorText: ui_theme_1.theme.colors.neutral['500'],
45
+ titleMarginBottom: 0,
46
+ fontWeightStrong: 500
47
+ },
48
+ Select: {
49
+ colorText: ui_theme_1.theme.colors.neutral['950'],
50
+ selectorBg: ui_theme_1.theme.colors.neutral['50'],
51
+ colorBgElevated: ui_theme_1.theme.colors.neutral['100'],
52
+ colorBorder: ui_theme_1.theme.colors.neutral['350'],
53
+ colorTextQuaternary: ui_theme_1.theme.colors.neutral['500'],
54
+ optionSelectedBg: ui_theme_1.theme.colors.azure['100'],
55
+ algorithm: antd_1.theme.defaultAlgorithm
56
+ },
57
+ Pagination: {
58
+ colorText: ui_theme_1.theme.colors.neutral['950'],
59
+ itemInputBg: ui_theme_1.theme.colors.neutral['75'],
60
+ colorBorder: ui_theme_1.theme.colors.neutral['350'],
61
+ borderRadius: 0,
62
+ itemActiveBg: ui_theme_1.theme.colors.neutral['500'],
63
+ colorTextDisabled: ui_theme_1.theme.colors.neutral['375'],
64
+ marginXS: 0,
65
+ itemSizeSM: 38
66
+ },
67
+ Spin: {
68
+ colorBgContainer: ui_theme_1.theme.colors.neutral['50']
69
+ },
70
+ Table: {
71
+ headerBorderRadius: 0,
72
+ headerBg: ui_theme_1.theme.colors.neutral['150'],
73
+ headerColor: ui_theme_1.theme.colors.neutral['500'],
74
+ borderColor: ui_theme_1.theme.colors.neutral['350'],
75
+ fontSize: ui_theme_1.fontSize * 0.875,
76
+ colorBgContainer: ui_theme_1.theme.colors.neutral['50'],
77
+ colorText: ui_theme_1.theme.colors.neutral['500'],
78
+ cellPaddingInline: 28,
79
+ colorBgBase: ui_theme_1.theme.colors.neutral['50'],
80
+ algorithm: antd_1.theme.defaultAlgorithm
81
+ },
82
+ Button: {
83
+ colorBgBase: ui_theme_1.theme.colors.neutral['50'],
84
+ colorTextBase: ui_theme_1.theme.colors.azure['500'],
85
+ colorBorder: ui_theme_1.theme.colors.azure['500'],
86
+ borderColorDisabled: ui_theme_1.theme.colors.neutral['350'],
87
+ algorithm: antd_1.theme.defaultAlgorithm
88
+ }
89
+ }
90
+ } },
91
+ React.createElement(context_1.AkitableContextProvider, { useAkitablePagination: useAkitablePagination, headerActions: headerActions },
92
+ React.createElement(components_1.AkitableHeader, { title: title, description: description, headerMiddleBlock: headerMiddleBlock }),
93
+ React.createElement(components_1.AntdTable, Object.assign({}, restProps)),
94
+ React.createElement(components_1.AkitableFooter, null)))));
95
+ };
96
+ exports.Akitable = Akitable;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.tsx"],"names":[],"mappings":";AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,kBAAkB;IAClB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,KAAK,IAAI;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import type { TableProps } from 'antd/lib';
2
+ import React from 'react';
3
+ import { AnyObject } from '../../types';
4
+ export type AntdTableProps<IData> = Omit<TableProps<IData>, 'title' | 'description' | 'pagination' | 'bordered'>;
5
+ export declare const AntdTable: <IData extends AnyObject>({ rowSelection, ...restProps }: AntdTableProps<IData>) => React.JSX.Element;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AntdTable/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,cAAc,CAAC,KAAK,IAAI,IAAI,CACtC,UAAU,CAAC,KAAK,CAAC,EACjB,OAAO,GAAG,aAAa,GAAG,YAAY,GAAG,UAAU,CACpD,CAAC;AAEF,eAAO,MAAM,SAAS,uGA6BrB,CAAC"}
@@ -0,0 +1,29 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { Table } from '@akinon/ui-table';
13
+ import React from 'react';
14
+ import { useAkitableContext } from '../../context';
15
+ export const AntdTable = (_a) => {
16
+ var { rowSelection } = _a, restProps = __rest(_a, ["rowSelection"]);
17
+ const { dispatch } = useAkitableContext();
18
+ const customRowSelection = rowSelection && Object.assign(Object.assign({}, rowSelection), { onChange: (selectedRowKeys, selectedRows) => {
19
+ // if akitable provides rowSelection.onChange, call it
20
+ if (rowSelection.onChange) {
21
+ rowSelection.onChange(selectedRowKeys, selectedRows, { type: 'all' });
22
+ }
23
+ dispatch({
24
+ type: 'SET_SELECTED_ROWS',
25
+ payload: selectedRows
26
+ });
27
+ } });
28
+ return (React.createElement(Table, Object.assign({ bordered: true, pagination: false, rowSelection: customRowSelection }, restProps)));
29
+ };
@@ -0,0 +1,6 @@
1
+ .akitable-footer {
2
+ padding: 20px;
3
+ display: flex;
4
+ justify-content: flex-end;
5
+ align-items: center;
6
+ }