Coder Social home page Coder Social logo

vue-template's Issues

c-modal: width and max-width computed not needed

It seems, that the width and max-width values on the modal and the related computed are not needed. If you use CSS and give the modal margin: 0 auto; it should be possible to achieve the same result.

Add outside click directive

In recent projects we already used an outside click directive. This should be added to the vue-template as well, because it is required by almost every project.

Allow customization of e-select and e-multiselect fields

Currently e-select and e-multiselect require an array of objects with specific keys for identifier and value. This is not very convenient, since the data often needs to be mapped. The components would be easier to use if the source for the value and identifier could be defined by prop, so "any" array of object could be used as a source.

Line clamping SCSS mixin

For IV we added a new SCSS mixin, which applies multiline line-clamping on modern browsers without JS.

Responsive font mixin

I think it is time to take font-size handling one step further. Right now we always need to define the font-size for mobile and desktop. It would make more sense, if there was a definition of coupled font-sizeds. e.g. default font-size on mobile is 14px, on desktop 16px. Then, with a mixin those fonts then should be retrievable. The available font sets could be defined with a combination of variables and maps.

@include responsive-font($font-size--p);
$font-size--p: map-get($responsive-font-sizes, p);
$responsive-font-sizes: (
  "p": (
     "xxs": 14,
     "md": 16
  )
)

Remove custom line-height

Across the template, there are several hardcoded line-heights used together with @include font(). They should be removed, to make search/replace easier at the beginning of a new project.

Extend notification schema

Notifications currently only have a type which holds information about the display type like error or info. We should define an additional property, that also defines, what kind of notification this is. e.g. Add-To-Cart message or global message or footer message, ...

So type would be about HOW a notification is displayed and the new property WHERE it is displayed.

Prefix prop documentation for mixins

When using mixins, the JSDoc is also shown in Styleguidist. This can be a bit confusing, because it is not clear where the prop is comming from. This could be improved by adding a prefix to the comments.

e.g. "form-states mixin Adds hover to state."

Update eslint config for vue/attributes-order

As in a discussion with @patric-eberle and @mob8607 we came to the conclusion that it might be better to use new settings for the attributes-order rule.

'vue/attributes-order': [2, {
      'order': [
        'DEFINITION',
        [
          'LIST_RENDERING',
          'CONDITIONALS',
          'RENDER_MODIFIERS',
          'OTHER_DIRECTIVES',
          'TWO_WAY_BINDING',
          'CONTENT'
        ], [
          'GLOBAL',
          'UNIQUE',
          'OTHER_ATTR',
        ],
        'EVENTS',
      ]
    }]

Replace modal plugin

The used Vue plugin vue-js-modal seems quite big for the functionality we actually use.
https://bundlephobia.com/[email protected]

Some features like drag and drop or resizing we never used. I think it would be worth to create our own modal component, which implements the basics to reduce JS size, CSS complexity and makes us more flexible.

This would most likely deprecate #119 #120

Auto generate available locales

Currently our i18n setup requires a manual definition of the available languages. This could be automated by extracting the available translation JSONs from the translation folder. This was implemented in IV.

e.g.

export const I18N_LOCALES = require.context('../translations/', false, /\.json/)
  .keys()
  .map(filePath => filePath.match(/(?<=\.\/).*?(?=\.json)/)[0]);

Focus error field

It would be helpful if we had a logic to focus the first field with an error in the document, where ever we currently are.

Replace vue-tabs-component

The used vue-tabs-component component is no longer actively maintained and should be removed or taken over into our own code.

Replace hasTouch mixin

The hasTouch mixin serves a computed property, that checks if the current device has touch support. But this test is misleading, since some devices may support touch, but still are used with a mouse (e.g. Windows). This mixing should be replaced with a logic, where on each click event it is evaluated if the event is in combination with a touch gesture.

Move styleguide translations to separate file

Currently we only have project related translations. Therefore it's not possible to hold translations we only need in the styleguide (e.g. language selector).

We should add additional translation files which contain styleguide related translations and will be merged when working in dev mode.

Add new convention for api actions

Currently api actions in Vuex are not distinguishable from other actions. We should add the prefix api for all actions, that communicate with the server. This makes the purpose of the actions clearer and also allows to identify server interactions directly in the components.

Simplify use of label with e-icon

Currently, if you want to add a label to an icon you always have to add a separate element. I think we should add the possibility to add at least a hidden label without an additional element by using a prop or slot.

Change running requests state

The stored state of a running request should hold not only the Boolean if the request is running. It should hold the request itself if it's running. So it's easier to handle cases where we need to get the specific request.

Example store module:

state: {
  runningRequests: {
    fetchData: null,
  },
},

...
getters: {
  getRequestIsRunning: state => Object.values(state.runningRequests).some(item => !!item),
}

...

mutations: {
  setRunningRequest(state, { id, request }) {
      state.runningRequests[id] = request;
  },
}

..

actions: {
  fetchData({ commit }) {
      const request = api.get('/get/the/data')
        .then((response) => {
          if (response) {
            return response;
          }

          return Promise.reject(new Error('API failure'));
        })
        .finally(() => {
          commit('setRunningRequest', { id: 'fetchData', request: null });
        });

      commit('setRunningRequest', { id: 'fetchData', request });

      return request;
  },
}

Simplify notifications

The notification setup contains already a lot of cases by default, of which some won't be used by future projects. The displayTypes should be reduced to one and types like add-to-cart should be removed.

Document own plugins

We have already several plugins like viewport and bem. These should also be documented in Styleguidist.

e-picture: add loading transition

When images are lazy loaded, they are displayed quite harsh when eventually loaded. This could be improved by adding an onload transition effect. See IV as an example.

Improved progress state for e-button

Currently the e-button component replaces it's content, when it switches to progress mode. This prevents us from using the v-t directive or any other directive, that places something inside the button, because it will be replaced with the progress. Would it instead be possible to use an absolute element for the progress state, that covers the main content? This would also prevent size changes when switching between the states.

Return response data with promise

The ajax promise should directly return the response data, since we have a convention about the response structure.

api.post().then((data, response) => {});

v-outside-click: allow only method

In IV we improved the v-outside-click directive to also allow a method as value instead of an object, because mostly no additional configuration is needed.

e-table: cell modifiers

It would make sense to add an additional modifier for each cell, which represents the column name. This way it would be possible to style whole columns without the need of an additional cell template.

focus mask improvements

For IV we extended the focus-mask directive with the possibility to use variants. The transition was also improved.

Create constructor for scale validation

The following props validator is used quite often with different scale numbers:

validator(value) {
          return [
            0,
            500
          ].includes(parseInt(value, 10));
}

It would be more convenient and reduce duplicated code if we had a constructor for this.

e.g.

props: {
   foo: {
      ...PROP_VALIDATION_SCALE([0, 200, 500]),
     type: Number,
     // ...
   }
}

Update to webpack 4+

Webpack version 4 has better tree shaking support and therefore should be able to create a smaller build output.

Simplify element components

Most element components have additional states and code, that was only required to apply the styling of the initial project. They should be reduced to the bare minimum, since it confuses external developers.

Styleguidist mockadata

The mockData in styleguide.options.js which was added for the styleguidist environment extends all components in dev mode. This is a bug and should be fixed. The mockData should only be added to the styleguidist Vue instance.

Double check use of v-html

There are some uses of v-html which seem rather unnecessary, to have it as a default. e.g. when using c-form-notification.

v-html should be avoided where ever possible. Especially on this project template.

e-date and c-date-picker

For IV we created two new components to handle date inputs. Since they contain no specific functionality (except for v-focus), it should be save to copy them into the boilerplate.

e-date

  • Accepts a date string and returns a date object
  • Date string format is based on the users sytem settings
  • Can have an inline label and icon if required

c-date-picker

  • Uses Pikaday
  • Allows to select a single date or a range of dates

e-input

  • Make sure internalValue gets updated when input value changes (watch)

Check for better initial data mock aproach

Check if there is a better approach to simulate the initial data push. Currently, the initial data is imported directly in the vuex module. It would be better, if also in the dev environment, the initial data would be pushed to the store via the initial data actions, to test the import.

Add multiple level support for demo navigation

Currently the demo navigation only allows one level of navigation items. Would be good if it would support multiple levels for visual grouping.

e.g.

- Sandbox
- Components
-- Component 1
- Pages
-- Homepage
--- Logged in
--- Logged out

Update body-scroll

The body-scroll helper in the boilerplate was replaced with a plugin in the meantime in W+F which added additional functionality. The helper should be replaced with this plugin.

Disallow the use of HTML in translations

Translations should not allow to contain HTML, because they can cause XXS. Also think of scenarios, where the translation itself could be converted into XXS critical code from outside, since the messages are available trough window.vm.

To prevent the use of HTML in translations warnHtmlInMessage should be turned on by default https://kazupon.github.io/vue-i18n/api/#constructor-options

To work with HTML and translations, the following approach(es) should be used: https://kazupon.github.io/vue-i18n/guide/interpolation.html#basic-usage

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.