@bizdoc/core 1.13.0-next.11 → 1.13.0-next.15

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.
@@ -2069,7 +2069,7 @@ const STRINGS = {
2069
2069
  ReceivedTime: 'Received {0}',
2070
2070
  ReceivedBy: 'Received by {0} {1}',
2071
2071
  ActionTakenBy: '{0} {1} this document on behalf of {2} {3}',
2072
- ActionTakenByTo: '{0} {1} this document to {2} on behalf of {3} {4}',
2072
+ ActionTakenByTo: '{0} {1} this document on behalf of {3} to {2} {4}',
2073
2073
  YouTakenActionBy: '{0} {1} this document on your behalf {2}',
2074
2074
  YouTakenActionByTo: '{0} {1} this document to {2} on your behalf {3}',
2075
2075
  ActionTakenByYou: 'You {0} this document on behalf of {1} {2}',
@@ -13387,14 +13387,7 @@ class FlowViewComponent extends TraceBase {
13387
13387
  /** */
13388
13388
  async _prepare() {
13389
13389
  const { connectors: dconnectors, nodes: dnodes } = this.model.workflow;
13390
- const indicators = [], connectors = dconnectors.map(c => ({
13391
- sourceID: c.sourceId,
13392
- targetID: c.targetId,
13393
- addInfo: {
13394
- estimate: c.estimate,
13395
- time: c.time
13396
- }
13397
- })), nodes = [];
13390
+ const indicators = [], connectors = [], nodes = [];
13398
13391
  let zIndex = 500;
13399
13392
  for (let node of dnodes) {
13400
13393
  if (nodes.find(n => n.id == node.id))
@@ -13449,29 +13442,6 @@ class FlowViewComponent extends TraceBase {
13449
13442
  }
13450
13443
  }]
13451
13444
  };
13452
- r > 0 &&
13453
- // more than one recipient to node,
13454
- dconnectors.forEach(c => {
13455
- if (c.targetId === node.id)
13456
- // add inbound connectors
13457
- connectors.push({
13458
- sourceID: c.sourceId,
13459
- targetID: nod.id,
13460
- addInfo: {
13461
- estimate: c.estimate
13462
- }
13463
- });
13464
- if (c.sourceId === node.id &&
13465
- // add outbound no origin or originated by the recipient
13466
- (!c.originId || c.originId === recipient.id))
13467
- connectors.push({
13468
- sourceID: nod.id,
13469
- targetID: c.targetId,
13470
- addInfo: {
13471
- estimate: c.estimate
13472
- }
13473
- });
13474
- });
13475
13445
  nodes.push(nod);
13476
13446
  // add action indicator
13477
13447
  if (recipient.action) {
@@ -13554,9 +13524,7 @@ class FlowViewComponent extends TraceBase {
13554
13524
  offset: shape.type === 'Path' ? {
13555
13525
  y: 1
13556
13526
  } : { x: .5 },
13557
- style: {
13558
- //bold: true
13559
- },
13527
+ style: {},
13560
13528
  verticalAlignment: shape.type === 'Path' ? 'Top' : 'Center'
13561
13529
  }]
13562
13530
  });
@@ -13597,6 +13565,23 @@ class FlowViewComponent extends TraceBase {
13597
13565
  }
13598
13566
  }
13599
13567
  }
13568
+ for (let connector of dconnectors) {
13569
+ let sources = nodes.filter(n => n.addInfo.node.id === connector.sourceId), targets = nodes.filter(n => n.addInfo.node.id === connector.targetId);
13570
+ for (let source of sources) {
13571
+ for (let target of targets) {
13572
+ if (!connector.originId || !source.addInfo.recipient ||
13573
+ connector.originId === source.addInfo.recipient.id)
13574
+ connectors.push({
13575
+ sourceID: source.id,
13576
+ targetID: target.id,
13577
+ addInfo: {
13578
+ estimate: connector.estimate,
13579
+ time: connector.time
13580
+ }
13581
+ });
13582
+ }
13583
+ }
13584
+ }
13600
13585
  return { connectors, nodes, indicators };
13601
13586
  }
13602
13587
  /**
@@ -13712,17 +13697,21 @@ class FlowViewComponent extends TraceBase {
13712
13697
  }
13713
13698
  if (recipient.replied) {
13714
13699
  const time = this._fromNow(recipient.replied);
13700
+ const targets = this.model.recipients.filter(r => r.originId === recipient.id), to = [];
13701
+ if (targets.length)
13702
+ for (let sibling of targets) {
13703
+ const who = await this._accounts.get(sibling.userId).toPromise();
13704
+ to.push(who.name);
13705
+ }
13715
13706
  if (recipient.byId) {
13716
13707
  if (recipient.byId === this._session.profile.byId) {
13717
13708
  const action = this._action(recipient.action, this._session.profile.byGender);
13718
- if (recipient.originId) {
13719
- const origin = this.model.recipients.find(r => r.id === recipient.originId);
13720
- const to = await this._accounts.get(origin.userId).toPromise();
13709
+ if (to.length) {
13721
13710
  if (recipient.userId === this._session.profile.userId)
13722
- tooltip.note = this._translate.get('ActionTakenByYouTo', action, to.name, this._session.profile.name, time);
13711
+ tooltip.note = this._translate.get('ActionTakenByYouTo', action, this._translate.join(to), this._session.profile.name, time);
13723
13712
  else {
13724
13713
  const who = await this._accounts.get(recipient.userId).toPromise();
13725
- tooltip.note = this._translate.get('ActionTakenByYouTo', action, to.name, who.name, time);
13714
+ tooltip.note = this._translate.get('ActionTakenByYouTo', action, this._translate.join(to), who.name, time);
13726
13715
  }
13727
13716
  }
13728
13717
  else if (recipient.userId === this._session.profile.userId)
@@ -13736,40 +13725,34 @@ class FlowViewComponent extends TraceBase {
13736
13725
  const by = await this._accounts.get(recipient.byId).toPromise();
13737
13726
  const action = this._action(recipient.action, by.gender);
13738
13727
  if (recipient.userId === this._session.profile.userId) {
13739
- if (recipient.originId) {
13740
- const origin = this.model.recipients.find(r => r.id === recipient.originId);
13741
- const to = await this._accounts.get(origin.userId).toPromise();
13742
- tooltip.note = this._translate.get('YouTakenActionByTo', by.name, action, to.name, time);
13728
+ if (to.length) {
13729
+ tooltip.note = this._translate.get('YouTakenActionByTo', by.name, action, this._translate.join(to), time);
13743
13730
  }
13744
13731
  else
13745
13732
  tooltip.note = this._translate.get('YouTakenActionBy', by.name, action, time);
13746
13733
  }
13747
13734
  else {
13748
13735
  const who = await this._accounts.get(recipient.userId).toPromise();
13749
- if (recipient.originId) {
13750
- const origin = this.model.recipients.find(r => r.id === recipient.originId);
13751
- const to = await this._accounts.get(origin.userId).toPromise();
13752
- tooltip.note = this._translate.get('ActionTakenByTo', by.name, action, to.name, who.name, time);
13736
+ if (to.length) {
13737
+ tooltip.note = this._translate.get('ActionTakenByTo', by.name, action, this._translate.join(to), who.name, time);
13753
13738
  }
13754
13739
  else
13755
13740
  tooltip.note = this._translate.get('ActionTakenBy', by.name, action, who.name, time);
13756
13741
  }
13757
13742
  }
13758
13743
  }
13759
- else if (recipient.originId) {
13760
- const origin = this.model.recipients.find(r => r.id === recipient.originId);
13761
- const to = await this._accounts.get(origin.userId).toPromise();
13744
+ else if (to.length) {
13762
13745
  if (recipient.userId === this._session.profile.userId) {
13763
13746
  const action = this._action(recipient.action, this._session.profile.gender);
13764
13747
  if (this._session.isImpersonating)
13765
- tooltip.note = this._translate.get('ActionTakenTo', this._session.profile.name, action, to.name, time);
13748
+ tooltip.note = this._translate.get('ActionTakenTo', this._session.profile.name, action, this._translate.join(to), time);
13766
13749
  else
13767
- tooltip.note = this._translate.get('YouTakenActionTo', action, to.name, time);
13750
+ tooltip.note = this._translate.get('YouTakenActionTo', action, this._translate.join(to), time);
13768
13751
  }
13769
13752
  else {
13770
13753
  const who = await this._accounts.get(recipient.userId).toPromise();
13771
13754
  const action = this._action(recipient.action, who.gender);
13772
- tooltip.note = this._translate.get('ActionTakenTo', who.name, action, to.name);
13755
+ tooltip.note = this._translate.get('ActionTakenTo', who.name, action, this._translate.join(to));
13773
13756
  }
13774
13757
  }
13775
13758
  else if (this._session.isImpersonating) {
@@ -13786,17 +13769,18 @@ class FlowViewComponent extends TraceBase {
13786
13769
  tooltip.note = this._translate.get('ActionTaken', who.name, action, time);
13787
13770
  }
13788
13771
  }
13789
- else if (!node.estimate) {
13790
- const time = this._fromNow(recipient.received);
13791
- if (this._session.isImpersonating)
13792
- tooltip.note = this._translate.personalize('ReceivedBy', this._session.profile.gender, this._session.profile.name, time);
13793
- else
13794
- tooltip.note = this._translate.get('YouReceived', time);
13795
- }
13796
13772
  else if (!recipient.estimate) {
13797
- const who = await this._accounts.get(recipient.userId).toPromise();
13798
13773
  const time = this._fromNow(recipient.received);
13799
- tooltip.note = this._translate.personalize('ReceivedTime', who.gender, time);
13774
+ if (recipient.userId === this._session.userId) {
13775
+ if (this._session.isImpersonating)
13776
+ tooltip.note = this._translate.personalize('ReceivedBy', this._session.profile.gender, this._session.profile.name, time);
13777
+ else
13778
+ tooltip.note = this._translate.get('YouReceived', time);
13779
+ }
13780
+ else {
13781
+ const who = await this._accounts.get(recipient.userId).toPromise();
13782
+ tooltip.note = this._translate.personalize('ReceivedTime', who.gender, time);
13783
+ }
13800
13784
  }
13801
13785
  if (recipient.substitutingId) {
13802
13786
  if (recipient.substitutingId === this._session.userId)
@@ -13955,14 +13939,13 @@ class TraceViewComponent extends TraceBase {
13955
13939
  if (to.length) {
13956
13940
  const users = [];
13957
13941
  for (let who of to) {
13958
- let profile = await me._accounts.get(who.substitutingId || who.userId).toPromise();
13942
+ let profile = await profileOf(who.substitutingId || who.userId);
13959
13943
  users.push(nameOf(profile));
13960
13944
  }
13961
13945
  return me._translate.get('ActionTo', name, me._translate.join(users));
13962
13946
  }
13963
13947
  }
13964
- else
13965
- return name;
13948
+ return name;
13966
13949
  }
13967
13950
  const trace = [];
13968
13951
  for (let l of log) {
@@ -14079,7 +14062,7 @@ class TraceViewComponent extends TraceBase {
14079
14062
  }
14080
14063
  }
14081
14064
  for (let recipient of recipients) {
14082
- if (!recipient.pending && !recipient.estimate)
14065
+ if (!recipient.pending && !recipient.estimate && !recipient.fyi)
14083
14066
  continue;
14084
14067
  let step = {
14085
14068
  time: recipient.received,