@meta2d/core 1.1.3 → 1.1.5
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/package.json +1 -1
- package/src/canvas/canvas.js +33 -6
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +28 -10
- package/src/core.js.map +1 -1
- package/src/diagrams/form.js +55 -12
- package/src/diagrams/form.js.map +1 -1
- package/src/diagrams/index.d.ts +3 -0
- package/src/diagrams/index.js +3 -0
- package/src/diagrams/index.js.map +1 -1
- package/src/diagrams/sceneContainer.d.ts +2 -0
- package/src/diagrams/sceneContainer.js +112 -0
- package/src/diagrams/sceneContainer.js.map +1 -0
- package/src/pen/model.d.ts +1 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/plugin.js +1 -1
- package/src/pen/plugin.js.map +1 -1
- package/src/pen/render.js +2 -1
- package/src/pen/render.js.map +1 -1
- package/src/store/store.js +2 -1
- package/src/store/store.js.map +1 -1
- package/src/tooltip/tooltip.js +3 -0
- package/src/tooltip/tooltip.js.map +1 -1
- package/src/utils/debounce.d.ts +2 -0
- package/src/utils/debounce.js +28 -0
- package/src/utils/debounce.js.map +1 -0
- package/src/utils/index.d.ts +1 -0
- package/src/utils/index.js +1 -0
- package/src/utils/index.js.map +1 -1
package/src/core.js
CHANGED
|
@@ -237,7 +237,7 @@ export class Meta2d {
|
|
|
237
237
|
let keys = url.match(/\$\{([^}]+)\}/g)?.map(m => m.slice(2, -1));
|
|
238
238
|
if (keys) {
|
|
239
239
|
keys?.forEach((key) => {
|
|
240
|
-
url = url.replace(`\${${key}}`, pen
|
|
240
|
+
url = url.replace(`\${${key}}`, getter(pen, key) || this.getDynamicParam(key));
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
}
|
|
@@ -262,7 +262,7 @@ export class Meta2d {
|
|
|
262
262
|
let keys = __value.match(/\$\{([^}]+)\}/g)?.map(m => m.slice(2, -1));
|
|
263
263
|
if (keys) {
|
|
264
264
|
keys.forEach((key) => {
|
|
265
|
-
__value = __value.replace(`\${${key}}`, pen
|
|
265
|
+
__value = __value.replace(`\${${key}}`, getter(pen, key) || this.getDynamicParam(key));
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
268
|
_value[key] = __value;
|
|
@@ -447,7 +447,7 @@ export class Meta2d {
|
|
|
447
447
|
let keys = e.params.match(/\$\{([^}]+)\}/g)?.map(m => m.slice(2, -1));
|
|
448
448
|
if (keys) {
|
|
449
449
|
keys?.forEach((key) => {
|
|
450
|
-
url = url.replace(`\${${key}}`, pen
|
|
450
|
+
url = url.replace(`\${${key}}`, getter(pen, key) || this.getDynamicParam(key));
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
453
|
}
|
|
@@ -505,13 +505,13 @@ export class Meta2d {
|
|
|
505
505
|
const _pen = e.params ? this.findOne(e.params) : pen;
|
|
506
506
|
for (let key in value) {
|
|
507
507
|
if (value[key] === undefined || value[key] === '') {
|
|
508
|
-
value[key] = _pen
|
|
508
|
+
value[key] = getter(_pen, key);
|
|
509
509
|
}
|
|
510
510
|
else if (typeof value[key] === 'string' &&
|
|
511
511
|
value[key]?.indexOf('${') > -1) {
|
|
512
512
|
let keys = value[key].match(/\$\{([^}]+)\}/g)?.map(m => m.slice(2, -1));
|
|
513
513
|
if (keys?.length) {
|
|
514
|
-
value[key] = _pen[
|
|
514
|
+
value[key] = getter(_pen, key[0]) ?? this.getDynamicParam(keys[0]);
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
}
|
|
@@ -535,7 +535,10 @@ export class Meta2d {
|
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
537
537
|
let params = queryURLParams(_pen.iframe.split('?')[1]);
|
|
538
|
-
|
|
538
|
+
let value = this.getSendData(e.data, pen);
|
|
539
|
+
if (e.list) {
|
|
540
|
+
value = this.getEventData(e.list, pen);
|
|
541
|
+
}
|
|
539
542
|
_pen.calculative.singleton.div.children[0].contentWindow.postMessage(JSON.stringify({
|
|
540
543
|
name: e.value,
|
|
541
544
|
id: params.id,
|
|
@@ -548,7 +551,10 @@ export class Meta2d {
|
|
|
548
551
|
console.warn('[meta2d] Emit value must be a string');
|
|
549
552
|
return;
|
|
550
553
|
}
|
|
551
|
-
|
|
554
|
+
let value = this.getSendData(e.data, pen);
|
|
555
|
+
if (e.list) {
|
|
556
|
+
value = this.getEventData(e.list, pen);
|
|
557
|
+
}
|
|
552
558
|
window.parent.postMessage(JSON.stringify({ name: e.value, data: value }), '*');
|
|
553
559
|
return;
|
|
554
560
|
};
|
|
@@ -684,8 +690,8 @@ export class Meta2d {
|
|
|
684
690
|
//图纸更新
|
|
685
691
|
const data = await getMeta2dData(this.store, id);
|
|
686
692
|
if (data) {
|
|
693
|
+
this.canvas.opening = true;
|
|
687
694
|
this.open(data);
|
|
688
|
-
this.canvas.opening = false;
|
|
689
695
|
this.lock(1);
|
|
690
696
|
const width = this.store.data.width || this.store.options.width;
|
|
691
697
|
const height = this.store.data.height || this.store.options.height;
|
|
@@ -695,6 +701,7 @@ export class Meta2d {
|
|
|
695
701
|
else {
|
|
696
702
|
this.fitView(true, 10);
|
|
697
703
|
}
|
|
704
|
+
this.render(true);
|
|
698
705
|
// document.title = data.name + "-" + window.name;
|
|
699
706
|
}
|
|
700
707
|
}
|
|
@@ -1552,7 +1559,7 @@ export class Meta2d {
|
|
|
1552
1559
|
this.canvas.setPenRect(pen, rect, render);
|
|
1553
1560
|
}
|
|
1554
1561
|
startAnimate(idOrTagOrPens, params) {
|
|
1555
|
-
this.stopAnimate(idOrTagOrPens);
|
|
1562
|
+
// this.stopAnimate(idOrTagOrPens);
|
|
1556
1563
|
let pens;
|
|
1557
1564
|
// 没有参数 则播放有自动播放属性的动画
|
|
1558
1565
|
if (!idOrTagOrPens) {
|
|
@@ -1565,9 +1572,19 @@ export class Meta2d {
|
|
|
1565
1572
|
}
|
|
1566
1573
|
else if (typeof idOrTagOrPens === 'string') {
|
|
1567
1574
|
pens = this.find(idOrTagOrPens);
|
|
1575
|
+
pens.forEach((pen) => {
|
|
1576
|
+
if (!pen.calculative.pause || pen.currentAnimation !== params) {
|
|
1577
|
+
this.stopAnimate([pen]);
|
|
1578
|
+
}
|
|
1579
|
+
});
|
|
1568
1580
|
}
|
|
1569
1581
|
else {
|
|
1570
1582
|
pens = idOrTagOrPens;
|
|
1583
|
+
pens.forEach((pen) => {
|
|
1584
|
+
if (!pen.calculative.pause || pen.currentAnimation !== params) {
|
|
1585
|
+
this.stopAnimate([pen]);
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1571
1588
|
}
|
|
1572
1589
|
if (!pens.length) {
|
|
1573
1590
|
return;
|
|
@@ -3583,12 +3600,13 @@ export class Meta2d {
|
|
|
3583
3600
|
this.doEvent(e, eventName);
|
|
3584
3601
|
break;
|
|
3585
3602
|
case 'change':
|
|
3586
|
-
e.pen && updateFormData(e.pen);
|
|
3587
3603
|
if (e.pen) {
|
|
3604
|
+
updateFormData(e.pen);
|
|
3588
3605
|
this.store.data.locked && !e.pen.disabled &&
|
|
3589
3606
|
this.doEvent(e.pen, eventName);
|
|
3590
3607
|
}
|
|
3591
3608
|
else {
|
|
3609
|
+
updateFormData(e);
|
|
3592
3610
|
this.store.data.locked &&
|
|
3593
3611
|
e &&
|
|
3594
3612
|
!e.disabled &&
|