@dcloudio/uni-components 3.0.0-4010420240430002 → 3.0.0-4020320240708001
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.
|
@@ -208,7 +208,10 @@ export const mixinDatacom = defineMixin({
|
|
|
208
208
|
}).catch((err : any | null) => {
|
|
209
209
|
this.mixinDatacomError = err as UniCloudError
|
|
210
210
|
options?.fail?.(err)
|
|
211
|
-
}).
|
|
211
|
+
}).then(() => {
|
|
212
|
+
this.mixinDatacomLoading = false
|
|
213
|
+
options?.complete?.()
|
|
214
|
+
}, () => {
|
|
212
215
|
this.mixinDatacomLoading = false
|
|
213
216
|
options?.complete?.()
|
|
214
217
|
})
|
|
@@ -110,7 +110,8 @@
|
|
|
110
110
|
}
|
|
111
111
|
//#endif
|
|
112
112
|
//#ifdef WEB || APP-IOS
|
|
113
|
-
|
|
113
|
+
const RealUniElementImpl = typeof UniElementImpl === 'undefined' ? class {} : UniElementImpl
|
|
114
|
+
export class UniCloudDBElement extends RealUniElementImpl {
|
|
114
115
|
constructor(data : INodeData, pageNode : PageNode) {
|
|
115
116
|
super(data, pageNode);
|
|
116
117
|
const TagName = 'UNICLOUD-DB';
|
|
@@ -189,7 +190,7 @@
|
|
|
189
190
|
} as UniCloudDBComponentUpdateOptions)
|
|
190
191
|
}
|
|
191
192
|
|
|
192
|
-
onLoadData! : (_ : UniCloudDBComponentLoadDataOptions) => void
|
|
193
|
+
onLoadData! : (_ : UniCloudDBComponentLoadDataOptions) => Promise<void>
|
|
193
194
|
onLoadMore! : () => void
|
|
194
195
|
onAdd! : (value : UTSJSONObject, options : UniCloudDBComponentAddOptions) => void
|
|
195
196
|
onUpdate!: (id : string, value : UTSJSONObject, options : UniCloudDBComponentUpdateOptions) => void
|
|
@@ -287,11 +288,23 @@
|
|
|
287
288
|
manual: {
|
|
288
289
|
type: Boolean,
|
|
289
290
|
default: false
|
|
291
|
+
},
|
|
292
|
+
ssrKey: {
|
|
293
|
+
type: String,
|
|
294
|
+
default: ""
|
|
290
295
|
}
|
|
291
296
|
},
|
|
292
297
|
data() {
|
|
293
298
|
return {
|
|
299
|
+
//#ifdef WEB
|
|
300
|
+
// TODO 修复类型错误
|
|
301
|
+
// @ts-ignore
|
|
302
|
+
dataList: ssrRef([] as Array<UTSJSONObject>) as Array<UTSJSONObject>,
|
|
303
|
+
//#endif
|
|
304
|
+
//#ifndef WEB
|
|
294
305
|
dataList: [] as Array<UTSJSONObject>,
|
|
306
|
+
//#endif
|
|
307
|
+
// dataList: [] as Array<UTSJSONObject>,
|
|
295
308
|
loading: false,
|
|
296
309
|
hasMore: false,
|
|
297
310
|
isEnded: false,
|
|
@@ -308,13 +321,22 @@
|
|
|
308
321
|
if (!registerFlag) {
|
|
309
322
|
registerFlag = true
|
|
310
323
|
// @ts-ignore
|
|
311
|
-
customElements.define(
|
|
324
|
+
typeof customElements !== 'undefined' && customElements.define(
|
|
312
325
|
'uni-cloud-db-element',
|
|
313
326
|
UniCloudDBElement,
|
|
314
327
|
)
|
|
315
328
|
}
|
|
316
329
|
},
|
|
317
330
|
//#endif
|
|
331
|
+
//#ifdef WEB
|
|
332
|
+
async serverPrefetch() : Promise<any> {
|
|
333
|
+
// @ts-ignore
|
|
334
|
+
if (!this.manual && this.loadtime === 'auto') {
|
|
335
|
+
// @ts-ignore
|
|
336
|
+
return this.loadData({})
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
//#endif
|
|
318
340
|
created() {
|
|
319
341
|
this.pagination.current = this.pageCurrent
|
|
320
342
|
this.pagination.size = this.pageSize
|
|
@@ -358,7 +380,7 @@
|
|
|
358
380
|
}
|
|
359
381
|
)
|
|
360
382
|
|
|
361
|
-
if (!this.manual && this.loadtime == LOAD_MODE_AUTO) {
|
|
383
|
+
if (!this.manual && this.loadtime == LOAD_MODE_AUTO && this.dataList.length == 0) {
|
|
362
384
|
if (typeof this.collection == 'string') {
|
|
363
385
|
const collectionString = this.collection as string
|
|
364
386
|
if (collectionString.length == 0) {
|
|
@@ -393,7 +415,7 @@
|
|
|
393
415
|
//#endif
|
|
394
416
|
},
|
|
395
417
|
methods: {
|
|
396
|
-
loadData(options : UniCloudDBComponentLoadDataOptions) {
|
|
418
|
+
async loadData(options : UniCloudDBComponentLoadDataOptions) : Promise<void> {
|
|
397
419
|
let clear = (options.clear != null && options.clear == true)
|
|
398
420
|
if (clear == true) {
|
|
399
421
|
if (this.pageData == PAGE_MODE_REPLACE) {
|
|
@@ -402,7 +424,7 @@
|
|
|
402
424
|
this.reset()
|
|
403
425
|
}
|
|
404
426
|
|
|
405
|
-
this.get(options)
|
|
427
|
+
await this.get(options)
|
|
406
428
|
},
|
|
407
429
|
loadMore() {
|
|
408
430
|
if (this.isEnded || this.loading) {
|
|
@@ -426,7 +448,7 @@
|
|
|
426
448
|
reset() {
|
|
427
449
|
this.pagination.current = 1
|
|
428
450
|
},
|
|
429
|
-
get(options? : UniCloudDBComponentLoadDataOptions) {
|
|
451
|
+
async get(options? : UniCloudDBComponentLoadDataOptions) : Promise<void> {
|
|
430
452
|
let loadAfterClear = false
|
|
431
453
|
if (options != null && options.clear != null && options.clear == true) {
|
|
432
454
|
loadAfterClear = true
|
|
@@ -438,7 +460,7 @@
|
|
|
438
460
|
this.error = null
|
|
439
461
|
|
|
440
462
|
this.loading = true
|
|
441
|
-
this.getExec().then((res : UniCloudDBGetResult) => {
|
|
463
|
+
await this.getExec().then((res : UniCloudDBGetResult) => {
|
|
442
464
|
const data = res.data
|
|
443
465
|
const count = res.count
|
|
444
466
|
|
|
@@ -461,7 +483,10 @@
|
|
|
461
483
|
}).catch((err : any | null) => {
|
|
462
484
|
this._requestFail(err, null)
|
|
463
485
|
options?.fail?.(err)
|
|
464
|
-
}).
|
|
486
|
+
}).then(() => {
|
|
487
|
+
this.loading = false
|
|
488
|
+
options?.complete?.()
|
|
489
|
+
}, () => {
|
|
465
490
|
this.loading = false
|
|
466
491
|
options?.complete?.()
|
|
467
492
|
})
|
|
@@ -474,7 +499,9 @@
|
|
|
474
499
|
this._isShowToast(options.showToast ?? false, options.toastTitle ?? 'add success')
|
|
475
500
|
}).catch((err) => {
|
|
476
501
|
this._requestFail(err, options.fail)
|
|
477
|
-
}).
|
|
502
|
+
}).then(() => {
|
|
503
|
+
this._requestComplete(options.complete, options.needLoading)
|
|
504
|
+
}, () => {
|
|
478
505
|
this._requestComplete(options.complete, options.needLoading)
|
|
479
506
|
})
|
|
480
507
|
},
|
|
@@ -519,7 +546,9 @@
|
|
|
519
546
|
this._isShowToast(options.showToast ?? false, options.toastTitle ?? 'update success')
|
|
520
547
|
}).catch((err : any | null) => {
|
|
521
548
|
this._requestFail(err, options.fail)
|
|
522
|
-
}).
|
|
549
|
+
}).then(() => {
|
|
550
|
+
this._requestComplete(options.complete, options.needLoading)
|
|
551
|
+
}, () => {
|
|
523
552
|
this._requestComplete(options.complete, options.needLoading)
|
|
524
553
|
})
|
|
525
554
|
},
|
|
@@ -538,7 +567,9 @@
|
|
|
538
567
|
}
|
|
539
568
|
}).catch((err : any | null) => {
|
|
540
569
|
this._requestFail(err, options.fail)
|
|
541
|
-
}).
|
|
570
|
+
}).then(() => {
|
|
571
|
+
this._requestComplete(options.complete, options.needLoading)
|
|
572
|
+
}, () => {
|
|
542
573
|
this._requestComplete(options.complete, options.needLoading)
|
|
543
574
|
})
|
|
544
575
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-components",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-4020320240708001",
|
|
4
4
|
"description": "@dcloudio/uni-components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
},
|
|
21
21
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dcloudio/uni-cloud": "3.0.0-
|
|
24
|
-
"@dcloudio/uni-h5": "3.0.0-
|
|
25
|
-
"@dcloudio/uni-i18n": "3.0.0-
|
|
23
|
+
"@dcloudio/uni-cloud": "3.0.0-4020320240708001",
|
|
24
|
+
"@dcloudio/uni-h5": "3.0.0-4020320240708001",
|
|
25
|
+
"@dcloudio/uni-i18n": "3.0.0-4020320240708001"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@dcloudio/uni-shared": "3.0.0-
|
|
28
|
+
"@dcloudio/uni-shared": "3.0.0-4020320240708001",
|
|
29
29
|
"@types/quill": "1.3.10"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/style-x/switch.css
CHANGED
|
@@ -36,29 +36,24 @@ uni-switch[disabled] .uni-switch-input {
|
|
|
36
36
|
transition: background-color 0.1s, border 0.1s;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.uni-switch-input:after {
|
|
40
|
-
content: ' ';
|
|
41
|
-
position: absolute;
|
|
42
|
-
top: 0;
|
|
43
|
-
left: 0;
|
|
44
|
-
width: 28px;
|
|
45
|
-
height: 28px;
|
|
46
|
-
border-radius: 15px;
|
|
47
|
-
background-color: #ffffff;
|
|
48
|
-
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.06);
|
|
49
|
-
transition: transform 0.3s;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
39
|
.uni-switch-input.uni-switch-input-checked {
|
|
53
40
|
border-color: #007aff;
|
|
54
41
|
background-color: #007aff;
|
|
55
42
|
}
|
|
56
43
|
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
uni-switch .uni-switch-thumb {
|
|
45
|
+
width: 28px;
|
|
46
|
+
height: 28px;
|
|
47
|
+
background-color: #fff;
|
|
48
|
+
border-radius: 15px;
|
|
49
|
+
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.06);
|
|
50
|
+
transition-duration: 0.3s;
|
|
51
|
+
transition-property: transform;
|
|
52
|
+
transform: translateX(0px);
|
|
53
|
+
overflow: visible;
|
|
59
54
|
}
|
|
60
55
|
|
|
61
|
-
|
|
56
|
+
uni-switch .uni-switch-thumb-checked {
|
|
62
57
|
transform: translateX(20px);
|
|
63
58
|
}
|
|
64
59
|
|