oa-componentbook 1.0.1-stage.62 → 1.0.1-stage.64

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.
@@ -10,4 +10,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
10
10
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
11
  const ButtonContainer = exports.ButtonContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n justify-content: flex-end;\n margin: 24px 0 0;\n @media (max-width: 768px) {\n justify-content: space-between;\n button{\n width: 100%;\n }\n }\n"])));
12
12
  const DescriptionContainer = exports.DescriptionContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 12px 0 0;\n"])));
13
- const TitleContainer = exports.TitleContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n flex-direction: column;\n margin: 0 0 16px;\n\n img {\n height: 36px;\n width: 36px;\n }\n"])));
13
+ const TitleContainer = exports.TitleContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n flex-direction: column;\n margin: 0 0 16px;\n padding: 0 42px 0 0;\n\n img {\n height: 36px;\n width: 36px;\n }\n"])));
package/build/index.js CHANGED
@@ -125,6 +125,12 @@ Object.defineProperty(exports, "CustomDetails", {
125
125
  return _CustomDetails.default;
126
126
  }
127
127
  });
128
+ Object.defineProperty(exports, "CustomDocumentViewer", {
129
+ enumerable: true,
130
+ get: function get() {
131
+ return _CustomDocumentViewer.default;
132
+ }
133
+ });
128
134
  Object.defineProperty(exports, "CustomDrawer", {
129
135
  enumerable: true,
130
136
  get: function get() {
@@ -680,6 +686,7 @@ var _CustomTimeline2 = _interopRequireDefault(require("./dev/oa-component-timeli
680
686
  var _DocUploadCardWidget2 = _interopRequireDefault(require("./dev/oa-widget-document-upload-card/DocUploadCardWidget"));
681
687
  var _CustomUpload2 = _interopRequireDefault(require("./dev/oa-component-upload/CustomUpload"));
682
688
  var _DocumentSideDrawer = _interopRequireDefault(require("./dev/oa-widget-document-side-drawer/DocumentSideDrawer"));
689
+ var _CustomDocumentViewer = _interopRequireDefault(require("./dev/oa-component-document-viewer/CustomDocumentViewer"));
683
690
  var _PaymentAndConsent = _interopRequireDefault(require("./layout/paymentAndConsent/PaymentAndConsent"));
684
691
  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); }
685
692
  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; }
@@ -11,6 +11,7 @@ require("core-js/modules/es.array.includes.js");
11
11
  require("core-js/modules/es.string.includes.js");
12
12
  require("core-js/modules/es.regexp.exec.js");
13
13
  require("core-js/modules/es.regexp.test.js");
14
+ require("core-js/modules/es.parse-int.js");
14
15
  require("core-js/modules/es.array.reduce.js");
15
16
  var _react = _interopRequireWildcard(require("react"));
16
17
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -156,19 +157,23 @@ function AddSparePartCollapseWidget(_ref) {
156
157
  */
157
158
  const onFieldChange = (itemId, field, value) => {
158
159
  if (field === 'hsnId' || isNumeric(value)) {
159
- // Bypass numeric check for HSN Code
160
+ if (field === 'discount') {
161
+ var _formValues$itemId;
162
+ if (parseInt((_formValues$itemId = formValues[itemId]) === null || _formValues$itemId === void 0 ? void 0 : _formValues$itemId.cost, 10) < parseInt(value, 10)) {
163
+ openNotification({
164
+ title: 'Error',
165
+ description: 'Discount cannot be greater than Cost.',
166
+ type: 'failure'
167
+ });
168
+ return;
169
+ }
170
+ }
160
171
  const updatedFormValues = _objectSpread(_objectSpread({}, formValues), {}, {
161
172
  [itemId]: _objectSpread(_objectSpread({}, formValues[itemId]), {}, {
162
173
  [field]: value
163
174
  })
164
175
  });
165
176
  setFormValues(updatedFormValues);
166
- } else {
167
- // openNotification({
168
- // title: 'Error',
169
- // description: 'Please enter only numeric values 146.',
170
- // type: 'failure',
171
- // });
172
177
  }
173
178
  };
174
179
 
@@ -71,7 +71,7 @@ function ApprovalWidget(_ref) {
71
71
  systemStatus,
72
72
  documentTitle,
73
73
  descriptionTitle,
74
- 'data-test': dataTest
74
+ "data-test": dataTest
75
75
  } = _ref,
76
76
  props = _objectWithoutProperties(_ref, _excluded);
77
77
  const getInitialValue = isApproved => {
@@ -89,11 +89,11 @@ function ApprovalWidget(_ref) {
89
89
  return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, null, /*#__PURE__*/_react.default.createElement("div", {
90
90
  className: "row"
91
91
  }, /*#__PURE__*/_react.default.createElement("div", {
92
- className: approvalForm.hidden ? 'col-sm-12 col-md-12 col-lg-12' : 'col-sm-12 col-md-7 col-lg-7 gutter'
92
+ className: approvalForm.hidden ? "col-sm-12 col-md-12 col-lg-12" : "col-sm-12 col-md-7 col-lg-7 gutter"
93
93
  }, /*#__PURE__*/_react.default.createElement("div", {
94
94
  className: "row"
95
95
  }, /*#__PURE__*/_react.default.createElement("div", {
96
- className: isQuestionStyleWidget ? 'col-sm-12 col-md-12 col-lg-12' : 'col-sm-12 col-md-9 col-lg-9 gutter flexCol12'
96
+ className: isQuestionStyleWidget ? "col-sm-12 col-md-12 col-lg-12" : "col-sm-12 col-md-9 col-lg-9 gutter flexCol12"
97
97
  }, title && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", {
98
98
  className: "type-b2-400"
99
99
  }, title, isMandatory && /*#__PURE__*/_react.default.createElement(_styles.RedText, null, "*"))), description && /*#__PURE__*/_react.default.createElement(_styles.Styledescription, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
@@ -107,7 +107,7 @@ function ApprovalWidget(_ref) {
107
107
  }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
108
108
  typography: "type-b2-400",
109
109
  color: "secondary-content"
110
- }, documentTitle, ' ', "\xA0"), /*#__PURE__*/_react.default.createElement(_UploadDownloadWidget.default, _extends({
110
+ }, documentTitle, " \xA0"), /*#__PURE__*/_react.default.createElement(_UploadDownloadWidget.default, _extends({
111
111
  disabled: (_approvalForm$disable = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable !== void 0 ? _approvalForm$disable : false,
112
112
  "data-test": dataTest ? "".concat(dataTest, "--upload-download-widget") : undefined
113
113
  }, docDetails, {
@@ -117,15 +117,15 @@ function ApprovalWidget(_ref) {
117
117
  "data-test": dataTest ? "".concat(dataTest, "--view-button") : undefined,
118
118
  onClick: () => viewOnClick(questionId),
119
119
  type: "text-only",
120
- label: isQuestionStyleWidget ? 'View Previous Description' : 'View History'
120
+ label: isQuestionStyleWidget ? "View Previous Description" : "View History"
121
121
  }), children)), !isQuestionStyleWidget && /*#__PURE__*/_react.default.createElement("div", {
122
122
  className: "col-sm-12 col-md-3 col-lg-3 flexCol8"
123
123
  }, systemStatus === null || systemStatus === void 0 ? void 0 : systemStatus.map(status => {
124
124
  var _status$items;
125
- return /*#__PURE__*/_react.default.createElement("div", null, status.renderType === 'text' && /*#__PURE__*/_react.default.createElement(_Typography.default, {
125
+ return /*#__PURE__*/_react.default.createElement("div", null, status.renderType === "text" && /*#__PURE__*/_react.default.createElement(_Typography.default, {
126
126
  typography: "type-b2-400",
127
127
  color: "secondary-content"
128
- }, status.label), status.renderType === 'tag' && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomTag.default, status)), status.renderType === 'toolTip' && ((_status$items = status.items) === null || _status$items === void 0 ? void 0 : _status$items.length) > 0 && /*#__PURE__*/_react.default.createElement(_CustomTooltip.default, {
128
+ }, status.label), status.renderType === "tag" && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomTag.default, status)), status.renderType === "toolTip" && ((_status$items = status.items) === null || _status$items === void 0 ? void 0 : _status$items.length) > 0 && /*#__PURE__*/_react.default.createElement(_CustomTooltip.default, {
129
129
  overlayClassName: "multipleDocumentTooltip",
130
130
  isDisplayed: true,
131
131
  title: (() => {
@@ -148,8 +148,8 @@ function ApprovalWidget(_ref) {
148
148
  className: "tooltip-item"
149
149
  }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
150
150
  size: 20,
151
- icon: item.type === 'positive' ? _Check.default : _Close.default,
152
- color: item.type === 'positive' ? 'positive' : 'negative'
151
+ icon: item.type === "positive" ? _Check.default : _Close.default,
152
+ color: item.type === "positive" ? "positive" : "negative"
153
153
  }), item.title)));
154
154
  }));
155
155
  })()
@@ -159,7 +159,7 @@ function ApprovalWidget(_ref) {
159
159
  })));
160
160
  })))), approvalForm.invisible && /*#__PURE__*/_react.default.createElement("div", {
161
161
  className: "col-sm-12 col-md-5 col-lg-5"
162
- }) || !approvalForm.hidden && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, actionRenderType === 'text' && /*#__PURE__*/_react.default.createElement("div", {
162
+ }) || !approvalForm.hidden && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, actionRenderType === "text" && /*#__PURE__*/_react.default.createElement("div", {
163
163
  className: "oaActionText"
164
164
  }, (actionContent === null || actionContent === void 0 ? void 0 : actionContent.icon) && /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
165
165
  icon: _CheckCircle.default,
@@ -167,7 +167,7 @@ function ApprovalWidget(_ref) {
167
167
  }), /*#__PURE__*/_react.default.createElement(_Typography.default, {
168
168
  typography: "type-b2-400",
169
169
  color: "secondary-content"
170
- }, (_actionContent$label = actionContent === null || actionContent === void 0 ? void 0 : actionContent.label) !== null && _actionContent$label !== void 0 ? _actionContent$label : '-')), actionRenderType === 'button' && /*#__PURE__*/_react.default.createElement(_CustomButton.default, actionContent), actionRenderType === 'radio' && /*#__PURE__*/_react.default.createElement("div", {
170
+ }, (_actionContent$label = actionContent === null || actionContent === void 0 ? void 0 : actionContent.label) !== null && _actionContent$label !== void 0 ? _actionContent$label : "-")), actionRenderType === "button" && /*#__PURE__*/_react.default.createElement(_CustomButton.default, actionContent), actionRenderType === "radio" && /*#__PURE__*/_react.default.createElement("div", {
171
171
  className: "col-sm-12 col-md-5 col-lg-5"
172
172
  }, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
173
173
  name: "isApproved-".concat(questionId),
@@ -177,7 +177,7 @@ function ApprovalWidget(_ref) {
177
177
  required: true,
178
178
  message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
179
179
  "data-test": "".concat(dataTest, "--is-approved-validation-message")
180
- }, "Approval status needs to be selected.") : 'Approval status needs to be selected.'
180
+ }, "Approval status needs to be selected.") : "Approval status needs to be selected."
181
181
  }]
182
182
  }, /*#__PURE__*/_react.default.createElement(_CustomRadio.default.Group, {
183
183
  "data-test": dataTest ? "".concat(dataTest, "--is-approved-radio-group") : undefined,
@@ -197,21 +197,27 @@ function ApprovalWidget(_ref) {
197
197
  className: "type-b2-400"
198
198
  }, "Remarks"), /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
199
199
  name: "remarks-".concat(questionId),
200
- initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks : '',
200
+ initialValue: (_approvalForm$remarks = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.remarks) !== null && _approvalForm$remarks !== void 0 ? _approvalForm$remarks : "",
201
201
  rules: [{
202
202
  required: true,
203
203
  message: dataTest ? /*#__PURE__*/_react.default.createElement("span", {
204
204
  "data-test": "".concat(dataTest, "--remarks-validation-message")
205
- }, "Remarks cannot be empty.") : 'Remarks cannot be empty.'
205
+ }, "Remarks cannot be empty.") : "Remarks cannot be empty."
206
206
  }]
207
207
  }, /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, {
208
208
  "data-test": dataTest ? "".concat(dataTest, "--remarks") : undefined,
209
209
  disabled: (_approvalForm$disable4 = approvalForm === null || approvalForm === void 0 ? void 0 : approvalForm.disabled) !== null && _approvalForm$disable4 !== void 0 ? _approvalForm$disable4 : false
210
- }))))) || undefined), hasDivider && /*#__PURE__*/_react.default.createElement(_antd.Divider, null));
210
+ })))), actionRenderType === "buttonWithForm" && /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
211
+ name: "validateDocumentButton#".concat(questionId),
212
+ rules: isMandatory ? [{
213
+ 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));
211
217
  }
212
218
  ApprovalWidget.propTypes = {
213
219
  children: _propTypes.default.node,
214
- 'data-test': _propTypes.default.string,
220
+ "data-test": _propTypes.default.string,
215
221
  description: _propTypes.default.string,
216
222
  // Leave description optional
217
223
  docDetails: _propTypes.default.shape({
@@ -252,8 +258,8 @@ ApprovalWidget.propTypes = {
252
258
  };
253
259
  ApprovalWidget.defaultProps = {
254
260
  children: null,
255
- 'data-test': undefined,
256
- description: '',
261
+ "data-test": undefined,
262
+ description: "",
257
263
  docDetails: {},
258
264
  approvalForm: {},
259
265
  isMandatory: false,
@@ -263,7 +269,7 @@ ApprovalWidget.defaultProps = {
263
269
  actionRenderType: undefined,
264
270
  actionContent: {},
265
271
  systemStatus: [],
266
- documentTitle: '',
267
- descriptionTitle: ''
272
+ documentTitle: "",
273
+ descriptionTitle: ""
268
274
  };
269
275
  var _default = exports.default = ApprovalWidget;
@@ -76,7 +76,8 @@ function NotesWidget(_ref) {
76
76
  value: noteInputValue,
77
77
  onChange: event => setNoteInputValue(event.target.value),
78
78
  onBlur: handleBlur,
79
- placeholder: "Type here .."
79
+ placeholder: "Type here ..",
80
+ maxLength: 500
80
81
  });
81
82
  }
82
83
  return /*#__PURE__*/_react.default.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "1.0.1-stage.62",
3
+ "version": "1.0.1-stage.64",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",