diginet-core-ui 1.4.23-beta.1 → 1.4.23-beta.2
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.
|
@@ -224,8 +224,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
224
224
|
})) : null);
|
|
225
225
|
};
|
|
226
226
|
const moveOnItem = e => {
|
|
227
|
-
if (e.key === '
|
|
228
|
-
closeDropdown();
|
|
227
|
+
if (e.key === 'Tab') {
|
|
228
|
+
closeDropdown(e, `key${e.key}`);
|
|
229
229
|
triggerBlur();
|
|
230
230
|
}
|
|
231
231
|
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
@@ -241,28 +241,31 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
241
241
|
}
|
|
242
242
|
};
|
|
243
243
|
const pressESCHandler = e => {
|
|
244
|
-
if (e.key === '
|
|
245
|
-
closeDropdown();
|
|
244
|
+
if (e.key === 'Tab') {
|
|
245
|
+
closeDropdown(e, `key${e.key}`);
|
|
246
246
|
triggerBlur();
|
|
247
247
|
} else if (e.key === 'ArrowDown' && dropdownListRef.current) {
|
|
248
248
|
e.preventDefault();
|
|
249
249
|
dropdownListRef.current.firstChild.focus();
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
-
const closeDropdown = () => {
|
|
252
|
+
const closeDropdown = (event, reason, value) => {
|
|
253
253
|
var _searchRef$current;
|
|
254
254
|
if (dropdownRef.current) {
|
|
255
255
|
setOpenState(false);
|
|
256
256
|
}
|
|
257
257
|
onClosed === null || onClosed === void 0 ? void 0 : onClosed({
|
|
258
|
-
|
|
258
|
+
event,
|
|
259
|
+
reason,
|
|
260
|
+
recentSearch: (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.value,
|
|
261
|
+
value
|
|
259
262
|
});
|
|
260
263
|
};
|
|
261
264
|
|
|
262
|
-
/**
|
|
263
|
-
* So sánh text đầu vào cáo map với txtSearch
|
|
264
|
-
* @param text
|
|
265
|
-
* @return {boolean}
|
|
265
|
+
/**
|
|
266
|
+
* So sánh text đầu vào cáo map với txtSearch
|
|
267
|
+
* @param text
|
|
268
|
+
* @return {boolean}
|
|
266
269
|
*/
|
|
267
270
|
const handleRenderBySearch = (text = '') => {
|
|
268
271
|
if (typeof text !== 'string') text = text.toString();
|
|
@@ -274,10 +277,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
274
277
|
} else return text.toLowerCase().includes(txtSearch.toLowerCase());
|
|
275
278
|
};
|
|
276
279
|
|
|
277
|
-
/**
|
|
278
|
-
* Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
|
|
279
|
-
* @param data {object} rowData of dataSource
|
|
280
|
-
* @return {string}
|
|
280
|
+
/**
|
|
281
|
+
* Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
|
|
282
|
+
* @param data {object} rowData of dataSource
|
|
283
|
+
* @return {string}
|
|
281
284
|
*/
|
|
282
285
|
const displayValue = data => {
|
|
283
286
|
let text = '';
|
|
@@ -375,20 +378,20 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
375
378
|
checked: checked,
|
|
376
379
|
value: value,
|
|
377
380
|
disabled: itemDisabled,
|
|
378
|
-
onChange:
|
|
381
|
+
onChange: e => onChangeValue(e, displayText, value, icon, data, index)
|
|
379
382
|
}, icon, text)));
|
|
380
383
|
} else {
|
|
381
384
|
items.push(jsx("div", {
|
|
382
385
|
key: index,
|
|
383
386
|
css: !itemDisabled ? _DropdownItemCSS : [DisabledCSS, _DropdownItemCSS],
|
|
384
387
|
className: 'DGN-UI-Dropdown-Item',
|
|
385
|
-
onClick:
|
|
388
|
+
onClick: e => {
|
|
386
389
|
if (itemDisabled) return;
|
|
387
|
-
onChangeValue(displayText, value, icon, data, index);
|
|
390
|
+
onChangeValue(e, displayText, value, icon, data, index);
|
|
388
391
|
},
|
|
389
392
|
onKeyDown: e => {
|
|
390
393
|
if (itemDisabled) return;
|
|
391
|
-
if (e.key === 'Enter') onChangeValue(displayText, value, icon, data, index);
|
|
394
|
+
if (e.key === 'Enter') onChangeValue(e, displayText, value, icon, data, index);
|
|
392
395
|
},
|
|
393
396
|
tabIndex: -1,
|
|
394
397
|
style: dropdownItemStyle
|
|
@@ -427,7 +430,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
427
430
|
id: treeViewID,
|
|
428
431
|
parentID: treeViewParentID,
|
|
429
432
|
value: typeof currentValue[unique] === 'string' ? [currentValue[unique]] : currentValue[unique],
|
|
430
|
-
onChange: (e, value) => onChangeValue('', multiple ? value : e.value),
|
|
433
|
+
onChange: (e, value) => onChangeValue(e, '', multiple ? value : e.value),
|
|
431
434
|
renderItem: renderItem
|
|
432
435
|
}) : EmptyDataText);
|
|
433
436
|
};
|
|
@@ -487,7 +490,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
487
490
|
const dropdownItem = document.createElement('div');
|
|
488
491
|
dropdownItem.className = `DGN-UI-Dropdown-Item css-${_DropdownItemCSS.name}`;
|
|
489
492
|
dropdownItem.tabIndex = -1;
|
|
490
|
-
dropdownItem.addEventListener('click',
|
|
493
|
+
dropdownItem.addEventListener('click', e => onChangeValue(e, displayText, value, icon, data, i));
|
|
491
494
|
dropdownItem.addEventListener('keypress', e => {
|
|
492
495
|
if (e.key === 'Enter') dropdownItem.firstChild.click();
|
|
493
496
|
});
|
|
@@ -655,7 +658,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
655
658
|
handleActionLoadData(true);
|
|
656
659
|
}
|
|
657
660
|
};
|
|
658
|
-
const onChangeValue = (displayText, value, icon, data) => {
|
|
661
|
+
const onChangeValue = (e, displayText, value, icon, data) => {
|
|
659
662
|
if (itemMode === 'treeview') {
|
|
660
663
|
if (valueProp === undefined) {
|
|
661
664
|
setValueMulti(value);
|
|
@@ -699,7 +702,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
699
702
|
}
|
|
700
703
|
}
|
|
701
704
|
if (closeAfterSelect === true || closeAfterSelect === undefined && !multiple) {
|
|
702
|
-
closeDropdown();
|
|
705
|
+
closeDropdown(e, 'changeValue', value);
|
|
703
706
|
}
|
|
704
707
|
};
|
|
705
708
|
const onRemove = (e, value) => {
|
|
@@ -820,7 +823,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
820
823
|
setValueSingle(el);
|
|
821
824
|
} else if (iconExpr && iconExpr !== 'none') {
|
|
822
825
|
const icon = getIconFromData(data);
|
|
823
|
-
const valueWithIcon = jsx(Fragment, null, icon
|
|
826
|
+
const valueWithIcon = jsx(Fragment, null, icon ? icon : null, renderContent(text));
|
|
824
827
|
const el = jsx("div", {
|
|
825
828
|
css: [displayFlex, itemsCenter, parseMinHeight(24)]
|
|
826
829
|
}, valueWithIcon);
|
|
@@ -834,7 +837,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
834
837
|
const _instance = {
|
|
835
838
|
...action,
|
|
836
839
|
closeDropdown: () => {
|
|
837
|
-
closeDropdown();
|
|
840
|
+
closeDropdown(null, 'ref');
|
|
838
841
|
},
|
|
839
842
|
showDropdown: () => {
|
|
840
843
|
setOpenState(true);
|
|
@@ -852,7 +855,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
852
855
|
_instance.__proto__ = {}; // hidden methods
|
|
853
856
|
currentRef.instance = _instance;
|
|
854
857
|
// keep old method
|
|
855
|
-
currentRef.closeDropdown = () => closeDropdown();
|
|
858
|
+
currentRef.closeDropdown = () => closeDropdown(null, 'ref');
|
|
856
859
|
currentRef.showDropdown = () => setOpenState(true);
|
|
857
860
|
currentRef.onClear = onClear;
|
|
858
861
|
currentRef.setPreviousValue = setPreviousValue;
|
|
@@ -910,7 +913,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
910
913
|
}
|
|
911
914
|
return () => {
|
|
912
915
|
allValue[unique] = null;
|
|
913
|
-
closeDropdown();
|
|
916
|
+
closeDropdown(null, 'cleanup');
|
|
914
917
|
};
|
|
915
918
|
}, []);
|
|
916
919
|
useEffect(() => {
|
|
@@ -923,7 +926,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
923
926
|
}
|
|
924
927
|
// Close dropdown treeview by children when select item
|
|
925
928
|
if (children && (closeAfterSelect === true || closeAfterSelect === undefined && !multiple)) {
|
|
926
|
-
closeDropdown();
|
|
929
|
+
closeDropdown(null, 'treeView');
|
|
927
930
|
}
|
|
928
931
|
}, [valueProp]);
|
|
929
932
|
useEffect(() => {
|
|
@@ -945,7 +948,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
945
948
|
} else {
|
|
946
949
|
inputRef.current.removeEventListener('keydown', onKeyDown);
|
|
947
950
|
}
|
|
948
|
-
closeDropdown();
|
|
951
|
+
closeDropdown(null, 'cleanup');
|
|
949
952
|
};
|
|
950
953
|
}, [disabled, readOnly, displayExpr, multiple, allowSearch, viewType, closeAfterSelect, selectBox]);
|
|
951
954
|
useEffect(() => {
|
|
@@ -1496,9 +1499,9 @@ Dropdown.propTypes = {
|
|
|
1496
1499
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1497
1500
|
/** If `true`, the component is disabled. */
|
|
1498
1501
|
disabled: PropTypes.bool,
|
|
1499
|
-
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1500
|
-
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1501
|
-
* Note: Do not use 'id - name', as it will return undefined.
|
|
1502
|
+
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1503
|
+
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1504
|
+
* Note: Do not use 'id - name', as it will return undefined.
|
|
1502
1505
|
*/
|
|
1503
1506
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1504
1507
|
/** Inline style for dropdown items. */
|
|
@@ -1507,14 +1510,14 @@ Dropdown.propTypes = {
|
|
|
1507
1510
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1508
1511
|
/** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
|
|
1509
1512
|
helperTextProps: PropTypes.object,
|
|
1510
|
-
/** The field name used for displaying icons.<br/>
|
|
1511
|
-
* Example:<br/>
|
|
1512
|
-
* string: 'icon'<br/>
|
|
1513
|
-
* object: {<br/>
|
|
1514
|
-
* key: 'icon',<br/>
|
|
1515
|
-
* prefix: 'https://imglink.com',<br/>
|
|
1516
|
-
* suffix: '.jpg'<br/>
|
|
1517
|
-
* }
|
|
1513
|
+
/** The field name used for displaying icons.<br/>
|
|
1514
|
+
* Example:<br/>
|
|
1515
|
+
* string: 'icon'<br/>
|
|
1516
|
+
* object: {<br/>
|
|
1517
|
+
* key: 'icon',<br/>
|
|
1518
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1519
|
+
* suffix: '.jpg'<br/>
|
|
1520
|
+
* }
|
|
1518
1521
|
*/
|
|
1519
1522
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1520
1523
|
key: PropTypes.string,
|
|
@@ -1548,8 +1551,8 @@ Dropdown.propTypes = {
|
|
|
1548
1551
|
onChange: PropTypes.func,
|
|
1549
1552
|
/** Callback function fired when the dropdown is closed. */
|
|
1550
1553
|
onClosed: PropTypes.func,
|
|
1551
|
-
/** Callback function fired when the input value changes.<br/>
|
|
1552
|
-
* If undefined, the filter function will run (default behavior).
|
|
1554
|
+
/** Callback function fired when the input value changes.<br/>
|
|
1555
|
+
* If undefined, the filter function will run (default behavior).
|
|
1553
1556
|
*/
|
|
1554
1557
|
onInput: PropTypes.func,
|
|
1555
1558
|
/** Callback function fired when a key is pressed down in the input. */
|
|
@@ -1560,21 +1563,21 @@ Dropdown.propTypes = {
|
|
|
1560
1563
|
placeholder: PropTypes.string,
|
|
1561
1564
|
/** If `true`, the component is read-only. */
|
|
1562
1565
|
readOnly: PropTypes.bool,
|
|
1563
|
-
/** Function used for custom rendering of items.<br/>
|
|
1564
|
-
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1565
|
-
* This can be used as an alternative to `displayExpr`
|
|
1566
|
+
/** Function used for custom rendering of items.<br/>
|
|
1567
|
+
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1568
|
+
* This can be used as an alternative to `displayExpr`
|
|
1566
1569
|
*/
|
|
1567
1570
|
renderItem: PropTypes.func,
|
|
1568
|
-
/** Function or field name used to display selected items.<br/>
|
|
1569
|
-
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1571
|
+
/** Function or field name used to display selected items.<br/>
|
|
1572
|
+
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1570
1573
|
*/
|
|
1571
1574
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1572
1575
|
/** If `true`, the label will indicate that the input is required. */
|
|
1573
1576
|
required: PropTypes.bool,
|
|
1574
|
-
/**
|
|
1575
|
-
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1576
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1577
|
-
* If `true`, the default delayOnInput will be used.
|
|
1577
|
+
/**
|
|
1578
|
+
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1579
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1580
|
+
* If `true`, the default delayOnInput will be used.
|
|
1578
1581
|
*/
|
|
1579
1582
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1580
1583
|
/** Specifies the field name or expression used to compare values with the search string. */
|
|
@@ -1601,19 +1604,19 @@ Dropdown.propTypes = {
|
|
|
1601
1604
|
valueObjectDefault: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
1602
1605
|
/** The variant to use. */
|
|
1603
1606
|
viewType: PropTypes.oneOf(['underlined', 'outlined', 'none'])
|
|
1604
|
-
/**
|
|
1605
|
-
* ref methods
|
|
1606
|
-
*
|
|
1607
|
-
* how to get component element? ref.current
|
|
1608
|
-
*
|
|
1609
|
-
* how to call method? ref.current.instance.{method}
|
|
1610
|
-
*
|
|
1611
|
-
* * showDropdown(): Show dropdown
|
|
1612
|
-
* * closeDropdown(): Close dropdown
|
|
1613
|
-
* * onClear(): Clear selected value
|
|
1614
|
-
* * setPreviousValue(): Set value to previous value
|
|
1615
|
-
* * setValue(value): Set value of dropdown
|
|
1616
|
-
* * @param {value} - string || number || array
|
|
1607
|
+
/**
|
|
1608
|
+
* ref methods
|
|
1609
|
+
*
|
|
1610
|
+
* how to get component element? ref.current
|
|
1611
|
+
*
|
|
1612
|
+
* how to call method? ref.current.instance.{method}
|
|
1613
|
+
*
|
|
1614
|
+
* * showDropdown(): Show dropdown
|
|
1615
|
+
* * closeDropdown(): Close dropdown
|
|
1616
|
+
* * onClear(): Clear selected value
|
|
1617
|
+
* * setPreviousValue(): Set value to previous value
|
|
1618
|
+
* * setValue(value): Set value of dropdown
|
|
1619
|
+
* * @param {value} - string || number || array
|
|
1617
1620
|
*/
|
|
1618
1621
|
};
|
|
1619
1622
|
|
|
@@ -178,16 +178,16 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
178
178
|
if (!openState) setOpenState(true);
|
|
179
179
|
onOpen && onOpen();
|
|
180
180
|
};
|
|
181
|
-
const onClosePopover = () => {
|
|
181
|
+
const onClosePopover = (event, reason) => {
|
|
182
182
|
if (openState) {
|
|
183
183
|
if (ref.current) ref.current.style.opacity = 0;
|
|
184
|
-
onClose && onClose();
|
|
184
|
+
onClose && onClose(event, reason);
|
|
185
185
|
setOpenState(false);
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
const pressESCHandler = event => {
|
|
189
189
|
if (event.key === 'Escape') {
|
|
190
|
-
onClosePopover();
|
|
190
|
+
onClosePopover(event, `key${event.key}`);
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
193
|
const onClickOutside = event => {
|
|
@@ -198,7 +198,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
198
198
|
}
|
|
199
199
|
const _anchor = ((_anchor2 = anchor) === null || _anchor2 === void 0 ? void 0 : _anchor2.element) || ((_anchor3 = anchor) === null || _anchor3 === void 0 ? void 0 : (_anchor3$current = _anchor3.current) === null || _anchor3$current === void 0 ? void 0 : _anchor3$current.element) || ((_anchor4 = anchor) === null || _anchor4 === void 0 ? void 0 : _anchor4.current) || anchor;
|
|
200
200
|
if (clickOutsideToClose && !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains((event === null || event === void 0 ? void 0 : event.toElement) || (event === null || event === void 0 ? void 0 : event.target))) && (!fullScreen || (_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && (_ref$current2$parentN = _ref$current2.parentNode) !== null && _ref$current2$parentN !== void 0 && _ref$current2$parentN.contains(event === null || event === void 0 ? void 0 : event.target)) && !(_anchor !== null && _anchor !== void 0 && _anchor.contains((event === null || event === void 0 ? void 0 : event.toElement) || (event === null || event === void 0 ? void 0 : event.target))) && openState) {
|
|
201
|
-
onClosePopover();
|
|
201
|
+
onClosePopover(event, 'clickOutside');
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
const updatePositionPopover = (el = null, cb) => {
|
|
@@ -478,7 +478,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
478
478
|
if (el) setElement(el);
|
|
479
479
|
!openState && el ? updatePositionPopover(el, onOpenPopover()) : onOpenPopover();
|
|
480
480
|
},
|
|
481
|
-
close: () => onClosePopover(),
|
|
481
|
+
close: () => onClosePopover(null, 'ref'),
|
|
482
482
|
setPosition: el => updatePositionPopover(el),
|
|
483
483
|
...action
|
|
484
484
|
}; // methods
|
|
@@ -583,9 +583,9 @@ const PopoverArrowCSS = (bgCl, arrowSize) => css`
|
|
|
583
583
|
Popover.propTypes = {
|
|
584
584
|
/** An HTML element, or a function that returns one. It's used to set the position of the popover. */
|
|
585
585
|
anchor: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.func, PropTypes.object, PropTypes.node, ref]),
|
|
586
|
-
/**
|
|
587
|
-
* This is the point on the anchor where the popover's anchor will attach to.
|
|
588
|
-
* Options: vertical: [top, center, bottom]; horizontal: [left, center, right].
|
|
586
|
+
/**
|
|
587
|
+
* This is the point on the anchor where the popover's anchor will attach to.
|
|
588
|
+
* Options: vertical: [top, center, bottom]; horizontal: [left, center, right].
|
|
589
589
|
*/
|
|
590
590
|
anchorOrigin: PropTypes.shape({
|
|
591
591
|
horizontal: PropTypes.oneOf(['center', 'left', 'right']),
|
|
@@ -601,14 +601,14 @@ Popover.propTypes = {
|
|
|
601
601
|
className: PropTypes.string,
|
|
602
602
|
/** If `true`, click outside will close component. */
|
|
603
603
|
clickOutsideToClose: PropTypes.bool,
|
|
604
|
-
/**
|
|
605
|
-
* Direction when Popover shown.
|
|
606
|
-
* Note: This prop will overwrite anchorOrigin & transformOrigin.
|
|
607
|
-
*
|
|
608
|
-
* * top: anchorOrigin: { vertical: 'top', horizontal: 'center' }, transformOrigin: { vertical: 'bottom', horizontal: 'center' }
|
|
609
|
-
* * left: anchorOrigin: { vertical: 'center', horizontal: 'left' }, transformOrigin: { vertical: 'center', horizontal: 'right' }
|
|
610
|
-
* * right: anchorOrigin: { vertical: 'center', horizontal: 'right' }, transformOrigin: { vertical: 'center', horizontal: 'left' }
|
|
611
|
-
* * bottom: anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }
|
|
604
|
+
/**
|
|
605
|
+
* Direction when Popover shown.
|
|
606
|
+
* Note: This prop will overwrite anchorOrigin & transformOrigin.
|
|
607
|
+
*
|
|
608
|
+
* * top: anchorOrigin: { vertical: 'top', horizontal: 'center' }, transformOrigin: { vertical: 'bottom', horizontal: 'center' }
|
|
609
|
+
* * left: anchorOrigin: { vertical: 'center', horizontal: 'left' }, transformOrigin: { vertical: 'center', horizontal: 'right' }
|
|
610
|
+
* * right: anchorOrigin: { vertical: 'center', horizontal: 'right' }, transformOrigin: { vertical: 'center', horizontal: 'left' }
|
|
611
|
+
* * bottom: anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }
|
|
612
612
|
*/
|
|
613
613
|
direction: PropTypes.oneOf(['top', 'left', 'right', 'bottom']),
|
|
614
614
|
/** Height of the component. */
|
|
@@ -625,9 +625,9 @@ Popover.propTypes = {
|
|
|
625
625
|
pressESCToClose: PropTypes.bool,
|
|
626
626
|
/** Style inline of component. */
|
|
627
627
|
style: PropTypes.object,
|
|
628
|
-
/**
|
|
629
|
-
* This is the point on the popover which will attach to the anchor's origin.
|
|
630
|
-
* Options: vertical: [top, center, bottom]; horizontal: [left, center, right].
|
|
628
|
+
/**
|
|
629
|
+
* This is the point on the popover which will attach to the anchor's origin.
|
|
630
|
+
* Options: vertical: [top, center, bottom]; horizontal: [left, center, right].
|
|
631
631
|
*/
|
|
632
632
|
transformOrigin: PropTypes.shape({
|
|
633
633
|
horizontal: PropTypes.oneOf(['center', 'left', 'right']),
|
|
@@ -639,24 +639,24 @@ Popover.propTypes = {
|
|
|
639
639
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
640
640
|
/** Config z-index of the component. */
|
|
641
641
|
zIndex: PropTypes.number
|
|
642
|
-
/**
|
|
643
|
-
* ref methods (ref.current.instance.*method*)
|
|
644
|
-
*
|
|
645
|
-
* * show: Show popover
|
|
646
|
-
* * close: Close popover
|
|
647
|
-
* * setPosition(element): Set position of popover
|
|
648
|
-
* * @param {element} - element
|
|
649
|
-
*
|
|
650
|
-
* * option(): Gets all UI component properties
|
|
651
|
-
* * Returns value - object
|
|
652
|
-
* * option(optionName): Gets the value of a single property
|
|
653
|
-
* * @param {optionName} - string
|
|
654
|
-
* * Returns value - any
|
|
655
|
-
* * option(optionName, optionValue): Updates the value of a single property
|
|
656
|
-
* * @param {optionName} - string
|
|
657
|
-
* * @param {optionValue} - any
|
|
658
|
-
* * option(options): Updates the values of several properties
|
|
659
|
-
* * @param {options} - object
|
|
642
|
+
/**
|
|
643
|
+
* ref methods (ref.current.instance.*method*)
|
|
644
|
+
*
|
|
645
|
+
* * show: Show popover
|
|
646
|
+
* * close: Close popover
|
|
647
|
+
* * setPosition(element): Set position of popover
|
|
648
|
+
* * @param {element} - element
|
|
649
|
+
*
|
|
650
|
+
* * option(): Gets all UI component properties
|
|
651
|
+
* * Returns value - object
|
|
652
|
+
* * option(optionName): Gets the value of a single property
|
|
653
|
+
* * @param {optionName} - string
|
|
654
|
+
* * Returns value - any
|
|
655
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
656
|
+
* * @param {optionName} - string
|
|
657
|
+
* * @param {optionValue} - any
|
|
658
|
+
* * option(options): Updates the values of several properties
|
|
659
|
+
* * @param {options} - object
|
|
660
660
|
*/
|
|
661
661
|
};
|
|
662
662
|
|