oa-componentbook 1.0.1-stage.439 → 1.0.1-stage.440
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-progress-bar/CustomProgressBar.js +8 -4
- package/build/components/oa-component-select/CustomSelect.js +1 -1
- package/build/components/oa-component-textarea/CustomTextArea.js +95 -8
- package/build/components/oa-component-textarea/constants.js +39 -0
- package/build/components/oa-component-textarea/styles.js +12 -3
- 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/index.js +0 -21
- package/build/layout/EntityOverviewLayout/EntityOverviewLayout.js +145 -4
- package/build/layout/EntityOverviewLayout/reducer/entityOverviewLayoutReducer.js +18 -1
- package/build/widgets/oa-form-widget/FormWidget.js +2 -1
- package/build/widgets/oa-widget-user-management/UserManagementWidget.js +61 -8
- package/package.json +1 -1
- package/build/components/oa-component-document-details-panel/DocumentDetailsPanel.js +0 -139
- package/build/components/oa-component-table-with-search-and-filter/TableWithSearchAndFilter.js +0 -450
- package/build/components/oa-component-table-with-search-and-filter/styles.js +0 -24
- package/build/dev/oa-widget-document-viewer-with-details/DocumentViewerWithDetails.js +0 -122
|
@@ -5,9 +5,12 @@ require("core-js/modules/es.weak-map.js");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = _default;
|
|
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");
|
|
11
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
15
|
var _antd = require("antd");
|
|
13
16
|
var _EditOutlined = _interopRequireDefault(require("@material-ui/icons/EditOutlined"));
|
|
@@ -28,7 +31,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
28
31
|
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; }
|
|
29
32
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
30
33
|
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 */
|
|
31
|
-
function
|
|
34
|
+
function _default(_ref) {
|
|
35
|
+
var _drawer$data, _activeDrawerData$mis;
|
|
32
36
|
let {
|
|
33
37
|
form,
|
|
34
38
|
fieldName = "users",
|
|
@@ -39,7 +43,8 @@ function UserManagementWidget(_ref) {
|
|
|
39
43
|
addUserClick,
|
|
40
44
|
deleteUserClick,
|
|
41
45
|
editUserClick,
|
|
42
|
-
misc
|
|
46
|
+
misc,
|
|
47
|
+
drawer
|
|
43
48
|
} = _ref;
|
|
44
49
|
const finalFields = fields || [];
|
|
45
50
|
const [editingUserId, setEditingUserId] = (0, _react.useState)(null);
|
|
@@ -88,6 +93,28 @@ function UserManagementWidget(_ref) {
|
|
|
88
93
|
[fieldName]: defaultUsers
|
|
89
94
|
});
|
|
90
95
|
}, [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;
|
|
91
118
|
const handleEdit = user => {
|
|
92
119
|
setEditingUserId(user.id);
|
|
93
120
|
setAddingUser(false);
|
|
@@ -127,7 +154,7 @@ function UserManagementWidget(_ref) {
|
|
|
127
154
|
const {
|
|
128
155
|
error,
|
|
129
156
|
data
|
|
130
|
-
} = await editUserClick(editingUserId, userData);
|
|
157
|
+
} = await editUserClick(editingUserId, userData, misc);
|
|
131
158
|
if (error) {
|
|
132
159
|
showErrorNotification(error);
|
|
133
160
|
} else {
|
|
@@ -146,10 +173,13 @@ function UserManagementWidget(_ref) {
|
|
|
146
173
|
} else if (addingUser) {
|
|
147
174
|
// Add new user
|
|
148
175
|
if (addUserClick) {
|
|
176
|
+
console.log("userData", userData);
|
|
177
|
+
console.log("misc", misc);
|
|
178
|
+
console.log("branchId", branchId);
|
|
149
179
|
const {
|
|
150
180
|
error,
|
|
151
181
|
data
|
|
152
|
-
} = await addUserClick(userData, misc);
|
|
182
|
+
} = await addUserClick(userData, misc, branchId);
|
|
153
183
|
if (error) {
|
|
154
184
|
showErrorNotification(error);
|
|
155
185
|
} else {
|
|
@@ -215,15 +245,38 @@ function UserManagementWidget(_ref) {
|
|
|
215
245
|
};
|
|
216
246
|
const canDelete = users.length > 1;
|
|
217
247
|
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
|
+
};
|
|
218
270
|
const renderFormField = field => {
|
|
219
271
|
var _field$options;
|
|
220
272
|
const fieldNameWithPrefix = "".concat(fieldName, "_").concat(field.key);
|
|
273
|
+
const processedRules = processRules(field.rules);
|
|
221
274
|
switch (field.widget || field.type) {
|
|
222
275
|
case "input":
|
|
223
276
|
return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
224
277
|
name: fieldNameWithPrefix,
|
|
225
278
|
label: field.label,
|
|
226
|
-
rules:
|
|
279
|
+
rules: processedRules,
|
|
227
280
|
style: {
|
|
228
281
|
marginBottom: 16
|
|
229
282
|
}
|
|
@@ -234,7 +287,7 @@ function UserManagementWidget(_ref) {
|
|
|
234
287
|
return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
235
288
|
name: fieldNameWithPrefix,
|
|
236
289
|
label: field.label,
|
|
237
|
-
rules:
|
|
290
|
+
rules: processedRules,
|
|
238
291
|
style: {
|
|
239
292
|
marginBottom: 16
|
|
240
293
|
}
|
|
@@ -249,7 +302,7 @@ function UserManagementWidget(_ref) {
|
|
|
249
302
|
return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
250
303
|
name: fieldNameWithPrefix,
|
|
251
304
|
label: field.label,
|
|
252
|
-
rules:
|
|
305
|
+
rules: processedRules,
|
|
253
306
|
style: {
|
|
254
307
|
marginBottom: 16
|
|
255
308
|
}
|
package/package.json
CHANGED
|
@@ -1,139 +0,0 @@
|
|
|
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;
|