oa-componentbook 1.0.1-stage.440 → 1.0.1-stage.441
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 +139 -0
- package/build/components/oa-component-select/CustomSelect.js +1 -1
- package/build/components/oa-component-table-with-search-and-filter/TableWithSearchAndFilter.js +450 -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 +2 -2
- package/build/dev/oa-widget-document-side-drawer/styles.js +1 -1
- package/build/dev/oa-widget-document-viewer-with-details/DocumentViewerWithDetails.js +122 -0
- package/build/index.js +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
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: #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 .section-header {\n background: var(--color-tertiary-background, #f5f5f5);\n padding: 12px 16px;\n }\n\n .details-table {\n width: 100%;\n }\n\n .details-row {\n display: flex;\n border-bottom: 1px solid var(--color-border, #f0f0f0);\n padding: 16px 0;\n }\n\n .details-label {\n width: 140px;\n min-width: 100px;\n flex-shrink: 0;\n }\n\n .details-value {\n flex: 1;\n word-break: break-word;\n font-weight: 500;\n }\n\n .details-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 16px;\n margin-top: 24px;\n padding-top: 24px;\n border-top: 1px solid var(--color-border, #e8e8e8);\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 && /*#__PURE__*/_react.default.createElement("div", {
|
|
70
|
+
className: "section-header"
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
72
|
+
typography: "type-sl1-700",
|
|
73
|
+
color: "secondary-content"
|
|
74
|
+
}, sectionTitle)), details && details.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
+
className: "details-table"
|
|
76
|
+
}, details.map((detail, index) => /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
+
className: "details-row",
|
|
78
|
+
key: detail.key || index
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
+
className: "details-label"
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
82
|
+
typography: "type-b2-400",
|
|
83
|
+
color: "secondary-content"
|
|
84
|
+
}, detail.label)), /*#__PURE__*/_react.default.createElement("div", {
|
|
85
|
+
className: "details-value"
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
87
|
+
typography: "type-b2-400",
|
|
88
|
+
color: "primary-content"
|
|
89
|
+
}, detail.value))))), actions && actions.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
className: "details-actions"
|
|
91
|
+
}, actions.map((action, index) => /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
92
|
+
key: action.key || index,
|
|
93
|
+
label: action.label,
|
|
94
|
+
onClick: action.onClick,
|
|
95
|
+
type: "text-only",
|
|
96
|
+
size: "medium",
|
|
97
|
+
iconConfig: {
|
|
98
|
+
icon: action.icon || null,
|
|
99
|
+
position: 'left'
|
|
100
|
+
}
|
|
101
|
+
}))), children && /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: "children-container"
|
|
103
|
+
}, children));
|
|
104
|
+
}
|
|
105
|
+
DocumentDetailsPanel.propTypes = {
|
|
106
|
+
/** Title text displayed at the top of the panel */
|
|
107
|
+
title: _propTypes.default.string,
|
|
108
|
+
/** Section header text (e.g., "INVOICE DETAILS") */
|
|
109
|
+
sectionTitle: _propTypes.default.string,
|
|
110
|
+
/** Array of detail items to display as key-value pairs */
|
|
111
|
+
details: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
112
|
+
key: _propTypes.default.string,
|
|
113
|
+
label: _propTypes.default.string.isRequired,
|
|
114
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.node]).isRequired
|
|
115
|
+
})),
|
|
116
|
+
/** Array of action buttons/links to display */
|
|
117
|
+
actions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
118
|
+
key: _propTypes.default.string,
|
|
119
|
+
label: _propTypes.default.string.isRequired,
|
|
120
|
+
onClick: _propTypes.default.func,
|
|
121
|
+
icon: _propTypes.default.node
|
|
122
|
+
})),
|
|
123
|
+
/** Additional content to render below the details */
|
|
124
|
+
children: _propTypes.default.node,
|
|
125
|
+
/** Additional CSS class */
|
|
126
|
+
className: _propTypes.default.string,
|
|
127
|
+
/** Inline styles */
|
|
128
|
+
style: _propTypes.default.object
|
|
129
|
+
};
|
|
130
|
+
DocumentDetailsPanel.defaultProps = {
|
|
131
|
+
title: null,
|
|
132
|
+
sectionTitle: null,
|
|
133
|
+
details: [],
|
|
134
|
+
actions: [],
|
|
135
|
+
children: null,
|
|
136
|
+
className: '',
|
|
137
|
+
style: {}
|
|
138
|
+
};
|
|
139
|
+
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,450 @@
|
|
|
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
|
+
require("core-js/modules/es.array.includes.js");
|
|
12
|
+
require("core-js/modules/es.string.includes.js");
|
|
13
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _Search = _interopRequireDefault(require("@material-ui/icons/Search"));
|
|
16
|
+
var _FilterList = _interopRequireDefault(require("@material-ui/icons/FilterList"));
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
var _CustomTable = _interopRequireDefault(require("../oa-component-table/CustomTable"));
|
|
19
|
+
var _CustomPagination = _interopRequireDefault(require("../oa-component-pagination/CustomPagination"));
|
|
20
|
+
var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
|
|
21
|
+
var _CustomDrawer = _interopRequireDefault(require("../oa-component-drawer/CustomDrawer"));
|
|
22
|
+
var _CustomButton = _interopRequireDefault(require("../oa-component-button/CustomButton"));
|
|
23
|
+
var _CustomInput = _interopRequireDefault(require("../oa-component-input/CustomInput"));
|
|
24
|
+
var _CustomSelect = _interopRequireDefault(require("../oa-component-select/CustomSelect"));
|
|
25
|
+
var _CustomRadio = _interopRequireDefault(require("../oa-component-radio/CustomRadio"));
|
|
26
|
+
var _CustomDatePicker = _interopRequireDefault(require("../oa-component-datepicker/CustomDatePicker"));
|
|
27
|
+
var _styles = require("./styles");
|
|
28
|
+
const _excluded = ["dataSource", "columns", "rowKey", "emptyText"];
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
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); }
|
|
31
|
+
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; }
|
|
32
|
+
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); }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
35
|
+
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; }
|
|
36
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
37
|
+
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); }
|
|
38
|
+
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; }
|
|
39
|
+
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; }
|
|
40
|
+
/**
|
|
41
|
+
* TableWithSearchAndFilter - A complete table component with search, filters and pagination
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} tableProps - Table configuration
|
|
44
|
+
* @param {Object} searchProps - Search configuration
|
|
45
|
+
* @param {Object} filterProps - Filter configuration
|
|
46
|
+
* @param {boolean} filterProps.show - Show/hide filters
|
|
47
|
+
* @param {Array} filterProps.config - Filter field configurations
|
|
48
|
+
* @param {Function} filterProps.onApply - Callback when filters are applied
|
|
49
|
+
* @param {Function} filterProps.onClear - Callback when filters are cleared
|
|
50
|
+
* @param {Function} filterProps.onChange - Callback when any filter value changes (key, value, allFilters, action)
|
|
51
|
+
* - action can be: 'search', 'select', 'clear', or 'change'
|
|
52
|
+
* @param {boolean} filterProps.loading - Global loading state for all filter selects
|
|
53
|
+
* @param {string} filterProps.buttonLabel - Custom filter button label
|
|
54
|
+
* @param {string} filterProps.drawerTitle - Custom filter drawer title
|
|
55
|
+
* @param {Object} paginationProps - Pagination configuration
|
|
56
|
+
* @param {string} className - Additional CSS class
|
|
57
|
+
*
|
|
58
|
+
* Filter Config Options:
|
|
59
|
+
* - type: 'select' - Supports `loading`, `showSearch`, `filterOption`, `disabled` properties
|
|
60
|
+
* - type: 'radio' - Radio button group
|
|
61
|
+
* - type: 'date' - Single date picker
|
|
62
|
+
* - type: 'dateRange' - Two date pickers with fields array
|
|
63
|
+
* - type: 'group' - Group of fields, each supporting `loading`, `showSearch`, `filterOption`, `disabled` (for select type)
|
|
64
|
+
*/
|
|
65
|
+
function TableWithSearchAndFilter(_ref) {
|
|
66
|
+
let {
|
|
67
|
+
tableProps = {},
|
|
68
|
+
searchProps = {},
|
|
69
|
+
filterProps = {},
|
|
70
|
+
paginationProps = {},
|
|
71
|
+
className = ''
|
|
72
|
+
} = _ref;
|
|
73
|
+
// Destructure tableProps with defaults
|
|
74
|
+
const {
|
|
75
|
+
dataSource = [],
|
|
76
|
+
columns = [],
|
|
77
|
+
rowKey = 'id',
|
|
78
|
+
emptyText = 'No data found'
|
|
79
|
+
} = tableProps,
|
|
80
|
+
restTableProps = _objectWithoutProperties(tableProps, _excluded);
|
|
81
|
+
|
|
82
|
+
// Destructure searchProps with defaults
|
|
83
|
+
const {
|
|
84
|
+
show: showSearch = true,
|
|
85
|
+
placeholder: searchPlaceholder = 'Search...',
|
|
86
|
+
debounceDelay = 500,
|
|
87
|
+
searchKeys = [],
|
|
88
|
+
onSearch
|
|
89
|
+
} = searchProps;
|
|
90
|
+
|
|
91
|
+
// Destructure filterProps with defaults
|
|
92
|
+
const {
|
|
93
|
+
show: showFilters = true,
|
|
94
|
+
config: filterConfig = [],
|
|
95
|
+
onApply: onFiltersApply,
|
|
96
|
+
onClear: onFiltersClear,
|
|
97
|
+
onChange: onFilterChange,
|
|
98
|
+
loading: filtersLoading = false,
|
|
99
|
+
buttonLabel: filterButtonLabel = 'Filters',
|
|
100
|
+
drawerTitle: filterDrawerTitle = 'FILTERS'
|
|
101
|
+
} = filterProps;
|
|
102
|
+
|
|
103
|
+
// Destructure paginationProps with defaults
|
|
104
|
+
const {
|
|
105
|
+
show: showPagination = true,
|
|
106
|
+
current = 1,
|
|
107
|
+
pageSize = 10,
|
|
108
|
+
total,
|
|
109
|
+
pageSizeOptions = [10, 20, 50, 100],
|
|
110
|
+
onChange: onPaginationChange,
|
|
111
|
+
onShowSizeChange
|
|
112
|
+
} = paginationProps;
|
|
113
|
+
|
|
114
|
+
// Search state
|
|
115
|
+
const [searchValue, setSearchValue] = (0, _react.useState)('');
|
|
116
|
+
const [filteredData, setFilteredData] = (0, _react.useState)(dataSource);
|
|
117
|
+
const timerRef = (0, _react.useRef)(null);
|
|
118
|
+
|
|
119
|
+
// Filter drawer state
|
|
120
|
+
const [isFilterDrawerVisible, setIsFilterDrawerVisible] = (0, _react.useState)(false);
|
|
121
|
+
const [filterValues, setFilterValues] = (0, _react.useState)({});
|
|
122
|
+
const [appliedFilters, setAppliedFilters] = (0, _react.useState)({});
|
|
123
|
+
|
|
124
|
+
// Client-side filtering function
|
|
125
|
+
const applyFiltersAndSearch = (data, search, filters) => {
|
|
126
|
+
let result = [...data];
|
|
127
|
+
if (search && searchKeys.length > 0) {
|
|
128
|
+
const searchLower = search.toLowerCase();
|
|
129
|
+
result = result.filter(item => searchKeys.some(key => {
|
|
130
|
+
var _item$key;
|
|
131
|
+
return (_item$key = item[key]) === null || _item$key === void 0 ? void 0 : _item$key.toString().toLowerCase().includes(searchLower);
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
Object.entries(filters).forEach(_ref2 => {
|
|
135
|
+
let [key, value] = _ref2;
|
|
136
|
+
if (value) {
|
|
137
|
+
result = result.filter(item => {
|
|
138
|
+
var _item$key2;
|
|
139
|
+
return ((_item$key2 = item[key]) === null || _item$key2 === void 0 ? void 0 : _item$key2.toString().toLowerCase()) === value.toString().toLowerCase();
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
setFilteredData(result);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// Sync filtered data when dataSource changes
|
|
147
|
+
(0, _react.useEffect)(() => {
|
|
148
|
+
applyFiltersAndSearch(dataSource, searchValue, appliedFilters);
|
|
149
|
+
}, [dataSource]);
|
|
150
|
+
|
|
151
|
+
// Search handlers
|
|
152
|
+
const handleSearchChange = e => {
|
|
153
|
+
const {
|
|
154
|
+
value
|
|
155
|
+
} = e.target;
|
|
156
|
+
setSearchValue(value);
|
|
157
|
+
if (timerRef.current) {
|
|
158
|
+
clearTimeout(timerRef.current);
|
|
159
|
+
}
|
|
160
|
+
if (debounceDelay === 0) {
|
|
161
|
+
if (onSearch) {
|
|
162
|
+
onSearch(value);
|
|
163
|
+
} else {
|
|
164
|
+
applyFiltersAndSearch(dataSource, value, appliedFilters);
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
timerRef.current = setTimeout(() => {
|
|
169
|
+
if (onSearch) {
|
|
170
|
+
onSearch(value);
|
|
171
|
+
} else {
|
|
172
|
+
applyFiltersAndSearch(dataSource, value, appliedFilters);
|
|
173
|
+
}
|
|
174
|
+
}, debounceDelay);
|
|
175
|
+
};
|
|
176
|
+
const handleSearchPressEnter = () => {
|
|
177
|
+
if (timerRef.current) {
|
|
178
|
+
clearTimeout(timerRef.current);
|
|
179
|
+
}
|
|
180
|
+
if (onSearch) {
|
|
181
|
+
onSearch(searchValue);
|
|
182
|
+
} else {
|
|
183
|
+
applyFiltersAndSearch(dataSource, searchValue, appliedFilters);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
(0, _react.useEffect)(() => () => {
|
|
187
|
+
if (timerRef.current) {
|
|
188
|
+
clearTimeout(timerRef.current);
|
|
189
|
+
}
|
|
190
|
+
}, []);
|
|
191
|
+
|
|
192
|
+
// Filter handlers
|
|
193
|
+
const handleOpenFilterDrawer = () => setIsFilterDrawerVisible(true);
|
|
194
|
+
const handleCloseFilterDrawer = () => setIsFilterDrawerVisible(false);
|
|
195
|
+
const handleFilterChange = function handleFilterChange(key, value) {
|
|
196
|
+
let action = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'change';
|
|
197
|
+
const updatedFilters = _objectSpread(_objectSpread({}, filterValues), {}, {
|
|
198
|
+
[key]: value
|
|
199
|
+
});
|
|
200
|
+
setFilterValues(updatedFilters);
|
|
201
|
+
|
|
202
|
+
// Call onChange callback if provided for real-time filter changes
|
|
203
|
+
if (onFilterChange) {
|
|
204
|
+
onFilterChange(key, value, updatedFilters, action);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const handleApplyFilters = () => {
|
|
208
|
+
setAppliedFilters(_objectSpread({}, filterValues));
|
|
209
|
+
setIsFilterDrawerVisible(false);
|
|
210
|
+
if (onFiltersApply) {
|
|
211
|
+
onFiltersApply(filterValues);
|
|
212
|
+
} else {
|
|
213
|
+
applyFiltersAndSearch(dataSource, searchValue, filterValues);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const handleClearFilters = () => {
|
|
217
|
+
setFilterValues({});
|
|
218
|
+
setAppliedFilters({});
|
|
219
|
+
if (onFiltersClear) {
|
|
220
|
+
onFiltersClear();
|
|
221
|
+
} else {
|
|
222
|
+
applyFiltersAndSearch(dataSource, searchValue, {});
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// Helper function to render CustomSelect (DRY principle)
|
|
227
|
+
const renderSelect = (fieldKey, fieldConfig) => {
|
|
228
|
+
const {
|
|
229
|
+
placeholder,
|
|
230
|
+
options = [],
|
|
231
|
+
loading = false,
|
|
232
|
+
isApiCallInProgress = false,
|
|
233
|
+
showSearch: fieldShowSearch = false,
|
|
234
|
+
filterOption,
|
|
235
|
+
disabled = false
|
|
236
|
+
} = fieldConfig;
|
|
237
|
+
const fieldValue = filterValues[fieldKey];
|
|
238
|
+
const isLoading = filtersLoading || loading || isApiCallInProgress;
|
|
239
|
+
return /*#__PURE__*/_react.default.createElement(_CustomSelect.default, {
|
|
240
|
+
placeholder: placeholder || 'Select an option',
|
|
241
|
+
value: fieldValue || undefined,
|
|
242
|
+
options: options,
|
|
243
|
+
onSelectionChange: val => {
|
|
244
|
+
// If val is null/undefined, it's a clear action
|
|
245
|
+
const action = val === null || val === undefined ? 'clear' : 'select';
|
|
246
|
+
handleFilterChange(fieldKey, val, action);
|
|
247
|
+
},
|
|
248
|
+
onSearch: searchText => handleFilterChange(fieldKey, searchText, 'search'),
|
|
249
|
+
onChange: val => {
|
|
250
|
+
// Catch clear from Ant Design's onChange (passes through {...props})
|
|
251
|
+
if (val === undefined || val === null) {
|
|
252
|
+
handleFilterChange(fieldKey, null, 'clear');
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
allowClear: true,
|
|
256
|
+
loading: isLoading,
|
|
257
|
+
showSearch: fieldShowSearch,
|
|
258
|
+
filterOption: filterOption,
|
|
259
|
+
disabled: disabled
|
|
260
|
+
// notFoundContent={(!isApiCallInProgress && query?.length < 3) ? "Start Typing atleast 3 characters" : (isApiCallInProgress && query?.length > 0) ? "Loading..." : "No data found"}
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// Helper function to render CustomDatePicker (DRY principle)
|
|
265
|
+
const renderDatePicker = (fieldKey, fieldConfig) => {
|
|
266
|
+
const {
|
|
267
|
+
placeholder
|
|
268
|
+
} = fieldConfig;
|
|
269
|
+
const fieldValue = filterValues[fieldKey];
|
|
270
|
+
return /*#__PURE__*/_react.default.createElement(_CustomDatePicker.default, {
|
|
271
|
+
placeholder: placeholder || 'Select date',
|
|
272
|
+
value: fieldValue,
|
|
273
|
+
onChange: date => handleFilterChange(fieldKey, date, 'change')
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// Helper function to render CustomRadio.Group (DRY principle)
|
|
278
|
+
const renderRadioGroup = (fieldKey, fieldConfig) => {
|
|
279
|
+
const {
|
|
280
|
+
options = []
|
|
281
|
+
} = fieldConfig;
|
|
282
|
+
const fieldValue = filterValues[fieldKey];
|
|
283
|
+
return /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
|
|
284
|
+
value: fieldValue,
|
|
285
|
+
onChange: e => handleFilterChange(fieldKey, e.target.value, 'change')
|
|
286
|
+
}, options.map(option => /*#__PURE__*/_react.default.createElement(_CustomRadio.default, {
|
|
287
|
+
key: option.value,
|
|
288
|
+
value: option.value,
|
|
289
|
+
label: option.label
|
|
290
|
+
})));
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// Render filter input based on type
|
|
294
|
+
const renderFilterInput = filter => {
|
|
295
|
+
const {
|
|
296
|
+
type,
|
|
297
|
+
key,
|
|
298
|
+
fields = []
|
|
299
|
+
} = filter;
|
|
300
|
+
switch (type) {
|
|
301
|
+
case 'radio':
|
|
302
|
+
return renderRadioGroup(key, filter);
|
|
303
|
+
case 'select':
|
|
304
|
+
return renderSelect(key, filter);
|
|
305
|
+
case 'date':
|
|
306
|
+
return renderDatePicker(key, filter);
|
|
307
|
+
case 'dateRange':
|
|
308
|
+
return /*#__PURE__*/_react.default.createElement(_styles.DateRangeContainer, null, fields.map(field => /*#__PURE__*/_react.default.createElement(_styles.FilterSubField, {
|
|
309
|
+
key: field.key
|
|
310
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.FilterSubLabel, null, field.label, field.required && /*#__PURE__*/_react.default.createElement(_styles.RequiredMark, null, "*")), renderDatePicker(field.key, field))));
|
|
311
|
+
case 'group':
|
|
312
|
+
return /*#__PURE__*/_react.default.createElement(_styles.FilterGroup, null, fields.map(field => /*#__PURE__*/_react.default.createElement(_styles.FilterSubField, {
|
|
313
|
+
key: field.key
|
|
314
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.FilterSubLabel, null, field.label, field.required && /*#__PURE__*/_react.default.createElement(_styles.RequiredMark, null, "*")), field.type === 'select' && renderSelect(field.key, field), field.type === 'date' && renderDatePicker(field.key, field), field.type === 'radio' && renderRadioGroup(field.key, field))));
|
|
315
|
+
default:
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
const displayData = onSearch || onFiltersApply ? dataSource : filteredData;
|
|
320
|
+
const totalRecords = total !== null && total !== void 0 ? total : displayData.length;
|
|
321
|
+
return /*#__PURE__*/_react.default.createElement(_styles.TableWithSearchAndFilterContainer, {
|
|
322
|
+
className: className
|
|
323
|
+
}, (showSearch || showFilters) && /*#__PURE__*/_react.default.createElement(_styles.Toolbar, null, showSearch && /*#__PURE__*/_react.default.createElement(_CustomInput.default, {
|
|
324
|
+
prefix: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
325
|
+
icon: _Search.default,
|
|
326
|
+
size: 20,
|
|
327
|
+
style: {
|
|
328
|
+
color: '#8c8c8c'
|
|
329
|
+
}
|
|
330
|
+
}),
|
|
331
|
+
placeholder: searchPlaceholder,
|
|
332
|
+
value: searchValue,
|
|
333
|
+
onChange: handleSearchChange,
|
|
334
|
+
onPressEnter: handleSearchPressEnter,
|
|
335
|
+
allowClear: true,
|
|
336
|
+
style: {
|
|
337
|
+
width: '350px',
|
|
338
|
+
flexShrink: 0
|
|
339
|
+
}
|
|
340
|
+
}), showFilters && /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
341
|
+
label: filterButtonLabel,
|
|
342
|
+
onClick: handleOpenFilterDrawer,
|
|
343
|
+
type: "secondary",
|
|
344
|
+
size: "medium",
|
|
345
|
+
iconConfig: {
|
|
346
|
+
icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
347
|
+
icon: _FilterList.default
|
|
348
|
+
}),
|
|
349
|
+
position: 'left'
|
|
350
|
+
}
|
|
351
|
+
})), showFilters && /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
352
|
+
title: filterDrawerTitle,
|
|
353
|
+
placement: "right",
|
|
354
|
+
isBaseDrawer: true,
|
|
355
|
+
onClose: handleCloseFilterDrawer,
|
|
356
|
+
open: isFilterDrawerVisible,
|
|
357
|
+
visible: isFilterDrawerVisible,
|
|
358
|
+
closable: false,
|
|
359
|
+
width: 400
|
|
360
|
+
}, /*#__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, {
|
|
361
|
+
key: filter.key
|
|
362
|
+
}, /*#__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, {
|
|
363
|
+
label: "Clear All",
|
|
364
|
+
onClick: handleClearFilters,
|
|
365
|
+
type: "secondary",
|
|
366
|
+
size: "medium"
|
|
367
|
+
}), /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
368
|
+
label: "Apply Filter",
|
|
369
|
+
onClick: handleApplyFilters,
|
|
370
|
+
type: "primary",
|
|
371
|
+
size: "medium"
|
|
372
|
+
})))), /*#__PURE__*/_react.default.createElement(_CustomTable.default, _extends({
|
|
373
|
+
rowKey: rowKey,
|
|
374
|
+
dataSource: displayData,
|
|
375
|
+
columns: columns,
|
|
376
|
+
pagination: false,
|
|
377
|
+
emptyText: emptyText
|
|
378
|
+
}, restTableProps)), showPagination && totalRecords > pageSize && /*#__PURE__*/_react.default.createElement(_styles.PaginationContainer, null, /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
|
|
379
|
+
current: current,
|
|
380
|
+
pageSize: pageSize,
|
|
381
|
+
total: totalRecords,
|
|
382
|
+
onChange: onPaginationChange,
|
|
383
|
+
onShowSizeChange: onShowSizeChange,
|
|
384
|
+
pageSizeOptions: pageSizeOptions,
|
|
385
|
+
showSizeChanger: true,
|
|
386
|
+
showTotal: true
|
|
387
|
+
})));
|
|
388
|
+
}
|
|
389
|
+
TableWithSearchAndFilter.propTypes = {
|
|
390
|
+
tableProps: _propTypes.default.shape({
|
|
391
|
+
dataSource: _propTypes.default.array,
|
|
392
|
+
columns: _propTypes.default.array.isRequired,
|
|
393
|
+
rowKey: _propTypes.default.string,
|
|
394
|
+
emptyText: _propTypes.default.string
|
|
395
|
+
}),
|
|
396
|
+
searchProps: _propTypes.default.shape({
|
|
397
|
+
show: _propTypes.default.bool,
|
|
398
|
+
placeholder: _propTypes.default.string,
|
|
399
|
+
debounceDelay: _propTypes.default.number,
|
|
400
|
+
searchKeys: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
401
|
+
onSearch: _propTypes.default.func
|
|
402
|
+
}),
|
|
403
|
+
filterProps: _propTypes.default.shape({
|
|
404
|
+
show: _propTypes.default.bool,
|
|
405
|
+
config: _propTypes.default.array,
|
|
406
|
+
onApply: _propTypes.default.func,
|
|
407
|
+
onClear: _propTypes.default.func,
|
|
408
|
+
onChange: _propTypes.default.func,
|
|
409
|
+
loading: _propTypes.default.bool,
|
|
410
|
+
buttonLabel: _propTypes.default.string,
|
|
411
|
+
drawerTitle: _propTypes.default.string
|
|
412
|
+
}),
|
|
413
|
+
paginationProps: _propTypes.default.shape({
|
|
414
|
+
show: _propTypes.default.bool,
|
|
415
|
+
current: _propTypes.default.number,
|
|
416
|
+
pageSize: _propTypes.default.number,
|
|
417
|
+
total: _propTypes.default.number,
|
|
418
|
+
pageSizeOptions: _propTypes.default.array,
|
|
419
|
+
onChange: _propTypes.default.func,
|
|
420
|
+
onShowSizeChange: _propTypes.default.func
|
|
421
|
+
}),
|
|
422
|
+
className: _propTypes.default.string
|
|
423
|
+
};
|
|
424
|
+
TableWithSearchAndFilter.defaultProps = {
|
|
425
|
+
tableProps: {
|
|
426
|
+
dataSource: [],
|
|
427
|
+
rowKey: 'id',
|
|
428
|
+
emptyText: 'No data found'
|
|
429
|
+
},
|
|
430
|
+
searchProps: {
|
|
431
|
+
show: true,
|
|
432
|
+
placeholder: 'Search...',
|
|
433
|
+
debounceDelay: 500,
|
|
434
|
+
searchKeys: []
|
|
435
|
+
},
|
|
436
|
+
filterProps: {
|
|
437
|
+
show: true,
|
|
438
|
+
config: [],
|
|
439
|
+
buttonLabel: 'Filters',
|
|
440
|
+
drawerTitle: 'FILTERS'
|
|
441
|
+
},
|
|
442
|
+
paginationProps: {
|
|
443
|
+
show: true,
|
|
444
|
+
current: 1,
|
|
445
|
+
pageSize: 10,
|
|
446
|
+
pageSizeOptions: [10, 20, 50, 100]
|
|
447
|
+
},
|
|
448
|
+
className: ''
|
|
449
|
+
};
|
|
450
|
+
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"])));
|
|
@@ -132,14 +132,14 @@ function DocumentSideDrawer(_ref) {
|
|
|
132
132
|
color: item.type === "positive" ? "positive" : "negative"
|
|
133
133
|
}), /*#__PURE__*/_react.default.createElement("p", null, item.title)))))));
|
|
134
134
|
};
|
|
135
|
-
return /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
135
|
+
return /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, _extends({
|
|
136
136
|
buttonConfig: drawerButtonConfig,
|
|
137
137
|
"data-test": "document-side-drawer",
|
|
138
138
|
className: "documentDrawer",
|
|
139
139
|
width: calculatedWidth,
|
|
140
140
|
onClose: handleCloseDrawer,
|
|
141
141
|
title: title
|
|
142
|
-
}, /*#__PURE__*/_react.default.createElement(_styles.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
142
|
+
}, props), /*#__PURE__*/_react.default.createElement(_styles.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
143
143
|
className: "viewerContainer"
|
|
144
144
|
}, renderDocumentViewer(), !onlyDocumentView && /*#__PURE__*/_react.default.createElement("div", {
|
|
145
145
|
className: "rightContSection"
|
|
@@ -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 .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,122 @@
|
|
|
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
|
+
/* eslint-disable */
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
/**
|
|
19
|
+
* DocumentViewerWithDetails Component
|
|
20
|
+
*
|
|
21
|
+
* A split-view component that displays a document viewer on the left
|
|
22
|
+
* and a details panel with actions on the right.
|
|
23
|
+
*
|
|
24
|
+
* Uses DocumentSideDrawer and DocumentDetailsPanel internally.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <DocumentViewerWithDetails
|
|
28
|
+
* title="VIEW DOCUMENT"
|
|
29
|
+
* fileUrl="/path/to/document.pdf"
|
|
30
|
+
* fileType="pdf"
|
|
31
|
+
* detailsTitle="Document Information"
|
|
32
|
+
* sectionTitle="DETAILS"
|
|
33
|
+
* details={[
|
|
34
|
+
* { label: 'Date', value: '17 Nov 2025' },
|
|
35
|
+
* { label: 'Document Number', value: 'DOC-12345' },
|
|
36
|
+
* ]}
|
|
37
|
+
* actions={[
|
|
38
|
+
* { label: 'Download', onClick: () => {}, icon: <DownloadIcon /> },
|
|
39
|
+
* ]}
|
|
40
|
+
* onClose={() => setIsOpen(false)}
|
|
41
|
+
* />
|
|
42
|
+
*/
|
|
43
|
+
function DocumentViewerWithDetails(_ref) {
|
|
44
|
+
let {
|
|
45
|
+
// Drawer props
|
|
46
|
+
title,
|
|
47
|
+
onClose,
|
|
48
|
+
drawerWidth,
|
|
49
|
+
// Document props
|
|
50
|
+
fileUrl,
|
|
51
|
+
fileType,
|
|
52
|
+
documentConfig,
|
|
53
|
+
// Details panel props
|
|
54
|
+
detailsTitle,
|
|
55
|
+
sectionTitle,
|
|
56
|
+
details,
|
|
57
|
+
actions,
|
|
58
|
+
// Additional children
|
|
59
|
+
children
|
|
60
|
+
} = _ref,
|
|
61
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
62
|
+
// Build document config from fileUrl or use provided documentConfig
|
|
63
|
+
const finalDocumentConfig = documentConfig || (fileUrl ? {
|
|
64
|
+
fileUrl,
|
|
65
|
+
fileType: fileType || 'pdf'
|
|
66
|
+
} : null);
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement(_DocumentSideDrawer.default, _extends({
|
|
68
|
+
title: title,
|
|
69
|
+
handleCloseDrawer: onClose,
|
|
70
|
+
documentConfig: finalDocumentConfig,
|
|
71
|
+
drawerWidth: drawerWidth
|
|
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.isRequired,
|
|
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
|
+
drawerWidth: "1200",
|
|
113
|
+
fileUrl: null,
|
|
114
|
+
fileType: null,
|
|
115
|
+
documentConfig: null,
|
|
116
|
+
detailsTitle: null,
|
|
117
|
+
sectionTitle: null,
|
|
118
|
+
details: [],
|
|
119
|
+
actions: [],
|
|
120
|
+
children: null
|
|
121
|
+
};
|
|
122
|
+
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"));
|