nathanreyes / v-calendar

An elegant calendar and datepicker plugin for Vue.
https://vcalendar.io
MIT License
4.41k stars 863 forks source link

v-calendar is not compiled down to ES5 #513

Open mcenkar opened 4 years ago

mcenkar commented 4 years ago

Currently if we look at https://unpkg.com/v-calendar@1.0.1/lib/v-calendar.umd.js there is a lot of code that is ES6. For example:

template strings:

const createGuid = function createGuid() {
  function S4() {
    return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
  }

  return `${S4() + S4()}-${S4()}-${S4()}-${S4()}-${S4()}${S4()}${S4()}`;
};

classes:

class theme_Theme {
  constructor(config) {
    var _this = this;

    this._config = Object(utils_["b" /* defaults */])(config, theme["a" /* default */]); // Make properties of config appear as properties of theme

computed properties:

      class: ['vc-h-full', {
        [this.theme.dayNotInMonth]: !this.inMonth
      }]

shorthand properties:

  watch: {
    theme() {
      this.refresh();
    },

spread:

    return h('div', {
      class: 'vc-grid-container',
      style: this.containerStyle
    }, [...getCells()]);

and async functions:

    async movePrev(opts) {
      const result = await this.move(-this.step_, opts);
      return result;
    },

I believe it would be useful if provided distribution was already transpiled down to ES5, so that users don't have to include extra configuration to transpile dependencies.

Arrow functions are already transpiled with babel: https://github.com/nathanreyes/v-calendar/blob/master/.babelrc

After adding some babel plugins all examples were compiled down to ES5.

I have opened pull request: #512

Possibly fixes some other issues: #339, #487, #500, #511.

bg commented 4 years ago

I'm interested to see this fixed, and see there is more recent discussion about this on the PR. What's the status? It was suggested a separate PR be filed to re-enable IE11 in browserslist, but it looks like that remains unresolved.

maxmarcon commented 4 years ago

@bg I tried it out and it looks like it's not as easy as simply re-enabling IE11 in babel. https://github.com/nathanreyes/v-calendar/pull/512#issuecomment-590118124

travislaynewilson commented 3 years ago

Bump. I can't use this wonderful component until this is fixed.

mikemellor11 commented 3 years ago

Bump.