@tridion-docs/extensions 1.0.4 → 2.0.0
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/CHANGELOG.md +12 -2
- package/LICENSE.md +1 -1
- package/README.md +77 -8
- package/dist/api/hooks/itemSelector.d.ts +7 -0
- package/dist/api/typings/BaseFolder.d.ts +5 -5
- package/dist/api/typings/BaseFolder.js +5 -5
- package/dist/api/typings/BaseObject.d.ts +18 -0
- package/dist/api/typings/Content.d.ts +2 -20
- package/dist/api/typings/DocumentObjectType.d.ts +6 -6
- package/dist/api/typings/DocumentObjectType.js +6 -6
- package/dist/api/typings/FolderType.d.ts +8 -8
- package/dist/api/typings/FolderType.js +8 -8
- package/dist/api/typings/Project.d.ts +11 -0
- package/dist/api/typings/PublicationObjectType.d.ts +1 -1
- package/dist/api/typings/PublicationObjectType.js +9 -0
- package/dist/api/typings/ViewType.d.ts +3 -1
- package/dist/api/typings/ViewType.js +2 -0
- package/dist/api/typings/index.d.ts +3 -0
- package/dist/extensionPoints/action/actionExtensions.d.ts +1 -1
- package/dist/extensionPoints/action/actionExtensionsBuilder.d.ts +1 -1
- package/dist/extensionPoints/action/explorerAction.d.ts +18 -9
- package/dist/extensionPoints/objectInsight/objectInsightExtensions.d.ts +1 -1
- package/dist/extensionPoints/objectInsight/objectInsightExtensionsBuilder.d.ts +1 -1
- package/dist/extensionPoints/objectInsight/objectInsightItem.d.ts +13 -9
- package/dist/index.js +1 -0
- package/dist/package.json.js +5 -5
- package/package.json +21 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
# @tridion-docs/extensions
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Added zIndex property to an useItemSelector hook
|
|
8
|
+
- Updated package dependencies
|
|
9
|
+
- Fixed export for ItemSelectorObjectType and PublicationObjectType
|
|
10
|
+
- Added support for Publication Hub
|
|
11
|
+
- Updated types to support Nswag
|
|
12
|
+
|
|
3
13
|
## 1.0.4
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
6
16
|
|
|
7
|
-
-
|
|
17
|
+
- For useNotification hook optional property area for adding action button is added
|
|
8
18
|
|
|
9
19
|
## 1.0.3
|
|
10
20
|
|
|
11
21
|
### Major Changes
|
|
12
22
|
|
|
13
|
-
-
|
|
23
|
+
- Tridion Docs extensions for Organize Space
|
package/LICENSE.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
License: https://www.rws.com/legal/terms-and-conditions/rws-technology/
|
|
2
|
-
Copyright
|
|
2
|
+
Copyright © 2024 RWS Holdings plc including its subsidiaries and affiliated companies. All rights reserved.
|
package/README.md
CHANGED
|
@@ -5,11 +5,42 @@ This project contains the helper function, components and hooks for working wit
|
|
|
5
5
|
# License
|
|
6
6
|
License: https://www.rws.com/legal/terms-and-conditions/rws-technology/
|
|
7
7
|
|
|
8
|
-
Copyright
|
|
8
|
+
Copyright © 2024 RWS Holdings plc including its subsidiaries and affiliated companies. All rights reserved.
|
|
9
9
|
|
|
10
10
|
# Compatibility
|
|
11
11
|
|
|
12
|
-
This version of the package is compatible with Tridion Docs 15.
|
|
12
|
+
This version of the package is compatible with Tridion Docs 15.1
|
|
13
|
+
|
|
14
|
+
# Upgrade instruction
|
|
15
|
+
|
|
16
|
+
## Packages
|
|
17
|
+
To use latest version of extension and extension-cli you need to update versions of package.json in your extension application.
|
|
18
|
+
|
|
19
|
+
You need to update versions of these two packages `@tridion-docs/extensions` and `@tridion-docs/extensions-cli`. We also recommend you to keep all other dependencies up to date. You can find examples of packages and their versions in package.json of extension-example application available on CD.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
"dependencies": {
|
|
23
|
+
...
|
|
24
|
+
"@tridion-docs/extensions": "2.0.0",
|
|
25
|
+
...
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
...
|
|
29
|
+
"@tridion-docs/extensions-cli": "2.0.0",
|
|
30
|
+
...
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
## Enums
|
|
34
|
+
|
|
35
|
+
`BaseFolder`, `DocumentObjectType`, `FolderType`, `PublicationObjectType` enums keys were changed from UPPERCASE to PascalCase.
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
// before
|
|
39
|
+
BaseFolder.EDITOR_TEMPLATE
|
|
40
|
+
|
|
41
|
+
// after
|
|
42
|
+
BaseFolder.EditorTemplate
|
|
43
|
+
```
|
|
13
44
|
|
|
14
45
|
# Documentation
|
|
15
46
|
|
|
@@ -107,11 +138,11 @@ export const useCustomHook = () => {
|
|
|
107
138
|
|
|
108
139
|
const itemSelectorProps = {
|
|
109
140
|
objectTypesToSelect: [
|
|
110
|
-
DocumentObjectType.
|
|
111
|
-
DocumentObjectType.
|
|
112
|
-
DocumentObjectType.
|
|
113
|
-
DocumentObjectType.
|
|
114
|
-
DocumentObjectType.
|
|
141
|
+
DocumentObjectType.Illustration,
|
|
142
|
+
DocumentObjectType.Library,
|
|
143
|
+
DocumentObjectType.Map,
|
|
144
|
+
DocumentObjectType.Other,
|
|
145
|
+
DocumentObjectType.Topic,
|
|
115
146
|
],
|
|
116
147
|
isMultiSelect: false,
|
|
117
148
|
onOk: async (values: Content[]) => {
|
|
@@ -138,6 +169,7 @@ export const useCustomHook = () => {
|
|
|
138
169
|
`onOk` | `function` | Function that will be called when a user clicks the OK button
|
|
139
170
|
`okLabel` | `string` | Label of the 'Ok' button
|
|
140
171
|
`cancelLabel` | `string` | Label of the 'Cancel' button
|
|
172
|
+
`modalZindex` | `number` | Property to set z-index property on the item selector modal
|
|
141
173
|
|
|
142
174
|
|
|
143
175
|
**Return**
|
|
@@ -460,7 +492,10 @@ builder.header.addMainNavigationLink(() => ({
|
|
|
460
492
|
`component` | `ComponentType` | Component that will be rendered after mouse click
|
|
461
493
|
|
|
462
494
|
## Action
|
|
463
|
-
Custom action button that might be used for executing custom logic for selected items.Registration of new navigation items is required to call the builder function `builder.header.builder.action.addExplorerAction
|
|
495
|
+
Custom action button that might be used for executing custom logic for selected items. Registration of new navigation items is required to call the builder function `builder.header.builder.action.addExplorerAction`.
|
|
496
|
+
|
|
497
|
+
`addExplorerAction` supports generic type definition, so we specify expected selected object type [more about generics](#generic-types).
|
|
498
|
+
|
|
464
499
|
|
|
465
500
|
```typescript jsx
|
|
466
501
|
|
|
@@ -474,6 +509,19 @@ builder.action.addExplorerAction(() => ({
|
|
|
474
509
|
icon: CustomIcon,
|
|
475
510
|
hook: useCustomHook,
|
|
476
511
|
}));
|
|
512
|
+
|
|
513
|
+
/* if we expect type other than `Content` we can define it here */
|
|
514
|
+
import { Project, ViewType } from '@tridion-docs/extensions';
|
|
515
|
+
builder.action.addExplorerAction<Project>(() => ({
|
|
516
|
+
id: 'id',
|
|
517
|
+
title: 'title',
|
|
518
|
+
tooltip: '',
|
|
519
|
+
isVisible: ({ activeView }) => {
|
|
520
|
+
return activeView === ViewType.project;
|
|
521
|
+
},
|
|
522
|
+
icon: CustomIcon,
|
|
523
|
+
hook: useCustomHook,
|
|
524
|
+
}));
|
|
477
525
|
```
|
|
478
526
|
|
|
479
527
|
**Props**
|
|
@@ -490,6 +538,7 @@ builder.action.addExplorerAction(() => ({
|
|
|
490
538
|
## Object Insight
|
|
491
539
|
The object right side panel is representing a custom data view for one or multiple selected items. Registration of new object insight is required to call the builder function `builder.objectInsight.addObjectInsightItem`
|
|
492
540
|
|
|
541
|
+
`addObjectInsightItem` supports generic type definition, so we specify expected selected object type [more about generics](#generic-types).
|
|
493
542
|
```typescript jsx
|
|
494
543
|
builder.objectInsight.addObjectInsightItem(() => ({
|
|
495
544
|
id: 'id',
|
|
@@ -501,6 +550,17 @@ builder.objectInsight.addObjectInsightItem(() => ({
|
|
|
501
550
|
component: CustomComponent,
|
|
502
551
|
}));
|
|
503
552
|
|
|
553
|
+
/* if we expect type other than `Content` we can define it here */
|
|
554
|
+
builder.objectInsight.addObjectInsightItem<Project>(() => ({
|
|
555
|
+
id: 'id',
|
|
556
|
+
tooltip: 'tooltip',
|
|
557
|
+
isVisible: (props) => {
|
|
558
|
+
return false;
|
|
559
|
+
},
|
|
560
|
+
icon: CustomIcon,
|
|
561
|
+
component: CustomComponent,
|
|
562
|
+
}));
|
|
563
|
+
|
|
504
564
|
```
|
|
505
565
|
|
|
506
566
|
|
|
@@ -530,6 +590,13 @@ builder.objectInsight.addObjectInsightItem(() => ({
|
|
|
530
590
|
`item` | `string` | Id of the navigation item that will be used for positioning. Default navigation items ('content', 'events', 'settings'), also you can use a previously added custom navigation items id
|
|
531
591
|
`PositioningType` | `PositioningType`| `string` | Indicate where should be located navigation item relative to previously selected item (`after` or `before`)
|
|
532
592
|
|
|
593
|
+
### Generic types
|
|
594
|
+
As far as we're supporting extensions in different areas like Publication Hub and Content Explorer hooks or components will operate with different types of input parameters. It doesn't not affect the API of the function but it will affect the types of arguments. For example, if we define action in Project or Project assignees in "Publication hub" we will get a `Project` type object instead of `Content` type. To support this case we introduced a generic type for some of the functions like `addExplorerAction` where you may specify the expected type of the active objects.
|
|
595
|
+
|
|
596
|
+
The default type is `Content`. That means `addExplorerAction<Content>()` and `addExplorerAction()` are equal code blocks.
|
|
597
|
+
|
|
598
|
+
[More about typescript generics](https://www.typescriptlang.org/docs/handbook/2/generics.html)
|
|
599
|
+
|
|
533
600
|
|
|
534
601
|
## Translations
|
|
535
602
|
Translation records can be registered per language by using the function `builder.translations.addTranslation`
|
|
@@ -546,6 +613,7 @@ Translation records can be registered per language by using the function `builde
|
|
|
546
613
|
//....
|
|
547
614
|
```
|
|
548
615
|
|
|
616
|
+
|
|
549
617
|
### Usage
|
|
550
618
|
Import ```t``` function returned by ```createExtensionGlobals``` and pass it the translation key.
|
|
551
619
|
|
|
@@ -560,6 +628,7 @@ Import ```t``` function returned by ```createExtensionGlobals``` and pass it the
|
|
|
560
628
|
| Deutsch | `de` |
|
|
561
629
|
| Spanish | `es` |
|
|
562
630
|
| French | `fr` |
|
|
631
|
+
| French (Canada) | `fr-CA` |
|
|
563
632
|
| Italian | `it` |
|
|
564
633
|
| Japanese | `ja` |
|
|
565
634
|
| Chinese (Simplified) | `zh` |
|
|
@@ -43,6 +43,13 @@ export interface ItemSelectorProps {
|
|
|
43
43
|
* @memberof ItemSelectorProps
|
|
44
44
|
*/
|
|
45
45
|
cancelLabel: string;
|
|
46
|
+
/**
|
|
47
|
+
* Property to set z-index property on the item selector modal.
|
|
48
|
+
*
|
|
49
|
+
* @type {number}
|
|
50
|
+
* @memberof ItemSelectorProps
|
|
51
|
+
*/
|
|
52
|
+
modalZindex?: number;
|
|
46
53
|
}
|
|
47
54
|
export type ItemSelectorHook = (props: ItemSelectorProps) => ItemSelectorHookResult;
|
|
48
55
|
/**
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Enumeration holding all base folders.
|
|
3
3
|
*/
|
|
4
4
|
export declare enum BaseFolder {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
None = "none",
|
|
6
|
+
Data = "data",
|
|
7
|
+
System = "system",
|
|
8
|
+
Favorites = "favorites",
|
|
9
|
+
EditorTemplate = "editorTemplate"
|
|
10
10
|
}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
var BaseFolder;
|
|
5
5
|
(function (BaseFolder) {
|
|
6
|
-
BaseFolder["
|
|
7
|
-
BaseFolder["
|
|
8
|
-
BaseFolder["
|
|
9
|
-
BaseFolder["
|
|
10
|
-
BaseFolder["
|
|
6
|
+
BaseFolder["None"] = "none";
|
|
7
|
+
BaseFolder["Data"] = "data";
|
|
8
|
+
BaseFolder["System"] = "system";
|
|
9
|
+
BaseFolder["Favorites"] = "favorites";
|
|
10
|
+
BaseFolder["EditorTemplate"] = "editorTemplate";
|
|
11
11
|
})(BaseFolder || (BaseFolder = {}));
|
|
12
12
|
|
|
13
13
|
export { BaseFolder };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface BaseObject {
|
|
2
|
+
/**
|
|
3
|
+
* The identifier.
|
|
4
|
+
*/
|
|
5
|
+
id?: string;
|
|
6
|
+
/**
|
|
7
|
+
* The title.
|
|
8
|
+
*/
|
|
9
|
+
title?: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* The description.
|
|
12
|
+
*/
|
|
13
|
+
description?: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* The type of the current object.
|
|
16
|
+
*/
|
|
17
|
+
type: string;
|
|
18
|
+
}
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import { BaseFolder, DocumentObjectType, FolderType } from "..";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The identifier.
|
|
5
|
-
*/
|
|
6
|
-
id?: string;
|
|
7
|
-
/**
|
|
8
|
-
* The title.
|
|
9
|
-
*/
|
|
10
|
-
title?: string | null;
|
|
11
|
-
/**
|
|
12
|
-
* The description.
|
|
13
|
-
*/
|
|
14
|
-
description?: string | null;
|
|
15
|
-
/**
|
|
16
|
-
* The type of the current object.
|
|
17
|
-
*/
|
|
18
|
-
type: string;
|
|
19
|
-
}
|
|
2
|
+
import { BaseObject } from './BaseObject';
|
|
20
3
|
export interface DocumentObject extends BaseObject {
|
|
21
4
|
/**
|
|
22
5
|
* The document object type.
|
|
@@ -55,7 +38,7 @@ export interface Folder extends BaseObject {
|
|
|
55
38
|
/**
|
|
56
39
|
* The type of the base folder (e.g. Data, System, Favorites, EditorTemplate).
|
|
57
40
|
*/
|
|
58
|
-
baseFolder?: BaseFolder
|
|
41
|
+
baseFolder?: BaseFolder;
|
|
59
42
|
}
|
|
60
43
|
export interface Publication extends BaseObject {
|
|
61
44
|
/**
|
|
@@ -84,4 +67,3 @@ export interface Publication extends BaseObject {
|
|
|
84
67
|
languageCombinationIds?: Array<string> | null;
|
|
85
68
|
}
|
|
86
69
|
export type Content = DocumentObject | Folder | Publication;
|
|
87
|
-
export {};
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Enumeration holding the type of document.
|
|
3
3
|
*/
|
|
4
4
|
export declare enum DocumentObjectType {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
Undefined = "undefined",
|
|
6
|
+
Illustration = "illustration",
|
|
7
|
+
Library = "library",
|
|
8
|
+
Map = "map",
|
|
9
|
+
Other = "other",
|
|
10
|
+
Topic = "topic"
|
|
11
11
|
}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
var DocumentObjectType;
|
|
5
5
|
(function (DocumentObjectType) {
|
|
6
|
-
DocumentObjectType["
|
|
7
|
-
DocumentObjectType["
|
|
8
|
-
DocumentObjectType["
|
|
9
|
-
DocumentObjectType["
|
|
10
|
-
DocumentObjectType["
|
|
11
|
-
DocumentObjectType["
|
|
6
|
+
DocumentObjectType["Undefined"] = "undefined";
|
|
7
|
+
DocumentObjectType["Illustration"] = "illustration";
|
|
8
|
+
DocumentObjectType["Library"] = "library";
|
|
9
|
+
DocumentObjectType["Map"] = "map";
|
|
10
|
+
DocumentObjectType["Other"] = "other";
|
|
11
|
+
DocumentObjectType["Topic"] = "topic";
|
|
12
12
|
})(DocumentObjectType || (DocumentObjectType = {}));
|
|
13
13
|
|
|
14
14
|
export { DocumentObjectType };
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Enumeration holding the type of a folder.
|
|
3
3
|
*/
|
|
4
4
|
export declare enum FolderType {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
Folder = "folder",
|
|
6
|
+
IllustrationFolder = "illustrationFolder",
|
|
7
|
+
LibraryFolder = "libraryFolder",
|
|
8
|
+
MapFolder = "mapFolder",
|
|
9
|
+
OtherFolder = "otherFolder",
|
|
10
|
+
PublicationFolder = "publicationFolder",
|
|
11
|
+
ReferenceFolder = "referenceFolder",
|
|
12
|
+
TopicFolder = "topicFolder"
|
|
13
13
|
}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
var FolderType;
|
|
5
5
|
(function (FolderType) {
|
|
6
|
-
FolderType["
|
|
7
|
-
FolderType["
|
|
8
|
-
FolderType["
|
|
9
|
-
FolderType["
|
|
10
|
-
FolderType["
|
|
11
|
-
FolderType["
|
|
12
|
-
FolderType["
|
|
13
|
-
FolderType["
|
|
6
|
+
FolderType["Folder"] = "folder";
|
|
7
|
+
FolderType["IllustrationFolder"] = "illustrationFolder";
|
|
8
|
+
FolderType["LibraryFolder"] = "libraryFolder";
|
|
9
|
+
FolderType["MapFolder"] = "mapFolder";
|
|
10
|
+
FolderType["OtherFolder"] = "otherFolder";
|
|
11
|
+
FolderType["PublicationFolder"] = "publicationFolder";
|
|
12
|
+
FolderType["ReferenceFolder"] = "referenceFolder";
|
|
13
|
+
FolderType["TopicFolder"] = "topicFolder";
|
|
14
14
|
})(FolderType || (FolderType = {}));
|
|
15
15
|
|
|
16
16
|
export { FolderType };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseObject } from './BaseObject';
|
|
2
|
+
export interface Project extends BaseObject {
|
|
3
|
+
/** The element name of the project. */
|
|
4
|
+
projectId?: string;
|
|
5
|
+
/** The CardId of the Assignee (if available). */
|
|
6
|
+
assigneeCardId?: number | null;
|
|
7
|
+
/** The title of the publication. */
|
|
8
|
+
publicationTitle?: string | null;
|
|
9
|
+
/** The version number of the publication version. */
|
|
10
|
+
publicationVersion?: string | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumeration holding the type of publication.
|
|
3
|
+
*/
|
|
4
|
+
var PublicationObjectType;
|
|
5
|
+
(function (PublicationObjectType) {
|
|
6
|
+
PublicationObjectType["Publication"] = "publication";
|
|
7
|
+
})(PublicationObjectType || (PublicationObjectType = {}));
|
|
8
|
+
|
|
9
|
+
export { PublicationObjectType };
|
|
@@ -10,6 +10,8 @@ var ViewType;
|
|
|
10
10
|
ViewType["details"] = "Details";
|
|
11
11
|
ViewType["search"] = "Search";
|
|
12
12
|
ViewType["inbox"] = "Inbox";
|
|
13
|
+
ViewType["project"] = "Project";
|
|
14
|
+
ViewType["projectAssignee"] = "ProjectAssignee";
|
|
13
15
|
})(ViewType || (ViewType = {}));
|
|
14
16
|
|
|
15
17
|
export { ViewType };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './Content';
|
|
2
|
+
export * from './Project';
|
|
2
3
|
export * from './BaseFolder';
|
|
3
4
|
export * from './DocumentObjectType';
|
|
4
5
|
export * from './FolderType';
|
|
@@ -11,3 +12,5 @@ export * from './FrontendAddon';
|
|
|
11
12
|
export * from './FrontendAddons';
|
|
12
13
|
export * from './Hierarchy';
|
|
13
14
|
export * from './UserInfo';
|
|
15
|
+
export * from './ItemSelectorObjectType';
|
|
16
|
+
export * from './PublicationObjectType';
|
|
@@ -2,6 +2,6 @@ import { ActionExtensions } from './actionExtensions';
|
|
|
2
2
|
import { ExplorerActionExtension } from './explorerAction';
|
|
3
3
|
export declare class ActionExtensionsBuilder {
|
|
4
4
|
private _explorerActionExtensions;
|
|
5
|
-
addExplorerAction: (item: ExplorerActionExtension) => this;
|
|
5
|
+
addExplorerAction: <T>(item: ExplorerActionExtension<T>) => this;
|
|
6
6
|
build: () => ActionExtensions;
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Content, Folder, ViewType, UserInfo } from "../../api";
|
|
2
|
-
export type ExplorerActionExtension = () => ExplorerActionExtensionConfiguration
|
|
3
|
-
export interface ExplorerActionExtensionConfiguration {
|
|
3
|
+
export type ExplorerActionExtension<T> = () => ExplorerActionExtensionConfiguration<T>;
|
|
4
|
+
export interface ExplorerActionExtensionConfiguration<T = Content> {
|
|
4
5
|
/**
|
|
5
6
|
* Action id (should be unique)
|
|
6
7
|
*
|
|
@@ -31,15 +32,15 @@ export interface ExplorerActionExtensionConfiguration {
|
|
|
31
32
|
*
|
|
32
33
|
* @type {(props: ExplorerActionExtensionVisibilityConfiguration) => boolean}
|
|
33
34
|
*/
|
|
34
|
-
readonly isVisible?: (props: ExplorerActionExtensionVisibilityConfiguration) => boolean;
|
|
35
|
+
readonly isVisible?: (props: ExplorerActionExtensionVisibilityConfiguration<T>) => boolean;
|
|
35
36
|
/**
|
|
36
37
|
* Hook to place on action button
|
|
37
38
|
*
|
|
38
39
|
* @memberof ExplorerActionExtensionConfiguration
|
|
39
40
|
*/
|
|
40
|
-
readonly hook: (props: ExplorerActionExtensionHookConfiguration) => ExplorerActionExtensionHookResults;
|
|
41
|
+
readonly hook: (props: ExplorerActionExtensionHookConfiguration<T>) => ExplorerActionExtensionHookResults;
|
|
41
42
|
}
|
|
42
|
-
export interface ExplorerActionExtensionVisibilityConfiguration extends ExplorerActionExtensionBaseConfiguration {
|
|
43
|
+
export interface ExplorerActionExtensionVisibilityConfiguration<T = Content> extends ExplorerActionExtensionBaseConfiguration<T> {
|
|
43
44
|
/**
|
|
44
45
|
* Indicates in which part of the UI explorer action is visible
|
|
45
46
|
*
|
|
@@ -63,6 +64,13 @@ export type ExplorerActionExtensionHookResults = {
|
|
|
63
64
|
* @memberof ExplorerActionExtensionHookResults
|
|
64
65
|
*/
|
|
65
66
|
readonly isAvailable: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Return true if you want to switch the button to the loading state. Loading state changing icon to the spinner and disables the button
|
|
69
|
+
*
|
|
70
|
+
* @type {boolean}
|
|
71
|
+
* @memberof ExplorerActionExtensionHookResults
|
|
72
|
+
*/
|
|
73
|
+
readonly isLoading?: boolean;
|
|
66
74
|
/**
|
|
67
75
|
* Method that is called when the action is clicked
|
|
68
76
|
*
|
|
@@ -71,21 +79,22 @@ export type ExplorerActionExtensionHookResults = {
|
|
|
71
79
|
*/
|
|
72
80
|
readonly execute: () => void | Promise<void>;
|
|
73
81
|
};
|
|
74
|
-
export interface ExplorerActionExtensionHookConfiguration extends ExplorerActionExtensionBaseConfiguration {
|
|
82
|
+
export interface ExplorerActionExtensionHookConfiguration<T = Content> extends ExplorerActionExtensionBaseConfiguration<T> {
|
|
75
83
|
}
|
|
76
84
|
/**
|
|
77
85
|
* Base properties for visibility and hook
|
|
78
86
|
*
|
|
79
87
|
* @interface ExplorerActionExtensionBaseConfiguration
|
|
88
|
+
* @typeParam T - type of active item, `Content` is default type
|
|
80
89
|
*/
|
|
81
|
-
interface ExplorerActionExtensionBaseConfiguration {
|
|
90
|
+
interface ExplorerActionExtensionBaseConfiguration<T = Content> {
|
|
82
91
|
/**
|
|
83
92
|
* The currently selected items inside the Explorer
|
|
84
93
|
*
|
|
85
|
-
* @type {
|
|
94
|
+
* @type {T[]}
|
|
86
95
|
* @memberof ExplorerActionExtensionBaseConfiguration
|
|
87
96
|
*/
|
|
88
|
-
readonly selectedItems:
|
|
97
|
+
readonly selectedItems: T[];
|
|
89
98
|
/**
|
|
90
99
|
* Folder we are currently in
|
|
91
100
|
*
|
|
@@ -2,6 +2,6 @@ import { ObjectInsightExtensions } from './objectInsightExtensions';
|
|
|
2
2
|
import { ObjectInsightItemExtension } from './objectInsightItem';
|
|
3
3
|
export declare class ObjectInsightExtensionsBuilder {
|
|
4
4
|
private _objectInsightItemExtensions;
|
|
5
|
-
addObjectInsightItem: (item: ObjectInsightItemExtension) => this;
|
|
5
|
+
addObjectInsightItem: <T>(item: ObjectInsightItemExtension<T>) => this;
|
|
6
6
|
build: () => ObjectInsightExtensions;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Content, Folder, UserInfo, ViewType } from "../../api";
|
|
2
2
|
import type { ComponentType } from 'react';
|
|
3
|
-
export type ObjectInsightItemExtension = () => ObjectInsightItemExtensionConfiguration
|
|
4
|
-
export interface ObjectInsightItemExtensionConfiguration {
|
|
3
|
+
export type ObjectInsightItemExtension<T> = () => ObjectInsightItemExtensionConfiguration<T>;
|
|
4
|
+
export interface ObjectInsightItemExtensionConfiguration<T = Content> {
|
|
5
5
|
/**
|
|
6
6
|
* Object Insight item id (should be unique)
|
|
7
7
|
*
|
|
@@ -26,22 +26,23 @@ export interface ObjectInsightItemExtensionConfiguration {
|
|
|
26
26
|
*
|
|
27
27
|
* @type {(props: ObjectInsightItemExtensionsVisibilityConfiguration) => boolean}
|
|
28
28
|
*/
|
|
29
|
-
readonly isVisible?: (props: ObjectInsightItemExtensionsVisibilityConfiguration) => boolean;
|
|
29
|
+
readonly isVisible?: (props: ObjectInsightItemExtensionsVisibilityConfiguration<T>) => boolean;
|
|
30
30
|
/**
|
|
31
31
|
* Menu item component to render on this path
|
|
32
32
|
*
|
|
33
33
|
* @type {ComponentType}
|
|
34
34
|
* @memberof ObjectInsightItemExtensionConfiguration
|
|
35
35
|
*/
|
|
36
|
-
readonly component: ComponentType<ObjectInsightItemExtensionComponentConfiguration
|
|
36
|
+
readonly component: ComponentType<ObjectInsightItemExtensionComponentConfiguration<T>>;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Component properties in object insight panel
|
|
40
40
|
*
|
|
41
41
|
* @export
|
|
42
42
|
* @interface ObjectInsightItemExtensionComponentConfiguration
|
|
43
|
+
* @typeParam T - type of active item, default value is Content
|
|
43
44
|
*/
|
|
44
|
-
export interface ObjectInsightItemExtensionComponentConfiguration extends ObjectInsightItemExtensionBaseConfiguration {
|
|
45
|
+
export interface ObjectInsightItemExtensionComponentConfiguration<T = Content> extends ObjectInsightItemExtensionBaseConfiguration<T> {
|
|
45
46
|
/**
|
|
46
47
|
* Indicates when item is in loading state or part of the UI is refreshing,
|
|
47
48
|
* so item can get new information after
|
|
@@ -56,8 +57,10 @@ export interface ObjectInsightItemExtensionComponentConfiguration extends Object
|
|
|
56
57
|
*
|
|
57
58
|
* @export
|
|
58
59
|
* @interface ObjectInsightItemExtensionsVisibilityConfiguration
|
|
60
|
+
* @typeParam T - type of active item, `Content` is default type
|
|
61
|
+
*
|
|
59
62
|
*/
|
|
60
|
-
export interface ObjectInsightItemExtensionsVisibilityConfiguration extends ObjectInsightItemExtensionBaseConfiguration {
|
|
63
|
+
export interface ObjectInsightItemExtensionsVisibilityConfiguration<T = Content> extends ObjectInsightItemExtensionBaseConfiguration<T> {
|
|
61
64
|
/**
|
|
62
65
|
* Indicates in which part of the UI object insight panel is visible
|
|
63
66
|
*
|
|
@@ -77,15 +80,16 @@ export interface ObjectInsightItemExtensionsVisibilityConfiguration extends Obje
|
|
|
77
80
|
* Base properties for component and visibility
|
|
78
81
|
*
|
|
79
82
|
* @interface ObjectInsightItemExtensionBaseConfiguration
|
|
83
|
+
* @typeParam T - type of active item, `Content` is default type
|
|
80
84
|
*/
|
|
81
|
-
interface ObjectInsightItemExtensionBaseConfiguration {
|
|
85
|
+
interface ObjectInsightItemExtensionBaseConfiguration<T = Content> {
|
|
82
86
|
/**
|
|
83
87
|
* Active item in the view, can be document object, folder or publication
|
|
84
88
|
*
|
|
85
|
-
* @type {
|
|
89
|
+
* @type {T}
|
|
86
90
|
* @memberof ObjectInsightItemExtensionBaseConfiguration
|
|
87
91
|
*/
|
|
88
|
-
activeItem:
|
|
92
|
+
activeItem: T;
|
|
89
93
|
/**
|
|
90
94
|
* Folder in which active items is in UI. Usually the same as parent folder,
|
|
91
95
|
* exception is when item is visible in reference folder and in search results
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { FolderType } from './api/typings/FolderType.js';
|
|
|
14
14
|
export { MessageSeverity } from './api/typings/Notification.js';
|
|
15
15
|
export { NavigationItemIdType, PositioningType } from './api/typings/Position.js';
|
|
16
16
|
export { ViewType } from './api/typings/ViewType.js';
|
|
17
|
+
export { PublicationObjectType } from './api/typings/PublicationObjectType.js';
|
|
17
18
|
export { initializeExtensionApiStorage } from './apiStorage/apiStorage.js';
|
|
18
19
|
import 'react';
|
|
19
20
|
export { ActionExtensionsBuilder } from './extensionPoints/action/actionExtensionsBuilder.js';
|
package/dist/package.json.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const version = "
|
|
1
|
+
const version = "2.0.0";
|
|
2
2
|
const peerDependencies = {
|
|
3
|
-
react: "
|
|
4
|
-
"react-dom": "
|
|
5
|
-
"react-is": "
|
|
6
|
-
"styled-components": "
|
|
3
|
+
react: "*",
|
|
4
|
+
"react-dom": "*",
|
|
5
|
+
"react-is": "*",
|
|
6
|
+
"styled-components": "*"
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { peerDependencies, version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tridion-docs/extensions",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Tridion Docs Extensions API",
|
|
5
5
|
"author": "RWS Group for and on behalf of its affiliates and subsidiaries",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -21,34 +21,34 @@
|
|
|
21
21
|
"build": "rollup -c",
|
|
22
22
|
"release": "rollup -c",
|
|
23
23
|
"start": "rollup -c -w",
|
|
24
|
-
"
|
|
24
|
+
"start:remote": "yarn run start",
|
|
25
|
+
"lint": "eslint .",
|
|
26
|
+
"lint:fix": "eslint . --fix && prettier --write \"src/**/*\"",
|
|
25
27
|
"prepublish": "yarn build"
|
|
26
28
|
},
|
|
27
29
|
"peerDependencies": {
|
|
28
|
-
"react": "
|
|
29
|
-
"react-dom": "
|
|
30
|
-
"react-is": "
|
|
31
|
-
"styled-components": "
|
|
30
|
+
"react": "*",
|
|
31
|
+
"react-dom": "*",
|
|
32
|
+
"react-is": "*",
|
|
33
|
+
"styled-components": "*"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@rollup/plugin-commonjs": "
|
|
35
|
-
"@rollup/plugin-json": "6.
|
|
36
|
-
"@rollup/plugin-node-resolve": "15.
|
|
37
|
-
"@rollup/plugin-typescript": "11.
|
|
38
|
-
"@
|
|
39
|
-
"@types/react": "18.
|
|
40
|
-
"@types/react-
|
|
41
|
-
"@types/react-is": "17.0.3",
|
|
42
|
-
"@types/styled-components": "5.1.26",
|
|
36
|
+
"@rollup/plugin-commonjs": "25.0.7",
|
|
37
|
+
"@rollup/plugin-json": "6.1.0",
|
|
38
|
+
"@rollup/plugin-node-resolve": "15.2.3",
|
|
39
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
40
|
+
"@types/react": "18.2.58",
|
|
41
|
+
"@types/react-dom": "18.2.19",
|
|
42
|
+
"@types/react-is": "18.2.4",
|
|
43
43
|
"react": "18.2.0",
|
|
44
44
|
"react-dom": "18.2.0",
|
|
45
45
|
"react-is": "18.2.0",
|
|
46
|
-
"rimraf": "
|
|
47
|
-
"rollup": "
|
|
46
|
+
"rimraf": "5.0.5",
|
|
47
|
+
"rollup": "4.12.0",
|
|
48
48
|
"rollup-plugin-delete": "2.0.0",
|
|
49
|
-
"rollup-plugin-node-externals": "
|
|
50
|
-
"styled-components": "
|
|
51
|
-
"typescript": "5.
|
|
52
|
-
"typescript-transform-paths": "3.4.
|
|
49
|
+
"rollup-plugin-node-externals": "7.0.1",
|
|
50
|
+
"styled-components": "6.1.8",
|
|
51
|
+
"typescript": "5.3.3",
|
|
52
|
+
"typescript-transform-paths": "3.4.7"
|
|
53
53
|
}
|
|
54
54
|
}
|