@pdfme/ui 4.2.5-dev.1 → 4.2.5-dev.4
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/dist/index.es.js +112 -190
- package/dist/index.umd.js +8 -8
- package/dist/types/components/Designer/RightSidebar/DetailView/index.d.ts +1 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Designer/RightSidebar/DetailView/index.tsx +11 -7
- package/src/components/Designer/index.tsx +3 -2
- package/src/types.ts +1 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import type { SchemaForUI } from '@pdfme/common';
|
3
3
|
import type { SidebarProps } from '../../../../types';
|
4
|
-
type DetailViewProps = Pick<SidebarProps, 'size' | 'schemas' | 'pageSize' | 'changeSchemas' | 'activeElements' | 'deselectSchema'> & {
|
4
|
+
type DetailViewProps = Pick<SidebarProps, 'size' | 'schemas' | 'schemasList' | 'pageSize' | 'changeSchemas' | 'activeElements' | 'deselectSchema'> & {
|
5
5
|
activeSchema: SchemaForUI;
|
6
6
|
};
|
7
7
|
declare const _default: React.MemoExoticComponent<(props: DetailViewProps) => React.JSX.Element>;
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
@@ -14,7 +14,7 @@ import { InternalNamePath, ValidateErrorEntity } from "rc-field-form/es/interfac
|
|
14
14
|
const { Text } = Typography;
|
15
15
|
|
16
16
|
type DetailViewProps = Pick<SidebarProps,
|
17
|
-
'size' | 'schemas' | 'pageSize' | 'changeSchemas' | 'activeElements' | 'deselectSchema'
|
17
|
+
'size' | 'schemas' | 'schemasList' | 'pageSize' | 'changeSchemas' | 'activeElements' | 'deselectSchema'
|
18
18
|
> & {
|
19
19
|
activeSchema: SchemaForUI;
|
20
20
|
};
|
@@ -22,7 +22,7 @@ type DetailViewProps = Pick<SidebarProps,
|
|
22
22
|
const DetailView = (props: DetailViewProps) => {
|
23
23
|
const { token } = theme.useToken();
|
24
24
|
|
25
|
-
const { size,
|
25
|
+
const { size, schemasList, changeSchemas, deselectSchema, activeSchema } = props;
|
26
26
|
const form = useForm();
|
27
27
|
|
28
28
|
const i18n = useContext(I18nContext);
|
@@ -74,14 +74,16 @@ const DetailView = (props: DetailViewProps) => {
|
|
74
74
|
|
75
75
|
useEffect(() => {
|
76
76
|
uniqueSchemaKey.current = (value: string): boolean => {
|
77
|
-
for (const
|
78
|
-
|
79
|
-
|
77
|
+
for (const page of schemasList) {
|
78
|
+
for (const s of Object.values(page)) {
|
79
|
+
if (s.key === value && s.id !== activeSchema.id) {
|
80
|
+
return false;
|
81
|
+
}
|
80
82
|
}
|
81
83
|
}
|
82
84
|
return true;
|
83
85
|
};
|
84
|
-
}, [
|
86
|
+
}, [schemasList, activeSchema]);
|
85
87
|
|
86
88
|
const uniqueSchemaKey = useRef((value: string): boolean => true);
|
87
89
|
|
@@ -218,9 +220,11 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
218
220
|
};
|
219
221
|
|
220
222
|
if (typeof activePropPanelSchema === 'function') {
|
223
|
+
const { schemasList: _, ...propPanelProps } = props;
|
224
|
+
|
221
225
|
const apps =
|
222
226
|
activePropPanelSchema({
|
223
|
-
...
|
227
|
+
...propPanelProps,
|
224
228
|
options,
|
225
229
|
theme: token,
|
226
230
|
i18n: i18n as (key: keyof Dict | string) => string,
|
@@ -163,9 +163,9 @@ const TemplateEditor = ({
|
|
163
163
|
const pageSize = pageSizes[pageCursor];
|
164
164
|
|
165
165
|
const newSchemaKey = (prefix: string) => {
|
166
|
-
let keyNum = schemasList
|
166
|
+
let keyNum = schemasList.reduce((acc, page) => acc + page.length, 0);
|
167
167
|
let newKey = prefix + keyNum;
|
168
|
-
while (schemasList
|
168
|
+
while (schemasList.some(page => page.find((s) => s.key === newKey))) {
|
169
169
|
keyNum++;
|
170
170
|
newKey = prefix + keyNum;
|
171
171
|
}
|
@@ -298,6 +298,7 @@ const TemplateEditor = ({
|
|
298
298
|
size={size}
|
299
299
|
pageSize={pageSizes[pageCursor] ?? []}
|
300
300
|
activeElements={activeElements}
|
301
|
+
schemasList={schemasList}
|
301
302
|
schemas={schemasList[pageCursor] ?? []}
|
302
303
|
changeSchemas={changeSchemas}
|
303
304
|
onSortEnd={onSortEnd}
|
package/src/types.ts
CHANGED