@knovator/pagecreator-admin 1.6.7 → 1.6.8
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/index.cjs +15 -7
- package/index.js +15 -7
- package/package.json +1 -1
- package/src/lib/components/Widget/Form/WidgetForm.d.ts +1 -1
- package/src/lib/components/Widget/Widget/Widget.d.ts +3 -3
- package/src/lib/components/Widget/WidgetFormActions/WidgetFormActions.d.ts +1 -1
- package/src/lib/types/components.d.ts +1 -0
package/index.cjs
CHANGED
|
@@ -7138,7 +7138,8 @@ const constants = {
|
|
|
7138
7138
|
};
|
|
7139
7139
|
const WidgetForm = ({
|
|
7140
7140
|
formRef,
|
|
7141
|
-
customInputs
|
|
7141
|
+
customInputs,
|
|
7142
|
+
onPrimaryButtonClick
|
|
7142
7143
|
}) => {
|
|
7143
7144
|
const {
|
|
7144
7145
|
register,
|
|
@@ -7532,9 +7533,11 @@ const WidgetForm = ({
|
|
|
7532
7533
|
}
|
|
7533
7534
|
return item;
|
|
7534
7535
|
});
|
|
7535
|
-
|
|
7536
|
+
const submitPayload = Object.assign(Object.assign({}, formData), {
|
|
7536
7537
|
items
|
|
7537
|
-
})
|
|
7538
|
+
});
|
|
7539
|
+
onPrimaryButtonClick === null || onPrimaryButtonClick === void 0 ? void 0 : onPrimaryButtonClick(undefined, submitPayload);
|
|
7540
|
+
onWidgetFormSubmit(submitPayload);
|
|
7538
7541
|
};
|
|
7539
7542
|
const onCollectionIndexChange = result => {
|
|
7540
7543
|
const {
|
|
@@ -7932,7 +7935,8 @@ const WidgetSearch = () => {
|
|
|
7932
7935
|
};
|
|
7933
7936
|
|
|
7934
7937
|
const WidgetFormActions = ({
|
|
7935
|
-
formRef
|
|
7938
|
+
formRef,
|
|
7939
|
+
onPrimaryButtonClick
|
|
7936
7940
|
}) => {
|
|
7937
7941
|
const {
|
|
7938
7942
|
onError,
|
|
@@ -7947,6 +7951,7 @@ const WidgetFormActions = ({
|
|
|
7947
7951
|
} = useWidgetState();
|
|
7948
7952
|
const onSubmitClick = e => {
|
|
7949
7953
|
var _a;
|
|
7954
|
+
onPrimaryButtonClick === null || onPrimaryButtonClick === void 0 ? void 0 : onPrimaryButtonClick(e);
|
|
7950
7955
|
if (!formRef) {
|
|
7951
7956
|
return onError(CALLBACK_CODES.INTERNAL, 'error', `formRef is required to submit the form!`);
|
|
7952
7957
|
} else if (!formRef.current) {
|
|
@@ -7996,7 +8001,8 @@ const Widget = ({
|
|
|
7996
8001
|
formatOptionLabel,
|
|
7997
8002
|
imageMaxSize,
|
|
7998
8003
|
translations,
|
|
7999
|
-
children
|
|
8004
|
+
children,
|
|
8005
|
+
onPrimaryButtonClick
|
|
8000
8006
|
}) => {
|
|
8001
8007
|
const {
|
|
8002
8008
|
commonTranslations
|
|
@@ -8083,10 +8089,12 @@ const Widget = ({
|
|
|
8083
8089
|
onClose: onCloseForm,
|
|
8084
8090
|
title: formState === 'ADD' ? derivedT.addWidgetTitle : formState === 'UPDATE' ? derivedT.updateWidgetTitle : '',
|
|
8085
8091
|
footerContent: /*#__PURE__*/React__default["default"].createElement(WidgetFormActions, {
|
|
8086
|
-
formRef: widgetFormRef
|
|
8092
|
+
formRef: widgetFormRef,
|
|
8093
|
+
onPrimaryButtonClick: onPrimaryButtonClick
|
|
8087
8094
|
})
|
|
8088
8095
|
}, /*#__PURE__*/React__default["default"].createElement(WidgetForm, {
|
|
8089
|
-
formRef: widgetFormRef
|
|
8096
|
+
formRef: widgetFormRef,
|
|
8097
|
+
onPrimaryButtonClick: onPrimaryButtonClick
|
|
8090
8098
|
}))), itemData && (/*#__PURE__*/React__default["default"].createElement(DeleteModal, {
|
|
8091
8099
|
formState: formState,
|
|
8092
8100
|
itemData: itemData,
|
package/index.js
CHANGED
|
@@ -7126,7 +7126,8 @@ const constants = {
|
|
|
7126
7126
|
};
|
|
7127
7127
|
const WidgetForm = ({
|
|
7128
7128
|
formRef,
|
|
7129
|
-
customInputs
|
|
7129
|
+
customInputs,
|
|
7130
|
+
onPrimaryButtonClick
|
|
7130
7131
|
}) => {
|
|
7131
7132
|
const {
|
|
7132
7133
|
register,
|
|
@@ -7520,9 +7521,11 @@ const WidgetForm = ({
|
|
|
7520
7521
|
}
|
|
7521
7522
|
return item;
|
|
7522
7523
|
});
|
|
7523
|
-
|
|
7524
|
+
const submitPayload = Object.assign(Object.assign({}, formData), {
|
|
7524
7525
|
items
|
|
7525
|
-
})
|
|
7526
|
+
});
|
|
7527
|
+
onPrimaryButtonClick === null || onPrimaryButtonClick === void 0 ? void 0 : onPrimaryButtonClick(undefined, submitPayload);
|
|
7528
|
+
onWidgetFormSubmit(submitPayload);
|
|
7526
7529
|
};
|
|
7527
7530
|
const onCollectionIndexChange = result => {
|
|
7528
7531
|
const {
|
|
@@ -7920,7 +7923,8 @@ const WidgetSearch = () => {
|
|
|
7920
7923
|
};
|
|
7921
7924
|
|
|
7922
7925
|
const WidgetFormActions = ({
|
|
7923
|
-
formRef
|
|
7926
|
+
formRef,
|
|
7927
|
+
onPrimaryButtonClick
|
|
7924
7928
|
}) => {
|
|
7925
7929
|
const {
|
|
7926
7930
|
onError,
|
|
@@ -7935,6 +7939,7 @@ const WidgetFormActions = ({
|
|
|
7935
7939
|
} = useWidgetState();
|
|
7936
7940
|
const onSubmitClick = e => {
|
|
7937
7941
|
var _a;
|
|
7942
|
+
onPrimaryButtonClick === null || onPrimaryButtonClick === void 0 ? void 0 : onPrimaryButtonClick(e);
|
|
7938
7943
|
if (!formRef) {
|
|
7939
7944
|
return onError(CALLBACK_CODES.INTERNAL, 'error', `formRef is required to submit the form!`);
|
|
7940
7945
|
} else if (!formRef.current) {
|
|
@@ -7984,7 +7989,8 @@ const Widget = ({
|
|
|
7984
7989
|
formatOptionLabel,
|
|
7985
7990
|
imageMaxSize,
|
|
7986
7991
|
translations,
|
|
7987
|
-
children
|
|
7992
|
+
children,
|
|
7993
|
+
onPrimaryButtonClick
|
|
7988
7994
|
}) => {
|
|
7989
7995
|
const {
|
|
7990
7996
|
commonTranslations
|
|
@@ -8071,10 +8077,12 @@ const Widget = ({
|
|
|
8071
8077
|
onClose: onCloseForm,
|
|
8072
8078
|
title: formState === 'ADD' ? derivedT.addWidgetTitle : formState === 'UPDATE' ? derivedT.updateWidgetTitle : '',
|
|
8073
8079
|
footerContent: /*#__PURE__*/React.createElement(WidgetFormActions, {
|
|
8074
|
-
formRef: widgetFormRef
|
|
8080
|
+
formRef: widgetFormRef,
|
|
8081
|
+
onPrimaryButtonClick: onPrimaryButtonClick
|
|
8075
8082
|
})
|
|
8076
8083
|
}, /*#__PURE__*/React.createElement(WidgetForm, {
|
|
8077
|
-
formRef: widgetFormRef
|
|
8084
|
+
formRef: widgetFormRef,
|
|
8085
|
+
onPrimaryButtonClick: onPrimaryButtonClick
|
|
8078
8086
|
}))), itemData && (/*#__PURE__*/React.createElement(DeleteModal, {
|
|
8079
8087
|
formState: formState,
|
|
8080
8088
|
itemData: itemData,
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormProps } from '../../../types';
|
|
3
|
-
declare const WidgetForm: ({ formRef, customInputs }: FormProps) => JSX.Element | null;
|
|
3
|
+
declare const WidgetForm: ({ formRef, customInputs, onPrimaryButtonClick }: FormProps) => JSX.Element | null;
|
|
4
4
|
export default WidgetForm;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WidgetProps } from '../../../types';
|
|
3
3
|
declare const Widget: {
|
|
4
|
-
({ routes, loader, explicitForm, imageBaseUrl, permissions, preConfirmDelete, formatListItem, formatOptionLabel, imageMaxSize, translations, children, }: WidgetProps): JSX.Element;
|
|
4
|
+
({ routes, loader, explicitForm, imageBaseUrl, permissions, preConfirmDelete, formatListItem, formatOptionLabel, imageMaxSize, translations, children, onPrimaryButtonClick, }: WidgetProps): JSX.Element;
|
|
5
5
|
Table: ({ extraActions, extraColumns }: import("../../../types").DerivedTableProps) => JSX.Element;
|
|
6
|
-
Form: ({ formRef, customInputs }: import("../../../types").FormProps) => JSX.Element | null;
|
|
6
|
+
Form: ({ formRef, customInputs, onPrimaryButtonClick }: import("../../../types").FormProps) => JSX.Element | null;
|
|
7
7
|
AddButton: () => JSX.Element;
|
|
8
8
|
Search: () => JSX.Element;
|
|
9
9
|
Pagination: () => JSX.Element;
|
|
10
10
|
FormWrapper: ({ children }: import("../../../types").FormWrapperProps) => JSX.Element | null;
|
|
11
|
-
FormActions: ({ formRef }: import("../../../types").FormActionWrapperProps) => JSX.Element | null;
|
|
11
|
+
FormActions: ({ formRef, onPrimaryButtonClick }: import("../../../types").FormActionWrapperProps) => JSX.Element | null;
|
|
12
12
|
};
|
|
13
13
|
export default Widget;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormActionWrapperProps } from '../../../types';
|
|
3
|
-
declare const WidgetFormActions: ({ formRef }: FormActionWrapperProps) => JSX.Element | null;
|
|
3
|
+
declare const WidgetFormActions: ({ formRef, onPrimaryButtonClick }: FormActionWrapperProps) => JSX.Element | null;
|
|
4
4
|
export default WidgetFormActions;
|
|
@@ -214,6 +214,7 @@ export interface WidgetProps {
|
|
|
214
214
|
imageBaseUrl?: string;
|
|
215
215
|
imageMaxSize?: number;
|
|
216
216
|
translations?: WidgetTranslationPairs;
|
|
217
|
+
onPrimaryButtonClick?: (e?: React.MouseEvent<HTMLButtonElement, MouseEvent>, data?: any) => void;
|
|
217
218
|
}
|
|
218
219
|
export interface DerivedTableProps {
|
|
219
220
|
extraActions?: (item: any) => JSX.Element;
|