oa-componentbook 1.0.1-stage.440 → 1.0.1-stage.442
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/build/components/oa-component-document-details-panel/DocumentDetailsPanel.js +154 -0
- package/build/components/oa-component-select/CustomSelect.js +1 -1
- package/build/components/oa-component-table-with-search-and-filter/TableWithSearchAndFilter.js +432 -0
- package/build/components/oa-component-table-with-search-and-filter/styles.js +24 -0
- package/build/dev/oa-widget-document-side-drawer/DocumentSideDrawer.js +9 -5
- package/build/dev/oa-widget-document-side-drawer/styles.js +1 -1
- package/build/dev/oa-widget-document-viewer-with-details/DocumentViewerWithDetails.js +123 -0
- package/build/index.js +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _Typography = _interopRequireDefault(require("../oa-component-typography/Typography"));
|
|
11
|
+
var _CustomButton = _interopRequireDefault(require("../oa-component-button/CustomButton"));
|
|
12
|
+
var _templateObject;
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
+
/**
|
|
16
|
+
* Styled container for the details panel
|
|
17
|
+
*/
|
|
18
|
+
const PanelContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: var(--color-background, #fff);\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n\n .panel-title {\n margin: 0 0 24px 0;\n }\n\n .table-container {\n border: 1px solid var(--color-border, #e8e8e8);\n border-radius: 4px;\n overflow: hidden;\n margin-bottom: 24px;\n }\n\n .section-header {\n background: var(--color-background-secondary, #f5f5f5);\n padding: 12px 16px;\n margin: 0;\n border-bottom: 1px solid var(--color-border, #e8e8e8);\n }\n\n .details-table {\n width: 100%;\n margin: 0;\n border-collapse: collapse;\n background: var(--color-background, #fff);\n }\n\n .details-row {\n border-bottom: 1px solid var(--color-border-light, #f0f0f0);\n }\n\n .details-row:last-child {\n border-bottom: none;\n }\n\n .details-label {\n width: 140px;\n min-width: 140px;\n padding: 16px;\n padding-right: 16px;\n text-align: left;\n vertical-align: top;\n }\n\n .details-value {\n padding: 16px;\n word-break: break-word;\n font-weight: 500;\n vertical-align: top;\n }\n\n .details-actions {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n margin-top: 0;\n padding-top: 0;\n border-top: none;\n }\n\n .details-actions button {\n padding: 0;\n }\n\n .children-container {\n margin-top: 24px;\n }\n"])));
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* DocumentDetailsPanel Component
|
|
22
|
+
*
|
|
23
|
+
* A reusable panel for displaying document/invoice details with key-value pairs.
|
|
24
|
+
* Can be used standalone or as children of DocumentSideDrawer, Modal, etc.
|
|
25
|
+
* Uses existing Typography and CustomButton components.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Standalone usage
|
|
29
|
+
* <DocumentDetailsPanel
|
|
30
|
+
* title="Check if the below details are correct"
|
|
31
|
+
* sectionTitle="INVOICE DETAILS"
|
|
32
|
+
* details={[
|
|
33
|
+
* { label: 'Date', value: '17 Nov 2025' },
|
|
34
|
+
* { label: 'Invoice Number', value: 'IEXPS8790L' },
|
|
35
|
+
* ]}
|
|
36
|
+
* actions={[
|
|
37
|
+
* { label: 'Download Invoice', onClick: () => {}, icon: <MaterialIcon icon={GetAppIcon} /> },
|
|
38
|
+
* ]}
|
|
39
|
+
* />
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // With DocumentSideDrawer
|
|
43
|
+
* <DocumentSideDrawer title="VALIDATE" documentConfig={...}>
|
|
44
|
+
* <DocumentDetailsPanel
|
|
45
|
+
* title="Verify the details"
|
|
46
|
+
* details={[...]}
|
|
47
|
+
* actions={[...]}
|
|
48
|
+
* />
|
|
49
|
+
* </DocumentSideDrawer>
|
|
50
|
+
*/
|
|
51
|
+
function DocumentDetailsPanel(_ref) {
|
|
52
|
+
let {
|
|
53
|
+
title,
|
|
54
|
+
sectionTitle,
|
|
55
|
+
details,
|
|
56
|
+
actions,
|
|
57
|
+
children,
|
|
58
|
+
className,
|
|
59
|
+
style
|
|
60
|
+
} = _ref;
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(PanelContainer, {
|
|
62
|
+
className: className,
|
|
63
|
+
style: style
|
|
64
|
+
}, title && /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
+
className: "panel-title"
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
67
|
+
typography: "type-t2-700",
|
|
68
|
+
color: "primary-content"
|
|
69
|
+
}, title)), (sectionTitle || details && details.length > 0) && /*#__PURE__*/_react.default.createElement("div", {
|
|
70
|
+
className: "table-container"
|
|
71
|
+
}, sectionTitle && /*#__PURE__*/_react.default.createElement("div", {
|
|
72
|
+
className: "section-header"
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
74
|
+
typography: "type-sl1-700",
|
|
75
|
+
color: "secondary-content"
|
|
76
|
+
}, sectionTitle)), details && details.length > 0 && /*#__PURE__*/_react.default.createElement("table", {
|
|
77
|
+
className: "details-table",
|
|
78
|
+
role: "table",
|
|
79
|
+
"aria-label": sectionTitle || 'Details'
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement("tbody", null, details.map((detail, index) => {
|
|
81
|
+
const rowKey = detail.key || "detail-".concat(detail.label, "-").concat(index);
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
83
|
+
className: "details-row",
|
|
84
|
+
key: rowKey
|
|
85
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
86
|
+
className: "details-label",
|
|
87
|
+
scope: "row"
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
89
|
+
typography: "type-b2-400",
|
|
90
|
+
color: "secondary-content"
|
|
91
|
+
}, detail.label)), /*#__PURE__*/_react.default.createElement("td", {
|
|
92
|
+
className: "details-value"
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
94
|
+
typography: "type-b2-400",
|
|
95
|
+
color: "primary-content"
|
|
96
|
+
}, detail.value)));
|
|
97
|
+
})))), actions && actions.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
+
className: "details-actions",
|
|
99
|
+
role: "group",
|
|
100
|
+
"aria-label": "Document actions"
|
|
101
|
+
}, actions.map((action, index) => {
|
|
102
|
+
const actionKey = action.key || "action-".concat(action.label, "-").concat(index);
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
104
|
+
key: actionKey,
|
|
105
|
+
label: action.label,
|
|
106
|
+
onClick: action.onClick,
|
|
107
|
+
type: "text-only",
|
|
108
|
+
size: "medium",
|
|
109
|
+
"aria-label": action.ariaLabel || action.label,
|
|
110
|
+
iconConfig: {
|
|
111
|
+
icon: action.icon || null,
|
|
112
|
+
position: 'left'
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
})), children && /*#__PURE__*/_react.default.createElement("div", {
|
|
116
|
+
className: "children-container"
|
|
117
|
+
}, children));
|
|
118
|
+
}
|
|
119
|
+
DocumentDetailsPanel.propTypes = {
|
|
120
|
+
/** Title text displayed at the top of the panel */
|
|
121
|
+
title: _propTypes.default.string,
|
|
122
|
+
/** Section header text (e.g., "INVOICE DETAILS") */
|
|
123
|
+
sectionTitle: _propTypes.default.string,
|
|
124
|
+
/** Array of detail items to display as key-value pairs */
|
|
125
|
+
details: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
126
|
+
key: _propTypes.default.string,
|
|
127
|
+
label: _propTypes.default.string.isRequired,
|
|
128
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.node]).isRequired
|
|
129
|
+
})),
|
|
130
|
+
/** Array of action buttons/links to display */
|
|
131
|
+
actions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
132
|
+
key: _propTypes.default.string,
|
|
133
|
+
label: _propTypes.default.string.isRequired,
|
|
134
|
+
onClick: _propTypes.default.func,
|
|
135
|
+
icon: _propTypes.default.node,
|
|
136
|
+
ariaLabel: _propTypes.default.string
|
|
137
|
+
})),
|
|
138
|
+
/** Additional content to render below the details */
|
|
139
|
+
children: _propTypes.default.node,
|
|
140
|
+
/** Additional CSS class */
|
|
141
|
+
className: _propTypes.default.string,
|
|
142
|
+
/** Inline styles */
|
|
143
|
+
style: _propTypes.default.object
|
|
144
|
+
};
|
|
145
|
+
DocumentDetailsPanel.defaultProps = {
|
|
146
|
+
title: null,
|
|
147
|
+
sectionTitle: null,
|
|
148
|
+
details: [],
|
|
149
|
+
actions: [],
|
|
150
|
+
children: null,
|
|
151
|
+
className: '',
|
|
152
|
+
style: {}
|
|
153
|
+
};
|
|
154
|
+
var _default = exports.default = DocumentDetailsPanel;
|
|
@@ -41,7 +41,7 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
41
41
|
const {
|
|
42
42
|
Option
|
|
43
43
|
} = _antd.Select;
|
|
44
|
-
const StyledSelect = (0, _styledComponents.default)(_antd.Select)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* Hiding the last tag in case of All being selected. */\n .ant-select-selection-overflow-item.ant-select-selection-overflow-item-rest {\n display: ", ";\n }\n .ant-select-selection-item-content {\n max-width: 70px;\n }\n"])), props => props.maxTagCount === 1 ? "none" : undefined);
|
|
44
|
+
const StyledSelect = (0, _styledComponents.default)(_antd.Select)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* Hiding the last tag in case of All being selected. */\n .ant-select-selection-overflow-item.ant-select-selection-overflow-item-rest {\n display: ", ";\n }\n .ant-select-selection-item-content {\n max-width: 70px;\n }\n \n /* Fix clear icon position */\n .ant-select-clear {\n display: flex;\n align-items: center;\n justify-content: center;\n right: 32px;\n margin-top: 0;\n transform: translateY(-50%);\n top: 50%;\n }\n \n /* Ensure suffix icon (dropdown arrow) stays in correct position */\n .ant-select-arrow {\n right: 12px;\n }\n"])), props => props.maxTagCount === 1 ? "none" : undefined);
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Takes an array of values and an object mapping values to labels and returns an
|
package/build/components/oa-component-table-with-search-and-filter/TableWithSearchAndFilter.js
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.object.assign.js");
|
|
5
|
+
require("core-js/modules/es.weak-map.js");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = void 0;
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _Search = _interopRequireDefault(require("@material-ui/icons/Search"));
|
|
13
|
+
var _FilterList = _interopRequireDefault(require("@material-ui/icons/FilterList"));
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
var _CustomTable = _interopRequireDefault(require("../oa-component-table/CustomTable"));
|
|
16
|
+
var _CustomPagination = _interopRequireDefault(require("../oa-component-pagination/CustomPagination"));
|
|
17
|
+
var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
|
|
18
|
+
var _CustomDrawer = _interopRequireDefault(require("../oa-component-drawer/CustomDrawer"));
|
|
19
|
+
var _CustomButton = _interopRequireDefault(require("../oa-component-button/CustomButton"));
|
|
20
|
+
var _CustomInput = _interopRequireDefault(require("../oa-component-input/CustomInput"));
|
|
21
|
+
var _CustomSelect = _interopRequireDefault(require("../oa-component-select/CustomSelect"));
|
|
22
|
+
var _CustomRadio = _interopRequireDefault(require("../oa-component-radio/CustomRadio"));
|
|
23
|
+
var _CustomDatePicker = _interopRequireDefault(require("../oa-component-datepicker/CustomDatePicker"));
|
|
24
|
+
var _styles = require("./styles");
|
|
25
|
+
const _excluded = ["dataSource", "columns", "rowKey", "emptyText"];
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
28
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
29
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
30
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
31
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
32
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
34
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
35
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
36
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
37
|
+
/**
|
|
38
|
+
* TableWithSearchAndFilter - A complete table component with search, filters and pagination
|
|
39
|
+
*
|
|
40
|
+
* @param {Object} tableProps - Table configuration
|
|
41
|
+
* @param {Object} searchProps - Search configuration
|
|
42
|
+
* @param {Object} filterProps - Filter configuration
|
|
43
|
+
* @param {boolean} filterProps.show - Show/hide filters
|
|
44
|
+
* @param {Array} filterProps.config - Filter field configurations
|
|
45
|
+
* @param {Function} filterProps.onApply - Callback when filters are applied
|
|
46
|
+
* @param {Function} filterProps.onClear - Callback when filters are cleared
|
|
47
|
+
* @param {Function} filterProps.onChange - Callback when any filter value changes (key, value, allFilters, action)
|
|
48
|
+
* - action can be: 'search', 'select', 'clear', or 'change'
|
|
49
|
+
* @param {boolean} filterProps.loading - Global loading state for all filter selects
|
|
50
|
+
* @param {string} filterProps.buttonLabel - Custom filter button label
|
|
51
|
+
* @param {string} filterProps.drawerTitle - Custom filter drawer title
|
|
52
|
+
* @param {Object} paginationProps - Pagination configuration
|
|
53
|
+
* @param {string} className - Additional CSS class
|
|
54
|
+
*
|
|
55
|
+
* Filter Config Options:
|
|
56
|
+
* - type: 'select' - Supports `loading`, `showSearch`, `filterOption`, `disabled` properties
|
|
57
|
+
* - type: 'radio' - Radio button group
|
|
58
|
+
* - type: 'date' - Single date picker
|
|
59
|
+
* - type: 'dateRange' - Two date pickers with fields array
|
|
60
|
+
* - type: 'group' - Group of fields, each supporting `loading`, `showSearch`, `filterOption`, `disabled` (for select type)
|
|
61
|
+
*/
|
|
62
|
+
function TableWithSearchAndFilter(_ref) {
|
|
63
|
+
let {
|
|
64
|
+
tableProps = {},
|
|
65
|
+
searchProps = {},
|
|
66
|
+
filterProps = {},
|
|
67
|
+
paginationProps = {},
|
|
68
|
+
className = ''
|
|
69
|
+
} = _ref;
|
|
70
|
+
// Destructure tableProps with defaults
|
|
71
|
+
const {
|
|
72
|
+
dataSource = [],
|
|
73
|
+
columns = [],
|
|
74
|
+
rowKey = 'id',
|
|
75
|
+
emptyText = 'No data found'
|
|
76
|
+
} = tableProps,
|
|
77
|
+
restTableProps = _objectWithoutProperties(tableProps, _excluded);
|
|
78
|
+
|
|
79
|
+
// Destructure searchProps with defaults
|
|
80
|
+
const {
|
|
81
|
+
show: showSearch = true,
|
|
82
|
+
placeholder: searchPlaceholder = 'Search...',
|
|
83
|
+
onSearch
|
|
84
|
+
} = searchProps;
|
|
85
|
+
|
|
86
|
+
// Destructure filterProps with defaults
|
|
87
|
+
const {
|
|
88
|
+
show: showFilters = true,
|
|
89
|
+
config: filterConfig = [],
|
|
90
|
+
onApply: onFiltersApply,
|
|
91
|
+
onClear: onFiltersClear,
|
|
92
|
+
onChange: onFilterChange,
|
|
93
|
+
loading: filtersLoading = false,
|
|
94
|
+
buttonLabel: filterButtonLabel = 'Filters',
|
|
95
|
+
drawerTitle: filterDrawerTitle = 'FILTERS'
|
|
96
|
+
} = filterProps;
|
|
97
|
+
|
|
98
|
+
// Destructure paginationProps with defaults
|
|
99
|
+
const {
|
|
100
|
+
show: showPagination = true,
|
|
101
|
+
current = 1,
|
|
102
|
+
pageSize = 10,
|
|
103
|
+
total,
|
|
104
|
+
pageSizeOptions = [10, 20, 50, 100],
|
|
105
|
+
onChange: onPaginationChange,
|
|
106
|
+
onShowSizeChange
|
|
107
|
+
} = paginationProps;
|
|
108
|
+
|
|
109
|
+
// Constants
|
|
110
|
+
const SEARCH_INPUT_WIDTH = '350px';
|
|
111
|
+
|
|
112
|
+
// Search state
|
|
113
|
+
const [searchValue, setSearchValue] = (0, _react.useState)('');
|
|
114
|
+
|
|
115
|
+
// Filter drawer state
|
|
116
|
+
const [isFilterDrawerVisible, setIsFilterDrawerVisible] = (0, _react.useState)(false);
|
|
117
|
+
const [filterValues, setFilterValues] = (0, _react.useState)({});
|
|
118
|
+
|
|
119
|
+
// Search handlers
|
|
120
|
+
const handleSearchChange = e => {
|
|
121
|
+
const {
|
|
122
|
+
value
|
|
123
|
+
} = e.target;
|
|
124
|
+
setSearchValue(value);
|
|
125
|
+
if (onSearch) {
|
|
126
|
+
onSearch(value);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const handleSearchPressEnter = () => {
|
|
130
|
+
if (onSearch) {
|
|
131
|
+
onSearch(searchValue);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// Filter handlers
|
|
136
|
+
const handleOpenFilterDrawer = () => setIsFilterDrawerVisible(true);
|
|
137
|
+
const handleCloseFilterDrawer = () => setIsFilterDrawerVisible(false);
|
|
138
|
+
const handleFilterChange = function handleFilterChange(key, value) {
|
|
139
|
+
let action = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'change';
|
|
140
|
+
// Normalize empty values: convert empty string to null for consistency
|
|
141
|
+
const normalizedValue = value === '' ? null : value;
|
|
142
|
+
const updatedFilters = _objectSpread(_objectSpread({}, filterValues), {}, {
|
|
143
|
+
[key]: normalizedValue
|
|
144
|
+
});
|
|
145
|
+
setFilterValues(updatedFilters);
|
|
146
|
+
|
|
147
|
+
// Call onChange callback if provided for real-time filter changes
|
|
148
|
+
if (onFilterChange) {
|
|
149
|
+
onFilterChange(key, normalizedValue, updatedFilters, action);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const handleApplyFilters = () => {
|
|
153
|
+
setIsFilterDrawerVisible(false);
|
|
154
|
+
if (onFiltersApply) {
|
|
155
|
+
onFiltersApply(filterValues);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const handleClearFilters = () => {
|
|
159
|
+
setFilterValues({});
|
|
160
|
+
if (onFiltersClear) {
|
|
161
|
+
onFiltersClear();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Memoized required keys calculation for better performance
|
|
166
|
+
const requiredKeys = (0, _react.useMemo)(() => {
|
|
167
|
+
const keys = [];
|
|
168
|
+
filterConfig.forEach(filter => {
|
|
169
|
+
const {
|
|
170
|
+
type,
|
|
171
|
+
key,
|
|
172
|
+
required,
|
|
173
|
+
fields = []
|
|
174
|
+
} = filter;
|
|
175
|
+
if (required) {
|
|
176
|
+
if (type === 'dateRange' || type === 'group') {
|
|
177
|
+
fields.forEach(field => {
|
|
178
|
+
keys.push(field.key);
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
keys.push(key);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
return keys;
|
|
186
|
+
}, [filterConfig]);
|
|
187
|
+
|
|
188
|
+
// Memoized check if all required fields are filled
|
|
189
|
+
const areAllRequiredFieldsFilled = (0, _react.useMemo)(() => requiredKeys.every(requiredKey => {
|
|
190
|
+
const value = filterValues[requiredKey];
|
|
191
|
+
// Check if value exists and is not empty/null/undefined
|
|
192
|
+
return value !== undefined && value !== null && value !== '';
|
|
193
|
+
}), [requiredKeys, filterValues]);
|
|
194
|
+
|
|
195
|
+
// Helper function to determine notFoundContent message
|
|
196
|
+
const getNotFoundContent = (isApiCallInProgress, query) => {
|
|
197
|
+
if (!isApiCallInProgress && (query === null || query === void 0 ? void 0 : query.length) < 3) {
|
|
198
|
+
return 'Start Typing atleast 3 characters';
|
|
199
|
+
}
|
|
200
|
+
if (isApiCallInProgress && (query === null || query === void 0 ? void 0 : query.length) > 0) {
|
|
201
|
+
return 'Loading...';
|
|
202
|
+
}
|
|
203
|
+
return 'No data found';
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// Helper function to render CustomSelect (DRY principle)
|
|
207
|
+
const renderSelect = (fieldKey, fieldConfig) => {
|
|
208
|
+
const {
|
|
209
|
+
placeholder,
|
|
210
|
+
options = [],
|
|
211
|
+
loading = false,
|
|
212
|
+
isApiCallInProgress = false,
|
|
213
|
+
searchValue: query = '',
|
|
214
|
+
showSearch: fieldShowSearch = false,
|
|
215
|
+
filterOption,
|
|
216
|
+
disabled = false
|
|
217
|
+
} = fieldConfig;
|
|
218
|
+
const fieldValue = filterValues[fieldKey];
|
|
219
|
+
const isLoading = filtersLoading || loading || isApiCallInProgress;
|
|
220
|
+
const notFoundContent = getNotFoundContent(isApiCallInProgress, query);
|
|
221
|
+
return /*#__PURE__*/_react.default.createElement(_CustomSelect.default, {
|
|
222
|
+
placeholder: placeholder || 'Select an option',
|
|
223
|
+
value: fieldValue || undefined,
|
|
224
|
+
options: options,
|
|
225
|
+
onSelectionChange: val => {
|
|
226
|
+
// Normalize: null/undefined means clear action
|
|
227
|
+
const action = val === null || val === undefined ? 'clear' : 'select';
|
|
228
|
+
handleFilterChange(fieldKey, val, action);
|
|
229
|
+
},
|
|
230
|
+
onSearch: searchText => {
|
|
231
|
+
// For search, pass the search text as-is (don't normalize to null)
|
|
232
|
+
handleFilterChange(fieldKey, searchText || null, 'search');
|
|
233
|
+
},
|
|
234
|
+
onChange: val => {
|
|
235
|
+
// Catch clear from Ant Design's onChange (passes through {...props})
|
|
236
|
+
if (val === undefined || val === null) {
|
|
237
|
+
handleFilterChange(fieldKey, null, 'clear');
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
allowClear: true,
|
|
241
|
+
loading: isLoading,
|
|
242
|
+
showSearch: fieldShowSearch,
|
|
243
|
+
filterOption: filterOption,
|
|
244
|
+
disabled: disabled,
|
|
245
|
+
notFoundContent: notFoundContent
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// Helper function to render CustomDatePicker (DRY principle)
|
|
250
|
+
const renderDatePicker = (fieldKey, fieldConfig) => {
|
|
251
|
+
const {
|
|
252
|
+
placeholder
|
|
253
|
+
} = fieldConfig;
|
|
254
|
+
const fieldValue = filterValues[fieldKey];
|
|
255
|
+
return /*#__PURE__*/_react.default.createElement(_CustomDatePicker.default, {
|
|
256
|
+
placeholder: placeholder || 'Select date',
|
|
257
|
+
value: fieldValue,
|
|
258
|
+
onChange: date => handleFilterChange(fieldKey, date, 'change')
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// Helper function to render CustomRadio.Group (DRY principle)
|
|
263
|
+
const renderRadioGroup = (fieldKey, fieldConfig) => {
|
|
264
|
+
const {
|
|
265
|
+
options = []
|
|
266
|
+
} = fieldConfig;
|
|
267
|
+
const fieldValue = filterValues[fieldKey];
|
|
268
|
+
return /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
|
|
269
|
+
value: fieldValue,
|
|
270
|
+
onChange: e => handleFilterChange(fieldKey, e.target.value, 'change')
|
|
271
|
+
}, options.map(option => /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
|
|
272
|
+
key: option.value,
|
|
273
|
+
value: option.value,
|
|
274
|
+
label: option.label
|
|
275
|
+
})));
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// Render filter input based on type
|
|
279
|
+
const renderFilterInput = filter => {
|
|
280
|
+
const {
|
|
281
|
+
type,
|
|
282
|
+
key,
|
|
283
|
+
fields = []
|
|
284
|
+
} = filter;
|
|
285
|
+
switch (type) {
|
|
286
|
+
case 'radio':
|
|
287
|
+
return renderRadioGroup(key, filter);
|
|
288
|
+
case 'select':
|
|
289
|
+
return renderSelect(key, filter);
|
|
290
|
+
case 'date':
|
|
291
|
+
return renderDatePicker(key, filter);
|
|
292
|
+
case 'dateRange':
|
|
293
|
+
return /*#__PURE__*/_react.default.createElement(_styles.DateRangeContainer, null, fields.map(field => /*#__PURE__*/_react.default.createElement(_styles.FilterSubField, {
|
|
294
|
+
key: field.key
|
|
295
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.FilterSubLabel, null, field.label), renderDatePicker(field.key, field))));
|
|
296
|
+
case 'group':
|
|
297
|
+
return /*#__PURE__*/_react.default.createElement(_styles.FilterGroup, null, fields.map(field => /*#__PURE__*/_react.default.createElement(_styles.FilterSubField, {
|
|
298
|
+
key: field.key
|
|
299
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.FilterSubLabel, null, field.label), field.type === 'select' && renderSelect(field.key, field), field.type === 'date' && renderDatePicker(field.key, field), field.type === 'radio' && renderRadioGroup(field.key, field))));
|
|
300
|
+
default:
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const displayData = dataSource;
|
|
305
|
+
const totalRecords = total !== null && total !== void 0 ? total : displayData.length;
|
|
306
|
+
return /*#__PURE__*/_react.default.createElement(_styles.TableWithSearchAndFilterContainer, {
|
|
307
|
+
className: className
|
|
308
|
+
}, (showSearch || showFilters) && /*#__PURE__*/_react.default.createElement(_styles.Toolbar, null, showSearch && /*#__PURE__*/_react.default.createElement(_CustomInput.default, {
|
|
309
|
+
prefix: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
310
|
+
icon: _Search.default,
|
|
311
|
+
size: 20,
|
|
312
|
+
style: {
|
|
313
|
+
color: '#8c8c8c'
|
|
314
|
+
}
|
|
315
|
+
}),
|
|
316
|
+
placeholder: searchPlaceholder,
|
|
317
|
+
value: searchValue,
|
|
318
|
+
onChange: handleSearchChange,
|
|
319
|
+
onPressEnter: handleSearchPressEnter,
|
|
320
|
+
allowClear: true,
|
|
321
|
+
style: {
|
|
322
|
+
width: SEARCH_INPUT_WIDTH,
|
|
323
|
+
flexShrink: 0
|
|
324
|
+
}
|
|
325
|
+
}), showFilters && /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
326
|
+
label: filterButtonLabel,
|
|
327
|
+
onClick: handleOpenFilterDrawer,
|
|
328
|
+
type: "secondary",
|
|
329
|
+
size: "medium",
|
|
330
|
+
iconConfig: {
|
|
331
|
+
icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
332
|
+
icon: _FilterList.default
|
|
333
|
+
}),
|
|
334
|
+
position: 'left'
|
|
335
|
+
}
|
|
336
|
+
})), showFilters && /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
337
|
+
title: filterDrawerTitle,
|
|
338
|
+
placement: "right",
|
|
339
|
+
isBaseDrawer: true,
|
|
340
|
+
onClose: handleCloseFilterDrawer,
|
|
341
|
+
open: isFilterDrawerVisible,
|
|
342
|
+
visible: isFilterDrawerVisible,
|
|
343
|
+
closable: false,
|
|
344
|
+
width: 400
|
|
345
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.FilterDrawerContent, null, /*#__PURE__*/_react.default.createElement(_styles.FilterDrawerBody, null, filterConfig.length > 0 ? filterConfig.map(filter => /*#__PURE__*/_react.default.createElement(_styles.FilterSection, {
|
|
346
|
+
key: filter.key
|
|
347
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.FilterLabel, null, filter.label, filter.required && /*#__PURE__*/_react.default.createElement(_styles.RequiredMark, null, "*")), renderFilterInput(filter))) : /*#__PURE__*/_react.default.createElement(_styles.FilterSection, null, /*#__PURE__*/_react.default.createElement(_styles.FilterLabel, null, "No filters configured"))), /*#__PURE__*/_react.default.createElement(_styles.FilterDrawerFooter, null, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
348
|
+
label: "Clear All",
|
|
349
|
+
onClick: handleClearFilters,
|
|
350
|
+
type: "secondary",
|
|
351
|
+
size: "medium"
|
|
352
|
+
}), /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
353
|
+
label: "Apply Filter",
|
|
354
|
+
onClick: handleApplyFilters,
|
|
355
|
+
type: "primary",
|
|
356
|
+
size: "medium",
|
|
357
|
+
disabled: !areAllRequiredFieldsFilled
|
|
358
|
+
})))), /*#__PURE__*/_react.default.createElement(_CustomTable.default, _extends({
|
|
359
|
+
rowKey: rowKey,
|
|
360
|
+
dataSource: displayData,
|
|
361
|
+
columns: columns,
|
|
362
|
+
pagination: false,
|
|
363
|
+
emptyText: emptyText
|
|
364
|
+
}, restTableProps)), showPagination && totalRecords > pageSize && /*#__PURE__*/_react.default.createElement(_styles.PaginationContainer, null, /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
|
|
365
|
+
current: current,
|
|
366
|
+
pageSize: pageSize,
|
|
367
|
+
total: totalRecords,
|
|
368
|
+
onChange: onPaginationChange,
|
|
369
|
+
onShowSizeChange: onShowSizeChange,
|
|
370
|
+
pageSizeOptions: pageSizeOptions,
|
|
371
|
+
showSizeChanger: true,
|
|
372
|
+
showTotal: true
|
|
373
|
+
})));
|
|
374
|
+
}
|
|
375
|
+
TableWithSearchAndFilter.propTypes = {
|
|
376
|
+
tableProps: _propTypes.default.shape({
|
|
377
|
+
dataSource: _propTypes.default.array,
|
|
378
|
+
columns: _propTypes.default.array.isRequired,
|
|
379
|
+
rowKey: _propTypes.default.string,
|
|
380
|
+
emptyText: _propTypes.default.string
|
|
381
|
+
}),
|
|
382
|
+
searchProps: _propTypes.default.shape({
|
|
383
|
+
show: _propTypes.default.bool,
|
|
384
|
+
placeholder: _propTypes.default.string,
|
|
385
|
+
onSearch: _propTypes.default.func
|
|
386
|
+
}),
|
|
387
|
+
filterProps: _propTypes.default.shape({
|
|
388
|
+
show: _propTypes.default.bool,
|
|
389
|
+
config: _propTypes.default.array,
|
|
390
|
+
onApply: _propTypes.default.func,
|
|
391
|
+
onClear: _propTypes.default.func,
|
|
392
|
+
onChange: _propTypes.default.func,
|
|
393
|
+
loading: _propTypes.default.bool,
|
|
394
|
+
buttonLabel: _propTypes.default.string,
|
|
395
|
+
drawerTitle: _propTypes.default.string
|
|
396
|
+
}),
|
|
397
|
+
paginationProps: _propTypes.default.shape({
|
|
398
|
+
show: _propTypes.default.bool,
|
|
399
|
+
current: _propTypes.default.number,
|
|
400
|
+
pageSize: _propTypes.default.number,
|
|
401
|
+
total: _propTypes.default.number,
|
|
402
|
+
pageSizeOptions: _propTypes.default.array,
|
|
403
|
+
onChange: _propTypes.default.func,
|
|
404
|
+
onShowSizeChange: _propTypes.default.func
|
|
405
|
+
}),
|
|
406
|
+
className: _propTypes.default.string
|
|
407
|
+
};
|
|
408
|
+
TableWithSearchAndFilter.defaultProps = {
|
|
409
|
+
tableProps: {
|
|
410
|
+
dataSource: [],
|
|
411
|
+
rowKey: 'id',
|
|
412
|
+
emptyText: 'No data found'
|
|
413
|
+
},
|
|
414
|
+
searchProps: {
|
|
415
|
+
show: true,
|
|
416
|
+
placeholder: 'Search...'
|
|
417
|
+
},
|
|
418
|
+
filterProps: {
|
|
419
|
+
show: true,
|
|
420
|
+
config: [],
|
|
421
|
+
buttonLabel: 'Filters',
|
|
422
|
+
drawerTitle: 'FILTERS'
|
|
423
|
+
},
|
|
424
|
+
paginationProps: {
|
|
425
|
+
show: true,
|
|
426
|
+
current: 1,
|
|
427
|
+
pageSize: 10,
|
|
428
|
+
pageSizeOptions: [10, 20, 50, 100]
|
|
429
|
+
},
|
|
430
|
+
className: ''
|
|
431
|
+
};
|
|
432
|
+
var _default = exports.default = TableWithSearchAndFilter;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Toolbar = exports.TableWithSearchAndFilterContainer = exports.RequiredMark = exports.PaginationContainer = exports.FilterSubLabelText = exports.FilterSubLabel = exports.FilterSubField = exports.FilterSection = exports.FilterLabel = exports.FilterGroup = exports.FilterDrawerFooter = exports.FilterDrawerContent = exports.FilterDrawerBody = exports.DateRangeContainer = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
const TableWithSearchAndFilterContainer = exports.TableWithSearchAndFilterContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n"])));
|
|
12
|
+
const Toolbar = exports.Toolbar = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 16px;\n gap: 16px;\n\n @media screen and (max-width: 768px) {\n flex-direction: column;\n align-items: stretch;\n }\n"])));
|
|
13
|
+
const FilterSection = exports.FilterSection = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-bottom: 24px;\n"])));
|
|
14
|
+
const FilterLabel = exports.FilterLabel = _styledComponents.default.label(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n font-weight: 600;\n font-size: 14px;\n color: var(--color-primary-content, #212121);\n margin-bottom: 12px;\n"])));
|
|
15
|
+
const RequiredMark = exports.RequiredMark = _styledComponents.default.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: #ff4d4f;\n margin-left: 2px;\n font-weight: 400;\n"])));
|
|
16
|
+
const PaginationContainer = exports.PaginationContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-top: 16px;\n display: flex;\n justify-content: flex-end;\n align-items: center;\n"])));
|
|
17
|
+
const FilterDrawerContent = exports.FilterDrawerContent = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n min-height: calc(100vh - 150px);\n"])));
|
|
18
|
+
const FilterDrawerBody = exports.FilterDrawerBody = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n flex: 1;\n overflow-y: auto;\n \n /* Make radio buttons horizontal */\n .ant-radio-group {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n }\n \n /* Ensure radio wrapper is visible - override line-height: 0 */\n .ant-radio-wrapper {\n display: inline-flex !important;\n align-items: center !important;\n margin-right: 0 !important;\n line-height: 1.5 !important;\n }\n \n /* Ensure radio label text is visible */\n .ant-radio-wrapper span:not(.ant-radio) {\n line-height: 1.5 !important;\n }\n \n .ant-radio-wrapper p {\n margin: 0;\n line-height: 1.5 !important;\n }\n"])));
|
|
19
|
+
const FilterDrawerFooter = exports.FilterDrawerFooter = _styledComponents.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n gap: 12px;\n padding: 16px 0;\n border-top: 1px solid #e8e8e8;\n margin-top: auto;\n"])));
|
|
20
|
+
const FilterGroup = exports.FilterGroup = _styledComponents.default.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 16px;\n"])));
|
|
21
|
+
const FilterSubField = exports.FilterSubField = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 8px;\n"])));
|
|
22
|
+
const FilterSubLabel = exports.FilterSubLabel = _styledComponents.default.label(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n font-weight: 400;\n font-size: 14px;\n color: var(--color-primary-content, #212121);\n"])));
|
|
23
|
+
const FilterSubLabelText = exports.FilterSubLabelText = _styledComponents.default.span(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n color: var(--color-primary-content, #212121);\n"])));
|
|
24
|
+
const DateRangeContainer = exports.DateRangeContainer = _styledComponents.default.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 16px;\n"])));
|
|
@@ -19,7 +19,7 @@ var _MaterialIcon = _interopRequireDefault(require("../../components/oa-componen
|
|
|
19
19
|
var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
20
20
|
var _Check = _interopRequireDefault(require("@material-ui/icons/Check"));
|
|
21
21
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
22
|
-
const _excluded = ["title", "handleCloseDrawer", "documentConfig", "drawerWidth", "drawerButtonConfig", "drawerTagConfig", "onlyDocumentView"];
|
|
22
|
+
const _excluded = ["title", "handleCloseDrawer", "documentConfig", "drawerWidth", "drawerButtonConfig", "drawerTagConfig", "onlyDocumentView", "containerClassName"];
|
|
23
23
|
/* eslint-disable */
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -50,7 +50,8 @@ function DocumentSideDrawer(_ref) {
|
|
|
50
50
|
drawerWidth,
|
|
51
51
|
drawerButtonConfig,
|
|
52
52
|
drawerTagConfig,
|
|
53
|
-
onlyDocumentView
|
|
53
|
+
onlyDocumentView,
|
|
54
|
+
containerClassName
|
|
54
55
|
} = _ref,
|
|
55
56
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
56
57
|
// Calculate the drawer width based on documentConfig or fallback to 480
|
|
@@ -132,14 +133,16 @@ function DocumentSideDrawer(_ref) {
|
|
|
132
133
|
color: item.type === "positive" ? "positive" : "negative"
|
|
133
134
|
}), /*#__PURE__*/_react.default.createElement("p", null, item.title)))))));
|
|
134
135
|
};
|
|
135
|
-
return /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, _extends({
|
|
136
137
|
buttonConfig: drawerButtonConfig,
|
|
137
138
|
"data-test": "document-side-drawer",
|
|
138
139
|
className: "documentDrawer",
|
|
139
140
|
width: calculatedWidth,
|
|
140
141
|
onClose: handleCloseDrawer,
|
|
141
142
|
title: title
|
|
142
|
-
}, /*#__PURE__*/_react.default.createElement(_styles.default,
|
|
143
|
+
}, props), /*#__PURE__*/_react.default.createElement(_styles.default, {
|
|
144
|
+
className: containerClassName
|
|
145
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
143
146
|
className: "viewerContainer"
|
|
144
147
|
}, renderDocumentViewer(), !onlyDocumentView && /*#__PURE__*/_react.default.createElement("div", {
|
|
145
148
|
className: "rightContSection"
|
|
@@ -180,7 +183,8 @@ DocumentSideDrawer.propTypes = {
|
|
|
180
183
|
drawerWidth: _propTypes.default.string,
|
|
181
184
|
drawerButtonConfig: _propTypes.default.object,
|
|
182
185
|
drawerTagConfig: _propTypes.default.object,
|
|
183
|
-
onlyDocumentView: _propTypes.default.bool
|
|
186
|
+
onlyDocumentView: _propTypes.default.bool,
|
|
187
|
+
containerClassName: _propTypes.default.string
|
|
184
188
|
};
|
|
185
189
|
|
|
186
190
|
// Default props to provide fallback values for optional props
|
|
@@ -8,5 +8,5 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
8
8
|
var _templateObject;
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
-
const ViewerContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-tabs-nav{\n margin: 0;\n}\n .ant-tabs-top>.ant-tabs-nav::before {\n border: none;\n border-right: 1px solid #E0E0E0;\n }\n .ant-tabs-content-holder .customDocumentViewerOverlayHeader{\n bottom: 60px;\n }\n .ant-tabs-tab{\n border-radius: 0px !important;\n border: none !important;\n border-bottom: 2px solid transparent !important;\n }\n .ant-tabs-tab-active{\n border-bottom: 2px solid var(--color-primary) !important;\n }\n .viewerContainer > div {\n flex: 1;\n box-sizing: border-box;\n }\n .viewerContainer {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n }\n .rightContSection {\n display: flex;\n flex-direction: column;\n padding: 24px;\n }\n .grayBoxSec {\n border-radius: 8px;\n background: #f6f6f6;\n padding: 12px 16px;\n }\n .statusSec {\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n .statusSec button {\n margin-left: 8px;\n }\n"])));
|
|
11
|
+
const ViewerContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.ant-tabs-nav{\n margin: 0;\n}\n .ant-tabs-top>.ant-tabs-nav::before {\n border: none;\n border-right: 1px solid #E0E0E0;\n }\n .ant-tabs-content-holder .customDocumentViewerOverlayHeader{\n bottom: 60px;\n }\n .ant-tabs-tab{\n border-radius: 0px !important;\n border: none !important;\n border-bottom: 2px solid transparent !important;\n }\n .ant-tabs-tab-active{\n border-bottom: 2px solid var(--color-primary) !important;\n }\n .viewerContainer > div {\n flex: 1;\n box-sizing: border-box;\n }\n .viewerContainer {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n }\n .rightContSection {\n display: flex;\n flex-direction: column;\n padding: 24px;\n min-width: 300px;\n max-width: 450px;\n overflow-x: visible;\n }\n /* Styles specific to DocumentViewerWithDetails */\n &.documentViewerWithDetails {\n .viewerContainer > div:first-child {\n flex: 1;\n box-sizing: border-box;\n min-width: 0;\n }\n .rightContSection {\n flex: 0 0 auto;\n width: fit-content;\n min-width: auto;\n max-width: none;\n }\n }\n .grayBoxSec {\n border-radius: 8px;\n background: #f6f6f6;\n padding: 12px 16px;\n }\n .statusSec {\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n .statusSec button {\n margin-left: 8px;\n }\n"])));
|
|
12
12
|
var _default = exports.default = ViewerContainer;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _DocumentSideDrawer = _interopRequireDefault(require("../oa-widget-document-side-drawer/DocumentSideDrawer"));
|
|
11
|
+
var _DocumentDetailsPanel = _interopRequireDefault(require("../../components/oa-component-document-details-panel/DocumentDetailsPanel"));
|
|
12
|
+
const _excluded = ["title", "onClose", "drawerWidth", "fileUrl", "fileType", "documentConfig", "detailsTitle", "sectionTitle", "details", "actions", "children"];
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
|
+
/**
|
|
18
|
+
* DocumentViewerWithDetails Component
|
|
19
|
+
*
|
|
20
|
+
* A split-view component that displays a document viewer on the left
|
|
21
|
+
* and a details panel with actions on the right.
|
|
22
|
+
*
|
|
23
|
+
* Uses DocumentSideDrawer and DocumentDetailsPanel internally.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <DocumentViewerWithDetails
|
|
27
|
+
* title="VIEW DOCUMENT"
|
|
28
|
+
* fileUrl="/path/to/document.pdf"
|
|
29
|
+
* fileType="pdf"
|
|
30
|
+
* detailsTitle="Document Information"
|
|
31
|
+
* sectionTitle="DETAILS"
|
|
32
|
+
* details={[
|
|
33
|
+
* { label: 'Date', value: '17 Nov 2025' },
|
|
34
|
+
* { label: 'Document Number', value: 'DOC-12345' },
|
|
35
|
+
* ]}
|
|
36
|
+
* actions={[
|
|
37
|
+
* { label: 'Download', onClick: () => {}, icon: <DownloadIcon /> },
|
|
38
|
+
* ]}
|
|
39
|
+
* onClose={() => setIsOpen(false)}
|
|
40
|
+
* />
|
|
41
|
+
*/
|
|
42
|
+
function DocumentViewerWithDetails(_ref) {
|
|
43
|
+
let {
|
|
44
|
+
// Drawer props
|
|
45
|
+
title,
|
|
46
|
+
onClose,
|
|
47
|
+
drawerWidth,
|
|
48
|
+
// Document props
|
|
49
|
+
fileUrl,
|
|
50
|
+
fileType,
|
|
51
|
+
documentConfig,
|
|
52
|
+
// Details panel props
|
|
53
|
+
detailsTitle,
|
|
54
|
+
sectionTitle,
|
|
55
|
+
details,
|
|
56
|
+
actions,
|
|
57
|
+
// Additional children
|
|
58
|
+
children
|
|
59
|
+
} = _ref,
|
|
60
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
61
|
+
// Build document config from fileUrl or use provided documentConfig
|
|
62
|
+
const finalDocumentConfig = documentConfig || (fileUrl ? {
|
|
63
|
+
fileUrl,
|
|
64
|
+
fileType: fileType || 'pdf'
|
|
65
|
+
} : null);
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(_DocumentSideDrawer.default, _extends({
|
|
67
|
+
title: title,
|
|
68
|
+
handleCloseDrawer: onClose,
|
|
69
|
+
documentConfig: finalDocumentConfig,
|
|
70
|
+
drawerWidth: drawerWidth,
|
|
71
|
+
containerClassName: "documentViewerWithDetails"
|
|
72
|
+
}, restProps), /*#__PURE__*/_react.default.createElement(_DocumentDetailsPanel.default, {
|
|
73
|
+
title: detailsTitle,
|
|
74
|
+
sectionTitle: sectionTitle,
|
|
75
|
+
details: details,
|
|
76
|
+
actions: actions
|
|
77
|
+
}, children));
|
|
78
|
+
}
|
|
79
|
+
DocumentViewerWithDetails.propTypes = {
|
|
80
|
+
/** Drawer title displayed in the header */
|
|
81
|
+
title: _propTypes.default.string,
|
|
82
|
+
/** Callback function when drawer is closed */
|
|
83
|
+
onClose: _propTypes.default.func,
|
|
84
|
+
/** Custom drawer width (default: 1200) */
|
|
85
|
+
drawerWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
86
|
+
/** URL of the document to display */
|
|
87
|
+
fileUrl: _propTypes.default.string,
|
|
88
|
+
/** Type of document: 'pdf', 'pdfWithCarousel', or 'image' */
|
|
89
|
+
fileType: _propTypes.default.oneOf(['pdf', 'pdfWithCarousel', 'image']),
|
|
90
|
+
/** Full document config (alternative to fileUrl) */
|
|
91
|
+
documentConfig: _propTypes.default.object,
|
|
92
|
+
/** Title text for the details panel */
|
|
93
|
+
detailsTitle: _propTypes.default.string,
|
|
94
|
+
/** Section header text (e.g., "DETAILS") */
|
|
95
|
+
sectionTitle: _propTypes.default.string,
|
|
96
|
+
/** Array of detail items to display */
|
|
97
|
+
details: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
98
|
+
label: _propTypes.default.string.isRequired,
|
|
99
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired
|
|
100
|
+
})),
|
|
101
|
+
/** Array of action buttons to display */
|
|
102
|
+
actions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
103
|
+
label: _propTypes.default.string.isRequired,
|
|
104
|
+
onClick: _propTypes.default.func,
|
|
105
|
+
icon: _propTypes.default.node
|
|
106
|
+
})),
|
|
107
|
+
/** Additional content to render in the details panel */
|
|
108
|
+
children: _propTypes.default.node
|
|
109
|
+
};
|
|
110
|
+
DocumentViewerWithDetails.defaultProps = {
|
|
111
|
+
title: null,
|
|
112
|
+
onClose: () => {},
|
|
113
|
+
drawerWidth: '1200',
|
|
114
|
+
fileUrl: null,
|
|
115
|
+
fileType: null,
|
|
116
|
+
documentConfig: null,
|
|
117
|
+
detailsTitle: null,
|
|
118
|
+
sectionTitle: null,
|
|
119
|
+
details: [],
|
|
120
|
+
actions: [],
|
|
121
|
+
children: null
|
|
122
|
+
};
|
|
123
|
+
var _default = exports.default = DocumentViewerWithDetails;
|
package/build/index.js
CHANGED
|
@@ -335,6 +335,12 @@ Object.defineProperty(exports, "DocUploadWidget", {
|
|
|
335
335
|
return _DocUploadWidget.default;
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
|
+
Object.defineProperty(exports, "DocumentDetailsPanel", {
|
|
339
|
+
enumerable: true,
|
|
340
|
+
get: function get() {
|
|
341
|
+
return _DocumentDetailsPanel.default;
|
|
342
|
+
}
|
|
343
|
+
});
|
|
338
344
|
Object.defineProperty(exports, "DocumentSideDrawer", {
|
|
339
345
|
enumerable: true,
|
|
340
346
|
get: function get() {
|
|
@@ -347,6 +353,12 @@ Object.defineProperty(exports, "DocumentSideModal", {
|
|
|
347
353
|
return _DocumentSideModal.default;
|
|
348
354
|
}
|
|
349
355
|
});
|
|
356
|
+
Object.defineProperty(exports, "DocumentViewerWithDetails", {
|
|
357
|
+
enumerable: true,
|
|
358
|
+
get: function get() {
|
|
359
|
+
return _DocumentViewerWithDetails.default;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
350
362
|
Object.defineProperty(exports, "DropdownSearchInput", {
|
|
351
363
|
enumerable: true,
|
|
352
364
|
get: function get() {
|
|
@@ -575,6 +587,12 @@ Object.defineProperty(exports, "StageTimelineWidget", {
|
|
|
575
587
|
return _StageTimelineWidget.default;
|
|
576
588
|
}
|
|
577
589
|
});
|
|
590
|
+
Object.defineProperty(exports, "TableWithSearchAndFilter", {
|
|
591
|
+
enumerable: true,
|
|
592
|
+
get: function get() {
|
|
593
|
+
return _TableWithSearchAndFilter.default;
|
|
594
|
+
}
|
|
595
|
+
});
|
|
578
596
|
Object.defineProperty(exports, "TextArea", {
|
|
579
597
|
enumerable: true,
|
|
580
598
|
get: function get() {
|
|
@@ -683,6 +701,7 @@ var _CustomSelect = _interopRequireDefault(require("./components/oa-component-se
|
|
|
683
701
|
var _CustomTimePicker = _interopRequireDefault(require("./components/oa-component-timepicker/CustomTimePicker"));
|
|
684
702
|
var _CustomDatePicker = _interopRequireDefault(require("./components/oa-component-datepicker/CustomDatePicker"));
|
|
685
703
|
var _CustomTable = _interopRequireDefault(require("./components/oa-component-table/CustomTable"));
|
|
704
|
+
var _TableWithSearchAndFilter = _interopRequireDefault(require("./components/oa-component-table-with-search-and-filter/TableWithSearchAndFilter"));
|
|
686
705
|
var _CustomTabs = _interopRequireDefault(require("./components/oa-component-tabs/CustomTabs"));
|
|
687
706
|
var _CustomTag = _interopRequireDefault(require("./components/oa-component-tag/CustomTag"));
|
|
688
707
|
var _CustomTimeline = _interopRequireDefault(require("./components/oa-component-timeline/CustomTimeline"));
|
|
@@ -754,6 +773,8 @@ var _CustomUpload2 = _interopRequireDefault(require("./dev/oa-component-upload/C
|
|
|
754
773
|
var _DocumentSideDrawer = _interopRequireDefault(require("./dev/oa-widget-document-side-drawer/DocumentSideDrawer"));
|
|
755
774
|
var _CustomDocumentViewer = _interopRequireDefault(require("./dev/oa-component-document-viewer/CustomDocumentViewer"));
|
|
756
775
|
var _DocumentSideModal = _interopRequireDefault(require("./dev/oa-widget-document-modal/DocumentSideModal"));
|
|
776
|
+
var _DocumentDetailsPanel = _interopRequireDefault(require("./components/oa-component-document-details-panel/DocumentDetailsPanel"));
|
|
777
|
+
var _DocumentViewerWithDetails = _interopRequireDefault(require("./dev/oa-widget-document-viewer-with-details/DocumentViewerWithDetails"));
|
|
757
778
|
var _PaymentAndConsent = _interopRequireDefault(require("./layout/paymentAndConsent/PaymentAndConsent"));
|
|
758
779
|
var _GenricLayOut = _interopRequireDefault(require("./layout/GenricLayOut/GenricLayOut"));
|
|
759
780
|
var _EntityOverviewLayout = _interopRequireDefault(require("./layout/EntityOverviewLayout/EntityOverviewLayout"));
|