papayaui 0.2.0 → 0.2.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.
@@ -2,22 +2,30 @@
2
2
  .#{$prefix}-badge {
3
3
  position: relative;
4
4
  display: inline-block;
5
+
5
6
  &__content {
6
7
  position: relative;
7
8
  display: flex;
8
9
  flex-direction: row;
9
- line-height: 11px;
10
+ line-height: _var(badge-font-size, 11px);
10
11
  text-align: center;
11
- font-size: 11px;
12
+ font-size: _var(badge-font-size, 11px);
12
13
  color: #fff;
13
- padding: 2px 5px;
14
+ padding: _var(badge-padding, 2px 5px);
14
15
  border-radius: 100px;
16
+ background-color: _var(badge-color, _var(color-danger));
15
17
  }
18
+
16
19
  &--dot &__content {
17
20
  padding: 0;
18
21
  width: 8px;
19
22
  height: 8px;
20
23
  }
24
+
25
+ &--border &__content {
26
+ border: _var(badge-border-width, 1px) solid _var(badge-border-color, #fff);
27
+ }
28
+
21
29
  &--fixed &__content {
22
30
  position: absolute;
23
31
  transform: translate(50%, -50%);
@@ -1,14 +1,19 @@
1
1
  <template>
2
- <view :class="[ns.b(), ns.is('dot', dot), ns.is('fixed', !!$slots.default)]">
2
+ <view
3
+ :class="[ns.b(), ns.is('dot', dot), ns.is('border', border), ns.is('fixed', !!$slots.default)]"
4
+ >
3
5
  <slot></slot>
4
6
  <view
5
7
  v-if="visible"
6
8
  :class="ns.e('content')"
7
- :style="{
8
- backgroundColor: color,
9
- top: getUnitValue(offset[1].toString()),
10
- right: getUnitValue(offset[0].toString()),
11
- }"
9
+ :style="
10
+ ns.style({
11
+ backgroundColor: color,
12
+ top: getUnitValue(offset[1].toString()),
13
+ right: getUnitValue(offset[0].toString()),
14
+ borderColor,
15
+ })
16
+ "
12
17
  >
13
18
  <slot v-if="$slots.content" name="content"></slot>
14
19
  <text v-else>{{ value }}</text>
@@ -14,6 +14,9 @@
14
14
  <DocDemoBlock title="自定义位置" card>
15
15
  <Demo5 />
16
16
  </DocDemoBlock>
17
+ <DocDemoBlock title="边框" card>
18
+ <Demo7 />
19
+ </DocDemoBlock>
17
20
  <DocDemoBlock title="独立展示" card>
18
21
  <Demo6 />
19
22
  </DocDemoBlock>
@@ -28,6 +31,7 @@ import Demo3 from '../../demos/badge/demo-3.vue'
28
31
  import Demo4 from '../../demos/badge/demo-4.vue'
29
32
  import Demo5 from '../../demos/badge/demo-5.vue'
30
33
  import Demo6 from '../../demos/badge/demo-6.vue'
34
+ import Demo7 from '../../demos/badge/demo-7.vue'
31
35
  </script>
32
36
 
33
37
  <style lang="scss">
@@ -35,12 +39,11 @@ import Demo6 from '../../demos/badge/demo-6.vue'
35
39
  :deep(.pa-badge) {
36
40
  margin-right: 42px;
37
41
  }
38
-
39
- &-block {
40
- width: 40px;
41
- height: 40px;
42
- background-color: rgb(238, 238, 238);
43
- border-radius: 3px;
44
- }
42
+ }
43
+ :deep(.demo-badge-block) {
44
+ width: 40px;
45
+ height: 40px;
46
+ background-color: rgb(238, 238, 238);
47
+ border-radius: 3px;
45
48
  }
46
49
  </style>
@@ -1,5 +1,4 @@
1
1
  import type { CSSProperties, ExtractPropTypes, PropType } from 'vue'
2
- import { defaultNamespace } from '../../core/useNamespace'
3
2
 
4
3
  export const badgeProps = {
5
4
  /**
@@ -9,10 +8,7 @@ export const badgeProps = {
9
8
  /**
10
9
  * 徽标背景颜色
11
10
  */
12
- color: {
13
- type: [String, Number] as PropType<CSSProperties['color']>,
14
- default: `var(--${defaultNamespace}-color-danger)`,
15
- },
11
+ color: [String, Number] as PropType<CSSProperties['color']>,
16
12
  /**
17
13
  * 是否展示为小点
18
14
  */
@@ -39,6 +35,14 @@ export const badgeProps = {
39
35
  type: Boolean,
40
36
  default: true,
41
37
  },
38
+ /**
39
+ * 是否显示边框
40
+ */
41
+ border: Boolean,
42
+ /**
43
+ * 边框颜色
44
+ */
45
+ borderColor: [String, Number] as PropType<CSSProperties['color']>,
42
46
  }
43
47
 
44
48
  export type BadgeProps = ExtractPropTypes<typeof badgeProps>
@@ -9,8 +9,9 @@
9
9
  :bg-color="bgColor"
10
10
  :closeable="closeable"
11
11
  :round="round"
12
- :close-on-click-overlay="maskCloseAble"
12
+ :close-on-click-overlay="closeOnClickOverlay ?? maskCloseAble"
13
13
  :safe-area-inset-bottom="false"
14
+ :duration="duration"
14
15
  @update:show="emit('update:show', !!$event)"
15
16
  @open="emit('open')"
16
17
  @opened="emit('opened')"
@@ -3,7 +3,15 @@ import { pick } from '../../utils'
3
3
  import { popupEmits, popupProps } from '../popup/props'
4
4
 
5
5
  export const bottomPopupProps = {
6
- ...pick(popupProps, ['show', 'zIndex', 'overlay', 'bgColor', 'safeAreaInsetBottom']),
6
+ ...pick(popupProps, [
7
+ 'show',
8
+ 'zIndex',
9
+ 'overlay',
10
+ 'bgColor',
11
+ 'safeAreaInsetBottom',
12
+ 'closeOnClickOverlay',
13
+ 'duration',
14
+ ]),
7
15
  /**
8
16
  * 标题
9
17
  */
@@ -31,6 +39,7 @@ export const bottomPopupProps = {
31
39
  },
32
40
  /**
33
41
  * 是否可以点击空白处关闭
42
+ * @deprecated 即将移除,统一使用 `closeOnClickOverlay`属性
34
43
  */
35
44
  maskCloseAble: popupProps.closeOnClickOverlay,
36
45
  }
@@ -3,7 +3,14 @@
3
3
  :show="show"
4
4
  :title="title"
5
5
  :height="height"
6
+ :round="round"
7
+ :z-index="zIndex"
8
+ :overlay="overlay"
9
+ :bg-color="bgColor"
10
+ :closeable="closeable"
11
+ :close-on-click-overlay="closeOnClickOverlay"
6
12
  :safe-area-inset-bottom="false"
13
+ :duration="duration"
7
14
  @update:show="emit('update:show', $event as boolean)"
8
15
  @open="emit('open')"
9
16
  @opened="emit('opened')"
@@ -1,7 +1,7 @@
1
- import type { ExtractPropTypes, CSSProperties, PropType } from 'vue'
1
+ import type { CSSProperties, ExtractPropTypes, PropType } from 'vue'
2
2
  import type { TreeNode, UseTreeFieldNames } from '../../core/useTree'
3
3
  import { defaultFieldNames } from '../../core/useTree'
4
- import { isArray, isObject, pick } from '../../utils'
4
+ import { isArray, isObject } from '../../utils'
5
5
  import { bottomPopupEmits, bottomPopupProps } from '../bottom-popup/props'
6
6
 
7
7
  export interface CascaderNode<T = any> {
@@ -13,7 +13,7 @@ export type CascaderOption = any
13
13
  export type CascaderValue = any
14
14
 
15
15
  export const cascaderProps = {
16
- ...pick(bottomPopupProps, ['show', 'height', 'title', 'safeAreaInsetBottom']),
16
+ ...bottomPopupProps,
17
17
  /**
18
18
  * 值
19
19
  */
@@ -4,7 +4,14 @@
4
4
  :show="show"
5
5
  :title="title"
6
6
  :height="height"
7
+ :round="round"
8
+ :z-index="zIndex"
9
+ :overlay="overlay"
10
+ :bg-color="bgColor"
11
+ :closeable="closeable"
12
+ :close-on-click-overlay="closeOnClickOverlay"
7
13
  :safe-area-inset-bottom="false"
14
+ :duration="duration"
8
15
  @update:show="emit('update:show', $event as boolean)"
9
16
  @open="emit('open')"
10
17
  @opened="emit('opened')"
@@ -1,13 +1,13 @@
1
- import type { ExtractPropTypes, CSSProperties, PropType } from 'vue'
1
+ import type { CSSProperties, ExtractPropTypes, PropType } from 'vue'
2
2
  import type { UseListProps } from '../../core/useList'
3
- import { isArray, isNumber, isObject, isString, pick } from '../../utils'
3
+ import { isArray, isNumber, isObject, isString } from '../../utils'
4
4
  import { bottomPopupEmits, bottomPopupProps } from '../bottom-popup/props'
5
5
 
6
6
  export type Option = any
7
7
  export type OptionValue = number | string
8
8
 
9
9
  export const pickerPopupProps = {
10
- ...pick(bottomPopupProps, ['show', 'height', 'title', 'safeAreaInsetBottom']),
10
+ ...bottomPopupProps,
11
11
  /**
12
12
  * 选择的值
13
13
  */
@@ -0,0 +1,10 @@
1
+ <template>
2
+ <view class="demo-badge">
3
+ <pa-badge content="6" border>
4
+ <view class="demo-badge-block"></view>
5
+ </pa-badge>
6
+ <pa-badge content="99" border border-color="#000">
7
+ <view class="demo-badge-block"></view>
8
+ </pa-badge>
9
+ </view>
10
+ </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "papayaui",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "适用于uniapp的ui扩展库",
5
5
  "packageManager": "pnpm@8.6.0",
6
6
  "dependencies": {
package/fonts/.DS_Store DELETED
Binary file
package/images/.DS_Store DELETED
Binary file