nubomed-ui 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. package/.env.bi +13 -0
  2. package/.env.terminal +13 -0
  3. package/.vscode/extensions.json +3 -0
  4. package/README.md +17 -0
  5. package/index.html +13 -0
  6. package/nubomed-ui/nubomed-ui.es.js +2005 -0
  7. package/nubomed-ui/nubomed-ui.umd.js +1 -0
  8. package/nubomed-ui/style.css +1 -0
  9. package/package.json +19 -7
  10. package/src/App.vue +31 -0
  11. package/src/bi-demos/Header.vue +29 -0
  12. package/src/bi-demos/Table.vue +69 -0
  13. package/src/bi-demos/index.vue +132 -0
  14. package/src/bi-packages/components/Box/images/corner-error.png +0 -0
  15. package/src/bi-packages/components/Box/images/corner-warning.png +0 -0
  16. package/src/bi-packages/components/Box/images/corner.png +0 -0
  17. package/src/bi-packages/components/Box/index.scss +86 -0
  18. package/src/bi-packages/components/Box/index.vue +53 -0
  19. package/src/bi-packages/components/Carousel/CarouselItem.vue +0 -0
  20. package/src/bi-packages/components/Carousel/index.vue +0 -0
  21. package/src/bi-packages/components/Header/images/left-bg.png +0 -0
  22. package/src/bi-packages/components/Header/images/logo.png +0 -0
  23. package/src/bi-packages/components/Header/images/right-bg.png +0 -0
  24. package/src/bi-packages/components/Header/index.scss +50 -0
  25. package/src/bi-packages/components/Header/index.vue +54 -0
  26. package/src/bi-packages/components/Table/TableColgroup.vue +43 -0
  27. package/src/bi-packages/components/Table/index copy.vue +107 -0
  28. package/src/bi-packages/components/Table/index.scss +118 -0
  29. package/src/bi-packages/components/Table/index.vue +108 -0
  30. package/src/bi-packages/components/TableColumn/index.scss +7 -0
  31. package/src/bi-packages/components/TableColumn/index.vue +60 -0
  32. package/src/bi-packages/fonts/OPPOSans-B.ttf +0 -0
  33. package/src/bi-packages/fonts/OPPOSans-M.ttf +0 -0
  34. package/src/bi-packages/fonts/font.scss +11 -0
  35. package/src/bi-packages/iconfont-svg/demo.css +539 -0
  36. package/src/bi-packages/iconfont-svg/demo_index.html +4811 -0
  37. package/src/bi-packages/iconfont-svg/iconfont.css +819 -0
  38. package/src/bi-packages/iconfont-svg/iconfont.js +1 -0
  39. package/src/bi-packages/iconfont-svg/iconfont.json +1416 -0
  40. package/src/bi-packages/iconfont-svg/iconfont.ttf +0 -0
  41. package/src/bi-packages/iconfont-svg/iconfont.woff +0 -0
  42. package/src/bi-packages/iconfont-svg/iconfont.woff2 +0 -0
  43. package/src/bi-packages/index.js +34 -0
  44. package/src/bi-packages/styles/mixin.scss +12 -0
  45. package/src/bi-packages/styles/var.scss +11 -0
  46. package/src/demos/ActionBar.vue +59 -0
  47. package/src/demos/Badge.vue +28 -0
  48. package/src/demos/Button copy.vue +302 -0
  49. package/src/demos/Button.vue +116 -0
  50. package/src/demos/ButtonGroup.vue +40 -0
  51. package/src/demos/Check.vue +29 -0
  52. package/src/demos/Dialog.vue +255 -0
  53. package/src/demos/Empty.vue +38 -0
  54. package/src/demos/FooterMenu.vue +49 -0
  55. package/src/demos/Header.vue +71 -0
  56. package/src/demos/Icons.vue +314 -0
  57. package/src/demos/Input.vue +87 -0
  58. package/src/demos/InputKeyboard.vue +30 -0
  59. package/src/demos/InputNumber.vue +34 -0
  60. package/src/demos/LeftMenu.vue +128 -0
  61. package/src/demos/Menus.vue +106 -0
  62. package/src/demos/OpenCabinetBall.vue +37 -0
  63. package/src/demos/Statusbar.vue +146 -0
  64. package/src/demos/Steps.vue +45 -0
  65. package/src/demos/Tost.vue +35 -0
  66. package/src/demos/button/button.md +19 -0
  67. package/src/demos/data/terList.json +145 -0
  68. package/src/demos/images/cabinets/H3000-D.png +0 -0
  69. package/src/demos/images/cabinets/H3000-R.png +0 -0
  70. package/src/demos/images/cabinets/H3000-Rh.png +0 -0
  71. package/src/demos/images/cabinets/H3000-Rh2.png +0 -0
  72. package/src/demos/images/cabinets/H3010-R.png +0 -0
  73. package/src/demos/index.vue +348 -0
  74. package/src/docs/icons/Icon.vue +72 -0
  75. package/src/docs/icons/icon.md +21 -0
  76. package/src/docs/index.html +15 -0
  77. package/src/docs/index.vue +301 -0
  78. package/src/main.js +23 -0
  79. package/src/packages/components/ActionBar/images/error.png +0 -0
  80. package/src/packages/components/ActionBar/images/loading.gif +0 -0
  81. package/src/packages/components/ActionBar/images/success.png +0 -0
  82. package/src/packages/components/ActionBar/images/warning.png +0 -0
  83. package/src/packages/components/ActionBar/images/warning_yellow.png +0 -0
  84. package/src/packages/components/ActionBar/index.scss +81 -0
  85. package/src/packages/components/ActionBar/index.vue +100 -0
  86. package/src/packages/components/Badge/index.scss +50 -0
  87. package/src/packages/components/Badge/index.vue +75 -0
  88. package/src/packages/components/Button/index.scss +241 -0
  89. package/src/packages/components/Button/index.vue +111 -0
  90. package/src/packages/components/ButtonGroup/index.scss +54 -0
  91. package/src/packages/components/ButtonGroup/index.vue +75 -0
  92. package/src/packages/components/Check/Cate.vue +138 -0
  93. package/src/packages/components/Check/index.scss +47 -0
  94. package/src/packages/components/Check/index.vue +105 -0
  95. package/src/packages/components/Dialog/images/error.png +0 -0
  96. package/src/packages/components/Dialog/images/success.png +0 -0
  97. package/src/packages/components/Dialog/images/warning-red.png +0 -0
  98. package/src/packages/components/Dialog/images/warning-yellow.png +0 -0
  99. package/src/packages/components/Dialog/index.scss +154 -0
  100. package/src/packages/components/Dialog/index.vue +305 -0
  101. package/src/packages/components/Empty/images/empty-abnormal.png +0 -0
  102. package/src/packages/components/Empty/images/empty-data.png +0 -0
  103. package/src/packages/components/Empty/images/empty-search.png +0 -0
  104. package/src/packages/components/Empty/index.vue +68 -0
  105. package/src/packages/components/Form/FormItem.vue +73 -0
  106. package/src/packages/components/Form/index.vue +76 -0
  107. package/src/packages/components/Icon/index.vue +30 -0
  108. package/src/packages/components/Input/index.scss +184 -0
  109. package/src/packages/components/Input/index.vue +189 -0
  110. package/src/packages/components/InputKeyboard/index.scss +63 -0
  111. package/src/packages/components/InputKeyboard/index.vue +117 -0
  112. package/src/packages/components/InputNumber/index.scss +103 -0
  113. package/src/packages/components/InputNumber/index.vue +160 -0
  114. package/src/packages/components/Menu/index.scss +559 -0
  115. package/src/packages/components/Menu/index.vue +211 -0
  116. package/src/packages/components/OpenCabinetBall/CabinetStatus.vue +94 -0
  117. package/src/packages/components/OpenCabinetBall/index.scss +204 -0
  118. package/src/packages/components/OpenCabinetBall/index.vue +113 -0
  119. package/src/packages/components/Statusbar/CabinetList.vue +125 -0
  120. package/src/packages/components/Statusbar/CabinetListStatus.vue +75 -0
  121. package/src/packages/components/Statusbar/CabinetListTempHum.vue +108 -0
  122. package/src/packages/components/Statusbar/index.scss +205 -0
  123. package/src/packages/components/Statusbar/index.vue +83 -0
  124. package/src/packages/components/Steps/index.scss +104 -0
  125. package/src/packages/components/Steps/index.vue +66 -0
  126. package/src/packages/components/SvgIcon/index.vue +41 -0
  127. package/src/packages/components/Toast/index.vue +72 -0
  128. package/src/packages/fonts/OPPOSans-B.ttf +0 -0
  129. package/src/packages/fonts/OPPOSans-M.ttf +0 -0
  130. package/src/packages/fonts/font.scss +11 -0
  131. package/src/packages/iconfont-svg/demo.css +539 -0
  132. package/src/packages/iconfont-svg/demo_index.html +4811 -0
  133. package/src/packages/iconfont-svg/iconfont.css +819 -0
  134. package/src/packages/iconfont-svg/iconfont.js +1 -0
  135. package/src/packages/iconfont-svg/iconfont.json +1416 -0
  136. package/src/packages/iconfont-svg/iconfont.ttf +0 -0
  137. package/src/packages/iconfont-svg/iconfont.woff +0 -0
  138. package/src/packages/iconfont-svg/iconfont.woff2 +0 -0
  139. package/src/packages/index.js +64 -0
  140. package/src/packages/styles/var.scss +24 -0
  141. package/src/utils/create.js +48 -0
  142. package/src/utils/index.js +13 -0
  143. package/src/utils/validate.js +3 -0
  144. package/vite.config.js +47 -0
  145. package/nubomed-ui.es.js +0 -152
  146. package/nubomed-ui.umd.js +0 -1
  147. package/style.css +0 -1
@@ -0,0 +1,241 @@
1
+ :root {
2
+ --nb-button-border-radius: 8px;
3
+ // 按type
4
+ // type=primary
5
+ --nb-button-primary-color: #ffffff;
6
+ --nb-button-primary-background: linear-gradient(180deg, #3385e6 0%, #0066e0 100%);
7
+ --nb-button-primary-box-shadow: 0px 1px 6px 0px rgba(24, 29, 65, 0.12);
8
+ --nb-button-primary-border-color: #0066e0;
9
+ --nb-button-primary-background-focus: #007aff;
10
+ // type=warning
11
+ --nb-button-warning-color: #ffffff;
12
+ --nb-button-warning-background: linear-gradient(180deg, #ea5765 0%, #e52d3e 100%);
13
+ --nb-button-warning-box-shadow: 0px 1px 6px 0px rgba(24, 29, 65, 0.12);
14
+ --nb-button-warning-border-color: #e52d3e;
15
+ --nb-button-warning-background-focus: #f94a5a;
16
+ // type=default
17
+ --nb-button-default-color: #181d41;
18
+ --nb-button-default-background: linear-gradient(180deg, #ffffff 0%, #f4f6f9 100%);
19
+ --nb-button-default-box-shadow: 0px 1px 6px 0px rgba(24, 29, 65, 0.12);
20
+ --nb-button-default-border-color: #cad0e0;
21
+ --nb-button-default-background-focus: #cad0e0;
22
+ // type=info
23
+ --nb-button-info-color: #ffffff;
24
+ --nb-button-info-background: linear-gradient(180deg, #00aabb 0%, #008693 100%);
25
+ --nb-button-info-box-shadow: none;
26
+ --nb-button-info-border-color: #008693;
27
+ --nb-button-info-background-focus: #008693;
28
+
29
+ // plain
30
+ --nb-button-plain-background: linear-gradient(180deg, #ffffff 0%, #f4f6f9 100%);
31
+ --nb-button-plain-border-color: #cad0e0;
32
+ // disabled
33
+ --nb-button-disabled-color: rgba(24, 29, 65, 0.2);
34
+ --nb-button-disabled-background: #f4f6f9;
35
+ --nb-button-disabled-box-shadow: none;
36
+ --nb-button-disabled-border-color: #f4f6f9;
37
+ --nb-button-disabled-background-focus: #f4f6f9;
38
+ // size=large
39
+ --nb-button-large-width: 480px;
40
+ --nb-button-large-height: 80px;
41
+ --nb-button-large-font-size: 28px;
42
+ --nb-button-large-icon-size: 40px;
43
+ // size=medium
44
+ --nb-button-medium-width: 220px;
45
+ --nb-button-medium-height: 72px;
46
+ --nb-button-medium-font-size: 28px;
47
+ --nb-button-medium-icon-size: 28px;
48
+ // size=small
49
+ --nb-button-small-width: 220px;
50
+ --nb-button-small-height: 64px;
51
+ --nb-button-small-font-size: 24px;
52
+ --nb-button-small-icon-size: 28px;
53
+ // size=mini
54
+ --nb-button-mini-width: 88px;
55
+ --nb-button-mini-height: 48px;
56
+ --nb-button-mini-font-size: 24px;
57
+ --nb-button-mini-icon-size: 24px;
58
+ }
59
+
60
+ .nb-button {
61
+ display: inline-flex;
62
+ justify-content: center;
63
+ align-items: center;
64
+ line-height: 1;
65
+ white-space: nowrap;
66
+ cursor: pointer;
67
+ text-align: center;
68
+ box-sizing: border-box;
69
+ outline: none;
70
+ transition: 0.1s;
71
+ user-select: none;
72
+ vertical-align: middle;
73
+ -webkit-appearance: none;
74
+ border-radius: var(--nb-button-border-radius);
75
+ font-family: inherit;
76
+ font-weight: normal;
77
+
78
+ &:focus {
79
+ outline: none;
80
+ }
81
+ &--large {
82
+ min-width: var(--nb-button-large-width);
83
+ height: var(--nb-button-large-height);
84
+ font-size: var(--nb-button-large-font-size);
85
+ padding: 0 36px;
86
+ svg,
87
+ .svg-icon {
88
+ width: var(--nb-button-large-icon-size);
89
+ height: var(--nb-button-large-icon-size);
90
+ margin-right: 8px;
91
+ }
92
+ }
93
+
94
+ &--medium {
95
+ min-width: var(--nb-button-medium-width);
96
+ height: var(--nb-button-medium-height);
97
+ font-size: var(--nb-button-medium-font-size);
98
+ padding: 0 20px;
99
+ svg,
100
+ .svg-icon {
101
+ width: var(--nb-button-medium-icon-size);
102
+ height: var(--nb-button-medium-icon-size);
103
+ margin-right: 8px;
104
+ }
105
+ }
106
+
107
+ &--small {
108
+ min-width: var(--nb-button-small-width);
109
+ height: var(--nb-button-small-height);
110
+ font-size: var(--nb-button-small-font-size);
111
+ padding: 0 20px;
112
+ svg,
113
+ .svg-icon {
114
+ width: var(--nb-button-small-icon-size);
115
+ height: var(--nb-button-small-icon-size);
116
+ margin-right: 8px;
117
+ }
118
+ }
119
+
120
+ &--mini {
121
+ min-width: var(--nb-button-mini-width);
122
+ height: var(--nb-button-mini-height);
123
+ font-size: var(--nb-button-mini-font-size);
124
+ padding: 0 20px;
125
+ svg,
126
+ .svg-icon {
127
+ width: var(--nb-button-mini-icon-size);
128
+ height: var(--nb-button-mini-icon-size);
129
+ margin-right: 8px;
130
+ }
131
+ }
132
+ &--auto-width {
133
+ width: fit-content;
134
+ min-width: 160px !important;
135
+ }
136
+
137
+ &--primary {
138
+ color: var(--nb-button-primary-color);
139
+ background: var(--nb-button-primary-background);
140
+ box-shadow: var(--nb-button-primary-box-shadow);
141
+ border: 1px solid var(--nb-button-primary-border-color);
142
+ &:focus {
143
+ border-color: var(--nb-button-primary-background-focus);
144
+ background-color: var(--nb-button-primary-background-focus);
145
+ }
146
+ &.nb-button--plain {
147
+ color: var(--nb-button-primary-border-color);
148
+ }
149
+ }
150
+ &--warning {
151
+ color: var(--nb-button-warning-color);
152
+ background: var(--nb-button-warning-background);
153
+ box-shadow: var(--nb-button-warning-box-shadow);
154
+ border: 1px solid var(--nb-button-warning-border-color);
155
+ &:focus {
156
+ border-color: var(--nb-button-warning-background-focus);
157
+ background-color: var(--nb-button-warning-background-focus);
158
+ }
159
+ &.nb-button--plain {
160
+ color: var(--nb-button-warning-border-color);
161
+ }
162
+ }
163
+ &--default {
164
+ color: var(--nb-button-default-color);
165
+ background: var(--nb-button-default-background);
166
+ box-shadow: var(--nb-button-default-box-shadow);
167
+ border: 1px solid var(--nb-button-default-border-color);
168
+ &:focus {
169
+ border-color: var(--nb-button-default-background-focus);
170
+ background-color: var(--nb-button-default-background-focus);
171
+ }
172
+ &.nb-button--plain {
173
+ color: var(--nb-button-default-border-color);
174
+ }
175
+ }
176
+ &--info {
177
+ color: var(--nb-button-info-color);
178
+ background: var(--nb-button-info-background);
179
+ box-shadow: var(--nb-button-info-box-shadow);
180
+ border: 1px solid var(--nb-button-info-border-color);
181
+ &:focus {
182
+ border-color: var(--nb-button-info-background-focus);
183
+ background-color: var(--nb-button-info-background-focus);
184
+ }
185
+ &.nb-button--plain {
186
+ color: var(--nb-button-info-border-color);
187
+ }
188
+ }
189
+ &--plain {
190
+ background: var(--nb-button-plain-background);
191
+ border-color: var(--nb-button-plain-border-color);
192
+ }
193
+
194
+ &--text {
195
+ &.nb-button--text {
196
+ min-width: 100px;
197
+ height: 64px;
198
+ background: transparent;
199
+ border-color: transparent;
200
+ box-shadow: none;
201
+ padding: 0 10px 0 6px;
202
+ font-size: 24px;
203
+ &:focus {
204
+ border-color: transparent;
205
+ background-color: transparent;
206
+ }
207
+ svg,
208
+ .svg-icon {
209
+ width: 32px;
210
+ height: 32px;
211
+ }
212
+ }
213
+ }
214
+ &--loading {
215
+ cursor: default;
216
+ opacity: 0.5;
217
+ .is-loading {
218
+ width: 28px;
219
+ height: 28px;
220
+ margin-right: 8px;
221
+ animation: rotating 2s linear infinite;
222
+ }
223
+ @keyframes rotating {
224
+ 0% {
225
+ transform: rotateZ(0deg);
226
+ }
227
+ 100% {
228
+ transform: rotateZ(360deg);
229
+ }
230
+ }
231
+ }
232
+ &--disabled {
233
+ cursor: not-allowed;
234
+ background: var(--nb-button-disabled-background);
235
+ box-shadow: var(--nb-button-disabled-box-shadow);
236
+ border: 1px solid var(--nb-button-disabled-border-color);
237
+ &.nb-button.nb-button--disabled {
238
+ color: var(--nb-button-disabled-color);
239
+ }
240
+ }
241
+ }
@@ -0,0 +1,111 @@
1
+ <!--
2
+ * @Author: chenghuan.dong
3
+ * @Date: 2023-06-27 16:57:58
4
+ * @LastEditors: chenghuan.dong
5
+ * @LastEditTime: 2023-06-29 18:27:30
6
+ * @Description: 按钮
7
+ -->
8
+ <template>
9
+ <button :class="classes" :disabled="buttonDisabled" @click="onClick">
10
+ <!-- loading -->
11
+ <svg-icon v-if="loading" icon="loading" class="is-loading" />
12
+ <!-- svg-icon -->
13
+ <svg-icon v-if="svgIcon" :icon="svgIcon" class="svg-icon" />
14
+ <slot></slot>
15
+ </button>
16
+ </template>
17
+ <script setup>
18
+ import { computed } from 'vue'
19
+ import { createNamespace } from '../../../utils/create.js'
20
+
21
+ const [name, bem] = createNamespace('button')
22
+
23
+ // 定义名称
24
+ defineOptions({
25
+ name: 'NbButton'
26
+ })
27
+
28
+ // 定义props
29
+ const props = defineProps({
30
+ // 定义Props
31
+ // 类型,可选值为 primary warning default info
32
+ type: {
33
+ type: String,
34
+ default: 'default',
35
+ validator(value) {
36
+ return ['default', 'primary', 'warning', 'info'].includes(value)
37
+ }
38
+ },
39
+ // 尺寸,可选值为 large medium small mini
40
+ size: {
41
+ type: String,
42
+ default: 'medium',
43
+ validator(value) {
44
+ return ['large', 'medium', 'small', 'mini'].includes(value)
45
+ }
46
+ },
47
+ // 按钮是否为禁用状态
48
+ disabled: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ // 是否为加载中状态
53
+ loading: {
54
+ type: Boolean,
55
+ default: false
56
+ },
57
+ // 是否为朴素按钮
58
+ plain: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
+ // 是否为文字按钮
63
+ text: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ // 是否自适应文字显示宽度
68
+ autoWidth: {
69
+ type: Boolean,
70
+ default: false
71
+ },
72
+ // svg-icon的名称
73
+ svgIcon: {
74
+ type: String,
75
+ default: ''
76
+ }
77
+ })
78
+
79
+ // 定义emits
80
+ const emits = defineEmits(['click'])
81
+
82
+ // 按钮是否禁用
83
+ const buttonDisabled = computed(() => {
84
+ if (props.loading) {
85
+ return true
86
+ }
87
+ return props.disabled
88
+ })
89
+
90
+ // 样式
91
+ const classes = bem([
92
+ props.size,
93
+ props.type,
94
+ {
95
+ 'auto-width': props.autoWidth,
96
+ plain: props.plain,
97
+ loading: props.loading,
98
+ disabled: props.disabled,
99
+ text: props.text
100
+ }
101
+ ])
102
+
103
+ // 点击按钮
104
+ const onClick = () => {
105
+ emits('click')
106
+ }
107
+ </script>
108
+
109
+ <style lang="scss">
110
+ @import './index.scss';
111
+ </style>
@@ -0,0 +1,54 @@
1
+ .nb-button-group {
2
+ display: inline-flex;
3
+ justify-content: center;
4
+ align-items: center;
5
+
6
+ &__item {
7
+ min-width: 88px;
8
+ height: 64px;
9
+ background: linear-gradient(180deg, #FFFFFF 0%, #F4F6F9 100%);
10
+ box-shadow: 0px 1px 6px 0px rgba(24, 29, 65, 0.12);
11
+ border-radius: 8px;
12
+ border: 1px solid #CAD0E0;
13
+ position: relative;
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ font-size: 24px;
18
+ line-height: 36px;
19
+ box-sizing: border-box;
20
+ padding: 0 17px;
21
+ overflow: hidden;
22
+ cursor: pointer;
23
+
24
+ .nb-icon {
25
+ display: none;
26
+ }
27
+
28
+ &--checked {
29
+ color: var(--nb-theme-color);
30
+ border: 3px solid var(--nb-theme-color);
31
+ box-shadow: none;
32
+ background: #DEEDFF;
33
+ overflow: hidden;
34
+ padding: 0 15px;
35
+ .nb-icon {
36
+ display: block;
37
+ position: absolute;
38
+ bottom: -3px;
39
+ right: -3px;
40
+ width: 28px;
41
+ height: 28px;
42
+ z-index: 2;
43
+ }
44
+ }
45
+ &--disabled{
46
+ cursor: no-drop;
47
+ color: var(--nb-input-disabled-color);
48
+ }
49
+ }
50
+
51
+ &__item+&__item {
52
+ margin-left: 16px;
53
+ }
54
+ }
@@ -0,0 +1,75 @@
1
+ <!--
2
+ * @Author: chenghuan.dong
3
+ * @Date: 2023-07-10 17:51:28
4
+ * @LastEditors: chenghuan.dong
5
+ * @LastEditTime: 2023-07-11 11:46:07
6
+ * @Description: 多选按钮组
7
+ -->
8
+ <template>
9
+ <ul class="nb-button-group">
10
+ <li v-for="(item, index) in data" :key="index" :class="itemClassess(item)" @click="handleChange(item)">{{ item.label }}<nb-icon icon="checked-corner-bottom" /></li>
11
+ </ul>
12
+ </template>
13
+ <script setup>
14
+ import { ref, computed } from 'vue'
15
+ import { createNamespace } from '../../../utils/create.js'
16
+
17
+ const [name, bem] = createNamespace('button-group')
18
+
19
+ // 定义名称
20
+ defineOptions({
21
+ name: 'NbButtonGroup'
22
+ })
23
+
24
+ // 定义props
25
+ const props = defineProps({
26
+ // 值
27
+ modelValue: {
28
+ type: [String, Number, Object, Boolean],
29
+ default: ''
30
+ },
31
+ // 选中项绑定值
32
+ data: {
33
+ type: Array,
34
+ default: () => {
35
+ return []
36
+ }
37
+ }
38
+ })
39
+
40
+ // 定义emits
41
+ const emits = defineEmits(['change'])
42
+
43
+
44
+ // 输入框值
45
+ const inputValue = computed({
46
+ get: () => props.modelValue,
47
+ set: (value) => {
48
+ emits('update:modelValue', value)
49
+ }
50
+ })
51
+
52
+ // 样式
53
+ const itemClassess = (item) => {
54
+ return bem('item', {
55
+ checked: (inputValue.value || []).includes(item.value),
56
+ disabled: item.disabled
57
+ })
58
+ }
59
+
60
+ // 点击按钮
61
+ const handleChange = (item) => {
62
+ const newValue = inputValue.value
63
+ const index = newValue.findIndex(x => x === item.value)
64
+ if (index > -1) {
65
+ newValue.splice(index, 1)
66
+ } else {
67
+ newValue.push(item.value)
68
+ }
69
+ emits('change', item)
70
+ }
71
+ </script>
72
+
73
+ <style lang="scss">
74
+ @import './index.scss';
75
+ </style>
@@ -0,0 +1,138 @@
1
+ <!--
2
+ * @Author: chenghuan.dong
3
+ * @Date: 2023-07-10 17:51:28
4
+ * @LastEditors: chenghuan.dong
5
+ * @LastEditTime: 2023-07-14 18:00:04
6
+ * @Description: 多选按钮组
7
+ -->
8
+ <template>
9
+ <div class="nb-check-cate">
10
+ <nb-icon class="nb-check-cate__arrow" icon="caret-right" />
11
+ <nb-icon class="nb-check-cate__icon" icon="menu-in-store" />
12
+ <strong class="nb-check-cate__text"
13
+ >异常出库<small>2021/10/22</small></strong
14
+ >
15
+ <span class="nb-check-cate__count">
16
+ <slot name="count"><i>数量</i><strong>32</strong></slot>
17
+ </span>
18
+ </div>
19
+ </template>
20
+ <script setup>
21
+ import { ref, computed } from "vue";
22
+ import { createNamespace } from '../../../utils/create.js';
23
+
24
+ const [name, bem] = createNamespace("check-cate");
25
+
26
+ // 定义名称
27
+ defineOptions({
28
+ name: "NbCheckCate",
29
+ });
30
+
31
+ // 定义props
32
+ const props = defineProps({
33
+ // 值
34
+ modelValue: {
35
+ type: [String, Number, Object, Boolean],
36
+ default: "",
37
+ },
38
+ // 选中项绑定值
39
+ data: {
40
+ type: Array,
41
+ default: () => {
42
+ return [];
43
+ },
44
+ },
45
+ });
46
+
47
+ // 定义emits
48
+ const emits = defineEmits(["change"]);
49
+
50
+ // 输入框值
51
+ const inputValue = computed({
52
+ get: () => props.modelValue,
53
+ set: (value) => {
54
+ emits("update:modelValue", value);
55
+ },
56
+ });
57
+
58
+ // 样式
59
+ const itemClassess = (item) => {
60
+ return bem("item", {
61
+ checked: (inputValue.value || []).includes(item.value),
62
+ disabled: item.disabled,
63
+ });
64
+ };
65
+
66
+ // 点击按钮
67
+ const handleChange = (item) => {
68
+ const newValue = inputValue.value;
69
+ const index = newValue.findIndex((x) => x === item.value);
70
+ if (index > -1) {
71
+ newValue.splice(index, 1);
72
+ } else {
73
+ newValue.push(item.value);
74
+ }
75
+ emits("change", item);
76
+ };
77
+ </script>
78
+
79
+ <style lang="scss">
80
+ .nb-check-cate {
81
+ display: flex;
82
+ align-items: center;
83
+ justify-content: space-between;
84
+ height: var(--nb-check-list-cate-height);
85
+ background-color: #f4f6f9;
86
+ border-radius: 8px;
87
+ padding: 0 30px 0 17px;
88
+ box-sizing: border-box;
89
+ &__arrow {
90
+ width: 40px !important;
91
+ height: 40px !important;
92
+ color: #8b8ea0;
93
+ margin-right: 8px;
94
+ cursor: pointer;
95
+ }
96
+ &__icon {
97
+ width: 40px !important;
98
+ height: 40px !important;
99
+ margin-right: 8px;
100
+ }
101
+
102
+ &__text {
103
+ font-size: 32px;
104
+ line-height: 48px;
105
+ font-family: var(--nb-font-bold-family);
106
+
107
+ small {
108
+ font-size: 24px;
109
+ line-height: 32px;
110
+ font-family: var(--nb-font-family);
111
+ font-weight: normal;
112
+ color: var(--nb-font-color-5);
113
+ margin-left: 18px;
114
+ }
115
+ }
116
+
117
+ &__count {
118
+ flex: 1;
119
+ text-align: right;
120
+ display: flex;
121
+ align-items: center;
122
+ justify-content: end;
123
+ i {
124
+ font-size: 24px;
125
+ line-height: 36px;
126
+ color: var(--nb-font-color-5);
127
+ font-style: normal;
128
+ }
129
+ strong {
130
+ font-family: var(--nb-font-bold-family);
131
+ font-size: 36px;
132
+ line-height: 48px;
133
+ margin-left: 8px;
134
+ color: var(--nb-theme-color);
135
+ }
136
+ }
137
+ }
138
+ </style>
@@ -0,0 +1,47 @@
1
+ :root {
2
+ --nb-check-list-cate-height: 72px;
3
+ --nb-check-list-detail-height: 94px;
4
+ }
5
+
6
+ .nb-check-list {
7
+ &__item {
8
+
9
+
10
+ &__details {}
11
+
12
+ &__detail {
13
+ margin-top: 8px;
14
+ min-height: var(--nb-check-list-detail-height);
15
+ background: #FEF2F6;
16
+ border-radius: 8px;
17
+ border: 1px solid #CAD0E0;
18
+ box-sizing: border-box;
19
+
20
+ &__top {
21
+ display: flex;
22
+ align-items: center;
23
+ min-height: calc(var(--nb-check-list-detail-height) - 2px);
24
+ padding: 0 24px 0 16px;
25
+
26
+ }
27
+
28
+ &__arrow {
29
+ width: 40px !important;
30
+ height: 40px !important;
31
+ color: #8B8EA0;
32
+ margin-right: 8px;
33
+ cursor: pointer;
34
+ }
35
+
36
+ &__name {
37
+ font-size: 28px;
38
+ line-height: 42px;
39
+ font-family: var(--nb-font-bold-family);
40
+ }
41
+ }
42
+ }
43
+
44
+ &__item+&__item {
45
+ margin-top: 40px;
46
+ }
47
+ }