nubomed-ui 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/{nubomed-ui/nubomed-ui.es.js → nubomed-ui.es.js} +547 -581
- package/{nubomed-ui/nubomed-ui.umd.js → nubomed-ui.umd.js} +1 -1
- package/package.json +7 -18
- package/.env.bi +0 -13
- package/.env.terminal +0 -13
- package/.vscode/extensions.json +0 -3
- package/README.md +0 -17
- package/index.html +0 -13
- package/src/App.vue +0 -31
- package/src/bi-demos/Header.vue +0 -29
- package/src/bi-demos/Table.vue +0 -69
- package/src/bi-demos/index.vue +0 -132
- package/src/bi-packages/components/Box/images/corner-error.png +0 -0
- package/src/bi-packages/components/Box/images/corner-warning.png +0 -0
- package/src/bi-packages/components/Box/images/corner.png +0 -0
- package/src/bi-packages/components/Box/index.scss +0 -86
- package/src/bi-packages/components/Box/index.vue +0 -53
- package/src/bi-packages/components/Carousel/CarouselItem.vue +0 -0
- package/src/bi-packages/components/Carousel/index.vue +0 -0
- package/src/bi-packages/components/Header/images/left-bg.png +0 -0
- package/src/bi-packages/components/Header/images/logo.png +0 -0
- package/src/bi-packages/components/Header/images/right-bg.png +0 -0
- package/src/bi-packages/components/Header/index.scss +0 -50
- package/src/bi-packages/components/Header/index.vue +0 -54
- package/src/bi-packages/components/Table/TableColgroup.vue +0 -43
- package/src/bi-packages/components/Table/index copy.vue +0 -107
- package/src/bi-packages/components/Table/index.scss +0 -118
- package/src/bi-packages/components/Table/index.vue +0 -108
- package/src/bi-packages/components/TableColumn/index.scss +0 -7
- package/src/bi-packages/components/TableColumn/index.vue +0 -60
- package/src/bi-packages/fonts/OPPOSans-B.ttf +0 -0
- package/src/bi-packages/fonts/OPPOSans-M.ttf +0 -0
- package/src/bi-packages/fonts/font.scss +0 -11
- package/src/bi-packages/iconfont-svg/demo.css +0 -539
- package/src/bi-packages/iconfont-svg/demo_index.html +0 -4811
- package/src/bi-packages/iconfont-svg/iconfont.css +0 -819
- package/src/bi-packages/iconfont-svg/iconfont.js +0 -1
- package/src/bi-packages/iconfont-svg/iconfont.json +0 -1416
- package/src/bi-packages/iconfont-svg/iconfont.ttf +0 -0
- package/src/bi-packages/iconfont-svg/iconfont.woff +0 -0
- package/src/bi-packages/iconfont-svg/iconfont.woff2 +0 -0
- package/src/bi-packages/index.js +0 -34
- package/src/bi-packages/styles/mixin.scss +0 -12
- package/src/bi-packages/styles/var.scss +0 -11
- package/src/demos/ActionBar.vue +0 -59
- package/src/demos/Badge.vue +0 -28
- package/src/demos/Button copy.vue +0 -302
- package/src/demos/Button.vue +0 -116
- package/src/demos/ButtonGroup.vue +0 -40
- package/src/demos/Check.vue +0 -29
- package/src/demos/Dialog.vue +0 -255
- package/src/demos/Empty.vue +0 -38
- package/src/demos/FooterMenu.vue +0 -49
- package/src/demos/Header.vue +0 -71
- package/src/demos/Icons.vue +0 -314
- package/src/demos/Input.vue +0 -87
- package/src/demos/InputKeyboard.vue +0 -30
- package/src/demos/InputNumber.vue +0 -34
- package/src/demos/LeftMenu.vue +0 -128
- package/src/demos/Menus.vue +0 -106
- package/src/demos/OpenCabinetBall.vue +0 -37
- package/src/demos/Statusbar.vue +0 -146
- package/src/demos/Steps.vue +0 -45
- package/src/demos/Tost.vue +0 -35
- package/src/demos/button/button.md +0 -19
- package/src/demos/data/terList.json +0 -145
- package/src/demos/images/cabinets/H3000-D.png +0 -0
- package/src/demos/images/cabinets/H3000-R.png +0 -0
- package/src/demos/images/cabinets/H3000-Rh.png +0 -0
- package/src/demos/images/cabinets/H3000-Rh2.png +0 -0
- package/src/demos/images/cabinets/H3010-R.png +0 -0
- package/src/demos/index.vue +0 -348
- package/src/docs/icons/Icon.vue +0 -72
- package/src/docs/icons/icon.md +0 -21
- package/src/docs/index.html +0 -15
- package/src/docs/index.vue +0 -301
- package/src/main.js +0 -23
- package/src/packages/components/ActionBar/images/error.png +0 -0
- package/src/packages/components/ActionBar/images/loading.gif +0 -0
- package/src/packages/components/ActionBar/images/success.png +0 -0
- package/src/packages/components/ActionBar/images/warning.png +0 -0
- package/src/packages/components/ActionBar/images/warning_yellow.png +0 -0
- package/src/packages/components/ActionBar/index.scss +0 -81
- package/src/packages/components/ActionBar/index.vue +0 -100
- package/src/packages/components/Badge/index.scss +0 -50
- package/src/packages/components/Badge/index.vue +0 -75
- package/src/packages/components/Button/index.scss +0 -241
- package/src/packages/components/Button/index.vue +0 -111
- package/src/packages/components/ButtonGroup/index.scss +0 -54
- package/src/packages/components/ButtonGroup/index.vue +0 -75
- package/src/packages/components/Check/Cate.vue +0 -138
- package/src/packages/components/Check/index.scss +0 -47
- package/src/packages/components/Check/index.vue +0 -105
- package/src/packages/components/Dialog/images/error.png +0 -0
- package/src/packages/components/Dialog/images/success.png +0 -0
- package/src/packages/components/Dialog/images/warning-red.png +0 -0
- package/src/packages/components/Dialog/images/warning-yellow.png +0 -0
- package/src/packages/components/Dialog/index.scss +0 -154
- package/src/packages/components/Dialog/index.vue +0 -305
- package/src/packages/components/Empty/images/empty-abnormal.png +0 -0
- package/src/packages/components/Empty/images/empty-data.png +0 -0
- package/src/packages/components/Empty/images/empty-search.png +0 -0
- package/src/packages/components/Empty/index.vue +0 -68
- package/src/packages/components/Form/FormItem.vue +0 -73
- package/src/packages/components/Form/index.vue +0 -76
- package/src/packages/components/Icon/index.vue +0 -30
- package/src/packages/components/Input/index.scss +0 -184
- package/src/packages/components/Input/index.vue +0 -189
- package/src/packages/components/InputKeyboard/index.scss +0 -63
- package/src/packages/components/InputKeyboard/index.vue +0 -117
- package/src/packages/components/InputNumber/index.scss +0 -103
- package/src/packages/components/InputNumber/index.vue +0 -160
- package/src/packages/components/Menu/index.scss +0 -559
- package/src/packages/components/Menu/index.vue +0 -211
- package/src/packages/components/OpenCabinetBall/CabinetStatus.vue +0 -94
- package/src/packages/components/OpenCabinetBall/index.scss +0 -204
- package/src/packages/components/OpenCabinetBall/index.vue +0 -113
- package/src/packages/components/Statusbar/CabinetList.vue +0 -125
- package/src/packages/components/Statusbar/CabinetListStatus.vue +0 -75
- package/src/packages/components/Statusbar/CabinetListTempHum.vue +0 -108
- package/src/packages/components/Statusbar/index.scss +0 -205
- package/src/packages/components/Statusbar/index.vue +0 -83
- package/src/packages/components/Steps/index.scss +0 -104
- package/src/packages/components/Steps/index.vue +0 -66
- package/src/packages/components/SvgIcon/index.vue +0 -41
- package/src/packages/components/Toast/index.vue +0 -72
- package/src/packages/fonts/OPPOSans-B.ttf +0 -0
- package/src/packages/fonts/OPPOSans-M.ttf +0 -0
- package/src/packages/fonts/font.scss +0 -11
- package/src/packages/iconfont-svg/demo.css +0 -539
- package/src/packages/iconfont-svg/demo_index.html +0 -4811
- package/src/packages/iconfont-svg/iconfont.css +0 -819
- package/src/packages/iconfont-svg/iconfont.js +0 -1
- package/src/packages/iconfont-svg/iconfont.json +0 -1416
- package/src/packages/iconfont-svg/iconfont.ttf +0 -0
- package/src/packages/iconfont-svg/iconfont.woff +0 -0
- package/src/packages/iconfont-svg/iconfont.woff2 +0 -0
- package/src/packages/index.js +0 -64
- package/src/packages/styles/var.scss +0 -24
- package/src/utils/create.js +0 -48
- package/src/utils/index.js +0 -13
- package/src/utils/validate.js +0 -3
- package/vite.config.js +0 -47
- /package/{nubomed-ui/style.css → style.css} +0 -0
@@ -1,73 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: chenghuan.dong
|
3
|
-
* @Date: 2022-12-24 19:25:39
|
4
|
-
* @LastEditors: chenghuan.dong
|
5
|
-
* @LastEditTime: 2023-07-04 20:11:13
|
6
|
-
* @Description: 空页面
|
7
|
-
-->
|
8
|
-
<template>
|
9
|
-
<div :class="bem(['', prop])" :prop="prop" :ref="prop">
|
10
|
-
<label v-if="label" :class="labelClasses">{{ label }}</label>
|
11
|
-
<div :class="bem('content')"><slot></slot>
|
12
|
-
<p v-if="errorMessage">{{ errorMessage }}</p>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
</template>
|
16
|
-
<script setup>
|
17
|
-
import { computed } from 'vue';
|
18
|
-
import { createNamespace } from '../../../utils/create.js'
|
19
|
-
// 定义名称
|
20
|
-
defineOptions({
|
21
|
-
name: 'NbFormItem'
|
22
|
-
})
|
23
|
-
|
24
|
-
// 定义props
|
25
|
-
const props = defineProps({
|
26
|
-
// 定义Props
|
27
|
-
// 提示语
|
28
|
-
label: {
|
29
|
-
type: String,
|
30
|
-
default: ''
|
31
|
-
},
|
32
|
-
// 字段
|
33
|
-
prop: {
|
34
|
-
type: String,
|
35
|
-
default: ''
|
36
|
-
},
|
37
|
-
// body的内容是表单
|
38
|
-
rules: {
|
39
|
-
type: Array,
|
40
|
-
default: []
|
41
|
-
}
|
42
|
-
})
|
43
|
-
|
44
|
-
const [name, bem] = createNamespace('form-item')
|
45
|
-
const labelClasses = bem('label',{
|
46
|
-
required: props.rules.find(x => x.required === true)
|
47
|
-
})
|
48
|
-
defineExpose({
|
49
|
-
error: () => {
|
50
|
-
console.error('error')
|
51
|
-
}
|
52
|
-
})
|
53
|
-
</script>
|
54
|
-
|
55
|
-
<style lang="scss">
|
56
|
-
.nb-form-item {
|
57
|
-
display: flex;
|
58
|
-
align-items: center;
|
59
|
-
margin-bottom: 40px;
|
60
|
-
&__label {
|
61
|
-
color: var(--nb-font-color-7);
|
62
|
-
font-size: 28px;
|
63
|
-
line-height: 42px;
|
64
|
-
margin-right: 20px;
|
65
|
-
text-align: right;
|
66
|
-
&--required::before{
|
67
|
-
content: '*';
|
68
|
-
color: var(--nb-abnormal-color);
|
69
|
-
margin-right: 4px;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
</style>
|
@@ -1,76 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: chenghuan.dong
|
3
|
-
* @Date: 2022-12-24 19:25:39
|
4
|
-
* @LastEditors: chenghuan.dong
|
5
|
-
* @LastEditTime: 2023-07-04 20:13:38
|
6
|
-
* @Description: 空页面
|
7
|
-
-->
|
8
|
-
<template>
|
9
|
-
<form :class="classes" ref="form">
|
10
|
-
<slot />
|
11
|
-
</form>
|
12
|
-
</template>
|
13
|
-
<script setup>
|
14
|
-
import { ref } from 'vue'
|
15
|
-
import { createNamespace } from '../../../utils/create.js'
|
16
|
-
// 定义名称
|
17
|
-
defineOptions({
|
18
|
-
name: 'NbForm'
|
19
|
-
})
|
20
|
-
|
21
|
-
// 定义props
|
22
|
-
const props = defineProps({
|
23
|
-
// 定义Props
|
24
|
-
// 提示语
|
25
|
-
label: {
|
26
|
-
type: String,
|
27
|
-
default: ''
|
28
|
-
},
|
29
|
-
model: {
|
30
|
-
type: Object,
|
31
|
-
default: () => {
|
32
|
-
return {}
|
33
|
-
}
|
34
|
-
},
|
35
|
-
// body的内容是表单
|
36
|
-
rules: {
|
37
|
-
type: Object,
|
38
|
-
default: () => {
|
39
|
-
return {}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
})
|
43
|
-
|
44
|
-
const [name, bem] = createNamespace('form')
|
45
|
-
const classes = bem('')
|
46
|
-
const form = ref()
|
47
|
-
|
48
|
-
function validate(cb) {
|
49
|
-
console.log('校验表单')
|
50
|
-
cb && cb()
|
51
|
-
}
|
52
|
-
|
53
|
-
defineExpose({
|
54
|
-
validate
|
55
|
-
})
|
56
|
-
</script>
|
57
|
-
|
58
|
-
<style lang="scss">
|
59
|
-
.nb-form-item {
|
60
|
-
display: flex;
|
61
|
-
align-items: center;
|
62
|
-
margin-bottom: 40px;
|
63
|
-
&__label {
|
64
|
-
color: var(--nb-font-color-7);
|
65
|
-
font-size: 28px;
|
66
|
-
line-height: 42px;
|
67
|
-
margin-right: 20px;
|
68
|
-
text-align: right;
|
69
|
-
&--required::before {
|
70
|
-
content: '*';
|
71
|
-
color: var(--nb-abnormal-color);
|
72
|
-
margin-right: 4px;
|
73
|
-
}
|
74
|
-
}
|
75
|
-
}
|
76
|
-
</style>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: chenghuan.dong
|
3
|
-
* @Date: 2023-06-27 16:57:58
|
4
|
-
* @LastEditors: chenghuan.dong
|
5
|
-
* @LastEditTime: 2023-06-27 20:25:45
|
6
|
-
* @Description:
|
7
|
-
-->
|
8
|
-
<template>
|
9
|
-
<svg-icon :icon="icon" class="nb-icon" />
|
10
|
-
</template>
|
11
|
-
<script setup>
|
12
|
-
// 定义名称
|
13
|
-
defineOptions({
|
14
|
-
name: 'NbIcon'
|
15
|
-
})
|
16
|
-
|
17
|
-
// 定义props
|
18
|
-
const props = defineProps({
|
19
|
-
// 定义Props
|
20
|
-
// 类型,可选值为 primary warning default info
|
21
|
-
icon: {
|
22
|
-
type: String,
|
23
|
-
required: true,
|
24
|
-
default: ''
|
25
|
-
}
|
26
|
-
})
|
27
|
-
</script>
|
28
|
-
|
29
|
-
<style lang="scss">
|
30
|
-
</style>
|
@@ -1,184 +0,0 @@
|
|
1
|
-
:root {
|
2
|
-
// 按size
|
3
|
-
// size=large
|
4
|
-
--nb-input-large-width: 480px;
|
5
|
-
--nb-input-large-height: 80px;
|
6
|
-
--nb-input-large-font-size: 28px;
|
7
|
-
--nb-input-large-icon-size: 40px;
|
8
|
-
// size=medium
|
9
|
-
--nb-input-medium-width: 400px;
|
10
|
-
--nb-input-medium-height: 64px;
|
11
|
-
--nb-input-medium-font-size: 24px;
|
12
|
-
--nb-input-medium-icon-size: 40px;
|
13
|
-
// size=small
|
14
|
-
--nb-input-small-width: 240px;
|
15
|
-
--nb-input-small-height: 64px;
|
16
|
-
--nb-input-small-font-size: 24px;
|
17
|
-
--nb-input-small-icon-size: 32px;
|
18
|
-
}
|
19
|
-
|
20
|
-
.nb-input {
|
21
|
-
display: inline-flex;
|
22
|
-
align-items: center;
|
23
|
-
line-height: 1;
|
24
|
-
box-sizing: border-box;
|
25
|
-
outline: none;
|
26
|
-
transition: 0.1s;
|
27
|
-
border-radius: var(--nb-input-border-radius);
|
28
|
-
border: 1px solid var(--nb-input-border-color);
|
29
|
-
font-family: inherit;
|
30
|
-
font-weight: normal;
|
31
|
-
vertical-align: middle;
|
32
|
-
caret-color: var(--nb-theme-color);
|
33
|
-
&:focus {
|
34
|
-
outline: none;
|
35
|
-
}
|
36
|
-
.nb-input__inner {
|
37
|
-
width: 100%;
|
38
|
-
flex-grow: 1;
|
39
|
-
-webkit-appearance: none;
|
40
|
-
color: var(--nb-input-color);
|
41
|
-
font-size: inherit;
|
42
|
-
padding: 0;
|
43
|
-
outline: none;
|
44
|
-
border: none;
|
45
|
-
background: none;
|
46
|
-
box-sizing: border-box;
|
47
|
-
&::placeholder {
|
48
|
-
color: var(--nb-input-placeholder-text-color);
|
49
|
-
font-weight: 400;
|
50
|
-
font-family: inherit;
|
51
|
-
font-size: inherit;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
.nb-input__prefix {
|
55
|
-
height: 100%;
|
56
|
-
.svg-icon {
|
57
|
-
color: #cad0e0;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
.nb-input__clear,
|
61
|
-
.nb-input__password {
|
62
|
-
display: flex;
|
63
|
-
align-items: center;
|
64
|
-
height: 100%;
|
65
|
-
cursor: pointer;
|
66
|
-
.svg-icon {
|
67
|
-
color: #8b8ea0;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
&--focus {
|
72
|
-
border: 2px solid var(--nb-theme-color);
|
73
|
-
}
|
74
|
-
|
75
|
-
&--dark {
|
76
|
-
border: 1px solid #fff;
|
77
|
-
background-color: transparent;
|
78
|
-
color: #ffffff;
|
79
|
-
.nb-input__inner {
|
80
|
-
background-color: transparent;
|
81
|
-
color: #ffffff;
|
82
|
-
&::placeholder {
|
83
|
-
color: rgba(#ffffff, 0.5);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
.nb-input__prefix .svg-icon,
|
87
|
-
.nb-input__clear .svg-icon,
|
88
|
-
.nb-input__password .svg-icon {
|
89
|
-
color: #cad0e0;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
&--large {
|
93
|
-
width: var(--nb-input-large-width);
|
94
|
-
height: var(--nb-input-large-height);
|
95
|
-
line-height: var(--nb-input-large-height);
|
96
|
-
padding: 0 16px 0 11px;
|
97
|
-
.nb-input__inner {
|
98
|
-
height: var(--nb-input-large-height);
|
99
|
-
line-height: var(--nb-input-large-height);
|
100
|
-
font-size: var(--nb-input-large-font-size);
|
101
|
-
}
|
102
|
-
.nb-input__prefix {
|
103
|
-
margin-right: 16px;
|
104
|
-
.svg-icon {
|
105
|
-
width: var(--nb-input-large-icon-size);
|
106
|
-
height: var(--nb-input-large-icon-size);
|
107
|
-
}
|
108
|
-
}
|
109
|
-
.nb-input__clear,
|
110
|
-
.nb-input__password {
|
111
|
-
width: 48px;
|
112
|
-
margin-left: 9px;
|
113
|
-
.svg-icon {
|
114
|
-
width: var(--nb-input-large-icon-size);
|
115
|
-
height: var(--nb-input-large-icon-size);
|
116
|
-
}
|
117
|
-
}
|
118
|
-
}
|
119
|
-
|
120
|
-
&--medium {
|
121
|
-
width: var(--nb-input-medium-width);
|
122
|
-
height: var(--nb-input-medium-height);
|
123
|
-
line-height: var(--nb-input-medium-height);
|
124
|
-
padding: 0 16px 0 11px;
|
125
|
-
.nb-input__inner {
|
126
|
-
height: var(--nb-input-medium-height);
|
127
|
-
line-height: var(--nb-input-medium-height);
|
128
|
-
font-size: var(--nb-input-medium-font-size);
|
129
|
-
}
|
130
|
-
.nb-input__prefix {
|
131
|
-
margin-right: 16px;
|
132
|
-
.svg-icon {
|
133
|
-
width: var(--nb-input-medium-icon-size);
|
134
|
-
height: var(--nb-input-medium-icon-size);
|
135
|
-
}
|
136
|
-
}
|
137
|
-
.nb-input__clear,
|
138
|
-
.nb-input__password {
|
139
|
-
width: 48px;
|
140
|
-
margin-left: 9px;
|
141
|
-
.svg-icon {
|
142
|
-
width: var(--nb-input-medium-icon-size);
|
143
|
-
height: var(--nb-input-medium-icon-size);
|
144
|
-
}
|
145
|
-
}
|
146
|
-
}
|
147
|
-
|
148
|
-
&--small {
|
149
|
-
width: var(--nb-input-small-width);
|
150
|
-
height: var(--nb-input-small-height);
|
151
|
-
line-height: var(--nb-input-small-height);
|
152
|
-
padding: 0 16px 0 11px;
|
153
|
-
.nb-input__inner {
|
154
|
-
height: var(--nb-input-small-height);
|
155
|
-
line-height: var(--nb-input-small-height);
|
156
|
-
font-size: var(--nb-input-small-font-size);
|
157
|
-
}
|
158
|
-
.nb-input__prefix {
|
159
|
-
margin-right: 16px;
|
160
|
-
.svg-icon {
|
161
|
-
width: var(--nb-input-small-icon-size);
|
162
|
-
height: var(--nb-input-small-icon-size);
|
163
|
-
}
|
164
|
-
}
|
165
|
-
.nb-input__clear,
|
166
|
-
.nb-input__password {
|
167
|
-
width: 48px;
|
168
|
-
margin-left: 9px;
|
169
|
-
.svg-icon {
|
170
|
-
width: var(--nb-input-small-icon-size);
|
171
|
-
height: var(--nb-input-small-icon-size);
|
172
|
-
}
|
173
|
-
}
|
174
|
-
}
|
175
|
-
&--disabled {
|
176
|
-
cursor: not-allowed;
|
177
|
-
background: var(--nb-input-disabled-background);
|
178
|
-
box-shadow: var(--nb-input-disabled-box-shadow);
|
179
|
-
border: 1px solid var(--nb-input-disabled-border-color);
|
180
|
-
&.nb-input.nb-input--disabled {
|
181
|
-
color: var(--nb-input-disabled-color);
|
182
|
-
}
|
183
|
-
}
|
184
|
-
}
|
@@ -1,189 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: chenghuan.dong
|
3
|
-
* @Date: 2023-06-27 16:57:58
|
4
|
-
* @LastEditors: chenghuan.dong
|
5
|
-
* @LastEditTime: 2023-06-29 19:18:26
|
6
|
-
* @Description: 文本输入框
|
7
|
-
-->
|
8
|
-
<template>
|
9
|
-
<div :class="wrapClass" @mouseenter="handleMouseEnter" @mouseleave="handleMouseLeave">
|
10
|
-
<div v-if="props.prefixIcon || $slots.prefix" class="nb-input__prefix">
|
11
|
-
<slot name="prefix" />
|
12
|
-
<svg-icon v-if="props.prefixIcon" :icon="props.prefixIcon" />
|
13
|
-
</div>
|
14
|
-
<input
|
15
|
-
v-model="inputValue"
|
16
|
-
:type="showPassword ? (hidePassword ? 'text' : 'password') : type"
|
17
|
-
:placeholder="placeholder"
|
18
|
-
:readonly="readonly"
|
19
|
-
:disabled="disabled"
|
20
|
-
class="nb-input__inner"
|
21
|
-
@focus="handleFocus"
|
22
|
-
@blur="handleBlur"
|
23
|
-
/>
|
24
|
-
<!-- 清除 -->
|
25
|
-
<div v-if="showClear" class="nb-input__clear" @click.stop="handleClear">
|
26
|
-
<svg-icon icon="circle-close-filled" />
|
27
|
-
</div>
|
28
|
-
<!-- 密码框显示小眼睛 -->
|
29
|
-
<div v-if="showPwdVisible" class="nb-input__password" @click.stop="handleShowPassword">
|
30
|
-
<svg-icon :icon="hidePassword ? 'eye-open' : 'eye-close'" />
|
31
|
-
</div>
|
32
|
-
<div v-if="props.suffixIcon || $slots.suffix" class="nb-input__suffix">
|
33
|
-
<slot name="suffix" />
|
34
|
-
<svg-icon v-if="props.suffixIcon" :icon="props.suffixIcon" />
|
35
|
-
</div>
|
36
|
-
</div>
|
37
|
-
</template>
|
38
|
-
<script setup>
|
39
|
-
import { ref, computed } from 'vue'
|
40
|
-
import { createNamespace } from '../../../utils/create.js'
|
41
|
-
|
42
|
-
const [name, bem] = createNamespace('input')
|
43
|
-
|
44
|
-
// 定义名称
|
45
|
-
defineOptions({
|
46
|
-
name: 'NbInput'
|
47
|
-
})
|
48
|
-
|
49
|
-
// 定义props
|
50
|
-
const props = defineProps({
|
51
|
-
// 值
|
52
|
-
modelValue: {
|
53
|
-
type: [String, Number, Object],
|
54
|
-
default: ''
|
55
|
-
},
|
56
|
-
// 尺寸,可选值为 large medium small
|
57
|
-
size: {
|
58
|
-
type: String,
|
59
|
-
default: 'medium',
|
60
|
-
validator(value) {
|
61
|
-
return ['large', 'medium', 'small'].includes(value)
|
62
|
-
}
|
63
|
-
},
|
64
|
-
// 类型,可选值为 text
|
65
|
-
type: {
|
66
|
-
type: String,
|
67
|
-
default: 'text'
|
68
|
-
},
|
69
|
-
// 输入框占位文本
|
70
|
-
placeholder: {
|
71
|
-
type: String
|
72
|
-
},
|
73
|
-
// 原生 readonly 属性,是否只读
|
74
|
-
readonly: {
|
75
|
-
type: Boolean,
|
76
|
-
default: false
|
77
|
-
},
|
78
|
-
// 是否显示清除按钮,只有当 type 不是 textarea时生效
|
79
|
-
clearable: {
|
80
|
-
type: Boolean,
|
81
|
-
default: true
|
82
|
-
},
|
83
|
-
// 是否显示切换密码图标
|
84
|
-
showPassword: {
|
85
|
-
type: Boolean,
|
86
|
-
default: false
|
87
|
-
},
|
88
|
-
// 是否为禁用状态
|
89
|
-
disabled: {
|
90
|
-
type: Boolean,
|
91
|
-
default: false
|
92
|
-
},
|
93
|
-
// 自定义后缀图标
|
94
|
-
suffixIcon: {
|
95
|
-
type: String
|
96
|
-
},
|
97
|
-
// 自定义前缀图标
|
98
|
-
prefixIcon: {
|
99
|
-
type: String
|
100
|
-
},
|
101
|
-
// 主题( 内置了 dark / light 两种主题)
|
102
|
-
effect: {
|
103
|
-
type: String,
|
104
|
-
default: 'light',
|
105
|
-
validator(value) {
|
106
|
-
return ['dark', 'light'].includes(value)
|
107
|
-
}
|
108
|
-
}
|
109
|
-
})
|
110
|
-
|
111
|
-
// 定义emits
|
112
|
-
const emits = defineEmits(['input', 'change', 'focus', 'blur', 'clear'])
|
113
|
-
|
114
|
-
const hovering = ref(false)
|
115
|
-
const focused = ref(false)
|
116
|
-
const hidePassword = ref(false)
|
117
|
-
|
118
|
-
// 输入框值
|
119
|
-
const inputValue = computed({
|
120
|
-
get: () => props.modelValue,
|
121
|
-
set: (value) => {
|
122
|
-
emits('update:modelValue', value)
|
123
|
-
}
|
124
|
-
})
|
125
|
-
|
126
|
-
const showClear = computed(
|
127
|
-
() => props.clearable && !props.disabled && !props.readonly && !!inputValue.value && (focused.value || hovering.value)
|
128
|
-
)
|
129
|
-
|
130
|
-
const showPwdVisible = computed(
|
131
|
-
() =>
|
132
|
-
props.showPassword &&
|
133
|
-
!props.disabled &&
|
134
|
-
!props.readonly &&
|
135
|
-
!!inputValue.value &&
|
136
|
-
(!!inputValue.value || focused.value)
|
137
|
-
)
|
138
|
-
|
139
|
-
// 样式
|
140
|
-
const wrapClass = computed(() => {
|
141
|
-
return bem([
|
142
|
-
props.size,
|
143
|
-
props.type,
|
144
|
-
props.effect,
|
145
|
-
{
|
146
|
-
disabled: props.disabled,
|
147
|
-
prefix: props.prefixIcon ? true : false,
|
148
|
-
focus: focused.value
|
149
|
-
}
|
150
|
-
])
|
151
|
-
})
|
152
|
-
const prefixClasses = bem(['prefix'])
|
153
|
-
|
154
|
-
const handleMouseEnter = (evt) => {
|
155
|
-
hovering.value = true
|
156
|
-
emits('mouseenter', evt)
|
157
|
-
}
|
158
|
-
|
159
|
-
const handleMouseLeave = (evt) => {
|
160
|
-
hovering.value = false
|
161
|
-
emits('mouseleave', evt)
|
162
|
-
}
|
163
|
-
|
164
|
-
const handleClear = () => {
|
165
|
-
emits('update:modelValue', '')
|
166
|
-
emits('clear')
|
167
|
-
}
|
168
|
-
|
169
|
-
const handleShowPassword = () => {
|
170
|
-
hidePassword.value = !hidePassword.value
|
171
|
-
if (hidePassword.value) {
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
const handleFocus = () => {
|
176
|
-
focused.value = true
|
177
|
-
emits('focus')
|
178
|
-
}
|
179
|
-
|
180
|
-
const handleBlur = () => {
|
181
|
-
focused.value = false
|
182
|
-
emits('blur')
|
183
|
-
}
|
184
|
-
|
185
|
-
</script>
|
186
|
-
|
187
|
-
<style lang="scss">
|
188
|
-
@import './index.scss';
|
189
|
-
</style>
|
@@ -1,63 +0,0 @@
|
|
1
|
-
.nb-input-keyboard {
|
2
|
-
display: inline-block;
|
3
|
-
width: 310px;
|
4
|
-
overflow-x: hidden;
|
5
|
-
padding: 30px 15px;
|
6
|
-
box-sizing: border-box;
|
7
|
-
&__input {
|
8
|
-
width: 100%;
|
9
|
-
display: flex;
|
10
|
-
align-items: center;
|
11
|
-
justify-content: space-between;
|
12
|
-
.nb-input {
|
13
|
-
width: 200px;
|
14
|
-
height: 50px;
|
15
|
-
margin-right: 6px;
|
16
|
-
}
|
17
|
-
.nb-button {
|
18
|
-
min-width: 74px;
|
19
|
-
width: 74px;
|
20
|
-
height: 50px;
|
21
|
-
font-size: 18px;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
&__keyboard {
|
25
|
-
width: 280px;
|
26
|
-
height: 353px;
|
27
|
-
margin-top: 30.5px;
|
28
|
-
background: #ffffff;
|
29
|
-
border-radius: 4px;
|
30
|
-
border: 1px solid #cad0e0;
|
31
|
-
box-sizing: border-box;
|
32
|
-
padding: 5px 0 0 5px;
|
33
|
-
display: flex;
|
34
|
-
flex-direction: column;
|
35
|
-
div {
|
36
|
-
flex: 1;
|
37
|
-
display: flex;
|
38
|
-
align-items: center;
|
39
|
-
justify-content: space-between;
|
40
|
-
margin-bottom: 5px;
|
41
|
-
span {
|
42
|
-
flex: 1;
|
43
|
-
height: 100%;
|
44
|
-
background: #f4f6f9;
|
45
|
-
border-radius: 3px;
|
46
|
-
border: 1px solid #cad0e0;
|
47
|
-
font-size: 25px;
|
48
|
-
font-family: var(--nb-font-bold-family);
|
49
|
-
line-height: 38px;
|
50
|
-
display: flex;
|
51
|
-
align-items: center;
|
52
|
-
justify-content: center;
|
53
|
-
box-sizing: border-box;
|
54
|
-
margin-right: 5px;
|
55
|
-
cursor: pointer;
|
56
|
-
&:active {
|
57
|
-
background-color: var(--nb-theme-color);
|
58
|
-
color: #ffffff;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|