@masterteam/work-center 0.0.34 → 0.0.35

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.
@@ -79,6 +79,7 @@
79
79
  "name": "\u0627\u0644\u0627\u0633\u0645",
80
80
  "status": "\u0627\u0644\u062d\u0627\u0644\u0629",
81
81
  "user": "\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645",
82
+ "userOrGroup": "\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 / \u0627\u0644\u0645\u062c\u0645\u0648\u0639\u0629",
82
83
  "initiationDate": "\u062a\u0627\u0631\u064a\u062e \u0627\u0644\u0628\u062f\u0621",
83
84
  "actionDate": "\u062a\u0627\u0631\u064a\u062e \u0627\u0644\u0625\u062c\u0631\u0627\u0621",
84
85
  "start": "\u0628\u062f\u0627\u064a\u0629",
@@ -125,6 +126,7 @@
125
126
  "name": "الاسم",
126
127
  "status": "الحالة",
127
128
  "user": "المستخدم",
129
+ "userOrGroup": "المستخدم / المجموعة",
128
130
  "initiationDate": "تاريخ البدء",
129
131
  "actionDate": "تاريخ الإجراء",
130
132
  "start": "بداية",
@@ -79,6 +79,7 @@
79
79
  "name": "Name",
80
80
  "status": "Status",
81
81
  "user": "User",
82
+ "userOrGroup": "User / Group",
82
83
  "initiationDate": "Initiation Date",
83
84
  "actionDate": "Action Date",
84
85
  "start": "Start",
@@ -125,6 +126,7 @@
125
126
  "name": "Name",
126
127
  "status": "Status",
127
128
  "user": "User",
129
+ "userOrGroup": "User / Group",
128
130
  "initiationDate": "Initiation Date",
129
131
  "actionDate": "Action Date",
130
132
  "start": "Start",
@@ -1735,10 +1735,11 @@ class WorkCenterProcessPreview {
1735
1735
  {
1736
1736
  key: 'status',
1737
1737
  label: this.transloco.translate('workCenter.preview.status'),
1738
+ type: 'entity',
1738
1739
  },
1739
1740
  {
1740
1741
  key: 'user',
1741
- label: this.transloco.translate('workCenter.preview.user'),
1742
+ label: this.transloco.translate('workCenter.preview.userOrGroup'),
1742
1743
  type: 'entity',
1743
1744
  },
1744
1745
  {
@@ -1756,18 +1757,50 @@ class WorkCenterProcessPreview {
1756
1757
  error = signal(null, ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
1757
1758
  preview = signal(null, ...(ngDevMode ? [{ debugName: "preview" }] : /* istanbul ignore next */ []));
1758
1759
  canRenderPreview = computed(() => (this.requestId() ?? 0) > 0, ...(ngDevMode ? [{ debugName: "canRenderPreview" }] : /* istanbul ignore next */ []));
1759
- approvalRows = computed(() => (this.preview()?.steps ?? []).map((step) => ({
1760
- stepName: this.resolveDisplayName(step.stepName) || String(step.stepId ?? '--'),
1761
- status: this.resolveDisplayName(step.status) || '--',
1762
- user: buildEntity('User', 'User', (step.actionUserInfo ?? step.targetUser ?? null)),
1763
- createdAt: buildEntity('Initiation Date', 'DateTime', step.createdAt ?? ''),
1764
- actionDate: buildEntity('Action Date', 'DateTime', step.actionDate ?? ''),
1765
- })), ...(ngDevMode ? [{ debugName: "approvalRows" }] : /* istanbul ignore next */ []));
1760
+ approvalRows = computed(() => {
1761
+ const steps = this.preview()?.steps ?? [];
1762
+ const rows = [];
1763
+ const seenGroupKeys = new Set();
1764
+ for (const step of steps) {
1765
+ const groupName = this.resolveGroupName(step.target);
1766
+ if (groupName) {
1767
+ const dedupKey = `${step.stepSchemaId ?? ''}|${step.target?.groupKey ?? ''}`;
1768
+ if (seenGroupKeys.has(dedupKey))
1769
+ continue;
1770
+ seenGroupKeys.add(dedupKey);
1771
+ // Prefer a sibling that has been actioned so we can surface real
1772
+ // action date/status; otherwise fall back to the current step.
1773
+ const siblings = steps.filter((s) => (s.stepSchemaId ?? '') === (step.stepSchemaId ?? '') &&
1774
+ (s.target?.groupKey ?? '') === (step.target?.groupKey ?? ''));
1775
+ const repr = siblings.find((s) => s.actionUserInfo) ?? step;
1776
+ rows.push({
1777
+ stepName: this.resolveDisplayName(repr.stepName) ||
1778
+ String(repr.stepId ?? '--'),
1779
+ status: buildEntity('Status', 'Status', repr.status),
1780
+ user: buildEntity('User', 'Text', groupName),
1781
+ createdAt: buildEntity('Initiation Date', 'DateTime', repr.createdAt ?? ''),
1782
+ actionDate: buildEntity('Action Date', 'DateTime', repr.actionDate ?? ''),
1783
+ });
1784
+ }
1785
+ else {
1786
+ rows.push({
1787
+ stepName: this.resolveDisplayName(step.stepName) ||
1788
+ String(step.stepId ?? '--'),
1789
+ status: buildEntity('Status', 'Status', step.status),
1790
+ user: buildEntity('User', 'User', (step.actionUserInfo ?? step.targetUser ?? null)),
1791
+ createdAt: buildEntity('Initiation Date', 'DateTime', step.createdAt ?? ''),
1792
+ actionDate: buildEntity('Action Date', 'DateTime', step.actionDate ?? ''),
1793
+ });
1794
+ }
1795
+ }
1796
+ return rows;
1797
+ }, ...(ngDevMode ? [{ debugName: "approvalRows" }] : /* istanbul ignore next */ []));
1766
1798
  hasApprovals = computed(() => this.approvalRows().length > 0, ...(ngDevMode ? [{ debugName: "hasApprovals" }] : /* istanbul ignore next */ []));
1767
1799
  schemaNodes = computed(() => {
1768
1800
  const steps = this.preview()?.schema?.stepsSchema ?? [];
1769
1801
  const connections = this.preview()?.schema?.connections ?? [];
1770
1802
  const sourceIds = new Set(connections.map((c) => String(c.source)));
1803
+ const currentStepIds = new Set((this.preview()?.currentStepSchemaIds ?? []).map(String));
1771
1804
  return steps.map((step) => {
1772
1805
  const isAppAction = step.type === 'AppAction';
1773
1806
  const isApprovalCommit = step.type === 'ApprovalCommit' || step.systemKind === 'ApprovalCommit';
@@ -1817,6 +1850,7 @@ class WorkCenterProcessPreview {
1817
1850
  : null,
1818
1851
  status: step.status ?? null,
1819
1852
  style: isAppAction || isApprovalCommit ? 'icon' : 'detail',
1853
+ current: currentStepIds.has(String(step.id)),
1820
1854
  };
1821
1855
  });
1822
1856
  }, ...(ngDevMode ? [{ debugName: "schemaNodes" }] : /* istanbul ignore next */ []));
@@ -1836,6 +1870,7 @@ class WorkCenterProcessPreview {
1836
1870
  badge: 'badge',
1837
1871
  status: 'status',
1838
1872
  style: 'style',
1873
+ current: 'current',
1839
1874
  };
1840
1875
  constructor() {
1841
1876
  effect(() => {
@@ -1853,6 +1888,13 @@ class WorkCenterProcessPreview {
1853
1888
  ngOnDestroy() {
1854
1889
  this.loadSub?.unsubscribe();
1855
1890
  }
1891
+ resolveGroupName(target) {
1892
+ if (!target || target.type !== 'Group' || !target.group) {
1893
+ return '';
1894
+ }
1895
+ return (this.resolveDisplayName(target.displayName) ||
1896
+ this.resolveDisplayName(target.group.name));
1897
+ }
1856
1898
  resolveDisplayName(name) {
1857
1899
  if (typeof name === 'string') {
1858
1900
  return name;