@fctc/widget-logic 4.1.9 → 4.2.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/hooks.d.mts CHANGED
@@ -781,7 +781,7 @@ declare const useGetSpecification: ({ model, viewData, fields, }: {
781
781
  specification: Record<string, any> | null;
782
782
  };
783
783
 
784
- declare const useListData: ({ action, context, viewData, model, service, xNode, mode, }: {
784
+ declare const useListData: ({ action, context, viewData, model, service, xNode, mode, limit, }: {
785
785
  action: ActionResultType;
786
786
  context: any;
787
787
  viewData?: ViewResponse;
@@ -789,6 +789,7 @@ declare const useListData: ({ action, context, viewData, model, service, xNode,
789
789
  service?: string;
790
790
  xNode?: string;
791
791
  mode?: string;
792
+ limit?: number;
792
793
  }) => {
793
794
  state: {
794
795
  specification: Record<string, any> | null;
package/dist/hooks.d.ts CHANGED
@@ -781,7 +781,7 @@ declare const useGetSpecification: ({ model, viewData, fields, }: {
781
781
  specification: Record<string, any> | null;
782
782
  };
783
783
 
784
- declare const useListData: ({ action, context, viewData, model, service, xNode, mode, }: {
784
+ declare const useListData: ({ action, context, viewData, model, service, xNode, mode, limit, }: {
785
785
  action: ActionResultType;
786
786
  context: any;
787
787
  viewData?: ViewResponse;
@@ -789,6 +789,7 @@ declare const useListData: ({ action, context, viewData, model, service, xNode,
789
789
  service?: string;
790
790
  xNode?: string;
791
791
  mode?: string;
792
+ limit?: number;
792
793
  }) => {
793
794
  state: {
794
795
  specification: Record<string, any> | null;
package/dist/hooks.js CHANGED
@@ -902,11 +902,12 @@ var useListData = ({
902
902
  model,
903
903
  service,
904
904
  xNode,
905
- mode
905
+ mode,
906
+ limit = 10
906
907
  }) => {
907
908
  const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
908
909
  const [page, setPage] = (0, import_react14.useState)(0);
909
- const [pageLimit, setPageLimit] = (0, import_react14.useState)(10);
910
+ const [pageLimit, setPageLimit] = (0, import_react14.useState)(limit);
910
911
  const [groupByList, setGroupByList] = (0, import_react14.useState)(null);
911
912
  const [domain, setDomain] = (0, import_react14.useState)(null);
912
913
  const [order, setOrder] = (0, import_react14.useState)("");
@@ -923,7 +924,7 @@ var useListData = ({
923
924
  return null;
924
925
  }
925
926
  const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, import_utils5.evalJSONDomain)(action?.domain, context) : [];
926
- const limit = pageLimit;
927
+ const limit2 = pageLimit;
927
928
  const offset = debouncedPage * pageLimit;
928
929
  const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
929
930
  const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
@@ -934,7 +935,7 @@ var useListData = ({
934
935
  model: action?.res_model,
935
936
  specification,
936
937
  domain: domainParse,
937
- limit,
938
+ limit: limit2,
938
939
  offset,
939
940
  fields,
940
941
  groupby,
package/dist/hooks.mjs CHANGED
@@ -887,11 +887,12 @@ var useListData = ({
887
887
  model,
888
888
  service,
889
889
  xNode,
890
- mode
890
+ mode,
891
+ limit = 10
891
892
  }) => {
892
893
  const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
893
894
  const [page, setPage] = useState5(0);
894
- const [pageLimit, setPageLimit] = useState5(10);
895
+ const [pageLimit, setPageLimit] = useState5(limit);
895
896
  const [groupByList, setGroupByList] = useState5(null);
896
897
  const [domain, setDomain] = useState5(null);
897
898
  const [order, setOrder] = useState5("");
@@ -908,7 +909,7 @@ var useListData = ({
908
909
  return null;
909
910
  }
910
911
  const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : evalJSONDomain(action?.domain, context) : [];
911
- const limit = pageLimit;
912
+ const limit2 = pageLimit;
912
913
  const offset = debouncedPage * pageLimit;
913
914
  const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
914
915
  const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
@@ -919,7 +920,7 @@ var useListData = ({
919
920
  model: action?.res_model,
920
921
  specification,
921
922
  domain: domainParse,
922
- limit,
923
+ limit: limit2,
923
924
  offset,
924
925
  fields,
925
926
  groupby,
package/dist/index.js CHANGED
@@ -4952,11 +4952,12 @@ var useListData = ({
4952
4952
  model,
4953
4953
  service,
4954
4954
  xNode,
4955
- mode
4955
+ mode,
4956
+ limit = 10
4956
4957
  }) => {
4957
4958
  const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
4958
4959
  const [page, setPage] = (0, import_react14.useState)(0);
4959
- const [pageLimit, setPageLimit] = (0, import_react14.useState)(10);
4960
+ const [pageLimit, setPageLimit] = (0, import_react14.useState)(limit);
4960
4961
  const [groupByList, setGroupByList] = (0, import_react14.useState)(null);
4961
4962
  const [domain, setDomain] = (0, import_react14.useState)(null);
4962
4963
  const [order, setOrder] = (0, import_react14.useState)("");
@@ -4973,7 +4974,7 @@ var useListData = ({
4973
4974
  return null;
4974
4975
  }
4975
4976
  const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, import_utils5.evalJSONDomain)(action?.domain, context) : [];
4976
- const limit = pageLimit;
4977
+ const limit2 = pageLimit;
4977
4978
  const offset = debouncedPage * pageLimit;
4978
4979
  const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
4979
4980
  const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
@@ -4984,7 +4985,7 @@ var useListData = ({
4984
4985
  model: action?.res_model,
4985
4986
  specification,
4986
4987
  domain: domainParse,
4987
- limit,
4988
+ limit: limit2,
4988
4989
  offset,
4989
4990
  fields,
4990
4991
  groupby,
@@ -6280,12 +6281,11 @@ var binaryFieldController = (props) => {
6280
6281
  }
6281
6282
  const fileUrl = URL.createObjectURL(file);
6282
6283
  setSelectedFile(file);
6283
- setInitialFile(null);
6284
6284
  setSelectedPreview(fileUrl);
6285
- onChange(file);
6286
6285
  const base64 = await convertUrlToBase64(fileUrl);
6287
6286
  const base64Data = extractBase64Data(base64);
6288
6287
  setValue(name, base64Data, { shouldDirty: true });
6288
+ onChange(base64Data);
6289
6289
  handleOnchange && handleOnchange(name ?? "", base64Data);
6290
6290
  if (filename) {
6291
6291
  setValue(
@@ -6323,7 +6323,8 @@ var binaryFieldController = (props) => {
6323
6323
  handleFileChange,
6324
6324
  handleRemoveFile,
6325
6325
  checkIsImageLink,
6326
- getBase64WithMimeType
6326
+ getBase64WithMimeType,
6327
+ setInitialFile
6327
6328
  };
6328
6329
  };
6329
6330
 
package/dist/index.mjs CHANGED
@@ -5046,11 +5046,12 @@ var useListData = ({
5046
5046
  model,
5047
5047
  service,
5048
5048
  xNode,
5049
- mode
5049
+ mode,
5050
+ limit = 10
5050
5051
  }) => {
5051
5052
  const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
5052
5053
  const [page, setPage] = useState5(0);
5053
- const [pageLimit, setPageLimit] = useState5(10);
5054
+ const [pageLimit, setPageLimit] = useState5(limit);
5054
5055
  const [groupByList, setGroupByList] = useState5(null);
5055
5056
  const [domain, setDomain] = useState5(null);
5056
5057
  const [order, setOrder] = useState5("");
@@ -5067,7 +5068,7 @@ var useListData = ({
5067
5068
  return null;
5068
5069
  }
5069
5070
  const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : evalJSONDomain(action?.domain, context) : [];
5070
- const limit = pageLimit;
5071
+ const limit2 = pageLimit;
5071
5072
  const offset = debouncedPage * pageLimit;
5072
5073
  const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
5073
5074
  const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
@@ -5078,7 +5079,7 @@ var useListData = ({
5078
5079
  model: action?.res_model,
5079
5080
  specification,
5080
5081
  domain: domainParse,
5081
- limit,
5082
+ limit: limit2,
5082
5083
  offset,
5083
5084
  fields,
5084
5085
  groupby,
@@ -6375,12 +6376,11 @@ var binaryFieldController = (props) => {
6375
6376
  }
6376
6377
  const fileUrl = URL.createObjectURL(file);
6377
6378
  setSelectedFile(file);
6378
- setInitialFile(null);
6379
6379
  setSelectedPreview(fileUrl);
6380
- onChange(file);
6381
6380
  const base64 = await convertUrlToBase64(fileUrl);
6382
6381
  const base64Data = extractBase64Data(base64);
6383
6382
  setValue(name, base64Data, { shouldDirty: true });
6383
+ onChange(base64Data);
6384
6384
  handleOnchange && handleOnchange(name ?? "", base64Data);
6385
6385
  if (filename) {
6386
6386
  setValue(
@@ -6418,7 +6418,8 @@ var binaryFieldController = (props) => {
6418
6418
  handleFileChange,
6419
6419
  handleRemoveFile,
6420
6420
  checkIsImageLink,
6421
- getBase64WithMimeType
6421
+ getBase64WithMimeType,
6422
+ setInitialFile
6422
6423
  };
6423
6424
  };
6424
6425
 
package/dist/widget.d.mts CHANGED
@@ -217,10 +217,11 @@ declare const binaryFieldController: (props: IInputFieldProps & {
217
217
  selectedPreview: string | null;
218
218
  initialFile: any;
219
219
  binaryRef: react.RefObject<HTMLDivElement>;
220
- handleFileChange: (e: ChangeEvent<HTMLInputElement>, onChange: (file: File | null) => void) => Promise<void>;
221
- handleRemoveFile: (onChange: (file: File | null) => void) => void;
220
+ handleFileChange: (e: ChangeEvent<HTMLInputElement>, onChange: (value: string | null) => void) => Promise<void>;
221
+ handleRemoveFile: (onChange: (value: string | null) => void) => void;
222
222
  checkIsImageLink: (url: string) => boolean;
223
223
  getBase64WithMimeType: (base64: string) => string | null;
224
+ setInitialFile: react.Dispatch<any>;
224
225
  };
225
226
 
226
227
  declare const tableHeadController: (props: any) => {
package/dist/widget.d.ts CHANGED
@@ -217,10 +217,11 @@ declare const binaryFieldController: (props: IInputFieldProps & {
217
217
  selectedPreview: string | null;
218
218
  initialFile: any;
219
219
  binaryRef: react.RefObject<HTMLDivElement>;
220
- handleFileChange: (e: ChangeEvent<HTMLInputElement>, onChange: (file: File | null) => void) => Promise<void>;
221
- handleRemoveFile: (onChange: (file: File | null) => void) => void;
220
+ handleFileChange: (e: ChangeEvent<HTMLInputElement>, onChange: (value: string | null) => void) => Promise<void>;
221
+ handleRemoveFile: (onChange: (value: string | null) => void) => void;
222
222
  checkIsImageLink: (url: string) => boolean;
223
223
  getBase64WithMimeType: (base64: string) => string | null;
224
+ setInitialFile: react.Dispatch<any>;
224
225
  };
225
226
 
226
227
  declare const tableHeadController: (props: any) => {
package/dist/widget.js CHANGED
@@ -4470,11 +4470,12 @@ var useListData = ({
4470
4470
  model,
4471
4471
  service,
4472
4472
  xNode,
4473
- mode
4473
+ mode,
4474
+ limit = 10
4474
4475
  }) => {
4475
4476
  const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
4476
4477
  const [page, setPage] = (0, import_react15.useState)(0);
4477
- const [pageLimit, setPageLimit] = (0, import_react15.useState)(10);
4478
+ const [pageLimit, setPageLimit] = (0, import_react15.useState)(limit);
4478
4479
  const [groupByList, setGroupByList] = (0, import_react15.useState)(null);
4479
4480
  const [domain, setDomain] = (0, import_react15.useState)(null);
4480
4481
  const [order, setOrder] = (0, import_react15.useState)("");
@@ -4491,7 +4492,7 @@ var useListData = ({
4491
4492
  return null;
4492
4493
  }
4493
4494
  const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, import_utils5.evalJSONDomain)(action?.domain, context) : [];
4494
- const limit = pageLimit;
4495
+ const limit2 = pageLimit;
4495
4496
  const offset = debouncedPage * pageLimit;
4496
4497
  const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
4497
4498
  const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
@@ -4502,7 +4503,7 @@ var useListData = ({
4502
4503
  model: action?.res_model,
4503
4504
  specification,
4504
4505
  domain: domainParse,
4505
- limit,
4506
+ limit: limit2,
4506
4507
  offset,
4507
4508
  fields,
4508
4509
  groupby,
@@ -5506,12 +5507,11 @@ var binaryFieldController = (props) => {
5506
5507
  }
5507
5508
  const fileUrl = URL.createObjectURL(file);
5508
5509
  setSelectedFile(file);
5509
- setInitialFile(null);
5510
5510
  setSelectedPreview(fileUrl);
5511
- onChange(file);
5512
5511
  const base64 = await convertUrlToBase64(fileUrl);
5513
5512
  const base64Data = extractBase64Data(base64);
5514
5513
  setValue(name, base64Data, { shouldDirty: true });
5514
+ onChange(base64Data);
5515
5515
  handleOnchange && handleOnchange(name ?? "", base64Data);
5516
5516
  if (filename) {
5517
5517
  setValue(
@@ -5549,7 +5549,8 @@ var binaryFieldController = (props) => {
5549
5549
  handleFileChange,
5550
5550
  handleRemoveFile,
5551
5551
  checkIsImageLink,
5552
- getBase64WithMimeType
5552
+ getBase64WithMimeType,
5553
+ setInitialFile
5553
5554
  };
5554
5555
  };
5555
5556
 
package/dist/widget.mjs CHANGED
@@ -4542,11 +4542,12 @@ var useListData = ({
4542
4542
  model,
4543
4543
  service,
4544
4544
  xNode,
4545
- mode
4545
+ mode,
4546
+ limit = 10
4546
4547
  }) => {
4547
4548
  const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
4548
4549
  const [page, setPage] = useState6(0);
4549
- const [pageLimit, setPageLimit] = useState6(10);
4550
+ const [pageLimit, setPageLimit] = useState6(limit);
4550
4551
  const [groupByList, setGroupByList] = useState6(null);
4551
4552
  const [domain, setDomain] = useState6(null);
4552
4553
  const [order, setOrder] = useState6("");
@@ -4563,7 +4564,7 @@ var useListData = ({
4563
4564
  return null;
4564
4565
  }
4565
4566
  const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : evalJSONDomain(action?.domain, context) : [];
4566
- const limit = pageLimit;
4567
+ const limit2 = pageLimit;
4567
4568
  const offset = debouncedPage * pageLimit;
4568
4569
  const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
4569
4570
  const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
@@ -4574,7 +4575,7 @@ var useListData = ({
4574
4575
  model: action?.res_model,
4575
4576
  specification,
4576
4577
  domain: domainParse,
4577
- limit,
4578
+ limit: limit2,
4578
4579
  offset,
4579
4580
  fields,
4580
4581
  groupby,
@@ -5578,12 +5579,11 @@ var binaryFieldController = (props) => {
5578
5579
  }
5579
5580
  const fileUrl = URL.createObjectURL(file);
5580
5581
  setSelectedFile(file);
5581
- setInitialFile(null);
5582
5582
  setSelectedPreview(fileUrl);
5583
- onChange(file);
5584
5583
  const base64 = await convertUrlToBase64(fileUrl);
5585
5584
  const base64Data = extractBase64Data(base64);
5586
5585
  setValue(name, base64Data, { shouldDirty: true });
5586
+ onChange(base64Data);
5587
5587
  handleOnchange && handleOnchange(name ?? "", base64Data);
5588
5588
  if (filename) {
5589
5589
  setValue(
@@ -5621,7 +5621,8 @@ var binaryFieldController = (props) => {
5621
5621
  handleFileChange,
5622
5622
  handleRemoveFile,
5623
5623
  checkIsImageLink,
5624
- getBase64WithMimeType
5624
+ getBase64WithMimeType,
5625
+ setInitialFile
5625
5626
  };
5626
5627
  };
5627
5628
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/widget-logic",
3
- "version": "4.1.9",
3
+ "version": "4.2.1",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",