├── .gitmodules
├── .npmignore
├── README.md
├── docs
└── en
│ ├── Dropdown.md
│ └── Modal.md
├── index.js
├── package.json
└── src
├── collections
├── Form.vue
├── Grid.vue
├── form
│ └── Field.vue
└── grid
│ ├── Column.vue
│ └── Row.vue
├── elements
├── Input.vue
└── Label.vue
├── mixins
├── collections.js
├── commons
│ ├── align.js
│ ├── arrai.js
│ ├── centered.js
│ ├── column.js
│ ├── constants.js
│ ├── equal-width.js
│ ├── float.js
│ ├── icon.js
│ ├── inverted.js
│ ├── klass.js
│ ├── props
│ │ ├── random.js
│ │ └── type.js
│ ├── sizes
│ │ ├── eight.js
│ │ └── six.js
│ ├── states
│ │ ├── disabled.js
│ │ ├── error.js
│ │ ├── focus.js
│ │ ├── loading.js
│ │ ├── success.js
│ │ └── warning.js
│ └── width.js
├── form.js
├── grid.js
├── index.js
└── modules.js
└── modules
├── Checkbox.vue
├── Dropdown.vue
└── Modal.vue
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "src/mixins/commons/input"]
2 | path = src/mixins/commons/input
3 | url = https://gist.github.com/ebc1d0a4c2b61fb8e5af27ee6fd43465.git
4 | [submodule "src/mixins/commons/click-outside"]
5 | path = src/mixins/commons/click-outside
6 | url = https://gist.github.com/435abf4b203571cba4c8ca1884997f9c.git
7 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | docs/
2 | README.md
3 | *.new
4 | *.bkp
5 | *.old.*
6 | *.old
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Semantic UI's Components
2 |
3 | Components and mixins to use with Vue 2
4 |
5 | ## Installation
6 |
7 | ```bash
8 | $ npm install semantic-ui-vue2
9 | ```
10 |
11 | Include Semantic UI's CSS in your HTML. See [official docs](http://semantic-ui.com/introduction/getting-started.html#include-in-your-html).
12 |
13 | ```html
14 |
15 | ```
16 |
17 | ## Usage
18 |
19 | ### Imports
20 |
21 | Import the global mixin to use all the components. See [example](#example) below.
22 |
23 | #### Components
24 |
25 | Import individual components.
26 |
27 | - `Grid` – component
28 | - `Row` – component
29 | - `Column` – component
30 | - `Checkbox` – component
31 | - `Dropdown` – component
32 | - `Input` – component
33 | - `Label` – component
34 | - `Form` – component
35 | - `Field` – component
36 |
37 | ```javascript
38 | import {ComponentName} from 'semantic-ui-vue2'
39 |
40 | export default {
41 | components: {
42 | 'component-name': ComponentName,
43 | …
44 | },
45 | …
46 | }
47 | ```
48 |
49 | #### Collections
50 |
51 | Mixins to import related components at once
52 |
53 | - `Grid` – `ui-grid`, `ui-row`, `ui-column`
54 | - `Form` – `ui-form`, `ui-field`
55 |
56 | ```javascript
57 | import {Collections} from 'semantic-ui-vue2'
58 |
59 | export default {
60 | mixins: [Collections.CollectionName]
61 | …
62 | }
63 | ```
64 |
65 | ### Example
66 |
67 | `App.vue`:
68 |
69 | ```html
70 |
71 |
72 |
73 |
74 | Lorem ipsum dolor sit amet
75 |
76 |
77 |
78 |
79 |
80 |
87 | ```
88 |
89 | Result:
90 |
91 | ```html
92 |
93 |
94 |
95 | Lorem ipsum dolor sit amet
96 |
97 |
98 |
99 | ```
100 |
--------------------------------------------------------------------------------
/docs/en/Dropdown.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/almino/semantic-ui-vue2/ae1bb10adf94dd2505976d470477a8d30300950c/docs/en/Dropdown.md
--------------------------------------------------------------------------------
/docs/en/Modal.md:
--------------------------------------------------------------------------------
1 | # Modal
2 |
3 | A modal displays content that temporarily blocks interactions with the main view of a site
4 |
5 | ## Requirements
6 |
7 | - `semantic/components/modal[.min].css` or `semantic/src/definitions/modules/modal.less`
8 | - `semantic/components/transition[.min].css` or `semantic/src/definitions/modules/transition.less`
9 |
10 | ## Attributes
11 |
12 | Type |Attribute | Default | Description
13 | -----|----------|---------|------------
14 | `Boolean` | `basic` | `false` | A modal can reduce its complexity
15 | `String` | `header` | `null` | A modal can have a header
16 | `String` | `image` | `null` | A modal can contain image content
17 | `String` or `Number` | `size` | `null` | A modal can vary in size
18 | `Boolean` | `active` | `false` | An active modal is visible on the page
19 | `Boolean` | `closable` | `false` | Setting to false will not allow you to close the modal by clicking on the dimmer
20 | `String` | `transition` | `'scale'` | Named transition to use when animating menu in and out, full list can be found in [ui transitions](https://semantic-ui.com/modules/transition.html) docs.
21 | `Number` | `duration` | `400` | Duration of animation
22 | `Boolean` | `inverted` | `false` | A modal can be inverted
23 |
24 |
25 | ## Events
26 |
27 | * `visible` – Is emmited after a modal has finished showing animating.
28 | * `hidden` – Is emmited after a modal has finished hiding animation.
29 | * `hide` – Is emmited after a modal starts to hide.
30 | * `show` – Is emmited when a modal starts to show.
31 |
32 | ## Methods
33 |
34 | * `hide` – Hides the modal
35 | * `show` – Shows the modal
36 | * `toggle` – Toggles the modal
37 |
38 | ## Slots
39 |
40 | * default – A modal can contain content
41 | * `header` – A modal can have a header
42 | * `actions` – A modal can contain a row of actions
43 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import Grid from './src/collections/Grid.vue'
2 | import Row from './src/collections/grid/Row.vue'
3 | import Column from './src/collections/grid/Column.vue'
4 | import Input from './src/elements/Input.vue'
5 | import Label from './src/elements/Label.vue'
6 |
7 | import Form from './src/collections/Form.vue'
8 | import Field from './src/collections/form/Field.vue'
9 |
10 | import Checkbox from './src/modules/Checkbox.vue'
11 | import Dropdown from './src/modules/Dropdown.vue'
12 | import Modal from './src/modules/Modal.vue'
13 |
14 | import Mixin from './src/mixins/'
15 | import Collections from './src/mixins/collections.js'
16 | import Modules from './src/mixins/modules.js'
17 |
18 | export {
19 | Mixin,
20 | Collections,
21 | Modules,
22 | Grid,
23 | Row,
24 | Column,
25 | Input,
26 | Label,
27 | Form,
28 | Field,
29 | Checkbox,
30 | Dropdown,
31 | Modal,
32 | }
33 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "semantic-ui-vue2",
3 | "version": "2.4.2",
4 | "description": "Semantic UI Integration for Vue 2",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/almino/semantic-ui-vue2.git"
12 | },
13 | "keywords": [
14 | "vue",
15 | "vue2",
16 | "semantic-ui"
17 | ],
18 | "author": "Almino Melo ",
19 | "license": "ISC",
20 | "bugs": {
21 | "url": "https://github.com/almino/semantic-ui-vue2/issues"
22 | },
23 | "homepage": "https://github.com/almino/semantic-ui-vue2#readme"
24 | }
25 |
--------------------------------------------------------------------------------
/src/collections/Form.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
22 |
--------------------------------------------------------------------------------
/src/collections/Grid.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
24 |
--------------------------------------------------------------------------------
/src/collections/form/Field.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
9 |
64 |
65 |
66 |
67 |
88 |
--------------------------------------------------------------------------------
/src/collections/grid/Column.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
16 |
--------------------------------------------------------------------------------
/src/collections/grid/Row.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
18 |
--------------------------------------------------------------------------------
/src/elements/Input.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
159 |
160 |
161 | # Input
162 |
163 | ```html
164 |
165 |
166 |
167 |
168 |
169 | Search
170 |
171 | Search
172 |
173 | ```
174 |
175 | # Output
176 |
177 | ```html
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
191 | ```
192 |
193 |
--------------------------------------------------------------------------------
/src/elements/Label.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
14 |
--------------------------------------------------------------------------------
/src/mixins/collections.js:
--------------------------------------------------------------------------------
1 | import Grid from './grid.js'
2 | import Form from './form.js'
3 |
4 | export default {
5 | Grid,
6 | Form,
7 | }
8 |
--------------------------------------------------------------------------------
/src/mixins/commons/align.js:
--------------------------------------------------------------------------------
1 | import Constants from './constants.js';
2 |
3 | const alignments = [
4 | Constants.bottom,
5 | Constants.center,
6 | Constants.left,
7 | Constants.middle,
8 | Constants.right,
9 | Constants.top,
10 | ];
11 |
12 | export default {
13 | props: {
14 | align: {
15 | type: [String, Array],
16 | }
17 | },
18 | methods: {
19 | getAlignClasses() {
20 | // Do we have a value?
21 | if (typeof this.align == 'undefined') {
22 | return false;
23 | }
24 |
25 | // We can't work with the prop itself
26 | var prop = this.align;
27 | // We work only with accepted values
28 | var regexp = new RegExp(alignments.join('|'));
29 |
30 | // We don't want arrays, for now
31 | if (this.align.constructor === Array) {
32 | prop = this.align.join(' ');
33 | }
34 |
35 | // Cast as array
36 | prop = prop.split(/[^a-z]/).filter(Boolean);
37 |
38 | // Remove words not accepted
39 | for (var i = 0; i < prop.length; i++) {
40 | if (!prop[i].match(regexp)) {
41 | prop.splice(i, 1);
42 | }
43 | }
44 |
45 | // If we don't have nothing to work
46 | if (prop.length < 1) {
47 | return false;
48 | }
49 |
50 | var glue = ' ' + Constants.aligned;
51 | return prop.join(glue + ' ') + glue;
52 | },
53 | },
54 | }
--------------------------------------------------------------------------------
/src/mixins/commons/arrai.js:
--------------------------------------------------------------------------------
1 | export default {
2 | methods: {
3 | arrayFlatten() {
4 | var result = [];
5 |
6 | for (var i = 0; i < arguments.length; i++) {
7 | if (Array.isArray(arguments[i])) {
8 | result = result.concat(this.arrayFlatten(...arguments[i]));
9 | } else {
10 | result.push(arguments[i]);
11 | }
12 | }
13 |
14 | return result;
15 | },
16 |
17 | }
18 | }
--------------------------------------------------------------------------------
/src/mixins/commons/centered.js:
--------------------------------------------------------------------------------
1 | export default {
2 | props: {
3 | centered: {
4 | type: Boolean,
5 | required: false,
6 | default: false,
7 | // validator(value) {
8 | // return true
9 | // },
10 | },
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/mixins/commons/column.js:
--------------------------------------------------------------------------------
1 | import Constants from './constants.js';
2 |
3 | const columns = [
4 | Constants.one,
5 | Constants.two,
6 | Constants.three,
7 | Constants.four,
8 | Constants.five,
9 | Constants.six,
10 | Constants.seven,
11 | Constants.eight,
12 | Constants.nine,
13 | Constants.ten,
14 | Constants.eleven,
15 | Constants.twelve,
16 | Constants.thirteen,
17 | Constants.fourteen,
18 | Constants.fifteen,
19 | Constants.sixteen,
20 | ];
21 |
22 | export default {
23 | props: {
24 | column: {
25 | type: [String, Number],
26 | required: false,
27 | validator(value) {
28 | return (value > 0 && value < 17) || columns.indexOf(value) > -1;
29 | }
30 | },
31 | },
32 | methods: {
33 | getSemanticColumns(value) {
34 | if (typeof value === 'undefined') {
35 | return columns;
36 | }
37 |
38 | return columns[value - 1];
39 | },
40 | getColumnClasses() {
41 | if (typeof this.column === 'undefined') {
42 | return '';
43 | }
44 |
45 | var classes = [Constants.column];
46 |
47 | if (isNaN(this.column)) {
48 | classes.unshift(this.column);
49 | } else {
50 | classes.unshift(this.getSemanticColumns(this.column));
51 | }
52 |
53 | return classes;
54 | },
55 | },
56 | }
--------------------------------------------------------------------------------
/src/mixins/commons/constants.js:
--------------------------------------------------------------------------------
1 | export default {
2 | action: 'action',
3 | active: 'active',
4 | aligned: 'aligned',
5 | animating: 'animating',
6 | basic: 'basic',
7 | big: 'big',
8 | blurring: 'blurring',
9 | bottom: 'bottom',
10 | center: 'center',
11 | centered: 'centered',
12 | checkbox: 'checkbox',
13 | column: 'column',
14 | columns: 'columns',
15 | computer: 'computer',
16 | dimmable: 'dimmable',
17 | dimmed: 'dimmed',
18 | dimmer: 'dimmer',
19 | down: 'down',
20 | eight: 'eight',
21 | eleven: 'eleven',
22 | equal: 'equal',
23 | fade: 'fade',
24 | fifteen: 'fifteen',
25 | five: 'five',
26 | flip: 'flip',
27 | floated: 'floated',
28 | four: 'four',
29 | fourteen: 'fourteen',
30 | fullscreen: 'fullscreen',
31 | horizontal: 'horizontal',
32 | huge: 'huge',
33 | icon: 'icon',
34 | in: 'in',
35 | inverted: 'inverted',
36 | labeled: 'labeled',
37 | large: 'large',
38 | left: 'left',
39 | massive: 'massive',
40 | medium: 'medium',
41 | middle: 'middle',
42 | mini: 'mini',
43 | mobile: 'mobile',
44 | modal: 'modal',
45 | modals: 'modals',
46 | nine: 'nine',
47 | one: 'one',
48 | out: 'out',
49 | page: 'page',
50 | radio: 'radio',
51 | right: 'right',
52 | scale: 'scale',
53 | seven: 'seven',
54 | six: 'six',
55 | sixteen: 'sixteen',
56 | slide: 'slide',
57 | slider: 'slider',
58 | small: 'small',
59 | tablet: 'tablet',
60 | ten: 'ten',
61 | thirteen: 'thirteen',
62 | three: 'three',
63 | tiny: 'tiny',
64 | toggle: 'toggle',
65 | top: 'top',
66 | transition: 'transition',
67 | twelve: 'twelve',
68 | two: 'two',
69 | ui: 'ui',
70 | up: 'up',
71 | vertical: 'vertical',
72 | visible: 'visible',
73 | wide: 'wide',
74 | widescreen: 'widescreen',
75 | width: 'width',
76 | }
--------------------------------------------------------------------------------
/src/mixins/commons/equal-width.js:
--------------------------------------------------------------------------------
1 | import Constants from './constants.js';
2 |
3 | export default {
4 | props: {
5 | equalWidth: {
6 | type: Boolean,
7 | required: false,
8 | default: false,
9 | },
10 | },
11 | methods: {
12 | getEqualWidthClasses() {
13 | if (this.equalWidth) {
14 | return [Constants.equal, Constants.width];
15 | }
16 |
17 | return false;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/mixins/commons/float.js:
--------------------------------------------------------------------------------
1 | import Constants from './constants.js';
2 |
3 | const floatings = [
4 | Constants.left,
5 | Constants.right,
6 | ];
7 |
8 | export default {
9 | props: {
10 | float: {
11 | type: String,
12 | validator(value) {
13 | return floatings.indexOf(value) > -1;
14 | },
15 | }
16 | },
17 | methods: {
18 | getFloatClasses() {
19 | return this.float ? [this.float, Constants.floated].join(' '): false;
20 | },
21 | },
22 | }
--------------------------------------------------------------------------------
/src/mixins/commons/icon.js:
--------------------------------------------------------------------------------
1 | import Constants from './constants.js';
2 |
3 | export default {
4 | props: {
5 | icon: {
6 | type: String,
7 | required: false,
8 | // default: false
9 | },
10 | iconPosition: {
11 | type: String,
12 | required: false,
13 | default: Constants.right,
14 | validator(value) {
15 | return value == Constants.right || value == Constants.left
16 | }
17 | },
18 | leftIcon: {
19 | type: String,
20 | required: false,
21 | // default: 'left',
22 | // validator(value) {
23 | // return true
24 | // }
25 | },
26 | },
27 | methods: {
28 | getIconClasses() {
29 | var classes = []
30 |
31 | if (this.icon) {
32 | if (this.iconPosition == Constants.left) {
33 | classes.push(this.iconPosition);
34 | }
35 |
36 | classes.push(Constants.icon);
37 | }
38 |
39 | return classes
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/mixins/commons/inverted.js:
--------------------------------------------------------------------------------
1 | export default {
2 | props: {
3 | inverted: {
4 | type: Boolean,
5 | required: false,
6 | default: false,
7 | // validator(value) {
8 | // return true
9 | // },
10 | },
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/mixins/commons/klass.js:
--------------------------------------------------------------------------------
1 | import Arrai from './arrai.js'
2 |
3 | export default {
4 | mixins: [Arrai],
5 | methods: {
6 | toggleClass(el, className) {
7 | if (!Array.isArray(className)) {
8 | className = className.split(' ')
9 | }
10 |
11 | for (var i = 0; i < className.length; i++) {
12 | if (el.classList) {
13 | el.classList.toggle(className);
14 | } else {
15 | var classes = el.className.split(' ');
16 | var existingIndex = classes.indexOf(className);
17 |
18 | if (existingIndex >= 0)
19 | classes.splice(existingIndex, 1);
20 | else
21 | classes.push(className);
22 |
23 | el.className = classes.join(' ');
24 | }
25 | }
26 | },
27 | addClass(el, className) {
28 | if (!Array.isArray(className)) {
29 | className = className.split(' ')
30 | }
31 |
32 | for (var i = 0; i < className.length; i++) {
33 | if (el.classList)
34 | el.classList.add(className)
35 | else
36 | el.className += ' ' + className
37 | }
38 | },
39 | arrayToClass(arrays) {
40 | return this.arrayFlatten(...arguments).join(' ');
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/mixins/commons/props/random.js:
--------------------------------------------------------------------------------
1 | export default {
2 | type: String,
3 | required: false,
4 | default () {
5 | return Math.random().toString(36).substring(7)
6 | },
7 | }
--------------------------------------------------------------------------------
/src/mixins/commons/props/type.js:
--------------------------------------------------------------------------------
1 | const types = [
2 | 'button',
3 | 'checkbox',
4 | 'color',
5 | 'date',
6 | 'datetime-local',
7 | 'email',
8 | 'file',
9 | 'hidden',
10 | 'image',
11 | 'month',
12 | 'number',
13 | 'password',
14 | 'radio',
15 | 'range',
16 | 'reset',
17 | 'search',
18 | 'submit',
19 | 'tel',
20 | 'text',
21 | 'time',
22 | 'url',
23 | 'week',
24 | ]
25 |
26 | export default {
27 | props: {
28 | type: {
29 | type: String,
30 | required: false,
31 | default: 'text',
32 | validator(value) {
33 | return types.indexOf(value) > -1
34 | }
35 | },
36 | }
37 | }
--------------------------------------------------------------------------------
/src/mixins/commons/sizes/eight.js:
--------------------------------------------------------------------------------
1 | import Constants from '../constants.js';
2 |
3 | const sizes = [
4 | Constants.massive,
5 | Constants.huge,
6 | Constants.big,
7 | Constants.large,
8 | Constants.medium,
9 | Constants.small,
10 | Constants.tiny,
11 | Constants.mini,
12 | ];
13 |
14 | export default {
15 | props: {
16 | size: {
17 | type: [String, Number],
18 | required: false,
19 | // default: false,
20 | validator(value) {
21 | return (value > 0 && value < (sizes.length + 1)) || sizes.indexOf(value) > -1;
22 | }
23 | },
24 | },
25 | methods: {
26 | getSemanticSizes(value) {
27 | if (typeof value === 'undefined') {
28 | return sizes;
29 | }
30 |
31 | return sizes[value - 1];
32 | },
33 | isSemanticSize(value) {
34 | return sizes.indexOf(value) > -1;
35 | },
36 | getSizeClasses() {
37 | return isNaN(this.size) ? this.size : this.getSemanticSizes(this.size);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/mixins/commons/sizes/six.js:
--------------------------------------------------------------------------------
1 | import Constants from '../constants.js';
2 |
3 | const sizes = [
4 | Constants.massive,
5 | Constants.huge,
6 | Constants.big,
7 | Constants.large,
8 | Constants.small,
9 | Constants.mini,
10 | ];
11 |
12 | export default {
13 | props: {
14 | size: {
15 | type: [String, Number],
16 | required: false,
17 | // default: false,
18 | validator(value) {
19 | return (value > 0 && value) < (sizes.length + 1) || sizes.indexOf(value) > -1;
20 | }
21 | },
22 | },
23 | methods: {
24 | getSemanticSizes(value) {
25 | if (typeof value === 'undefined') {
26 | return sizes;
27 | }
28 |
29 | return sizes[value - 1];
30 | },
31 | isSemanticSize(value) {
32 | return sizes.indexOf(value) > -1;
33 | },
34 | getSizeClasses() {
35 | return isNaN(this.size) ? this.size : this.getSemanticSizes(this.size);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/mixins/commons/states/disabled.js:
--------------------------------------------------------------------------------
1 | export default {
2 | props: {
3 | disabled: {
4 | type: Boolean,
5 | required: false,
6 | default: false,
7 | // validator(value) {
8 | // return true
9 | // },
10 | },
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/mixins/commons/states/error.js:
--------------------------------------------------------------------------------
1 | export default {
2 | props: {
3 | error: {
4 | type: Boolean,
5 | required: false,
6 | default: false,
7 | // validator(value) {
8 | // return true
9 | // },
10 | },
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/mixins/commons/states/focus.js:
--------------------------------------------------------------------------------
1 | export default {
2 | props: {
3 | focus: {
4 | type: Boolean,
5 | required: false,
6 | default: false,
7 | // validator(value) {
8 | // return true
9 | // },
10 | },
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/mixins/commons/states/loading.js:
--------------------------------------------------------------------------------
1 | export default {
2 | props: {
3 | loading: {
4 | type: Boolean,
5 | required: false,
6 | default: false,
7 | // validator(value) {
8 | // return true
9 | // },
10 | },
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/mixins/commons/states/success.js:
--------------------------------------------------------------------------------
1 | export default {
2 | props: {
3 | success: {
4 | type: Boolean,
5 | required: false,
6 | default: false,
7 | // validator(value) {
8 | // return true
9 | // },
10 | },
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/mixins/commons/states/warning.js:
--------------------------------------------------------------------------------
1 | export default {
2 | props: {
3 | warning: {
4 | type: Boolean,
5 | required: false,
6 | default: false,
7 | // validator(value) {
8 | // return true
9 | // },
10 | },
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/mixins/commons/width.js:
--------------------------------------------------------------------------------
1 | import Constants from './constants.js';
2 |
3 | const widths = [
4 | Constants.one,
5 | Constants.two,
6 | Constants.three,
7 | Constants.four,
8 | Constants.five,
9 | Constants.six,
10 | Constants.seven,
11 | Constants.eight,
12 | Constants.nine,
13 | Constants.ten,
14 | Constants.eleven,
15 | Constants.twelve,
16 | Constants.thirteen,
17 | Constants.fourteen,
18 | Constants.fifteen,
19 | Constants.sixteen,
20 | ]
21 |
22 | export default {
23 | props: {
24 | width: {
25 | type: [String, Number],
26 | required: false,
27 | // default: false,
28 | validator(value) {
29 | return (value > 0 && value < 17) || widths.indexOf(value) > -1;
30 | }
31 | },
32 | mobile: {
33 | type: [String, Number],
34 | required: false,
35 | // default: false,
36 | validator(value) {
37 | return (value > 0 && value < 17) || widths.indexOf(value) > -1;
38 | }
39 | },
40 | tablet: {
41 | type: [String, Number],
42 | required: false,
43 | // default: false,
44 | validator(value) {
45 | return (value > 0 && value < 17) || widths.indexOf(value) > -1;
46 | }
47 | },
48 | computer: {
49 | type: [String, Number],
50 | required: false,
51 | // default: false,
52 | validator(value) {
53 | return (value > 0 && value < 17) || widths.indexOf(value) > -1;
54 | }
55 | },
56 | widescreen: {
57 | type: [String, Number],
58 | required: false,
59 | // default: false,
60 | validator(value) {
61 | return (value > 0 && value < 17) || widths.indexOf(value) > -1;
62 | }
63 | },
64 | },
65 | methods: {
66 | getSemanticWidths(value) {
67 | if (typeof value === 'undefined') {
68 | return widths;
69 | }
70 |
71 | return widths[value - 1];
72 | },
73 | getWidthClassesFor(type, width) {
74 |
75 | var classes = [];
76 |
77 | classes.unshift(Constants.wide, type);
78 |
79 | if (isNaN(width)) {
80 | classes.unshift(width);
81 | } else {
82 | classes.unshift(this.getSemanticWidths(width));
83 | }
84 |
85 | return classes;
86 | },
87 | getWidthClasses() {
88 | if (
89 | typeof this.width === 'undefined' &&
90 | typeof this.mobile === 'undefined' &&
91 | typeof this.tablet === 'undefined' &&
92 | typeof this.computer === 'undefined' &&
93 | typeof this.widescreen === 'undefined'
94 | ) {
95 | return false;
96 | }
97 |
98 | var classes = [];
99 |
100 | if (typeof this.mobile === 'undefined' &&
101 | typeof this.tablet === 'undefined' &&
102 | typeof this.computer === 'undefined' &&
103 | typeof this.widescreen === 'undefined'
104 | ) {
105 | classes.unshift(Constants.wide);
106 |
107 | if (isNaN(this.width)) {
108 | classes.unshift(this.width);
109 | } else {
110 | classes.unshift(this.getSemanticWidths(this.width));
111 | }
112 | } else {
113 | if (typeof this.widescreen !== 'undefined') {
114 | classes.unshift(...this.getWidthClassesFor(Constants.widescreen, this.widescreen));
115 | }
116 |
117 | if (typeof this.computer !== 'undefined') {
118 | classes.unshift(...this.getWidthClassesFor(Constants.computer, this.computer));
119 | }
120 |
121 | if (typeof this.tablet !== 'undefined') {
122 | classes.unshift(...this.getWidthClassesFor(Constants.tablet, this.tablet));
123 | }
124 |
125 | if (typeof this.mobile !== 'undefined') {
126 | classes.unshift(...this.getWidthClassesFor(Constants.mobile, this.mobile));
127 | }
128 | }
129 |
130 | return classes;
131 | }
132 | }
133 | }
--------------------------------------------------------------------------------
/src/mixins/form.js:
--------------------------------------------------------------------------------
1 | import Form from '../collections/Form.vue'
2 | import Field from '../collections/form/Field.vue'
3 |
4 | export default {
5 | components: {
6 | 'ui-form': Form,
7 | 'ui-field': Field,
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/mixins/grid.js:
--------------------------------------------------------------------------------
1 | import Grid from '../collections/Grid.vue'
2 | import Row from '../collections/grid/Row.vue'
3 | import Column from '../collections/grid/Column.vue'
4 |
5 | export default {
6 | components: {
7 | 'ui-grid': Grid,
8 | 'ui-row': Row,
9 | 'ui-column': Column,
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/mixins/index.js:
--------------------------------------------------------------------------------
1 | import Grid from './grid.js'
2 | import Form from './form.js'
3 |
4 | import Input from '../elements/Input.vue'
5 | import Label from '../elements/Label.vue'
6 |
7 | import Checkbox from '../modules/Checkbox.vue'
8 | import Modal from '../modules/Modal.vue'
9 | import Dropdown from '../modules/Dropdown.vue'
10 |
11 | export default {
12 | mixins: [
13 | Grid,
14 | Form,
15 | ],
16 | components: {
17 | 'ui-input': Input,
18 | 'ui-label': Label,
19 | 'ui-checkbox': Checkbox,
20 | 'ui-dropdown': Dropdown,
21 | 'ui-modal': Modal,
22 | },
23 | }
24 |
--------------------------------------------------------------------------------
/src/mixins/modules.js:
--------------------------------------------------------------------------------
1 | import Checkbox from '../modules/Checkbox.vue'
2 | import Dropdown from '../modules/Dropdown.vue'
3 | import Modal from '../modules/Modal.vue'
4 |
5 | export default {
6 | Checkbox,
7 | Dropdown,
8 | Modal,
9 | }
10 |
--------------------------------------------------------------------------------
/src/modules/Checkbox.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
61 |
64 |
65 |
66 |
67 |
229 |
230 |
236 |
237 |
238 | `v-model` has to be an `array` if you want to track multiple selections
239 |
240 |
241 |
--------------------------------------------------------------------------------
/src/modules/Dropdown.vue:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
26 |
{{ selected.text || selected.value || placeholder || text }}
31 |
38 |
43 |
44 |
45 |
55 | {{ item.name ? item.name : item.value }}
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/src/modules/Modal.vue:
--------------------------------------------------------------------------------
1 |
2 |
9 |
15 |
22 |
26 |
28 |
31 |
32 |
![]()
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------