@tridion-docs/extensions 2.0.0 → 2.1.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 +7 -0
- package/README.md +138 -15
- package/dist/api/typings/TranslationJob.d.ts +3 -0
- package/dist/api/typings/ViewType.d.ts +3 -2
- package/dist/api/typings/ViewType.js +2 -1
- package/dist/api/typings/index.d.ts +1 -0
- package/dist/extensionPoints/action/explorerAction.d.ts +10 -1
- package/dist/frameworkInfo.js +1 -1
- package/dist/package.json.js +5 -5
- package/package.json +21 -21
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Copyright © 2024 RWS Holdings plc including its subsidiaries and affiliated com
|
|
|
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.2
|
|
13
13
|
|
|
14
14
|
# Upgrade instruction
|
|
15
15
|
|
|
@@ -21,26 +21,15 @@ You need to update versions of these two packages `@tridion-docs/extensions` and
|
|
|
21
21
|
```
|
|
22
22
|
"dependencies": {
|
|
23
23
|
...
|
|
24
|
-
"@tridion-docs/extensions": "2.
|
|
24
|
+
"@tridion-docs/extensions": "2.1.0",
|
|
25
25
|
...
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
...
|
|
29
|
-
"@tridion-docs/extensions-cli": "2.
|
|
29
|
+
"@tridion-docs/extensions-cli": "2.1.0",
|
|
30
30
|
...
|
|
31
31
|
}
|
|
32
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
|
-
```
|
|
44
33
|
|
|
45
34
|
# Documentation
|
|
46
35
|
|
|
@@ -124,7 +113,7 @@ export const CustomPage = () => {
|
|
|
124
113
|
|
|
125
114
|
The extension library provides hooks to assist with extension development.
|
|
126
115
|
|
|
127
|
-
##
|
|
116
|
+
## `useItemSelector`
|
|
128
117
|
|
|
129
118
|
The `useItemSelector` allows you to show dialog with a structured folder tree on the left side and the content of the folder on the right side. This dialog supposes to help you to select one of the multiple objects based on your configuration.
|
|
130
119
|
|
|
@@ -704,3 +693,137 @@ const getExtensionsBaseUrl = () => {
|
|
|
704
693
|
const baseUrl = getExtensionsBaseUrl();
|
|
705
694
|
const client = new Client(baseUrl);
|
|
706
695
|
```
|
|
696
|
+
|
|
697
|
+
# FAQ
|
|
698
|
+
**I want to use [useItemSelector](#useitemselector) inside [Antd Modal](https://ant.design/components/modal) component but I can't see popups and filters in item selector.**
|
|
699
|
+
|
|
700
|
+
This is a known issue caused by mixing two different UI frameworks. To resolve this issue, there are two approaches:
|
|
701
|
+
|
|
702
|
+
*Preferable way*
|
|
703
|
+
|
|
704
|
+
Reset the zIndex property for the Antd Modal and specify a custom container that positions it correctly relative to the ItemSelector.
|
|
705
|
+
|
|
706
|
+
```js
|
|
707
|
+
const popupContainer = useMemo(() => {
|
|
708
|
+
const container = document.createElement('div');
|
|
709
|
+
document.body.append(container);
|
|
710
|
+
return container;
|
|
711
|
+
}, []);
|
|
712
|
+
|
|
713
|
+
<Modal
|
|
714
|
+
zIndex={0}
|
|
715
|
+
getContainer={popupContainer}
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
*Complete page example*
|
|
719
|
+
|
|
720
|
+
```js
|
|
721
|
+
import { Content, DocumentObjectType, useItemSelector } from '@tridion-docs/extensions';
|
|
722
|
+
import { useMemo, useState } from 'react';
|
|
723
|
+
import { Button, Modal } from 'antd';
|
|
724
|
+
|
|
725
|
+
export const CustomPage = () => {
|
|
726
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
727
|
+
|
|
728
|
+
const showModal = () => setIsModalOpen(true);
|
|
729
|
+
const handleOk = () => setIsModalOpen(false);
|
|
730
|
+
const handleCancel = () => setIsModalOpen(false);
|
|
731
|
+
|
|
732
|
+
const itemSelectorProps = {
|
|
733
|
+
objectTypesToSelect: [DocumentObjectType.Library],
|
|
734
|
+
isMultiSelect: false,
|
|
735
|
+
onOk: (selectedItems: Content[]) => console.log(selectedItems),
|
|
736
|
+
okLabel: 'ok',
|
|
737
|
+
cancelLabel: 'cancel',
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
const { execute: showItemSelector } = useItemSelector(itemSelectorProps);
|
|
741
|
+
|
|
742
|
+
const popupContainer = useMemo(() => {
|
|
743
|
+
const container = document.createElement('div');
|
|
744
|
+
document.body.append(container);
|
|
745
|
+
return container;
|
|
746
|
+
}, []);
|
|
747
|
+
|
|
748
|
+
return (
|
|
749
|
+
<>
|
|
750
|
+
<Button type="primary" onClick={showModal}>Open Modal </Button>
|
|
751
|
+
<Modal
|
|
752
|
+
title="Basic Modal"
|
|
753
|
+
open={isModalOpen}
|
|
754
|
+
onOk={handleOk}
|
|
755
|
+
onCancel={handleCancel}
|
|
756
|
+
zIndex={0}
|
|
757
|
+
getContainer={popupContainer}
|
|
758
|
+
>
|
|
759
|
+
<Button onClick={showItemSelector}>show</Button>
|
|
760
|
+
</Modal>
|
|
761
|
+
</>
|
|
762
|
+
);
|
|
763
|
+
};
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
*Alternative way*
|
|
767
|
+
|
|
768
|
+
If you prefer a simpler fix, you can use CSS to globally adjust the z-index for popups. However, this may cause issues with other components and is less reliable across different library versions.
|
|
769
|
+
|
|
770
|
+
```js
|
|
771
|
+
import { Content, DocumentObjectType, useItemSelector } from '@tridion-docs/extensions';
|
|
772
|
+
import { useState } from 'react';
|
|
773
|
+
|
|
774
|
+
import { Button, Modal } from 'antd';
|
|
775
|
+
|
|
776
|
+
import './CustomPage.module.css';
|
|
777
|
+
|
|
778
|
+
export const CustomPage = () => {
|
|
779
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
780
|
+
|
|
781
|
+
const showModal = () => setIsModalOpen(true);
|
|
782
|
+
const handleOk = () => setIsModalOpen(false);
|
|
783
|
+
const handleCancel = () => setIsModalOpen(false);
|
|
784
|
+
|
|
785
|
+
const itemSelectorProps = {
|
|
786
|
+
objectTypesToSelect: [DocumentObjectType.Library],
|
|
787
|
+
isMultiSelect: false,
|
|
788
|
+
onOk: (selectedItems: Content[]) => console.log(selectedItems),
|
|
789
|
+
okLabel: 'ok',
|
|
790
|
+
cancelLabel: 'cancel',
|
|
791
|
+
modalZindex: 1002
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
const { execute: showItemSelector } = useItemSelector(itemSelectorProps);
|
|
795
|
+
|
|
796
|
+
return (
|
|
797
|
+
<>
|
|
798
|
+
<Button type="primary" onClick={showModal}>Open Modal </Button>
|
|
799
|
+
<Modal
|
|
800
|
+
title="Basic Modal"
|
|
801
|
+
open={isModalOpen}
|
|
802
|
+
onOk={handleOk}
|
|
803
|
+
onCancel={handleCancel}
|
|
804
|
+
>
|
|
805
|
+
<Button onClick={showItemSelector}>show</Button>
|
|
806
|
+
</Modal>
|
|
807
|
+
</>
|
|
808
|
+
);
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
```css
|
|
815
|
+
/* CustomPage.module.css */
|
|
816
|
+
|
|
817
|
+
div[data-test~='popup'] {
|
|
818
|
+
z-index: 9999;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
body > div > div[class*='ant-select-dropdown'] {
|
|
822
|
+
z-index: 10000;
|
|
823
|
+
}
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
*Note:* This solution applies globally, affecting all popups on the page. It is not guaranteed to work consistently across future releases, as the CSS selector may change.
|
|
829
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Indicates in which part of the UI object insight panel is visible
|
|
2
|
+
* Indicates in which part of the UI object insight panel or action button is visible
|
|
3
3
|
*
|
|
4
4
|
* @export
|
|
5
5
|
* @enum {number}
|
|
@@ -10,5 +10,6 @@ export declare enum ViewType {
|
|
|
10
10
|
search = "Search",
|
|
11
11
|
inbox = "Inbox",
|
|
12
12
|
project = "Project",
|
|
13
|
-
projectAssignee = "ProjectAssignee"
|
|
13
|
+
projectAssignee = "ProjectAssignee",
|
|
14
|
+
translationJobs = "TranslationJobs"
|
|
14
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Indicates in which part of the UI object insight panel is visible
|
|
2
|
+
* Indicates in which part of the UI object insight panel or action button is visible
|
|
3
3
|
*
|
|
4
4
|
* @export
|
|
5
5
|
* @enum {number}
|
|
@@ -12,6 +12,7 @@ var ViewType;
|
|
|
12
12
|
ViewType["inbox"] = "Inbox";
|
|
13
13
|
ViewType["project"] = "Project";
|
|
14
14
|
ViewType["projectAssignee"] = "ProjectAssignee";
|
|
15
|
+
ViewType["translationJobs"] = "TranslationJobs";
|
|
15
16
|
})(ViewType || (ViewType = {}));
|
|
16
17
|
|
|
17
18
|
export { ViewType };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Content, Folder, ViewType, UserInfo } from "../../api";
|
|
3
2
|
export type ExplorerActionExtension<T> = () => ExplorerActionExtensionConfiguration<T>;
|
|
4
3
|
export interface ExplorerActionExtensionConfiguration<T = Content> {
|
|
@@ -16,10 +15,20 @@ export interface ExplorerActionExtensionConfiguration<T = Content> {
|
|
|
16
15
|
readonly tooltip: string;
|
|
17
16
|
/**
|
|
18
17
|
* Action button label
|
|
18
|
+
* used to show the label when the button is under a group button
|
|
19
|
+
* and in other places if a long label is not set
|
|
19
20
|
*
|
|
20
21
|
* @type {string}
|
|
21
22
|
*/
|
|
22
23
|
readonly label: string;
|
|
24
|
+
/**
|
|
25
|
+
* Action button long label,
|
|
26
|
+
* used to show the label when the button is outside of a group
|
|
27
|
+
* or under a more button
|
|
28
|
+
*
|
|
29
|
+
* @type {string}
|
|
30
|
+
*/
|
|
31
|
+
readonly longLabel?: string;
|
|
23
32
|
/**
|
|
24
33
|
* Action button icon (SVG)
|
|
25
34
|
*
|
package/dist/frameworkInfo.js
CHANGED
package/dist/package.json.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const version = "2.
|
|
1
|
+
const version = "2.1.0";
|
|
2
2
|
const peerDependencies = {
|
|
3
|
-
react: "
|
|
4
|
-
"react-dom": "
|
|
5
|
-
"react-is": "
|
|
6
|
-
"styled-components": "
|
|
3
|
+
react: "18.3.1",
|
|
4
|
+
"react-dom": "18.3.1",
|
|
5
|
+
"react-is": "18.3.1",
|
|
6
|
+
"styled-components": "6.1.15"
|
|
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": "2.
|
|
3
|
+
"version": "2.1.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",
|
|
@@ -27,28 +27,28 @@
|
|
|
27
27
|
"prepublish": "yarn build"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"react": "
|
|
31
|
-
"react-dom": "
|
|
32
|
-
"react-is": "
|
|
33
|
-
"styled-components": "
|
|
30
|
+
"react": "18.3.1",
|
|
31
|
+
"react-dom": "18.3.1",
|
|
32
|
+
"react-is": "18.3.1",
|
|
33
|
+
"styled-components": "6.1.15"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@rollup/plugin-commonjs": "
|
|
36
|
+
"@rollup/plugin-commonjs": "28.0.2",
|
|
37
37
|
"@rollup/plugin-json": "6.1.0",
|
|
38
|
-
"@rollup/plugin-node-resolve": "
|
|
39
|
-
"@rollup/plugin-typescript": "
|
|
40
|
-
"@types/react": "18.
|
|
41
|
-
"@types/react-dom": "18.
|
|
42
|
-
"@types/react-is": "18.
|
|
43
|
-
"react": "18.
|
|
44
|
-
"react-dom": "18.
|
|
45
|
-
"react-is": "18.
|
|
46
|
-
"rimraf": "
|
|
47
|
-
"rollup": "4.
|
|
48
|
-
"rollup-plugin-delete": "2.
|
|
49
|
-
"rollup-plugin-node-externals": "
|
|
50
|
-
"styled-components": "6.1.
|
|
51
|
-
"typescript": "5.
|
|
52
|
-
"typescript-transform-paths": "3.
|
|
38
|
+
"@rollup/plugin-node-resolve": "16.0.0",
|
|
39
|
+
"@rollup/plugin-typescript": "12.1.2",
|
|
40
|
+
"@types/react": "18.3.18",
|
|
41
|
+
"@types/react-dom": "18.3.5",
|
|
42
|
+
"@types/react-is": "18.3.1",
|
|
43
|
+
"react": "18.3.1",
|
|
44
|
+
"react-dom": "18.3.1",
|
|
45
|
+
"react-is": "18.3.1",
|
|
46
|
+
"rimraf": "6.0.1",
|
|
47
|
+
"rollup": "4.34.8",
|
|
48
|
+
"rollup-plugin-delete": "2.1.0",
|
|
49
|
+
"rollup-plugin-node-externals": "8.0.0",
|
|
50
|
+
"styled-components": "6.1.15",
|
|
51
|
+
"typescript": "5.7.3",
|
|
52
|
+
"typescript-transform-paths": "3.5.3"
|
|
53
53
|
}
|
|
54
54
|
}
|