@zohodesk/dot 1.0.0-temp-229.2 → 1.0.0-temp-230.1
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/README.md +7 -5
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +0 -3
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +0 -3
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +0 -3
- package/es/AttachmentViewer/AttachmentViewer.js +115 -23
- package/es/AttachmentViewer/AttachmentViewer.module.css +1 -1
- package/es/AttachmentViewer/props/defaultProps.js +2 -1
- package/es/AttachmentViewer/props/propTypes.js +3 -1
- package/es/Link/Link.js +4 -3
- package/es/Link/props/propTypes.js +1 -0
- package/es/common/dot_boxShadow.module.css +0 -2
- package/es/form/fields/SelectField/SelectField.js +2 -4
- package/es/form/fields/SelectField/props/defaultProps.js +0 -1
- package/es/form/fields/SelectField/props/propTypes.js +0 -1
- package/es/list/status/StatusDropdown/StatusDropdown.js +79 -121
- package/es/list/status/StatusDropdown/StatusDropdown.module.css +7 -54
- package/es/list/status/StatusDropdown/props/defaultProps.js +1 -2
- package/es/list/status/StatusDropdown/props/propTypes.js +1 -2
- package/lib/AttachmentViewer/AttachmentViewer.js +177 -80
- package/lib/AttachmentViewer/AttachmentViewer.module.css +1 -1
- package/lib/AttachmentViewer/props/defaultProps.js +2 -1
- package/lib/AttachmentViewer/props/propTypes.js +3 -1
- package/lib/Link/Link.js +4 -3
- package/lib/Link/props/propTypes.js +1 -0
- package/lib/common/dot_boxShadow.module.css +0 -2
- package/lib/form/fields/SelectField/SelectField.js +2 -4
- package/lib/form/fields/SelectField/props/defaultProps.js +0 -1
- package/lib/form/fields/SelectField/props/propTypes.js +0 -1
- package/lib/list/status/StatusDropdown/StatusDropdown.js +81 -133
- package/lib/list/status/StatusDropdown/StatusDropdown.module.css +7 -54
- package/lib/list/status/StatusDropdown/props/defaultProps.js +1 -2
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,12 +4,13 @@ In this Library, we Provide Some Basic Components to Build Your Application
|
|
|
4
4
|
|
|
5
5
|
# 1.9.13
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- Added
|
|
9
|
-
-
|
|
7
|
+
- **AttachmentViewer**
|
|
8
|
+
- Added support for updating existing attachment list items.
|
|
9
|
+
- Increased header bar height.
|
|
10
|
+
- Added support for `showCount`, `renderCustomIcons`, annotation URL re-rendering, and `downloadName`.
|
|
10
11
|
|
|
11
|
-
- **
|
|
12
|
-
- Added `
|
|
12
|
+
- **Link**
|
|
13
|
+
- Added `downloadName` prop for custom file download names.
|
|
13
14
|
|
|
14
15
|
# 1.9.12
|
|
15
16
|
|
|
@@ -35,6 +36,7 @@ In this Library, we Provide Some Basic Components to Build Your Application
|
|
|
35
36
|
|
|
36
37
|
- PX to variable conversion was not applied due to the CBT migration. The issue has now been fixed.
|
|
37
38
|
|
|
39
|
+
|
|
38
40
|
# 1.9.8
|
|
39
41
|
|
|
40
42
|
- **DotProvider** - Variables package handled and separated the component & variable import files
|
|
@@ -259,9 +259,6 @@
|
|
|
259
259
|
|
|
260
260
|
/* status dropdown */
|
|
261
261
|
--zdt_statusdropdown_line_border:var(--zdt_cta_grey_15_border);
|
|
262
|
-
--zdt_statusdropdown_wrapper_container_border:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(100.00% + var(--zdc_default_inverse_low)), calc( 0.2 + var(--zdc_alpha_low)));
|
|
263
|
-
--zdt_statusdropdown_wrapper_container_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), 100.00%, 0.03);
|
|
264
|
-
--zdt_statusdropdown_wrapper_dropdown_bg:hsla(217, calc(var(--zd-saturation, 1) * 23.08%), calc(17.84% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
265
262
|
|
|
266
263
|
/* status listitem */
|
|
267
264
|
--zdt_statuslistitem_list_text:hsla(210, calc(var(--zd-saturation, 1) * 7.41%), calc(89.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
@@ -259,9 +259,6 @@
|
|
|
259
259
|
|
|
260
260
|
/* status dropdown */
|
|
261
261
|
--zdt_statusdropdown_line_border:var(--zdt_cta_grey_15_border);
|
|
262
|
-
--zdt_statusdropdown_wrapper_container_border:hsla(218, calc(var(--zd-saturation, 1) * 42.22%), calc(91.18% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
263
|
-
--zdt_statusdropdown_wrapper_container_bg:hsla(216, calc(var(--zd-saturation, 1) * 38.46%), 97.45%, 1);
|
|
264
|
-
--zdt_statusdropdown_wrapper_dropdown_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(100.00% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
265
262
|
|
|
266
263
|
/* status listitem */
|
|
267
264
|
--zdt_statuslistitem_list_text:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(0.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
@@ -259,9 +259,6 @@
|
|
|
259
259
|
|
|
260
260
|
/* status dropdown */
|
|
261
261
|
--zdt_statusdropdown_line_border:var(--zdt_cta_grey_15_border);
|
|
262
|
-
--zdt_statusdropdown_wrapper_container_border:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(100.00% + var(--zdc_default_inverse_low)), calc( 0.2 + var(--zdc_alpha_low)));
|
|
263
|
-
--zdt_statusdropdown_wrapper_container_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), 100.00%, 0.03);
|
|
264
|
-
--zdt_statusdropdown_wrapper_dropdown_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(12.94% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
265
262
|
|
|
266
263
|
/* status listitem */
|
|
267
264
|
--zdt_statuslistitem_list_text:hsla(210, calc(var(--zd-saturation, 1) * 7.41%), calc(89.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
@@ -47,8 +47,35 @@ export default class AttachmentViewer extends Component {
|
|
|
47
47
|
this.zoomMaintain = this.zoomMaintain.bind(this);
|
|
48
48
|
this.handleMenuValidation = this.handleMenuValidation.bind(this);
|
|
49
49
|
this.getPreviewIconData = this.getPreviewIconData.bind(this);
|
|
50
|
-
this.renderIframe = this.renderIframe.bind(this);
|
|
51
|
-
}
|
|
50
|
+
this.renderIframe = this.renderIframe.bind(this); // this.updateItem = this.updateItem.bind(this);
|
|
51
|
+
} // updateItem(idOrIndex, changes) {
|
|
52
|
+
// if (!changes || typeof changes !== 'object') {
|
|
53
|
+
// return false;
|
|
54
|
+
// }
|
|
55
|
+
// const { data } = this.state;
|
|
56
|
+
// const targetIdx = typeof idOrIndex === 'number'
|
|
57
|
+
// ? idOrIndex
|
|
58
|
+
// : data.findIndex((item) => item && item.id === idOrIndex);
|
|
59
|
+
// if (targetIdx < 0 || targetIdx >= data.length) {
|
|
60
|
+
// return false;
|
|
61
|
+
// }
|
|
62
|
+
// this.setState((prevState) => {
|
|
63
|
+
// const nextData = prevState.data.slice();
|
|
64
|
+
// nextData[targetIdx] = { ...nextData[targetIdx], ...changes };
|
|
65
|
+
// let nextDataList = prevState.dataList;
|
|
66
|
+
// if (targetIdx < prevState.dataList.length) {
|
|
67
|
+
// nextDataList = prevState.dataList.slice();
|
|
68
|
+
// nextDataList[targetIdx] = { ...nextDataList[targetIdx], ...changes };
|
|
69
|
+
// }
|
|
70
|
+
// return { data: nextData, dataList: nextDataList };
|
|
71
|
+
// }, () => {
|
|
72
|
+
// if (this.state.selectedIndex === targetIdx) {
|
|
73
|
+
// this.handleMenuValidation();
|
|
74
|
+
// }
|
|
75
|
+
// });
|
|
76
|
+
// return true;
|
|
77
|
+
// }
|
|
78
|
+
|
|
52
79
|
|
|
53
80
|
isImageFileType(fileName) {
|
|
54
81
|
const extension = (getExtensionFromFileName(fileName) || '').toLowerCase();
|
|
@@ -80,8 +107,9 @@ export default class AttachmentViewer extends Component {
|
|
|
80
107
|
selectedIndex
|
|
81
108
|
} = this.state;
|
|
82
109
|
let indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
|
|
110
|
+
const attachmentPreviewUrlChanged = previewObj.previewData[0]?.viewUrl !== prevState.data[0]?.viewUrl; // Triggers an update if the previewed attachment is edited by the Attachment Annotator.
|
|
83
111
|
|
|
84
|
-
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
|
|
112
|
+
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
|
|
85
113
|
let objChanged = previewObj.previewData.some((value, index) => {
|
|
86
114
|
return shallowDiff(value, prevProps.previewObj[index]);
|
|
87
115
|
});
|
|
@@ -100,7 +128,7 @@ export default class AttachmentViewer extends Component {
|
|
|
100
128
|
}
|
|
101
129
|
}
|
|
102
130
|
|
|
103
|
-
if (prevState.selectedIndex != selectedIndex) {
|
|
131
|
+
if (prevState.selectedIndex != selectedIndex || attachmentPreviewUrlChanged) {
|
|
104
132
|
this.handleMenuValidation();
|
|
105
133
|
}
|
|
106
134
|
}
|
|
@@ -308,6 +336,73 @@ export default class AttachmentViewer extends Component {
|
|
|
308
336
|
}, this.props.customProps.iframeProps));
|
|
309
337
|
}
|
|
310
338
|
|
|
339
|
+
getRenderImageFrameCustomClass(_ref3) {
|
|
340
|
+
let {
|
|
341
|
+
canZoom,
|
|
342
|
+
retainZoom,
|
|
343
|
+
isZoomed,
|
|
344
|
+
customImageClass,
|
|
345
|
+
customChildrenClass
|
|
346
|
+
} = _ref3;
|
|
347
|
+
return {
|
|
348
|
+
customImageClass: `${style.img} ${style.altText} ${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
|
|
349
|
+
customChildrenClass
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
renderImageFrame(data, i) {
|
|
354
|
+
const {
|
|
355
|
+
selectedIndex,
|
|
356
|
+
isZoomed,
|
|
357
|
+
canZoom,
|
|
358
|
+
isPreviewAttachmentValid
|
|
359
|
+
} = this.state;
|
|
360
|
+
const {
|
|
361
|
+
maintainZoom,
|
|
362
|
+
renderCustomImagePreviewElement
|
|
363
|
+
} = this.props;
|
|
364
|
+
const {
|
|
365
|
+
viewUrl,
|
|
366
|
+
name,
|
|
367
|
+
children,
|
|
368
|
+
dataId = 'attachViewer',
|
|
369
|
+
customClass = {},
|
|
370
|
+
customProps = {}
|
|
371
|
+
} = data;
|
|
372
|
+
const {
|
|
373
|
+
imageProps = {}
|
|
374
|
+
} = customProps;
|
|
375
|
+
const {
|
|
376
|
+
customImageClass = '',
|
|
377
|
+
customChildrenClass = ''
|
|
378
|
+
} = customClass;
|
|
379
|
+
const retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
380
|
+
const handleZoomOut = isPreviewAttachmentValid && isZoomed ? this.zoomOut.bind(this, i) : undefined;
|
|
381
|
+
const handleZoomIn = isPreviewAttachmentValid && !isZoomed ? e => this.zoomIn(e, i, true) : undefined;
|
|
382
|
+
const handleImageClick = isPreviewAttachmentValid ? isZoomed ? handleZoomOut : handleZoomIn : undefined;
|
|
383
|
+
const imageFrameCustomClass = this.getRenderImageFrameCustomClass({
|
|
384
|
+
canZoom,
|
|
385
|
+
retainZoom,
|
|
386
|
+
isZoomed,
|
|
387
|
+
customImageClass,
|
|
388
|
+
customChildrenClass
|
|
389
|
+
});
|
|
390
|
+
const img = /*#__PURE__*/React.createElement(AttachmentImage, _extends({
|
|
391
|
+
customClass: imageFrameCustomClass,
|
|
392
|
+
src: viewUrl,
|
|
393
|
+
onClick: handleImageClick,
|
|
394
|
+
alt: name,
|
|
395
|
+
dataId: dataId,
|
|
396
|
+
id: `img${i}`,
|
|
397
|
+
isCover: false
|
|
398
|
+
}, imageProps), children);
|
|
399
|
+
return typeof renderCustomImagePreviewElement === 'function' ? renderCustomImagePreviewElement({
|
|
400
|
+
defaultView: img,
|
|
401
|
+
data,
|
|
402
|
+
index: i
|
|
403
|
+
}) : img;
|
|
404
|
+
}
|
|
405
|
+
|
|
311
406
|
imgPreviewView(downloadUrl) {
|
|
312
407
|
var _this = this;
|
|
313
408
|
|
|
@@ -404,18 +499,7 @@ export default class AttachmentViewer extends Component {
|
|
|
404
499
|
}, videoProps), /*#__PURE__*/React.createElement("source", {
|
|
405
500
|
src: viewUrl,
|
|
406
501
|
type: `video/${extension}`
|
|
407
|
-
})) : _this.isImageFileType(name) || children ? /*#__PURE__*/React.createElement(
|
|
408
|
-
customClass: {
|
|
409
|
-
customImageClass: `${style.img} ${style.altText} ${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
|
|
410
|
-
customChildrenClass
|
|
411
|
-
},
|
|
412
|
-
src: viewUrl,
|
|
413
|
-
onClick: isPreviewAttachmentValid ? isZoomed ? _this.zoomOut.bind(_this, i) : e => _this.zoomIn(e, i, true) : undefined,
|
|
414
|
-
alt: name,
|
|
415
|
-
dataId: dataId,
|
|
416
|
-
id: `img${i}`,
|
|
417
|
-
isCover: false
|
|
418
|
-
}, imageProps), children) : type === "document" && previewurl != null ? _this.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/React.createElement("div", {
|
|
502
|
+
})) : _this.isImageFileType(name) || children ? _this.renderImageFrame(data, i) : type === "document" && previewurl != null ? _this.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/React.createElement("div", {
|
|
419
503
|
className: style.previewNone
|
|
420
504
|
}, /*#__PURE__*/React.createElement("div", {
|
|
421
505
|
className: style.fileTypeImg
|
|
@@ -424,9 +508,10 @@ export default class AttachmentViewer extends Component {
|
|
|
424
508
|
$ui_weight: "semibold"
|
|
425
509
|
}, previewUnsupportedText), downloadUrl ? /*#__PURE__*/React.createElement(Link, {
|
|
426
510
|
href: downloadUrl,
|
|
511
|
+
download: true,
|
|
512
|
+
downloadName: name,
|
|
427
513
|
className: style.downloadLink,
|
|
428
|
-
hasReload: true
|
|
429
|
-
download: true
|
|
514
|
+
hasReload: true
|
|
430
515
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
431
516
|
palette: "primaryFilled",
|
|
432
517
|
text: downloadText
|
|
@@ -449,7 +534,9 @@ export default class AttachmentViewer extends Component {
|
|
|
449
534
|
i18nKeys,
|
|
450
535
|
isActive,
|
|
451
536
|
dataId,
|
|
452
|
-
customProps
|
|
537
|
+
customProps,
|
|
538
|
+
showCount,
|
|
539
|
+
renderCustomIcons
|
|
453
540
|
} = this.props;
|
|
454
541
|
const {
|
|
455
542
|
avatarProps = {}
|
|
@@ -477,10 +564,10 @@ export default class AttachmentViewer extends Component {
|
|
|
477
564
|
}, /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
478
565
|
responsiveId: responsiveId,
|
|
479
566
|
query: this.responsiveFunc
|
|
480
|
-
},
|
|
567
|
+
}, _ref4 => {
|
|
481
568
|
let {
|
|
482
569
|
uptoTablet
|
|
483
|
-
} =
|
|
570
|
+
} = _ref4;
|
|
484
571
|
return /*#__PURE__*/React.createElement(Container, {
|
|
485
572
|
scroll: "none",
|
|
486
573
|
"data-scroll-palette": "dark"
|
|
@@ -495,7 +582,7 @@ export default class AttachmentViewer extends Component {
|
|
|
495
582
|
"data-title": selectedAttachment.name,
|
|
496
583
|
dataId: "attachName",
|
|
497
584
|
id: ariaId
|
|
498
|
-
}, selectedAttachment.name), /*#__PURE__*/React.createElement(Box, {
|
|
585
|
+
}, selectedAttachment.name), showCount && /*#__PURE__*/React.createElement(Box, {
|
|
499
586
|
flexible: true,
|
|
500
587
|
className: style.count,
|
|
501
588
|
dataId: "attachCountContainer"
|
|
@@ -507,7 +594,11 @@ export default class AttachmentViewer extends Component {
|
|
|
507
594
|
align: uptoTablet ? 'bottom' : 'center',
|
|
508
595
|
wrap: "wrap",
|
|
509
596
|
isCover: false
|
|
510
|
-
},
|
|
597
|
+
}, typeof renderCustomIcons === 'function' && renderCustomIcons({
|
|
598
|
+
selectedAttachment,
|
|
599
|
+
selectedIndex,
|
|
600
|
+
totalLen
|
|
601
|
+
}), canZoom ? isZoomed ? /*#__PURE__*/React.createElement("div", {
|
|
511
602
|
className: uptoTablet ? style.mobileMenu : style.menu,
|
|
512
603
|
onClick: this.zoomOut.bind(this, selectedIndex),
|
|
513
604
|
"data-id": "zoomOut",
|
|
@@ -555,6 +646,7 @@ export default class AttachmentViewer extends Component {
|
|
|
555
646
|
className: uptoTablet ? style.mobileMenu : style.menu
|
|
556
647
|
}, /*#__PURE__*/React.createElement(Link, {
|
|
557
648
|
href: downloadUrl,
|
|
649
|
+
downloadName: selectedAttachment.name,
|
|
558
650
|
target: "_parent",
|
|
559
651
|
hasReload: true,
|
|
560
652
|
download: true,
|
package/es/Link/Link.js
CHANGED
|
@@ -61,7 +61,8 @@ export default class Link extends React.Component {
|
|
|
61
61
|
rel,
|
|
62
62
|
dataId,
|
|
63
63
|
customProps,
|
|
64
|
-
ariaLabel
|
|
64
|
+
ariaLabel,
|
|
65
|
+
downloadName
|
|
65
66
|
} = this.props;
|
|
66
67
|
let {
|
|
67
68
|
isLink,
|
|
@@ -71,10 +72,10 @@ export default class Link extends React.Component {
|
|
|
71
72
|
let option = {};
|
|
72
73
|
|
|
73
74
|
if (download) {
|
|
74
|
-
option.download = true;
|
|
75
|
+
option.download = downloadName || true;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
let ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
|
|
78
|
+
let ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'downloadName', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
|
|
78
79
|
let others = Object.keys(this.props).filter(key => ignoreKeys.indexOf(key) == -1).reduce((res, key) => {
|
|
79
80
|
res[key] = this.props[key];
|
|
80
81
|
return res;
|
|
@@ -40,6 +40,4 @@
|
|
|
40
40
|
--zd_bs_onboarding_close_icon: var(--zd_bs_contrast_outline, 0px 2px 15px var(--zd-shadow-saturation, rgba(0, 0, 0, 0.09)));
|
|
41
41
|
--zd_bs_onboarding_gradient: var(--zd_bs_contrast_outline, 0px 20px 30px 0px var(--zdt_onboarding_bg_box_shadow));
|
|
42
42
|
--zd_bs_onboarding_primary_button: var(--zd_bs_contrast_outline, 0px 4px 20px 0px var(--zdt_onboarding_primary_button_shadow));
|
|
43
|
-
/* status dropdown */
|
|
44
|
-
--zd_bs_statusdropdown_wrapper_container: var(--zd_bs_contrast_outline, 3px 3px 26px 0 var(--zdt_texteditor_menu_after_box_shadow));
|
|
45
43
|
}
|
|
@@ -97,8 +97,7 @@ export default class SelectField extends PureComponent {
|
|
|
97
97
|
onFocus,
|
|
98
98
|
iconOnHover,
|
|
99
99
|
customProps,
|
|
100
|
-
renderLabelProps
|
|
101
|
-
renderCustomDropBoxHeader
|
|
100
|
+
renderLabelProps
|
|
102
101
|
} = this.props;
|
|
103
102
|
const {
|
|
104
103
|
LabelProps = {},
|
|
@@ -168,8 +167,7 @@ export default class SelectField extends PureComponent {
|
|
|
168
167
|
iconOnHover: iconOnHover,
|
|
169
168
|
title: title
|
|
170
169
|
}, SelectProps, {
|
|
171
|
-
ariaLabelledby: uniqueId
|
|
172
|
-
renderCustomDropBoxHeader: renderCustomDropBoxHeader
|
|
170
|
+
ariaLabelledby: uniqueId
|
|
173
171
|
}), children ? children : null)), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
174
172
|
text: validationMessage,
|
|
175
173
|
palette: validationPalette,
|
|
@@ -45,7 +45,6 @@ export const propTypes = {
|
|
|
45
45
|
ValidationMessageProps1: PropTypes.object,
|
|
46
46
|
ValidationMessageProps2: PropTypes.object
|
|
47
47
|
}),
|
|
48
|
-
renderCustomDropBoxHeader: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
49
48
|
htmlId: PropTypes.string,
|
|
50
49
|
...FieldCommonPropTypes
|
|
51
50
|
};
|
|
@@ -13,7 +13,6 @@ import StatusListItem from "../StatusListItem/StatusListItem";
|
|
|
13
13
|
import commonStyle from '@zohodesk/components/es/common/common.module.css';
|
|
14
14
|
import ResponsiveDropBox from '@zohodesk/components/es/ResponsiveDropBox/ResponsiveDropBox';
|
|
15
15
|
import { ResponsiveReceiver } from '@zohodesk/components/es/Responsive/CustomResponsive';
|
|
16
|
-
import Flex from '@zohodesk/layout/es/Flex/Flex';
|
|
17
16
|
import { getUniqueId } from '@zohodesk/components/es/Provider/IdProvider';
|
|
18
17
|
import btnStyle from '@zohodesk/components/es/semantic/Button/semanticButton.module.css';
|
|
19
18
|
import style from "./StatusDropdown.module.css";
|
|
@@ -31,11 +30,6 @@ export class StatusDropdown extends React.Component {
|
|
|
31
30
|
this.searchList = this.searchList.bind(this);
|
|
32
31
|
this.handleScroll = this.handleScroll.bind(this);
|
|
33
32
|
this.emptySearchSVG = this.emptySearchSVG.bind(this);
|
|
34
|
-
this.getSearchA11y = this.getSearchA11y.bind(this);
|
|
35
|
-
this.getHeadingA11y = this.getHeadingA11y.bind(this);
|
|
36
|
-
this.getListItemA11y = this.getListItemA11y.bind(this);
|
|
37
|
-
this.getTextBoxIconCustomProps = this.getTextBoxIconCustomProps.bind(this);
|
|
38
|
-
this.handleListItemClick = this.handleListItemClick.bind(this);
|
|
39
33
|
this.getAriaId = getUniqueId(this);
|
|
40
34
|
}
|
|
41
35
|
|
|
@@ -130,44 +124,6 @@ export class StatusDropdown extends React.Component {
|
|
|
130
124
|
};
|
|
131
125
|
}
|
|
132
126
|
|
|
133
|
-
getSearchA11y() {
|
|
134
|
-
return {
|
|
135
|
-
ariaHaspopup: this.props.isSearch ? 'listbox' : 'menu',
|
|
136
|
-
ariaExpanded: this.props.isPopupReady,
|
|
137
|
-
role: 'combobox',
|
|
138
|
-
ariaActivedescendant: this.props.isPopupReady ? this.props.value : '',
|
|
139
|
-
ariaOwns: this.getAriaId()
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
getHeadingA11y() {
|
|
144
|
-
return {
|
|
145
|
-
role: 'heading'
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
getListItemA11y(isActive, listItemText) {
|
|
150
|
-
return {
|
|
151
|
-
role: this.props.isSearch ? 'option' : 'menuitem',
|
|
152
|
-
ariaSelected: isActive,
|
|
153
|
-
ariaLabel: listItemText
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
getTextBoxIconCustomProps() {
|
|
158
|
-
return {
|
|
159
|
-
TextBoxProps: {
|
|
160
|
-
'data-a11y-autofocus': true
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
handleListItemClick(item) {
|
|
166
|
-
return e => {
|
|
167
|
-
this.onSelect(item, e);
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
127
|
render() {
|
|
172
128
|
let {
|
|
173
129
|
options
|
|
@@ -223,12 +179,10 @@ export class StatusDropdown extends React.Component {
|
|
|
223
179
|
renderTargetElement,
|
|
224
180
|
renderFooterElement,
|
|
225
181
|
a11y = {},
|
|
226
|
-
customClass
|
|
227
|
-
renderCustomDropBoxHeader
|
|
182
|
+
customClass
|
|
228
183
|
} = this.props;
|
|
229
184
|
const {
|
|
230
|
-
dropBoxClass = ''
|
|
231
|
-
customDropBoxHeader = ''
|
|
185
|
+
dropBoxClass = ''
|
|
232
186
|
} = customClass;
|
|
233
187
|
const {
|
|
234
188
|
tabIndex = 0,
|
|
@@ -241,9 +195,6 @@ export class StatusDropdown extends React.Component {
|
|
|
241
195
|
} = this.state;
|
|
242
196
|
let containerClass = `${className ? className : ''} ${isPopupReady ? activeStyle ? activeStyle : '' : showIconOnHover ? style.hoverIcon : ''} ${isDisabled ? commonStyle.disabled : isReadOnly ? style.readOnly : !isEditable ? style.cursorDefault : !showOnHover ? `${style.cursor} ${hoverStyle ? hoverStyle : ''}` : `${hoverStyle ? hoverStyle : ''} ${style.cursorDefault}`}`;
|
|
243
197
|
let ariaTitleId = this.getAriaId();
|
|
244
|
-
let textBoxA11y = this.getSearchA11y();
|
|
245
|
-
let headingA11y = this.getHeadingA11y();
|
|
246
|
-
let textBoxIconCustomProps = this.getTextBoxIconCustomProps();
|
|
247
198
|
return /*#__PURE__*/React.createElement("div", {
|
|
248
199
|
className: style.posRel,
|
|
249
200
|
onMouseEnter: showOnHover && !isDisabled && !isReadOnly && isEditable ? this.handleTogglePopup : undefined,
|
|
@@ -300,8 +251,8 @@ export class StatusDropdown extends React.Component {
|
|
|
300
251
|
isAnimate: true,
|
|
301
252
|
getRef: getContainerRef,
|
|
302
253
|
customClass: {
|
|
303
|
-
customDropBoxWrap:
|
|
304
|
-
customDropBox:
|
|
254
|
+
customDropBoxWrap: style.dropBoxContainer,
|
|
255
|
+
customDropBox: dropBoxClass
|
|
305
256
|
},
|
|
306
257
|
needResponsive: needResponsive,
|
|
307
258
|
isResponsivePadding: true,
|
|
@@ -319,74 +270,81 @@ export class StatusDropdown extends React.Component {
|
|
|
319
270
|
isFetchingOptions: isFetchingOptions
|
|
320
271
|
}
|
|
321
272
|
}
|
|
322
|
-
}, ((
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
273
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, isSearch ? /*#__PURE__*/React.createElement(Box, {
|
|
274
|
+
className: style.search
|
|
275
|
+
}, /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
276
|
+
placeHolder: placeHolderText,
|
|
277
|
+
onChange: this.handleChange,
|
|
278
|
+
value: searchString,
|
|
279
|
+
onClear: this.onSearchClear,
|
|
280
|
+
size: searchBoxSize,
|
|
281
|
+
customProps: {
|
|
282
|
+
TextBoxProps: {
|
|
283
|
+
'data-a11y-autofocus': true
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
a11y: {
|
|
287
|
+
ariaHaspopup: isSearch ? 'listbox' : 'menu',
|
|
288
|
+
ariaExpanded: isPopupReady,
|
|
289
|
+
role: 'combobox',
|
|
290
|
+
ariaActivedescendant: isPopupReady ? value : '',
|
|
291
|
+
ariaOwns: ariaTitleId
|
|
292
|
+
},
|
|
293
|
+
dataId: `${dataId}_search`
|
|
294
|
+
})) : null, title && options.length != 0 && /*#__PURE__*/React.createElement(Box, {
|
|
295
|
+
className: style.title
|
|
296
|
+
}, /*#__PURE__*/React.createElement(DropDownHeading, {
|
|
297
|
+
htmlId: ariaTitleId,
|
|
298
|
+
text: title,
|
|
299
|
+
a11y: {
|
|
300
|
+
role: 'heading'
|
|
301
|
+
}
|
|
302
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
303
|
+
scroll: "vertical",
|
|
304
|
+
flexible: true,
|
|
305
|
+
shrink: true,
|
|
306
|
+
dataId: `${dataId}_list`,
|
|
307
|
+
preventParentScroll: "vertical",
|
|
308
|
+
className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt}`,
|
|
309
|
+
onScroll: this.handleScroll,
|
|
310
|
+
role: isSearch ? 'listbox' : 'menu',
|
|
311
|
+
tabindex: "-1",
|
|
312
|
+
isScrollAttribute: true
|
|
313
|
+
}, options.length != 0 && isDataLoaded ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map((item, i) => {
|
|
314
|
+
const listItemText = item[keyName];
|
|
315
|
+
const isActive = value === listItemText;
|
|
316
|
+
return /*#__PURE__*/React.createElement(StatusListItem, {
|
|
317
|
+
key: i,
|
|
318
|
+
dataId: `dataid_${i}`,
|
|
319
|
+
value: listItemText,
|
|
320
|
+
id: item[idName],
|
|
321
|
+
active: isActive,
|
|
322
|
+
onClick: this.onSelect.bind(this, item),
|
|
323
|
+
index: i,
|
|
324
|
+
needTick: needTick,
|
|
325
|
+
needBorder: false,
|
|
326
|
+
bulletColor: item[statusColor],
|
|
327
|
+
title: listItemText,
|
|
328
|
+
needMultiLineText: needMultiLineText,
|
|
329
|
+
autoHover: true,
|
|
330
|
+
a11y: {
|
|
331
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
332
|
+
ariaSelected: isActive,
|
|
333
|
+
ariaLabel: listItemText
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
|
|
337
|
+
isCover: false,
|
|
338
|
+
align: "both"
|
|
339
|
+
}, /*#__PURE__*/React.createElement(Loader, null))) : isDataLoaded ? /*#__PURE__*/React.createElement(CommonEmptyState, {
|
|
340
|
+
className: style.svgWrapper,
|
|
341
|
+
title: searchErrorText || 'No results',
|
|
342
|
+
description: searchEmptyHint,
|
|
343
|
+
size: "small",
|
|
344
|
+
getEmptyState: this.emptySearchSVG
|
|
345
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
346
|
+
className: style.loader
|
|
347
|
+
}, /*#__PURE__*/React.createElement(Loader, null))), renderFooterElement ? renderFooterElement : null));
|
|
390
348
|
}) : null);
|
|
391
349
|
}
|
|
392
350
|
|