@tuya-miniapp/smart-ui 2.3.0-beta-5 → 2.3.0-beta-7
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.
- package/dist/common/appLog.d.ts +10 -0
- package/dist/common/appLog.js +105 -0
- package/dist/dialog/dialog.js +14 -1
- package/dist/dialog/index.js +5 -0
- package/dist/mixins/transition.js +13 -2
- package/dist/toast/index.js +4 -0
- package/dist/toast/toast.js +6 -0
- package/lib/common/appLog.d.ts +10 -0
- package/lib/common/appLog.js +112 -0
- package/lib/dialog/dialog.js +17 -1
- package/lib/dialog/index.js +5 -0
- package/lib/mixins/transition.js +16 -2
- package/lib/toast/index.js +7 -0
- package/lib/toast/toast.js +9 -0
- package/package.json +1 -1
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare const init: (tag: string) => any;
|
2
|
+
export declare const info: (data: any, devId?: string) => void;
|
3
|
+
export declare const warn: (data: any, devId?: string) => void;
|
4
|
+
export declare const error: (data: any, devId?: string) => void;
|
5
|
+
declare const _default: {
|
6
|
+
info: (data: any, devId?: string | undefined) => void;
|
7
|
+
warn: (data: any, devId?: string | undefined) => void;
|
8
|
+
error: (data: any, devId?: string | undefined) => void;
|
9
|
+
};
|
10
|
+
export default _default;
|
@@ -0,0 +1,105 @@
|
|
1
|
+
/* eslint-disable no-console */
|
2
|
+
const defaultTag = 'smart-ui-info';
|
3
|
+
let Log = null;
|
4
|
+
function isErrorMessage(obj) {
|
5
|
+
return obj instanceof Error;
|
6
|
+
}
|
7
|
+
export const init = (tag) => {
|
8
|
+
if (tag !== defaultTag && tag) {
|
9
|
+
Log = null;
|
10
|
+
}
|
11
|
+
if (Log) {
|
12
|
+
return Log;
|
13
|
+
}
|
14
|
+
// @ts-ignore
|
15
|
+
if (!ty.getLogManager) {
|
16
|
+
console.warn('不支持ty.getLogManager');
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
// @ts-ignore
|
20
|
+
Log = ty.getLogManager({
|
21
|
+
tag: tag || defaultTag,
|
22
|
+
});
|
23
|
+
return Log;
|
24
|
+
};
|
25
|
+
export const info = (data, devId) => {
|
26
|
+
if (!Log) {
|
27
|
+
const _log = init(devId || defaultTag);
|
28
|
+
if (!_log) {
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
if (typeof data !== 'string') {
|
33
|
+
// eslint-disable-next-line no-param-reassign
|
34
|
+
data = JSON.stringify(data);
|
35
|
+
}
|
36
|
+
Log.log({
|
37
|
+
message: data,
|
38
|
+
success(res) {
|
39
|
+
// console.log('success ty.Log', res);
|
40
|
+
},
|
41
|
+
failure(err) {
|
42
|
+
console.log('fail ty.Log', err);
|
43
|
+
},
|
44
|
+
});
|
45
|
+
};
|
46
|
+
export const warn = (data, devId) => {
|
47
|
+
if (!Log) {
|
48
|
+
const _log = init(devId || defaultTag);
|
49
|
+
if (!_log) {
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
if (typeof data !== 'string') {
|
54
|
+
// eslint-disable-next-line no-param-reassign
|
55
|
+
data = JSON.stringify(data);
|
56
|
+
}
|
57
|
+
Log.debug({
|
58
|
+
message: data,
|
59
|
+
success(res) {
|
60
|
+
console.log('success ty.debug', res);
|
61
|
+
},
|
62
|
+
failure(err) {
|
63
|
+
console.log('fail ty.debug', err);
|
64
|
+
},
|
65
|
+
});
|
66
|
+
};
|
67
|
+
export const error = (data, devId) => {
|
68
|
+
var _a, _b;
|
69
|
+
if (!Log) {
|
70
|
+
const _log = init(devId || defaultTag);
|
71
|
+
if (!_log) {
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
let _data = null;
|
76
|
+
const isError = isErrorMessage(data);
|
77
|
+
if (isError) {
|
78
|
+
_data = {
|
79
|
+
message: data.message,
|
80
|
+
stack: (_b = (_a = data.stack) === null || _a === void 0 ? void 0 : _a.slice(0, 200)) !== null && _b !== void 0 ? _b : [],
|
81
|
+
};
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
try {
|
85
|
+
_data = JSON.stringify(data);
|
86
|
+
}
|
87
|
+
catch (e) {
|
88
|
+
_data = e === null || e === void 0 ? void 0 : e.toString();
|
89
|
+
}
|
90
|
+
}
|
91
|
+
Log.error({
|
92
|
+
message: _data,
|
93
|
+
success(res) {
|
94
|
+
console.log('success ty.error', res);
|
95
|
+
},
|
96
|
+
failure(err) {
|
97
|
+
console.log('fail ty.error', err);
|
98
|
+
},
|
99
|
+
});
|
100
|
+
};
|
101
|
+
export default {
|
102
|
+
info,
|
103
|
+
warn,
|
104
|
+
error,
|
105
|
+
};
|
package/dist/dialog/dialog.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import appLog from '../common/appLog';
|
1
2
|
import { getCurrentPage } from '../common/utils';
|
2
3
|
const queueRef = {
|
3
4
|
value: [],
|
@@ -35,16 +36,21 @@ export const contextRef = {
|
|
35
36
|
};
|
36
37
|
const Dialog = (options) => {
|
37
38
|
options = Object.assign(Object.assign({}, currentOptions), options);
|
38
|
-
|
39
|
+
const prom = new Promise((resolve, reject) => {
|
40
|
+
appLog.info('start open dialog');
|
39
41
|
const context = (typeof options.context === 'function' ? options.context() : options.context) ||
|
40
42
|
contextRef.value[options.selector] ||
|
41
43
|
getCurrentPage();
|
42
44
|
const selector = options.selector;
|
45
|
+
appLog.info(`dialog selector: ${selector}`);
|
46
|
+
appLog.info(`queue : ${JSON.stringify(queueRef.value)}`);
|
43
47
|
const dialog = context.selectComponent(options.selector);
|
48
|
+
appLog.info(`dialog component ${dialog ? 'success' : 'fail'}`);
|
44
49
|
if (!options.ignoreQueue &&
|
45
50
|
queueRef.value.length > 0 &&
|
46
51
|
queueRef.value.find(item => dialog && item && item.id === dialog.id)) {
|
47
52
|
console.warn(`相同选择器的 Dialog 调用过于频繁,${dialog.id} 已忽略重复调用`);
|
53
|
+
appLog.info(`相同选择器的 Dialog 调用过于频繁,${dialog.id} 已忽略重复调用`);
|
48
54
|
return;
|
49
55
|
}
|
50
56
|
delete options.context;
|
@@ -60,16 +66,23 @@ const Dialog = (options) => {
|
|
60
66
|
*/
|
61
67
|
queueRef.value = queueRef.value.filter(item => item.id !== dialog.id);
|
62
68
|
action === 'confirm' ? resolve(instance) : reject(instance);
|
69
|
+
appLog.info(`dialog ${dialog.id} callback`);
|
63
70
|
} }, optionsWithInputValue));
|
64
71
|
wx.nextTick(() => {
|
72
|
+
appLog.info(`start open dialog ${dialog.id}`);
|
65
73
|
dialog.setData({ show: true });
|
66
74
|
});
|
67
75
|
queueRef.value.push(dialog);
|
68
76
|
}
|
69
77
|
else {
|
70
78
|
console.warn(`未找到 ${(selector !== null && selector !== void 0 ? selector : '#smart-dialog').replace('#', '')} 节点,请确认 selector 及 context 是否正确`);
|
79
|
+
appLog.info(`未找到 ${(selector !== null && selector !== void 0 ? selector : '#smart-dialog').replace('#', '')} 节点,请确认 selector 及 context 是否正确`);
|
71
80
|
}
|
72
81
|
});
|
82
|
+
prom.catch(err => {
|
83
|
+
console.log(err, '---Dialog-error');
|
84
|
+
});
|
85
|
+
return prom;
|
73
86
|
};
|
74
87
|
Dialog.alert = (options) => Dialog(options);
|
75
88
|
Dialog.confirm = (options) => Dialog(Object.assign({ showCancelButton: true }, options));
|
package/dist/dialog/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import warningIcon from '@tuya-miniapp/icons/dist/svg/Warning';
|
2
2
|
import { SmartComponent } from '../common/component';
|
3
3
|
import { button } from '../mixins/button';
|
4
|
+
import appLog from '../common/appLog';
|
4
5
|
import { getCurrentPage, toPromise } from '../common/utils';
|
5
6
|
import { contextRef } from './dialog';
|
6
7
|
SmartComponent({
|
@@ -97,13 +98,16 @@ SmartComponent({
|
|
97
98
|
return;
|
98
99
|
if (contextRef.value[`#${this.id}`]) {
|
99
100
|
console.error(`Dialog component #${this.id} repeated!`);
|
101
|
+
appLog.info(`Dialog component #${this.id} repeated!`);
|
100
102
|
}
|
101
103
|
contextRef.value[`#${this.id}`] = getCurrentPage();
|
104
|
+
appLog.info(`Dialog #${this.id} mounted`);
|
102
105
|
},
|
103
106
|
destroyed: function () {
|
104
107
|
if (!this.id)
|
105
108
|
return;
|
106
109
|
contextRef.value[`#${this.id}`] = null;
|
110
|
+
appLog.info(`dialog #${this.id} destroyed`);
|
107
111
|
},
|
108
112
|
methods: {
|
109
113
|
onConfirm() {
|
@@ -181,6 +185,7 @@ SmartComponent({
|
|
181
185
|
},
|
182
186
|
onAfterLeave() {
|
183
187
|
this.$emit('after-leave');
|
188
|
+
appLog.info(`dialog #${this.id} after-leave`);
|
184
189
|
const { callback, actionType } = this.data;
|
185
190
|
if (callback) {
|
186
191
|
callback(actionType, this);
|
@@ -1,4 +1,5 @@
|
|
1
1
|
// @ts-nocheck
|
2
|
+
import appLog from '../common/appLog';
|
2
3
|
import { requestAnimationFrame } from '../common/utils';
|
3
4
|
import { isObj } from '../common/validator';
|
4
5
|
const getClassNames = (name) => ({
|
@@ -39,6 +40,7 @@ export function transition(showDefaultValue) {
|
|
39
40
|
},
|
40
41
|
methods: {
|
41
42
|
observeShow(value, old) {
|
43
|
+
appLog.info(`transition component observeShow value: ${value};old: ${value}`);
|
42
44
|
if (value === old) {
|
43
45
|
return;
|
44
46
|
}
|
@@ -47,6 +49,7 @@ export function transition(showDefaultValue) {
|
|
47
49
|
enter() {
|
48
50
|
if (this.enterFinishedPromise)
|
49
51
|
return;
|
52
|
+
appLog.info(`transition component enter success`);
|
50
53
|
this.enterFinishedPromise = new Promise(resolve => {
|
51
54
|
const { duration, name } = this.data;
|
52
55
|
const classNames = getClassNames(name);
|
@@ -72,6 +75,7 @@ export function transition(showDefaultValue) {
|
|
72
75
|
return;
|
73
76
|
}
|
74
77
|
this.transitionEnded = false;
|
78
|
+
appLog.info(`transition component enter transitionEnded false`);
|
75
79
|
this.setData({ classes: classNames['enter-to'] });
|
76
80
|
resolve();
|
77
81
|
});
|
@@ -79,12 +83,14 @@ export function transition(showDefaultValue) {
|
|
79
83
|
});
|
80
84
|
this.enterFinishedPromise.catch(err => {
|
81
85
|
this.enterFinishedPromise = null;
|
82
|
-
|
86
|
+
appLog.info(err);
|
87
|
+
console.log(err, '---error-enter');
|
83
88
|
});
|
84
89
|
},
|
85
90
|
leave() {
|
86
91
|
if (!this.enterFinishedPromise)
|
87
92
|
return;
|
93
|
+
appLog.info(`transition component leave success`);
|
88
94
|
this.enterFinishedPromise
|
89
95
|
.then(() => {
|
90
96
|
if (!this.data.display) {
|
@@ -109,8 +115,10 @@ export function transition(showDefaultValue) {
|
|
109
115
|
return;
|
110
116
|
}
|
111
117
|
this.transitionEnded = false;
|
118
|
+
appLog.info(`transition component leave transitionEnded false`);
|
112
119
|
setTimeout(() => {
|
113
120
|
this.enterFinishedPromise = null;
|
121
|
+
appLog.info(`transition component enterFinishedPromise cleared`);
|
114
122
|
this.onTransitionEnd();
|
115
123
|
}, currentDuration);
|
116
124
|
this.setData({ classes: classNames['leave-to'] });
|
@@ -119,15 +127,18 @@ export function transition(showDefaultValue) {
|
|
119
127
|
})
|
120
128
|
.catch(err => {
|
121
129
|
this.enterFinishedPromise = null;
|
122
|
-
console.log(err, '---error');
|
130
|
+
console.log(err, '---error-leave');
|
123
131
|
});
|
124
132
|
},
|
125
133
|
onTransitionEnd() {
|
134
|
+
appLog.info(`transition component in transitionEnded ${this.transitionEnded}`);
|
126
135
|
if (this.transitionEnded) {
|
127
136
|
return;
|
128
137
|
}
|
129
138
|
this.transitionEnded = true;
|
139
|
+
appLog.info(`transition component in transitionEnded true`);
|
130
140
|
this.$emit(`after-${this.status}`);
|
141
|
+
appLog.info(`transition component onTransitionEnd ${this.status} success`);
|
131
142
|
const { show, display } = this.data;
|
132
143
|
if (!show && display) {
|
133
144
|
this.setData({ display: false });
|
package/dist/toast/index.js
CHANGED
@@ -2,6 +2,7 @@ import { Success, Alarm, Error } from './icons';
|
|
2
2
|
import { SmartComponent } from '../common/component';
|
3
3
|
import { contextRef } from './toast';
|
4
4
|
import { getCurrentPage } from '../common/utils';
|
5
|
+
import appLog from '../common/appLog';
|
5
6
|
SmartComponent({
|
6
7
|
props: {
|
7
8
|
show: Boolean,
|
@@ -38,13 +39,16 @@ SmartComponent({
|
|
38
39
|
return;
|
39
40
|
if (contextRef.value[`#${this.id}`]) {
|
40
41
|
console.error(`Toast component #${this.id} repeated!`);
|
42
|
+
appLog.info(`Toast component #${this.id} repeated!`);
|
41
43
|
}
|
42
44
|
contextRef.value[`#${this.id}`] = getCurrentPage();
|
45
|
+
appLog.info(`Toast #${this.id} mounted`);
|
43
46
|
},
|
44
47
|
destroyed: function () {
|
45
48
|
if (!this.id)
|
46
49
|
return;
|
47
50
|
contextRef.value[`#${this.id}`] = null;
|
51
|
+
appLog.info(`Toast #${this.id} destroyed`);
|
48
52
|
},
|
49
53
|
methods: {
|
50
54
|
// for prevent touchmove
|
package/dist/toast/toast.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import appLog from '../common/appLog';
|
1
2
|
import { getCurrentPage } from '../common/utils';
|
2
3
|
import { isObj } from '../common/validator';
|
3
4
|
const defaultOptions = {
|
@@ -27,12 +28,16 @@ export const contextRef = {
|
|
27
28
|
};
|
28
29
|
function Toast(toastOptions) {
|
29
30
|
const options = Object.assign(Object.assign({}, currentOptions), parseOptions(toastOptions));
|
31
|
+
appLog.info('start open Toast');
|
30
32
|
const context = (typeof options.context === 'function' ? options.context() : options.context) ||
|
31
33
|
contextRef.value[options.selector] ||
|
32
34
|
getCurrentPage();
|
33
35
|
const toast = context.selectComponent(options.selector);
|
36
|
+
appLog.info(`toast selector: ${options.selector}`);
|
37
|
+
appLog.info(`toast component ${toast ? 'success' : 'fail'}`);
|
34
38
|
if (!toast) {
|
35
39
|
console.warn(`未找到 ${options.selector || '#smart-toast'} 节点,请确认 selector 及 context 是否正确`);
|
40
|
+
appLog.info(`未找到 ${options.selector || '#smart-toast'} 节点,请确认 selector 及 context 是否正确`);
|
36
41
|
return;
|
37
42
|
}
|
38
43
|
delete options.context;
|
@@ -50,6 +55,7 @@ function Toast(toastOptions) {
|
|
50
55
|
toast.timer = setTimeout(() => {
|
51
56
|
toast.clear();
|
52
57
|
queueRef.value = queueRef.value.filter(item => item !== toast);
|
58
|
+
appLog.info(`toast ${options.selector} cleared`);
|
53
59
|
}, options.duration);
|
54
60
|
}
|
55
61
|
return toast;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare const init: (tag: string) => any;
|
2
|
+
export declare const info: (data: any, devId?: string) => void;
|
3
|
+
export declare const warn: (data: any, devId?: string) => void;
|
4
|
+
export declare const error: (data: any, devId?: string) => void;
|
5
|
+
declare const _default: {
|
6
|
+
info: (data: any, devId?: string | undefined) => void;
|
7
|
+
warn: (data: any, devId?: string | undefined) => void;
|
8
|
+
error: (data: any, devId?: string | undefined) => void;
|
9
|
+
};
|
10
|
+
export default _default;
|
@@ -0,0 +1,112 @@
|
|
1
|
+
"use strict";
|
2
|
+
/* eslint-disable no-console */
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.error = exports.warn = exports.info = exports.init = void 0;
|
5
|
+
var defaultTag = 'smart-ui-info';
|
6
|
+
var Log = null;
|
7
|
+
function isErrorMessage(obj) {
|
8
|
+
return obj instanceof Error;
|
9
|
+
}
|
10
|
+
var init = function (tag) {
|
11
|
+
if (tag !== defaultTag && tag) {
|
12
|
+
Log = null;
|
13
|
+
}
|
14
|
+
if (Log) {
|
15
|
+
return Log;
|
16
|
+
}
|
17
|
+
// @ts-ignore
|
18
|
+
if (!ty.getLogManager) {
|
19
|
+
console.warn('不支持ty.getLogManager');
|
20
|
+
return null;
|
21
|
+
}
|
22
|
+
// @ts-ignore
|
23
|
+
Log = ty.getLogManager({
|
24
|
+
tag: tag || defaultTag,
|
25
|
+
});
|
26
|
+
return Log;
|
27
|
+
};
|
28
|
+
exports.init = init;
|
29
|
+
var info = function (data, devId) {
|
30
|
+
if (!Log) {
|
31
|
+
var _log = (0, exports.init)(devId || defaultTag);
|
32
|
+
if (!_log) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
if (typeof data !== 'string') {
|
37
|
+
// eslint-disable-next-line no-param-reassign
|
38
|
+
data = JSON.stringify(data);
|
39
|
+
}
|
40
|
+
Log.log({
|
41
|
+
message: data,
|
42
|
+
success: function (res) {
|
43
|
+
// console.log('success ty.Log', res);
|
44
|
+
},
|
45
|
+
failure: function (err) {
|
46
|
+
console.log('fail ty.Log', err);
|
47
|
+
},
|
48
|
+
});
|
49
|
+
};
|
50
|
+
exports.info = info;
|
51
|
+
var warn = function (data, devId) {
|
52
|
+
if (!Log) {
|
53
|
+
var _log = (0, exports.init)(devId || defaultTag);
|
54
|
+
if (!_log) {
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
if (typeof data !== 'string') {
|
59
|
+
// eslint-disable-next-line no-param-reassign
|
60
|
+
data = JSON.stringify(data);
|
61
|
+
}
|
62
|
+
Log.debug({
|
63
|
+
message: data,
|
64
|
+
success: function (res) {
|
65
|
+
console.log('success ty.debug', res);
|
66
|
+
},
|
67
|
+
failure: function (err) {
|
68
|
+
console.log('fail ty.debug', err);
|
69
|
+
},
|
70
|
+
});
|
71
|
+
};
|
72
|
+
exports.warn = warn;
|
73
|
+
var error = function (data, devId) {
|
74
|
+
var _a, _b;
|
75
|
+
if (!Log) {
|
76
|
+
var _log = (0, exports.init)(devId || defaultTag);
|
77
|
+
if (!_log) {
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
var _data = null;
|
82
|
+
var isError = isErrorMessage(data);
|
83
|
+
if (isError) {
|
84
|
+
_data = {
|
85
|
+
message: data.message,
|
86
|
+
stack: (_b = (_a = data.stack) === null || _a === void 0 ? void 0 : _a.slice(0, 200)) !== null && _b !== void 0 ? _b : [],
|
87
|
+
};
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
try {
|
91
|
+
_data = JSON.stringify(data);
|
92
|
+
}
|
93
|
+
catch (e) {
|
94
|
+
_data = e === null || e === void 0 ? void 0 : e.toString();
|
95
|
+
}
|
96
|
+
}
|
97
|
+
Log.error({
|
98
|
+
message: _data,
|
99
|
+
success: function (res) {
|
100
|
+
console.log('success ty.error', res);
|
101
|
+
},
|
102
|
+
failure: function (err) {
|
103
|
+
console.log('fail ty.error', err);
|
104
|
+
},
|
105
|
+
});
|
106
|
+
};
|
107
|
+
exports.error = error;
|
108
|
+
exports.default = {
|
109
|
+
info: exports.info,
|
110
|
+
warn: exports.warn,
|
111
|
+
error: exports.error,
|
112
|
+
};
|
package/lib/dialog/dialog.js
CHANGED
@@ -10,8 +10,12 @@ var __assign = (this && this.__assign) || function () {
|
|
10
10
|
};
|
11
11
|
return __assign.apply(this, arguments);
|
12
12
|
};
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
+
};
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
14
17
|
exports.contextRef = void 0;
|
18
|
+
var appLog_1 = __importDefault(require("../common/appLog"));
|
15
19
|
var utils_1 = require("../common/utils");
|
16
20
|
var queueRef = {
|
17
21
|
value: [],
|
@@ -49,16 +53,21 @@ exports.contextRef = {
|
|
49
53
|
};
|
50
54
|
var Dialog = function (options) {
|
51
55
|
options = __assign(__assign({}, currentOptions), options);
|
52
|
-
|
56
|
+
var prom = new Promise(function (resolve, reject) {
|
57
|
+
appLog_1.default.info('start open dialog');
|
53
58
|
var context = (typeof options.context === 'function' ? options.context() : options.context) ||
|
54
59
|
exports.contextRef.value[options.selector] ||
|
55
60
|
(0, utils_1.getCurrentPage)();
|
56
61
|
var selector = options.selector;
|
62
|
+
appLog_1.default.info("dialog selector: ".concat(selector));
|
63
|
+
appLog_1.default.info("queue : ".concat(JSON.stringify(queueRef.value)));
|
57
64
|
var dialog = context.selectComponent(options.selector);
|
65
|
+
appLog_1.default.info("dialog component ".concat(dialog ? 'success' : 'fail'));
|
58
66
|
if (!options.ignoreQueue &&
|
59
67
|
queueRef.value.length > 0 &&
|
60
68
|
queueRef.value.find(function (item) { return dialog && item && item.id === dialog.id; })) {
|
61
69
|
console.warn("\u76F8\u540C\u9009\u62E9\u5668\u7684 Dialog \u8C03\u7528\u8FC7\u4E8E\u9891\u7E41\uFF0C".concat(dialog.id, " \u5DF2\u5FFD\u7565\u91CD\u590D\u8C03\u7528"));
|
70
|
+
appLog_1.default.info("\u76F8\u540C\u9009\u62E9\u5668\u7684 Dialog \u8C03\u7528\u8FC7\u4E8E\u9891\u7E41\uFF0C".concat(dialog.id, " \u5DF2\u5FFD\u7565\u91CD\u590D\u8C03\u7528"));
|
62
71
|
return;
|
63
72
|
}
|
64
73
|
delete options.context;
|
@@ -74,16 +83,23 @@ var Dialog = function (options) {
|
|
74
83
|
*/
|
75
84
|
queueRef.value = queueRef.value.filter(function (item) { return item.id !== dialog.id; });
|
76
85
|
action === 'confirm' ? resolve(instance) : reject(instance);
|
86
|
+
appLog_1.default.info("dialog ".concat(dialog.id, " callback"));
|
77
87
|
} }, optionsWithInputValue));
|
78
88
|
wx.nextTick(function () {
|
89
|
+
appLog_1.default.info("start open dialog ".concat(dialog.id));
|
79
90
|
dialog.setData({ show: true });
|
80
91
|
});
|
81
92
|
queueRef.value.push(dialog);
|
82
93
|
}
|
83
94
|
else {
|
84
95
|
console.warn("\u672A\u627E\u5230 ".concat((selector !== null && selector !== void 0 ? selector : '#smart-dialog').replace('#', ''), " \u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4 selector \u53CA context \u662F\u5426\u6B63\u786E"));
|
96
|
+
appLog_1.default.info("\u672A\u627E\u5230 ".concat((selector !== null && selector !== void 0 ? selector : '#smart-dialog').replace('#', ''), " \u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4 selector \u53CA context \u662F\u5426\u6B63\u786E"));
|
85
97
|
}
|
86
98
|
});
|
99
|
+
prom.catch(function (err) {
|
100
|
+
console.log(err, '---Dialog-error');
|
101
|
+
});
|
102
|
+
return prom;
|
87
103
|
};
|
88
104
|
Dialog.alert = function (options) { return Dialog(options); };
|
89
105
|
Dialog.confirm = function (options) {
|
package/lib/dialog/index.js
CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var Warning_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Warning"));
|
7
7
|
var component_1 = require("../common/component");
|
8
8
|
var button_1 = require("../mixins/button");
|
9
|
+
var appLog_1 = __importDefault(require("../common/appLog"));
|
9
10
|
var utils_1 = require("../common/utils");
|
10
11
|
var dialog_1 = require("./dialog");
|
11
12
|
(0, component_1.SmartComponent)({
|
@@ -102,13 +103,16 @@ var dialog_1 = require("./dialog");
|
|
102
103
|
return;
|
103
104
|
if (dialog_1.contextRef.value["#".concat(this.id)]) {
|
104
105
|
console.error("Dialog component #".concat(this.id, " repeated!"));
|
106
|
+
appLog_1.default.info("Dialog component #".concat(this.id, " repeated!"));
|
105
107
|
}
|
106
108
|
dialog_1.contextRef.value["#".concat(this.id)] = (0, utils_1.getCurrentPage)();
|
109
|
+
appLog_1.default.info("Dialog #".concat(this.id, " mounted"));
|
107
110
|
},
|
108
111
|
destroyed: function () {
|
109
112
|
if (!this.id)
|
110
113
|
return;
|
111
114
|
dialog_1.contextRef.value["#".concat(this.id)] = null;
|
115
|
+
appLog_1.default.info("dialog #".concat(this.id, " destroyed"));
|
112
116
|
},
|
113
117
|
methods: {
|
114
118
|
onConfirm: function () {
|
@@ -189,6 +193,7 @@ var dialog_1 = require("./dialog");
|
|
189
193
|
},
|
190
194
|
onAfterLeave: function () {
|
191
195
|
this.$emit('after-leave');
|
196
|
+
appLog_1.default.info("dialog #".concat(this.id, " after-leave"));
|
192
197
|
var _a = this.data, callback = _a.callback, actionType = _a.actionType;
|
193
198
|
if (callback) {
|
194
199
|
callback(actionType, this);
|
package/lib/mixins/transition.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.transition = void 0;
|
4
7
|
// @ts-nocheck
|
8
|
+
var appLog_1 = __importDefault(require("../common/appLog"));
|
5
9
|
var utils_1 = require("../common/utils");
|
6
10
|
var validator_1 = require("../common/validator");
|
7
11
|
var getClassNames = function (name) { return ({
|
@@ -42,6 +46,7 @@ function transition(showDefaultValue) {
|
|
42
46
|
},
|
43
47
|
methods: {
|
44
48
|
observeShow: function (value, old) {
|
49
|
+
appLog_1.default.info("transition component observeShow value: ".concat(value, ";old: ").concat(value));
|
45
50
|
if (value === old) {
|
46
51
|
return;
|
47
52
|
}
|
@@ -51,6 +56,7 @@ function transition(showDefaultValue) {
|
|
51
56
|
var _this = this;
|
52
57
|
if (this.enterFinishedPromise)
|
53
58
|
return;
|
59
|
+
appLog_1.default.info("transition component enter success");
|
54
60
|
this.enterFinishedPromise = new Promise(function (resolve) {
|
55
61
|
var _a = _this.data, duration = _a.duration, name = _a.name;
|
56
62
|
var classNames = getClassNames(name);
|
@@ -76,6 +82,7 @@ function transition(showDefaultValue) {
|
|
76
82
|
return;
|
77
83
|
}
|
78
84
|
_this.transitionEnded = false;
|
85
|
+
appLog_1.default.info("transition component enter transitionEnded false");
|
79
86
|
_this.setData({ classes: classNames['enter-to'] });
|
80
87
|
resolve();
|
81
88
|
});
|
@@ -83,13 +90,15 @@ function transition(showDefaultValue) {
|
|
83
90
|
});
|
84
91
|
this.enterFinishedPromise.catch(function (err) {
|
85
92
|
_this.enterFinishedPromise = null;
|
86
|
-
|
93
|
+
appLog_1.default.info(err);
|
94
|
+
console.log(err, '---error-enter');
|
87
95
|
});
|
88
96
|
},
|
89
97
|
leave: function () {
|
90
98
|
var _this = this;
|
91
99
|
if (!this.enterFinishedPromise)
|
92
100
|
return;
|
101
|
+
appLog_1.default.info("transition component leave success");
|
93
102
|
this.enterFinishedPromise
|
94
103
|
.then(function () {
|
95
104
|
if (!_this.data.display) {
|
@@ -114,8 +123,10 @@ function transition(showDefaultValue) {
|
|
114
123
|
return;
|
115
124
|
}
|
116
125
|
_this.transitionEnded = false;
|
126
|
+
appLog_1.default.info("transition component leave transitionEnded false");
|
117
127
|
setTimeout(function () {
|
118
128
|
_this.enterFinishedPromise = null;
|
129
|
+
appLog_1.default.info("transition component enterFinishedPromise cleared");
|
119
130
|
_this.onTransitionEnd();
|
120
131
|
}, currentDuration);
|
121
132
|
_this.setData({ classes: classNames['leave-to'] });
|
@@ -124,15 +135,18 @@ function transition(showDefaultValue) {
|
|
124
135
|
})
|
125
136
|
.catch(function (err) {
|
126
137
|
_this.enterFinishedPromise = null;
|
127
|
-
console.log(err, '---error');
|
138
|
+
console.log(err, '---error-leave');
|
128
139
|
});
|
129
140
|
},
|
130
141
|
onTransitionEnd: function () {
|
142
|
+
appLog_1.default.info("transition component in transitionEnded ".concat(this.transitionEnded));
|
131
143
|
if (this.transitionEnded) {
|
132
144
|
return;
|
133
145
|
}
|
134
146
|
this.transitionEnded = true;
|
147
|
+
appLog_1.default.info("transition component in transitionEnded true");
|
135
148
|
this.$emit("after-".concat(this.status));
|
149
|
+
appLog_1.default.info("transition component onTransitionEnd ".concat(this.status, " success"));
|
136
150
|
var _a = this.data, show = _a.show, display = _a.display;
|
137
151
|
if (!show && display) {
|
138
152
|
this.setData({ display: false });
|
package/lib/toast/index.js
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
var icons_1 = require("./icons");
|
4
7
|
var component_1 = require("../common/component");
|
5
8
|
var toast_1 = require("./toast");
|
6
9
|
var utils_1 = require("../common/utils");
|
10
|
+
var appLog_1 = __importDefault(require("../common/appLog"));
|
7
11
|
(0, component_1.SmartComponent)({
|
8
12
|
props: {
|
9
13
|
show: Boolean,
|
@@ -40,13 +44,16 @@ var utils_1 = require("../common/utils");
|
|
40
44
|
return;
|
41
45
|
if (toast_1.contextRef.value["#".concat(this.id)]) {
|
42
46
|
console.error("Toast component #".concat(this.id, " repeated!"));
|
47
|
+
appLog_1.default.info("Toast component #".concat(this.id, " repeated!"));
|
43
48
|
}
|
44
49
|
toast_1.contextRef.value["#".concat(this.id)] = (0, utils_1.getCurrentPage)();
|
50
|
+
appLog_1.default.info("Toast #".concat(this.id, " mounted"));
|
45
51
|
},
|
46
52
|
destroyed: function () {
|
47
53
|
if (!this.id)
|
48
54
|
return;
|
49
55
|
toast_1.contextRef.value["#".concat(this.id)] = null;
|
56
|
+
appLog_1.default.info("Toast #".concat(this.id, " destroyed"));
|
50
57
|
},
|
51
58
|
methods: {
|
52
59
|
// for prevent touchmove
|
package/lib/toast/toast.js
CHANGED
@@ -10,8 +10,12 @@ var __assign = (this && this.__assign) || function () {
|
|
10
10
|
};
|
11
11
|
return __assign.apply(this, arguments);
|
12
12
|
};
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
+
};
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
14
17
|
exports.contextRef = void 0;
|
18
|
+
var appLog_1 = __importDefault(require("../common/appLog"));
|
15
19
|
var utils_1 = require("../common/utils");
|
16
20
|
var validator_1 = require("../common/validator");
|
17
21
|
var defaultOptions = {
|
@@ -41,12 +45,16 @@ exports.contextRef = {
|
|
41
45
|
};
|
42
46
|
function Toast(toastOptions) {
|
43
47
|
var options = __assign(__assign({}, currentOptions), parseOptions(toastOptions));
|
48
|
+
appLog_1.default.info('start open Toast');
|
44
49
|
var context = (typeof options.context === 'function' ? options.context() : options.context) ||
|
45
50
|
exports.contextRef.value[options.selector] ||
|
46
51
|
(0, utils_1.getCurrentPage)();
|
47
52
|
var toast = context.selectComponent(options.selector);
|
53
|
+
appLog_1.default.info("toast selector: ".concat(options.selector));
|
54
|
+
appLog_1.default.info("toast component ".concat(toast ? 'success' : 'fail'));
|
48
55
|
if (!toast) {
|
49
56
|
console.warn("\u672A\u627E\u5230 ".concat(options.selector || '#smart-toast', " \u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4 selector \u53CA context \u662F\u5426\u6B63\u786E"));
|
57
|
+
appLog_1.default.info("\u672A\u627E\u5230 ".concat(options.selector || '#smart-toast', " \u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4 selector \u53CA context \u662F\u5426\u6B63\u786E"));
|
50
58
|
return;
|
51
59
|
}
|
52
60
|
delete options.context;
|
@@ -64,6 +72,7 @@ function Toast(toastOptions) {
|
|
64
72
|
toast.timer = setTimeout(function () {
|
65
73
|
toast.clear();
|
66
74
|
queueRef.value = queueRef.value.filter(function (item) { return item !== toast; });
|
75
|
+
appLog_1.default.info("toast ".concat(options.selector, " cleared"));
|
67
76
|
}, options.duration);
|
68
77
|
}
|
69
78
|
return toast;
|