papayaui 0.2.9 → 0.2.11

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.
@@ -10,9 +10,11 @@
10
10
  font-size: _var(cell-font-size, 14px);
11
11
  line-height: _var(cell-line-height, 24px);
12
12
  overflow: hidden;
13
- &__title,
13
+ &__title {
14
+ flex: _var(cell-title-flex, 1);
15
+ }
14
16
  &__value {
15
- flex: 1;
17
+ flex: _var(cell-value-flex, 1);
16
18
  }
17
19
 
18
20
  &__icon,
@@ -34,7 +36,7 @@
34
36
  &__value {
35
37
  position: relative;
36
38
  overflow: hidden;
37
- text-align: right;
39
+ text-align: _var(cell-value-text-align, right);
38
40
  vertical-align: middle;
39
41
  word-wrap: break-word;
40
42
  @include _setVar(textarea-padding, 0);
@@ -51,7 +53,8 @@
51
53
  transform: rotate(_var(cell-icon-right-rotate, 0));
52
54
  }
53
55
 
54
- &__icon, &__icon-right {
56
+ &__icon,
57
+ &__icon-right {
55
58
  font-size: _var(cell-icon-size, 16px);
56
59
  }
57
60
 
@@ -14,7 +14,7 @@
14
14
  <view
15
15
  v-if="!!title || $slots.title"
16
16
  :class="[ns.e('title'), titleClass]"
17
- :style="{ flex: titleWidth ? `0 ${getUnitValue(titleWidth)}` : '1' }"
17
+ :style="ns.style({ flex: titleWidth ? `0 ${getUnitValue(titleWidth)}` : undefined })"
18
18
  >
19
19
  <slot v-if="$slots.title" name="title" />
20
20
  <template v-else>
@@ -22,7 +22,14 @@
22
22
  <view v-if="label" :class="ns.e('label')">{{ label }}</view>
23
23
  </template>
24
24
  </view>
25
- <view :class="[ns.e('value'), valueClass]" :style="{ textAlign: valueAlign }">
25
+ <view
26
+ :class="[ns.e('value'), valueClass]"
27
+ :style="
28
+ ns.style({
29
+ textAlign: valueAlign !== cellProps.valueAlign.default ? valueAlign : undefined,
30
+ })
31
+ "
32
+ >
26
33
  <slot v-if="$slots.default" />
27
34
  <text v-else :selectable="selectable" :user-select="selectable">{{ value }}</text>
28
35
 
@@ -14,6 +14,10 @@
14
14
  line-height: $height;
15
15
  }
16
16
 
17
+ &__input {
18
+ text-align: _var(input-text-align, right);
19
+ }
20
+
17
21
  &__placeholder {
18
22
  color: _var(input-placeholder-color, _var(color-disabled));
19
23
  }
@@ -5,12 +5,7 @@
5
5
  >
6
6
  <slot name="prefix" />
7
7
 
8
- <view
9
- v-if="showMask"
10
- :class="[ns.e('mask')]"
11
- :style="{ textAlign: inputAlign }"
12
- @tap.stop="onFocus"
13
- >
8
+ <view v-if="showMask" :class="[ns.e('mask')]" :style="customStyle" @tap.stop="onFocus">
14
9
  {{ inputValue }}
15
10
  </view>
16
11
 
@@ -22,7 +17,7 @@
22
17
  :disabled="readonly || disabled"
23
18
  :placeholder="placeholder"
24
19
  :placeholder-class="ns.e('placeholder')"
25
- :style="{ textAlign: inputAlign }"
20
+ :style="customStyle"
26
21
  :maxlength="maxLength"
27
22
  :focus="inputSelection.focus"
28
23
  :selection-start="inputSelection.start"
@@ -50,7 +45,7 @@
50
45
  </template>
51
46
 
52
47
  <script setup lang="ts">
53
- import { computed, ref } from 'vue'
48
+ import { computed, ref, type CSSProperties } from 'vue'
54
49
  import { formatNumericTypeString, minAndMax, useNamespace } from '../../core'
55
50
  import type { EventDetail } from '../../types'
56
51
  import IconComponent from '../icon/icon.vue'
@@ -72,6 +67,14 @@ const inputValue = computed<string>({
72
67
  },
73
68
  })
74
69
 
70
+ const customStyle = computed(() => {
71
+ const style: CSSProperties = {}
72
+ if (props.inputAlign !== inputProps.inputAlign.default) {
73
+ style.textAlign = props.inputAlign
74
+ }
75
+ return style
76
+ })
77
+
75
78
  const inputSelection = ref({ focus: false, start: -1, end: -1 })
76
79
 
77
80
  const showMask = computed(() => {
@@ -1,5 +1,6 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue'
2
2
  import { isString } from '../../utils'
3
+ import { cellProps } from '../cell'
3
4
 
4
5
  export type InputType = 'text' | 'number'
5
6
  export type InputValue = string | number
@@ -52,10 +53,7 @@ export const inputProps = {
52
53
  /**
53
54
  * 内容对齐方式
54
55
  */
55
- inputAlign: {
56
- type: String as PropType<'left' | 'center' | 'right'>,
57
- default: 'right',
58
- },
56
+ inputAlign: cellProps.valueAlign,
59
57
  /**
60
58
  * 是否禁用
61
59
  */
@@ -227,6 +227,7 @@ const onCreate = async () => {
227
227
  }
228
228
 
229
229
  const onSelect = async (value: OptionValue) => {
230
+ emit('select', value)
230
231
  if (_onSelect(value) && !showView.value.confirm) {
231
232
  onOk()
232
233
  }
@@ -118,6 +118,7 @@ export const pickerPopupEmits = {
118
118
  ...bottomPopupEmits,
119
119
  'update:modelValue': (value: OptionValue | OptionValue[]) =>
120
120
  isString(value) || isNumber(value) || isArray(value),
121
+ select: (item: Option) => isObject(item),
121
122
  change: (item: Option | Option[]) => isObject(item) || isArray(item),
122
123
  /**
123
124
  * 新增选项
@@ -18,6 +18,7 @@
18
18
  color: inherit;
19
19
  line-height: inherit;
20
20
  height: _var(textarea-height, $line-height * 3);
21
+ text-align: _var(textarea-text-align, left);
21
22
  }
22
23
 
23
24
  &__placeholder {
@@ -50,7 +50,9 @@ const customStyle = computed(() => {
50
50
  if (props.height && !props.autoHeight) {
51
51
  style.height = getUnitValue(props.height)
52
52
  }
53
- style.textAlign = props.inputAlign
53
+ if (props.inputAlign !== textareaProps.inputAlign.default) {
54
+ style.textAlign = props.inputAlign
55
+ }
54
56
  return style
55
57
  })
56
58
 
@@ -7,6 +7,7 @@ export type FileItem = {
7
7
  type?: 'image' | 'video'
8
8
  status?: 'ready' | 'uploading' | 'success' | 'error'
9
9
  deletable?: boolean
10
+ thumbUrl?: string
10
11
  }
11
12
 
12
13
  export const uploaderProps = {
@@ -6,7 +6,7 @@
6
6
  <view v-for="(file, index) in fileList" :key="index" :class="ns.e('preview')">
7
7
  <view :class="ns.e('preview-image')" :style="sizeStyle">
8
8
  <ImageComponent
9
- :src="file.url"
9
+ :src="file.thumbUrl ?? file.url"
10
10
  width="100%"
11
11
  height="100%"
12
12
  mode="aspectFill"
@@ -133,6 +133,13 @@ const onPreview = (file: FileItem, index: number) => {
133
133
  uni.previewMedia({
134
134
  sources: props.fileList,
135
135
  current: index,
136
+ fail: () => {
137
+ // 前面的API可能存在兼容问题,失败时使用降级方法
138
+ uni.previewImage({
139
+ urls: props.fileList.map((file) => file.url),
140
+ current: index,
141
+ })
142
+ },
136
143
  })
137
144
  // #endif
138
145
  // #ifndef MP
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "papayaui",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "适用于uniapp的ui扩展库",
5
5
  "packageManager": "pnpm@8.6.0",
6
6
  "dependencies": {
package/utils/cos.ts CHANGED
@@ -230,7 +230,7 @@ export class PaCOS {
230
230
  }
231
231
 
232
232
  async getAuthorization(options: any) {
233
- if (this.cosAuthorization && this.cosAuthorization.expiredTime < Date.now() / 1000) {
233
+ if (this.cosAuthorization && this.cosAuthorization.expiredTime > Date.now() / 1000) {
234
234
  return this.cosAuthorization
235
235
  }
236
236
  const authorization = await this.config.getAuthorization(options)
@@ -249,13 +249,6 @@ export class PaCOS {
249
249
  const cosConfig = await this.getConfig()
250
250
  const Key = `${cosConfig.prefix}/${params?.Key ?? filePath.replace(/^.+\/(.+)$/, '$1')}`
251
251
  return new Promise<UploadFileResult>((resolve, reject) => {
252
- console.log('uploadFile params', {
253
- Bucket: cosConfig.bucket,
254
- Region: cosConfig.region,
255
- FilePath: filePath,
256
- ...params,
257
- Key,
258
- })
259
252
  this.cos.uploadFile(
260
253
  {
261
254
  Bucket: cosConfig.bucket,
@@ -1,14 +0,0 @@
1
- import { defaultNamespace } from '../../core'
2
-
3
- const Dialog = () => {
4
- const node = uni
5
- .createSelectorQuery()
6
- .select(`#${defaultNamespace}-dialog`)
7
- .node((result) => {
8
- console.log('result', result)
9
- })
10
- .exec()
11
- console.log(node)
12
- }
13
-
14
- export default Dialog