@knovator/pagecreator-admin 0.7.1 → 0.7.2
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
CHANGED
|
@@ -2806,7 +2806,7 @@ const usePage = ({
|
|
|
2806
2806
|
}
|
|
2807
2807
|
onError(code, 'error', data === null || data === void 0 ? void 0 : data.message);
|
|
2808
2808
|
}, [onError, onLogout]);
|
|
2809
|
-
const getWidgets = React.useCallback(callback => __awaiter(void 0, void 0, void 0, function* () {
|
|
2809
|
+
const getWidgets = React.useCallback((search, callback) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2810
2810
|
try {
|
|
2811
2811
|
setWidgetsLoading(true);
|
|
2812
2812
|
const api = getApiType({
|
|
@@ -2821,6 +2821,7 @@ const usePage = ({
|
|
|
2821
2821
|
url: api.url,
|
|
2822
2822
|
onError: handleError(CALLBACK_CODES.GET_ALL),
|
|
2823
2823
|
data: {
|
|
2824
|
+
search: search || '',
|
|
2824
2825
|
all: true,
|
|
2825
2826
|
isActive: true
|
|
2826
2827
|
}
|
|
@@ -4063,6 +4064,7 @@ const PageForm = ({
|
|
|
4063
4064
|
canAdd,
|
|
4064
4065
|
canUpdate
|
|
4065
4066
|
} = usePageState();
|
|
4067
|
+
const callerRef = React.useRef(null);
|
|
4066
4068
|
// Form Utility Functions
|
|
4067
4069
|
function handleCapitalize(event) {
|
|
4068
4070
|
event.target.value = capitalizeFirstLetter(event.target.value);
|
|
@@ -4083,10 +4085,13 @@ const PageForm = ({
|
|
|
4083
4085
|
return event;
|
|
4084
4086
|
}
|
|
4085
4087
|
function loadOptions(value, callback) {
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4088
|
+
if (callerRef.current) clearTimeout(callerRef.current);
|
|
4089
|
+
callerRef.current = setTimeout(() => {
|
|
4090
|
+
getWidgets(value, widgetsData => {
|
|
4091
|
+
if (callback) callback(widgetsData);
|
|
4092
|
+
if (formState === 'UPDATE' && data) setSelectedWidgets(data.widgets.map(widgetId => widgetsData.find(widget => widget['value'] === widgetId)).filter(widget => widget));
|
|
4093
|
+
});
|
|
4094
|
+
}, 300);
|
|
4090
4095
|
}
|
|
4091
4096
|
// Widget Form Functions
|
|
4092
4097
|
const onDragEnd = result => {
|
package/index.js
CHANGED
|
@@ -2794,7 +2794,7 @@ const usePage = ({
|
|
|
2794
2794
|
}
|
|
2795
2795
|
onError(code, 'error', data === null || data === void 0 ? void 0 : data.message);
|
|
2796
2796
|
}, [onError, onLogout]);
|
|
2797
|
-
const getWidgets = useCallback(callback => __awaiter(void 0, void 0, void 0, function* () {
|
|
2797
|
+
const getWidgets = useCallback((search, callback) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2798
2798
|
try {
|
|
2799
2799
|
setWidgetsLoading(true);
|
|
2800
2800
|
const api = getApiType({
|
|
@@ -2809,6 +2809,7 @@ const usePage = ({
|
|
|
2809
2809
|
url: api.url,
|
|
2810
2810
|
onError: handleError(CALLBACK_CODES.GET_ALL),
|
|
2811
2811
|
data: {
|
|
2812
|
+
search: search || '',
|
|
2812
2813
|
all: true,
|
|
2813
2814
|
isActive: true
|
|
2814
2815
|
}
|
|
@@ -4051,6 +4052,7 @@ const PageForm = ({
|
|
|
4051
4052
|
canAdd,
|
|
4052
4053
|
canUpdate
|
|
4053
4054
|
} = usePageState();
|
|
4055
|
+
const callerRef = useRef(null);
|
|
4054
4056
|
// Form Utility Functions
|
|
4055
4057
|
function handleCapitalize(event) {
|
|
4056
4058
|
event.target.value = capitalizeFirstLetter(event.target.value);
|
|
@@ -4071,10 +4073,13 @@ const PageForm = ({
|
|
|
4071
4073
|
return event;
|
|
4072
4074
|
}
|
|
4073
4075
|
function loadOptions(value, callback) {
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4076
|
+
if (callerRef.current) clearTimeout(callerRef.current);
|
|
4077
|
+
callerRef.current = setTimeout(() => {
|
|
4078
|
+
getWidgets(value, widgetsData => {
|
|
4079
|
+
if (callback) callback(widgetsData);
|
|
4080
|
+
if (formState === 'UPDATE' && data) setSelectedWidgets(data.widgets.map(widgetId => widgetsData.find(widget => widget['value'] === widgetId)).filter(widget => widget));
|
|
4081
|
+
});
|
|
4082
|
+
}, 300);
|
|
4078
4083
|
}
|
|
4079
4084
|
// Widget Form Functions
|
|
4080
4085
|
const onDragEnd = result => {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { PageProps } from '../../../types';
|
|
3
3
|
declare const Page: {
|
|
4
4
|
({ t, loader, explicitForm, children, permissions, preConfirmDelete, }: PageProps): JSX.Element;
|
|
5
|
-
Table: () => JSX.Element;
|
|
5
|
+
Table: ({ extraActions, extraColumns }: import("../../../types").DerivedTableProps) => JSX.Element;
|
|
6
6
|
Search: () => JSX.Element;
|
|
7
7
|
Form: ({ formRef }: import("../../../types").FormProps) => JSX.Element | null;
|
|
8
8
|
AddButton: () => JSX.Element;
|
|
@@ -3,7 +3,7 @@ import Checkbox from "./Checkbox";
|
|
|
3
3
|
import Select from "./Select";
|
|
4
4
|
import ReactSelect from "./ReactSelect";
|
|
5
5
|
import SrcSet from './SrcSet';
|
|
6
|
-
declare const _default: (({ label, id, placeholder, type, size, required, error, className, disabled, rest, onInput, onBlur, value, onChange, wrapperClassName, }: import("../../../types").InputProps) => JSX.Element) & {
|
|
6
|
+
declare const _default: (({ label, id, placeholder, type, size, required, error, className, disabled, rest, onInput, onBlur, value, info, onChange, wrapperClassName, }: import("../../../types").InputProps) => JSX.Element) & {
|
|
7
7
|
Select: typeof Select;
|
|
8
8
|
ReactSelect: typeof ReactSelect;
|
|
9
9
|
Checkbox: typeof Checkbox;
|
|
@@ -24,7 +24,7 @@ declare const usePage: ({ routes, defaultLimit, canList, preConfirmDelete, }: Us
|
|
|
24
24
|
widgets: ObjectType[];
|
|
25
25
|
itemData: any;
|
|
26
26
|
formState: FormActionTypes | undefined;
|
|
27
|
-
getWidgets: (callback?: ((data: any) => void) | undefined) => Promise<void>;
|
|
27
|
+
getWidgets: (search?: string, callback?: ((data: any) => void) | undefined) => Promise<void>;
|
|
28
28
|
onCloseForm: () => void;
|
|
29
29
|
widgetsLoading: boolean;
|
|
30
30
|
selectedWidgets: {
|
|
@@ -70,7 +70,7 @@ export interface PageContextType {
|
|
|
70
70
|
list: any[];
|
|
71
71
|
searchText: string;
|
|
72
72
|
changeSearch: (val: string) => void;
|
|
73
|
-
getWidgets: (callback?: (data: any) => void) => void;
|
|
73
|
+
getWidgets: (search?: string, callback?: (data: any) => void) => void;
|
|
74
74
|
formState: FormActionTypes | undefined;
|
|
75
75
|
closeForm: () => void;
|
|
76
76
|
onPageFormSubmit: (data: any) => void;
|