oa-componentbook 1.0.1-stage.374 → 1.0.1-stage.376
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.
|
@@ -16,7 +16,7 @@ var _styles = require("./styles");
|
|
|
16
16
|
var _CustomRadio = _interopRequireDefault(require("../../components/oa-component-radio/CustomRadio"));
|
|
17
17
|
var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
|
|
18
18
|
var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
|
|
19
|
-
const _excluded = ["children", "description", "docDetails", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "data-test"];
|
|
19
|
+
const _excluded = ["children", "description", "docDetails", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "data-test", "maxLength"];
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
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
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; }
|
|
@@ -59,9 +59,11 @@ function ApprovalWidget(_ref) {
|
|
|
59
59
|
questionId,
|
|
60
60
|
title,
|
|
61
61
|
viewOnClick,
|
|
62
|
-
|
|
62
|
+
"data-test": dataTest,
|
|
63
|
+
maxLength
|
|
63
64
|
} = _ref,
|
|
64
65
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
66
|
+
console.log(maxLength, "maxLength2");
|
|
65
67
|
const getInitialValue = isApproved => {
|
|
66
68
|
switch (isApproved) {
|
|
67
69
|
case true:
|
|
@@ -77,11 +79,11 @@ function ApprovalWidget(_ref) {
|
|
|
77
79
|
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
80
|
className: "row"
|
|
79
81
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
-
className: approvalForm.hidden ?
|
|
82
|
+
className: approvalForm.hidden ? "col-sm-12 col-md-12 col-lg-12" : "col-sm-12 col-md-7 col-lg-7 gutter"
|
|
81
83
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
82
84
|
className: "row"
|
|
83
85
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
84
|
-
className: isQuestionStyleWidget ?
|
|
86
|
+
className: isQuestionStyleWidget ? "col-sm-12 col-md-12 col-lg-12" : "col-sm-12 col-md-8 col-lg-8 gutter"
|
|
85
87
|
}, title && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", {
|
|
86
88
|
className: "type-b2-400"
|
|
87
89
|
}, title, isMandatory && /*#__PURE__*/_react.default.createElement(_styles.RedText, null, "*"))), description && /*#__PURE__*/_react.default.createElement(_styles.Styledescription, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
@@ -92,7 +94,7 @@ function ApprovalWidget(_ref) {
|
|
|
92
94
|
"data-test": dataTest ? "".concat(dataTest, "--view-button") : undefined,
|
|
93
95
|
onClick: () => viewOnClick(questionId),
|
|
94
96
|
type: "text-only",
|
|
95
|
-
label: isQuestionStyleWidget ?
|
|
97
|
+
label: isQuestionStyleWidget ? "View Previous Description" : "View History"
|
|
96
98
|
}), children)), !isQuestionStyleWidget && /*#__PURE__*/_react.default.createElement("div", {
|
|
97
99
|
className: "col-sm-12 col-md-4 col-lg-4"
|
|
98
100
|
}, /*#__PURE__*/_react.default.createElement(_UploadDownloadWidget.default, _extends({
|
|
@@ -112,7 +114,7 @@ function ApprovalWidget(_ref) {
|
|
|
112
114
|
required: true,
|
|
113
115
|
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
114
116
|
"data-test": "".concat(dataTest, "--is-approved-validation-message")
|
|
115
|
-
}, "Approval status needs to be selected.") :
|
|
117
|
+
}, "Approval status needs to be selected.") : "Approval status needs to be selected."
|
|
116
118
|
}]
|
|
117
119
|
}, /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
|
|
118
120
|
"data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-group") : undefined,
|
|
@@ -132,12 +134,17 @@ function ApprovalWidget(_ref) {
|
|
|
132
134
|
className: "type-b2-400"
|
|
133
135
|
}, "Remarks"), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
134
136
|
name: "remarks-".concat(questionId),
|
|
135
|
-
initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks :
|
|
137
|
+
initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks : "",
|
|
136
138
|
rules: [{
|
|
137
139
|
required: true,
|
|
138
140
|
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
139
141
|
"data-test": "".concat(dataTest, "--remarks-validation-message")
|
|
140
|
-
}, "Remarks cannot be empty.") :
|
|
142
|
+
}, "Remarks cannot be empty.") : "Remarks cannot be empty."
|
|
143
|
+
}, maxLength && {
|
|
144
|
+
max: maxLength,
|
|
145
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
146
|
+
"data-test": "".concat(dataTest, "--remarks-maxlength-validation-message")
|
|
147
|
+
}, "Remarks cannot exceed ".concat(maxLength, " characters.")) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "Remarks cannot exceed ".concat(maxLength, " characters."))
|
|
141
148
|
}]
|
|
142
149
|
}, /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
|
|
143
150
|
"data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
|
|
@@ -146,7 +153,7 @@ function ApprovalWidget(_ref) {
|
|
|
146
153
|
}
|
|
147
154
|
ApprovalWidget.propTypes = {
|
|
148
155
|
children: _propTypes.default.node,
|
|
149
|
-
|
|
156
|
+
"data-test": _propTypes.default.string,
|
|
150
157
|
description: _propTypes.default.string,
|
|
151
158
|
// Leave description optional
|
|
152
159
|
docDetails: _propTypes.default.shape({
|
|
@@ -176,8 +183,8 @@ ApprovalWidget.propTypes = {
|
|
|
176
183
|
};
|
|
177
184
|
ApprovalWidget.defaultProps = {
|
|
178
185
|
children: null,
|
|
179
|
-
|
|
180
|
-
description:
|
|
186
|
+
"data-test": null,
|
|
187
|
+
description: "",
|
|
181
188
|
docDetails: {},
|
|
182
189
|
approvalForm: {
|
|
183
190
|
disabled: false,
|
|
@@ -22,7 +22,7 @@ var _CustomButton = _interopRequireDefault(require("../../components/oa-componen
|
|
|
22
22
|
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
23
23
|
var _CustomTag = _interopRequireDefault(require("../../components/oa-component-tag/CustomTag"));
|
|
24
24
|
var _CustomTooltip = _interopRequireDefault(require("../../components/oa-component-tooltip/CustomTooltip"));
|
|
25
|
-
const _excluded = ["children", "description", "docDetails", "multipleDocDetails", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "actionRenderType", "actionContent", "systemStatus", "documentTitle", "descriptionTitle", "data-test", "form", "columnDynamicCssClass", "tooltipPlacement"];
|
|
25
|
+
const _excluded = ["children", "description", "docDetails", "multipleDocDetails", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "actionRenderType", "actionContent", "systemStatus", "documentTitle", "descriptionTitle", "data-test", "form", "columnDynamicCssClass", "tooltipPlacement", "maxLength"];
|
|
26
26
|
/* eslint-disable */
|
|
27
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
28
|
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); }
|
|
@@ -75,7 +75,8 @@ function ApprovalWidget(_ref) {
|
|
|
75
75
|
"data-test": dataTest,
|
|
76
76
|
form,
|
|
77
77
|
columnDynamicCssClass,
|
|
78
|
-
tooltipPlacement
|
|
78
|
+
tooltipPlacement,
|
|
79
|
+
maxLength
|
|
79
80
|
} = _ref,
|
|
80
81
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
81
82
|
const getInitialValue = isApproved => {
|
|
@@ -183,12 +184,17 @@ function ApprovalWidget(_ref) {
|
|
|
183
184
|
}, "Remarks"), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
184
185
|
name: "remarks-".concat(questionId),
|
|
185
186
|
initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks : "",
|
|
186
|
-
rules: isRequired
|
|
187
|
+
rules: [isRequired && {
|
|
187
188
|
required: true,
|
|
188
189
|
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
189
190
|
"data-test": "".concat(dataTest, "--remarks-validation-message")
|
|
190
191
|
}, "Remarks cannot be empty.") : "Remarks cannot be empty."
|
|
191
|
-
}
|
|
192
|
+
}, maxLength && {
|
|
193
|
+
max: maxLength,
|
|
194
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
195
|
+
"data-test": "".concat(dataTest, "--remarks-maxlength-validation-message")
|
|
196
|
+
}, "Remarks cannot exceed ".concat(maxLength, " characters.")) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "Remarks cannot exceed ".concat(maxLength, " characters."))
|
|
197
|
+
}]
|
|
192
198
|
}, /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
|
|
193
199
|
"data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
|
|
194
200
|
disabled: (_approvalForm$disable3 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable3 !== void 0 ? _approvalForm$disable3 : false
|
|
@@ -197,20 +203,20 @@ function ApprovalWidget(_ref) {
|
|
|
197
203
|
|
|
198
204
|
/**
|
|
199
205
|
* BUSINESS LOGIC: Two different radio implementations exist for different approval scenarios
|
|
200
|
-
*
|
|
206
|
+
*
|
|
201
207
|
* "radio" - MANDATORY APPROVAL: Always requires user to select approval status
|
|
202
208
|
* - Used when approval decision is compulsory (e.g., critical business processes)
|
|
203
209
|
* - Both approval status AND remarks (if pending) are mandatory
|
|
204
210
|
* - Cannot proceed without making a selection
|
|
205
|
-
*
|
|
211
|
+
*
|
|
206
212
|
* "radioOptional" - OPTIONAL APPROVAL: Approval status depends on isMandatory flag
|
|
207
213
|
* - Used when approval might be optional based on business rules
|
|
208
214
|
* - If isMandatory=true: Same behavior as "radio" (mandatory)
|
|
209
215
|
* - If isMandatory=false: User can skip approval selection
|
|
210
216
|
* - Provides flexibility for different approval workflows
|
|
211
|
-
*
|
|
217
|
+
*
|
|
212
218
|
* This separation allows the same component to handle both strict and flexible approval processes
|
|
213
|
-
*
|
|
219
|
+
*
|
|
214
220
|
* Renders the approval section based on action render type
|
|
215
221
|
* @returns {React.ReactNode} Approval section component
|
|
216
222
|
*/
|
|
@@ -380,16 +386,22 @@ function ApprovalWidget(_ref) {
|
|
|
380
386
|
validateStatus: form.getFieldError("icQues_remarks_".concat(questionId)) ? "error" : "",
|
|
381
387
|
help: form.getFieldError("icQues_remarks_".concat(questionId)) || ""
|
|
382
388
|
}, getFieldDecorator("icQues_remarks_".concat(questionId), {
|
|
383
|
-
rules: isMandatory
|
|
389
|
+
rules: [isMandatory && {
|
|
384
390
|
required: true,
|
|
385
391
|
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
386
392
|
"data-test": "".concat(dataTest, "--remarks-validation-message")
|
|
387
393
|
}, "Remarks cannot be empty.") : "Remarks cannot be empty."
|
|
388
|
-
}
|
|
394
|
+
}, maxLength && {
|
|
395
|
+
max: maxLength,
|
|
396
|
+
message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
|
|
397
|
+
"data-test": "".concat(dataTest, "--remarks-maxlength-validation-message")
|
|
398
|
+
}, "Remarks cannot exceed ".concat(maxLength, " characters.")) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "Remarks cannot exceed ".concat(maxLength, " characters."))
|
|
399
|
+
}],
|
|
389
400
|
initialValue: (_approvalForm$remarks2 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks2 !== void 0 ? _approvalForm$remarks2 : ""
|
|
390
401
|
})( /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
|
|
391
402
|
"data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
|
|
392
|
-
disabled: (_approvalForm$disable10 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable10 !== void 0 ? _approvalForm$disable10 : false
|
|
403
|
+
disabled: (_approvalForm$disable10 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable10 !== void 0 ? _approvalForm$disable10 : false,
|
|
404
|
+
maxLength: maxLength
|
|
393
405
|
}))))), actionRenderType === "buttonWithFormV4" && /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
394
406
|
name: "validateDocumentButton#".concat(questionId),
|
|
395
407
|
initialValue: approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.isApproved,
|