@digitalc/drm-dxp-package 0.0.7 → 0.0.8

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.
@@ -24,19 +24,23 @@ const BasicInfo = props => {
24
24
  const [taxCodeList, setTaxCodeList] = React.useState([]);
25
25
  const [regNumData, setRegNumData] = React.useState({});
26
26
 
27
- const ruleList = basicInfoCom.find(item => item.componentCode === 'COMMON_PARTNER_BRN')?.componentValidateRuleList || [];
28
- const serveUrl = ruleList?.find(item => item.validateType === 'S')?.validateRule;
29
- const ruleBrn = ruleList.find(item => item.validateType === 'R')?.validateRule || '';
27
+ const foundBrnComponent = basicInfoCom.find(item => item.componentCode === 'COMMON_PARTNER_BRN');
28
+ const ruleList = foundBrnComponent && foundBrnComponent.componentValidateRuleList || [];
29
+ // validateType=R表示正则表达式,S表示接口服务,L表示长度校验
30
+ const foundSRule = ruleList.find(item => item.validateType === 'S');
31
+ const serveUrl = foundSRule && foundSRule.validateRule;
32
+ const foundRRule = ruleList.find(item => item.validateType === 'R');
33
+ const ruleBrn = foundRRule && foundRRule.validateRule || '';
30
34
 
31
35
  React.useEffect(() => {
32
36
  setInfoData(isNew ? subBaseInfoData : orgBaseInfoDetails);
33
37
  }, [JSON.stringify(subBaseInfoData), JSON.stringify(orgBaseInfoDetails)]);
34
38
 
35
39
  React.useEffect(() => {
36
- if (selectedOwner?.orgSubtype) {
40
+ if (selectedOwner && selectedOwner.orgSubtype) {
37
41
  dispatch({
38
42
  type: 'partner360/qryChannelTypeByParentId',
39
- payload: { channelTypeCode: selectedOwner?.orgSubtype },
43
+ payload: { channelTypeCode: selectedOwner && selectedOwner.orgSubtype },
40
44
  });
41
45
  }
42
46
  dispatch({
@@ -50,22 +54,22 @@ const BasicInfo = props => {
50
54
  }).then(res => {
51
55
  setTaxCodeList(res);
52
56
  });
53
- }, [selectedOwner?.orgSubtype]);
57
+ }, [selectedOwner && selectedOwner.orgSubtype]);
54
58
 
55
59
  React.useEffect(() => {
56
60
  if (partnerStatus === PARTNER_STATUS.NEW && getFieldValue('orgSubtype')) {
57
61
  dispatch({
58
62
  type: 'partner360/queryFormConfigList',
59
- payload: getFieldValue('orgSubtype') ?? '',
63
+ payload: getFieldValue('orgSubtype') || '',
60
64
  });
61
65
  }
62
- if (orgBaseInfoDetails?.orgSubtype) {
66
+ if (orgBaseInfoDetails && orgBaseInfoDetails.orgSubtype) {
63
67
  dispatch({
64
68
  type: 'partner360/queryFormConfigList',
65
- payload: orgBaseInfoDetails?.orgSubtype ?? '',
69
+ payload: (orgBaseInfoDetails && orgBaseInfoDetails.orgSubtype) || '',
66
70
  });
67
71
  }
68
- }, [getFieldValue('orgSubtype'), orgBaseInfoDetails?.orgSubtype]);
72
+ }, [getFieldValue('orgSubtype'), orgBaseInfoDetails && orgBaseInfoDetails.orgSubtype]);
69
73
 
70
74
  React.useEffect(() => {
71
75
  switch (partnerStatus) {
@@ -96,16 +100,16 @@ const BasicInfo = props => {
96
100
  payload: {
97
101
  ownerInformationError: {
98
102
  ...ownerInformationError,
99
- [data?.key]: {
100
- message: resp?.code === '200' ? '' : resp?.message || formatLocalMessage('SYSTEM_ERROR'),
103
+ [data && data.key]: {
104
+ message: (resp && resp.code === '200') ? '' : (resp && resp.message) || formatLocalMessage('SYSTEM_ERROR'),
101
105
  },
102
106
  },
103
107
  },
104
108
  });
105
- if (resp?.code !== '200') {
109
+ if (resp && resp.code !== '200') {
106
110
  return {
107
111
  validateStatus: 'error',
108
- help: resp?.message,
112
+ help: resp && resp.message,
109
113
  };
110
114
  }
111
115
  return {
@@ -117,7 +121,7 @@ const BasicInfo = props => {
117
121
  const changeRegNbr = async (val, ruleAll, isQry, rule) => {
118
122
  const msg = validatorRule(val, ruleAll || brnPattern, 'ESALES_ITEM_RULES_BRN_TIPS', false, rule);
119
123
  setRegNumData(msg);
120
- if (msg?.validateStatus === 'error') {
124
+ if (msg && msg.validateStatus === 'error') {
121
125
  return;
122
126
  }
123
127
  const data = { key: 'regNum', regNum: val, regType: getFieldValue('regType'), orgId: orgBaseInfoDetails.orgId };
@@ -189,14 +193,15 @@ const BasicInfo = props => {
189
193
  xs: 24,
190
194
  };
191
195
 
196
+ // list
192
197
  const FORM_LIST = {
193
- COMMON_PARTNER_PARENT: selectedOwner?.orgName ? {
198
+ COMMON_PARTNER_PARENT: (selectedOwner && selectedOwner.orgName) ? {
194
199
  index: 1,
195
200
  components: com => (
196
201
  <Col {...colConfig}>
197
202
  <Form.Item label={formatLocalMessage('PARTNER_PARENT')}>
198
203
  {getFieldDecorator('parentOrgId', {
199
- initialValue: selectedOwner?.orgName,
204
+ initialValue: selectedOwner && selectedOwner.orgName,
200
205
  rules: [
201
206
  {
202
207
  required: com.required === 'Y',
@@ -225,7 +230,7 @@ const BasicInfo = props => {
225
230
  <Col {...colConfig}>
226
231
  <Form.Item label={formatLocalMessage('PARTNER_NAME')}>
227
232
  {getFieldDecorator('orgName', {
228
- initialValue: infoData?.orgName || null,
233
+ initialValue: infoData && infoData.orgName || null,
229
234
  rules: [
230
235
  {
231
236
  required: com.required === 'Y',
@@ -248,7 +253,7 @@ const BasicInfo = props => {
248
253
  <Col {...colConfig}>
249
254
  <Form.Item label={formatLocalMessage('PARTNER_CODE')}>
250
255
  {getFieldDecorator('orgCode', {
251
- initialValue: infoData?.orgCode || null,
256
+ initialValue: infoData && infoData.orgCode || null,
252
257
  rules: [
253
258
  {
254
259
  required: com.required === 'Y',
@@ -266,7 +271,7 @@ const BasicInfo = props => {
266
271
  <Col {...colConfig}>
267
272
  <Form.Item label={formatLocalMessage('PARTNER_CATEGORY')}>
268
273
  {getFieldDecorator('channelCategoryName', {
269
- initialValue: selectedOwner?.channelCategoryName || infoData?.channelCategoryName || null,
274
+ initialValue: (selectedOwner && selectedOwner.channelCategoryName) || (infoData && infoData.channelCategoryName) || null,
270
275
  rules: [
271
276
  {
272
277
  required: com.required === 'Y',
@@ -286,8 +291,8 @@ const BasicInfo = props => {
286
291
  {getFieldDecorator('orgSubtype', {
287
292
  initialValue: (
288
293
  partnerStatus === PARTNER_STATUS.NEW
289
- ? infoData?.orgSubtype || channelTypeList[0]?.channelTypeCode
290
- : infoData?.orgSubtypeName
294
+ ? (infoData && infoData.orgSubtype) || (channelTypeList[0] && channelTypeList[0].channelTypeCode)
295
+ : (infoData && infoData.orgSubtypeName)
291
296
  ),
292
297
  rules: [
293
298
  {
@@ -319,7 +324,7 @@ const BasicInfo = props => {
319
324
  <Col {...colConfig}>
320
325
  <Form.Item label={formatLocalMessage('PARTNER_REGISTER_TYPE')}>
321
326
  {getFieldDecorator('regType', {
322
- initialValue: infoData?.regType || null,
327
+ initialValue: infoData && infoData.regType || null,
323
328
  rules: [
324
329
  {
325
330
  required: com.required === 'Y',
@@ -361,7 +366,7 @@ const BasicInfo = props => {
361
366
  )}
362
367
  >
363
368
  {getFieldDecorator('regNum', {
364
- initialValue: infoData?.regNum || null,
369
+ initialValue: infoData && infoData.regNum || null,
365
370
  rules: [
366
371
  {
367
372
  required: com.required === 'Y',
@@ -390,7 +395,7 @@ const BasicInfo = props => {
390
395
  <Col {...colConfig}>
391
396
  <Form.Item label={formatLocalMessage('PARTNER_STATUS')}>
392
397
  {getFieldDecorator('statusCd', {
393
- initialValue: PARTNER_HIERARCHY_STATUS[infoData?.statusCd]?.label || null,
398
+ initialValue: infoData && infoData.statusCd && PARTNER_HIERARCHY_STATUS[infoData.statusCd] && PARTNER_HIERARCHY_STATUS[infoData.statusCd].label || null,
394
399
  rules: [
395
400
  {
396
401
  required: com.required === 'Y',
@@ -409,7 +414,7 @@ const BasicInfo = props => {
409
414
  <Form.Item label={formatLocalMessage('PARTNER_CREATED_DATE')}>
410
415
  {getFieldDecorator('createDate', {
411
416
  initialValue: (
412
- infoData?.createDate && moment(infoData?.createDate, DEFAULT_DATE_TABLE_FORMAT).format(DRM_DATETIME_FORMAT_UI_NEW)
417
+ infoData && infoData.createDate && moment(infoData.createDate, DEFAULT_DATE_TABLE_FORMAT).format(DRM_DATETIME_FORMAT_UI_NEW)
413
418
  ) || null,
414
419
  rules: [
415
420
  {
@@ -428,7 +433,7 @@ const BasicInfo = props => {
428
433
  <Col {...colConfig}>
429
434
  <Form.Item label={formatLocalMessage('PARTNER_TAX_CODE')}>
430
435
  {getFieldDecorator('taxCode', {
431
- initialValue: infoData?.taxCode || null,
436
+ initialValue: infoData && infoData.taxCode || null,
432
437
  rules: [
433
438
  {
434
439
  required: com.required === 'Y',
@@ -460,7 +465,7 @@ const BasicInfo = props => {
460
465
  label={formatLocalMessage('PARTNER_TIN_ID')}
461
466
  >
462
467
  {getFieldDecorator('tinId', {
463
- initialValue: infoData?.tinId || null,
468
+ initialValue: infoData && infoData.tinId || null,
464
469
  rules: [
465
470
  {
466
471
  required: com.required === 'Y',
@@ -481,9 +486,9 @@ const BasicInfo = props => {
481
486
  <Row gutter={24}>
482
487
  {basicInfoCom.map((item, index) => {
483
488
  if ((index + 1) % 3 === 0) {
484
- return <>{FORM_LIST?.[item.componentCode]?.components(item)}<div style={{ clear: 'both' }} /></>;
489
+ return <>{FORM_LIST && FORM_LIST[item.componentCode] && FORM_LIST[item.componentCode].components(item)}<div style={{ clear: 'both' }} /></>;
485
490
  }
486
- return FORM_LIST?.[item.componentCode]?.components(item);
491
+ return FORM_LIST && FORM_LIST[item.componentCode] && FORM_LIST[item.componentCode].components(item);
487
492
  })}
488
493
  </Row>
489
494
  <ParentSelect clearOrgSubtype={clearOrgSubtype} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalc/drm-dxp-package",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "files": [