@pushwoosh/smart-components-kit 1.0.58 → 1.0.60
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.
|
@@ -72,6 +72,7 @@ export function ModalCloningJourney({
|
|
|
72
72
|
watch,
|
|
73
73
|
setValue,
|
|
74
74
|
setError,
|
|
75
|
+
clearErrors,
|
|
75
76
|
handleSubmit,
|
|
76
77
|
formState: {
|
|
77
78
|
errors
|
|
@@ -144,6 +145,9 @@ export function ModalCloningJourney({
|
|
|
144
145
|
});
|
|
145
146
|
} else {
|
|
146
147
|
setValue('destination', newValue.map(item => item.value));
|
|
148
|
+
if (newValue.length > 0) {
|
|
149
|
+
clearErrors('destination');
|
|
150
|
+
}
|
|
147
151
|
}
|
|
148
152
|
};
|
|
149
153
|
const isCloningToAnotherProject = applicationsOptions.length > 0 && (values.destination.length === 1 && values.destination[0] !== applicationCode || values.destination.length > 1);
|
|
@@ -167,7 +171,12 @@ export function ModalCloningJourney({
|
|
|
167
171
|
placeholder: "ex. Onboarding",
|
|
168
172
|
name: "title",
|
|
169
173
|
value: values.title,
|
|
170
|
-
onChange: e =>
|
|
174
|
+
onChange: e => {
|
|
175
|
+
setValue('title', e.target.value);
|
|
176
|
+
if (e.target.value) {
|
|
177
|
+
clearErrors('title');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
171
180
|
})), React.createElement(FieldBox, {
|
|
172
181
|
title: "Destination projects",
|
|
173
182
|
error: (_errors$destination = errors.destination) === null || _errors$destination === void 0 ? void 0 : _errors$destination.message,
|
package/Table/hooks/index.d.ts
CHANGED
package/Table/hooks/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DataTableParams, DataTableContextSyncType } from '../types';
|
|
2
|
+
export type DataTableContextSyncProps<I, P extends DataTableParams> = {
|
|
3
|
+
getItems: (params: P) => I[];
|
|
4
|
+
params: P;
|
|
5
|
+
onChangeParams: (params: P) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function useDataTableContextSync<I, P extends DataTableParams = DataTableParams>({ getItems, params, onChangeParams, }: DataTableContextSyncProps<I, P>): DataTableContextSyncType<I, P>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
export function useDataTableContextSync({
|
|
3
|
+
getItems,
|
|
4
|
+
params,
|
|
5
|
+
onChangeParams
|
|
6
|
+
}) {
|
|
7
|
+
return useMemo(() => {
|
|
8
|
+
const items = getItems(params);
|
|
9
|
+
return {
|
|
10
|
+
data: {
|
|
11
|
+
items,
|
|
12
|
+
totalPages: Math.ceil(items.length / params.perPage) || 1,
|
|
13
|
+
total: items.length
|
|
14
|
+
},
|
|
15
|
+
params,
|
|
16
|
+
onChangeParams: onChangeParams
|
|
17
|
+
};
|
|
18
|
+
}, [getItems, params, onChangeParams]);
|
|
19
|
+
}
|
package/Table/types.d.ts
CHANGED
|
@@ -18,3 +18,8 @@ export type DataTableContextType<T, P extends DataTableParams> = {
|
|
|
18
18
|
params: P;
|
|
19
19
|
onChangeParams: (params: P) => void;
|
|
20
20
|
};
|
|
21
|
+
export type DataTableContextSyncType<T, P extends DataTableParams> = {
|
|
22
|
+
data: DataTableData<T>;
|
|
23
|
+
params: P;
|
|
24
|
+
onChangeParams: (params: P) => void;
|
|
25
|
+
};
|
package/package.json
CHANGED