aq-fe-framework 0.1.305 → 0.1.307
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.
@@ -135,8 +135,8 @@ import { ActionIcon } from "@mantine/core";
|
|
135
135
|
import { IconDeviceFloppy, IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
|
136
136
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
137
137
|
function MyActionIcon(_a) {
|
138
|
-
var _b = _a, { children, crudType } = _b, rest = __objRest(_b, ["children", "crudType"]);
|
139
|
-
if (
|
138
|
+
var _b = _a, { children, crudType = "default" } = _b, rest = __objRest(_b, ["children", "crudType"]);
|
139
|
+
if (crudType == "default") {
|
140
140
|
return /* @__PURE__ */ jsx4(ActionIcon, __spreadProps(__spreadValues({ color: "indigo" }, rest), { children }));
|
141
141
|
}
|
142
142
|
if (crudType == "create") {
|
@@ -835,7 +835,7 @@ function MyButtonModal(_a) {
|
|
835
835
|
"objectName"
|
836
836
|
]);
|
837
837
|
const objectNameLower = objectName == null ? void 0 : objectName.toLowerCase();
|
838
|
-
if (crudType
|
838
|
+
if (crudType == "default") {
|
839
839
|
return /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
840
840
|
/* @__PURE__ */ jsx17(Button3, __spreadProps(__spreadValues({ onClick: disclosure == null ? void 0 : disclosure[1].open, color: "indigo" }, rest), { children: label })),
|
841
841
|
/* @__PURE__ */ jsx17(
|
package/dist/core/index.d.mts
CHANGED
@@ -24,7 +24,7 @@ interface CoreButtonCreateUpdateProps<IReq, IRes> {
|
|
24
24
|
actionIconProps?: ActionIconProps;
|
25
25
|
buttonProps?: ButtonProps;
|
26
26
|
isUpdate?: boolean;
|
27
|
-
onSubmit: (values: IReq) => Promise<AxiosResponse<MyApiResponse<IRes
|
27
|
+
onSubmit: (values: IReq) => Promise<AxiosResponse<MyApiResponse<IRes>>> | void;
|
28
28
|
onSuccess?: () => void;
|
29
29
|
onError?: () => void;
|
30
30
|
form: UseFormReturnType<IReq>;
|
package/dist/core/index.mjs
CHANGED
@@ -205,7 +205,23 @@ function CoreButtonCreateUpdate({
|
|
205
205
|
const disclosure = externalDisclosure != null ? externalDisclosure : defaultDisclosure;
|
206
206
|
const queryClient = useQueryClient();
|
207
207
|
const mutation = useMyReactMutation({
|
208
|
-
axiosFn: (values) =>
|
208
|
+
axiosFn: (values) => {
|
209
|
+
const result = onSubmit(values);
|
210
|
+
if (result === void 0) {
|
211
|
+
return Promise.resolve({
|
212
|
+
data: {
|
213
|
+
message: "T\u1EA1o th\xE0nh c\xF4ng (gi\u1EA3 l\u1EADp)",
|
214
|
+
data: {},
|
215
|
+
isSuccess: 1
|
216
|
+
},
|
217
|
+
status: 200,
|
218
|
+
statusText: "OK",
|
219
|
+
headers: {},
|
220
|
+
config: {}
|
221
|
+
});
|
222
|
+
}
|
223
|
+
return result;
|
224
|
+
},
|
209
225
|
options: __spreadValues(__spreadValues({
|
210
226
|
onSuccess: () => {
|
211
227
|
queryClient.invalidateQueries();
|