sadais-piui 1.2.7-beta40 → 1.2.7-beta41
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: zhangzhenfei
|
|
3
3
|
* @Date: 2022-06-28 16:53:54
|
|
4
|
-
* @LastEditTime: 2022-08-
|
|
4
|
+
* @LastEditTime: 2022-08-31 16:19:31
|
|
5
5
|
* @LastEditors: zhangzhenfei
|
|
6
6
|
* @Description: 日历日期数据
|
|
7
7
|
* @FilePath: /dt-weitibao-console/Users/feilin/workspace/piui/piui-awesome/src/piui/components/pi-calendar-panel/components/calendar-days/index.vue
|
|
@@ -184,7 +184,7 @@ export default {
|
|
|
184
184
|
}
|
|
185
185
|
return new Date(year, month, '0')
|
|
186
186
|
},
|
|
187
|
-
|
|
187
|
+
getNextMonthFirstDay() {
|
|
188
188
|
let year = this.year
|
|
189
189
|
let month = this.month + 1
|
|
190
190
|
if (month === 13) {
|
|
@@ -198,7 +198,7 @@ export default {
|
|
|
198
198
|
const firstDays = []
|
|
199
199
|
const preMonthLastDay = this.getPreMonthLastDay
|
|
200
200
|
const lastDay = preMonthLastDay.getDate()
|
|
201
|
-
const firstDay = new Date(`${this.year}
|
|
201
|
+
const firstDay = new Date(`${this.year}-${this.month}-01 00:00:00`).getDay()
|
|
202
202
|
for (let i = 0; i < firstDay; i++) {
|
|
203
203
|
const day = preMonthLastDay.setDate(lastDay - firstDay + i + 1)
|
|
204
204
|
firstDays.push(new Date(day))
|
|
@@ -222,10 +222,10 @@ export default {
|
|
|
222
222
|
const dayCount = 7 * 6 // 固定显示6周
|
|
223
223
|
const monthDays = new Date(this.year, this.month, 0).getDate()
|
|
224
224
|
const firstDayCount = this.firstDay.length
|
|
225
|
-
const nextMonthFirstDay = this.
|
|
225
|
+
const nextMonthFirstDay = this.getNextMonthFirstDay
|
|
226
226
|
for (let i = 1; i <= dayCount; i++) {
|
|
227
227
|
let day = {
|
|
228
|
-
key:
|
|
228
|
+
key: this.$pi.guid(),
|
|
229
229
|
index: i
|
|
230
230
|
}
|
|
231
231
|
|
|
@@ -247,9 +247,10 @@ export default {
|
|
|
247
247
|
}
|
|
248
248
|
} else {
|
|
249
249
|
// 当月数据
|
|
250
|
+
const formatDay = `${this.year}-${this.month}-${i - firstDayCount}`
|
|
250
251
|
day = {
|
|
251
252
|
...day,
|
|
252
|
-
...this.$pi.date.parseDate(
|
|
253
|
+
...this.$pi.date.parseDate(new Date(formatDay))
|
|
253
254
|
}
|
|
254
255
|
const isDisabled = this.isDisabled(day)
|
|
255
256
|
// 禁用
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
2
|
+
<view
|
|
3
|
+
class="pi-align-center pi-w-100P"
|
|
4
|
+
:style="[customStyle]"
|
|
5
|
+
:class="[customClass]"
|
|
6
|
+
>
|
|
3
7
|
<view v-if="searchLabel" class="pi-pd-right-18" :style="[searchLabelStyle]">
|
|
4
8
|
{{ searchLabel }}
|
|
5
9
|
</view>
|
|
@@ -12,8 +16,8 @@
|
|
|
12
16
|
{
|
|
13
17
|
background: background,
|
|
14
18
|
borderRadius: shape == 'round' ? '2000px' : '8rpx',
|
|
15
|
-
flexDirection: searchIconPosition === 'right' ? 'row-reverse' : 'row'
|
|
16
|
-
}
|
|
19
|
+
flexDirection: searchIconPosition === 'right' ? 'row-reverse' : 'row',
|
|
20
|
+
},
|
|
17
21
|
]"
|
|
18
22
|
>
|
|
19
23
|
<!-- 搜索图标 -->
|
|
@@ -22,8 +26,8 @@
|
|
|
22
26
|
:class="[
|
|
23
27
|
{
|
|
24
28
|
'pi-pd-left-18 pi-pd-right-18': searchIconPosition === 'left',
|
|
25
|
-
'pi-pd-right-18': searchIconPosition === 'right'
|
|
26
|
-
}
|
|
29
|
+
'pi-pd-right-18': searchIconPosition === 'right',
|
|
30
|
+
},
|
|
27
31
|
]"
|
|
28
32
|
>
|
|
29
33
|
<view :class="'pi-fz-32 pi-icon-' + searchIcon" :style="[IconStyle]" />
|
|
@@ -34,6 +38,24 @@
|
|
|
34
38
|
:class="[{ 'pi-pd-left-18': searchIconPosition === 'right' }]"
|
|
35
39
|
>
|
|
36
40
|
<input
|
|
41
|
+
v-if="isControlFocus"
|
|
42
|
+
class="pi-flex-sub pi-fz-28"
|
|
43
|
+
confirm-type="search"
|
|
44
|
+
:value="val"
|
|
45
|
+
:disabled="disabled"
|
|
46
|
+
:maxlength="parseInt(maxlength, 10)"
|
|
47
|
+
:focus="focused"
|
|
48
|
+
:placeholder="placeholder"
|
|
49
|
+
:placeholder-style="placeholderStyle"
|
|
50
|
+
type="text"
|
|
51
|
+
:style="[mergeInputStyle]"
|
|
52
|
+
@blur="handleInputBlur"
|
|
53
|
+
@confirm="handleInputSearch"
|
|
54
|
+
@input="handleInputChange"
|
|
55
|
+
@focus="handleInputFocus"
|
|
56
|
+
/>
|
|
57
|
+
<input
|
|
58
|
+
v-else
|
|
37
59
|
class="pi-flex-sub pi-fz-28"
|
|
38
60
|
confirm-type="search"
|
|
39
61
|
:value="val"
|
|
@@ -50,7 +72,11 @@
|
|
|
50
72
|
@focus="handleInputFocus"
|
|
51
73
|
/>
|
|
52
74
|
<!-- clear action -->
|
|
53
|
-
<view
|
|
75
|
+
<view
|
|
76
|
+
v-if="clearable && val"
|
|
77
|
+
class="pi-pd-lr-18"
|
|
78
|
+
@tap="handleClearInput"
|
|
79
|
+
>
|
|
54
80
|
<view class="pi-icon-roundclosefill" :style="[clearIconStyle]" />
|
|
55
81
|
</view>
|
|
56
82
|
</view>
|
|
@@ -77,202 +103,212 @@
|
|
|
77
103
|
* clear 点击清除按钮后触发 event: Event
|
|
78
104
|
* action 点击右侧action触发
|
|
79
105
|
*/
|
|
80
|
-
import ValueSync from
|
|
81
|
-
import { getConfig } from
|
|
106
|
+
import ValueSync from "../../mixin/value-sync";
|
|
107
|
+
import { getConfig } from "../../config";
|
|
82
108
|
|
|
83
|
-
const TAG =
|
|
84
|
-
const { search } = getConfig()
|
|
109
|
+
const TAG = "PiSearch";
|
|
110
|
+
const { search } = getConfig();
|
|
85
111
|
|
|
86
112
|
export default {
|
|
87
|
-
name:
|
|
113
|
+
name: "PiSearch",
|
|
88
114
|
// 混入自定义样式customStyle和customClass
|
|
89
115
|
mixins: [ValueSync], // 注入value与val,进行双向绑定
|
|
90
116
|
props: {
|
|
91
117
|
// 初始值
|
|
92
118
|
value: {
|
|
93
|
-
required: false
|
|
119
|
+
required: false,
|
|
94
120
|
},
|
|
95
121
|
// 自定义样式,对象形式
|
|
96
122
|
customStyle: {
|
|
97
123
|
type: Object,
|
|
98
124
|
// `{}`
|
|
99
125
|
default() {
|
|
100
|
-
return search.customStyle
|
|
101
|
-
}
|
|
126
|
+
return search.customStyle;
|
|
127
|
+
},
|
|
102
128
|
},
|
|
103
129
|
// 自定义样式类,字符串形式
|
|
104
130
|
customClass: {
|
|
105
131
|
type: String,
|
|
106
132
|
// `''`
|
|
107
133
|
default() {
|
|
108
|
-
return search.customClass
|
|
109
|
-
}
|
|
134
|
+
return search.customClass;
|
|
135
|
+
},
|
|
110
136
|
},
|
|
111
137
|
// 搜索框形状,可选值为 `'square'` `'round'`
|
|
112
138
|
shape: {
|
|
113
139
|
type: String,
|
|
114
140
|
// `'round'`
|
|
115
141
|
default: search.shape,
|
|
116
|
-
validator: function(value) {
|
|
117
|
-
return [
|
|
118
|
-
}
|
|
142
|
+
validator: function (value) {
|
|
143
|
+
return ["square", "round"].includes(value);
|
|
144
|
+
},
|
|
119
145
|
},
|
|
120
146
|
// 背景颜色
|
|
121
147
|
background: {
|
|
122
148
|
type: String,
|
|
123
149
|
// `'#f5f5f5'`
|
|
124
|
-
default: search.background
|
|
150
|
+
default: search.background,
|
|
125
151
|
},
|
|
126
152
|
// 是否启用清除控件
|
|
127
153
|
clearable: {
|
|
128
154
|
type: Boolean,
|
|
129
155
|
// `true`
|
|
130
|
-
default: search.clearable
|
|
156
|
+
default: search.clearable,
|
|
131
157
|
},
|
|
132
158
|
// 清除图标自定义样式
|
|
133
159
|
clearIconStyle: {
|
|
134
160
|
type: Object,
|
|
135
161
|
// `{}`
|
|
136
162
|
default() {
|
|
137
|
-
return search.searchIconStyle
|
|
138
|
-
}
|
|
163
|
+
return search.searchIconStyle;
|
|
164
|
+
},
|
|
139
165
|
},
|
|
140
166
|
// 是否自动获得焦点
|
|
141
167
|
focus: {
|
|
142
168
|
type: Boolean,
|
|
143
169
|
// `false`
|
|
144
|
-
default: search.focus
|
|
170
|
+
default: search.focus,
|
|
145
171
|
},
|
|
146
172
|
// 占位提示文字
|
|
147
173
|
placeholder: {
|
|
148
174
|
type: String,
|
|
149
175
|
// `'请输入搜索关键词'`
|
|
150
|
-
default: search.placeholder
|
|
176
|
+
default: search.placeholder,
|
|
151
177
|
},
|
|
152
178
|
// 指定 placeholder 的样式
|
|
153
179
|
placeholderStyle: {
|
|
154
180
|
type: String,
|
|
155
181
|
// `'color: #cccccc;'`
|
|
156
182
|
default() {
|
|
157
|
-
return search.placeholderStyle
|
|
158
|
-
}
|
|
183
|
+
return search.placeholderStyle;
|
|
184
|
+
},
|
|
159
185
|
},
|
|
160
186
|
// 输入框最大能输入的长度,-1为不限制长度
|
|
161
187
|
maxlength: {
|
|
162
188
|
type: [Number, String],
|
|
163
189
|
// `-1`
|
|
164
|
-
default: search.maxlength
|
|
190
|
+
default: search.maxlength,
|
|
165
191
|
},
|
|
166
192
|
// 是否在搜索框右侧显示文字
|
|
167
193
|
showAction: {
|
|
168
194
|
type: Boolean,
|
|
169
195
|
// `false`
|
|
170
|
-
default: search.showAction
|
|
196
|
+
default: search.showAction,
|
|
171
197
|
},
|
|
172
198
|
// 右侧显示文字
|
|
173
199
|
actionText: {
|
|
174
200
|
type: String,
|
|
175
201
|
// `'取消'`
|
|
176
|
-
default: search.actionText
|
|
202
|
+
default: search.actionText,
|
|
177
203
|
},
|
|
178
204
|
// 指定右侧显示文字样式
|
|
179
205
|
actionStyle: {
|
|
180
206
|
type: Object,
|
|
181
207
|
// `{}`
|
|
182
208
|
default() {
|
|
183
|
-
return search.actionStyle
|
|
184
|
-
}
|
|
209
|
+
return search.actionStyle;
|
|
210
|
+
},
|
|
185
211
|
},
|
|
186
212
|
// 输入框内容对齐方式,可选值 `'left'` `'center'` `'right'`
|
|
187
213
|
inputAlign: {
|
|
188
214
|
type: String,
|
|
189
215
|
// `'left'`
|
|
190
|
-
default: search.inputAlign
|
|
216
|
+
default: search.inputAlign,
|
|
191
217
|
},
|
|
192
218
|
// 搜索框左侧文本
|
|
193
219
|
searchLabel: {
|
|
194
220
|
type: String,
|
|
195
221
|
// `''`
|
|
196
|
-
default: search.searchLabel
|
|
222
|
+
default: search.searchLabel,
|
|
197
223
|
},
|
|
198
224
|
// 搜索框左侧文本样式
|
|
199
225
|
searchLabelStyle: {
|
|
200
226
|
type: Object,
|
|
201
227
|
// `{}`
|
|
202
228
|
default() {
|
|
203
|
-
return search.searchLabelStyle
|
|
204
|
-
}
|
|
229
|
+
return search.searchLabelStyle;
|
|
230
|
+
},
|
|
205
231
|
},
|
|
206
232
|
// 是否显示搜索icon
|
|
207
233
|
showSearchIcon: {
|
|
208
234
|
type: Boolean,
|
|
209
235
|
// `true`
|
|
210
|
-
default: search.showSearchIcon
|
|
236
|
+
default: search.showSearchIcon,
|
|
211
237
|
},
|
|
212
238
|
// 输入框的图标,可以为icon名称或图片路径
|
|
213
239
|
searchIcon: {
|
|
214
240
|
type: String,
|
|
215
241
|
// `'search'`
|
|
216
|
-
default: search.searchIcon
|
|
242
|
+
default: search.searchIcon,
|
|
217
243
|
},
|
|
218
244
|
// 输入框左边的图标颜色(当传入searchIcon为name的时候)
|
|
219
245
|
searchIconColor: {
|
|
220
246
|
type: String,
|
|
221
247
|
// `'#333333'`
|
|
222
|
-
default: search.searchIconColor
|
|
248
|
+
default: search.searchIconColor,
|
|
223
249
|
},
|
|
224
250
|
// 输入框左侧的图标自定义样式
|
|
225
251
|
searchIconStyle: {
|
|
226
252
|
type: Object,
|
|
227
253
|
// `{}`
|
|
228
254
|
default() {
|
|
229
|
-
return search.searchIconStyle
|
|
230
|
-
}
|
|
255
|
+
return search.searchIconStyle;
|
|
256
|
+
},
|
|
231
257
|
},
|
|
232
258
|
// 搜索icon的位置, 可选值为`'left'` `'right'`
|
|
233
259
|
searchIconPosition: {
|
|
234
260
|
type: String,
|
|
235
261
|
// `'left'`
|
|
236
262
|
default: search.searchIconPosition,
|
|
237
|
-
validator: function(value) {
|
|
238
|
-
return [
|
|
239
|
-
}
|
|
263
|
+
validator: function (value) {
|
|
264
|
+
return ["left", "right"].includes(value);
|
|
265
|
+
},
|
|
240
266
|
},
|
|
241
267
|
// 是否禁用输入框
|
|
242
268
|
disabled: {
|
|
243
269
|
type: Boolean,
|
|
244
270
|
// `false`
|
|
245
|
-
default: search.disabled
|
|
271
|
+
default: search.disabled,
|
|
246
272
|
},
|
|
247
273
|
// 指定input样式
|
|
248
274
|
inputStyle: {
|
|
249
275
|
type: Object,
|
|
250
276
|
// `{}`
|
|
251
277
|
default() {
|
|
252
|
-
return search.inputStyle
|
|
253
|
-
}
|
|
278
|
+
return search.inputStyle;
|
|
279
|
+
},
|
|
254
280
|
},
|
|
255
281
|
// 导航栏高度,单位px
|
|
256
282
|
height: {
|
|
257
283
|
type: [String, Number],
|
|
258
284
|
// `58`
|
|
259
|
-
default: search.height
|
|
285
|
+
default: search.height,
|
|
260
286
|
},
|
|
261
287
|
// 输入文本颜色
|
|
262
288
|
color: {
|
|
263
289
|
type: String,
|
|
264
290
|
// `'#333333'`
|
|
265
|
-
default: search.color
|
|
266
|
-
}
|
|
291
|
+
default: search.color,
|
|
292
|
+
},
|
|
267
293
|
},
|
|
268
294
|
data() {
|
|
269
295
|
return {
|
|
270
|
-
focused: this.focus // input 是否已获取焦点
|
|
271
|
-
}
|
|
296
|
+
focused: this.focus, // input 是否已获取焦点
|
|
297
|
+
};
|
|
272
298
|
},
|
|
273
299
|
computed: {
|
|
300
|
+
isControlFocus() {
|
|
301
|
+
// #ifdef APP-PLUS
|
|
302
|
+
const info = uni.getSystemInfoSync();
|
|
303
|
+
return info.platform === "android";
|
|
304
|
+
// #endif
|
|
305
|
+
|
|
306
|
+
// #ifndef APP-PLUS
|
|
307
|
+
return false;
|
|
308
|
+
// #endif
|
|
309
|
+
},
|
|
274
310
|
getHeight() {
|
|
275
|
-
return this.$pi.common.addUnit(this.height)
|
|
311
|
+
return this.$pi.common.addUnit(this.height);
|
|
276
312
|
},
|
|
277
313
|
mergeInputStyle() {
|
|
278
314
|
return {
|
|
@@ -280,67 +316,67 @@ export default {
|
|
|
280
316
|
color: this.color,
|
|
281
317
|
background: this.background,
|
|
282
318
|
height: this.getHeight,
|
|
283
|
-
...this.inputStyle
|
|
284
|
-
}
|
|
319
|
+
...this.inputStyle,
|
|
320
|
+
};
|
|
285
321
|
},
|
|
286
322
|
IconStyle() {
|
|
287
323
|
return {
|
|
288
324
|
color: this.searchIconColor,
|
|
289
|
-
...this.searchIconStyle
|
|
290
|
-
}
|
|
291
|
-
}
|
|
325
|
+
...this.searchIconStyle,
|
|
326
|
+
};
|
|
327
|
+
},
|
|
292
328
|
},
|
|
293
329
|
watch: {
|
|
294
330
|
focus: {
|
|
295
331
|
deep: true,
|
|
296
332
|
immediate: true,
|
|
297
333
|
handler(value) {
|
|
298
|
-
this.focused = value
|
|
299
|
-
}
|
|
300
|
-
}
|
|
334
|
+
this.focused = value;
|
|
335
|
+
},
|
|
336
|
+
},
|
|
301
337
|
},
|
|
302
338
|
methods: {
|
|
303
339
|
handleInputChange(e) {
|
|
304
|
-
const value = e.detail.value
|
|
340
|
+
const value = e.detail.value;
|
|
305
341
|
// 输入框内容变化时触发
|
|
306
|
-
this.val = value
|
|
307
|
-
this.handleEmitChange()
|
|
342
|
+
this.val = value;
|
|
343
|
+
this.handleEmitChange();
|
|
308
344
|
},
|
|
309
345
|
handleInputBlur() {
|
|
310
|
-
this.focused = false
|
|
346
|
+
this.focused = false;
|
|
311
347
|
// 输入框失去焦点时触发
|
|
312
348
|
// @arg `event: Event`
|
|
313
|
-
this.$emit(
|
|
314
|
-
uni.hideKeyboard() // 收起键盘
|
|
349
|
+
this.$emit("blur", this.val);
|
|
350
|
+
uni.hideKeyboard(); // 收起键盘
|
|
315
351
|
},
|
|
316
352
|
handleInputSearch(e) {
|
|
317
353
|
// 确定搜索时触发
|
|
318
354
|
// @arg `value: string` (当前输入的值)
|
|
319
|
-
this.$emit(
|
|
320
|
-
uni.hideKeyboard() // 收起键盘
|
|
355
|
+
this.$emit("search", e.detail.value);
|
|
356
|
+
uni.hideKeyboard(); // 收起键盘
|
|
321
357
|
},
|
|
322
358
|
handleInputFocus() {
|
|
323
|
-
this.focused = true
|
|
359
|
+
this.focused = true;
|
|
324
360
|
// 输入框获得焦点时触发
|
|
325
361
|
// @arg `event: Event`
|
|
326
|
-
this.$emit(
|
|
362
|
+
this.$emit("focus", this.val);
|
|
327
363
|
},
|
|
328
364
|
handleClearInput() {
|
|
329
|
-
this.val =
|
|
330
|
-
this.handleEmitChange()
|
|
331
|
-
uni.hideKeyboard() // 收起键盘
|
|
365
|
+
this.val = "";
|
|
366
|
+
this.handleEmitChange();
|
|
367
|
+
uni.hideKeyboard(); // 收起键盘
|
|
332
368
|
this.$nextTick(() => {
|
|
333
369
|
// 延后发出事件,避免在父组件监听clear事件时,value为更新前的值(不为空)
|
|
334
370
|
// @arg `event: Event`
|
|
335
|
-
this.$emit(
|
|
336
|
-
})
|
|
371
|
+
this.$emit("clear", this.val);
|
|
372
|
+
});
|
|
337
373
|
},
|
|
338
374
|
handleActionClick() {
|
|
339
375
|
// 点击按钮时触发
|
|
340
|
-
this.$emit(
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
376
|
+
this.$emit("action", this.val);
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
};
|
|
344
380
|
</script>
|
|
345
381
|
|
|
346
382
|
<style lang="scss" scoped>
|