@bsol-oss/react-datatable5 9.0.1 → 9.0.2
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 +10 -10
- package/dist/index.mjs +10 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var hi = require('react-icons/hi');
|
|
|
29
29
|
var axios = require('axios');
|
|
30
30
|
var reactHookForm = require('react-hook-form');
|
|
31
31
|
var dayjs = require('dayjs');
|
|
32
|
+
var ti = require('react-icons/ti');
|
|
32
33
|
var reactI18next = require('react-i18next');
|
|
33
34
|
|
|
34
35
|
function _interopNamespaceDefault(e) {
|
|
@@ -2570,8 +2571,8 @@ const PaginationPageText = React__namespace.forwardRef(function PaginationPageTe
|
|
|
2570
2571
|
if (format === "short")
|
|
2571
2572
|
return `${page} / ${totalPages}`;
|
|
2572
2573
|
if (format === "compact")
|
|
2573
|
-
return `${page}
|
|
2574
|
-
return `${pageRange.start + 1} - ${Math.min(pageRange.end, count)}
|
|
2574
|
+
return `${page} / ${totalPages}`;
|
|
2575
|
+
return `${pageRange.start + 1} - ${Math.min(pageRange.end, count)} / ${count}`;
|
|
2575
2576
|
}, [format, page, totalPages, pageRange, count]);
|
|
2576
2577
|
return (jsxRuntime.jsx(react.Text, { fontWeight: "medium", ref: ref, ...rest, children: content }));
|
|
2577
2578
|
});
|
|
@@ -4329,23 +4330,22 @@ const FileDropzone = ({ children = undefined, gridProps = {}, onDrop = () => { }
|
|
|
4329
4330
|
const FilePicker = ({ column }) => {
|
|
4330
4331
|
const { setValue, formState: { errors }, watch, } = reactHookForm.useFormContext();
|
|
4331
4332
|
const { schema, translate } = useSchemaContext();
|
|
4332
|
-
displayText;
|
|
4333
4333
|
const { required } = schema;
|
|
4334
4334
|
const isRequired = required?.some((columnId) => columnId === column);
|
|
4335
4335
|
if (schema.properties == undefined) {
|
|
4336
4336
|
throw new Error("schema properties when using String Input Field");
|
|
4337
4337
|
}
|
|
4338
|
-
const { gridColumn, gridRow
|
|
4338
|
+
const { gridColumn, gridRow } = schema.properties[column];
|
|
4339
4339
|
const currentFiles = (watch(column) ?? []);
|
|
4340
4340
|
return (jsxRuntime.jsxs(Field, { label: `${translate.t(`${column}.fieldLabel`)}`, required: isRequired, gridColumn: gridColumn ?? "span 4", gridRow: gridRow ?? "span 1", display: "grid", gridTemplateRows: "auto 1fr auto", alignItems: "stretch", children: [jsxRuntime.jsx(FileDropzone, { onDrop: ({ files }) => {
|
|
4341
4341
|
const newFiles = files.filter(({ name }) => !currentFiles.some((cur) => cur.name === name));
|
|
4342
4342
|
setValue(column, [...currentFiles, ...newFiles]);
|
|
4343
|
-
}, placeholder: translate.t(`${column}.fileDropzone`) }), jsxRuntime.jsx(react.Flex, { flexFlow: "
|
|
4344
|
-
return (jsxRuntime.jsx(
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4343
|
+
}, placeholder: translate.t(`${column}.fileDropzone`) }), jsxRuntime.jsx(react.Flex, { flexFlow: "column", gap: 1, children: currentFiles.map((file) => {
|
|
4344
|
+
return (jsxRuntime.jsx(react.Card.Root, { variant: "subtle", children: jsxRuntime.jsxs(react.Card.Body, { gap: "2", cursor: "pointer", onClick: () => {
|
|
4345
|
+
setValue(column, currentFiles.filter(({ name }) => {
|
|
4346
|
+
return name !== file.name;
|
|
4347
|
+
}));
|
|
4348
|
+
}, display: "flex", flexFlow: 'row', alignItems: 'center', padding: '2', children: [jsxRuntime.jsx(react.Box, { children: file.name }), jsxRuntime.jsx(ti.TiDeleteOutline, {})] }) }, file.name));
|
|
4349
4349
|
}) }), errors[`${column}`] && (jsxRuntime.jsx(react.Text, { color: "red.400", children: translate.t(`${column}.fieldRequired`) }))] }));
|
|
4350
4350
|
};
|
|
4351
4351
|
|
package/dist/index.mjs
CHANGED
|
@@ -28,6 +28,7 @@ import { HiColorSwatch, HiOutlineInformationCircle } from 'react-icons/hi';
|
|
|
28
28
|
import axios from 'axios';
|
|
29
29
|
import { useFormContext, FormProvider, useForm as useForm$1 } from 'react-hook-form';
|
|
30
30
|
import dayjs from 'dayjs';
|
|
31
|
+
import { TiDeleteOutline } from 'react-icons/ti';
|
|
31
32
|
import { useTranslation } from 'react-i18next';
|
|
32
33
|
|
|
33
34
|
const DataTableContext = createContext({
|
|
@@ -2550,8 +2551,8 @@ const PaginationPageText = React.forwardRef(function PaginationPageText(props, r
|
|
|
2550
2551
|
if (format === "short")
|
|
2551
2552
|
return `${page} / ${totalPages}`;
|
|
2552
2553
|
if (format === "compact")
|
|
2553
|
-
return `${page}
|
|
2554
|
-
return `${pageRange.start + 1} - ${Math.min(pageRange.end, count)}
|
|
2554
|
+
return `${page} / ${totalPages}`;
|
|
2555
|
+
return `${pageRange.start + 1} - ${Math.min(pageRange.end, count)} / ${count}`;
|
|
2555
2556
|
}, [format, page, totalPages, pageRange, count]);
|
|
2556
2557
|
return (jsx(Text, { fontWeight: "medium", ref: ref, ...rest, children: content }));
|
|
2557
2558
|
});
|
|
@@ -4309,23 +4310,22 @@ const FileDropzone = ({ children = undefined, gridProps = {}, onDrop = () => { }
|
|
|
4309
4310
|
const FilePicker = ({ column }) => {
|
|
4310
4311
|
const { setValue, formState: { errors }, watch, } = useFormContext();
|
|
4311
4312
|
const { schema, translate } = useSchemaContext();
|
|
4312
|
-
displayText;
|
|
4313
4313
|
const { required } = schema;
|
|
4314
4314
|
const isRequired = required?.some((columnId) => columnId === column);
|
|
4315
4315
|
if (schema.properties == undefined) {
|
|
4316
4316
|
throw new Error("schema properties when using String Input Field");
|
|
4317
4317
|
}
|
|
4318
|
-
const { gridColumn, gridRow
|
|
4318
|
+
const { gridColumn, gridRow } = schema.properties[column];
|
|
4319
4319
|
const currentFiles = (watch(column) ?? []);
|
|
4320
4320
|
return (jsxs(Field, { label: `${translate.t(`${column}.fieldLabel`)}`, required: isRequired, gridColumn: gridColumn ?? "span 4", gridRow: gridRow ?? "span 1", display: "grid", gridTemplateRows: "auto 1fr auto", alignItems: "stretch", children: [jsx(FileDropzone, { onDrop: ({ files }) => {
|
|
4321
4321
|
const newFiles = files.filter(({ name }) => !currentFiles.some((cur) => cur.name === name));
|
|
4322
4322
|
setValue(column, [...currentFiles, ...newFiles]);
|
|
4323
|
-
}, placeholder: translate.t(`${column}.fileDropzone`) }), jsx(Flex, { flexFlow: "
|
|
4324
|
-
return (jsx(
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4323
|
+
}, placeholder: translate.t(`${column}.fileDropzone`) }), jsx(Flex, { flexFlow: "column", gap: 1, children: currentFiles.map((file) => {
|
|
4324
|
+
return (jsx(Card.Root, { variant: "subtle", children: jsxs(Card.Body, { gap: "2", cursor: "pointer", onClick: () => {
|
|
4325
|
+
setValue(column, currentFiles.filter(({ name }) => {
|
|
4326
|
+
return name !== file.name;
|
|
4327
|
+
}));
|
|
4328
|
+
}, display: "flex", flexFlow: 'row', alignItems: 'center', padding: '2', children: [jsx(Box, { children: file.name }), jsx(TiDeleteOutline, {})] }) }, file.name));
|
|
4329
4329
|
}) }), errors[`${column}`] && (jsx(Text, { color: "red.400", children: translate.t(`${column}.fieldRequired`) }))] }));
|
|
4330
4330
|
};
|
|
4331
4331
|
|