oa-componentbook 1.0.1-stage.441 → 1.0.1-stage.443

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.
@@ -15,7 +15,7 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
15
15
  /**
16
16
  * Styled container for the details panel
17
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"])));
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
19
 
20
20
  /**
21
21
  * DocumentDetailsPanel Component
@@ -66,39 +66,53 @@ function DocumentDetailsPanel(_ref) {
66
66
  }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
67
67
  typography: "type-t2-700",
68
68
  color: "primary-content"
69
- }, title)), sectionTitle && /*#__PURE__*/_react.default.createElement("div", {
69
+ }, title)), (sectionTitle || details && details.length > 0) && /*#__PURE__*/_react.default.createElement("div", {
70
+ className: "table-container"
71
+ }, sectionTitle && /*#__PURE__*/_react.default.createElement("div", {
70
72
  className: "section-header"
71
73
  }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
72
74
  typography: "type-sl1-700",
73
75
  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", {
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", {
102
116
  className: "children-container"
103
117
  }, children));
104
118
  }
@@ -118,7 +132,8 @@ DocumentDetailsPanel.propTypes = {
118
132
  key: _propTypes.default.string,
119
133
  label: _propTypes.default.string.isRequired,
120
134
  onClick: _propTypes.default.func,
121
- icon: _propTypes.default.node
135
+ icon: _propTypes.default.node,
136
+ ariaLabel: _propTypes.default.string
122
137
  })),
123
138
  /** Additional content to render below the details */
124
139
  children: _propTypes.default.node,
@@ -18,7 +18,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
18
  * @param {number} totalStep - The total number of steps in the progress.
19
19
  * @param {string} headingColor - The color used for the step text heading.
20
20
  * @param {string} barColor - The color used for the progress bar.
21
- * @param {boolean} showStepText - Whether to display the step text (Step X out of Y).
22
21
  *
23
22
  * @returns {React.ReactElement} A component displaying the current progress.
24
23
  */
@@ -27,10 +26,9 @@ function ProgressBar(_ref) {
27
26
  currentStep,
28
27
  totalStep,
29
28
  headingColor,
30
- barColor,
31
- showStepText
29
+ barColor
32
30
  } = _ref;
33
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showStepText && /*#__PURE__*/_react.default.createElement("div", {
31
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
34
32
  className: "margin-bottom-8"
35
33
  }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
36
34
  color: headingColor,
@@ -59,14 +57,12 @@ ProgressBar.propTypes = {
59
57
  currentStep: _propTypes.default.number,
60
58
  totalStep: _propTypes.default.number,
61
59
  headingColor: _propTypes.default.string,
62
- barColor: _propTypes.default.string,
63
- showStepText: _propTypes.default.bool
60
+ barColor: _propTypes.default.string
64
61
  };
65
62
  ProgressBar.defaultProps = {
66
63
  currentStep: 1,
67
64
  totalStep: 1,
68
65
  headingColor: 'positive',
69
- barColor: 'positive',
70
- showStepText: true
66
+ barColor: 'positive'
71
67
  };
72
68
  var _default = exports.default = ProgressBar;
@@ -8,9 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  });
9
9
  exports.default = void 0;
10
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");
11
+ require("core-js/modules/es.json.stringify.js");
14
12
  var _react = _interopRequireWildcard(require("react"));
15
13
  var _Search = _interopRequireDefault(require("@material-ui/icons/Search"));
16
14
  var _FilterList = _interopRequireDefault(require("@material-ui/icons/FilterList"));
@@ -83,8 +81,6 @@ function TableWithSearchAndFilter(_ref) {
83
81
  const {
84
82
  show: showSearch = true,
85
83
  placeholder: searchPlaceholder = 'Search...',
86
- debounceDelay = 500,
87
- searchKeys = [],
88
84
  onSearch
89
85
  } = searchProps;
90
86
 
@@ -111,42 +107,15 @@ function TableWithSearchAndFilter(_ref) {
111
107
  onShowSizeChange
112
108
  } = paginationProps;
113
109
 
110
+ // Constants
111
+ const SEARCH_INPUT_WIDTH = '350px';
112
+
114
113
  // Search state
115
114
  const [searchValue, setSearchValue] = (0, _react.useState)('');
116
- const [filteredData, setFilteredData] = (0, _react.useState)(dataSource);
117
- const timerRef = (0, _react.useRef)(null);
118
115
 
119
116
  // Filter drawer state
120
117
  const [isFilterDrawerVisible, setIsFilterDrawerVisible] = (0, _react.useState)(false);
121
118
  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
119
 
151
120
  // Search handlers
152
121
  const handleSearchChange = e => {
@@ -154,75 +123,120 @@ function TableWithSearchAndFilter(_ref) {
154
123
  value
155
124
  } = e.target;
156
125
  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;
126
+ if (onSearch) {
127
+ onSearch(value);
167
128
  }
168
- timerRef.current = setTimeout(() => {
169
- if (onSearch) {
170
- onSearch(value);
171
- } else {
172
- applyFiltersAndSearch(dataSource, value, appliedFilters);
173
- }
174
- }, debounceDelay);
175
129
  };
176
130
  const handleSearchPressEnter = () => {
177
- if (timerRef.current) {
178
- clearTimeout(timerRef.current);
179
- }
180
131
  if (onSearch) {
181
132
  onSearch(searchValue);
182
- } else {
183
- applyFiltersAndSearch(dataSource, searchValue, appliedFilters);
184
133
  }
185
134
  };
186
- (0, _react.useEffect)(() => () => {
187
- if (timerRef.current) {
188
- clearTimeout(timerRef.current);
189
- }
190
- }, []);
191
135
 
192
136
  // Filter handlers
193
137
  const handleOpenFilterDrawer = () => setIsFilterDrawerVisible(true);
194
138
  const handleCloseFilterDrawer = () => setIsFilterDrawerVisible(false);
195
139
  const handleFilterChange = function handleFilterChange(key, value) {
196
140
  let action = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'change';
141
+ // Normalize empty values: convert empty string to null for consistency
142
+ const normalizedValue = value === '' ? null : value;
197
143
  const updatedFilters = _objectSpread(_objectSpread({}, filterValues), {}, {
198
- [key]: value
144
+ [key]: normalizedValue
199
145
  });
200
146
  setFilterValues(updatedFilters);
201
147
 
202
148
  // Call onChange callback if provided for real-time filter changes
203
149
  if (onFilterChange) {
204
- onFilterChange(key, value, updatedFilters, action);
150
+ onFilterChange(key, normalizedValue, updatedFilters, action);
205
151
  }
206
152
  };
207
153
  const handleApplyFilters = () => {
208
- setAppliedFilters(_objectSpread({}, filterValues));
209
154
  setIsFilterDrawerVisible(false);
210
155
  if (onFiltersApply) {
211
156
  onFiltersApply(filterValues);
212
- } else {
213
- applyFiltersAndSearch(dataSource, searchValue, filterValues);
214
157
  }
215
158
  };
216
159
  const handleClearFilters = () => {
217
160
  setFilterValues({});
218
- setAppliedFilters({});
219
161
  if (onFiltersClear) {
220
162
  onFiltersClear();
221
- } else {
222
- applyFiltersAndSearch(dataSource, searchValue, {});
223
163
  }
224
164
  };
225
165
 
166
+ // Memoized required keys calculation for better performance
167
+ const requiredKeys = (0, _react.useMemo)(() => {
168
+ const keys = [];
169
+ filterConfig.forEach(filter => {
170
+ const {
171
+ type,
172
+ key,
173
+ required,
174
+ fields = []
175
+ } = filter;
176
+ if (required) {
177
+ if (type === 'dateRange' || type === 'group') {
178
+ fields.forEach(field => {
179
+ keys.push(field.key);
180
+ });
181
+ } else {
182
+ keys.push(key);
183
+ }
184
+ }
185
+ });
186
+ return keys;
187
+ }, [filterConfig]);
188
+
189
+ // Create a stable string representation of filterValues for required keys
190
+ // This ensures reliable dependency tracking in production builds
191
+ const requiredFieldsSignature = (0, _react.useMemo)(() => requiredKeys.map(key => {
192
+ const value = filterValues[key];
193
+ // Create a stable string representation that changes when value changes
194
+ if (value === undefined || value === null) return "".concat(key, ":null");
195
+ if (value instanceof Date) return "".concat(key, ":").concat(value.getTime());
196
+ return "".concat(key, ":").concat(JSON.stringify(value));
197
+ }).join('|'), [requiredKeys, filterValues]);
198
+
199
+ // Memoized check if all required fields are filled
200
+ const areAllRequiredFieldsFilled = (0, _react.useMemo)(() => {
201
+ // If no required fields, button should be enabled
202
+ if (requiredKeys.length === 0) {
203
+ return true;
204
+ }
205
+
206
+ // Check each required field has a valid value
207
+ return requiredKeys.every(requiredKey => {
208
+ const value = filterValues[requiredKey];
209
+
210
+ // Check if value exists and is not empty/null/undefined
211
+ // Also handle edge cases: empty arrays, empty objects, etc.
212
+ if (value === undefined || value === null || value === '') {
213
+ return false;
214
+ }
215
+
216
+ // Handle arrays
217
+ if (Array.isArray(value)) {
218
+ return value.length > 0;
219
+ }
220
+
221
+ // Handle objects (but allow Date objects and other valid objects)
222
+ if (typeof value === 'object' && !(value instanceof Date)) {
223
+ return Object.keys(value).length > 0;
224
+ }
225
+ return true;
226
+ });
227
+ }, [requiredKeys, requiredFieldsSignature, filterValues]);
228
+
229
+ // Helper function to determine notFoundContent message
230
+ const getNotFoundContent = (isApiCallInProgress, query) => {
231
+ if (!isApiCallInProgress && (query === null || query === void 0 ? void 0 : query.length) < 3) {
232
+ return 'Start Typing atleast 3 characters';
233
+ }
234
+ if (isApiCallInProgress && (query === null || query === void 0 ? void 0 : query.length) > 0) {
235
+ return 'Loading...';
236
+ }
237
+ return 'No data found';
238
+ };
239
+
226
240
  // Helper function to render CustomSelect (DRY principle)
227
241
  const renderSelect = (fieldKey, fieldConfig) => {
228
242
  const {
@@ -230,22 +244,27 @@ function TableWithSearchAndFilter(_ref) {
230
244
  options = [],
231
245
  loading = false,
232
246
  isApiCallInProgress = false,
247
+ searchValue: query = '',
233
248
  showSearch: fieldShowSearch = false,
234
249
  filterOption,
235
250
  disabled = false
236
251
  } = fieldConfig;
237
252
  const fieldValue = filterValues[fieldKey];
238
253
  const isLoading = filtersLoading || loading || isApiCallInProgress;
254
+ const notFoundContent = getNotFoundContent(isApiCallInProgress, query);
239
255
  return /*#__PURE__*/_react.default.createElement(_CustomSelect.default, {
240
256
  placeholder: placeholder || 'Select an option',
241
257
  value: fieldValue || undefined,
242
258
  options: options,
243
259
  onSelectionChange: val => {
244
- // If val is null/undefined, it's a clear action
260
+ // Normalize: null/undefined means clear action
245
261
  const action = val === null || val === undefined ? 'clear' : 'select';
246
262
  handleFilterChange(fieldKey, val, action);
247
263
  },
248
- onSearch: searchText => handleFilterChange(fieldKey, searchText, 'search'),
264
+ onSearch: searchText => {
265
+ // For search, pass the search text as-is (don't normalize to null)
266
+ handleFilterChange(fieldKey, searchText || null, 'search');
267
+ },
249
268
  onChange: val => {
250
269
  // Catch clear from Ant Design's onChange (passes through {...props})
251
270
  if (val === undefined || val === null) {
@@ -256,8 +275,8 @@ function TableWithSearchAndFilter(_ref) {
256
275
  loading: isLoading,
257
276
  showSearch: fieldShowSearch,
258
277
  filterOption: filterOption,
259
- disabled: disabled
260
- // notFoundContent={(!isApiCallInProgress && query?.length < 3) ? "Start Typing atleast 3 characters" : (isApiCallInProgress && query?.length > 0) ? "Loading..." : "No data found"}
278
+ disabled: disabled,
279
+ notFoundContent: notFoundContent
261
280
  });
262
281
  };
263
282
 
@@ -307,16 +326,16 @@ function TableWithSearchAndFilter(_ref) {
307
326
  case 'dateRange':
308
327
  return /*#__PURE__*/_react.default.createElement(_styles.DateRangeContainer, null, fields.map(field => /*#__PURE__*/_react.default.createElement(_styles.FilterSubField, {
309
328
  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))));
329
+ }, /*#__PURE__*/_react.default.createElement(_styles.FilterSubLabel, null, field.label), renderDatePicker(field.key, field))));
311
330
  case 'group':
312
331
  return /*#__PURE__*/_react.default.createElement(_styles.FilterGroup, null, fields.map(field => /*#__PURE__*/_react.default.createElement(_styles.FilterSubField, {
313
332
  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))));
333
+ }, /*#__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))));
315
334
  default:
316
335
  return null;
317
336
  }
318
337
  };
319
- const displayData = onSearch || onFiltersApply ? dataSource : filteredData;
338
+ const displayData = dataSource;
320
339
  const totalRecords = total !== null && total !== void 0 ? total : displayData.length;
321
340
  return /*#__PURE__*/_react.default.createElement(_styles.TableWithSearchAndFilterContainer, {
322
341
  className: className
@@ -334,7 +353,7 @@ function TableWithSearchAndFilter(_ref) {
334
353
  onPressEnter: handleSearchPressEnter,
335
354
  allowClear: true,
336
355
  style: {
337
- width: '350px',
356
+ width: SEARCH_INPUT_WIDTH,
338
357
  flexShrink: 0
339
358
  }
340
359
  }), showFilters && /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
@@ -368,7 +387,8 @@ function TableWithSearchAndFilter(_ref) {
368
387
  label: "Apply Filter",
369
388
  onClick: handleApplyFilters,
370
389
  type: "primary",
371
- size: "medium"
390
+ size: "medium",
391
+ disabled: !areAllRequiredFieldsFilled
372
392
  })))), /*#__PURE__*/_react.default.createElement(_CustomTable.default, _extends({
373
393
  rowKey: rowKey,
374
394
  dataSource: displayData,
@@ -396,8 +416,6 @@ TableWithSearchAndFilter.propTypes = {
396
416
  searchProps: _propTypes.default.shape({
397
417
  show: _propTypes.default.bool,
398
418
  placeholder: _propTypes.default.string,
399
- debounceDelay: _propTypes.default.number,
400
- searchKeys: _propTypes.default.arrayOf(_propTypes.default.string),
401
419
  onSearch: _propTypes.default.func
402
420
  }),
403
421
  filterProps: _propTypes.default.shape({
@@ -429,9 +447,7 @@ TableWithSearchAndFilter.defaultProps = {
429
447
  },
430
448
  searchProps: {
431
449
  show: true,
432
- placeholder: 'Search...',
433
- debounceDelay: 500,
434
- searchKeys: []
450
+ placeholder: 'Search...'
435
451
  },
436
452
  filterProps: {
437
453
  show: true,
@@ -1,25 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.object.assign.js");
4
- require("core-js/modules/es.weak-map.js");
5
- require("core-js/modules/web.dom-collections.iterator.js");
6
4
  Object.defineProperty(exports, "__esModule", {
7
5
  value: true
8
6
  });
9
7
  exports.default = void 0;
10
- require("core-js/modules/es.string.trim.js");
11
8
  var _react = _interopRequireDefault(require("react"));
12
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
10
  var _antd = require("antd");
14
- var _SendRounded = _interopRequireDefault(require("@material-ui/icons/SendRounded"));
15
- var _styles = _interopRequireWildcard(require("./styles"));
11
+ var _styles = _interopRequireDefault(require("./styles"));
16
12
  var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
17
- var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
18
- var _constants = require("./constants");
19
- const _excluded = ["rows", "placeholder", "maxLength", "className", "variant"],
20
- _excluded2 = ["minRows", "maxRows", "sendIconConfig", "onSend", "value", "onChange", "disabled"];
21
- 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); }
22
- 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; }
13
+ const _excluded = ["rows", "placeholder", "maxLength", "className"];
23
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
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); }
25
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; }
@@ -28,25 +19,19 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
28
19
  * A custom text area component.
29
20
  *
30
21
  * The component includes the following properties:
31
- * - `rows`: The number of rows for the text area (used for default variant).
22
+ * - `rows`: The number of rows for the text area.
32
23
  * - `placeholder`: The placeholder text for the text area.
33
24
  * - `maxLength`: The maximum length of the input value.
34
25
  * - `className`: Additional CSS class to apply to the text area.
35
- * - `variant`: 'default' or 'gradient' - determines the styling variant.
36
- * - `minRows`: Initial line height for gradient variant (default: 1).
37
- * - `maxRows`: Maximum rows before scrolling starts for gradient variant (default: null for unlimited).
38
- * - `sendIconConfig`: Object with `show` (boolean, default: false) and `disabled` (boolean, default: false) for gradient variant only.
39
- * - `onSend`: Callback function called when send icon is clicked (gradient variant only).
40
26
  * - `antDesignProps`: Any other props to pass to the antd Input.TextArea component.
41
27
  *
42
28
  * The component will apply the following styles:
43
29
  * - A dark grey background when the component is disabled.
44
30
  * - A dark grey text color when the component is disabled.
45
31
  * - A custom style class of `custom-textarea` to the outer element.
46
- * - Gradient border and auto-growing height for gradient variant.
47
32
  *
48
33
  * The component will also apply the following props to the antd Input.TextArea component:
49
- * - `rows` (for default variant) or `minRows`/`maxRows` (for gradient variant)
34
+ * - `rows`
50
35
  * - `placeholder`
51
36
  * - `maxLength`
52
37
  * - `className` (appended to the outer element)
@@ -57,79 +42,9 @@ function CustomTextArea(_ref) {
57
42
  rows,
58
43
  placeholder,
59
44
  maxLength,
60
- className,
61
- variant = 'default'
45
+ className
62
46
  } = _ref,
63
47
  antDesignProps = _objectWithoutProperties(_ref, _excluded);
64
- // Render gradient variant
65
- if (variant === 'gradient') {
66
- // Extract gradient-specific props from antDesignProps
67
- const _ref2 = antDesignProps || {},
68
- {
69
- minRows = _constants.DEFAULT_MIN_ROWS,
70
- maxRows = _constants.DEFAULT_MAX_ROWS,
71
- sendIconConfig = _constants.DEFAULT_SEND_ICON_CONFIG,
72
- onSend,
73
- value,
74
- onChange,
75
- disabled
76
- } = _ref2,
77
- restAntDesignProps = _objectWithoutProperties(_ref2, _excluded2);
78
-
79
- // Handle send icon click - gradient variant only
80
- // Use value prop directly - no internal state management
81
- const handleSendClick = () => {
82
- const currentValue = value || '';
83
- // Only allow click if textarea is enabled, icon config is not disabled, and has content
84
- if (onSend && !disabled && !sendIconConfig.disabled && currentValue.trim()) {
85
- onSend(currentValue);
86
- }
87
- };
88
-
89
- // Determine if send icon should be enabled - gradient variant only
90
- // Icon is enabled if: textarea is enabled AND config says it's not disabled AND there's content
91
- // Use value prop directly - no internal state
92
- const currentValue = value || '';
93
- const isSendEnabled = !disabled && !sendIconConfig.disabled && currentValue.trim().length > 0;
94
-
95
- // Determine if icon should be shown - only for gradient variant
96
- // Hidden by default, only show when explicitly requested via sendIconConfig.show
97
- const shouldShowIcon = sendIconConfig.show;
98
- return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
99
- theme: {
100
- token: {
101
- colorBgContainerDisabled: _ColorVariablesMap.default['--color-divider'],
102
- colorTextDisabled: _ColorVariablesMap.default['--color-secondary-content']
103
- }
104
- }
105
- }, /*#__PURE__*/_react.default.createElement(_styles.TextAreaWrapper, {
106
- className: className,
107
- $disabled: disabled
108
- }, /*#__PURE__*/_react.default.createElement(_styles.default, _extends({
109
- placeholder: placeholder,
110
- maxLength: maxLength,
111
- className: "custom-textarea-gradient",
112
- value: value,
113
- onChange: onChange,
114
- disabled: disabled,
115
- autoSize: maxRows ? {
116
- minRows,
117
- maxRows
118
- } : {
119
- minRows
120
- }
121
- }, restAntDesignProps)), shouldShowIcon && /*#__PURE__*/_react.default.createElement(_styles.SendIconWrapper, {
122
- className: disabled || sendIconConfig.disabled || !isSendEnabled ? 'icon-disabled' : 'icon-enabled'
123
- }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
124
- icon: _SendRounded.default,
125
- size: 24,
126
- color: isSendEnabled ? 'primary' : 'placeholder-text',
127
- onClick: handleSendClick
128
- }))));
129
- }
130
-
131
- // Render default variant (existing behavior - completely unchanged)
132
- // All props including value, onChange pass through naturally via antDesignProps
133
48
  return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
134
49
  theme: {
135
50
  token: {
@@ -148,14 +63,12 @@ CustomTextArea.propTypes = {
148
63
  rows: _propTypes.default.number,
149
64
  placeholder: _propTypes.default.string,
150
65
  maxLength: _propTypes.default.number,
151
- className: _propTypes.default.string,
152
- variant: _propTypes.default.oneOf(['default', 'gradient'])
66
+ className: _propTypes.default.string
153
67
  };
154
68
  CustomTextArea.defaultProps = {
155
- rows: _constants.DEFAULT_ROWS,
69
+ rows: 2,
156
70
  placeholder: null,
157
71
  maxLength: 5000,
158
- className: '',
159
- variant: 'default'
72
+ className: ''
160
73
  };
161
74
  var _default = exports.default = CustomTextArea;
@@ -3,23 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.TextAreaWrapper = exports.SendIconWrapper = void 0;
6
+ exports.default = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _antd = require("antd");
9
- var _constants = require("./constants");
10
- var _templateObject, _templateObject2, _templateObject3;
9
+ var _templateObject;
11
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
11
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
13
12
  const {
14
13
  TextArea: AntdTextArea
15
14
  } = _antd.Input;
16
-
17
- // Default textarea styles (existing)
18
- const StyledTextArea = (0, _styledComponents.default)(AntdTextArea)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.custom-textarea {\n padding: 16px;\n resize: none;\n border-radius: 4px;\n max-height: 92px;\n border: 1px solid var(--color-placeholder-text);\n }\n &.custom-textarea:hover {\n border: 1px solid var(--color-primary);\n }\n &.custom-textarea:focus-within {\n box-shadow: 0px 0px 4px 0px rgba(1, 79, 197, 0.90);\n }\n\n /* Gradient variant styles */\n &.custom-textarea-gradient {\n padding: 16px 48px 16px 16px;\n resize: none;\n border-radius: calc(", " - 2px);\n border: none;\n background: var(--color-primary-background);\n font-size: 16px;\n line-height: 24px;\n color: var(--color-primary-content);\n min-height: auto !important;\n box-shadow: none;\n width: 100%;\n }\n\n &.custom-textarea-gradient::placeholder {\n color: var(--color-secondary-content);\n }\n\n &.custom-textarea-gradient:hover {\n box-shadow: none;\n }\n\n &.custom-textarea-gradient:focus {\n outline: none;\n box-shadow: none;\n }\n\n &.custom-textarea-gradient:focus-within {\n box-shadow: none;\n }\n"])), _constants.TEXTAREA_BORDER_RADIUS);
19
-
20
- // Wrapper for gradient variant with gradient border
21
- const TextAreaWrapper = exports.TextAreaWrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n display: block;\n width: 100%;\n border-radius: ", ";\n padding: 2px;\n background: ", ";\n box-shadow: ", ";\n opacity: ", ";\n"])), _constants.TEXTAREA_BORDER_RADIUS, props => props.$disabled ? 'var(--color-divider)' : "linear-gradient(\n 135deg,\n ".concat(_constants.GRADIENT_BORDER_COLORS.top, " 0%,\n ").concat(_constants.GRADIENT_BORDER_COLORS.middle, " 50%,\n ").concat(_constants.GRADIENT_BORDER_COLORS.bottom, " 100%\n )"), props => props.$disabled ? 'none' : _constants.TEXTAREA_SHADOW, props => props.$disabled ? 0.6 : 1);
22
-
23
- // Send icon wrapper positioned absolutely
24
- const SendIconWrapper = exports.SendIconWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 18px;\n right: 18px;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10;\n pointer-events: none;\n\n button,\n svg {\n pointer-events: auto;\n }\n\n /* Icon disabled state */\n &.icon-disabled {\n opacity: 0.5;\n \n button,\n svg {\n cursor: not-allowed;\n }\n }\n\n /* Icon enabled state */\n &.icon-enabled {\n opacity: 1;\n \n button,\n svg {\n cursor: pointer;\n }\n }\n"])));
15
+ const StyledTextArea = (0, _styledComponents.default)(AntdTextArea)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.custom-textarea {\n padding: 16px;\n resize: none;\n border-radius: 4px;\n max-height: 92px;\n border: 1px solid var(--color-placeholder-text);\n }\n &.custom-textarea:hover {\n border: 1px solid var(--color-primary);\n }\n &.custom-textarea:focus-within {\n box-shadow: 0px 0px 4px 0px rgba(1, 79, 197, 0.90);\n }\n"])));
25
16
  var _default = exports.default = StyledTextArea;
@@ -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
@@ -139,7 +140,9 @@ function DocumentSideDrawer(_ref) {
139
140
  width: calculatedWidth,
140
141
  onClose: handleCloseDrawer,
141
142
  title: title
142
- }, props), /*#__PURE__*/_react.default.createElement(_styles.default, null, /*#__PURE__*/_react.default.createElement("div", {
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 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"])));
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;
@@ -10,19 +10,18 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _DocumentSideDrawer = _interopRequireDefault(require("../oa-widget-document-side-drawer/DocumentSideDrawer"));
11
11
  var _DocumentDetailsPanel = _interopRequireDefault(require("../../components/oa-component-document-details-panel/DocumentDetailsPanel"));
12
12
  const _excluded = ["title", "onClose", "drawerWidth", "fileUrl", "fileType", "documentConfig", "detailsTitle", "sectionTitle", "details", "actions", "children"];
13
- /* eslint-disable */
14
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
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); }
16
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; }
17
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; }
18
17
  /**
19
18
  * DocumentViewerWithDetails Component
20
- *
19
+ *
21
20
  * A split-view component that displays a document viewer on the left
22
21
  * and a details panel with actions on the right.
23
- *
22
+ *
24
23
  * Uses DocumentSideDrawer and DocumentDetailsPanel internally.
25
- *
24
+ *
26
25
  * @example
27
26
  * <DocumentViewerWithDetails
28
27
  * title="VIEW DOCUMENT"
@@ -68,7 +67,8 @@ function DocumentViewerWithDetails(_ref) {
68
67
  title: title,
69
68
  handleCloseDrawer: onClose,
70
69
  documentConfig: finalDocumentConfig,
71
- drawerWidth: drawerWidth
70
+ drawerWidth: drawerWidth,
71
+ containerClassName: "documentViewerWithDetails"
72
72
  }, restProps), /*#__PURE__*/_react.default.createElement(_DocumentDetailsPanel.default, {
73
73
  title: detailsTitle,
74
74
  sectionTitle: sectionTitle,
@@ -80,7 +80,7 @@ DocumentViewerWithDetails.propTypes = {
80
80
  /** Drawer title displayed in the header */
81
81
  title: _propTypes.default.string,
82
82
  /** Callback function when drawer is closed */
83
- onClose: _propTypes.default.func.isRequired,
83
+ onClose: _propTypes.default.func,
84
84
  /** Custom drawer width (default: 1200) */
85
85
  drawerWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
86
86
  /** URL of the document to display */
@@ -109,7 +109,8 @@ DocumentViewerWithDetails.propTypes = {
109
109
  };
110
110
  DocumentViewerWithDetails.defaultProps = {
111
111
  title: null,
112
- drawerWidth: "1200",
112
+ onClose: () => {},
113
+ drawerWidth: '1200',
113
114
  fileUrl: null,
114
115
  fileType: null,
115
116
  documentConfig: null,
@@ -58,8 +58,7 @@ function EntityOverviewLayout(_ref) {
58
58
  profileData,
59
59
  accordionData,
60
60
  drawer,
61
- modal,
62
- misc
61
+ modal
63
62
  } = state !== null && state !== void 0 ? state : {};
64
63
  (0, _react.useEffect)(() => {
65
64
  init();
@@ -122,90 +121,8 @@ function EntityOverviewLayout(_ref) {
122
121
  placement: "bottomRight"
123
122
  });
124
123
  };
125
- const handleCloseDrawer = async () => {
126
- var _state$misc2, _state$misc3, _state$misc4;
127
- // Get selected enterprise from session storage to ensure profile data reflects correct enterprise
128
- const selectedEnterpriseFromStorage = JSON.parse(sessionStorage.getItem('selectedEnterprise') || 'null');
129
- const enterpriseIdFromStorage = (selectedEnterpriseFromStorage === null || selectedEnterpriseFromStorage === void 0 ? void 0 : selectedEnterpriseFromStorage.value) || (selectedEnterpriseFromStorage === null || selectedEnterpriseFromStorage === void 0 ? void 0 : selectedEnterpriseFromStorage.enterpriseId) || (selectedEnterpriseFromStorage === null || selectedEnterpriseFromStorage === void 0 ? void 0 : selectedEnterpriseFromStorage.id);
130
-
131
- // Update misc with enterpriseId from session storage
132
- const currentMisc = _objectSpread(_objectSpread({}, (_state$misc2 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc2 !== void 0 ? _state$misc2 : {}), {}, {
133
- enterpriseId: enterpriseIdFromStorage || (state === null || state === void 0 || (_state$misc3 = state.misc) === null || _state$misc3 === void 0 ? void 0 : _state$misc3.enterpriseId),
134
- enterpriseData: selectedEnterpriseFromStorage || (state === null || state === void 0 || (_state$misc4 = state.misc) === null || _state$misc4 === void 0 ? void 0 : _state$misc4.enterpriseData)
135
- });
136
- dispatch({
137
- type: _entityOverviewLayoutReducer.actionTypes.SET_LOADING,
138
- payload: true
139
- });
140
- if (getInitialData) {
141
- const {
142
- error,
143
- data
144
- } = await (getInitialData === null || getInitialData === void 0 ? void 0 : getInitialData(_objectSpread({}, currentMisc)));
145
- if (error) {
146
- showErrorNotification(error);
147
- const dynamicConfig = (0, _staticConfigResolver.default)(config, {});
148
- // Update misc with enterpriseId from session storage
149
- if (currentMisc) {
150
- dynamicConfig.misc = currentMisc;
151
- }
152
- // Don't preserve profile data - let it be re-rendered from config with correct enterprise
153
- // Don't preserve accordion data - use fresh data from API (or empty if error)
154
- dispatch({
155
- type: _entityOverviewLayoutReducer.actionTypes.INIT,
156
- payload: dynamicConfig
157
- });
158
- } else {
159
- const dynamicConfig = (0, _staticConfigResolver.default)(config, data !== null && data !== void 0 ? data : {});
160
- // Update misc with enterpriseId from session storage
161
- if (currentMisc) {
162
- dynamicConfig.misc = currentMisc;
163
- }
164
- // Use fresh profile data from API response to reflect correct enterprise
165
- if (data !== null && data !== void 0 && data.data) {
166
- dispatch({
167
- type: _entityOverviewLayoutReducer.actionTypes.UPDATE_PROFILE_DATA,
168
- payload: data.data
169
- });
170
- }
171
- // Use fresh accordion data from API response (includes newly added users)
172
- // Check for both 'accordionData' and 'accordianData' (typo in API response)
173
- const freshAccordionData = (data === null || data === void 0 ? void 0 : data.accordionData) || (data === null || data === void 0 ? void 0 : data.accordianData);
174
- if (freshAccordionData) {
175
- let accordionDataToUpdate;
176
- if (Array.isArray(freshAccordionData)) {
177
- accordionDataToUpdate = freshAccordionData;
178
- } else if (freshAccordionData.data && Array.isArray(freshAccordionData.data)) {
179
- accordionDataToUpdate = freshAccordionData.data;
180
- } else {
181
- accordionDataToUpdate = freshAccordionData;
182
- }
183
- // Update accordion data with fresh data from API
184
- dispatch({
185
- type: _entityOverviewLayoutReducer.actionTypes.UPDATE_ACCORDION_DATA,
186
- payload: accordionDataToUpdate
187
- });
188
- }
189
- dispatch({
190
- type: _entityOverviewLayoutReducer.actionTypes.INIT,
191
- payload: dynamicConfig
192
- });
193
- }
194
- } else {
195
- const dynamicConfig = (0, _staticConfigResolver.default)(config, {});
196
- // Update misc with enterpriseId from session storage
197
- if (currentMisc) {
198
- dynamicConfig.misc = currentMisc;
199
- }
200
- dispatch({
201
- type: _entityOverviewLayoutReducer.actionTypes.INIT,
202
- payload: dynamicConfig
203
- });
204
- }
205
- dispatch({
206
- type: _entityOverviewLayoutReducer.actionTypes.SET_LOADING,
207
- payload: false
208
- });
124
+ const handleCloseDrawer = () => {
125
+ init();
209
126
  dispatch({
210
127
  type: _entityOverviewLayoutReducer.actionTypes.CLOSE_DRAWER
211
128
  });
@@ -223,70 +140,14 @@ function EntityOverviewLayout(_ref) {
223
140
  {
224
141
  (config === null || config === void 0 ? void 0 : config.storageType) == "sessionStorage" && (config === null || config === void 0 ? void 0 : config.storageKey) && sessionStorage.setItem(config === null || config === void 0 ? void 0 : config.storageKey, JSON.stringify(selectedData));
225
142
  }
226
- // Always update 'selectedEnterprise' in sessionStorage to keep misc.enterpriseId in sync
227
- if (selectedData) {
228
- sessionStorage.setItem('selectedEnterprise', JSON.stringify(selectedData));
229
- }
230
143
  showSuccessNotification(config === null || config === void 0 ? void 0 : config.successMessage);
231
144
  if (error) {
232
145
  showErrorNotification(error);
233
146
  } else {
234
- // Update misc.enterpriseId to keep it in sync with selected enterprise
235
- // Read from selectedData to match the sessionStorage structure
236
- const enterpriseId = (selectedData === null || selectedData === void 0 ? void 0 : selectedData.value) || (selectedData === null || selectedData === void 0 ? void 0 : selectedData.enterpriseId) || (selectedData === null || selectedData === void 0 ? void 0 : selectedData.id) || selectedValue;
237
- if (enterpriseId) {
238
- dispatch({
239
- type: _entityOverviewLayoutReducer.actionTypes.SET_MISC,
240
- payload: _objectSpread(_objectSpread({}, state === null || state === void 0 ? void 0 : state.misc), {}, {
241
- enterpriseId: enterpriseId,
242
- enterpriseData: selectedData // Also update enterpriseData to match sessionStorage
243
- })
244
- });
245
- }
246
147
  dispatch({
247
148
  type: _entityOverviewLayoutReducer.actionTypes.UPDATE_PROFILE_DATA,
248
149
  payload: selectedItem
249
150
  });
250
- // Update accordion data if provided in the response
251
- // Note: API returns 'accordianData' (typo) but we check for both
252
- const accordionDataFromResponse = (data === null || data === void 0 ? void 0 : data.accordionData) || (data === null || data === void 0 ? void 0 : data.accordianData);
253
-
254
- // Check if accordionDataFromResponse is an object with data array, or if it's directly an array
255
- if (accordionDataFromResponse) {
256
- let accordionDataToUpdate;
257
- if (Array.isArray(accordionDataFromResponse)) {
258
- // If it's directly an array, use it as is
259
- accordionDataToUpdate = accordionDataFromResponse;
260
- } else if (accordionDataFromResponse.data && Array.isArray(accordionDataFromResponse.data)) {
261
- // If it's an object with a data property containing the array, extract the data array
262
- accordionDataToUpdate = accordionDataFromResponse.data;
263
- }
264
- if (accordionDataToUpdate) {
265
- dispatch({
266
- type: _entityOverviewLayoutReducer.actionTypes.UPDATE_ACCORDION_DATA,
267
- payload: accordionDataToUpdate
268
- });
269
- } else {
270
- console.log('Accordion data structure not recognized:', accordionDataFromResponse);
271
- }
272
- } else {
273
- if (getInitialData && config !== null && config !== void 0 && config.refreshAccordionOnSwitch) {
274
- var _state$misc5;
275
- // Optionally refresh accordion data by calling getInitialData again
276
- const {
277
- error: refreshError,
278
- data: refreshData
279
- } = await (getInitialData === null || getInitialData === void 0 ? void 0 : getInitialData(_objectSpread(_objectSpread({}, (_state$misc5 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc5 !== void 0 ? _state$misc5 : {}), {}, {
280
- selectedValue
281
- })));
282
- if (!refreshError && refreshData !== null && refreshData !== void 0 && refreshData.accordionData) {
283
- dispatch({
284
- type: _entityOverviewLayoutReducer.actionTypes.UPDATE_ACCORDION_DATA,
285
- payload: refreshData.accordionData
286
- });
287
- }
288
- }
289
- }
290
151
  }
291
152
  }
292
153
  };
@@ -394,9 +255,7 @@ function EntityOverviewLayout(_ref) {
394
255
  customPageModal: modal,
395
256
  addUserClick: addUserClick,
396
257
  deleteUserClick: deleteUserClick,
397
- editUserClick: editUserClick,
398
- misc: misc,
399
- drawer: drawer
258
+ editUserClick: editUserClick
400
259
  }))))));
401
260
  }
402
261
  EntityOverviewLayout.propTypes = {};
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.initialState = exports.entityOverviewLayoutReducer = exports.actionTypes = void 0;
7
- require("core-js/modules/web.dom-collections.iterator.js");
8
7
  require("core-js/modules/es.symbol.description.js");
9
8
  var _staticConfigResolver = require("../../GenricLayOut/resolver/staticConfigResolver");
10
9
  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; }
@@ -20,8 +19,7 @@ const actionTypes = exports.actionTypes = {
20
19
  SET_DRAWER: 'SET_DRAWER',
21
20
  TOGGLE_DRAWER: 'TOGGLE_DRAWER',
22
21
  CLOSE_DRAWER: 'CLOSE_DRAWER',
23
- UPDATE_PROFILE_DATA: 'UPDATE_PROFILE_DATA',
24
- UPDATE_ACCORDION_DATA: 'UPDATE_ACCORDION_DATA'
22
+ UPDATE_PROFILE_DATA: 'UPDATE_PROFILE_DATA'
25
23
  };
26
24
  const initialState = exports.initialState = {};
27
25
  const entityOverviewLayoutReducer = (state, action) => {
@@ -40,21 +38,6 @@ const entityOverviewLayoutReducer = (state, action) => {
40
38
  return _objectSpread(_objectSpread({}, state), {}, {
41
39
  profileData: action.payload
42
40
  });
43
- case actionTypes.UPDATE_ACCORDION_DATA:
44
- {
45
- var _state$accordionData$, _state$accordionData;
46
- console.log('Reducer: Updating accordion data with payload:', action.payload);
47
- const newAccordionData = _objectSpread(_objectSpread({}, (state === null || state === void 0 ? void 0 : state.accordionData) || {}), {}, {
48
- // Preserve all existing accordionData properties
49
- visible: (_state$accordionData$ = state === null || state === void 0 || (_state$accordionData = state.accordionData) === null || _state$accordionData === void 0 ? void 0 : _state$accordionData.visible) !== null && _state$accordionData$ !== void 0 ? _state$accordionData$ : true,
50
- // Preserve visible property, default to true
51
- data: Array.isArray(action.payload) ? [...action.payload] : action.payload // Ensure new array reference
52
- });
53
- console.log('Reducer: New accordion data:', newAccordionData);
54
- return _objectSpread(_objectSpread({}, state), {}, {
55
- accordionData: newAccordionData
56
- });
57
- }
58
41
  case actionTypes.SET_MISC:
59
42
  return _objectSpread(_objectSpread({}, state), {}, {
60
43
  misc: _objectSpread(_objectSpread({}, state.misc), action.payload)
@@ -452,8 +452,7 @@ function FormWidget(props) {
452
452
  initialData: (item === null || item === void 0 ? void 0 : item.value) || [],
453
453
  fields: item === null || item === void 0 ? void 0 : item.fields,
454
454
  disabled: (item === null || item === void 0 ? void 0 : item.disabled) || false,
455
- customPageModal: props === null || props === void 0 ? void 0 : props.customPageModal,
456
- misc: props === null || props === void 0 ? void 0 : props.misc
455
+ customPageModal: props === null || props === void 0 ? void 0 : props.customPageModal
457
456
  }, props)));
458
457
  case "field":
459
458
  return renderFieldWidget(item);
@@ -5,12 +5,9 @@ require("core-js/modules/es.weak-map.js");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = _default;
8
+ exports.default = UserManagementWidget;
9
9
  require("core-js/modules/web.dom-collections.iterator.js");
10
10
  require("core-js/modules/es.promise.js");
11
- require("core-js/modules/es.regexp.constructor.js");
12
- require("core-js/modules/es.regexp.exec.js");
13
- require("core-js/modules/es.regexp.to-string.js");
14
11
  var _react = _interopRequireWildcard(require("react"));
15
12
  var _antd = require("antd");
16
13
  var _EditOutlined = _interopRequireDefault(require("@material-ui/icons/EditOutlined"));
@@ -31,8 +28,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
31
28
  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; }
32
29
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
33
30
  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); } /* eslint-disable */
34
- function _default(_ref) {
35
- var _drawer$data, _activeDrawerData$mis;
31
+ function UserManagementWidget(_ref) {
36
32
  let {
37
33
  form,
38
34
  fieldName = "users",
@@ -43,8 +39,7 @@ function _default(_ref) {
43
39
  addUserClick,
44
40
  deleteUserClick,
45
41
  editUserClick,
46
- misc,
47
- drawer
42
+ misc
48
43
  } = _ref;
49
44
  const finalFields = fields || [];
50
45
  const [editingUserId, setEditingUserId] = (0, _react.useState)(null);
@@ -93,28 +88,6 @@ function _default(_ref) {
93
88
  [fieldName]: defaultUsers
94
89
  });
95
90
  }, [initialData, fieldName, form]);
96
-
97
- // Reset form state when drawer closes or opens to ensure fresh context
98
- (0, _react.useEffect)(() => {
99
- if (drawer && drawer.visible === false) {
100
- // Reset adding/editing state when drawer closes
101
- setAddingUser(false);
102
- setEditingUserId(null);
103
- setDeleteModalVisible(false);
104
- setUserToDelete(null);
105
-
106
- // Clear form fields
107
- const clearData = {};
108
- finalFields.forEach(field => {
109
- clearData["".concat(fieldName, "_").concat(field.key)] = "";
110
- });
111
- form.setFieldsValue(clearData);
112
- }
113
- }, [drawer === null || drawer === void 0 ? void 0 : drawer.visible, form, fieldName, finalFields]);
114
-
115
- // Access branchId dynamically from drawer data using active drawer key
116
- const activeDrawerData = drawer === null || drawer === void 0 || (_drawer$data = drawer.data) === null || _drawer$data === void 0 ? void 0 : _drawer$data[drawer === null || drawer === void 0 ? void 0 : drawer.active];
117
- const branchId = activeDrawerData === null || activeDrawerData === void 0 || (_activeDrawerData$mis = activeDrawerData.misc) === null || _activeDrawerData$mis === void 0 ? void 0 : _activeDrawerData$mis.branchId;
118
91
  const handleEdit = user => {
119
92
  setEditingUserId(user.id);
120
93
  setAddingUser(false);
@@ -154,7 +127,7 @@ function _default(_ref) {
154
127
  const {
155
128
  error,
156
129
  data
157
- } = await editUserClick(editingUserId, userData, misc);
130
+ } = await editUserClick(editingUserId, userData);
158
131
  if (error) {
159
132
  showErrorNotification(error);
160
133
  } else {
@@ -173,13 +146,10 @@ function _default(_ref) {
173
146
  } else if (addingUser) {
174
147
  // Add new user
175
148
  if (addUserClick) {
176
- console.log("userData", userData);
177
- console.log("misc", misc);
178
- console.log("branchId", branchId);
179
149
  const {
180
150
  error,
181
151
  data
182
- } = await addUserClick(userData, misc, branchId);
152
+ } = await addUserClick(userData, misc);
183
153
  if (error) {
184
154
  showErrorNotification(error);
185
155
  } else {
@@ -245,38 +215,15 @@ function _default(_ref) {
245
215
  };
246
216
  const canDelete = users.length > 1;
247
217
  const isEditing = editingUserId !== null || addingUser;
248
-
249
- // Process rules to handle checkValidator structure (similar to FormWidget)
250
- const processRules = rules => {
251
- if (!rules || !Array.isArray(rules)) {
252
- return rules;
253
- }
254
- return rules.map(r => {
255
- // If rule has checkValidator, extract the nested rule object
256
- if (r !== null && r !== void 0 && r.checkValidator && r !== null && r !== void 0 && r.rule) {
257
- let processedRule = _objectSpread({}, r.rule);
258
-
259
- // Handle pattern conversion if it's a string
260
- if (processedRule.pattern && typeof processedRule.pattern === "string") {
261
- processedRule.pattern = new RegExp(processedRule.pattern);
262
- }
263
- return processedRule;
264
- }
265
-
266
- // Return rule as-is if it doesn't have checkValidator structure
267
- return r;
268
- });
269
- };
270
218
  const renderFormField = field => {
271
219
  var _field$options;
272
220
  const fieldNameWithPrefix = "".concat(fieldName, "_").concat(field.key);
273
- const processedRules = processRules(field.rules);
274
221
  switch (field.widget || field.type) {
275
222
  case "input":
276
223
  return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
277
224
  name: fieldNameWithPrefix,
278
225
  label: field.label,
279
- rules: processedRules,
226
+ rules: field.rules,
280
227
  style: {
281
228
  marginBottom: 16
282
229
  }
@@ -287,7 +234,7 @@ function _default(_ref) {
287
234
  return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
288
235
  name: fieldNameWithPrefix,
289
236
  label: field.label,
290
- rules: processedRules,
237
+ rules: field.rules,
291
238
  style: {
292
239
  marginBottom: 16
293
240
  }
@@ -302,7 +249,7 @@ function _default(_ref) {
302
249
  return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
303
250
  name: fieldNameWithPrefix,
304
251
  label: field.label,
305
- rules: processedRules,
252
+ rules: field.rules,
306
253
  style: {
307
254
  marginBottom: 16
308
255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "1.0.1-stage.441",
3
+ "version": "1.0.1-stage.443",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TEXTAREA_SHADOW = exports.TEXTAREA_BORDER_RADIUS = exports.SEND_ICON_SIZE = exports.GRADIENT_BORDER_COLORS = exports.DEFAULT_SEND_ICON_CONFIG = exports.DEFAULT_ROWS = exports.DEFAULT_MIN_ROWS = exports.DEFAULT_MAX_ROWS = void 0;
7
- /**
8
- * Constants for CustomTextArea component
9
- */
10
-
11
- // Default values for textarea configuration
12
- const DEFAULT_MIN_ROWS = exports.DEFAULT_MIN_ROWS = 1;
13
- const DEFAULT_MAX_ROWS = exports.DEFAULT_MAX_ROWS = null; // null means unlimited growth
14
- const DEFAULT_ROWS = exports.DEFAULT_ROWS = 2;
15
-
16
- // Gradient border colors
17
- const GRADIENT_BORDER_COLORS = exports.GRADIENT_BORDER_COLORS = {
18
- top: '#0098FF',
19
- // Blue
20
- middle: '#9A6CFF',
21
- // Purple
22
- bottom: '#FB6252' // Coral/Orange-Red
23
- };
24
-
25
- // Shadow styles
26
- const TEXTAREA_SHADOW = exports.TEXTAREA_SHADOW = '0px 2px 10px rgba(0, 0, 0, 0.14)';
27
-
28
- // Border radius
29
- const TEXTAREA_BORDER_RADIUS = exports.TEXTAREA_BORDER_RADIUS = '12px';
30
-
31
- // Icon sizes
32
- const SEND_ICON_SIZE = exports.SEND_ICON_SIZE = 24;
33
-
34
- // Default send icon configuration
35
- const DEFAULT_SEND_ICON_CONFIG = exports.DEFAULT_SEND_ICON_CONFIG = {
36
- show: false,
37
- // Hidden by default - only show when explicitly requested
38
- disabled: false
39
- };