@zscreate/zhxy-app-component 1.0.0

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.
Files changed (70) hide show
  1. package/components/dying318-picker/Demo.vue +342 -0
  2. package/components/dying318-picker/Picker.nvue +441 -0
  3. package/components/dying318-picker/Picker.vue +442 -0
  4. package/components/dying318-picker/Pickers.vue +321 -0
  5. package/components/dying318-picker/README.md +479 -0
  6. package/components/easydrag-sort/easydrag-sort.vue +248 -0
  7. package/components/evan-form/evan-form.vue +102 -0
  8. package/components/evan-form/utils.js +125 -0
  9. package/components/evan-form-item/evan-form-item.vue +1457 -0
  10. package/components/evan-form-item/mixins/computedMixin.js +44 -0
  11. package/components/evan-form-item/mixins/pubSubMixin.js +104 -0
  12. package/components/evan-form-item/mixins/validateByApiMinxins.js +21 -0
  13. package/components/evan-form-item/mixins/validateFormMixin.js +71 -0
  14. package/components/evan-form-item/mixins/valueChangeMixin.js +64 -0
  15. package/components/evan-form-item/modules/edit.png +0 -0
  16. package/components/evan-form-item/utilForForm.js +35 -0
  17. package/components/evan-form-item/utils.js +51 -0
  18. package/components/form-container/data.js +709 -0
  19. package/components/form-container/form-container.vue +897 -0
  20. package/components/jin-edit/jin-edit.vue +327 -0
  21. package/components/jin-edit/jin-icons.vue +48 -0
  22. package/components/jin-edit/readme.md +65 -0
  23. package/components/l-file/l-file.vue +260 -0
  24. package/components/lb-picker/index.vue +286 -0
  25. package/components/signatrue-write/signatrue-write.vue +220 -0
  26. package/components/t-color-picker/t-color-picker.vue +784 -0
  27. package/components/uni-datetime-picker/changelog.md +76 -0
  28. package/components/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue +182 -0
  29. package/components/uni-datetime-picker/components/uni-datetime-picker/calendar.js +546 -0
  30. package/components/uni-datetime-picker/components/uni-datetime-picker/calendar.vue +1024 -0
  31. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json +19 -0
  32. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js +8 -0
  33. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json +19 -0
  34. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json +19 -0
  35. package/components/uni-datetime-picker/components/uni-datetime-picker/keypress.js +45 -0
  36. package/components/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue +927 -0
  37. package/components/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue +966 -0
  38. package/components/uni-datetime-picker/components/uni-datetime-picker/util.js +437 -0
  39. package/components/uni-datetime-picker/components/uni-datetime-picker/year-mont-picker.vue +901 -0
  40. package/components/uni-datetime-picker/components/uni-datetime-picker/year-picker.vue +271 -0
  41. package/components/uni-datetime-picker/package.json +89 -0
  42. package/components/uni-datetime-picker/readme.md +159 -0
  43. package/components/uni-icons/icons.js +96 -0
  44. package/components/uni-icons/uni-icons.vue +57 -0
  45. package/components/uni-popup/message.js +29 -0
  46. package/components/uni-popup/popup.js +25 -0
  47. package/components/uni-popup/uni-popup-dialog.vue +243 -0
  48. package/components/uni-popup/uni-popup-message.vue +116 -0
  49. package/components/uni-popup/uni-popup-share.vue +165 -0
  50. package/components/uni-popup/uni-popup.vue +297 -0
  51. package/components/uni-rate/uni-rate.vue +140 -0
  52. package/components/uni-transition/uni-transition.vue +279 -0
  53. package/components/uploadFile/uploadFile.vue +124 -0
  54. package/components/viewcomponents/applicateGrid.vue +96 -0
  55. package/components/viewcomponents/card.vue +166 -0
  56. package/components/viewcomponents/formCard.vue +82 -0
  57. package/components/viewcomponents/infocell.vue +122 -0
  58. package/components/viewcomponents/navsearch.vue +59 -0
  59. package/components/viewcomponents/newscontent.vue +85 -0
  60. package/components/xp-picker/util.js +105 -0
  61. package/components/xp-picker/xp-picker.vue +330 -0
  62. package/index.js +9 -0
  63. package/package.json +29 -0
  64. package/static/iconfont.css +32 -0
  65. package/static/mttf.ttf +0 -0
  66. package/static/uni.ttf +0 -0
  67. package/utils/js-interp.js +6501 -0
  68. package/utils/js-interp.md +10 -0
  69. package/utils/moment.js +4601 -0
  70. package/utils/util.js +106 -0
@@ -0,0 +1,441 @@
1
+ <template>
2
+ <view>
3
+ <view @click="showPicker">
4
+ <slot></slot>
5
+ </view>
6
+ <view ref="picker" class="picker-pop" v-if="show" @touchmove="stopEvent">
7
+ <view class="picker-mask" @click="cancel" :style="{height: screenHeight}"></view>
8
+ <view class="picker-panel" :style="pickerPanelTranslate">
9
+ <view class="picker-action">
10
+ <text class="cancel" @click="cancel" :style="pickerStyle.cancel">取消</text>
11
+ <text class="confirm" @click="confirm" :style="pickerStyle.confirm">确定</text>
12
+ </view>
13
+ <view class="picker-content">
14
+ <view class="picker-column" v-for="(column, columnIndex) in columns" :key="columnIndex"
15
+ :style="pickerStyle.column[columnIndex]" :data-column="columnIndex"
16
+ @touchstart="touchstart" @touchmove="touchmove" @touchend="touchend">
17
+ <view class="scroll-wrapper">
18
+ <view class="scroll-list" :style="column.style">
19
+ <view class="picker-item" v-for="(data, itemIndex) in column.pickerList" :key="itemIndex">
20
+ <text class="picker-item-text">{{data[pickerKey.label]}}</text>
21
+ </view>
22
+ </view>
23
+ <view class="top-cover"></view>
24
+ <view class="top-cover-border"></view>
25
+ <view class="bottom-cover"></view>
26
+ <view class="bottom-cover-border"></view>
27
+ </view>
28
+ </view>
29
+ </view>
30
+ </view>
31
+ </view>
32
+ </view>
33
+ </template>
34
+
35
+ <script>
36
+ import navsearch from '../viewcomponents/navsearch.vue'
37
+ export default {
38
+ props: {
39
+ pickerList: {
40
+ value: Array,
41
+ require: true,
42
+ default() {
43
+ return []
44
+ }
45
+ },
46
+ pickerKey: {
47
+ value: Object,
48
+ default() {
49
+ return {
50
+ value: 'value',
51
+ label: 'label',
52
+ children: 'children'
53
+ }
54
+ }
55
+ },
56
+ pickerStyle: {
57
+ value: Object,
58
+ default() {
59
+ return {
60
+ cancel: {},
61
+ confirm: {},
62
+ column: []
63
+ }
64
+ }
65
+ },
66
+ defaultValue: {
67
+ value: Array,
68
+ default() {
69
+ return []
70
+ }
71
+ },
72
+ columnNum: {
73
+ value: Number,
74
+ default: 0
75
+ },
76
+ itemRotateDeg: {
77
+ value: Number,
78
+ default: 15
79
+ },
80
+ beforeSetColumn: {
81
+ value: Function,
82
+ default: null
83
+ },
84
+ speedUpRatio: {
85
+ value: Number,
86
+ default: 1
87
+ },
88
+ },
89
+ data() {
90
+ return {
91
+ show: false,
92
+ reactModel: true,
93
+ columns: [],
94
+ systemInfo: uni.getSystemInfoSync(),
95
+ startScrollTop: 0,
96
+ startPickedIndex: 0,
97
+ scrollingColumnIndex: 0,
98
+ }
99
+ },
100
+ components:{
101
+ navsearch
102
+ },
103
+ watch: {
104
+ pickerList() {
105
+ this.init()
106
+ },
107
+ defaultValue() {
108
+ this.init()
109
+ },
110
+ },
111
+ computed: {
112
+ pickerItemStyle() {
113
+ return function(pickedIndex, itemIndex) {
114
+ let distance = Math.abs(pickedIndex - itemIndex)
115
+ if (distance <= 3) {
116
+ return {
117
+ transform: 'rotateX(' + distance * this.itemRotateDeg + 'deg)'
118
+ }
119
+ } else {
120
+ return {}
121
+ }
122
+ }
123
+ },
124
+ screenHeight() {
125
+ return this.systemInfo.screenHeight
126
+ },
127
+ pickerItemHeight() {
128
+ return Math.floor(68 * this.systemInfo.windowWidth / 750)
129
+ },
130
+ pickerPanelTranslate() {
131
+ if (this.show) {
132
+ return {
133
+ transform: "translate(0, -" + this.systemInfo.windowBottom + ");"
134
+ }
135
+ } else {
136
+ return {
137
+ transform: "translate(0, 100%);"
138
+ }
139
+ }
140
+ }
141
+ },
142
+ mounted() {
143
+ },
144
+ methods: {
145
+ search(v){
146
+ console.log(v)
147
+ console.log('===')
148
+ },
149
+ stopEvent(event) {
150
+ event.stopPropagation()
151
+ },
152
+ init() {
153
+ if (Array.isArray(this.pickerList[0])) {
154
+ this.pickerList.forEach((pickerList, index) => {
155
+ this.setColumn(index, pickerList)
156
+ })
157
+ this.reactModel = false;
158
+ } else {
159
+ this.setColumn(0, this.pickerList)
160
+ }
161
+ },
162
+ showPicker(event) {
163
+ this.stopEvent(event)
164
+ this.init()
165
+ if (this.inited) {
166
+ this.show = true
167
+ } else {
168
+ // #ifdef H5
169
+ let $picker = this.$refs.picker
170
+ document.body.appendChild($picker)
171
+ // #endif
172
+ setTimeout(() => {
173
+ this.show = true
174
+ }, 20)
175
+ this.inited = true
176
+ }
177
+ this.$emit('click') // 传递click事件
178
+ },
179
+ confirm() {
180
+ let picked = {index: [], value: [], label: [], indexes: [],values: [], labels: []}
181
+ for (let column of this.columns) {
182
+ let columnPicked = this.columnPickedInfo(column)
183
+ if (columnPicked) {
184
+ picked.index = columnPicked.index
185
+ picked.value = columnPicked.value
186
+ picked.label = columnPicked.label
187
+
188
+ picked.indexes.push(columnPicked.index)
189
+ picked.values.push(columnPicked.value)
190
+ picked.labels.push(columnPicked.label)
191
+ } else {
192
+ picked.indexes.push(null)
193
+ picked.values.push(null)
194
+ picked.labels.push(null)
195
+ }
196
+ }
197
+ this.$emit('confirm', picked)
198
+ this.hide()
199
+ },
200
+ cancel() {
201
+ this.$emit('cancel')
202
+ this.hide()
203
+ },
204
+ hide() {
205
+ this.show = false
206
+ },
207
+ columnPickedInfo(column) {
208
+ if (column.pickerList.length < 1) {
209
+ return null
210
+ }
211
+ return {
212
+ index: column.pickedIndex,
213
+ value: column.pickerList[column.pickedIndex][this.pickerKey.value],
214
+ label: column.pickerList[column.pickedIndex][this.pickerKey.label],
215
+ }
216
+ },
217
+ touchstart(e) {
218
+ this.scrollingColumnIndex = e.target.dataset.column
219
+ this.startScrollTop = e.changedTouches[0].pageY
220
+ this.startPickedIndex = this.columns[this.scrollingColumnIndex].pickedIndex
221
+
222
+ this.columns[this.scrollingColumnIndex].scrollEventQueue = [{
223
+ index: this.startPickedIndex,
224
+ time: +new Date()
225
+ }]
226
+ },
227
+ touchmove(e) {
228
+ let scrollDistance = this.startScrollTop - e.changedTouches[0].pageY
229
+ let scrollIndex = Math.round(scrollDistance/this.pickerItemHeight)
230
+ let column = this.columns[this.scrollingColumnIndex]
231
+ let currentPickedIndex = column.pickedIndex
232
+ this.setColumnIndex(column, this.startPickedIndex + scrollIndex)
233
+ if (column.pickedIndex !== currentPickedIndex) {
234
+ this.scrollColumn(column, true)
235
+ }
236
+ },
237
+ touchend(e) {
238
+ let column = this.columns[this.scrollingColumnIndex]
239
+ this.scrollColumn(column, false, true)
240
+ },
241
+ setColumn(columnIndex, pickerList) {
242
+ if (columnIndex === 5 || (this.columnNum > 0 && columnIndex >= this.columnNum)) {
243
+ // limit max 5 columns
244
+ return
245
+ }
246
+ let columnPickerList = pickerList || []
247
+ if (this.beforeSetColumn) {
248
+ // 在开始渲染列之前使用钩子动态修改pickerList,注意避免对pickerList修改以保证渲染不污染源数据
249
+ columnPickerList = this.beforeSetColumn(columnIndex, columnPickerList)
250
+ }
251
+ if (columnPickerList.length < 1) {
252
+ if (this.columnNum === 0) {
253
+ // 动态列数,当前列为空,清除后面全部列
254
+ this.columns = this.columns.filter(column => {
255
+ return column.index < columnIndex
256
+ })
257
+ return
258
+ } else if (columnIndex < this.columnNum) {
259
+ // 固定列数,清除下一列,递归清除后面全部列
260
+ this.setColumn(columnIndex + 1, [])
261
+ } else {
262
+ return
263
+ }
264
+ }
265
+
266
+ let currentColumn = this.columns[columnIndex] || {}
267
+ let column = {
268
+ index: columnIndex,
269
+ scrollEventQueue: [],
270
+ pickerList: columnPickerList,
271
+ pickedIndex: 0,
272
+ style: {
273
+ "transition-property": "transform",
274
+ "transition-duration": "200",
275
+ "transform": "translateY(0)"
276
+ }
277
+ }
278
+ this.setColumnIndex(column, currentColumn.pickedIndex || 0) // 使得column的index维持在当前选择位置
279
+ let defaultValue = this.defaultValue && this.defaultValue[columnIndex] !== false ? this.defaultValue[columnIndex] : false
280
+ if (currentColumn.pickedIndex === undefined && defaultValue !== false) {
281
+ column.pickerList.map((pickerItem, index) => {
282
+ if (pickerItem[this.pickerKey.value] == defaultValue) {
283
+ column.pickedIndex = index
284
+ }
285
+ })
286
+ }
287
+
288
+ this.scrollColumn(column)
289
+ this.$set(this.columns, columnIndex, column)
290
+ },
291
+ setColumnIndex(column, index) {
292
+ index = index < 0 ? 0 : index
293
+ column.pickedIndex = Math.min(index, column.pickerList.length - 1)
294
+ },
295
+ scrollColumn(column, needThrottle = false, needSpeedUp = false) {
296
+ let now = +new Date()
297
+ let lastScrollEvent = column.scrollEventQueue[column.scrollEventQueue.length-1]
298
+ if (needThrottle && lastScrollEvent.time && now < (lastScrollEvent.time + 100)) {
299
+ return
300
+ }
301
+ let speedUpIndex = 0
302
+ if (needSpeedUp && this.speedUpRatio) {
303
+ // 模拟惯性效果,在touch事件接触后,根据最后两次滚动事件的速度生成滑动的距离。在touch过程中,保持触摸距离和滚动距离的一致
304
+ if (column.scrollEventQueue.length > 1) {
305
+ lastScrollEvent = column.scrollEventQueue[column.scrollEventQueue.length-2]
306
+ }
307
+ let speed = (column.pickedIndex - lastScrollEvent.index) / (now - lastScrollEvent.time)
308
+ speedUpIndex = Math.floor(Math.pow(speed, 2) * 800 * this.speedUpRatio) // 使用二次方曲线放大加速效果,其中效果800为默认调试参数
309
+ speedUpIndex = speed > 0 ? speedUpIndex : -speedUpIndex;
310
+ this.setColumnIndex(column, column.pickedIndex + speedUpIndex)
311
+ }
312
+
313
+ column.scrollEventQueue.push({
314
+ index: column.pickedIndex,
315
+ time: now
316
+ })
317
+
318
+ let translateY = column.pickedIndex * this.pickerItemHeight
319
+ column.style = {
320
+ "transition-property": "transform",
321
+ "transition-duration": "200",
322
+ "transform": "translateY(" + -translateY + ")"
323
+ }
324
+
325
+ if (this.reactModel && column.pickerList[column.pickedIndex]) {
326
+ this.setColumn(column.index + 1, column.pickerList[column.pickedIndex][this.pickerKey.children])
327
+ }
328
+
329
+ this.$emit('change', column.index, this.columnPickedInfo(column))
330
+ }
331
+ },
332
+ };
333
+ </script>
334
+
335
+ <style lang="scss" scoped>
336
+ .picker-mask {
337
+ position: fixed;
338
+ top: 0;
339
+ left: 0;
340
+ right: 0;
341
+ bottom: 0;
342
+ z-index: 999;
343
+ width: 750r
344
+ px;
345
+ background-color: rgba(0, 0, 0, .6);
346
+ }
347
+
348
+ .picker-panel {
349
+ position: fixed;
350
+ bottom: 0;
351
+ left: 0;
352
+ width: 750rpx;
353
+ background-color: #fff;
354
+ transform: translate(0, 100%);
355
+ transition: transform .3s;
356
+ flex-direction: column;
357
+ }
358
+ .picker-action {
359
+ width: 750rpx;
360
+ height: 96rpx;
361
+ position: relative;
362
+ justify-content: space-between;
363
+ }
364
+ .confirm, .cancel {
365
+ padding: 30rpx;
366
+ font-size: 36rpx;
367
+ }
368
+ .confirm {
369
+ color: #007aff;
370
+ }
371
+
372
+ .picker-content {
373
+ width: 750rpx;
374
+ height: 476rpx;
375
+ overflow: hidden;
376
+ position: relative;
377
+ }
378
+ .picker-column {
379
+ flex: 1;
380
+ font-size: 32rpx;
381
+ overflow: hidden;
382
+ flex-direction: column;
383
+ }
384
+
385
+ .scroll-wrapper {
386
+ position: relative;
387
+ height: 476rpx;
388
+ flex-direction: column;
389
+ }
390
+ .top-cover, .bottom-cover {
391
+ width: 750rpx;
392
+ height: 204rpx;
393
+ position: absolute;
394
+
395
+ transform: translateZ(0);
396
+ background-image: linear-gradient(to top,rgba(245, 245, 245, .2),rgba(245, 245, 245, .9));
397
+ }
398
+ .top-cover {
399
+ top: 0;
400
+ }
401
+ .bottom-cover {
402
+ bottom: 0;
403
+ background-image: linear-gradient(to bottom,rgba(245, 245, 245,.2),rgba(245, 245, 245, .9));
404
+ }
405
+ .top-cover-border, .bottom-cover-border {
406
+ position: absolute;
407
+ width: 750rpx;
408
+ height: 1px;
409
+ border-color: #ccc;
410
+ border-style: solid;
411
+ }
412
+ .top-cover-border {
413
+ top: 204rpx;
414
+ border-bottom-width: .5px;
415
+ }
416
+ .bottom-cover-border {
417
+ bottom: 204rpx;
418
+ border-top-width: .5px;
419
+ }
420
+ .scroll-list {
421
+ padding: 204rpx 0;
422
+ flex-direction: column;
423
+ overflow: hidden;
424
+ }
425
+ .picker-item {
426
+ justify-content: center;
427
+ align-items: center;
428
+ height: 68rpx;
429
+ }
430
+ .picker-item-text {
431
+ flex: 1;
432
+ lines: 1;
433
+ text-overflow: ellipsis;
434
+ /*无法给text设定宽度,此处无效 */
435
+ padding: 10rpx;
436
+ text-align: center;
437
+ font-size: 32rpx;
438
+ color: #333;
439
+
440
+ }
441
+ </style>