mergedBuiltinPlacements.js 954 B

12345678910111213141516171819202122232425262728293031323334
  1. const getBuiltInPlacements = popupOverflow => {
  2. const htmlRegion = popupOverflow === 'scroll' ? 'scroll' : 'visible';
  3. const sharedConfig = {
  4. overflow: {
  5. adjustX: true,
  6. adjustY: true,
  7. shiftY: true
  8. },
  9. htmlRegion,
  10. dynamicInset: true
  11. };
  12. return {
  13. bottomLeft: Object.assign(Object.assign({}, sharedConfig), {
  14. points: ['tl', 'bl'],
  15. offset: [0, 4]
  16. }),
  17. bottomRight: Object.assign(Object.assign({}, sharedConfig), {
  18. points: ['tr', 'br'],
  19. offset: [0, 4]
  20. }),
  21. topLeft: Object.assign(Object.assign({}, sharedConfig), {
  22. points: ['bl', 'tl'],
  23. offset: [0, -4]
  24. }),
  25. topRight: Object.assign(Object.assign({}, sharedConfig), {
  26. points: ['br', 'tr'],
  27. offset: [0, -4]
  28. })
  29. };
  30. };
  31. function mergedBuiltinPlacements(buildInPlacements, popupOverflow) {
  32. return buildInPlacements || getBuiltInPlacements(popupOverflow);
  33. }
  34. export default mergedBuiltinPlacements;