Skip to content
This repository was archived by the owner on Aug 19, 2024. It is now read-only.

Commit 50f18e7

Browse files
author
Irfan Maulana
committed
init commit skeleton plugin
1 parent 97e20a3 commit 50f18e7

File tree

11 files changed

+7070
-0
lines changed

11 files changed

+7070
-0
lines changed

App.vue

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<template>
2+
<div id="app" class="VueStringFilter">
3+
4+
<header role="header" class="site__header header"><div class="header__wrapper"><div class="header__brand"> <a href="https://mazipan.github.io/demo/"> <img src="https://mazipan.github.io/images/irfan-maulana.jpg" alt="Irfan Maulana" title="Irfan Maulana"> </a><div class="header__title"> Irfan Maulana | Demo</div></div></div> </header>
5+
6+
<div class="app">
7+
<div class="grid__row content centered">
8+
<h1>Lightweight and Customizable Vue Currency Filter Plugins By Irfan Maulana</h1>
9+
10+
<h2>Example : </h2>
11+
<input type="tel" pattern="[0-9]*" v-model="textInput" class="textfield textfield--shadow"/>
12+
13+
<div><b>Before filter</b> : {{ textInput }}</div>
14+
<div>
15+
<b>After filter</b> :
16+
<b class="result__filter">{{ textInput | currency(configSymbol, configSeparator, configFractionCount, configFractionSeparator, configSymbolPosition, configSymbolSpacing) }}</b>
17+
</div>
18+
19+
<h2>Customize Config :</h2>
20+
<div class="form__group">
21+
<div class="form__icon form__icon--radius-left">
22+
Symbol
23+
</div>
24+
<input class="textfield" type="text" v-model="configSymbol">
25+
</div>
26+
27+
<div class="form__group">
28+
<div class="form__icon form__icon--radius-left">
29+
Separator
30+
</div>
31+
<input class="textfield" type="text" v-model="configSeparator">
32+
</div>
33+
34+
<div class="form__group">
35+
<div class="form__icon form__icon--radius-left">
36+
Fraction Count
37+
</div>
38+
<input class="textfield" type="tel" pattern="[0-9]*" v-model="configFractionCount">
39+
</div>
40+
41+
<div class="form__group">
42+
<div class="form__icon form__icon--radius-left">
43+
Fraction Separator
44+
</div>
45+
<input class="textfield" type="text" v-model="configFractionSeparator">
46+
</div>
47+
48+
<div class="form__group m-b-5">
49+
<div class="form__icon form__icon--radius-left">
50+
Symbol Position
51+
</div>
52+
<div class="form__wrapper">
53+
<input class="radio radio--blue" type="radio" id="radio-form-1" name="radio-symbol" v-model="configSymbolPosition" v-bind:value="'front'">
54+
<label for="radio-form-1">Front</label>
55+
<input class="radio radio--blue" type="radio" id="radio-form-2" name="radio-symbol" v-model="configSymbolPosition" v-bind:value="'back'">
56+
<label for="radio-form-2">End of text</label>
57+
</div>
58+
</div>
59+
60+
<div class="form__group m-b-5">
61+
<div class="form__icon form__icon--radius-left">
62+
Symbol Spacing
63+
</div>
64+
<div class="form__wrapper">
65+
<input class="radio radio--blue" type="radio" id="radio-form-3" name="radio-spacing" v-model="configSymbolSpacing" v-bind:value="true">
66+
<label for="radio-form-3">Yes</label>
67+
<input class="radio radio--blue" type="radio" id="radio-form-4" name="radio-spacing" v-model="configSymbolSpacing" v-bind:value="false">
68+
<label for="radio-form-4">No</label>
69+
</div>
70+
</div>
71+
72+
</div>
73+
</div>
74+
75+
<div class="grid__row content centered"><h2>Contribute</h2><p> Feel free to fork <i class="fa fa-code-fork"></i> on <a href="https://github.com/mazipan/vue-string-filter" target="_blank">GitHub <i class="fa fa-github"></i></a> if you have any features <i class="fa fa-cart-plus"></i> or bugs <i class="fa fa-bug"></i>!</p></div>
76+
<div class="grid__row content centered"><h2>Contact Developer</h2><p><a href="https://github.com/mazipan"> <img src="https://img.shields.io/badge/mazipan-Github-lightgrey.svg?maxAge=3600" alt="Github"> </a><a href="mailto:mazipanneh@gmail.com"> <img src="https://img.shields.io/badge/mazipanneh-Email-yellow.svg?maxAge=3600" alt="Email"> </a><a href="https://mazipanneh.com/blog/"> <img src="https://img.shields.io/badge/mazipanneh-Blog-brightgreen.svg?maxAge=3600" alt="Blog"> </a><a href="https://facebook.com/mazipanneh"> <img src="https://img.shields.io/badge/mazipanneh-Facebook-blue.svg?maxAge=3600" alt="Facebook"> </a><br/><a href="https://twitter.com/Maz_Ipan"> <img src="https://img.shields.io/badge/Maz_Ipan-Twitter-55acee.svg?maxAge=3600" alt="Twitter"> </a><a href="https://id.linkedin.com/in/irfanmaulanamazipan"> <img src="https://img.shields.io/badge/irfanmaulanamazipan-Linkedin-0077b5.svg?maxAge=3600" alt="Linkedin"> </a><a href="https://www.slideshare.net/IrfanMaulana21"> <img src="https://img.shields.io/badge/IrfanMaulana21-Slideshare-0077b5.svg?maxAge=3600" alt="Slideshare"> </a></p></div>
77+
<div class="grid__row content centered"><p> Copyright © 2017 <a href="https://mazipanneh.com/blog/">Irfan Maulana</a>, All Rights Reserved.</p></div>
78+
79+
</div>
80+
</template>
81+
82+
<script>
83+
export default {
84+
name: 'app',
85+
data () {
86+
return {
87+
textInput: 20000,
88+
configSymbol: '$',
89+
configSeparator: '.',
90+
configFractionCount: 0,
91+
configFractionSeparator: ',',
92+
configSymbolPosition: 'front',
93+
configSymbolSpacing: true
94+
}
95+
}
96+
}
97+
98+
</script>
99+
100+
<style lang="scss">
101+
.form__group{
102+
max-width: 500px;
103+
}
104+
.form__icon{
105+
width: 180px;
106+
}
107+
.form__wrapper{
108+
margin-left: 5px;
109+
}
110+
.m-b-5{
111+
margin-bottom: 5px;
112+
}
113+
</style>

CONTRIBUTING.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Contributing to Vue Currency Filter
2+
3+
Looking to contribute something? **Here's how you can help.**
4+
5+
Please take a moment to review this document in order to make the contribution process easy and effective for everyone in the community.
6+
7+
## Using the issue tracker
8+
9+
The issue tracker is the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests) and [submitting pull requests](#pull-requests), but please respect the following
10+
restrictions:
11+
12+
* Please **do not** use the issue tracker for personal support requests. Please [email me](mailto:mazipanneh@gmail.com) or [send me a tweet](https://twitter.com/Maz_Ipan) as they are better places to get help.
13+
14+
* Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others.
15+
16+
## Bug reports
17+
18+
A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful, so thanks!
19+
20+
Guidelines for bug reports:
21+
22+
1. **Use the GitHub issue search** &mdash; check if the issue has already been reported.
23+
24+
2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or development branch in the repository.
25+
26+
3. **Isolate the problem** &mdash; ideally create a [reduced test case](https://css-tricks.com/reduced-test-cases/).
27+
28+
29+
A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and OS experience the problem? Do other browsers show the bug differently? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
30+
31+
Example:
32+
33+
> Short and descriptive example bug report title
34+
>
35+
> A summary of the issue and the browser/OS environment in which it occurs. If
36+
> suitable, include the steps required to reproduce the bug.
37+
>
38+
> 1. This is the first step
39+
> 2. This is the second step
40+
> 3. Further steps, etc.
41+
>
42+
> `<url>` - a link to the reduced test case
43+
>
44+
> Any other information you want to share that is relevant to the issue being
45+
> reported. This might include the lines of code that you have identified as
46+
> causing the bug, and potential solutions (and your opinions on their
47+
> merits).
48+
49+
50+
## Feature requests
51+
52+
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
53+
54+
55+
## Pull requests
56+
57+
Good pull requests—patches, improvements, new features—are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
58+
59+
**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
60+
61+
Please adhere to the [coding guidelines](#code-guidelines) used throughout the project (indentation, accurate comments, etc.) and any other requirements (such as test coverage).
62+
63+
Adhering to the following process is the best way to get your work included in the project:
64+
65+
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
66+
and configure the remotes:
67+
68+
```bash
69+
# Clone your fork of the repo into the current directory
70+
git clone https://github.com/<your-username>/<repo-name>
71+
# Navigate to the newly cloned directory
72+
cd <repo-name>
73+
# Assign the original repo to a remote called "upstream"
74+
git remote add upstream https://github.com/mazipan/vue-string-filter
75+
```
76+
77+
2. If you cloned a while ago, get the latest changes from upstream:
78+
79+
```bash
80+
git checkout master
81+
git pull upstream master
82+
```
83+
84+
3. Create a new topic branch (off the main project development branch) to
85+
contain your feature, change, or fix:
86+
87+
```bash
88+
git checkout -b <topic-branch-name>
89+
```
90+
91+
4. Make sure to update, or add to the tests when appropriate. **Patches and
92+
features will not be accepted without tests.** Run `npm test` to check that
93+
all tests pass after you've made changes.
94+
95+
5. Locally merge (or rebase) the upstream development branch into your topic branch:
96+
97+
```bash
98+
git pull [--rebase] upstream master
99+
```
100+
101+
6. Push your topic branch up to your fork:
102+
103+
```bash
104+
git push origin <topic-branch-name>
105+
```
106+
107+
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
108+
with a clear title and description against the `master` branch.
109+
110+
**IMPORTANT**: By submitting a patch, you agree to allow the project owners to
111+
license your work under the terms of the [MIT License](LICENSE).
112+
113+
114+
## Code guidelines
115+
116+
### HTML
117+
118+
- Use tags and elements appropriate for an HTML5 doctype (e.g., self-closing tags).
119+
120+
### JS
121+
122+
- No semicolons (in client-side JS)
123+
- 2 spaces (no tabs)
124+
- Don't use jQuery (no "$" allowed)
125+
126+
### Checking code
127+
128+
Run `npm run dev` before committing to ensure your changes follow our coding standards.
129+
130+
131+
## License
132+
133+
By contributing your code, you agree to license your contribution under the [MIT License](LICENSE).

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,69 @@
11
# vue-string-filter
2+
3+
[![License](https://img.shields.io/github/license/mazipan/vue-string-filter.svg?maxAge=3600)](https://github.com/mazipan/vue-string-filter)
4+
[![Github Issue](https://img.shields.io/github/issues/mazipan/vue-string-filter.svg?maxAge=3600)](https://github.com/mazipan/vue-string-filter/issues)
5+
[![GitHub Fork](https://img.shields.io/github/forks/mazipan/vue-string-filter.svg?maxAge=3600)](https://github.com/mazipan/vue-string-filter/network)
6+
[![GitHub Star](https://img.shields.io/github/stars/mazipan/vue-string-filter.svg?maxAge=3600)](https://github.com/mazipan/vue-string-filter/stargazers)
7+
8+
[![version](https://img.shields.io/npm/v/vue-string-filter.svg)](https://www.npmjs.com/package/vue-string-filter)
9+
[![downloads monthly](https://img.shields.io/npm/dm/vue-string-filter.svg)](https://www.npmjs.com/package/vue-string-filter)
10+
[![downloads](https://img.shields.io/npm/dt/vue-string-filter.svg)](https://www.npmjs.com/package/vue-string-filter)
11+
12+
[![Travis](https://img.shields.io/travis/mazipan/vue-string-filter.svg)](https://travis-ci.org/mazipan/vue-string-filter)
13+
[![codecov](https://codecov.io/gh/mazipan/vue-string-filter/branch/master/graph/badge.svg)](https://codecov.io/gh/mazipan/vue-string-filter)
14+
215
:scissors: Lightweight Vue 2 String Manipulation Filter
16+
17+
## Demo
18+
[https://mazipan.github.io/vue-string-filter/](https://mazipan.github.io/vue-string-filter/)
19+
20+
21+
## Available Filter
22+
+ `uppercase`
23+
+ `lowercase`
24+
+ `capitalize`
25+
26+
## Download
27+
28+
NPM :
29+
```bash
30+
npm install vue-string-filter
31+
```
32+
33+
Yarn :
34+
```bash
35+
yarn add vue-string-filter
36+
```
37+
38+
## Sample Usage
39+
40+
#### Use Plugins :
41+
42+
```javascript
43+
import VueStringFilter from 'vue-string-filter'
44+
Vue.use(VueStringFilter)
45+
```
46+
47+
48+
#### Use in View :
49+
50+
```html
51+
<span>{{ 20000 | currency}}</span>
52+
```
53+
54+
55+
## Contributing
56+
57+
If you'd like to contribute, head to the [contributing guidelines](/CONTRIBUTING.md). Inside you'll find directions for opening issues, coding standards, and notes on development.
58+
59+
### Hope this will be useful for you all.
60+
61+
Contact Me :
62+
63+
[![Email](https://img.shields.io/badge/mazipanneh-Email-yellow.svg?maxAge=3600)](mailto:mazipanneh@gmail.com)
64+
[![Website](https://img.shields.io/badge/mazipanneh-Blog-brightgreen.svg?maxAge=3600)](https://mazipanneh.com/blog/)
65+
[![Facebook](https://img.shields.io/badge/mazipanneh-Facebook-blue.svg?maxAge=3600)](https://facebook.com/mazipanneh)
66+
67+
[![Twitter](https://img.shields.io/badge/Maz_Ipan-Twitter-55acee.svg?maxAge=3600)](https://twitter.com/Maz_Ipan)
68+
[![Linkedin](https://img.shields.io/badge/irfanmaulanamazipan-Linkedin-0077b5.svg?maxAge=3600)](https://id.linkedin.com/in/irfanmaulanamazipan)
69+
[![Slideshare](https://img.shields.io/badge/IrfanMaulana21-Slideshare-0077b5.svg?maxAge=3600)](https://www.slideshare.net/IrfanMaulana21)

VueStringFilter.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const VueStringFilter = {
2+
install (Vue, options) {
3+
4+
// helper to check undefined variable
5+
function _isUndefined (obj) {
6+
return typeof obj === "undefined"
7+
}
8+
9+
if(_isUndefined(options)) options = {}
10+
11+
Vue.filter('lowercase', function (value) {
12+
return value
13+
})
14+
15+
Vue.filter('uppercase', function (value) {
16+
return value
17+
})
18+
19+
Vue.filter('capitalize', function (value) {
20+
return value
21+
})
22+
23+
}
24+
}
25+
26+
export default VueStringFilter

0 commit comments

Comments
 (0)