react-table-edit 1.2.17 → 1.2.19
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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +25 -14
- package/dist/index.mjs +24 -14
- package/package.json +1 -3
package/dist/index.d.mts
CHANGED
|
@@ -18,6 +18,7 @@ type IFColumnSelectTable = {
|
|
|
18
18
|
};
|
|
19
19
|
type IFTableSelectFormat = {
|
|
20
20
|
dateFormat?: string;
|
|
21
|
+
datetimeFormat?: string;
|
|
21
22
|
decimalSeparator?: string;
|
|
22
23
|
thousandSeparator?: string;
|
|
23
24
|
colorNegative?: string;
|
|
@@ -170,6 +171,7 @@ type IFTableEditSearchSetting = {
|
|
|
170
171
|
};
|
|
171
172
|
type IFTableEditFormat = {
|
|
172
173
|
dateFormat?: string;
|
|
174
|
+
datetimeFormat?: string;
|
|
173
175
|
decimalSeparator?: string;
|
|
174
176
|
thousandSeparator?: string;
|
|
175
177
|
colorNegative?: string;
|
|
@@ -267,6 +269,7 @@ declare const generateUUID: () => string;
|
|
|
267
269
|
*/
|
|
268
270
|
declare const formartNumberic: (str: string | number, decimalSeparator: string, thousandSeparator: string, fraction?: number, isDone?: boolean, haveNegative?: boolean) => string;
|
|
269
271
|
declare const roundNumber: (num: number, fraction: number) => number;
|
|
272
|
+
declare const formatDateTime: (data: any, format?: string) => string;
|
|
270
273
|
|
|
271
274
|
type IFDataProps = {
|
|
272
275
|
buttonWidth?: number;
|
|
@@ -357,4 +360,4 @@ interface IFDataInputStyle {
|
|
|
357
360
|
}
|
|
358
361
|
declare const InputStyleComponent: (props: IFDataInputStyle) => react_jsx_runtime.JSX.Element;
|
|
359
362
|
|
|
360
|
-
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditFormat, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFTableSelectFormat, type IFTableTreeSelectFormat, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
|
363
|
+
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditFormat, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFTableSelectFormat, type IFTableTreeSelectFormat, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ type IFColumnSelectTable = {
|
|
|
18
18
|
};
|
|
19
19
|
type IFTableSelectFormat = {
|
|
20
20
|
dateFormat?: string;
|
|
21
|
+
datetimeFormat?: string;
|
|
21
22
|
decimalSeparator?: string;
|
|
22
23
|
thousandSeparator?: string;
|
|
23
24
|
colorNegative?: string;
|
|
@@ -170,6 +171,7 @@ type IFTableEditSearchSetting = {
|
|
|
170
171
|
};
|
|
171
172
|
type IFTableEditFormat = {
|
|
172
173
|
dateFormat?: string;
|
|
174
|
+
datetimeFormat?: string;
|
|
173
175
|
decimalSeparator?: string;
|
|
174
176
|
thousandSeparator?: string;
|
|
175
177
|
colorNegative?: string;
|
|
@@ -267,6 +269,7 @@ declare const generateUUID: () => string;
|
|
|
267
269
|
*/
|
|
268
270
|
declare const formartNumberic: (str: string | number, decimalSeparator: string, thousandSeparator: string, fraction?: number, isDone?: boolean, haveNegative?: boolean) => string;
|
|
269
271
|
declare const roundNumber: (num: number, fraction: number) => number;
|
|
272
|
+
declare const formatDateTime: (data: any, format?: string) => string;
|
|
270
273
|
|
|
271
274
|
type IFDataProps = {
|
|
272
275
|
buttonWidth?: number;
|
|
@@ -357,4 +360,4 @@ interface IFDataInputStyle {
|
|
|
357
360
|
}
|
|
358
361
|
declare const InputStyleComponent: (props: IFDataInputStyle) => react_jsx_runtime.JSX.Element;
|
|
359
362
|
|
|
360
|
-
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditFormat, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFTableSelectFormat, type IFTableTreeSelectFormat, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
|
363
|
+
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditFormat, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFTableSelectFormat, type IFTableTreeSelectFormat, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ __export(src_exports, {
|
|
|
38
38
|
checkThousandSeparator: () => checkThousandSeparator,
|
|
39
39
|
default: () => src_default,
|
|
40
40
|
formartNumberic: () => formartNumberic,
|
|
41
|
+
formatDateTime: () => formatDateTime,
|
|
41
42
|
generateUUID: () => generateUUID,
|
|
42
43
|
isNullOrUndefined: () => isNullOrUndefined,
|
|
43
44
|
messageBoxConfirm: () => messageBoxConfirm,
|
|
@@ -356,9 +357,20 @@ var roundNumber = (num, fraction) => {
|
|
|
356
357
|
const result = Math.round(num * base) / base;
|
|
357
358
|
return result;
|
|
358
359
|
};
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
var formatDateTime = (data, format = "dd/MM/yyyy") => {
|
|
361
|
+
if (!data) {
|
|
362
|
+
return "";
|
|
363
|
+
}
|
|
364
|
+
const date = new Date(data);
|
|
365
|
+
const map = {
|
|
366
|
+
dd: String(date.getDate()).padStart(2, "0"),
|
|
367
|
+
MM: String(date.getMonth() + 1).padStart(2, "0"),
|
|
368
|
+
yyyy: date.getFullYear(),
|
|
369
|
+
HH: String(date.getHours()).padStart(2, "0"),
|
|
370
|
+
mm: String(date.getMinutes()).padStart(2, "0")
|
|
371
|
+
};
|
|
372
|
+
return format.replace(/dd|MM|yyyy|HH|mm/g, (match) => map[match]);
|
|
373
|
+
};
|
|
362
374
|
|
|
363
375
|
// src/component/edit-form/index.tsx
|
|
364
376
|
var import_react8 = require("react");
|
|
@@ -604,7 +616,6 @@ var import_react6 = __toESM(require("react"));
|
|
|
604
616
|
var import_reactstrap4 = require("reactstrap");
|
|
605
617
|
var import_react_i18next3 = require("react-i18next");
|
|
606
618
|
var import_classnames4 = __toESM(require("classnames"));
|
|
607
|
-
var import_moment = __toESM(require("moment"));
|
|
608
619
|
var import_becoxy_icons2 = require("becoxy-icons");
|
|
609
620
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
610
621
|
var defaultMaxHeight = 250;
|
|
@@ -927,9 +938,9 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
927
938
|
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
928
939
|
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true, false) ?? 0;
|
|
929
940
|
} else if (col.type === "date") {
|
|
930
|
-
valueDisplay = valueDisplay ? (
|
|
941
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat) : "";
|
|
931
942
|
} else if (col.type === "datetime") {
|
|
932
|
-
valueDisplay = valueDisplay ? (
|
|
943
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
|
|
933
944
|
}
|
|
934
945
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react6.Fragment, { children: [
|
|
935
946
|
col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -1077,7 +1088,7 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
1077
1088
|
if (element) {
|
|
1078
1089
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1079
1090
|
index === 0 ? "" : ", ",
|
|
1080
|
-
formatOptionLabel ? formatOptionLabel(
|
|
1091
|
+
formatOptionLabel ? formatOptionLabel(element) : element[fieldLabel ?? "label"]
|
|
1081
1092
|
] }, index);
|
|
1082
1093
|
}
|
|
1083
1094
|
}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_classnames4.default)("select-value", { "d-none": searchTerm }), children: [
|
|
@@ -2276,7 +2287,6 @@ var import_react15 = __toESM(require("react"));
|
|
|
2276
2287
|
var import_reactstrap10 = require("reactstrap");
|
|
2277
2288
|
var import_react_i18next11 = require("react-i18next");
|
|
2278
2289
|
var import_classnames13 = __toESM(require("classnames"));
|
|
2279
|
-
var import_moment2 = __toESM(require("moment"));
|
|
2280
2290
|
var import_becoxy_icons6 = require("becoxy-icons");
|
|
2281
2291
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2282
2292
|
var defaultMaxHeight2 = 250;
|
|
@@ -2551,9 +2561,9 @@ var SelectTableTree = (0, import_react15.forwardRef)((props, ref) => {
|
|
|
2551
2561
|
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
2552
2562
|
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
2553
2563
|
} else if (col.type === "date") {
|
|
2554
|
-
valueDisplay = valueDisplay ? (
|
|
2564
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat) : "";
|
|
2555
2565
|
} else if (col.type === "datetime") {
|
|
2556
|
-
valueDisplay = valueDisplay ? (
|
|
2566
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
|
|
2557
2567
|
}
|
|
2558
2568
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react15.Fragment, { children: [
|
|
2559
2569
|
col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
@@ -3053,7 +3063,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3053
3063
|
{
|
|
3054
3064
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
3055
3065
|
style: { textAlign: col.textAlign, height: 29 },
|
|
3056
|
-
value: row[col.field] ? (
|
|
3066
|
+
value: row[col.field] ? formatDateTime(row[col.field], "yyyy-MM-dd") : row[col.field],
|
|
3057
3067
|
onChange: (val) => {
|
|
3058
3068
|
row[col.field] = val.target.value;
|
|
3059
3069
|
if (col.callback) {
|
|
@@ -3082,7 +3092,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3082
3092
|
{
|
|
3083
3093
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
3084
3094
|
style: { textAlign: col.textAlign, height: 29 },
|
|
3085
|
-
value: row[col.field] ? (
|
|
3095
|
+
value: row[col.field] ? formatDateTime(row[col.field], "yyyy-MM-dd HH:mm") : row[col.field],
|
|
3086
3096
|
onChange: (val) => {
|
|
3087
3097
|
row[col.field] = val.target.value;
|
|
3088
3098
|
if (col.callback) {
|
|
@@ -3939,9 +3949,9 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3939
3949
|
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
3940
3950
|
value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true, false) ?? 0;
|
|
3941
3951
|
} else if (col.editType === "date") {
|
|
3942
|
-
value = value ? (
|
|
3952
|
+
value = value ? formatDateTime(value, formatSetting?.dateFormat) : "";
|
|
3943
3953
|
} else if (col.editType === "datetime") {
|
|
3944
|
-
value = value ? (
|
|
3954
|
+
value = value ? formatDateTime(value, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
|
|
3945
3955
|
}
|
|
3946
3956
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
3947
3957
|
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
@@ -5348,6 +5358,7 @@ var src_default = table_default;
|
|
|
5348
5358
|
checkDecimalSeparator,
|
|
5349
5359
|
checkThousandSeparator,
|
|
5350
5360
|
formartNumberic,
|
|
5361
|
+
formatDateTime,
|
|
5351
5362
|
generateUUID,
|
|
5352
5363
|
isNullOrUndefined,
|
|
5353
5364
|
messageBoxConfirm,
|
package/dist/index.mjs
CHANGED
|
@@ -301,9 +301,20 @@ var roundNumber = (num, fraction) => {
|
|
|
301
301
|
const result = Math.round(num * base) / base;
|
|
302
302
|
return result;
|
|
303
303
|
};
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
304
|
+
var formatDateTime = (data, format = "dd/MM/yyyy") => {
|
|
305
|
+
if (!data) {
|
|
306
|
+
return "";
|
|
307
|
+
}
|
|
308
|
+
const date = new Date(data);
|
|
309
|
+
const map = {
|
|
310
|
+
dd: String(date.getDate()).padStart(2, "0"),
|
|
311
|
+
MM: String(date.getMonth() + 1).padStart(2, "0"),
|
|
312
|
+
yyyy: date.getFullYear(),
|
|
313
|
+
HH: String(date.getHours()).padStart(2, "0"),
|
|
314
|
+
mm: String(date.getMinutes()).padStart(2, "0")
|
|
315
|
+
};
|
|
316
|
+
return format.replace(/dd|MM|yyyy|HH|mm/g, (match) => map[match]);
|
|
317
|
+
};
|
|
307
318
|
|
|
308
319
|
// src/component/edit-form/index.tsx
|
|
309
320
|
import { forwardRef as forwardRef2, useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
|
|
@@ -567,7 +578,6 @@ import {
|
|
|
567
578
|
} from "reactstrap";
|
|
568
579
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
569
580
|
import classnames3 from "classnames";
|
|
570
|
-
import moment from "moment";
|
|
571
581
|
import { Plus } from "becoxy-icons";
|
|
572
582
|
import { Fragment as Fragment6, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
573
583
|
var defaultMaxHeight = 250;
|
|
@@ -890,9 +900,9 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
890
900
|
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
891
901
|
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true, false) ?? 0;
|
|
892
902
|
} else if (col.type === "date") {
|
|
893
|
-
valueDisplay = valueDisplay ?
|
|
903
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat) : "";
|
|
894
904
|
} else if (col.type === "datetime") {
|
|
895
|
-
valueDisplay = valueDisplay ?
|
|
905
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
|
|
896
906
|
}
|
|
897
907
|
return /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
898
908
|
col.visible !== false && /* @__PURE__ */ jsx5(
|
|
@@ -1040,7 +1050,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
1040
1050
|
if (element) {
|
|
1041
1051
|
return /* @__PURE__ */ jsxs5("span", { children: [
|
|
1042
1052
|
index === 0 ? "" : ", ",
|
|
1043
|
-
formatOptionLabel ? formatOptionLabel(
|
|
1053
|
+
formatOptionLabel ? formatOptionLabel(element) : element[fieldLabel ?? "label"]
|
|
1044
1054
|
] }, index);
|
|
1045
1055
|
}
|
|
1046
1056
|
}) }) }) : /* @__PURE__ */ jsx5(Fragment6, { children: /* @__PURE__ */ jsxs5("div", { className: classnames3("select-value", { "d-none": searchTerm }), children: [
|
|
@@ -2247,7 +2257,6 @@ import {
|
|
|
2247
2257
|
} from "reactstrap";
|
|
2248
2258
|
import { useTranslation as useTranslation11 } from "react-i18next";
|
|
2249
2259
|
import classnames8 from "classnames";
|
|
2250
|
-
import moment2 from "moment";
|
|
2251
2260
|
import { ChevronRight as ChevronRight3, Plus as Plus3 } from "becoxy-icons";
|
|
2252
2261
|
import { Fragment as Fragment19, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2253
2262
|
var defaultMaxHeight2 = 250;
|
|
@@ -2522,9 +2531,9 @@ var SelectTableTree = forwardRef3((props, ref) => {
|
|
|
2522
2531
|
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
2523
2532
|
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
2524
2533
|
} else if (col.type === "date") {
|
|
2525
|
-
valueDisplay = valueDisplay ?
|
|
2534
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat) : "";
|
|
2526
2535
|
} else if (col.type === "datetime") {
|
|
2527
|
-
valueDisplay = valueDisplay ?
|
|
2536
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
|
|
2528
2537
|
}
|
|
2529
2538
|
return /* @__PURE__ */ jsxs14(Fragment18, { children: [
|
|
2530
2539
|
col.visible !== false && /* @__PURE__ */ jsxs14(
|
|
@@ -3024,7 +3033,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3024
3033
|
{
|
|
3025
3034
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
3026
3035
|
style: { textAlign: col.textAlign, height: 29 },
|
|
3027
|
-
value: row[col.field] ?
|
|
3036
|
+
value: row[col.field] ? formatDateTime(row[col.field], "yyyy-MM-dd") : row[col.field],
|
|
3028
3037
|
onChange: (val) => {
|
|
3029
3038
|
row[col.field] = val.target.value;
|
|
3030
3039
|
if (col.callback) {
|
|
@@ -3053,7 +3062,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3053
3062
|
{
|
|
3054
3063
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
3055
3064
|
style: { textAlign: col.textAlign, height: 29 },
|
|
3056
|
-
value: row[col.field] ?
|
|
3065
|
+
value: row[col.field] ? formatDateTime(row[col.field], "yyyy-MM-dd HH:mm") : row[col.field],
|
|
3057
3066
|
onChange: (val) => {
|
|
3058
3067
|
row[col.field] = val.target.value;
|
|
3059
3068
|
if (col.callback) {
|
|
@@ -3910,9 +3919,9 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3910
3919
|
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
3911
3920
|
value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true, false) ?? 0;
|
|
3912
3921
|
} else if (col.editType === "date") {
|
|
3913
|
-
value = value ?
|
|
3922
|
+
value = value ? formatDateTime(value, formatSetting?.dateFormat) : "";
|
|
3914
3923
|
} else if (col.editType === "datetime") {
|
|
3915
|
-
value = value ?
|
|
3924
|
+
value = value ? formatDateTime(value, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
|
|
3916
3925
|
}
|
|
3917
3926
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
3918
3927
|
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
@@ -5319,6 +5328,7 @@ export {
|
|
|
5319
5328
|
checkThousandSeparator,
|
|
5320
5329
|
src_default as default,
|
|
5321
5330
|
formartNumberic,
|
|
5331
|
+
formatDateTime,
|
|
5322
5332
|
generateUUID,
|
|
5323
5333
|
isNullOrUndefined,
|
|
5324
5334
|
messageBoxConfirm,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-table-edit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,9 +25,7 @@
|
|
|
25
25
|
"@hookform/resolvers": "^2.8.10",
|
|
26
26
|
"@types/react-resizable": "^3.0.7",
|
|
27
27
|
"becoxy-icons": "1.8.1",
|
|
28
|
-
"bootstrap": "5.1.0",
|
|
29
28
|
"classnames": "2.3.1",
|
|
30
|
-
"moment": "^2.29.3",
|
|
31
29
|
"react": "^18.1.0",
|
|
32
30
|
"react-dom": "^18.1.0",
|
|
33
31
|
"react-hook-form": "7.43.9",
|