@memberjunction/ng-record-clone 0.0.0 → 6.2.0-edge.2
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/LICENSE +183 -0
- package/README.md +225 -28
- package/dist/lib/clone-lineage-chip.component.d.ts +50 -0
- package/dist/lib/clone-lineage-chip.component.d.ts.map +1 -0
- package/dist/lib/clone-lineage-chip.component.js +448 -0
- package/dist/lib/clone-lineage-chip.component.js.map +1 -0
- package/dist/lib/clone-plan-tree.component.d.ts +51 -0
- package/dist/lib/clone-plan-tree.component.d.ts.map +1 -0
- package/dist/lib/clone-plan-tree.component.js +634 -0
- package/dist/lib/clone-plan-tree.component.js.map +1 -0
- package/dist/lib/clone-progress.component.d.ts +12 -0
- package/dist/lib/clone-progress.component.d.ts.map +1 -0
- package/dist/lib/clone-progress.component.js +151 -0
- package/dist/lib/clone-progress.component.js.map +1 -0
- package/dist/lib/clone-result.component.d.ts +40 -0
- package/dist/lib/clone-result.component.d.ts.map +1 -0
- package/dist/lib/clone-result.component.js +357 -0
- package/dist/lib/clone-result.component.js.map +1 -0
- package/dist/lib/clone-review.component.d.ts +58 -0
- package/dist/lib/clone-review.component.d.ts.map +1 -0
- package/dist/lib/clone-review.component.js +581 -0
- package/dist/lib/clone-review.component.js.map +1 -0
- package/dist/lib/clone-scope-controls.component.d.ts +81 -0
- package/dist/lib/clone-scope-controls.component.d.ts.map +1 -0
- package/dist/lib/clone-scope-controls.component.js +394 -0
- package/dist/lib/clone-scope-controls.component.js.map +1 -0
- package/dist/lib/clone-values.component.d.ts +55 -0
- package/dist/lib/clone-values.component.d.ts.map +1 -0
- package/dist/lib/clone-values.component.js +493 -0
- package/dist/lib/clone-values.component.js.map +1 -0
- package/dist/lib/record-clone-panel.component.d.ts +247 -0
- package/dist/lib/record-clone-panel.component.d.ts.map +1 -0
- package/dist/lib/record-clone-panel.component.js +1252 -0
- package/dist/lib/record-clone-panel.component.js.map +1 -0
- package/dist/lib/record-clone-slide-in.component.d.ts +83 -0
- package/dist/lib/record-clone-slide-in.component.d.ts.map +1 -0
- package/dist/lib/record-clone-slide-in.component.js +206 -0
- package/dist/lib/record-clone-slide-in.component.js.map +1 -0
- package/dist/lib/record-clone-types.d.ts +89 -0
- package/dist/lib/record-clone-types.d.ts.map +1 -0
- package/dist/lib/record-clone-types.js +29 -0
- package/dist/lib/record-clone-types.js.map +1 -0
- package/dist/lib/record-clone.module.d.ts +16 -0
- package/dist/lib/record-clone.module.d.ts.map +1 -0
- package/dist/lib/record-clone.module.js +69 -0
- package/dist/lib/record-clone.module.js.map +1 -0
- package/dist/lib/record-clone.service.d.ts +42 -0
- package/dist/lib/record-clone.service.d.ts.map +1 -0
- package/dist/lib/record-clone.service.js +123 -0
- package/dist/lib/record-clone.service.js.map +1 -0
- package/dist/public-api.d.ts +16 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +16 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +49 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
|
|
4
|
+
"Business Source License" is a trademark of MariaDB plc.
|
|
5
|
+
|
|
6
|
+
-----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
|
|
10
|
+
Licensor: Blue Cypress, Inc.
|
|
11
|
+
|
|
12
|
+
Licensed Work: MemberJunction.
|
|
13
|
+
The Licensed Work is (c) 2023-2026 Blue Cypress, Inc.
|
|
14
|
+
|
|
15
|
+
Additional Use Grant: Subject to the terms of this License, Licensor grants
|
|
16
|
+
you the following additional rights to make Production
|
|
17
|
+
Use of the Licensed Work.
|
|
18
|
+
|
|
19
|
+
1. Internal Use
|
|
20
|
+
|
|
21
|
+
You may make production use of the Licensed Work for
|
|
22
|
+
your own internal business or organizational operations.
|
|
23
|
+
|
|
24
|
+
2. Nonprofit Use
|
|
25
|
+
|
|
26
|
+
If you are a Nonprofit, you may make production use of
|
|
27
|
+
the Licensed Work for the operations and activities of
|
|
28
|
+
your Organizational Family.
|
|
29
|
+
|
|
30
|
+
3. MemberJunction Certified Program Use
|
|
31
|
+
|
|
32
|
+
If you are authorized by Licensor under the
|
|
33
|
+
MemberJunction Certified Program to provide professional
|
|
34
|
+
services using the Licensed Work, you may make
|
|
35
|
+
production use of the Licensed Work in providing such
|
|
36
|
+
professional services to a client, provided that:
|
|
37
|
+
|
|
38
|
+
(a) the Licensed Work is deployed in, and the applicable
|
|
39
|
+
production use occurs within, an environment owned,
|
|
40
|
+
leased, licensed, subscribed to, or otherwise controlled
|
|
41
|
+
by that client; and
|
|
42
|
+
|
|
43
|
+
(b) the production use is for that client's own internal
|
|
44
|
+
business or organizational operations or is otherwise
|
|
45
|
+
independently permitted to that client under this
|
|
46
|
+
Additional Use Grant.
|
|
47
|
+
|
|
48
|
+
4. Definitions Applicable to the Additional Use Grant
|
|
49
|
+
|
|
50
|
+
"Affiliate" means, with respect to a specified Person,
|
|
51
|
+
any other Person that directly or indirectly Controls,
|
|
52
|
+
is Controlled by, or is under common Control with such
|
|
53
|
+
specified Person.
|
|
54
|
+
|
|
55
|
+
"Control" (including the terms "Controls," "Controlled
|
|
56
|
+
by," and "under common Control with") means the direct
|
|
57
|
+
or indirect possession of the power to direct or cause
|
|
58
|
+
the direction of the management and policies of a
|
|
59
|
+
Person, whether through ownership of voting interests,
|
|
60
|
+
by contract, or otherwise.
|
|
61
|
+
|
|
62
|
+
"Organizational Family" means, with respect to a Person,
|
|
63
|
+
(a) such Person and its Affiliates, and (b) any
|
|
64
|
+
nonprofit organization, governmental entity, chapter,
|
|
65
|
+
division, local affiliate, regional affiliate, state
|
|
66
|
+
affiliate, national affiliate, or other entity that is
|
|
67
|
+
formally affiliated with such Person through governing
|
|
68
|
+
documents, a charter, bylaws, a membership agreement, or
|
|
69
|
+
another written organizational instrument, and is
|
|
70
|
+
recognized under such documents as part of the same
|
|
71
|
+
organizational structure.
|
|
72
|
+
|
|
73
|
+
"Nonprofit" means a Person recognized by the Internal
|
|
74
|
+
Revenue Service as exempt from federal income taxation
|
|
75
|
+
under Section 501(c)(3), 501(c)(4), 501(c)(5), or
|
|
76
|
+
501(c)(6) of the Internal Revenue Code, or a foreign
|
|
77
|
+
organization recognized under substantially equivalent
|
|
78
|
+
laws.
|
|
79
|
+
|
|
80
|
+
A Person claiming eligibility as a Nonprofit shall, upon
|
|
81
|
+
Licensor's reasonable request, provide documentation
|
|
82
|
+
reasonably sufficient to demonstrate that it qualifies
|
|
83
|
+
as a Nonprofit. If such Person materially misrepresents,
|
|
84
|
+
or is unable to demonstrate, its qualification as a
|
|
85
|
+
Nonprofit, the rights granted to such Person under
|
|
86
|
+
Section 2 of this Additional Use Grant shall terminate.
|
|
87
|
+
|
|
88
|
+
"MemberJunction Certified Program" means Licensor's
|
|
89
|
+
then-current program for certifying and authorizing a
|
|
90
|
+
Person to provide professional services using the
|
|
91
|
+
Licensed Work.
|
|
92
|
+
|
|
93
|
+
"Person" means any individual, corporation, limited
|
|
94
|
+
liability company, partnership, association, nonprofit
|
|
95
|
+
organization, governmental entity, or other legal or
|
|
96
|
+
organizational entity.
|
|
97
|
+
|
|
98
|
+
Change Date: Four (4) years from the date the Licensed Work is first
|
|
99
|
+
made available.
|
|
100
|
+
|
|
101
|
+
Change License: MIT License.
|
|
102
|
+
|
|
103
|
+
For information about alternative licensing arrangements for the Licensed
|
|
104
|
+
Work, please contact Blue Cypress, Inc.
|
|
105
|
+
|
|
106
|
+
-----------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
Terms
|
|
109
|
+
|
|
110
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
111
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
112
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
113
|
+
production use.
|
|
114
|
+
|
|
115
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
116
|
+
available distribution of a specific version of the Licensed Work under this
|
|
117
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
118
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
119
|
+
above terminate.
|
|
120
|
+
|
|
121
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
122
|
+
currently in effect as described in this License, you must purchase a
|
|
123
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
124
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
125
|
+
|
|
126
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
127
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
128
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
129
|
+
for each version of the Licensed Work released by Licensor.
|
|
130
|
+
|
|
131
|
+
You must conspicuously display this License on each original or modified copy
|
|
132
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
133
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
134
|
+
License apply to your use of that work.
|
|
135
|
+
|
|
136
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
137
|
+
terminate your rights under this License for the current and all other
|
|
138
|
+
versions of the Licensed Work.
|
|
139
|
+
|
|
140
|
+
This License does not grant you any right in any trademark or logo of
|
|
141
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
142
|
+
Licensor as expressly required by this License).
|
|
143
|
+
|
|
144
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
145
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
146
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
147
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
148
|
+
TITLE.
|
|
149
|
+
|
|
150
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
151
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
152
|
+
as long as you comply with the Covenants of Licensor below.
|
|
153
|
+
|
|
154
|
+
-----------------------------------------------------------------------------
|
|
155
|
+
|
|
156
|
+
Covenants of Licensor
|
|
157
|
+
|
|
158
|
+
In consideration of the right to use this License's text and the "Business
|
|
159
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
160
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
161
|
+
|
|
162
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
163
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
164
|
+
where "compatible" means that software provided under the Change License
|
|
165
|
+
can be included in a program with software provided under GPL Version 2.0
|
|
166
|
+
or a later version. Licensor may specify additional Change Licenses without
|
|
167
|
+
limitation.
|
|
168
|
+
|
|
169
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
170
|
+
impose any additional restriction on the right granted in this License, as
|
|
171
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
172
|
+
|
|
173
|
+
3. To specify a Change Date.
|
|
174
|
+
|
|
175
|
+
4. Not to modify this License in any other way.
|
|
176
|
+
|
|
177
|
+
-----------------------------------------------------------------------------
|
|
178
|
+
|
|
179
|
+
Notice
|
|
180
|
+
|
|
181
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
182
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
183
|
+
under an Open Source License, as stated in this License.
|
package/README.md
CHANGED
|
@@ -1,45 +1,242 @@
|
|
|
1
1
|
# @memberjunction/ng-record-clone
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular widgets for cloning a MemberJunction record together with the records it owns: an embeddable clone wizard, a slide-in wrapper around it, and the smaller pieces they are built from (plan tree, values form, review, progress, result, lineage chip).
|
|
4
4
|
|
|
5
|
-
**This package is
|
|
5
|
+
> **Layering note.** This package is UI only. The graph walk, policies, field mapping and writes live on the server in **`@memberjunction/record-cloning`** (engine) and **`@memberjunction/record-cloning-base`** (client-safe contracts). The widgets reach the engine through four MJ remote operations (`RecordClone.Describe`, `.Plan`, `.Execute`, `.GetLineage`) whose typed clients CodeGen emits into `@memberjunction/core-entities`. There is no custom GraphQL resolver. See [`plans/record-cloning/README.md`](../../../../plans/record-cloning/README.md) for the full design.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The package is a widgets-layer (`mjUILayer: "widgets"`) library. It never imports the Router or anything under `packages/Angular/Explorer`; every navigation is an output event the host maps onto its own routing.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
```mermaid
|
|
12
|
+
graph TD
|
|
13
|
+
TB["ng-base-forms<br/>mj-form-toolbar"] -->|ShowCloneButton| SI["mj-record-clone-slide-in"]
|
|
14
|
+
SI --> SP["mj-slide-panel<br/>(ng-ui-components)"]
|
|
15
|
+
SI --> P["mj-record-clone-panel<br/>(embeddable wizard)"]
|
|
16
|
+
P --> SC["mj-clone-scope-controls"]
|
|
17
|
+
P --> PT["mj-clone-plan-tree"]
|
|
18
|
+
P --> V["mj-clone-values"]
|
|
19
|
+
P --> R["mj-clone-review"]
|
|
20
|
+
P --> PR["mj-clone-progress"]
|
|
21
|
+
P --> RS["mj-clone-result"]
|
|
22
|
+
P --> S["RecordCloneService"]
|
|
23
|
+
S -->|remote operations| SRV["MJAPI → record-cloning engine"]
|
|
24
|
+
LC["mj-clone-lineage-chip"] --> S
|
|
25
|
+
```
|
|
15
26
|
|
|
16
|
-
|
|
27
|
+
| Component | Selector | Use it when |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `RecordClonePanelComponent` | `mj-record-clone-panel` | You want the wizard inline: a dialog, a dashboard card, a side pane, a test harness |
|
|
30
|
+
| `RecordCloneSlideInComponent` | `mj-record-clone-slide-in` | You want the standard right-hand slide-in with one element |
|
|
31
|
+
| `CloneLineageChipComponent` | `mj-clone-lineage-chip` | You want a "Cloned from X" / "3 clones" chip with a lineage popover |
|
|
32
|
+
| `RecordCloneService` | — | You want to call the remote operations directly |
|
|
17
33
|
|
|
18
|
-
|
|
34
|
+
The building blocks (`mj-clone-scope-controls`, `mj-clone-plan-tree`, `mj-clone-values`, `mj-clone-review`, `mj-clone-progress`, `mj-clone-result`) are exported for hosts that compose their own flow.
|
|
19
35
|
|
|
20
|
-
##
|
|
36
|
+
## Installation
|
|
21
37
|
|
|
22
|
-
|
|
38
|
+
```bash
|
|
39
|
+
npm install @memberjunction/ng-record-clone
|
|
40
|
+
```
|
|
23
41
|
|
|
24
|
-
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
42
|
+
Every component is standalone. Import the ones you use, or `RecordCloneModule` for all of them.
|
|
28
43
|
|
|
29
|
-
##
|
|
44
|
+
## Usage
|
|
30
45
|
|
|
31
|
-
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
46
|
+
### On entity forms (no code)
|
|
36
47
|
|
|
37
|
-
|
|
48
|
+
`ng-base-forms` hosts the slide-in in the record toolbar. The Clone button appears when all of these hold:
|
|
38
49
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
1. The toolbar config has `ShowCloneButton: true`. It is on in `DEFAULT_TOOLBAR_CONFIG`, `EXPLORER_TOOLBAR_CONFIG` and `CUSTOM_LAYOUT_TOOLBAR_CONFIG`; a form turns it off with `Toolbar: { ShowCloneButton: false }` in its form config.
|
|
51
|
+
2. The entity's `Configuration.Clone.Enabled` is `true` on its `MJ: Entities` record.
|
|
52
|
+
3. `RecordClone.Describe` says the current user may clone it (cached per provider and entity for the session).
|
|
53
|
+
4. The record is saved and the form is in read mode.
|
|
54
|
+
|
|
55
|
+
The toolbar re-emits the clone's navigation requests through its own `Navigate` output as a `RecordNavigationEvent`, so existing form hosts need no changes. It also emits `BeforeClone` (cancellable) and `CloneCompleted`.
|
|
56
|
+
|
|
57
|
+
### Slide-in
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<button (click)="ShowClone = true">Clone</button>
|
|
42
61
|
|
|
43
|
-
|
|
62
|
+
<mj-record-clone-slide-in
|
|
63
|
+
[(Visible)]="ShowClone"
|
|
64
|
+
[Record]="record"
|
|
65
|
+
[Provider]="provider"
|
|
66
|
+
(CloneCompleted)="OnCloned($event)"
|
|
67
|
+
(NavigateToRecord)="OpenRecord($event)">
|
|
68
|
+
</mj-record-clone-slide-in>
|
|
69
|
+
```
|
|
44
70
|
|
|
45
|
-
|
|
71
|
+
```typescript
|
|
72
|
+
import { CompositeKey } from '@memberjunction/core';
|
|
73
|
+
import type { CloneCompletedEvent, CloneNavigationEvent } from '@memberjunction/ng-record-clone';
|
|
74
|
+
|
|
75
|
+
OnCloned(e: CloneCompletedEvent): void {
|
|
76
|
+
console.log(`Created ${e.CreatedRecordsCount} records, log ${e.CloneLogID}`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
OpenRecord(e: CloneNavigationEvent): void {
|
|
80
|
+
const entity = this.provider.EntityByName(e.EntityName);
|
|
81
|
+
this.myNavigation.OpenRecord(e.EntityName, CompositeKey.FromURLSegment(entity, e.RecordKey));
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The slide-in creates the panel on first open and restarts it on every later open, so each open plans against the record's current state. It refuses to close (X, Escape, backdrop, or `Close()`) while a clone is executing.
|
|
86
|
+
|
|
87
|
+
### Embedded panel
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<mj-record-clone-panel
|
|
91
|
+
[EntityName]="'MJ: AI Prompts'"
|
|
92
|
+
[RecordKey]="promptId"
|
|
93
|
+
(StateChange)="State = $event"
|
|
94
|
+
(CloneCompleted)="OnCloned($event)"
|
|
95
|
+
(NavigateToRecord)="OpenRecord($event)"
|
|
96
|
+
(CloseRequested)="HidePanel()">
|
|
97
|
+
</mj-record-clone-panel>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Give the panel a source with `Record`, or with `EntityName` plus `RecordKey`. `RecordKey` accepts a `RecordCloneKey` or a record-id string in compact URL-segment form: a bare value for a single-column key, `Field1|Value1||Field2|Value2` for a composite one. It is parsed with `CompositeKey.FromURLSegment` against the entity's metadata.
|
|
101
|
+
|
|
102
|
+
With `AutoStart` on (the default) the panel describes and plans as soon as it has a source. Set `[AutoStart]="false"` and call `Start()` to control timing.
|
|
103
|
+
|
|
104
|
+
### Lineage chip
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<mj-clone-lineage-chip
|
|
108
|
+
[EntityName]="record.EntityInfo.Name"
|
|
109
|
+
[RecordKey]="record.PrimaryKey.ToURLSegment()"
|
|
110
|
+
(NavigateToRecord)="OpenRecord($event)">
|
|
111
|
+
</mj-clone-lineage-chip>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Renders nothing when the record has no lineage.
|
|
115
|
+
|
|
116
|
+
## Component Reference
|
|
117
|
+
|
|
118
|
+
### `mj-record-clone-panel` — `RecordClonePanelComponent`
|
|
119
|
+
|
|
120
|
+
The wizard: **Scope** (preset, caps, toggles, planned record tree) → **Values** (clone name, prompted fields, retarget pickers, reason) → **Review** (counts, warnings, per-node field diff) → **Executing** → **Done** or **Failed**. An entity that can't be cloned shows the server's reason instead.
|
|
121
|
+
|
|
122
|
+
**Inputs**
|
|
123
|
+
|
|
124
|
+
| Input | Type | Default | Description |
|
|
125
|
+
|---|---|---|---|
|
|
126
|
+
| `Record` | `BaseEntity \| null` | `null` | Record to clone. Supplies the key and entity name when those inputs are not set. |
|
|
127
|
+
| `EntityName` | `string` | — | Source entity, e.g. `'MJ: Users'`. |
|
|
128
|
+
| `RecordKey` | `RecordCloneKey \| string` | — | Source key; see [Embedded panel](#embedded-panel). |
|
|
129
|
+
| `AutoStart` | `boolean` | `true` | Start as soon as a source is set. |
|
|
130
|
+
| `ShowStepTabs` | `boolean` | `true` | Show the Scope / Values / Review tabs. |
|
|
131
|
+
| `Provider` | `IMetadataProvider \| null` | `null` | Inherited from `BaseAngularComponent`; every server call uses it. |
|
|
132
|
+
|
|
133
|
+
**Outputs**
|
|
134
|
+
|
|
135
|
+
| Output | Payload | Fires when |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| `StateChange` | `RecordClonePanelState` | The wizard state changes (`loading`, `scope`, `values`, `review`, `executing`, `done`, `failed`, `not_cloneable`, …). |
|
|
138
|
+
| `StepChange` | `RecordCloneStep` | The active step changes. |
|
|
139
|
+
| `PlanChanged` | `RecordClonePlanDetails` | A plan (re)computation succeeds. |
|
|
140
|
+
| `CloneCompleted` | `CloneCompletedEvent` | The clone commits. The panel also raises the standard BaseEntity `save` / `create` event for the root so open grids refresh. |
|
|
141
|
+
| `CloneFailed` | `CloneFailedEvent` | Describe, plan or execute fails. `ResultCode` carries `PLAN_CHANGED`, `FORBIDDEN`, etc. when the server sent one. |
|
|
142
|
+
| `NavigateToRecord` | `CloneNavigationEvent` | The user opens the new clone or its clone log. Followed by `CloseRequested`. |
|
|
143
|
+
| `CloseRequested` | `void` | The user pressed Close or Cancel. The panel never hides itself. |
|
|
144
|
+
|
|
145
|
+
**Methods and properties**
|
|
146
|
+
|
|
147
|
+
| Member | Description |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `Start(): Promise<void>` | Describe, plan, land on Scope. Calling it again starts over. |
|
|
150
|
+
| `Reset(): Promise<void>` | Clear entered values and start over ("Clone another"). |
|
|
151
|
+
| `Replan(): Promise<void>` | Re-plan with the current `ScopeOptions`. |
|
|
152
|
+
| `GoToStep(step)` | Move to a step. Review is refused while prompted values are invalid, and entering it re-plans with the entered values. |
|
|
153
|
+
| `ExecuteClone(): Promise<void>` | Execute the reviewed plan with its hash. The server refuses with `PLAN_CHANGED` if the graph moved since review. |
|
|
154
|
+
| `CurrentState`, `CurrentStep` | Current wizard position. |
|
|
155
|
+
| `IsBusy` | True while loading or executing. |
|
|
156
|
+
| `ActivePlan`, `DescribeDetails`, `ExecutionResult` | Latest server answers. |
|
|
157
|
+
| `ScopeOptions` | Options sent with every plan and execute. |
|
|
158
|
+
| `TargetRecordKey` | Record-id string of the root clone after success. |
|
|
159
|
+
|
|
160
|
+
**Who can change the scope.** The scope step always shows what the clone will copy, taken from the entity's `Configuration.Clone`, with anything that differs highlighted. Anyone may narrow a plan by switching a Deep branch to Skip in the tree, when the entity's `UserEditable` is `scope` or `all`. A holder of `Clone Records: Override Scope` (the Developer role by default) also gets a Developer overrides section to raise depth or the record cap, include soft links, subtypes or the hierarchy subtree, and switch Skip branches back to Deep. Entity Actions run on the cloned rows by default (AI Actions don't), and the entity's `Hooks` configuration can turn them off. The panel doesn't offer a per-clone override; a caller holding `Clone Records: Fire Hooks` can set `EntityActions` on the `RecordClone.Plan` / `Execute` request. `RecordClone.Describe` returns `CanOverrideScope` and `CanFireHooks`, and the server applies the same rules to every request, ignoring anything a caller isn't allowed with a warning on the plan.
|
|
161
|
+
|
|
162
|
+
**Where the values step gets its fields.** Nothing on the values step is specific to any one entity. The prompted fields come from the entity's `Configuration.Clone.Fields.PromptFor` (for `MJ: Users`: `Email`, `FirstName`, `LastName`). They start empty unless the engine proposed a value, because a prompted field such as a unique Email must not keep the source row's value. The suggested clone name comes from the naming strategy (`Clone.Naming`; by default the name field plus any unique string field). When a prompted field is also a `Clone.Naming.Fields` entry, typing in it keeps the clone name in step until the user edits the name directly. Retarget pickers come from `Clone.UI.RetargetFields`.
|
|
163
|
+
|
|
164
|
+
### `mj-record-clone-slide-in` — `RecordCloneSlideInComponent`
|
|
165
|
+
|
|
166
|
+
**Inputs:** `Visible` (two-way with `VisibleChange`), `Record`, `EntityName`, `RecordKey`, `Title` (default `Clone <entity>`), `WidthPx` (default 720), `ShowStepTabs`, `Provider`.
|
|
167
|
+
|
|
168
|
+
**Outputs:** `VisibleChange`, `Closed`, plus every panel output re-emitted unchanged: `StateChange`, `StepChange`, `PlanChanged`, `CloneCompleted`, `CloneFailed`, `NavigateToRecord`.
|
|
169
|
+
|
|
170
|
+
**Methods:** `Open()`, `Close()` (ignored while executing), `Panel` (the embedded `RecordClonePanelComponent` once opened), `CanCloseGuard` (passed to `mj-slide-panel`).
|
|
171
|
+
|
|
172
|
+
### Building blocks
|
|
173
|
+
|
|
174
|
+
| Component | Inputs | Outputs |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `mj-clone-scope-controls` | `Presets`, `SelectedPreset`, `MaxDepth`, `MaxRecords`, `Subtypes`, `Hierarchy`, `SoftLinks`, `EntityActions`, `ConfiguredScope`, `EntityName`, `CanOverrideScope` | `ScopeChanged: RecordClonePlanOptions`, `ResetToDefaults` |
|
|
177
|
+
| `mj-clone-plan-tree` | `Plan`, `SelectedNodeKey`, `AllowNarrowing`, `AllowWidening` | `NodeSelected: RecordClonePlanNode`, `EdgePolicyChanged: CloneEdgePolicyChange` |
|
|
178
|
+
| `mj-clone-values` | `EntityName`, `RootName`, `NamingStrategyReason`, `PromptedFields`, `PromptedValues`, `RetargetFields`, `Reason` | `RootNameChange`, `PromptedValuesChange`, `RetargetFieldsChange`, `ReasonChange`, `ValidityChange` |
|
|
179
|
+
| `mj-clone-review` | `Plan`, `RootName`, `Reason`, `IsExecuting` | `Confirm`, `Cancel`, `NodeClicked: string` |
|
|
180
|
+
| `mj-clone-progress` | `Progress: CloneProgressUpdate` | — |
|
|
181
|
+
| `mj-clone-result` | `Result`, `EntityName`, `TargetKey`, `RootRecordName` | `OpenClone`, `CloneAnother`, `Close`, `OpenCloneLog`, `NavigateToRecord` |
|
|
182
|
+
| `mj-clone-lineage-chip` | `EntityName`, `RecordKey`, `AutoLoad`, `LineageData` | `NavigateToRecord` |
|
|
183
|
+
|
|
184
|
+
The plan tree also exposes `ExpandAll()` and `CollapseAll()`. The lineage chip exposes `LoadLineage()`, `TogglePopover()` and `ClosePopover()`.
|
|
185
|
+
|
|
186
|
+
### `RecordCloneService`
|
|
187
|
+
|
|
188
|
+
`providedIn: 'root'`. Every method takes an optional `IMetadataProvider`; when it's omitted, the service uses `Metadata.Provider`.
|
|
189
|
+
|
|
190
|
+
| Method | Remote operation | Notes |
|
|
191
|
+
|---|---|---|
|
|
192
|
+
| `DescribeRecord(input, provider?, forceRefresh?)` | `RecordClone.Describe` | Entity-level answers (no `Key`) are cached per provider and entity. Concurrent callers share one request, and failures are not cached. |
|
|
193
|
+
| `PlanClone(input, provider?)` | `RecordClone.Plan` | Dry run; writes nothing. |
|
|
194
|
+
| `ExecuteClone(input, provider?)` | `RecordClone.Execute` | Pass `ExpectedPlanHash` from the reviewed plan. |
|
|
195
|
+
| `GetLineage(input, provider?)` | `RecordClone.GetLineage` | Ancestors and clones of a record. |
|
|
196
|
+
| `ClearDescribeCache(entityName?, provider?)` | — | Drop one entity's cached answer, or all of them. |
|
|
197
|
+
|
|
198
|
+
### Types
|
|
199
|
+
|
|
200
|
+
| Type | Description |
|
|
201
|
+
|---|---|
|
|
202
|
+
| `RecordClonePanelState`, `RecordCloneStep` | Wizard state and step unions. |
|
|
203
|
+
| `CloneScopeValues` | The six scope values the scope step shows and edits. |
|
|
204
|
+
| `CloneEdgePolicyChange` | `{ RelationshipID, Policy }` — a branch the user switched, sent as an edge override. |
|
|
205
|
+
| `CloneCompletedEvent` | `EntityName`, `TargetKey`, `CloneLogID`, `CreatedRecordsCount`, `Result`. |
|
|
206
|
+
| `CloneFailedEvent` | `EntityName`, `Message`, `ResultCode?`. |
|
|
207
|
+
| `CloneNavigationEvent` | `{ Kind: 'record', EntityName, RecordKey }`. `RecordKey` is a record-id string for `CompositeKey.FromURLSegment`. |
|
|
208
|
+
| `ClonePromptFieldItem`, `CloneRetargetFieldItem`, `CloneProgressUpdate`, `CloneTreeNodeViewModel` | View models for the building blocks. |
|
|
209
|
+
| `EntityToRecordCloneKey(record)`, `CompositeKeyToRecordCloneKey(key)`, `RecordCloneKeyToString(key)` | Key helpers that keep every primary key column. |
|
|
210
|
+
|
|
211
|
+
## Key Design Patterns
|
|
212
|
+
|
|
213
|
+
- **Events out, never routing.** Components emit `CloneNavigationEvent`, `CloseRequested` and friends. The base-forms toolbar turns navigation into its own `Navigate` output; Explorer's form host routes it from there.
|
|
214
|
+
- **Server is the gate.** The UI hides what the server says the user can't do, but `Describe`, `Plan` and `Execute` re-check every permission, cap and lock on the server.
|
|
215
|
+
- **Plan hash.** `Execute` carries the reviewed plan's hash, so a graph that changed after review is refused with `PLAN_CHANGED` rather than cloned blind.
|
|
216
|
+
- **Theming.** Styles use MJ semantic tokens only (`--mj-bg-surface`, `--mj-border-default`, `--mj-text-*`, `--mj-status-*`, `--mj-space-*`, `--mj-radius-*`), so light, dark and custom themes apply without overrides.
|
|
217
|
+
- **Multi-provider.** Every component extends `BaseAngularComponent` or takes a provider, and the service never assumes the global provider when one is given.
|
|
218
|
+
|
|
219
|
+
## Dependencies
|
|
220
|
+
|
|
221
|
+
| Package | Why |
|
|
222
|
+
|---|---|
|
|
223
|
+
| `@memberjunction/core` | `BaseEntity`, `CompositeKey`, `IMetadataProvider` |
|
|
224
|
+
| `@memberjunction/core-entities` | Generated remote-operation clients and their input/output types |
|
|
225
|
+
| `@memberjunction/global` | Event bus for the post-clone `save` event |
|
|
226
|
+
| `@memberjunction/ng-base-types` | `BaseAngularComponent` (provider plumbing) |
|
|
227
|
+
| `@memberjunction/ng-ui-components` | `mj-slide-panel`, `mj-tab-nav`, `mj-switch`, `mjButton` |
|
|
228
|
+
|
|
229
|
+
Peer dependencies: `@angular/core`, `@angular/common`, `@angular/forms`.
|
|
230
|
+
|
|
231
|
+
## Build
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
cd packages/Angular/Generic/record-clone
|
|
235
|
+
npm run build # ngc
|
|
236
|
+
npm test # vitest (DOM + unit)
|
|
237
|
+
npm run test:types # type-check the specs
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
BUSL-1.1
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Compact lineage chip and history popover component.
|
|
3
|
+
*
|
|
4
|
+
* Implements §12.3 of the Record Cloning architectural blueprint. Surfaces origin
|
|
5
|
+
* and clone lineage metadata ("Cloned from <name>" or "<n> clones"). Clicking opens
|
|
6
|
+
* a popover listing ancestral origins and descendant clones with safe navigation links.
|
|
7
|
+
*/
|
|
8
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
9
|
+
import type { RecordCloneKey, RecordCloneGetLineageOutput, RecordCloneLineageItem } from '@memberjunction/core-entities';
|
|
10
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
11
|
+
import { type CloneNavigationEvent } from './record-clone-types';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
export declare class CloneLineageChipComponent extends BaseAngularComponent implements OnInit {
|
|
14
|
+
private cloneService;
|
|
15
|
+
private cdr;
|
|
16
|
+
/** Entity of the record whose lineage to show. */
|
|
17
|
+
EntityName: string;
|
|
18
|
+
/** Key of the record: a RecordCloneKey or a record-id string (`CompositeKey.FromURLSegment` form). */
|
|
19
|
+
RecordKey: RecordCloneKey | string;
|
|
20
|
+
/** Load lineage on init. Set false and call `LoadLineage()` to control timing. */
|
|
21
|
+
AutoLoad: boolean;
|
|
22
|
+
/** Pre-loaded lineage; skips the server call when set. */
|
|
23
|
+
LineageData: RecordCloneGetLineageOutput | null;
|
|
24
|
+
/** Asks the host to open an ancestor or clone from the popover. */
|
|
25
|
+
NavigateToRecord: EventEmitter<CloneNavigationEvent>;
|
|
26
|
+
IsOpen: boolean;
|
|
27
|
+
IsLoading: boolean;
|
|
28
|
+
get SourceRecord(): RecordCloneLineageItem | undefined;
|
|
29
|
+
get Ancestors(): RecordCloneLineageItem[] | undefined;
|
|
30
|
+
get Clones(): RecordCloneLineageItem[] | undefined;
|
|
31
|
+
get HasLineage(): boolean;
|
|
32
|
+
get ChipIcon(): string;
|
|
33
|
+
get ChipLabel(): string;
|
|
34
|
+
get ChipTooltip(): string;
|
|
35
|
+
ngOnInit(): Promise<void>;
|
|
36
|
+
LoadLineage(): Promise<void>;
|
|
37
|
+
private static nextId;
|
|
38
|
+
/** Ties the chip's aria-controls to its popover. */
|
|
39
|
+
readonly PopoverId: string;
|
|
40
|
+
private chipTrigger?;
|
|
41
|
+
private closeButton?;
|
|
42
|
+
TogglePopover(): void;
|
|
43
|
+
/** Closes the popover; `returnFocus` puts focus back on the chip (Escape, the close button). */
|
|
44
|
+
ClosePopover(returnFocus?: boolean): void;
|
|
45
|
+
OnEscape(event: Event): void;
|
|
46
|
+
OnNavigate(item: RecordCloneLineageItem): void;
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CloneLineageChipComponent, never>;
|
|
48
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CloneLineageChipComponent, "mj-clone-lineage-chip", never, { "EntityName": { "alias": "EntityName"; "required": false; }; "RecordKey": { "alias": "RecordKey"; "required": false; }; "AutoLoad": { "alias": "AutoLoad"; "required": false; }; "LineageData": { "alias": "LineageData"; "required": false; }; }, { "NavigateToRecord": "NavigateToRecord"; }, never, never, true, never>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=clone-lineage-chip.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone-lineage-chip.component.d.ts","sourceRoot":"","sources":["../../src/lib/clone-lineage-chip.component.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKH,YAAY,EACZ,MAAM,EAKT,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACR,cAAc,EACd,2BAA2B,EAC3B,sBAAsB,EACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAgC,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;;AAE/F,qBAmSa,yBAA0B,SAAQ,oBAAqB,YAAW,MAAM;IACjF,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,GAAG,CAA6B;IAExC,kDAAkD;IACzC,UAAU,SAAM;IACzB,sGAAsG;IAC7F,SAAS,EAAE,cAAc,GAAG,MAAM,CAAM;IACjD,kFAAkF;IACzE,QAAQ,UAAQ;IACzB,0DAA0D;IACjD,WAAW,EAAE,2BAA2B,GAAG,IAAI,CAAQ;IAEhE,mEAAmE;IACzD,gBAAgB,qCAA4C;IAE/D,MAAM,UAAS;IACf,SAAS,UAAS;IAEzB,IAAW,YAAY,IAAI,sBAAsB,GAAG,SAAS,CAG5D;IAED,IAAW,SAAS,IAAI,sBAAsB,EAAE,GAAG,SAAS,CAE3D;IAED,IAAW,MAAM,IAAI,sBAAsB,EAAE,GAAG,SAAS,CAExD;IAED,IAAW,UAAU,IAAI,OAAO,CAE/B;IAED,IAAW,QAAQ,IAAI,MAAM,CAK5B;IAED,IAAW,SAAS,IAAI,MAAM,CAQ7B;IAED,IAAW,WAAW,IAAI,MAAM,CAK/B;IAEY,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAMzB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAK;IAC1B,oDAAoD;IACpD,SAAgB,SAAS,SAA4D;IAC3D,OAAO,CAAC,WAAW,CAAC,CAAgC;IACpD,OAAO,CAAC,WAAW,CAAC,CAAgC;IAEvE,aAAa,IAAI,IAAI;IAO5B,gGAAgG;IACzF,YAAY,CAAC,WAAW,UAAQ,GAAG,IAAI;IAMvC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAM5B,UAAU,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI;yCAtH5C,yBAAyB;2CAAzB,yBAAyB;CA+HrC"}
|