next-recomponents 2.0.43 → 2.0.44
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/dist/index.js +22 -11
- package/dist/index.mjs +22 -11
- package/package.json +1 -1
- package/src/pop/index.tsx +7 -6
- package/src/pop/types.ts +1 -0
- package/src/table-advanced/h.table.tsx +16 -4
package/dist/index.js
CHANGED
|
@@ -37185,14 +37185,15 @@ function usePopup() {
|
|
|
37185
37185
|
);
|
|
37186
37186
|
const close = (0, import_react10.useCallback)(
|
|
37187
37187
|
async (confirmed, value) => {
|
|
37188
|
-
var _a, _b;
|
|
37188
|
+
var _a, _b, _c;
|
|
37189
37189
|
const prev = { ...popup };
|
|
37190
37190
|
let visible = false;
|
|
37191
37191
|
if (confirmed) {
|
|
37192
37192
|
(_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
|
|
37193
|
-
} else if (prev == null ? void 0 : prev.
|
|
37194
|
-
visible = !Boolean(await ((_b = prev.
|
|
37193
|
+
} else if (prev == null ? void 0 : prev.onClose) {
|
|
37194
|
+
visible = !Boolean(await ((_b = prev.onClose) == null ? void 0 : _b.call(prev)));
|
|
37195
37195
|
} else {
|
|
37196
|
+
(_c = prev.onCancel) == null ? void 0 : _c.call(prev);
|
|
37196
37197
|
visible = false;
|
|
37197
37198
|
}
|
|
37198
37199
|
const data = { ...prev, visible, inputValue: "" };
|
|
@@ -37218,10 +37219,9 @@ function usePopup() {
|
|
|
37218
37219
|
type: "modal",
|
|
37219
37220
|
message,
|
|
37220
37221
|
color,
|
|
37221
|
-
|
|
37222
|
-
|
|
37223
|
-
|
|
37224
|
-
onCancel: onClose ? async () => {
|
|
37222
|
+
onConfirm: () => resolve(),
|
|
37223
|
+
onCancel: () => resolve(),
|
|
37224
|
+
onClose: onClose ? async () => {
|
|
37225
37225
|
return await (onClose == null ? void 0 : onClose());
|
|
37226
37226
|
} : void 0,
|
|
37227
37227
|
icons,
|
|
@@ -39165,8 +39165,13 @@ function HTable({
|
|
|
39165
39165
|
onClick: (e) => {
|
|
39166
39166
|
context.excel.export(
|
|
39167
39167
|
context.data.map((d) => {
|
|
39168
|
-
const
|
|
39169
|
-
|
|
39168
|
+
const obj = {};
|
|
39169
|
+
for (let key in d) {
|
|
39170
|
+
if (!key.startsWith("_")) {
|
|
39171
|
+
obj[key] = d[key];
|
|
39172
|
+
}
|
|
39173
|
+
}
|
|
39174
|
+
return obj;
|
|
39170
39175
|
})
|
|
39171
39176
|
);
|
|
39172
39177
|
},
|
|
@@ -39352,7 +39357,10 @@ function HTable({
|
|
|
39352
39357
|
children: ((_e = (_d = context.buttons[key]) == null ? void 0 : _d.props) == null ? void 0 : _e.children) ? item : null,
|
|
39353
39358
|
onClick: async (e) => {
|
|
39354
39359
|
var _a2, _b2;
|
|
39355
|
-
const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onClick) == null ? void 0 : _b2.call(_a2,
|
|
39360
|
+
const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onClick) == null ? void 0 : _b2.call(_a2, {
|
|
39361
|
+
e,
|
|
39362
|
+
row
|
|
39363
|
+
})) || {};
|
|
39356
39364
|
const newData = [...context.data];
|
|
39357
39365
|
const index = newData.findIndex((f) => f.id == (row == null ? void 0 : row.id));
|
|
39358
39366
|
newData[index] = { ...newData[index], ...ret };
|
|
@@ -39361,7 +39369,10 @@ function HTable({
|
|
|
39361
39369
|
onChange: async (e) => {
|
|
39362
39370
|
var _a2, _b2, _c2;
|
|
39363
39371
|
const value = e.target.value;
|
|
39364
|
-
const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2,
|
|
39372
|
+
const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, {
|
|
39373
|
+
e,
|
|
39374
|
+
row
|
|
39375
|
+
})) || {};
|
|
39365
39376
|
const newData = [...context.data];
|
|
39366
39377
|
const index = newData.findIndex((f) => f.id == (row == null ? void 0 : row.id));
|
|
39367
39378
|
if (index >= 0) {
|
package/dist/index.mjs
CHANGED
|
@@ -37170,14 +37170,15 @@ function usePopup() {
|
|
|
37170
37170
|
);
|
|
37171
37171
|
const close = useCallback(
|
|
37172
37172
|
async (confirmed, value) => {
|
|
37173
|
-
var _a, _b;
|
|
37173
|
+
var _a, _b, _c;
|
|
37174
37174
|
const prev = { ...popup };
|
|
37175
37175
|
let visible = false;
|
|
37176
37176
|
if (confirmed) {
|
|
37177
37177
|
(_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
|
|
37178
|
-
} else if (prev == null ? void 0 : prev.
|
|
37179
|
-
visible = !Boolean(await ((_b = prev.
|
|
37178
|
+
} else if (prev == null ? void 0 : prev.onClose) {
|
|
37179
|
+
visible = !Boolean(await ((_b = prev.onClose) == null ? void 0 : _b.call(prev)));
|
|
37180
37180
|
} else {
|
|
37181
|
+
(_c = prev.onCancel) == null ? void 0 : _c.call(prev);
|
|
37181
37182
|
visible = false;
|
|
37182
37183
|
}
|
|
37183
37184
|
const data = { ...prev, visible, inputValue: "" };
|
|
@@ -37203,10 +37204,9 @@ function usePopup() {
|
|
|
37203
37204
|
type: "modal",
|
|
37204
37205
|
message,
|
|
37205
37206
|
color,
|
|
37206
|
-
|
|
37207
|
-
|
|
37208
|
-
|
|
37209
|
-
onCancel: onClose ? async () => {
|
|
37207
|
+
onConfirm: () => resolve(),
|
|
37208
|
+
onCancel: () => resolve(),
|
|
37209
|
+
onClose: onClose ? async () => {
|
|
37210
37210
|
return await (onClose == null ? void 0 : onClose());
|
|
37211
37211
|
} : void 0,
|
|
37212
37212
|
icons,
|
|
@@ -39163,8 +39163,13 @@ function HTable({
|
|
|
39163
39163
|
onClick: (e) => {
|
|
39164
39164
|
context.excel.export(
|
|
39165
39165
|
context.data.map((d) => {
|
|
39166
|
-
const
|
|
39167
|
-
|
|
39166
|
+
const obj = {};
|
|
39167
|
+
for (let key in d) {
|
|
39168
|
+
if (!key.startsWith("_")) {
|
|
39169
|
+
obj[key] = d[key];
|
|
39170
|
+
}
|
|
39171
|
+
}
|
|
39172
|
+
return obj;
|
|
39168
39173
|
})
|
|
39169
39174
|
);
|
|
39170
39175
|
},
|
|
@@ -39350,7 +39355,10 @@ function HTable({
|
|
|
39350
39355
|
children: ((_e = (_d = context.buttons[key]) == null ? void 0 : _d.props) == null ? void 0 : _e.children) ? item : null,
|
|
39351
39356
|
onClick: async (e) => {
|
|
39352
39357
|
var _a2, _b2;
|
|
39353
|
-
const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onClick) == null ? void 0 : _b2.call(_a2,
|
|
39358
|
+
const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onClick) == null ? void 0 : _b2.call(_a2, {
|
|
39359
|
+
e,
|
|
39360
|
+
row
|
|
39361
|
+
})) || {};
|
|
39354
39362
|
const newData = [...context.data];
|
|
39355
39363
|
const index = newData.findIndex((f) => f.id == (row == null ? void 0 : row.id));
|
|
39356
39364
|
newData[index] = { ...newData[index], ...ret };
|
|
@@ -39359,7 +39367,10 @@ function HTable({
|
|
|
39359
39367
|
onChange: async (e) => {
|
|
39360
39368
|
var _a2, _b2, _c2;
|
|
39361
39369
|
const value = e.target.value;
|
|
39362
|
-
const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2,
|
|
39370
|
+
const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, {
|
|
39371
|
+
e,
|
|
39372
|
+
row
|
|
39373
|
+
})) || {};
|
|
39363
39374
|
const newData = [...context.data];
|
|
39364
39375
|
const index = newData.findIndex((f) => f.id == (row == null ? void 0 : row.id));
|
|
39365
39376
|
if (index >= 0) {
|
package/package.json
CHANGED
package/src/pop/index.tsx
CHANGED
|
@@ -24,6 +24,7 @@ export default function usePopup() {
|
|
|
24
24
|
const open = useCallback(
|
|
25
25
|
(partial: Omit<PopupState, "visible" | "inputValue">) => {
|
|
26
26
|
const { message, ...rest } = partial;
|
|
27
|
+
|
|
27
28
|
messageRef.current = message as any;
|
|
28
29
|
setPopup({ ...rest, visible: true, inputValue: "" });
|
|
29
30
|
},
|
|
@@ -36,9 +37,10 @@ export default function usePopup() {
|
|
|
36
37
|
let visible = false;
|
|
37
38
|
if (confirmed) {
|
|
38
39
|
prev.onConfirm?.(value);
|
|
39
|
-
} else if (prev?.
|
|
40
|
-
visible = !Boolean(await prev.
|
|
40
|
+
} else if (prev?.onClose) {
|
|
41
|
+
visible = !Boolean(await prev.onClose?.());
|
|
41
42
|
} else {
|
|
43
|
+
prev.onCancel?.();
|
|
42
44
|
visible = false;
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -76,10 +78,9 @@ export default function usePopup() {
|
|
|
76
78
|
type: "modal",
|
|
77
79
|
message,
|
|
78
80
|
color,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
onCancel: onClose
|
|
81
|
+
onConfirm: () => resolve(),
|
|
82
|
+
onCancel: () => resolve(),
|
|
83
|
+
onClose: onClose
|
|
83
84
|
? async () => {
|
|
84
85
|
return await onClose?.();
|
|
85
86
|
}
|
package/src/pop/types.ts
CHANGED
|
@@ -164,8 +164,14 @@ export default function HTable({
|
|
|
164
164
|
onClick={(e) => {
|
|
165
165
|
context.excel.export(
|
|
166
166
|
context.data.map((d) => {
|
|
167
|
-
const
|
|
168
|
-
|
|
167
|
+
const obj: any = {};
|
|
168
|
+
|
|
169
|
+
for (let key in d) {
|
|
170
|
+
if (!key.startsWith("_")) {
|
|
171
|
+
obj[key] = d[key];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return obj;
|
|
169
175
|
}),
|
|
170
176
|
);
|
|
171
177
|
}}
|
|
@@ -405,7 +411,10 @@ export default function HTable({
|
|
|
405
411
|
: null,
|
|
406
412
|
onClick: async (e: any) => {
|
|
407
413
|
const ret =
|
|
408
|
-
(await context.buttons[key].props?.onClick?.(
|
|
414
|
+
(await context.buttons[key].props?.onClick?.({
|
|
415
|
+
e,
|
|
416
|
+
row,
|
|
417
|
+
})) || {};
|
|
409
418
|
const newData = [...context.data];
|
|
410
419
|
const index = newData.findIndex((f) => f.id == row?.id);
|
|
411
420
|
newData[index] = { ...newData[index], ...ret };
|
|
@@ -414,7 +423,10 @@ export default function HTable({
|
|
|
414
423
|
onChange: async (e: { target: { value: string } }) => {
|
|
415
424
|
const value = e.target.value;
|
|
416
425
|
const ret =
|
|
417
|
-
(await context.buttons[key].props?.onChange?.(
|
|
426
|
+
(await context.buttons[key].props?.onChange?.({
|
|
427
|
+
e,
|
|
428
|
+
row,
|
|
429
|
+
})) || {};
|
|
418
430
|
|
|
419
431
|
const newData = [...context.data];
|
|
420
432
|
const index = newData.findIndex((f) => f.id == row?.id);
|