@pushwoosh/smart-components-kit 1.0.27 → 1.0.28
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.
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type FC } from 'react';
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
|
+
import { type RenderDynamicContentProps } from './types';
|
|
2
3
|
type DynamicContentPickerProps = {
|
|
3
4
|
applicationCode: string;
|
|
4
5
|
text: string;
|
|
5
6
|
title?: string;
|
|
7
|
+
renderDynamicContent?: (props: RenderDynamicContentProps) => ReactNode;
|
|
6
8
|
};
|
|
7
9
|
export declare const DynamicContentPicker: FC<DynamicContentPickerProps>;
|
|
8
10
|
export {};
|
|
@@ -22,7 +22,8 @@ const reducer = (state, action) => {
|
|
|
22
22
|
export const DynamicContentPicker = ({
|
|
23
23
|
applicationCode,
|
|
24
24
|
text,
|
|
25
|
-
title
|
|
25
|
+
title,
|
|
26
|
+
renderDynamicContent
|
|
26
27
|
}) => {
|
|
27
28
|
var _middlewareData$arrow, _middlewareData$arrow2;
|
|
28
29
|
const arrowRef = useRef(null);
|
|
@@ -72,7 +73,16 @@ export const DynamicContentPicker = ({
|
|
|
72
73
|
}))))), !!activeVar && React.createElement("div", {
|
|
73
74
|
ref: refs.setFloating,
|
|
74
75
|
style: floatingStyles
|
|
75
|
-
},
|
|
76
|
+
}, renderDynamicContent ? renderDynamicContent({
|
|
77
|
+
activeVar,
|
|
78
|
+
onChange: newDC => dispatch({
|
|
79
|
+
type: 'set',
|
|
80
|
+
key: activeVar,
|
|
81
|
+
value: newDC
|
|
82
|
+
}),
|
|
83
|
+
onClose: () => setActiveVar(undefined),
|
|
84
|
+
update
|
|
85
|
+
}) : React.createElement(VariedDynamicContentPickerFormSmart, {
|
|
76
86
|
key: activeVar,
|
|
77
87
|
applicationCode: applicationCode,
|
|
78
88
|
initialDc: state[activeVar],
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
import { type VariedDynamicContent } from '../DynamicContentPickerForm/types';
|
|
1
2
|
export type ArrowDirection = 'top' | 'bottom' | 'left' | 'right';
|
|
3
|
+
export type RenderDynamicContentProps = {
|
|
4
|
+
activeVar: string;
|
|
5
|
+
onChange: (newDC: VariedDynamicContent) => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
update: () => void;
|
|
8
|
+
};
|
package/package.json
CHANGED