@tuya-miniapp/smart-ui 2.3.0-beta-8 → 2.3.0-beta-10

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.
@@ -11,13 +11,12 @@ function percentToDecimal(percent) {
11
11
  percent = percent.replace('%', '');
12
12
  return percent / 100;
13
13
  }
14
+ var idListRef = {
15
+ value: [],
16
+ };
14
17
  (0, component_1.SmartComponent)({
15
18
  props: {
16
19
  className: String,
17
- canvasId: {
18
- type: String,
19
- value: 'circle_' + Date.now(),
20
- },
21
20
  customStyle: String,
22
21
  size: {
23
22
  type: String,
@@ -46,7 +45,9 @@ function percentToDecimal(percent) {
46
45
  type: Number,
47
46
  value: 0,
48
47
  observer: function (val) {
49
- this.render(val);
48
+ if (this.data.canvasId) {
49
+ this.render(val, this.data.canvasId);
50
+ }
50
51
  },
51
52
  },
52
53
  mode: {
@@ -59,7 +60,46 @@ function percentToDecimal(percent) {
59
60
  value: true,
60
61
  },
61
62
  },
63
+ data: {
64
+ canvasId: '',
65
+ dpr: 1,
66
+ },
67
+ created: function () {
68
+ this.initId();
69
+ this.initRate();
70
+ },
71
+ mounted: function () {
72
+ this.render(this.data.percent, this.data.canvasId);
73
+ },
74
+ destroyed: function () {
75
+ var _this = this;
76
+ idListRef.value = idListRef.value.filter(function (id) { return id !== _this.data.canvasId; });
77
+ },
62
78
  methods: {
79
+ initId: function () {
80
+ if (this.data.canvasId)
81
+ return;
82
+ var id = "smart-ui-circle_".concat(String(+new Date()).slice(-4), "_").concat(String(Math.random()).slice(-2));
83
+ if (idListRef.value.includes(id)) {
84
+ this.initId();
85
+ return;
86
+ }
87
+ this.setData({
88
+ canvasId: id,
89
+ });
90
+ idListRef.value.push(id);
91
+ },
92
+ initRate: function () {
93
+ var _this = this;
94
+ wx.getSystemInfo({
95
+ success: function (res) {
96
+ var dpr = res.pixelRatio; // 获取设备像素比
97
+ _this.setData({
98
+ dpr: dpr,
99
+ });
100
+ },
101
+ });
102
+ },
63
103
  renderAll: function (canvas, ctx, progress, ops) {
64
104
  if (ops === void 0) { ops = {
65
105
  lineCap: 'round',
@@ -100,6 +140,7 @@ function percentToDecimal(percent) {
100
140
  }
101
141
  ctx.setLineCap(ops.lineCap); // 设置圆角效果
102
142
  ctx.stroke();
143
+ ctx.scale(canvas.dpr, canvas.dpr);
103
144
  ctx.draw();
104
145
  }
105
146
  // 示例:绘制不同的进度条
@@ -145,6 +186,7 @@ function percentToDecimal(percent) {
145
186
  }
146
187
  ctx.setLineCap(ops.lineCap); // 设置圆角效果
147
188
  ctx.stroke();
189
+ ctx.scale(canvas.dpr, canvas.dpr);
148
190
  ctx.draw();
149
191
  }
150
192
  // 示例:绘制不同的进度条
@@ -201,24 +243,29 @@ function percentToDecimal(percent) {
201
243
  }
202
244
  ctx.setLineCap(ops.lineCap); // 设置圆角效果
203
245
  ctx.stroke();
246
+ ctx.scale(canvas.dpr, canvas.dpr);
204
247
  ctx.draw();
205
248
  }
206
249
  // 示例:绘制不同的进度条
207
250
  drawProgressBar(progress, canvas.fillColor); // 25%的蓝色进度条
208
251
  },
209
- render: function (val) {
252
+ render: function (val, canvasId) {
210
253
  // @ts-ignore
211
- var context = ty.createCanvasContext(this.data.canvasId);
254
+ var context = ty.createCanvasContext(canvasId);
212
255
  var sizeVal = this.parseSize();
213
256
  var params = {
214
- width: sizeVal,
215
- height: sizeVal,
257
+ canvasWidth: +sizeVal,
258
+ canvasHeight: +sizeVal,
259
+ width: +sizeVal,
260
+ height: +sizeVal,
216
261
  lineWidth: this.data.trackWidth,
217
262
  trackColor: this.data.trackColor,
218
263
  fillColor: this.data.fillColor,
219
264
  fillColorStops: this.data.fillColorStops,
220
265
  maskColor: this.data.maskColor,
266
+ dpr: this.data.dpr,
221
267
  };
268
+ this.setData(params);
222
269
  if (this.data.mode === 'basic') {
223
270
  this.renderAll(params, context, val / 100, this.data.round ? { lineCap: 'round' } : { lineCap: '' });
224
271
  }
@@ -1 +1,9 @@
1
- <canvas class="smart-progress-circle" type="2d" canvas-id="{{canvasId}}" style="width: {{size}}; height:{{size}};"></canvas>
1
+ <canvas
2
+ class="smart-progress-circle"
3
+ type="2d"
4
+ wx:if="{{canvasId}}"
5
+ width="{{ canvasWidth * dpr }}"
6
+ height="{{ canvasHeight * dpr }}"
7
+ canvas-id="{{canvasId}}"
8
+ style="width: {{width}}px; height:{{height}}px;"
9
+ ></canvas>
@@ -16,7 +16,7 @@ var init = function (tag) {
16
16
  }
17
17
  // @ts-ignore
18
18
  if (!ty.getLogManager) {
19
- console.warn('不支持ty.getLogManager');
19
+ // console.warn('不支持ty.getLogManager');
20
20
  return null;
21
21
  }
22
22
  // @ts-ignore
@@ -43,7 +43,7 @@ var info = function (data, devId) {
43
43
  // console.log('success ty.Log', res);
44
44
  },
45
45
  failure: function (err) {
46
- console.log('fail ty.Log', err);
46
+ // console.log('fail ty.Log', err);
47
47
  },
48
48
  });
49
49
  };
@@ -62,10 +62,10 @@ var warn = function (data, devId) {
62
62
  Log.debug({
63
63
  message: data,
64
64
  success: function (res) {
65
- console.log('success ty.debug', res);
65
+ // console.log('success ty.debug', res);
66
66
  },
67
67
  failure: function (err) {
68
- console.log('fail ty.debug', err);
68
+ // console.log('fail ty.debug', err);
69
69
  },
70
70
  });
71
71
  };
@@ -97,10 +97,10 @@ var error = function (data, devId) {
97
97
  Log.error({
98
98
  message: _data,
99
99
  success: function (res) {
100
- console.log('success ty.error', res);
100
+ // console.log('success ty.error', res);
101
101
  },
102
102
  failure: function (err) {
103
- console.log('fail ty.error', err);
103
+ // console.log('fail ty.error', err);
104
104
  },
105
105
  });
106
106
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /// <reference types="miniprogram-api-typings" />
3
2
  /// <reference types="miniprogram-api-typings" />
4
3
  /// <reference types="miniprogram-api-typings" />
@@ -8,7 +7,7 @@ export { getSystemInfoSync } from './version';
8
7
  export declare function range(num: number, min: number, max: number): number;
9
8
  export declare function nextTick(cb: (...args: any[]) => void): void;
10
9
  export declare function addUnit(value?: string | number): string | undefined;
11
- export declare function requestAnimationFrame(cb: () => void): NodeJS.Timeout;
10
+ export declare function requestAnimationFrame(cb?: () => void): Promise<void>;
12
11
  export declare function pickExclude(obj: unknown, keys: string[]): {};
13
12
  export declare function getRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult>;
14
13
  export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>;
@@ -31,9 +31,12 @@ function addUnit(value) {
31
31
  }
32
32
  exports.addUnit = addUnit;
33
33
  function requestAnimationFrame(cb) {
34
- return setTimeout(function () {
35
- cb();
36
- }, 1000 / 30);
34
+ return new Promise(function (resolve) {
35
+ setTimeout(function () {
36
+ cb === null || cb === void 0 ? void 0 : cb();
37
+ resolve();
38
+ }, 1000 / 30);
39
+ });
37
40
  }
38
41
  exports.requestAnimationFrame = requestAnimationFrame;
39
42
  function pickExclude(obj, keys) {
@@ -146,6 +146,9 @@ var defaultFormatter = function (type, value) {
146
146
  formatterFunc: function (type, value, data) {
147
147
  var _a;
148
148
  var _b, _c;
149
+ if (type === 'part') {
150
+ return value === 0 ? data.amText : data.pmText;
151
+ }
149
152
  var _d = (_b = this === null || this === void 0 ? void 0 : this.data) !== null && _b !== void 0 ? _b : data, formatterMap = _d.formatterMap, _e = _d.formatter, formatter = _e === void 0 ? defaultFormatter : _e;
150
153
  var mapDetail = formatterMap === null || formatterMap === void 0 ? void 0 : formatterMap[type];
151
154
  if (typeof mapDetail === 'string') {
@@ -375,8 +378,8 @@ var defaultFormatter = function (type, value) {
375
378
  part: part,
376
379
  });
377
380
  values = [
378
- part,
379
- formatter('hour', part ? (!hour ? 12 : hour - 12) : hour, this.data),
381
+ formatter('part', part, this.data),
382
+ formatter('hour', part ? (!hour ? '12' : (hour - 12).toString().padStart(2, '0')) : hour, this.data),
380
383
  formatter('minute', minute, this.data),
381
384
  ];
382
385
  }
@@ -99,6 +99,7 @@ var Dialog = function (options) {
99
99
  prom.catch(function (err) {
100
100
  appLog_1.default.info("Dialog promise Error", err);
101
101
  console.log(err, '---Dialog-error');
102
+ queueRef.value = [];
102
103
  });
103
104
  return prom;
104
105
  };
@@ -199,5 +199,12 @@ var dialog_1 = require("./dialog");
199
199
  callback(actionType, this);
200
200
  }
201
201
  },
202
+ // 兜底防止 通过api方式打开组件失败 导致队列没有清除
203
+ onPopUpError: function () {
204
+ var _a = this.data, callback = _a.callback, actionType = _a.actionType;
205
+ if (callback) {
206
+ callback(actionType, this);
207
+ }
208
+ },
202
209
  },
203
210
  });
@@ -17,6 +17,8 @@
17
17
  bind:before-leave="onBeforeLeave"
18
18
  bind:leave="onLeave"
19
19
  bind:after-leave="onAfterLeave"
20
+ bind:enter-error="onPopUpError"
21
+ bind:leave-error="onPopUpError"
20
22
  >
21
23
  <view
22
24
  wx:if="{{ title || useTitleSlot }}"
@@ -1,11 +1,43 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.transition = void 0;
7
40
  // @ts-nocheck
8
- var appLog_1 = __importDefault(require("../common/appLog"));
9
41
  var utils_1 = require("../common/utils");
10
42
  var validator_1 = require("../common/validator");
11
43
  var getClassNames = function (name) { return ({
@@ -38,6 +70,8 @@ function transition(showDefaultValue) {
38
70
  type: '',
39
71
  inited: false,
40
72
  display: false,
73
+ animating: false,
74
+ status: '',
41
75
  },
42
76
  ready: function () {
43
77
  if (this.data.show === true) {
@@ -46,7 +80,6 @@ function transition(showDefaultValue) {
46
80
  },
47
81
  methods: {
48
82
  observeShow: function (value, old) {
49
- appLog_1.default.info("transition component observeShow value: ".concat(value, ";old: ").concat(old));
50
83
  if (value === old) {
51
84
  return;
52
85
  }
@@ -54,104 +87,133 @@ function transition(showDefaultValue) {
54
87
  },
55
88
  enter: function () {
56
89
  var _this = this;
57
- if (this.enterFinishedPromise)
90
+ if (this.enterFinishedPromise || this.data.animating)
58
91
  return;
59
- appLog_1.default.info("transition component enter success");
60
- this.enterFinishedPromise = new Promise(function (resolve) {
61
- var _a = _this.data, duration = _a.duration, name = _a.name;
62
- var classNames = getClassNames(name);
63
- var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
64
- if (_this.status === 'enter') {
65
- return;
66
- }
67
- _this.status = 'enter';
68
- _this.$emit('before-enter');
69
- (0, utils_1.requestAnimationFrame)(function () {
70
- if (_this.status !== 'enter') {
71
- return;
92
+ this.setData({
93
+ animating: true,
94
+ status: 'enter',
95
+ });
96
+ // eslint-disable-next-line no-async-promise-executor
97
+ this.enterFinishedPromise = new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
98
+ var _a, duration, name, classNames, currentDuration;
99
+ var _this = this;
100
+ return __generator(this, function (_b) {
101
+ switch (_b.label) {
102
+ case 0:
103
+ _a = this.data, duration = _a.duration, name = _a.name;
104
+ classNames = getClassNames(name);
105
+ currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
106
+ this.$emit('before-enter');
107
+ return [4 /*yield*/, (0, utils_1.requestAnimationFrame)()];
108
+ case 1:
109
+ _b.sent();
110
+ this.$emit('enter');
111
+ this.setData({
112
+ inited: true,
113
+ display: true,
114
+ classes: classNames.enter,
115
+ currentDuration: currentDuration,
116
+ });
117
+ return [4 /*yield*/, (0, utils_1.requestAnimationFrame)()];
118
+ case 2:
119
+ _b.sent();
120
+ this.transitionEnded = false;
121
+ this.setData({ classes: classNames['enter-to'] });
122
+ clearTimeout(this.timer);
123
+ this.timer = setTimeout(function () {
124
+ _this.$emit("after-enter");
125
+ _this.setData({
126
+ animating: false,
127
+ });
128
+ _this.checkShowStatus();
129
+ }, currentDuration + 20);
130
+ resolve();
131
+ return [2 /*return*/];
72
132
  }
73
- _this.$emit('enter');
74
- _this.setData({
75
- inited: true,
76
- display: true,
77
- classes: classNames.enter,
78
- currentDuration: currentDuration,
79
- });
80
- (0, utils_1.requestAnimationFrame)(function () {
81
- if (_this.status !== 'enter') {
82
- return;
83
- }
84
- _this.transitionEnded = false;
85
- appLog_1.default.info("transition component enter transitionEnded false");
86
- _this.setData({ classes: classNames['enter-to'] });
87
- resolve();
88
- });
89
133
  });
90
- });
134
+ }); });
91
135
  this.enterFinishedPromise.catch(function (err) {
92
136
  _this.enterFinishedPromise = null;
93
- appLog_1.default.info("enter enterFinishedPromise catch", err);
137
+ _this.setData({ animating: false });
94
138
  console.log(err, '---error-enter');
139
+ _this.$emit('enter-error', err);
95
140
  });
96
141
  },
97
142
  leave: function () {
98
- var _this = this;
99
- if (!this.enterFinishedPromise)
100
- return;
101
- appLog_1.default.info("transition component leave success");
102
- this.enterFinishedPromise
103
- .then(function () {
104
- if (!_this.data.display) {
105
- return;
106
- }
107
- var _a = _this.data, duration = _a.duration, name = _a.name;
108
- var classNames = getClassNames(name);
109
- var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
110
- _this.status = 'leave';
111
- _this.$emit('before-leave');
112
- (0, utils_1.requestAnimationFrame)(function () {
113
- if (_this.status !== 'leave') {
114
- return;
115
- }
116
- _this.$emit('leave');
117
- _this.setData({
118
- classes: classNames.leave,
119
- currentDuration: currentDuration,
143
+ return __awaiter(this, void 0, void 0, function () {
144
+ var _this = this;
145
+ return __generator(this, function (_a) {
146
+ if (!this.enterFinishedPromise || this.data.animating)
147
+ return [2 /*return*/];
148
+ this.setData({
149
+ animating: true,
150
+ status: 'leave',
120
151
  });
121
- (0, utils_1.requestAnimationFrame)(function () {
122
- if (_this.status !== 'leave') {
123
- return;
124
- }
125
- _this.transitionEnded = false;
126
- appLog_1.default.info("transition component leave transitionEnded false");
127
- setTimeout(function () {
128
- _this.enterFinishedPromise = null;
129
- appLog_1.default.info("transition component enterFinishedPromise cleared");
130
- _this.onTransitionEnd();
131
- }, currentDuration);
132
- _this.setData({ classes: classNames['leave-to'] });
152
+ this.enterFinishedPromise
153
+ .then(function () { return __awaiter(_this, void 0, void 0, function () {
154
+ var _a, duration, name, classNames, currentDuration;
155
+ var _this = this;
156
+ return __generator(this, function (_b) {
157
+ switch (_b.label) {
158
+ case 0:
159
+ _a = this.data, duration = _a.duration, name = _a.name;
160
+ classNames = getClassNames(name);
161
+ currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
162
+ this.$emit('before-leave');
163
+ return [4 /*yield*/, (0, utils_1.requestAnimationFrame)()];
164
+ case 1:
165
+ _b.sent();
166
+ this.$emit('leave');
167
+ this.setData({
168
+ classes: classNames.leave,
169
+ currentDuration: currentDuration,
170
+ });
171
+ return [4 /*yield*/, (0, utils_1.requestAnimationFrame)()];
172
+ case 2:
173
+ _b.sent();
174
+ this.transitionEnded = false;
175
+ clearTimeout(this.timer);
176
+ setTimeout(function () {
177
+ _this.enterFinishedPromise = null;
178
+ _this.$emit("after-leave");
179
+ _this.setData({
180
+ display: false,
181
+ animating: false,
182
+ });
183
+ _this.checkShowStatus();
184
+ }, currentDuration + 20);
185
+ this.setData({ classes: classNames['leave-to'] });
186
+ return [2 /*return*/];
187
+ }
188
+ });
189
+ }); })
190
+ .catch(function (err) {
191
+ _this.enterFinishedPromise = null;
192
+ _this.setData({ animating: false });
193
+ console.log(err, '---error-leave');
194
+ _this.$emit('leave-error', err);
133
195
  });
196
+ return [2 /*return*/];
134
197
  });
135
- })
136
- .catch(function (err) {
137
- _this.enterFinishedPromise = null;
138
- appLog_1.default.info("leave enterFinishedPromise catch", err);
139
- console.log(err, '---error-enter');
140
198
  });
141
199
  },
142
- onTransitionEnd: function () {
143
- appLog_1.default.info("transition component in transitionEnded ".concat(this.transitionEnded));
144
- if (this.transitionEnded) {
145
- return;
146
- }
147
- this.transitionEnded = true;
148
- appLog_1.default.info("transition component in transitionEnded true");
149
- this.$emit("after-".concat(this.status));
150
- appLog_1.default.info("transition component onTransitionEnd ".concat(this.status, " success"));
151
- var _a = this.data, show = _a.show, display = _a.display;
152
- if (!show && display) {
153
- this.setData({ display: false });
154
- }
200
+ checkShowStatus: function () {
201
+ return __awaiter(this, void 0, void 0, function () {
202
+ var _a, status, show;
203
+ return __generator(this, function (_b) {
204
+ switch (_b.label) {
205
+ case 0:
206
+ _a = this.data, status = _a.status, show = _a.show;
207
+ return [4 /*yield*/, (0, utils_1.requestAnimationFrame)()];
208
+ case 1:
209
+ _b.sent();
210
+ if ((status === 'enter' && show) || (status === 'leave' && !show))
211
+ return [2 /*return*/];
212
+ show ? this.enter() : this.leave();
213
+ return [2 /*return*/];
214
+ }
215
+ });
216
+ });
155
217
  },
156
218
  },
157
219
  });
@@ -1 +1 @@
1
- @import '../common/index.css';.smart-popover{--overlay-background-color:transparent;position:relative}.smart-popover,.smart-popover-button{display:inline-block}.smart-popover-overlay{background-color:var(--popover-background-color,var(--app-B4,#fff));border-radius:var(--popover-border-radius,12px);box-shadow:var(--popover-box-shadow,0 6px 12px 0 rgba(0,0,0,.1));padding:var(--popover-padding,12px);position:absolute;z-index:102}.smart-popover-overlay-arrow{background-position:50%;background-repeat:no-repeat;position:absolute}
1
+ @import '../common/index.css';.smart-popover{--overlay-background-color:transparent;position:relative}.smart-popover,.smart-popover-button{display:inline-block}.smart-popover-overlay{background-color:var(--popover-background-color,var(--app-B4,#fff));border-radius:var(--popover-border-radius,12px);box-shadow:var(--popover-box-shadow,0 6px 12px 0 rgba(0,0,0,.1));opacity:0;padding:var(--popover-padding,12px);position:absolute;transition:opacity .3s ease-in-out;z-index:102}.smart-popover-overlay-arrow{background-position:50%;background-repeat:no-repeat;position:absolute}
@@ -13,7 +13,6 @@ var __assign = (this && this.__assign) || function () {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  /* eslint-disable prefer-destructuring */
15
15
  var component_1 = require("../common/component");
16
- var transition_1 = require("../mixins/transition");
17
16
  var IconSrc = function (deg) {
18
17
  return "<svg style=\"transform: rotate(".concat(deg, ")\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" fill=\"none\" version=\"1.1\" width=\"18.00000052453666\" height=\"6.000001573609978\" viewBox=\"0 0 18.00000052453666 6.000001573609978\"><g transform=\"matrix(-1,-8.742277657347586e-8,-8.742277657347586e-8,1,36.00000104907346,0.0000015736100241790166)\"><path d=\"M18.026037824536658,0.006179333609978323C18.827028524536658,0.014487173609978322,19.72353052453666,0.026256673609978323,20.50303052453666,0.3038745736099783C21.34506052453666,0.6038775736099783,21.90250052453666,1.1284215736099783,22.46337052453666,1.7457315736099783C22.867160524536658,2.1897415736099783,23.66033052453666,3.137051573609978,24.04654052453666,3.5944415736099784C24.36263052453666,3.9694415736099784,24.98139052453666,4.710681573609978,25.31923052453666,5.0693015736099785C25.74452052453666,5.520461573609978,26.270210524536658,6.000001573609978,27.00036052453666,6.000001573609978C27.730510524536662,6.000001573609978,28.25600052453666,5.520461573609978,28.681000524536657,5.069761573609978C29.01880052453666,4.711371573609978,29.63760052453666,3.969671573609978,29.95390052453666,3.5949015736099783C30.33970052453666,3.137511573609978,31.13280052453666,2.1902015736099782,31.53690052453666,1.7461915736099782C32.09870052453666,1.1288815736099784,32.65520052453666,0.6043385736099783,33.49700052453666,0.3043355736099783C34.276700524536665,0.027410573609978322,35.17340052453666,0.014948673609978322,35.97390052453666,0.006640913609978322C36.811100524536656,-0.0018975863900216774,17.189137524536658,-0.0023591663900216775,18.026037824536658,0.006179333609978323Z\" fill-rule=\"evenodd\" fill=\"#FFFFFF\" fill-opacity=\"1\"/></g></svg>");
19
18
  };
@@ -30,7 +29,6 @@ function createSvgIcon(svg) {
30
29
  'leave-to-class',
31
30
  'close-icon-class',
32
31
  ],
33
- mixins: [(0, transition_1.transition)(false)],
34
32
  props: {
35
33
  // `top`、`topLeft`、`topRight`、`bottom`、`bottomLeft`、`bottomRight`、`left`、`leftTop`、`leftBottom`、`right`、`rightTop`、`rightBottom`
36
34
  placement: {
@@ -41,9 +39,12 @@ function createSvgIcon(svg) {
41
39
  type: Boolean,
42
40
  observer: function (value) {
43
41
  if (value !== this.data.currentShow) {
44
- this.setData({
45
- currentShow: value,
46
- });
42
+ if (value) {
43
+ this.onOpen();
44
+ }
45
+ else {
46
+ this.onClose();
47
+ }
47
48
  }
48
49
  },
49
50
  },
@@ -57,10 +58,10 @@ function createSvgIcon(svg) {
57
58
  },
58
59
  duration: {
59
60
  type: Number,
60
- value: 2000,
61
+ value: 20000,
61
62
  },
62
63
  },
63
- data: { currentShow: false },
64
+ data: { currentShow: false, showStyle: '' },
64
65
  mounted: function () { },
65
66
  created: function () { },
66
67
  methods: {
@@ -172,11 +173,19 @@ function createSvgIcon(svg) {
172
173
  this.setData(params);
173
174
  },
174
175
  onClick: function () {
176
+ this.onOpen();
177
+ },
178
+ onOpen: function () {
175
179
  var _this = this;
176
180
  this.getButtonPosition();
177
181
  this.setData({
178
182
  currentShow: true,
179
183
  });
184
+ setTimeout(function () {
185
+ _this.setData({
186
+ showStyle: 'opacity: 1;',
187
+ });
188
+ }, 100);
180
189
  this.$emit('show-change', true);
181
190
  if (this.data.duration) {
182
191
  setTimeout(function () {
@@ -185,11 +194,17 @@ function createSvgIcon(svg) {
185
194
  }
186
195
  },
187
196
  onClose: function () {
197
+ var _this = this;
188
198
  this.setData({
189
- currentShow: false,
199
+ showStyle: 'opacity: 0;',
190
200
  });
191
- this.$emit('show-change', false);
192
- this.$emit('close', false);
201
+ setTimeout(function () {
202
+ _this.setData({
203
+ currentShow: false,
204
+ });
205
+ _this.$emit('show-change', false);
206
+ _this.$emit('close', false);
207
+ }, 300);
193
208
  },
194
209
  },
195
210
  });
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "component": true,
3
3
  "usingComponents": {
4
- "smart-transition": "../transition/index",
5
4
  "smart-overlay": "../overlay/index"
6
5
  }
7
6
  }