@bsol-oss/react-datatable5 11.0.0-beta.9 → 12.0.0-beta.1
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 +13 -7
- package/dist/index.mjs +13 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4206,7 +4206,7 @@ const getTableData = async ({ serverUrl, in_table, searching = "", where = [], l
|
|
|
4206
4206
|
|
|
4207
4207
|
const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
|
|
4208
4208
|
const { watch, formState: { errors }, setValue, } = reactHookForm.useFormContext();
|
|
4209
|
-
const { serverUrl, idMap, setIdMap, translate } = useSchemaContext();
|
|
4209
|
+
const { serverUrl, idMap, setIdMap, translate, schema: parentSchema, } = useSchemaContext();
|
|
4210
4210
|
const { required, gridColumn, gridRow, renderDisplay, foreign_key } = schema;
|
|
4211
4211
|
const isRequired = required?.some((columnId) => columnId === column);
|
|
4212
4212
|
const { table, column: column_ref, display_column, } = foreign_key;
|
|
@@ -4249,7 +4249,10 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
|
|
|
4249
4249
|
const watchId = watch(colLabel);
|
|
4250
4250
|
const watchIds = (watch(colLabel) ?? []);
|
|
4251
4251
|
reactQuery.useQuery({
|
|
4252
|
-
queryKey: [
|
|
4252
|
+
queryKey: [
|
|
4253
|
+
`idpicker`,
|
|
4254
|
+
{ form: parentSchema.title, column, searchText, limit, page },
|
|
4255
|
+
],
|
|
4253
4256
|
queryFn: async () => {
|
|
4254
4257
|
const data = await getTableData({
|
|
4255
4258
|
serverUrl,
|
|
@@ -4338,12 +4341,15 @@ react.NumberInput.Scrubber;
|
|
|
4338
4341
|
react.NumberInput.Label;
|
|
4339
4342
|
|
|
4340
4343
|
const NumberInputField = ({ schema, column, prefix, }) => {
|
|
4341
|
-
const {
|
|
4344
|
+
const { setValue, formState: { errors }, watch, } = reactHookForm.useFormContext();
|
|
4342
4345
|
const { translate } = useSchemaContext();
|
|
4343
4346
|
const { required, gridColumn, gridRow } = schema;
|
|
4344
4347
|
const isRequired = required?.some((columnId) => columnId === column);
|
|
4345
4348
|
const colLabel = `${prefix}${column}`;
|
|
4346
|
-
|
|
4349
|
+
const value = watch(`${colLabel}`);
|
|
4350
|
+
return (jsxRuntime.jsxs(Field, { label: `${translate.t(removeIndex(`${colLabel}.fieldLabel`))}`, required: isRequired, gridColumn, gridRow, children: [jsxRuntime.jsx(NumberInputRoot, { children: jsxRuntime.jsx(NumberInputField$1, { required: isRequired, value: value, onChange: (event) => {
|
|
4351
|
+
setValue(`${colLabel}`, Number(event.target.value));
|
|
4352
|
+
} }) }), errors[`${column}`] && (jsxRuntime.jsx(react.Text, { color: "red.400", children: translate.t(removeIndex(`${colLabel}.fieldRequired`)) }))] }));
|
|
4347
4353
|
};
|
|
4348
4354
|
|
|
4349
4355
|
const ObjectInput = ({ schema, column, prefix }) => {
|
|
@@ -5046,9 +5052,9 @@ const FormInternal = () => {
|
|
|
5046
5052
|
}, formNoValidate: true, children: translate.t("submit") })] })] }) }));
|
|
5047
5053
|
};
|
|
5048
5054
|
const Form = ({ schema, idMap, setIdMap, form, serverUrl, translate, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, }) => {
|
|
5049
|
-
const { properties } = schema;
|
|
5050
|
-
idListSanityCheck("order", order, properties);
|
|
5051
|
-
idListSanityCheck("ignore", ignore, properties);
|
|
5055
|
+
// const { properties } = schema;
|
|
5056
|
+
// idListSanityCheck("order", order, properties as object);
|
|
5057
|
+
// idListSanityCheck("ignore", ignore, properties as object);
|
|
5052
5058
|
return (jsxRuntime.jsx(SchemaFormContext.Provider, { value: {
|
|
5053
5059
|
schema,
|
|
5054
5060
|
serverUrl,
|
package/dist/index.mjs
CHANGED
|
@@ -4186,7 +4186,7 @@ const getTableData = async ({ serverUrl, in_table, searching = "", where = [], l
|
|
|
4186
4186
|
|
|
4187
4187
|
const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
|
|
4188
4188
|
const { watch, formState: { errors }, setValue, } = useFormContext();
|
|
4189
|
-
const { serverUrl, idMap, setIdMap, translate } = useSchemaContext();
|
|
4189
|
+
const { serverUrl, idMap, setIdMap, translate, schema: parentSchema, } = useSchemaContext();
|
|
4190
4190
|
const { required, gridColumn, gridRow, renderDisplay, foreign_key } = schema;
|
|
4191
4191
|
const isRequired = required?.some((columnId) => columnId === column);
|
|
4192
4192
|
const { table, column: column_ref, display_column, } = foreign_key;
|
|
@@ -4229,7 +4229,10 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
|
|
|
4229
4229
|
const watchId = watch(colLabel);
|
|
4230
4230
|
const watchIds = (watch(colLabel) ?? []);
|
|
4231
4231
|
useQuery({
|
|
4232
|
-
queryKey: [
|
|
4232
|
+
queryKey: [
|
|
4233
|
+
`idpicker`,
|
|
4234
|
+
{ form: parentSchema.title, column, searchText, limit, page },
|
|
4235
|
+
],
|
|
4233
4236
|
queryFn: async () => {
|
|
4234
4237
|
const data = await getTableData({
|
|
4235
4238
|
serverUrl,
|
|
@@ -4318,12 +4321,15 @@ NumberInput.Scrubber;
|
|
|
4318
4321
|
NumberInput.Label;
|
|
4319
4322
|
|
|
4320
4323
|
const NumberInputField = ({ schema, column, prefix, }) => {
|
|
4321
|
-
const {
|
|
4324
|
+
const { setValue, formState: { errors }, watch, } = useFormContext();
|
|
4322
4325
|
const { translate } = useSchemaContext();
|
|
4323
4326
|
const { required, gridColumn, gridRow } = schema;
|
|
4324
4327
|
const isRequired = required?.some((columnId) => columnId === column);
|
|
4325
4328
|
const colLabel = `${prefix}${column}`;
|
|
4326
|
-
|
|
4329
|
+
const value = watch(`${colLabel}`);
|
|
4330
|
+
return (jsxs(Field, { label: `${translate.t(removeIndex(`${colLabel}.fieldLabel`))}`, required: isRequired, gridColumn, gridRow, children: [jsx(NumberInputRoot, { children: jsx(NumberInputField$1, { required: isRequired, value: value, onChange: (event) => {
|
|
4331
|
+
setValue(`${colLabel}`, Number(event.target.value));
|
|
4332
|
+
} }) }), errors[`${column}`] && (jsx(Text, { color: "red.400", children: translate.t(removeIndex(`${colLabel}.fieldRequired`)) }))] }));
|
|
4327
4333
|
};
|
|
4328
4334
|
|
|
4329
4335
|
const ObjectInput = ({ schema, column, prefix }) => {
|
|
@@ -5026,9 +5032,9 @@ const FormInternal = () => {
|
|
|
5026
5032
|
}, formNoValidate: true, children: translate.t("submit") })] })] }) }));
|
|
5027
5033
|
};
|
|
5028
5034
|
const Form = ({ schema, idMap, setIdMap, form, serverUrl, translate, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, }) => {
|
|
5029
|
-
const { properties } = schema;
|
|
5030
|
-
idListSanityCheck("order", order, properties);
|
|
5031
|
-
idListSanityCheck("ignore", ignore, properties);
|
|
5035
|
+
// const { properties } = schema;
|
|
5036
|
+
// idListSanityCheck("order", order, properties as object);
|
|
5037
|
+
// idListSanityCheck("ignore", ignore, properties as object);
|
|
5032
5038
|
return (jsx(SchemaFormContext.Provider, { value: {
|
|
5033
5039
|
schema,
|
|
5034
5040
|
serverUrl,
|