oa-componentbook 1.0.1-stage.65 → 1.0.1-stage.66

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.
@@ -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", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "actionRenderType", "actionContent", "systemStatus", "documentTitle", "descriptionTitle", "data-test"];
25
+ const _excluded = ["children", "description", "docDetails", "approvalForm", "isMandatory", "hasDivider", "isQuestionStyleWidget", "questionId", "title", "viewOnClick", "actionRenderType", "actionContent", "systemStatus", "documentTitle", "descriptionTitle", "data-test", "form"];
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); }
@@ -71,7 +71,8 @@ function ApprovalWidget(_ref) {
71
71
  systemStatus,
72
72
  documentTitle,
73
73
  descriptionTitle,
74
- "data-test": dataTest
74
+ "data-test": dataTest,
75
+ form
75
76
  } = _ref,
76
77
  props = _objectWithoutProperties(_ref, _excluded);
77
78
  const getInitialValue = isApproved => {
@@ -85,6 +86,7 @@ function ApprovalWidget(_ref) {
85
86
  }
86
87
  };
87
88
  const [isApproved, setIsApproved] = (0, _react.useState)(getInitialValue(approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.isApproved));
89
+ const getFieldDecorator = form === null || form === void 0 ? void 0 : form.getFieldDecorator;
88
90
  const onRadioChange = event => setIsApproved(event.target.value);
89
91
  return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, null, /*#__PURE__*/_react.default.createElement("div", {
90
92
  className: "row"
@@ -207,13 +209,24 @@ function ApprovalWidget(_ref) {
207
209
  }, /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
208
210
  "data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
209
211
  disabled: (_approvalForm$disable4 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable4 !== void 0 ? _approvalForm$disable4 : false
210
- })))), actionRenderType === "buttonWithForm" && /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
211
- name: "validateDocumentButton#".concat(questionId),
212
- rules: isMandatory ? [{
212
+ })))), actionRenderType === "buttonWithForm" &&
213
+ /*#__PURE__*/
214
+ // <Form.Item
215
+ // name={`validateDocumentButton#${questionId}`}
216
+ // rules={
217
+ // isMandatory
218
+ // ? [{ required: true, message: "Reason is required" }]
219
+ // : []
220
+ // }
221
+ // >
222
+ //
223
+ // </Form.Item>
224
+ _react.default.createElement(_antd.Form.Item, null, getFieldDecorator("validateDocumentButton#".concat(questionId), {
225
+ rules: [{
213
226
  required: true,
214
- message: "Reason is required"
215
- }] : []
216
- }, /*#__PURE__*/_react.default.createElement(_CustomButton.default, actionContent))) || undefined), hasDivider && /*#__PURE__*/_react.default.createElement(_antd.Divider, null));
227
+ message: "This field is required"
228
+ }]
229
+ })( /*#__PURE__*/_react.default.createElement(_CustomButton.default, actionContent)))) || undefined), hasDivider && /*#__PURE__*/_react.default.createElement(_antd.Divider, null));
217
230
  }
218
231
  ApprovalWidget.propTypes = {
219
232
  children: _propTypes.default.node,
@@ -254,7 +267,8 @@ ApprovalWidget.propTypes = {
254
267
  title: _propTypes.default.string
255
268
  })),
256
269
  documentTitle: _propTypes.default.string,
257
- descriptionTitle: _propTypes.default.string
270
+ descriptionTitle: _propTypes.default.string,
271
+ form: _propTypes.default.object
258
272
  };
259
273
  ApprovalWidget.defaultProps = {
260
274
  children: null,
@@ -270,6 +284,7 @@ ApprovalWidget.defaultProps = {
270
284
  actionContent: {},
271
285
  systemStatus: [],
272
286
  documentTitle: "",
273
- descriptionTitle: ""
287
+ descriptionTitle: "",
288
+ form: null
274
289
  };
275
290
  var _default = exports.default = ApprovalWidget;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "1.0.1-stage.65",
3
+ "version": "1.0.1-stage.66",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",