@knovator/pagecreator-admin 0.8.1 → 0.8.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/README.md +3 -4
- package/index.cjs +6 -0
- package/index.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
|
|
92
92
|
### Prerequisites
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
Create one reactjs/nextjs application if you don't have one,
|
|
95
95
|
* Project
|
|
96
96
|
```sh
|
|
97
97
|
npx create-react-app my-app
|
|
@@ -104,8 +104,7 @@ We can use `@knovator/pagecreator-admin` in React/Next application, we can creat
|
|
|
104
104
|
|
|
105
105
|
### Installation
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
1. Install NPM packages
|
|
107
|
+
1. Add pagecreator package
|
|
109
108
|
```sh
|
|
110
109
|
npm install @knovator/pagecreator-admin
|
|
111
110
|
# or
|
|
@@ -121,7 +120,7 @@ We can use `@knovator/pagecreator-admin` in React/Next application, we can creat
|
|
|
121
120
|
|
|
122
121
|
### Provider
|
|
123
122
|
|
|
124
|
-
`@knovator/pagecreator-admin` uses **Context API
|
|
123
|
+
In order to support communication between components `@knovator/pagecreator-admin` uses **Context API**. So, `Widget`/`Page` components should be wrapped by Provider.
|
|
125
124
|
```jsx
|
|
126
125
|
import { Provider } from '@knovator/pagecreator-admin';
|
|
127
126
|
|
package/index.cjs
CHANGED
|
@@ -2879,6 +2879,11 @@ const usePage = ({
|
|
|
2879
2879
|
}
|
|
2880
2880
|
}), [baseUrl, currentPageRef, limitRef, offsetRef, handleError, pageRoutesPrefix, routes, token]);
|
|
2881
2881
|
const onPageFormSubmit = data => __awaiter(void 0, void 0, void 0, function* () {
|
|
2882
|
+
if (selectedWidgets.length) {
|
|
2883
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2884
|
+
// @ts-ignore
|
|
2885
|
+
data.widgets = selectedWidgets.map(item => item.value);
|
|
2886
|
+
}
|
|
2882
2887
|
setLoading(true);
|
|
2883
2888
|
const code = formState === 'ADD' ? CALLBACK_CODES.CREATE : CALLBACK_CODES.UPDATE;
|
|
2884
2889
|
try {
|
|
@@ -2969,6 +2974,7 @@ const usePage = ({
|
|
|
2969
2974
|
}
|
|
2970
2975
|
};
|
|
2971
2976
|
const onChangeWidgetSequence = (sourceIndex, destinationIndex) => {
|
|
2977
|
+
console.log(sourceIndex, destinationIndex);
|
|
2972
2978
|
setSelectedWidgets(listData => {
|
|
2973
2979
|
const temporaryData = [...listData];
|
|
2974
2980
|
const [selectedRow] = temporaryData.splice(sourceIndex, 1);
|
package/index.js
CHANGED
|
@@ -2867,6 +2867,11 @@ const usePage = ({
|
|
|
2867
2867
|
}
|
|
2868
2868
|
}), [baseUrl, currentPageRef, limitRef, offsetRef, handleError, pageRoutesPrefix, routes, token]);
|
|
2869
2869
|
const onPageFormSubmit = data => __awaiter(void 0, void 0, void 0, function* () {
|
|
2870
|
+
if (selectedWidgets.length) {
|
|
2871
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2872
|
+
// @ts-ignore
|
|
2873
|
+
data.widgets = selectedWidgets.map(item => item.value);
|
|
2874
|
+
}
|
|
2870
2875
|
setLoading(true);
|
|
2871
2876
|
const code = formState === 'ADD' ? CALLBACK_CODES.CREATE : CALLBACK_CODES.UPDATE;
|
|
2872
2877
|
try {
|
|
@@ -2957,6 +2962,7 @@ const usePage = ({
|
|
|
2957
2962
|
}
|
|
2958
2963
|
};
|
|
2959
2964
|
const onChangeWidgetSequence = (sourceIndex, destinationIndex) => {
|
|
2965
|
+
console.log(sourceIndex, destinationIndex);
|
|
2960
2966
|
setSelectedWidgets(listData => {
|
|
2961
2967
|
const temporaryData = [...listData];
|
|
2962
2968
|
const [selectedRow] = temporaryData.splice(sourceIndex, 1);
|