papayaui 0.2.3 → 0.2.5
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/components/cascader/cascader.vue +1 -1
- package/components/cascader/props.ts +8 -0
- package/components/cell/cell.scss +7 -0
- package/components/cell/cell.vue +6 -3
- package/components/cell/props.ts +4 -0
- package/components/checkbox-btns/checkbox-btns.scss +5 -3
- package/components/checkbox-btns/checkbox-btns.vue +7 -5
- package/components/checkbox-btns/props.ts +1 -4
- package/components/field/props.ts +1 -1
- package/components/form-item/form-item.vue +9 -1
- package/components/form-item/props.ts +5 -1
- package/components/menu/menu.scss +8 -8
- package/components/menu-item/menu-item.vue +1 -0
- package/components/menu-item/props.ts +2 -0
- package/components/picker-popup/picker-popup.vue +5 -3
- package/components/picker-popup/props.ts +12 -0
- package/components/popup/popup.scss +1 -1
- package/components/search/props.ts +1 -0
- package/components/search/search.scss +13 -8
- package/components/search/search.vue +3 -1
- package/components/textarea/textarea.scss +1 -1
- package/demos/cell/demo-1.vue +1 -0
- package/demos/cell/demo-2.vue +1 -1
- package/demos/cell/demo-7.vue +1 -0
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
@closed="emit('closed')"
|
|
19
19
|
>
|
|
20
20
|
<view :class="ns.b('content')">
|
|
21
|
-
<Search v-if="showSearch" v-model="searchText" :class="ns.b('search')" />
|
|
21
|
+
<Search v-if="showSearch" v-model="searchText" v-bind="searchProps" :class="ns.b('search')" />
|
|
22
22
|
<view v-if="show" :class="ns.b('tab')">
|
|
23
23
|
<Tabs v-model="tabActive" :tabs="tabList" label-key="name" scrollable shrink />
|
|
24
24
|
</view>
|
|
@@ -3,6 +3,7 @@ import type { TreeNode, UseTreeFieldNames } from '../../core/useTree'
|
|
|
3
3
|
import { defaultFieldNames } from '../../core/useTree'
|
|
4
4
|
import { isArray, isObject } from '../../utils'
|
|
5
5
|
import { bottomPopupEmits, bottomPopupProps } from '../bottom-popup/props'
|
|
6
|
+
import type { SearchProps } from '../search'
|
|
6
7
|
|
|
7
8
|
export interface CascaderNode<T = any> {
|
|
8
9
|
props: T
|
|
@@ -50,6 +51,13 @@ export const cascaderProps = {
|
|
|
50
51
|
* 是否显示搜索
|
|
51
52
|
*/
|
|
52
53
|
showSearch: Boolean,
|
|
54
|
+
/**
|
|
55
|
+
* 搜索框的props
|
|
56
|
+
*/
|
|
57
|
+
searchProps: {
|
|
58
|
+
type: Object as PropType<Partial<SearchProps>>,
|
|
59
|
+
default: () => ({}),
|
|
60
|
+
},
|
|
53
61
|
/**
|
|
54
62
|
* 动态获取下一级节点数据
|
|
55
63
|
*/
|
|
@@ -24,6 +24,13 @@
|
|
|
24
24
|
margin-right: _var(cell-icon-left-margin-left, 4px);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
&__label {
|
|
28
|
+
margin-top: 4px;
|
|
29
|
+
color: _var(cell-label-color, _var(color-black-3));
|
|
30
|
+
font-size: _var(cell-label-font-size, 12px);
|
|
31
|
+
line-height: _var(cell-label-line-height, 18px);
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
&__value {
|
|
28
35
|
position: relative;
|
|
29
36
|
overflow: hidden;
|
package/components/cell/cell.vue
CHANGED
|
@@ -17,13 +17,16 @@
|
|
|
17
17
|
:style="{ flex: titleWidth ? `0 ${getUnitValue(titleWidth)}` : '1' }"
|
|
18
18
|
>
|
|
19
19
|
<slot v-if="$slots.title" name="title" />
|
|
20
|
-
<
|
|
20
|
+
<template v-else>
|
|
21
|
+
<text>{{ title }}</text>
|
|
22
|
+
<view v-if="label" :class="ns.e('label')">{{ label }}</view>
|
|
23
|
+
</template>
|
|
21
24
|
</view>
|
|
22
|
-
<view :class="[ns.e('value'), valueClass]">
|
|
25
|
+
<view :class="[ns.e('value'), valueClass]" :style="{ textAlign: valueAlign }">
|
|
23
26
|
<slot v-if="$slots.default" />
|
|
24
27
|
<text v-else :selectable="selectable" :user-select="selectable">{{ value }}</text>
|
|
25
28
|
|
|
26
|
-
<view v-if="errorMessage" :class="ns.e('error-message')"
|
|
29
|
+
<view v-if="errorMessage" :class="ns.e('error-message')">
|
|
27
30
|
{{ errorMessage }}
|
|
28
31
|
</view>
|
|
29
32
|
</view>
|
package/components/cell/props.ts
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
&-button {
|
|
4
4
|
font-size: _var(checkbox-btns-font-size, 14px);
|
|
5
5
|
color: _var(checkbox-btns-color, _var(color-black));
|
|
6
|
+
background-color: _var(checkbox-btns-background, _var(color-gray));
|
|
7
|
+
border-color: _var(checkbox-btns-border-color, _var(color-gray));
|
|
6
8
|
padding: _var(checkbox-btns-padding, 7px 4px);
|
|
7
9
|
border-width: _var(checkbox-btns-border-width, 2rpx);
|
|
8
10
|
border-style: solid;
|
|
9
11
|
text-align: center;
|
|
10
12
|
&.active {
|
|
11
|
-
color: _var(color-primary);
|
|
12
|
-
background-color: rgba(0, 156, 93, 0.1) !important;
|
|
13
|
-
border-color: _var(color-primary) !important;
|
|
13
|
+
color: _var(checkbox-btns-active-color, _var(color-primary));
|
|
14
|
+
background-color: _var(checkbox-btns-active-background, rgba(0, 156, 93, 0.1)) !important;
|
|
15
|
+
border-color: _var(checkbox-btns-active-border-color, _var(color-primary)) !important;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
}
|
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
active: typeof modelValue !== 'undefined' ? isSelected(item[valueKey]) : false,
|
|
14
14
|
},
|
|
15
15
|
]"
|
|
16
|
-
:style="
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
:style="
|
|
17
|
+
ns.style({
|
|
18
|
+
backgroundColor: bgColor,
|
|
19
|
+
borderColor: bgColor,
|
|
20
|
+
borderRadius: getUnitValue(typeof round === 'boolean' ? (round ? '100' : '0') : round),
|
|
21
|
+
})
|
|
22
|
+
"
|
|
21
23
|
@tap="onSelect(item, index)"
|
|
22
24
|
>
|
|
23
25
|
<slot v-if="$slots.default" :item="item" :index="index" />
|
|
@@ -112,7 +112,7 @@ export const fieldProps = {
|
|
|
112
112
|
export const fieldEmits = {
|
|
113
113
|
'update:modelValue': (value: string) => isString(value),
|
|
114
114
|
input: (value: string) => isString(value),
|
|
115
|
-
blur: (value:
|
|
115
|
+
blur: (value: unknown) => isObject(value),
|
|
116
116
|
confirm: (value: EventDetail<{ value: string }>) => isObject(value),
|
|
117
117
|
clear: () => true,
|
|
118
118
|
'click-input': (value: Event) => isObject(value),
|
|
@@ -4,9 +4,17 @@
|
|
|
4
4
|
:title="label"
|
|
5
5
|
:error-message="errorMessage"
|
|
6
6
|
v-bind="$props"
|
|
7
|
+
:label="desc"
|
|
7
8
|
@click="emit('click')"
|
|
8
9
|
/>
|
|
9
|
-
<Cell
|
|
10
|
+
<Cell
|
|
11
|
+
v-else
|
|
12
|
+
:title="label"
|
|
13
|
+
:error-message="errorMessage"
|
|
14
|
+
v-bind="$props"
|
|
15
|
+
:label="desc"
|
|
16
|
+
@click="emit('click')"
|
|
17
|
+
>
|
|
10
18
|
<slot />
|
|
11
19
|
</Cell>
|
|
12
20
|
</template>
|
|
@@ -4,7 +4,7 @@ import { pick } from '../../utils'
|
|
|
4
4
|
import { cellProps } from '../cell'
|
|
5
5
|
|
|
6
6
|
export const formItemProps = {
|
|
7
|
-
...pick(cellProps, ['suffix']),
|
|
7
|
+
...pick(cellProps, ['titleWidth', 'suffix']),
|
|
8
8
|
/**
|
|
9
9
|
* 校验对应的字段名
|
|
10
10
|
*/
|
|
@@ -13,6 +13,10 @@ export const formItemProps = {
|
|
|
13
13
|
* 标签名
|
|
14
14
|
*/
|
|
15
15
|
label: String,
|
|
16
|
+
/**
|
|
17
|
+
* 描述信息
|
|
18
|
+
*/
|
|
19
|
+
desc: String,
|
|
16
20
|
/**
|
|
17
21
|
* 校验规则
|
|
18
22
|
*/
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
@import '../../styles/vars.scss';
|
|
2
2
|
|
|
3
3
|
.#{$prefix}-menu {
|
|
4
|
-
$barHeight: 48px;
|
|
4
|
+
$barHeight: _var(menu-height, 48px);
|
|
5
5
|
|
|
6
6
|
position: relative;
|
|
7
7
|
&__bar {
|
|
8
8
|
position: relative;
|
|
9
9
|
display: flex;
|
|
10
10
|
height: $barHeight;
|
|
11
|
-
background-color: #fff;
|
|
12
|
-
box-shadow: 0 2px 12px rgb(100 101 102 / 12%);
|
|
11
|
+
background-color: _var(menu-background, #fff);
|
|
12
|
+
box-shadow: _var(menu-shadow, 0 2px 12px rgb(100 101 102 / 12%));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
&__item {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
position: relative;
|
|
26
26
|
box-sizing: border-box;
|
|
27
27
|
max-width: 100%;
|
|
28
|
-
padding: 0 8px;
|
|
29
|
-
color: _var(color-black);
|
|
30
|
-
font-size: 15px;
|
|
31
|
-
line-height: 22px;
|
|
28
|
+
padding: _var(menu-title-padding, 0 8px);
|
|
29
|
+
color: _var(menu-title-color, _var(color-black));
|
|
30
|
+
font-size: _var(menu-title-font-size, 15px);
|
|
31
|
+
line-height: _var(menu-title-line-height, 22px);
|
|
32
32
|
|
|
33
33
|
&::after {
|
|
34
34
|
position: absolute;
|
|
@@ -60,4 +60,4 @@
|
|
|
60
60
|
border-color: transparent transparent currentColor currentColor;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
@confirm="onOk"
|
|
21
21
|
>
|
|
22
22
|
<view :class="ns.e('content')">
|
|
23
|
+
<slot name="before" />
|
|
23
24
|
<Search
|
|
24
25
|
v-if="showSearch"
|
|
25
26
|
v-model="searchText"
|
|
27
|
+
v-bind="searchProps"
|
|
26
28
|
:class="ns.e('search')"
|
|
27
29
|
@change="debounceSearchChange"
|
|
28
30
|
/>
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
<ButtonComponent
|
|
57
59
|
v-if="showView.create"
|
|
58
60
|
:class="ns.e('create-button')"
|
|
59
|
-
:type="
|
|
61
|
+
:type="showView.confirm ? 'default' : 'primary'"
|
|
60
62
|
ellipsis
|
|
61
63
|
block
|
|
62
64
|
@click="onCreate"
|
|
@@ -138,7 +140,7 @@ const filterOptions = computed(() => {
|
|
|
138
140
|
|
|
139
141
|
const showView = computed(() => {
|
|
140
142
|
const create = props.allowCreate && !!searchText.value
|
|
141
|
-
const confirm = props.multiple
|
|
143
|
+
const confirm = props.multiple || props.showConfirm
|
|
142
144
|
return {
|
|
143
145
|
footer: create || confirm,
|
|
144
146
|
create,
|
|
@@ -225,7 +227,7 @@ const onCreate = async () => {
|
|
|
225
227
|
}
|
|
226
228
|
|
|
227
229
|
const onSelect = async (value: OptionValue) => {
|
|
228
|
-
if (_onSelect(value) && !
|
|
230
|
+
if (_onSelect(value) && !showView.value.confirm) {
|
|
229
231
|
onOk()
|
|
230
232
|
}
|
|
231
233
|
}
|
|
@@ -2,6 +2,7 @@ import type { CSSProperties, ExtractPropTypes, PropType } from 'vue'
|
|
|
2
2
|
import type { UseListProps } from '../../core/useList'
|
|
3
3
|
import { isArray, isNumber, isObject, isString } from '../../utils'
|
|
4
4
|
import { bottomPopupEmits, bottomPopupProps } from '../bottom-popup/props'
|
|
5
|
+
import type { SearchProps } from '../search'
|
|
5
6
|
|
|
6
7
|
export type Option = any
|
|
7
8
|
export type OptionValue = number | string
|
|
@@ -37,6 +38,13 @@ export const pickerPopupProps = {
|
|
|
37
38
|
* 是否显示搜索
|
|
38
39
|
*/
|
|
39
40
|
showSearch: Boolean,
|
|
41
|
+
/**
|
|
42
|
+
* 搜索框的props
|
|
43
|
+
*/
|
|
44
|
+
searchProps: {
|
|
45
|
+
type: Object as PropType<Partial<SearchProps>>,
|
|
46
|
+
default: () => ({}),
|
|
47
|
+
},
|
|
40
48
|
/**
|
|
41
49
|
* 是否多选
|
|
42
50
|
*/
|
|
@@ -84,6 +92,10 @@ export const pickerPopupProps = {
|
|
|
84
92
|
* 确定后是否重置数据
|
|
85
93
|
*/
|
|
86
94
|
resetAfterConfirm: Boolean,
|
|
95
|
+
/**
|
|
96
|
+
* 是否显示确认按钮,多选时强制开启
|
|
97
|
+
*/
|
|
98
|
+
showConfirm: Boolean,
|
|
87
99
|
/**
|
|
88
100
|
* 是否允许用户创建新条目,需配合 showSearch 使用
|
|
89
101
|
*/
|
|
@@ -51,6 +51,7 @@ export const searchEmits = {
|
|
|
51
51
|
'update:modelValue': (value: string) => isString(value),
|
|
52
52
|
change: (value: string) => isString(value),
|
|
53
53
|
confirm: (value: EventDetail<{ value: string }>) => isObject(value),
|
|
54
|
+
blur: (value: unknown) => isObject(value),
|
|
54
55
|
clear: () => true,
|
|
55
56
|
'click-input': () => true,
|
|
56
57
|
}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
@import '../../styles/vars.scss';
|
|
2
2
|
.#{$prefix}-search {
|
|
3
|
-
@include _setVar(field-input-color, _var(color-black));
|
|
4
|
-
@include _setVar(cell-bg-color, transparent);
|
|
5
|
-
@include _setVar(cell-title-color, _var(color-black-3));
|
|
6
|
-
@include _setVar(cell-padding-x, 8px);
|
|
7
|
-
@include _setVar(cell-padding-y, 8px);
|
|
8
3
|
padding: _var(search-padding, 10px 12px);
|
|
9
4
|
background-color: _var(search-bg-color, #fff);
|
|
10
|
-
|
|
5
|
+
|
|
6
|
+
&__content {
|
|
11
7
|
flex: 1;
|
|
12
8
|
background-color: _var(search-input-bg-color, _var(color-gray));
|
|
13
|
-
border-radius: 3px;
|
|
9
|
+
border-radius: _var(search-input-radius, 3px);
|
|
14
10
|
}
|
|
15
|
-
|
|
11
|
+
|
|
12
|
+
&__input {
|
|
13
|
+
@include _setVar(field-input-color, _var(search-input-color, _var(color-black)));
|
|
14
|
+
@include _setVar(cell-bg-color, transparent);
|
|
15
|
+
@include _setVar(cell-title-color, _var(search-icon-color, _var(color-black-3)));
|
|
16
|
+
@include _setVar(cell-padding-x, _var(search-input-padding-x, 8px));
|
|
17
|
+
@include _setVar(cell-padding-y, _var(search-input-padding-y, 5px));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&--round &__content {
|
|
16
21
|
border-radius: 100px;
|
|
17
22
|
}
|
|
18
23
|
}
|
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
>
|
|
7
7
|
<slot name="before" />
|
|
8
8
|
<view
|
|
9
|
-
:class="ns.
|
|
9
|
+
:class="ns.e('content')"
|
|
10
10
|
class="flex items-center"
|
|
11
11
|
:style="ns.style({ backgroundColor: inputBackground })"
|
|
12
12
|
>
|
|
13
13
|
<slot name="prefix" />
|
|
14
14
|
<Field
|
|
15
|
+
:class="ns.e('input')"
|
|
15
16
|
class="flex-1"
|
|
16
17
|
:model-value="modelValue"
|
|
17
18
|
icon="search"
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
:clearable="clearable"
|
|
24
25
|
@update:model-value="onUpdate"
|
|
25
26
|
@confirm="emit('confirm', $event)"
|
|
27
|
+
@blur="emit('blur', $event)"
|
|
26
28
|
@clear="emit('clear')"
|
|
27
29
|
@click-input="emit('click-input')"
|
|
28
30
|
/>
|
package/demos/cell/demo-1.vue
CHANGED
package/demos/cell/demo-2.vue
CHANGED
package/demos/cell/demo-7.vue
CHANGED