@varlet/ui 2.8.1 → 2.8.2
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.
- package/es/button/Button.mjs +39 -4
- package/es/button/props.mjs +0 -2
- package/es/button/provide.mjs +16 -0
- package/es/button-group/ButtonGroup.mjs +45 -0
- package/es/button-group/ButtonGroupSfc.css +0 -0
- package/es/button-group/buttonGroup.css +1 -0
- package/es/button-group/index.mjs +9 -0
- package/es/button-group/props.mjs +43 -0
- package/es/button-group/provide.mjs +17 -0
- package/es/button-group/style/index.mjs +4 -0
- package/es/index.bundle.mjs +7 -1
- package/es/index.mjs +6 -1
- package/es/paper/Paper.mjs +1 -1
- package/es/style.css +1 -1
- package/es/style.mjs +1 -0
- package/es/varlet.esm.js +3851 -3713
- package/highlight/web-types.en-US.json +82 -7
- package/highlight/web-types.zh-CN.json +82 -7
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +342 -192
- package/package.json +5 -5
- package/types/buttonGroup.d.ts +25 -0
- package/types/index.d.ts +2 -0
- package/umd/varlet.js +6 -6
package/es/button/Button.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import Ripple from '../ripple/index.mjs';
|
|
2
2
|
import VarLoading from '../loading/index.mjs';
|
|
3
|
-
import { defineComponent, ref } from 'vue';
|
|
3
|
+
import { computed, defineComponent, ref } from 'vue';
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
6
|
+
import { useButtonGroup } from './provide.mjs';
|
|
6
7
|
import { isArray } from '@varlet/shared';
|
|
7
8
|
var {
|
|
8
9
|
n,
|
|
@@ -20,10 +21,10 @@ function __render__(_ctx, _cache) {
|
|
|
20
21
|
var _directive_ripple = _resolveDirective("ripple");
|
|
21
22
|
|
|
22
23
|
return _withDirectives((_openBlock(), _createElementBlock("button", {
|
|
23
|
-
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), _ctx.n("--" + _ctx.size), [_ctx.block, _ctx.n('$--flex') + " " + _ctx.n('--block'), _ctx.n('$--inline-flex')], [_ctx.disabled, _ctx.n('--disabled')], [_ctx.text, _ctx.n("--text-" + _ctx.type) + " " + _ctx.n('--text'), _ctx.n("--" + _ctx.type) + " " + _ctx.n(
|
|
24
|
+
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), _ctx.n("--" + _ctx.states.size), [_ctx.block, _ctx.n('$--flex') + " " + _ctx.n('--block'), _ctx.n('$--inline-flex')], [_ctx.disabled, _ctx.n('--disabled')], [_ctx.states.text, _ctx.n("--text-" + _ctx.states.type) + " " + _ctx.n('--text'), _ctx.n("--" + _ctx.states.type) + " " + _ctx.n("$-elevation--" + _ctx.states.elevation)], [_ctx.states.text && _ctx.disabled, _ctx.n('--text-disabled')], [_ctx.round, _ctx.n('--round')], [_ctx.states.outline, _ctx.n('--outline')])),
|
|
24
25
|
style: _normalizeStyle({
|
|
25
|
-
color: _ctx.textColor,
|
|
26
|
-
background: _ctx.color
|
|
26
|
+
color: _ctx.states.textColor,
|
|
27
|
+
background: _ctx.states.color
|
|
27
28
|
}),
|
|
28
29
|
type: _ctx.nativeType,
|
|
29
30
|
disabled: _ctx.disabled,
|
|
@@ -66,6 +67,39 @@ var __sfc__ = defineComponent({
|
|
|
66
67
|
|
|
67
68
|
setup(props) {
|
|
68
69
|
var pending = ref(false);
|
|
70
|
+
var {
|
|
71
|
+
buttonGroup
|
|
72
|
+
} = useButtonGroup();
|
|
73
|
+
var states = computed(() => {
|
|
74
|
+
if (!buttonGroup) {
|
|
75
|
+
return {
|
|
76
|
+
elevation: 2,
|
|
77
|
+
type: props.type != null ? props.type : 'default',
|
|
78
|
+
size: props.size != null ? props.size : 'normal',
|
|
79
|
+
color: props.color,
|
|
80
|
+
text: props.text,
|
|
81
|
+
textColor: props.textColor,
|
|
82
|
+
outline: props.outline
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var {
|
|
87
|
+
type,
|
|
88
|
+
size,
|
|
89
|
+
color,
|
|
90
|
+
textColor,
|
|
91
|
+
mode
|
|
92
|
+
} = buttonGroup;
|
|
93
|
+
return {
|
|
94
|
+
elevation: 0,
|
|
95
|
+
type: props.type != null ? props.type : type.value,
|
|
96
|
+
size: props.size != null ? props.size : size.value,
|
|
97
|
+
color: props.color != null ? props.color : color.value,
|
|
98
|
+
textColor: props.textColor != null ? props.textColor : textColor.value,
|
|
99
|
+
text: mode.value !== 'normal',
|
|
100
|
+
outline: mode.value === 'outline'
|
|
101
|
+
};
|
|
102
|
+
});
|
|
69
103
|
|
|
70
104
|
var attemptAutoLoading = result => {
|
|
71
105
|
if (props.autoLoading) {
|
|
@@ -111,6 +145,7 @@ var __sfc__ = defineComponent({
|
|
|
111
145
|
n,
|
|
112
146
|
classes,
|
|
113
147
|
pending,
|
|
148
|
+
states,
|
|
114
149
|
handleClick,
|
|
115
150
|
handleTouchstart
|
|
116
151
|
};
|
package/es/button/props.mjs
CHANGED
|
@@ -18,7 +18,6 @@ function nativeTypeValidator(nativeType) {
|
|
|
18
18
|
export var props = {
|
|
19
19
|
type: {
|
|
20
20
|
type: String,
|
|
21
|
-
default: 'default',
|
|
22
21
|
validator: typeValidator
|
|
23
22
|
},
|
|
24
23
|
nativeType: {
|
|
@@ -28,7 +27,6 @@ export var props = {
|
|
|
28
27
|
},
|
|
29
28
|
size: {
|
|
30
29
|
type: String,
|
|
31
|
-
default: 'normal',
|
|
32
30
|
validator: sizeValidator
|
|
33
31
|
},
|
|
34
32
|
loading: {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useAtParentIndex, useParent } from '../utils/components.mjs';
|
|
2
|
+
import { BUTTON_GROUP_BIND_BUTTON_KEY, BUTTON_GROUP_COUNT_BUTTON_KEY } from '../button-group/provide.mjs';
|
|
3
|
+
export function useButtonGroup() {
|
|
4
|
+
var {
|
|
5
|
+
bindParent,
|
|
6
|
+
parentProvider
|
|
7
|
+
} = useParent(BUTTON_GROUP_BIND_BUTTON_KEY);
|
|
8
|
+
var {
|
|
9
|
+
index
|
|
10
|
+
} = useAtParentIndex(BUTTON_GROUP_COUNT_BUTTON_KEY);
|
|
11
|
+
return {
|
|
12
|
+
index,
|
|
13
|
+
buttonGroup: parentProvider,
|
|
14
|
+
bindButtonGroup: bindParent
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { computed, defineComponent } from 'vue';
|
|
2
|
+
import { useButtons } from './provide.mjs';
|
|
3
|
+
import { createNamespace } from '../utils/components.mjs';
|
|
4
|
+
import { props } from './props.mjs';
|
|
5
|
+
var {
|
|
6
|
+
n,
|
|
7
|
+
classes
|
|
8
|
+
} = createNamespace('button-group');
|
|
9
|
+
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
10
|
+
|
|
11
|
+
function __render__(_ctx, _cache) {
|
|
12
|
+
return _openBlock(), _createElementBlock("div", {
|
|
13
|
+
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), [_ctx.mode, "" + _ctx.n("--mode-" + _ctx.mode)], [_ctx.vertical, _ctx.n('--vertical'), _ctx.n('--horizontal')], [_ctx.mode === 'normal', _ctx.n("$-elevation--" + _ctx.elevation)]))
|
|
14
|
+
}, [_renderSlot(_ctx.$slots, "default")], 2
|
|
15
|
+
/* CLASS */
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var __sfc__ = defineComponent({
|
|
20
|
+
name: 'VarButtonGroup',
|
|
21
|
+
props,
|
|
22
|
+
|
|
23
|
+
setup(props) {
|
|
24
|
+
var {
|
|
25
|
+
bindButtons
|
|
26
|
+
} = useButtons();
|
|
27
|
+
var buttonGroupProvider = {
|
|
28
|
+
elevation: computed(() => props.elevation),
|
|
29
|
+
type: computed(() => props.type),
|
|
30
|
+
size: computed(() => props.size),
|
|
31
|
+
color: computed(() => props.color),
|
|
32
|
+
textColor: computed(() => props.textColor),
|
|
33
|
+
mode: computed(() => props.mode)
|
|
34
|
+
};
|
|
35
|
+
bindButtons(buttonGroupProvider);
|
|
36
|
+
return {
|
|
37
|
+
n,
|
|
38
|
+
classes
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
__sfc__.render = __render__;
|
|
45
|
+
export default __sfc__;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.var-button-group { display: inline-flex; border-radius: var(--button-border-radius); max-width: 100%; overflow: auto;}.var-button-group > .var-button:active { box-shadow: none;}.var-button-group--horizontal > .var-button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0;}.var-button-group--horizontal > .var-button:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0;}.var-button-group--horizontal > .var-button:not(:first-child):not(:last-child) { border-radius: 0;}.var-button-group--horizontal.var-button-group--mode-text > .var-button { border-right: thin solid currentColor;}.var-button-group--horizontal.var-button-group--mode-text > .var-button:last-child { border: none;}.var-button-group--horizontal.var-button-group--mode-outline > .var-button:not(:first-child) { border-left: none;}.var-button-group--vertical { flex-direction: column;}.var-button-group--vertical > .var-button:first-child { border-bottom-left-radius: 0; border-bottom-right-radius: 0;}.var-button-group--vertical > .var-button:last-child { border-top-left-radius: 0; border-top-right-radius: 0;}.var-button-group--vertical > .var-button:not(:first-child):not(:last-child) { border-radius: 0;}.var-button-group--vertical.var-button-group--mode-text > .var-button { border-bottom: thin solid currentColor;}.var-button-group--vertical.var-button-group--mode-text > .var-button:last-child { border: none;}.var-button-group--vertical.var-button-group--mode-outline > .var-button:not(:first-child) { border-top: none;}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Component entry, the folder where the file exists will be exposed to the user
|
|
2
|
+
import ButtonGroup from './ButtonGroup.mjs';
|
|
3
|
+
|
|
4
|
+
ButtonGroup.install = function (app) {
|
|
5
|
+
app.component(ButtonGroup.name, ButtonGroup);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export var _ButtonGroupComponent = ButtonGroup;
|
|
9
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
function typeValidator(type) {
|
|
2
|
+
return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function sizeValidator(size) {
|
|
6
|
+
return ['normal', 'mini', 'small', 'large'].includes(size);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function modeValidator(mode) {
|
|
10
|
+
return ['normal', 'text', 'outline'].includes(mode);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export var props = {
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'default',
|
|
17
|
+
validator: typeValidator
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'normal',
|
|
22
|
+
validator: sizeValidator
|
|
23
|
+
},
|
|
24
|
+
color: {
|
|
25
|
+
type: String
|
|
26
|
+
},
|
|
27
|
+
textColor: {
|
|
28
|
+
type: String
|
|
29
|
+
},
|
|
30
|
+
mode: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'normal',
|
|
33
|
+
validator: modeValidator
|
|
34
|
+
},
|
|
35
|
+
elevation: {
|
|
36
|
+
type: [Number, String],
|
|
37
|
+
default: 2
|
|
38
|
+
},
|
|
39
|
+
vertical: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
42
|
+
}
|
|
43
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useAtChildrenCounter, useChildren } from '../utils/components.mjs';
|
|
2
|
+
export var BUTTON_GROUP_BIND_BUTTON_KEY = Symbol('BUTTON_GROUP_BIND_BUTTON_KEY');
|
|
3
|
+
export var BUTTON_GROUP_COUNT_BUTTON_KEY = Symbol('BUTTON_GROUP_COUNT_BUTTON_KEY');
|
|
4
|
+
export function useButtons() {
|
|
5
|
+
var {
|
|
6
|
+
bindChildren,
|
|
7
|
+
childProviders
|
|
8
|
+
} = useChildren(BUTTON_GROUP_BIND_BUTTON_KEY);
|
|
9
|
+
var {
|
|
10
|
+
length
|
|
11
|
+
} = useAtChildrenCounter(BUTTON_GROUP_COUNT_BUTTON_KEY);
|
|
12
|
+
return {
|
|
13
|
+
length,
|
|
14
|
+
buttons: childProviders,
|
|
15
|
+
bindButtons: bindChildren
|
|
16
|
+
};
|
|
17
|
+
}
|
package/es/index.bundle.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import BottomNavigationItem from './bottom-navigation-item/index.mjs'
|
|
|
9
9
|
import Breadcrumb from './breadcrumb/index.mjs'
|
|
10
10
|
import Breadcrumbs from './breadcrumbs/index.mjs'
|
|
11
11
|
import Button from './button/index.mjs'
|
|
12
|
+
import ButtonGroup from './button-group/index.mjs'
|
|
12
13
|
import Card from './card/index.mjs'
|
|
13
14
|
import Cell from './cell/index.mjs'
|
|
14
15
|
import Checkbox from './checkbox/index.mjs'
|
|
@@ -86,6 +87,7 @@ export * from './bottom-navigation-item/index.mjs'
|
|
|
86
87
|
export * from './breadcrumb/index.mjs'
|
|
87
88
|
export * from './breadcrumbs/index.mjs'
|
|
88
89
|
export * from './button/index.mjs'
|
|
90
|
+
export * from './button-group/index.mjs'
|
|
89
91
|
export * from './card/index.mjs'
|
|
90
92
|
export * from './cell/index.mjs'
|
|
91
93
|
export * from './checkbox/index.mjs'
|
|
@@ -163,6 +165,7 @@ import './bottom-navigation-item/style/index.mjs'
|
|
|
163
165
|
import './breadcrumb/style/index.mjs'
|
|
164
166
|
import './breadcrumbs/style/index.mjs'
|
|
165
167
|
import './button/style/index.mjs'
|
|
168
|
+
import './button-group/style/index.mjs'
|
|
166
169
|
import './card/style/index.mjs'
|
|
167
170
|
import './cell/style/index.mjs'
|
|
168
171
|
import './checkbox/style/index.mjs'
|
|
@@ -229,7 +232,7 @@ import './time-picker/style/index.mjs'
|
|
|
229
232
|
import './tooltip/style/index.mjs'
|
|
230
233
|
import './uploader/style/index.mjs'
|
|
231
234
|
|
|
232
|
-
const version = '2.8.
|
|
235
|
+
const version = '2.8.2'
|
|
233
236
|
|
|
234
237
|
function install(app) {
|
|
235
238
|
ActionSheet.install && app.use(ActionSheet)
|
|
@@ -243,6 +246,7 @@ function install(app) {
|
|
|
243
246
|
Breadcrumb.install && app.use(Breadcrumb)
|
|
244
247
|
Breadcrumbs.install && app.use(Breadcrumbs)
|
|
245
248
|
Button.install && app.use(Button)
|
|
249
|
+
ButtonGroup.install && app.use(ButtonGroup)
|
|
246
250
|
Card.install && app.use(Card)
|
|
247
251
|
Cell.install && app.use(Cell)
|
|
248
252
|
Checkbox.install && app.use(Checkbox)
|
|
@@ -324,6 +328,7 @@ export {
|
|
|
324
328
|
Breadcrumb,
|
|
325
329
|
Breadcrumbs,
|
|
326
330
|
Button,
|
|
331
|
+
ButtonGroup,
|
|
327
332
|
Card,
|
|
328
333
|
Cell,
|
|
329
334
|
Checkbox,
|
|
@@ -405,6 +410,7 @@ export default {
|
|
|
405
410
|
Breadcrumb,
|
|
406
411
|
Breadcrumbs,
|
|
407
412
|
Button,
|
|
413
|
+
ButtonGroup,
|
|
408
414
|
Card,
|
|
409
415
|
Cell,
|
|
410
416
|
Checkbox,
|
package/es/index.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import BottomNavigationItem from './bottom-navigation-item/index.mjs'
|
|
|
9
9
|
import Breadcrumb from './breadcrumb/index.mjs'
|
|
10
10
|
import Breadcrumbs from './breadcrumbs/index.mjs'
|
|
11
11
|
import Button from './button/index.mjs'
|
|
12
|
+
import ButtonGroup from './button-group/index.mjs'
|
|
12
13
|
import Card from './card/index.mjs'
|
|
13
14
|
import Cell from './cell/index.mjs'
|
|
14
15
|
import Checkbox from './checkbox/index.mjs'
|
|
@@ -86,6 +87,7 @@ export * from './bottom-navigation-item/index.mjs'
|
|
|
86
87
|
export * from './breadcrumb/index.mjs'
|
|
87
88
|
export * from './breadcrumbs/index.mjs'
|
|
88
89
|
export * from './button/index.mjs'
|
|
90
|
+
export * from './button-group/index.mjs'
|
|
89
91
|
export * from './card/index.mjs'
|
|
90
92
|
export * from './cell/index.mjs'
|
|
91
93
|
export * from './checkbox/index.mjs'
|
|
@@ -152,7 +154,7 @@ export * from './time-picker/index.mjs'
|
|
|
152
154
|
export * from './tooltip/index.mjs'
|
|
153
155
|
export * from './uploader/index.mjs'
|
|
154
156
|
|
|
155
|
-
const version = '2.8.
|
|
157
|
+
const version = '2.8.2'
|
|
156
158
|
|
|
157
159
|
function install(app) {
|
|
158
160
|
ActionSheet.install && app.use(ActionSheet)
|
|
@@ -166,6 +168,7 @@ function install(app) {
|
|
|
166
168
|
Breadcrumb.install && app.use(Breadcrumb)
|
|
167
169
|
Breadcrumbs.install && app.use(Breadcrumbs)
|
|
168
170
|
Button.install && app.use(Button)
|
|
171
|
+
ButtonGroup.install && app.use(ButtonGroup)
|
|
169
172
|
Card.install && app.use(Card)
|
|
170
173
|
Cell.install && app.use(Cell)
|
|
171
174
|
Checkbox.install && app.use(Checkbox)
|
|
@@ -247,6 +250,7 @@ export {
|
|
|
247
250
|
Breadcrumb,
|
|
248
251
|
Breadcrumbs,
|
|
249
252
|
Button,
|
|
253
|
+
ButtonGroup,
|
|
250
254
|
Card,
|
|
251
255
|
Cell,
|
|
252
256
|
Checkbox,
|
|
@@ -328,6 +332,7 @@ export default {
|
|
|
328
332
|
Breadcrumb,
|
|
329
333
|
Breadcrumbs,
|
|
330
334
|
Button,
|
|
335
|
+
ButtonGroup,
|
|
331
336
|
Card,
|
|
332
337
|
Cell,
|
|
333
338
|
Checkbox,
|
package/es/paper/Paper.mjs
CHANGED
|
@@ -13,7 +13,7 @@ function __render__(_ctx, _cache) {
|
|
|
13
13
|
var _directive_ripple = _resolveDirective("ripple");
|
|
14
14
|
|
|
15
15
|
return _withDirectives((_openBlock(), _createElementBlock("div", {
|
|
16
|
-
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), _ctx.n("$-elevation--" + _ctx.elevation), [_ctx.onClick, _ctx.n('--cursor')], [_ctx.round, _ctx.n('--round')], [_ctx.inline, _ctx.n('$--inline-flex')])),
|
|
16
|
+
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), [_ctx.elevation != null, _ctx.n("$-elevation--" + _ctx.elevation)], [_ctx.onClick, _ctx.n('--cursor')], [_ctx.round, _ctx.n('--round')], [_ctx.inline, _ctx.n('$--inline-flex')])),
|
|
17
17
|
style: _normalizeStyle({
|
|
18
18
|
width: _ctx.toSizeUnit(_ctx.width),
|
|
19
19
|
height: _ctx.toSizeUnit(_ctx.height),
|