@lx-frontend/wrap-element-ui 0.4.0-beta.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,150 +1,150 @@
1
- <template>
2
- <div
3
- class="search-select"
4
- @keyup.up.prevent="navigateOptions($event, 'prev')"
5
- @keyup.down.prevent="navigateOptions($event, 'next')"
6
- @keyup.enter.prevent="selectOption"
7
- >
8
- <el-input
9
- class="search-select__input"
10
- ref="input"
11
- v-model="content"
12
- :placeholder="placeholder"
13
- @input="handleInputChange"
14
- @focus="handleFocus"
15
- @blur="handleBlur"
16
- ></el-input>
17
- <div v-if="visible && value !== ''" class="select-down" >
18
- <div
19
- v-for="(item, index) in list"
20
- :key="getKey(item, index)"
21
- :class="['select-down__item', {'select-down__item--active': currentId === index}]"
22
- @mouseover="currentId = index"
23
- @click="handleSelect(item)"
24
- >
25
- <div
26
- v-for="(showItem, index) in showList"
27
- :key="getKey(showItem, index)"
28
- :style="`flex: ${showItem.flex}`"
29
- :class="`select-down__box select-down__${showItem.name}`"
30
- >
31
- <span>{{ item[showItem.name] || '--' }}</span>
32
- </div>
33
- </div>
34
- </div>
35
- </div>
36
- </template>
37
-
38
- <script>
39
- export default {
40
- name: 'SearchSelect',
41
- props: {
42
- value: {
43
- default: '',
44
- type: String,
45
- },
46
- placeholder: {
47
- default: '请输入',
48
- type: String,
49
- },
50
- list: {
51
- default: () => [],
52
- type: Array,
53
- },
54
- showList: {
55
- default: () => [],
56
- type: Array,
57
- }
58
- },
59
- data() {
60
- return {
61
- content: '',
62
- visible: false,
63
- currentId: 0
64
- }
65
- },
66
- watch: {
67
- value(val) {
68
- this.content = val
69
- }
70
- },
71
- methods: {
72
- handleFocus() {
73
- this.visible = true
74
- this.$emit('input', this.content)
75
- },
76
- handleInputChange(params) {
77
- this.$emit('update:value', params)
78
- this.$emit('input', params)
79
- },
80
- navigateOptions(e, params) {
81
- e.target.selectionStart = this.content.length
82
- if (params === 'next') this.currentId = this.currentId === this.list.length - 1 ? 0 : this.currentId + 1
83
- if (params === 'prev') this.currentId = this.currentId === 0 ? this.list.length - 1 : this.currentId - 1
84
- },
85
- selectOption() {
86
- this.visible = false
87
- this.$refs.input.blur()
88
- this.$emit('select', this.list[this.currentId])
89
- },
90
- handleBlur() {
91
- const timer = setTimeout(() => {
92
- this.visible = false
93
- clearTimeout(timer)
94
- }, 300)
95
- },
96
- handleSelect(item) {
97
- this.$emit('select', item)
98
- },
99
- getKey (item, index) {
100
- return btoa(escape(`${item}_${index}`))
101
- }
102
- },
103
- };
104
- </script>
105
-
106
- <style lang="scss">
107
- .search-select{
108
- position: relative;
109
- width: 100%;
110
-
111
- &__input{
112
- width: 100%;
113
- }
114
- }
115
-
116
- .select-down{
117
- width: 100%;
118
- position: absolute;
119
- z-index: 100;
120
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
121
- border-radius: 4px;
122
- border: 0 solid #d0d0d1;
123
- background-color: #fff;
124
- overflow: hidden;
125
- margin-top: 10px;
126
-
127
- &__item{
128
- height: 30px;
129
- line-height: 30px;
130
- display: flex;
131
- justify-content: space-between;
132
- text-align: center;
133
- box-sizing: border-box;
134
- padding: 0 15px;
135
-
136
- &--active{
137
- background-color: #eee;
138
- }
139
- }
140
-
141
- &__box{
142
- text-align: center;
143
- overflow: hidden;
144
-
145
- &:first-of-type{
146
- text-align: left;
147
- }
148
- }
149
- }
150
- </style>
1
+ <template>
2
+ <div
3
+ class="search-select"
4
+ @keyup.up.prevent="navigateOptions($event, 'prev')"
5
+ @keyup.down.prevent="navigateOptions($event, 'next')"
6
+ @keyup.enter.prevent="selectOption"
7
+ >
8
+ <el-input
9
+ class="search-select__input"
10
+ ref="input"
11
+ v-model="content"
12
+ :placeholder="placeholder"
13
+ @input="handleInputChange"
14
+ @focus="handleFocus"
15
+ @blur="handleBlur"
16
+ ></el-input>
17
+ <div v-if="visible && value !== ''" class="select-down" >
18
+ <div
19
+ v-for="(item, index) in list"
20
+ :key="getKey(item, index)"
21
+ :class="['select-down__item', {'select-down__item--active': currentId === index}]"
22
+ @mouseover="currentId = index"
23
+ @click="handleSelect(item)"
24
+ >
25
+ <div
26
+ v-for="(showItem, index) in showList"
27
+ :key="getKey(showItem, index)"
28
+ :style="`flex: ${showItem.flex}`"
29
+ :class="`select-down__box select-down__${showItem.name}`"
30
+ >
31
+ <span>{{ item[showItem.name] || '--' }}</span>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <script>
39
+ export default {
40
+ name: 'SearchSelect',
41
+ props: {
42
+ value: {
43
+ default: '',
44
+ type: String,
45
+ },
46
+ placeholder: {
47
+ default: '请输入',
48
+ type: String,
49
+ },
50
+ list: {
51
+ default: () => [],
52
+ type: Array,
53
+ },
54
+ showList: {
55
+ default: () => [],
56
+ type: Array,
57
+ }
58
+ },
59
+ data() {
60
+ return {
61
+ content: '',
62
+ visible: false,
63
+ currentId: 0
64
+ }
65
+ },
66
+ watch: {
67
+ value(val) {
68
+ this.content = val
69
+ }
70
+ },
71
+ methods: {
72
+ handleFocus() {
73
+ this.visible = true
74
+ this.$emit('input', this.content)
75
+ },
76
+ handleInputChange(params) {
77
+ this.$emit('update:value', params)
78
+ this.$emit('input', params)
79
+ },
80
+ navigateOptions(e, params) {
81
+ e.target.selectionStart = this.content.length
82
+ if (params === 'next') this.currentId = this.currentId === this.list.length - 1 ? 0 : this.currentId + 1
83
+ if (params === 'prev') this.currentId = this.currentId === 0 ? this.list.length - 1 : this.currentId - 1
84
+ },
85
+ selectOption() {
86
+ this.visible = false
87
+ this.$refs.input.blur()
88
+ this.$emit('select', this.list[this.currentId])
89
+ },
90
+ handleBlur() {
91
+ const timer = setTimeout(() => {
92
+ this.visible = false
93
+ clearTimeout(timer)
94
+ }, 300)
95
+ },
96
+ handleSelect(item) {
97
+ this.$emit('select', item)
98
+ },
99
+ getKey (item, index) {
100
+ return btoa(escape(`${item}_${index}`))
101
+ }
102
+ },
103
+ };
104
+ </script>
105
+
106
+ <style lang="scss">
107
+ .search-select{
108
+ position: relative;
109
+ width: 100%;
110
+
111
+ &__input{
112
+ width: 100%;
113
+ }
114
+ }
115
+
116
+ .select-down{
117
+ width: 100%;
118
+ position: absolute;
119
+ z-index: 100;
120
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
121
+ border-radius: 4px;
122
+ border: 0 solid #d0d0d1;
123
+ background-color: #fff;
124
+ overflow: hidden;
125
+ margin-top: 10px;
126
+
127
+ &__item{
128
+ height: 30px;
129
+ line-height: 30px;
130
+ display: flex;
131
+ justify-content: space-between;
132
+ text-align: center;
133
+ box-sizing: border-box;
134
+ padding: 0 15px;
135
+
136
+ &--active{
137
+ background-color: #eee;
138
+ }
139
+ }
140
+
141
+ &__box{
142
+ text-align: center;
143
+ overflow: hidden;
144
+
145
+ &:first-of-type{
146
+ text-align: left;
147
+ }
148
+ }
149
+ }
150
+ </style>
package/packages/index.js CHANGED
@@ -1,59 +1,59 @@
1
- /**
2
- * @author Vic
3
- * Date: 19/03/14
4
- */
5
- import DemoComponent from './DemoComponent/index'
6
- import AuditSteps from './AuditSteps/index'
7
- import Ellipsis from './Ellipsis/index'
8
- import SearchForm from './SearchForm/index'
9
- import LxTable from './LxTable/index'
10
- import SearchSelect from './SearchSelect/index'
11
- import AddMembers from './AddMembers/index'
12
- import PopoverForm from './PopoverForm/index'
13
-
14
-
15
- const components = [
16
- DemoComponent,
17
- AuditSteps,
18
- Ellipsis,
19
- SearchForm,
20
- LxTable,
21
- SearchSelect,
22
- AddMembers,
23
- PopoverForm
24
- ]
25
-
26
- const install = function (Vue) {
27
- if (install.installed) return
28
- components.map(function(component) {
29
- Vue.component(component.name, component)
30
- })
31
- }
32
-
33
- if (typeof window !== 'undefined' && window.Vue) {
34
- install(window.Vue)
35
- }
36
-
37
- export {
38
- install,
39
- DemoComponent,
40
- AuditSteps,
41
- Ellipsis,
42
- SearchForm,
43
- LxTable,
44
- SearchSelect,
45
- AddMembers,
46
- PopoverForm
47
- }
48
-
49
- export default {
50
- install,
51
- DemoComponent,
52
- AuditSteps,
53
- Ellipsis,
54
- SearchForm,
55
- LxTable,
56
- SearchSelect,
57
- AddMembers,
58
- PopoverForm
59
- }
1
+ /**
2
+ * @author Vic
3
+ * Date: 19/03/14
4
+ */
5
+ import DemoComponent from './DemoComponent/index'
6
+ import AuditSteps from './AuditSteps/index'
7
+ import Ellipsis from './Ellipsis/index'
8
+ import SearchForm from './SearchForm/index'
9
+ import LxTable from './LxTable/index'
10
+ import SearchSelect from './SearchSelect/index'
11
+ import AddMembers from './AddMembers/index'
12
+ import PopoverForm from './PopoverForm/index'
13
+
14
+
15
+ const components = [
16
+ DemoComponent,
17
+ AuditSteps,
18
+ Ellipsis,
19
+ SearchForm,
20
+ LxTable,
21
+ SearchSelect,
22
+ AddMembers,
23
+ PopoverForm
24
+ ]
25
+
26
+ const install = function (Vue) {
27
+ if (install.installed) return
28
+ components.map(function(component) {
29
+ Vue.component(component.name, component)
30
+ })
31
+ }
32
+
33
+ if (typeof window !== 'undefined' && window.Vue) {
34
+ install(window.Vue)
35
+ }
36
+
37
+ export {
38
+ install,
39
+ DemoComponent,
40
+ AuditSteps,
41
+ Ellipsis,
42
+ SearchForm,
43
+ LxTable,
44
+ SearchSelect,
45
+ AddMembers,
46
+ PopoverForm
47
+ }
48
+
49
+ export default {
50
+ install,
51
+ DemoComponent,
52
+ AuditSteps,
53
+ Ellipsis,
54
+ SearchForm,
55
+ LxTable,
56
+ SearchSelect,
57
+ AddMembers,
58
+ PopoverForm
59
+ }
@@ -1,44 +1,44 @@
1
- import { Message } from 'element-ui';
2
- import MessageType from 'element-ui/packages/message';
3
-
4
-
5
- let messageInstance: MessageType = null;
6
-
7
- const closeMsg = (message: MessageType) => {
8
- message.singleTimer = setTimeout(() => {
9
- message.singleTimer && clearTimeout(message.singleTimer);
10
- message.close();
11
- messageInstance = null;
12
- }, 3000);
13
- };
14
-
15
- const singleMessage: MessageType = (options: any) => {
16
- if (
17
- messageInstance
18
- && (messageInstance.message !== options.message || messageInstance.type !== options.type)
19
- ) {
20
- messageInstance.close();
21
- messageInstance = Message({ ...options, duration: 0 });
22
- return closeMsg(messageInstance);
23
- }
24
- if (messageInstance) {
25
- messageInstance.singleTimer && clearTimeout(messageInstance.singleTimer);
26
- return closeMsg(messageInstance);
27
- }
28
- messageInstance = Message({ ...options, duration: 0 });
29
- closeMsg(messageInstance);
30
- };
31
-
32
- ['error', 'success', 'info', 'warning'].forEach(type => {
33
- singleMessage[type] = options => {
34
- if (typeof options === 'string') {
35
- options = {
36
- message: options,
37
- };
38
- }
39
- options.type = type;
40
- return singleMessage(options);
41
- };
42
- });
43
-
44
- export default singleMessage;
1
+ import { Message } from 'element-ui';
2
+ import MessageType from 'element-ui/packages/message';
3
+
4
+
5
+ let messageInstance: MessageType = null;
6
+
7
+ const closeMsg = (message: MessageType) => {
8
+ message.singleTimer = setTimeout(() => {
9
+ message.singleTimer && clearTimeout(message.singleTimer);
10
+ message.close();
11
+ messageInstance = null;
12
+ }, 3000);
13
+ };
14
+
15
+ const singleMessage: MessageType = (options: any) => {
16
+ if (
17
+ messageInstance
18
+ && (messageInstance.message !== options.message || messageInstance.type !== options.type)
19
+ ) {
20
+ messageInstance.close();
21
+ messageInstance = Message({ ...options, duration: 0 });
22
+ return closeMsg(messageInstance);
23
+ }
24
+ if (messageInstance) {
25
+ messageInstance.singleTimer && clearTimeout(messageInstance.singleTimer);
26
+ return closeMsg(messageInstance);
27
+ }
28
+ messageInstance = Message({ ...options, duration: 0 });
29
+ closeMsg(messageInstance);
30
+ };
31
+
32
+ ['error', 'success', 'info', 'warning'].forEach(type => {
33
+ singleMessage[type] = options => {
34
+ if (typeof options === 'string') {
35
+ options = {
36
+ message: options,
37
+ };
38
+ }
39
+ options.type = type;
40
+ return singleMessage(options);
41
+ };
42
+ });
43
+
44
+ export default singleMessage;
@@ -1,25 +1,25 @@
1
- 'use strict';
2
-
3
- var gulp = require('gulp');
4
- var sass = require('gulp-sass');
5
- var autoprefixer = require('gulp-autoprefixer');
6
- var cssmin = require('gulp-cssmin');
7
-
8
- gulp.task('compile', function() {
9
- return gulp.src('./src/*.scss')
10
- .pipe(sass.sync())
11
- .pipe(autoprefixer({
12
- browsers: ['ie > 9', 'last 2 versions'],
13
- cascade: false
14
- }))
15
- .pipe(cssmin())
16
- .pipe(gulp.dest('./lib'));
17
- });
18
-
19
- gulp.task('copyfont', function() {
20
- return gulp.src('./src/fonts/**')
21
- .pipe(cssmin())
22
- .pipe(gulp.dest('./lib/fonts'));
23
- });
24
-
25
- gulp.task('build', ['compile', 'copyfont']);
1
+ 'use strict';
2
+
3
+ var gulp = require('gulp');
4
+ var sass = require('gulp-sass');
5
+ var autoprefixer = require('gulp-autoprefixer');
6
+ var cssmin = require('gulp-cssmin');
7
+
8
+ gulp.task('compile', function() {
9
+ return gulp.src('./src/*.scss')
10
+ .pipe(sass.sync())
11
+ .pipe(autoprefixer({
12
+ browsers: ['ie > 9', 'last 2 versions'],
13
+ cascade: false
14
+ }))
15
+ .pipe(cssmin())
16
+ .pipe(gulp.dest('./lib'));
17
+ });
18
+
19
+ gulp.task('copyfont', function() {
20
+ return gulp.src('./src/fonts/**')
21
+ .pipe(cssmin())
22
+ .pipe(gulp.dest('./lib/fonts'));
23
+ });
24
+
25
+ gulp.task('build', ['compile', 'copyfont']);
@@ -1,23 +1,23 @@
1
- {
2
- "name": "wrap-element-ui-theme-default",
3
- "version": "0.0.0",
4
- "description": "wrap-element-ui component default theme.",
5
- "main": "lib/index.css",
6
- "scripts": {
7
- "dev": "gulp build && gulp watch",
8
- "build": "gulp build"
9
- },
10
- "keywords": [
11
- "wrap-element-ui",
12
- "theme"
13
- ],
14
- "author": "Vic",
15
- "license": "MIT",
16
- "devDependencies": {
17
- "gulp": "^3.9.1",
18
- "gulp-cssmin": "^0.1.7",
19
- "gulp-postcss": "^6.1.1",
20
- "postcss-salad": "^1.0.5"
21
- },
22
- "dependencies": {}
23
- }
1
+ {
2
+ "name": "wrap-element-ui-theme-default",
3
+ "version": "0.0.0",
4
+ "description": "wrap-element-ui component default theme.",
5
+ "main": "lib/index.css",
6
+ "scripts": {
7
+ "dev": "gulp build && gulp watch",
8
+ "build": "gulp build"
9
+ },
10
+ "keywords": [
11
+ "wrap-element-ui",
12
+ "theme"
13
+ ],
14
+ "author": "Vic",
15
+ "license": "MIT",
16
+ "devDependencies": {
17
+ "gulp": "^3.9.1",
18
+ "gulp-cssmin": "^0.1.7",
19
+ "gulp-postcss": "^6.1.1",
20
+ "postcss-salad": "^1.0.5"
21
+ },
22
+ "dependencies": {}
23
+ }