index.sjs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. var antmove_export = {};
  2. import antmove_1_module from '../wxs/utils.sjs';
  3. import antmove_2_module from '../wxs/style.sjs';
  4. /* eslint-disable */
  5. var utils = antmove_1_module;
  6. var style = antmove_2_module;
  7. function tabClass(active, ellipsis) {
  8. var classes = ['tab-class'];
  9. if (active) {
  10. classes.push('tab-active-class');
  11. }
  12. if (ellipsis) {
  13. classes.push('van-ellipsis');
  14. }
  15. return classes.join(' ');
  16. }
  17. function tabStyle(data) {
  18. var titleColor = data.active ? data.titleActiveColor : data.titleInactiveColor;
  19. var ellipsis = data.scrollable && data.ellipsis; // card theme color
  20. if (data.type === 'card') {
  21. return style({
  22. 'border-color': data.color,
  23. 'background-color': !data.disabled && data.active ? data.color : null,
  24. color: titleColor || (!data.disabled && !data.active ? data.color : null),
  25. 'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null
  26. });
  27. }
  28. return style({
  29. color: titleColor,
  30. 'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null
  31. });
  32. }
  33. function navStyle(color, type) {
  34. return style({
  35. 'border-color': type === 'card' && color ? color : null
  36. });
  37. }
  38. function trackStyle(data) {
  39. if (!data.animated) {
  40. return '';
  41. }
  42. return style({
  43. left: -100 * data.currentIndex + '%',
  44. 'transition-duration': data.duration + 's',
  45. '-webkit-transition-duration': data.duration + 's'
  46. });
  47. }
  48. function lineStyle(data) {
  49. return style({
  50. width: utils.addUnit(data.lineWidth),
  51. transform: 'translateX(' + data.lineOffsetLeft + 'px)',
  52. '-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)',
  53. 'background-color': data.color,
  54. height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null,
  55. 'border-radius': data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null,
  56. 'transition-duration': !data.skipTransition ? data.duration + 's' : null,
  57. '-webkit-transition-duration': !data.skipTransition ? data.duration + 's' : null
  58. });
  59. }
  60. antmove_export = {
  61. tabClass: tabClass,
  62. tabStyle: tabStyle,
  63. trackStyle: trackStyle,
  64. lineStyle: lineStyle,
  65. navStyle: navStyle
  66. };
  67. export default antmove_export;