react-table-edit 0.7.4 → 0.7.5
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +55 -36
- package/dist/index.mjs +52 -33
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -28,11 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var Table_Edit_exports = {};
|
|
32
|
+
__export(Table_Edit_exports, {
|
|
33
33
|
SelectTable: () => SelectTable,
|
|
34
34
|
TabsMenuComponent: () => TabsMenuComponent,
|
|
35
|
-
default: () =>
|
|
35
|
+
default: () => Table_Edit_default,
|
|
36
36
|
formartNumberic: () => formartNumberic,
|
|
37
37
|
generateUUID: () => generateUUID,
|
|
38
38
|
isNullOrUndefined: () => isNullOrUndefined,
|
|
@@ -49,7 +49,7 @@ __export(Table_edit_exports, {
|
|
|
49
49
|
roundNumber: () => roundNumber,
|
|
50
50
|
useOnClickOutside: () => useOnClickOutside
|
|
51
51
|
});
|
|
52
|
-
module.exports = __toCommonJS(
|
|
52
|
+
module.exports = __toCommonJS(Table_Edit_exports);
|
|
53
53
|
|
|
54
54
|
// test-app/src/component/table/index.tsx
|
|
55
55
|
var import_react16 = require("react");
|
|
@@ -749,6 +749,7 @@ var EditForm = (0, import_react8.forwardRef)((props, ref) => {
|
|
|
749
749
|
minWidth,
|
|
750
750
|
onPaste,
|
|
751
751
|
openOnFocus,
|
|
752
|
+
isClearable,
|
|
752
753
|
labelSize = "label-small"
|
|
753
754
|
} = props;
|
|
754
755
|
const { innerWidth } = window;
|
|
@@ -1026,21 +1027,46 @@ var EditForm = (0, import_react8.forwardRef)((props, ref) => {
|
|
|
1026
1027
|
),
|
|
1027
1028
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [
|
|
1028
1029
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : "" }),
|
|
1029
|
-
!onChangeField ? /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1030
|
+
!onChangeField ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "d-flex justify-content-end", children: [
|
|
1031
|
+
isClearable && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1032
|
+
import_reactstrap6.Button,
|
|
1033
|
+
{
|
|
1034
|
+
ref: buttonRef,
|
|
1035
|
+
className: "btn me-50 py-25 px-50",
|
|
1036
|
+
outline: true,
|
|
1037
|
+
onClick: () => {
|
|
1038
|
+
itemsField.forEach((e) => {
|
|
1039
|
+
if (e.type === "numeric") {
|
|
1040
|
+
setValue(e.name, 0);
|
|
1041
|
+
} else {
|
|
1042
|
+
setValue(e.name, "");
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
},
|
|
1046
|
+
onKeyDown: (e) => {
|
|
1047
|
+
if (e.code === "Tab") {
|
|
1048
|
+
closeMenu();
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
children: t("Clear")
|
|
1052
|
+
}
|
|
1053
|
+
),
|
|
1054
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1055
|
+
import_reactstrap6.Button,
|
|
1056
|
+
{
|
|
1057
|
+
ref: buttonRef,
|
|
1058
|
+
color: "primary",
|
|
1059
|
+
className: "btn btn-primary py-25 px-50",
|
|
1060
|
+
onClick: handleSubmit(handleOnSubmit),
|
|
1061
|
+
onKeyDown: (e) => {
|
|
1062
|
+
if (e.code === "Tab") {
|
|
1063
|
+
closeMenu();
|
|
1064
|
+
}
|
|
1065
|
+
},
|
|
1066
|
+
children: t("Save")
|
|
1067
|
+
}
|
|
1068
|
+
)
|
|
1069
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, {})
|
|
1044
1070
|
] })
|
|
1045
1071
|
] }) })
|
|
1046
1072
|
}
|
|
@@ -3073,13 +3099,9 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3073
3099
|
}
|
|
3074
3100
|
};
|
|
3075
3101
|
const getColumn = (col, index) => {
|
|
3076
|
-
const column = contentColumns[col + index];
|
|
3102
|
+
const column = contentColumns.filter((e) => e.visible !== false)[col + index];
|
|
3077
3103
|
if (column) {
|
|
3078
|
-
|
|
3079
|
-
return { ...column };
|
|
3080
|
-
} else {
|
|
3081
|
-
return getColumn(col, index + 1);
|
|
3082
|
-
}
|
|
3104
|
+
return { ...column };
|
|
3083
3105
|
}
|
|
3084
3106
|
return void 0;
|
|
3085
3107
|
};
|
|
@@ -3092,22 +3114,20 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3092
3114
|
for (let index = 0; index < rowsClipboard[0].trimEnd().split(" ").length; index++) {
|
|
3093
3115
|
const stringData = [];
|
|
3094
3116
|
rowsClipboard.forEach((element) => {
|
|
3095
|
-
if (element.trimEnd().split(" ")[index]) {
|
|
3117
|
+
if (element.trimEnd().split(" ")[index] && !stringData.includes(element.trimEnd().split(" ")[index].toString().trim())) {
|
|
3096
3118
|
stringData.push(element.trimEnd().split(" ")[index].toString().trim());
|
|
3097
3119
|
}
|
|
3098
3120
|
});
|
|
3099
3121
|
const column = getColumn(col, index);
|
|
3100
3122
|
if (column) {
|
|
3101
|
-
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + 0])) && column.editEnable) {
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
column.resultValidate = rs;
|
|
3106
|
-
}
|
|
3123
|
+
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + 0])) && column.editEnable && column.onPasteValidate) {
|
|
3124
|
+
const rs = await column.onPasteValidate(stringData.join(","), 0, dataSource[currenRowIndex + 0]);
|
|
3125
|
+
if (rs) {
|
|
3126
|
+
column.resultValidate = rs;
|
|
3107
3127
|
}
|
|
3108
3128
|
}
|
|
3129
|
+
columnsDataChange.push(column);
|
|
3109
3130
|
}
|
|
3110
|
-
columnsDataChange.push(column);
|
|
3111
3131
|
}
|
|
3112
3132
|
for (let indexRow = 0; indexRow < rowsClipboard.length; indexRow++) {
|
|
3113
3133
|
const item = rowsClipboard[indexRow];
|
|
@@ -3121,8 +3141,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3121
3141
|
const stringData = colsClipboard[index].toString().trim();
|
|
3122
3142
|
const column = columnsDataChange[index];
|
|
3123
3143
|
if (column) {
|
|
3124
|
-
|
|
3125
|
-
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + indexRow])) && column.editEnable) {
|
|
3144
|
+
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + indexRow])) && column.editEnable || column.onPaste) {
|
|
3126
3145
|
if (column.onPasteValidate && column.resultValidate) {
|
|
3127
3146
|
const rs = column.resultValidate.find((item2) => item2[column.selectSettings?.fieldValue] === stringData);
|
|
3128
3147
|
if (rs) {
|
|
@@ -3776,7 +3795,7 @@ var TabsMenuComponent = ({
|
|
|
3776
3795
|
};
|
|
3777
3796
|
|
|
3778
3797
|
// index.ts
|
|
3779
|
-
var
|
|
3798
|
+
var Table_Edit_default = table_default;
|
|
3780
3799
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3781
3800
|
0 && (module.exports = {
|
|
3782
3801
|
SelectTable,
|
package/dist/index.mjs
CHANGED
|
@@ -706,6 +706,7 @@ var EditForm = forwardRef((props, ref) => {
|
|
|
706
706
|
minWidth,
|
|
707
707
|
onPaste,
|
|
708
708
|
openOnFocus,
|
|
709
|
+
isClearable,
|
|
709
710
|
labelSize = "label-small"
|
|
710
711
|
} = props;
|
|
711
712
|
const { innerWidth } = window;
|
|
@@ -983,21 +984,46 @@ var EditForm = forwardRef((props, ref) => {
|
|
|
983
984
|
),
|
|
984
985
|
/* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [
|
|
985
986
|
/* @__PURE__ */ jsx7("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : "" }),
|
|
986
|
-
!onChangeField ? /* @__PURE__ */
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
987
|
+
!onChangeField ? /* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-end", children: [
|
|
988
|
+
isClearable && /* @__PURE__ */ jsx7(
|
|
989
|
+
Button,
|
|
990
|
+
{
|
|
991
|
+
ref: buttonRef,
|
|
992
|
+
className: "btn me-50 py-25 px-50",
|
|
993
|
+
outline: true,
|
|
994
|
+
onClick: () => {
|
|
995
|
+
itemsField.forEach((e) => {
|
|
996
|
+
if (e.type === "numeric") {
|
|
997
|
+
setValue(e.name, 0);
|
|
998
|
+
} else {
|
|
999
|
+
setValue(e.name, "");
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
},
|
|
1003
|
+
onKeyDown: (e) => {
|
|
1004
|
+
if (e.code === "Tab") {
|
|
1005
|
+
closeMenu();
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
children: t("Clear")
|
|
1009
|
+
}
|
|
1010
|
+
),
|
|
1011
|
+
/* @__PURE__ */ jsx7(
|
|
1012
|
+
Button,
|
|
1013
|
+
{
|
|
1014
|
+
ref: buttonRef,
|
|
1015
|
+
color: "primary",
|
|
1016
|
+
className: "btn btn-primary py-25 px-50",
|
|
1017
|
+
onClick: handleSubmit(handleOnSubmit),
|
|
1018
|
+
onKeyDown: (e) => {
|
|
1019
|
+
if (e.code === "Tab") {
|
|
1020
|
+
closeMenu();
|
|
1021
|
+
}
|
|
1022
|
+
},
|
|
1023
|
+
children: t("Save")
|
|
1024
|
+
}
|
|
1025
|
+
)
|
|
1026
|
+
] }) : /* @__PURE__ */ jsx7(Fragment7, {})
|
|
1001
1027
|
] })
|
|
1002
1028
|
] }) })
|
|
1003
1029
|
}
|
|
@@ -3039,13 +3065,9 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3039
3065
|
}
|
|
3040
3066
|
};
|
|
3041
3067
|
const getColumn = (col, index) => {
|
|
3042
|
-
const column = contentColumns[col + index];
|
|
3068
|
+
const column = contentColumns.filter((e) => e.visible !== false)[col + index];
|
|
3043
3069
|
if (column) {
|
|
3044
|
-
|
|
3045
|
-
return { ...column };
|
|
3046
|
-
} else {
|
|
3047
|
-
return getColumn(col, index + 1);
|
|
3048
|
-
}
|
|
3070
|
+
return { ...column };
|
|
3049
3071
|
}
|
|
3050
3072
|
return void 0;
|
|
3051
3073
|
};
|
|
@@ -3058,22 +3080,20 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3058
3080
|
for (let index = 0; index < rowsClipboard[0].trimEnd().split(" ").length; index++) {
|
|
3059
3081
|
const stringData = [];
|
|
3060
3082
|
rowsClipboard.forEach((element) => {
|
|
3061
|
-
if (element.trimEnd().split(" ")[index]) {
|
|
3083
|
+
if (element.trimEnd().split(" ")[index] && !stringData.includes(element.trimEnd().split(" ")[index].toString().trim())) {
|
|
3062
3084
|
stringData.push(element.trimEnd().split(" ")[index].toString().trim());
|
|
3063
3085
|
}
|
|
3064
3086
|
});
|
|
3065
3087
|
const column = getColumn(col, index);
|
|
3066
3088
|
if (column) {
|
|
3067
|
-
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + 0])) && column.editEnable) {
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
column.resultValidate = rs;
|
|
3072
|
-
}
|
|
3089
|
+
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + 0])) && column.editEnable && column.onPasteValidate) {
|
|
3090
|
+
const rs = await column.onPasteValidate(stringData.join(","), 0, dataSource[currenRowIndex + 0]);
|
|
3091
|
+
if (rs) {
|
|
3092
|
+
column.resultValidate = rs;
|
|
3073
3093
|
}
|
|
3074
3094
|
}
|
|
3095
|
+
columnsDataChange.push(column);
|
|
3075
3096
|
}
|
|
3076
|
-
columnsDataChange.push(column);
|
|
3077
3097
|
}
|
|
3078
3098
|
for (let indexRow = 0; indexRow < rowsClipboard.length; indexRow++) {
|
|
3079
3099
|
const item = rowsClipboard[indexRow];
|
|
@@ -3087,8 +3107,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3087
3107
|
const stringData = colsClipboard[index].toString().trim();
|
|
3088
3108
|
const column = columnsDataChange[index];
|
|
3089
3109
|
if (column) {
|
|
3090
|
-
|
|
3091
|
-
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + indexRow])) && column.editEnable) {
|
|
3110
|
+
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + indexRow])) && column.editEnable || column.onPaste) {
|
|
3092
3111
|
if (column.onPasteValidate && column.resultValidate) {
|
|
3093
3112
|
const rs = column.resultValidate.find((item2) => item2[column.selectSettings?.fieldValue] === stringData);
|
|
3094
3113
|
if (rs) {
|
|
@@ -3742,11 +3761,11 @@ var TabsMenuComponent = ({
|
|
|
3742
3761
|
};
|
|
3743
3762
|
|
|
3744
3763
|
// index.ts
|
|
3745
|
-
var
|
|
3764
|
+
var Table_Edit_default = table_default;
|
|
3746
3765
|
export {
|
|
3747
3766
|
SelectTable,
|
|
3748
3767
|
TabsMenuComponent,
|
|
3749
|
-
|
|
3768
|
+
Table_Edit_default as default,
|
|
3750
3769
|
formartNumberic,
|
|
3751
3770
|
generateUUID,
|
|
3752
3771
|
isNullOrUndefined,
|