@fctc/sme-widget-ui 1.0.4 → 1.0.6

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 CHANGED
@@ -15139,9 +15139,10 @@ var Search = ({
15139
15139
  setPage(0);
15140
15140
  setSelectedRowKeys([]);
15141
15141
  const containSearchFilter = selectedTags?.length > 0 && selectedTags?.find(
15142
- (item) => item?.type === SearchType.FILTER || item?.type === SearchType.SEARCH || item?.type === SearchType.GROUP
15142
+ (item) => item?.type === SearchType.FILTER || item?.type === SearchType.SEARCH
15143
15143
  );
15144
- if (containSearchFilter || Array.isArray(selectedTags) && selectedTags?.length === 0) {
15144
+ const containGroup = selectedTags?.length > 0 && selectedTags?.some((item) => item?.type === SearchType.GROUP);
15145
+ if (containSearchFilter && !containGroup || selectedTags?.length === 0) {
15145
15146
  setDomainList(domainSearch);
15146
15147
  }
15147
15148
  }
@@ -15152,8 +15153,9 @@ var Search = ({
15152
15153
  setDidInit(false);
15153
15154
  setIsReadyFormatDomain(false);
15154
15155
  };
15155
- }, [viewData]);
15156
+ }, [aid]);
15156
15157
  (0, import_react18.useEffect)(() => {
15158
+ if (!filterBy) return;
15157
15159
  if (didInit || selectedTags?.length > 0) return;
15158
15160
  const searchDefaults = Object.entries(context || {}).filter(
15159
15161
  ([key]) => key.startsWith("search_default_")
@@ -15181,7 +15183,7 @@ var Search = ({
15181
15183
  return item;
15182
15184
  });
15183
15185
  if (updatedFilter) setFilterBy(updatedFilter);
15184
- if (hasGroupBy) {
15186
+ if (hasGroupBy && fieldsList?.length > 0) {
15185
15187
  viewData?.views?.search?.filters_by?.forEach((item, idx) => {
15186
15188
  const groupCtx = evalJSONContext(item?.context);
15187
15189
  handleAddTagSearch?.({
@@ -15190,13 +15192,14 @@ var Search = ({
15190
15192
  type: SearchType.GROUP,
15191
15193
  context: groupCtx,
15192
15194
  groupIndex: idx,
15193
- isDefault: true
15195
+ isDefault: true,
15196
+ fieldsGroup: fieldsList
15194
15197
  });
15195
15198
  });
15196
15199
  setDidInit(true);
15197
15200
  }
15198
15201
  setIsReadyFormatDomain(true);
15199
- }, [aid]);
15202
+ }, [aid, filterBy, fieldsList]);
15200
15203
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
15201
15204
  "div",
15202
15205
  {
@@ -32612,19 +32615,7 @@ var FeeField = (props) => {
32612
32615
  var import_react54 = require("react");
32613
32616
  var import_jsx_runtime82 = require("react/jsx-runtime");
32614
32617
  var FileUploadField = (props) => {
32615
- const {
32616
- name: name2,
32617
- methods,
32618
- isForm,
32619
- model,
32620
- required,
32621
- idForm,
32622
- widget,
32623
- useUploadImage,
32624
- useUploadFile,
32625
- useGetImage,
32626
- isBase64File
32627
- } = props;
32618
+ const { name: name2, methods, isForm, model, required, idForm, widget, useUploadImage, useUploadFile, useGetImage, isBase64File } = props;
32628
32619
  const fileInputRef = (0, import_react54.useRef)(null);
32629
32620
  const [selectedFiles, setSelectedFiles] = (0, import_react54.useState)([]);
32630
32621
  const [uploadError, setUploadError] = (0, import_react54.useState)();
@@ -33960,14 +33951,12 @@ var Many2ManyField = (props) => {
33960
33951
  page,
33961
33952
  rows,
33962
33953
  columns,
33963
- typeTable,
33964
33954
  renderField,
33965
33955
  isDataLoading,
33966
33956
  relation,
33967
33957
  onToggleColumnOptional,
33968
33958
  isDataFetched,
33969
33959
  isPlaceholderData,
33970
- isCheckBox,
33971
33960
  optionsObject,
33972
33961
  onChoose,
33973
33962
  onAddNew,
@@ -33981,7 +33970,13 @@ var Many2ManyField = (props) => {
33981
33970
  evalJSONContext,
33982
33971
  searchController,
33983
33972
  viewData,
33984
- setDomain
33973
+ setDomain,
33974
+ isDisplayCheckbox,
33975
+ checkedAll,
33976
+ handleCheckBoxAll,
33977
+ selectedRowKeysRef,
33978
+ typeTable,
33979
+ setSelectedRowKeys
33985
33980
  } = props;
33986
33981
  const {
33987
33982
  context,
@@ -34021,8 +34016,6 @@ var Many2ManyField = (props) => {
34021
34016
  groupBy,
34022
34017
  showFiltersGroups: true,
34023
34018
  setGroupBy,
34024
- setSelectedRowKeys: (keys) => {
34025
- },
34026
34019
  setDomainList: setDomain,
34027
34020
  setPage: (pages) => {
34028
34021
  setPage?.(pages);
@@ -34032,6 +34025,7 @@ var Many2ManyField = (props) => {
34032
34025
  (col) => col?.field?.type_co === "field" && col?.optional !== "hide"
34033
34026
  )?.map((col) => ({ ...col.field })) ?? []
34034
34027
  ],
34028
+ setSelectedRowKeys,
34035
34029
  viewData,
34036
34030
  context,
34037
34031
  selectedRowKeys,
@@ -34076,7 +34070,9 @@ var Many2ManyField = (props) => {
34076
34070
  {
34077
34071
  columns,
34078
34072
  onToggleColumnOptional,
34079
- isDisplayCheckbox: false
34073
+ isDisplayCheckbox,
34074
+ checkedAll,
34075
+ handleCheckBoxAll
34080
34076
  }
34081
34077
  ),
34082
34078
  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
@@ -34085,7 +34081,7 @@ var Many2ManyField = (props) => {
34085
34081
  columns,
34086
34082
  rows,
34087
34083
  rootField,
34088
- isDisplayCheckbox: false,
34084
+ isDisplayCheckbox,
34089
34085
  model: relation,
34090
34086
  renderField: ({
34091
34087
  row,
@@ -34106,7 +34102,11 @@ var Many2ManyField = (props) => {
34106
34102
  },
34107
34103
  onRemoveRow: null,
34108
34104
  onAddRow,
34109
- onClickRow
34105
+ onClickRow,
34106
+ typeTable,
34107
+ selectedRowKeysRef,
34108
+ selectedRowKeys,
34109
+ setSelectedRowKeys
34110
34110
  }
34111
34111
  )
34112
34112
  ]
@@ -34117,7 +34117,7 @@ var Many2ManyField = (props) => {
34117
34117
  }
34118
34118
  ) }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LayerLoading, {}),
34119
34119
  /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-2 mt-auto", children: [
34120
- isCheckBox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34120
+ isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34121
34121
  "button",
34122
34122
  {
34123
34123
  disabled: selectedRowKeys?.length === 0,
package/dist/index.mjs CHANGED
@@ -15020,9 +15020,10 @@ var Search = ({
15020
15020
  setPage(0);
15021
15021
  setSelectedRowKeys([]);
15022
15022
  const containSearchFilter = selectedTags?.length > 0 && selectedTags?.find(
15023
- (item) => item?.type === SearchType.FILTER || item?.type === SearchType.SEARCH || item?.type === SearchType.GROUP
15023
+ (item) => item?.type === SearchType.FILTER || item?.type === SearchType.SEARCH
15024
15024
  );
15025
- if (containSearchFilter || Array.isArray(selectedTags) && selectedTags?.length === 0) {
15025
+ const containGroup = selectedTags?.length > 0 && selectedTags?.some((item) => item?.type === SearchType.GROUP);
15026
+ if (containSearchFilter && !containGroup || selectedTags?.length === 0) {
15026
15027
  setDomainList(domainSearch);
15027
15028
  }
15028
15029
  }
@@ -15033,8 +15034,9 @@ var Search = ({
15033
15034
  setDidInit(false);
15034
15035
  setIsReadyFormatDomain(false);
15035
15036
  };
15036
- }, [viewData]);
15037
+ }, [aid]);
15037
15038
  useEffect6(() => {
15039
+ if (!filterBy) return;
15038
15040
  if (didInit || selectedTags?.length > 0) return;
15039
15041
  const searchDefaults = Object.entries(context || {}).filter(
15040
15042
  ([key]) => key.startsWith("search_default_")
@@ -15062,7 +15064,7 @@ var Search = ({
15062
15064
  return item;
15063
15065
  });
15064
15066
  if (updatedFilter) setFilterBy(updatedFilter);
15065
- if (hasGroupBy) {
15067
+ if (hasGroupBy && fieldsList?.length > 0) {
15066
15068
  viewData?.views?.search?.filters_by?.forEach((item, idx) => {
15067
15069
  const groupCtx = evalJSONContext(item?.context);
15068
15070
  handleAddTagSearch?.({
@@ -15071,13 +15073,14 @@ var Search = ({
15071
15073
  type: SearchType.GROUP,
15072
15074
  context: groupCtx,
15073
15075
  groupIndex: idx,
15074
- isDefault: true
15076
+ isDefault: true,
15077
+ fieldsGroup: fieldsList
15075
15078
  });
15076
15079
  });
15077
15080
  setDidInit(true);
15078
15081
  }
15079
15082
  setIsReadyFormatDomain(true);
15080
- }, [aid]);
15083
+ }, [aid, filterBy, fieldsList]);
15081
15084
  return /* @__PURE__ */ jsxs39(
15082
15085
  "div",
15083
15086
  {
@@ -32493,19 +32496,7 @@ var FeeField = (props) => {
32493
32496
  import { useEffect as useEffect16, useRef as useRef14, useState as useState16 } from "react";
32494
32497
  import { jsx as jsx84, jsxs as jsxs59 } from "react/jsx-runtime";
32495
32498
  var FileUploadField = (props) => {
32496
- const {
32497
- name: name2,
32498
- methods,
32499
- isForm,
32500
- model,
32501
- required,
32502
- idForm,
32503
- widget,
32504
- useUploadImage,
32505
- useUploadFile,
32506
- useGetImage,
32507
- isBase64File
32508
- } = props;
32499
+ const { name: name2, methods, isForm, model, required, idForm, widget, useUploadImage, useUploadFile, useGetImage, isBase64File } = props;
32509
32500
  const fileInputRef = useRef14(null);
32510
32501
  const [selectedFiles, setSelectedFiles] = useState16([]);
32511
32502
  const [uploadError, setUploadError] = useState16();
@@ -33841,14 +33832,12 @@ var Many2ManyField = (props) => {
33841
33832
  page,
33842
33833
  rows,
33843
33834
  columns,
33844
- typeTable,
33845
33835
  renderField,
33846
33836
  isDataLoading,
33847
33837
  relation,
33848
33838
  onToggleColumnOptional,
33849
33839
  isDataFetched,
33850
33840
  isPlaceholderData,
33851
- isCheckBox,
33852
33841
  optionsObject,
33853
33842
  onChoose,
33854
33843
  onAddNew,
@@ -33862,7 +33851,13 @@ var Many2ManyField = (props) => {
33862
33851
  evalJSONContext,
33863
33852
  searchController,
33864
33853
  viewData,
33865
- setDomain
33854
+ setDomain,
33855
+ isDisplayCheckbox,
33856
+ checkedAll,
33857
+ handleCheckBoxAll,
33858
+ selectedRowKeysRef,
33859
+ typeTable,
33860
+ setSelectedRowKeys
33866
33861
  } = props;
33867
33862
  const {
33868
33863
  context,
@@ -33902,8 +33897,6 @@ var Many2ManyField = (props) => {
33902
33897
  groupBy,
33903
33898
  showFiltersGroups: true,
33904
33899
  setGroupBy,
33905
- setSelectedRowKeys: (keys) => {
33906
- },
33907
33900
  setDomainList: setDomain,
33908
33901
  setPage: (pages) => {
33909
33902
  setPage?.(pages);
@@ -33913,6 +33906,7 @@ var Many2ManyField = (props) => {
33913
33906
  (col) => col?.field?.type_co === "field" && col?.optional !== "hide"
33914
33907
  )?.map((col) => ({ ...col.field })) ?? []
33915
33908
  ],
33909
+ setSelectedRowKeys,
33916
33910
  viewData,
33917
33911
  context,
33918
33912
  selectedRowKeys,
@@ -33957,7 +33951,9 @@ var Many2ManyField = (props) => {
33957
33951
  {
33958
33952
  columns,
33959
33953
  onToggleColumnOptional,
33960
- isDisplayCheckbox: false
33954
+ isDisplayCheckbox,
33955
+ checkedAll,
33956
+ handleCheckBoxAll
33961
33957
  }
33962
33958
  ),
33963
33959
  /* @__PURE__ */ jsx102(
@@ -33966,7 +33962,7 @@ var Many2ManyField = (props) => {
33966
33962
  columns,
33967
33963
  rows,
33968
33964
  rootField,
33969
- isDisplayCheckbox: false,
33965
+ isDisplayCheckbox,
33970
33966
  model: relation,
33971
33967
  renderField: ({
33972
33968
  row,
@@ -33987,7 +33983,11 @@ var Many2ManyField = (props) => {
33987
33983
  },
33988
33984
  onRemoveRow: null,
33989
33985
  onAddRow,
33990
- onClickRow
33986
+ onClickRow,
33987
+ typeTable,
33988
+ selectedRowKeysRef,
33989
+ selectedRowKeys,
33990
+ setSelectedRowKeys
33991
33991
  }
33992
33992
  )
33993
33993
  ]
@@ -33998,7 +33998,7 @@ var Many2ManyField = (props) => {
33998
33998
  }
33999
33999
  ) }) }) : /* @__PURE__ */ jsx102(LayerLoading, {}),
34000
34000
  /* @__PURE__ */ jsxs72("div", { className: "flex items-center gap-2 mt-auto", children: [
34001
- isCheckBox && /* @__PURE__ */ jsx102(
34001
+ isDisplayCheckbox && /* @__PURE__ */ jsx102(
34002
34002
  "button",
34003
34003
  {
34004
34004
  disabled: selectedRowKeys?.length === 0,
@@ -326,13 +326,13 @@ interface Many2ManyProps extends IInputFieldProps {
326
326
  isDataLoading?: any;
327
327
  isDataFetched?: any;
328
328
  isPlaceholderData?: any;
329
- isCheckBox?: boolean;
329
+ isDisplayCheckbox?: boolean;
330
330
  optionsObject?: any;
331
331
  selectedRowKeys?: any;
332
332
  handleCreateNewOnPage?: any;
333
+ typeTable?: any;
333
334
  rows: any;
334
335
  columns: any;
335
- typeTable?: string;
336
336
  page?: any;
337
337
  totalRows?: number;
338
338
  rootField?: any;
@@ -343,6 +343,7 @@ interface Many2ManyProps extends IInputFieldProps {
343
343
  onAddRow?: Function;
344
344
  onClickRow?: Function;
345
345
  onToggleColumnOptional?: any;
346
+ setSelectedRowKeys?: any;
346
347
  renderField?: ({ row, col, indexRow, onChangeData, rootField, }: {
347
348
  row: any;
348
349
  col: any;
@@ -354,6 +355,9 @@ interface Many2ManyProps extends IInputFieldProps {
354
355
  setDomain?: Dispatch<SetStateAction<any>>;
355
356
  searchController: SearchController;
356
357
  evalJSONContext?: any;
358
+ checkedAll?: any;
359
+ handleCheckBoxAll?: any;
360
+ selectedRowKeysRef?: any;
357
361
  }
358
362
 
359
363
  declare const Many2ManyField: (props: Many2ManyProps) => React$1.ReactPortal;
package/dist/widgets.d.ts CHANGED
@@ -326,13 +326,13 @@ interface Many2ManyProps extends IInputFieldProps {
326
326
  isDataLoading?: any;
327
327
  isDataFetched?: any;
328
328
  isPlaceholderData?: any;
329
- isCheckBox?: boolean;
329
+ isDisplayCheckbox?: boolean;
330
330
  optionsObject?: any;
331
331
  selectedRowKeys?: any;
332
332
  handleCreateNewOnPage?: any;
333
+ typeTable?: any;
333
334
  rows: any;
334
335
  columns: any;
335
- typeTable?: string;
336
336
  page?: any;
337
337
  totalRows?: number;
338
338
  rootField?: any;
@@ -343,6 +343,7 @@ interface Many2ManyProps extends IInputFieldProps {
343
343
  onAddRow?: Function;
344
344
  onClickRow?: Function;
345
345
  onToggleColumnOptional?: any;
346
+ setSelectedRowKeys?: any;
346
347
  renderField?: ({ row, col, indexRow, onChangeData, rootField, }: {
347
348
  row: any;
348
349
  col: any;
@@ -354,6 +355,9 @@ interface Many2ManyProps extends IInputFieldProps {
354
355
  setDomain?: Dispatch<SetStateAction<any>>;
355
356
  searchController: SearchController;
356
357
  evalJSONContext?: any;
358
+ checkedAll?: any;
359
+ handleCheckBoxAll?: any;
360
+ selectedRowKeysRef?: any;
357
361
  }
358
362
 
359
363
  declare const Many2ManyField: (props: Many2ManyProps) => React$1.ReactPortal;
package/dist/widgets.js CHANGED
@@ -14784,9 +14784,10 @@ var Search = ({
14784
14784
  setPage(0);
14785
14785
  setSelectedRowKeys([]);
14786
14786
  const containSearchFilter = selectedTags?.length > 0 && selectedTags?.find(
14787
- (item) => item?.type === SearchType.FILTER || item?.type === SearchType.SEARCH || item?.type === SearchType.GROUP
14787
+ (item) => item?.type === SearchType.FILTER || item?.type === SearchType.SEARCH
14788
14788
  );
14789
- if (containSearchFilter || Array.isArray(selectedTags) && selectedTags?.length === 0) {
14789
+ const containGroup = selectedTags?.length > 0 && selectedTags?.some((item) => item?.type === SearchType.GROUP);
14790
+ if (containSearchFilter && !containGroup || selectedTags?.length === 0) {
14790
14791
  setDomainList(domainSearch);
14791
14792
  }
14792
14793
  }
@@ -14797,8 +14798,9 @@ var Search = ({
14797
14798
  setDidInit(false);
14798
14799
  setIsReadyFormatDomain(false);
14799
14800
  };
14800
- }, [viewData]);
14801
+ }, [aid]);
14801
14802
  (0, import_react18.useEffect)(() => {
14803
+ if (!filterBy) return;
14802
14804
  if (didInit || selectedTags?.length > 0) return;
14803
14805
  const searchDefaults = Object.entries(context || {}).filter(
14804
14806
  ([key]) => key.startsWith("search_default_")
@@ -14826,7 +14828,7 @@ var Search = ({
14826
14828
  return item;
14827
14829
  });
14828
14830
  if (updatedFilter) setFilterBy(updatedFilter);
14829
- if (hasGroupBy) {
14831
+ if (hasGroupBy && fieldsList?.length > 0) {
14830
14832
  viewData?.views?.search?.filters_by?.forEach((item, idx) => {
14831
14833
  const groupCtx = evalJSONContext(item?.context);
14832
14834
  handleAddTagSearch?.({
@@ -14835,13 +14837,14 @@ var Search = ({
14835
14837
  type: SearchType.GROUP,
14836
14838
  context: groupCtx,
14837
14839
  groupIndex: idx,
14838
- isDefault: true
14840
+ isDefault: true,
14841
+ fieldsGroup: fieldsList
14839
14842
  });
14840
14843
  });
14841
14844
  setDidInit(true);
14842
14845
  }
14843
14846
  setIsReadyFormatDomain(true);
14844
- }, [aid]);
14847
+ }, [aid, filterBy, fieldsList]);
14845
14848
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
14846
14849
  "div",
14847
14850
  {
@@ -32257,19 +32260,7 @@ var FeeField = (props) => {
32257
32260
  var import_react54 = require("react");
32258
32261
  var import_jsx_runtime82 = require("react/jsx-runtime");
32259
32262
  var FileUploadField = (props) => {
32260
- const {
32261
- name: name2,
32262
- methods,
32263
- isForm,
32264
- model,
32265
- required,
32266
- idForm,
32267
- widget,
32268
- useUploadImage,
32269
- useUploadFile,
32270
- useGetImage,
32271
- isBase64File
32272
- } = props;
32263
+ const { name: name2, methods, isForm, model, required, idForm, widget, useUploadImage, useUploadFile, useGetImage, isBase64File } = props;
32273
32264
  const fileInputRef = (0, import_react54.useRef)(null);
32274
32265
  const [selectedFiles, setSelectedFiles] = (0, import_react54.useState)([]);
32275
32266
  const [uploadError, setUploadError] = (0, import_react54.useState)();
@@ -33605,14 +33596,12 @@ var Many2ManyField = (props) => {
33605
33596
  page,
33606
33597
  rows,
33607
33598
  columns,
33608
- typeTable,
33609
33599
  renderField,
33610
33600
  isDataLoading,
33611
33601
  relation,
33612
33602
  onToggleColumnOptional,
33613
33603
  isDataFetched,
33614
33604
  isPlaceholderData,
33615
- isCheckBox,
33616
33605
  optionsObject,
33617
33606
  onChoose,
33618
33607
  onAddNew,
@@ -33626,7 +33615,13 @@ var Many2ManyField = (props) => {
33626
33615
  evalJSONContext,
33627
33616
  searchController,
33628
33617
  viewData,
33629
- setDomain
33618
+ setDomain,
33619
+ isDisplayCheckbox,
33620
+ checkedAll,
33621
+ handleCheckBoxAll,
33622
+ selectedRowKeysRef,
33623
+ typeTable,
33624
+ setSelectedRowKeys
33630
33625
  } = props;
33631
33626
  const {
33632
33627
  context,
@@ -33666,8 +33661,6 @@ var Many2ManyField = (props) => {
33666
33661
  groupBy,
33667
33662
  showFiltersGroups: true,
33668
33663
  setGroupBy,
33669
- setSelectedRowKeys: (keys) => {
33670
- },
33671
33664
  setDomainList: setDomain,
33672
33665
  setPage: (pages) => {
33673
33666
  setPage?.(pages);
@@ -33677,6 +33670,7 @@ var Many2ManyField = (props) => {
33677
33670
  (col) => col?.field?.type_co === "field" && col?.optional !== "hide"
33678
33671
  )?.map((col) => ({ ...col.field })) ?? []
33679
33672
  ],
33673
+ setSelectedRowKeys,
33680
33674
  viewData,
33681
33675
  context,
33682
33676
  selectedRowKeys,
@@ -33721,7 +33715,9 @@ var Many2ManyField = (props) => {
33721
33715
  {
33722
33716
  columns,
33723
33717
  onToggleColumnOptional,
33724
- isDisplayCheckbox: false
33718
+ isDisplayCheckbox,
33719
+ checkedAll,
33720
+ handleCheckBoxAll
33725
33721
  }
33726
33722
  ),
33727
33723
  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
@@ -33730,7 +33726,7 @@ var Many2ManyField = (props) => {
33730
33726
  columns,
33731
33727
  rows,
33732
33728
  rootField,
33733
- isDisplayCheckbox: false,
33729
+ isDisplayCheckbox,
33734
33730
  model: relation,
33735
33731
  renderField: ({
33736
33732
  row,
@@ -33751,7 +33747,11 @@ var Many2ManyField = (props) => {
33751
33747
  },
33752
33748
  onRemoveRow: null,
33753
33749
  onAddRow,
33754
- onClickRow
33750
+ onClickRow,
33751
+ typeTable,
33752
+ selectedRowKeysRef,
33753
+ selectedRowKeys,
33754
+ setSelectedRowKeys
33755
33755
  }
33756
33756
  )
33757
33757
  ]
@@ -33762,7 +33762,7 @@ var Many2ManyField = (props) => {
33762
33762
  }
33763
33763
  ) }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LayerLoading, {}),
33764
33764
  /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-2 mt-auto", children: [
33765
- isCheckBox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33765
+ isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33766
33766
  "button",
33767
33767
  {
33768
33768
  disabled: selectedRowKeys?.length === 0,
package/dist/widgets.mjs CHANGED
@@ -14722,9 +14722,10 @@ var Search = ({
14722
14722
  setPage(0);
14723
14723
  setSelectedRowKeys([]);
14724
14724
  const containSearchFilter = selectedTags?.length > 0 && selectedTags?.find(
14725
- (item) => item?.type === SearchType.FILTER || item?.type === SearchType.SEARCH || item?.type === SearchType.GROUP
14725
+ (item) => item?.type === SearchType.FILTER || item?.type === SearchType.SEARCH
14726
14726
  );
14727
- if (containSearchFilter || Array.isArray(selectedTags) && selectedTags?.length === 0) {
14727
+ const containGroup = selectedTags?.length > 0 && selectedTags?.some((item) => item?.type === SearchType.GROUP);
14728
+ if (containSearchFilter && !containGroup || selectedTags?.length === 0) {
14728
14729
  setDomainList(domainSearch);
14729
14730
  }
14730
14731
  }
@@ -14735,8 +14736,9 @@ var Search = ({
14735
14736
  setDidInit(false);
14736
14737
  setIsReadyFormatDomain(false);
14737
14738
  };
14738
- }, [viewData]);
14739
+ }, [aid]);
14739
14740
  useEffect6(() => {
14741
+ if (!filterBy) return;
14740
14742
  if (didInit || selectedTags?.length > 0) return;
14741
14743
  const searchDefaults = Object.entries(context || {}).filter(
14742
14744
  ([key]) => key.startsWith("search_default_")
@@ -14764,7 +14766,7 @@ var Search = ({
14764
14766
  return item;
14765
14767
  });
14766
14768
  if (updatedFilter) setFilterBy(updatedFilter);
14767
- if (hasGroupBy) {
14769
+ if (hasGroupBy && fieldsList?.length > 0) {
14768
14770
  viewData?.views?.search?.filters_by?.forEach((item, idx) => {
14769
14771
  const groupCtx = evalJSONContext(item?.context);
14770
14772
  handleAddTagSearch?.({
@@ -14773,13 +14775,14 @@ var Search = ({
14773
14775
  type: SearchType.GROUP,
14774
14776
  context: groupCtx,
14775
14777
  groupIndex: idx,
14776
- isDefault: true
14778
+ isDefault: true,
14779
+ fieldsGroup: fieldsList
14777
14780
  });
14778
14781
  });
14779
14782
  setDidInit(true);
14780
14783
  }
14781
14784
  setIsReadyFormatDomain(true);
14782
- }, [aid]);
14785
+ }, [aid, filterBy, fieldsList]);
14783
14786
  return /* @__PURE__ */ jsxs39(
14784
14787
  "div",
14785
14788
  {
@@ -32195,19 +32198,7 @@ var FeeField = (props) => {
32195
32198
  import { useEffect as useEffect16, useRef as useRef14, useState as useState16 } from "react";
32196
32199
  import { jsx as jsx84, jsxs as jsxs59 } from "react/jsx-runtime";
32197
32200
  var FileUploadField = (props) => {
32198
- const {
32199
- name: name2,
32200
- methods,
32201
- isForm,
32202
- model,
32203
- required,
32204
- idForm,
32205
- widget,
32206
- useUploadImage,
32207
- useUploadFile,
32208
- useGetImage,
32209
- isBase64File
32210
- } = props;
32201
+ const { name: name2, methods, isForm, model, required, idForm, widget, useUploadImage, useUploadFile, useGetImage, isBase64File } = props;
32211
32202
  const fileInputRef = useRef14(null);
32212
32203
  const [selectedFiles, setSelectedFiles] = useState16([]);
32213
32204
  const [uploadError, setUploadError] = useState16();
@@ -33543,14 +33534,12 @@ var Many2ManyField = (props) => {
33543
33534
  page,
33544
33535
  rows,
33545
33536
  columns,
33546
- typeTable,
33547
33537
  renderField,
33548
33538
  isDataLoading,
33549
33539
  relation,
33550
33540
  onToggleColumnOptional,
33551
33541
  isDataFetched,
33552
33542
  isPlaceholderData,
33553
- isCheckBox,
33554
33543
  optionsObject,
33555
33544
  onChoose,
33556
33545
  onAddNew,
@@ -33564,7 +33553,13 @@ var Many2ManyField = (props) => {
33564
33553
  evalJSONContext,
33565
33554
  searchController,
33566
33555
  viewData,
33567
- setDomain
33556
+ setDomain,
33557
+ isDisplayCheckbox,
33558
+ checkedAll,
33559
+ handleCheckBoxAll,
33560
+ selectedRowKeysRef,
33561
+ typeTable,
33562
+ setSelectedRowKeys
33568
33563
  } = props;
33569
33564
  const {
33570
33565
  context,
@@ -33604,8 +33599,6 @@ var Many2ManyField = (props) => {
33604
33599
  groupBy,
33605
33600
  showFiltersGroups: true,
33606
33601
  setGroupBy,
33607
- setSelectedRowKeys: (keys) => {
33608
- },
33609
33602
  setDomainList: setDomain,
33610
33603
  setPage: (pages) => {
33611
33604
  setPage?.(pages);
@@ -33615,6 +33608,7 @@ var Many2ManyField = (props) => {
33615
33608
  (col) => col?.field?.type_co === "field" && col?.optional !== "hide"
33616
33609
  )?.map((col) => ({ ...col.field })) ?? []
33617
33610
  ],
33611
+ setSelectedRowKeys,
33618
33612
  viewData,
33619
33613
  context,
33620
33614
  selectedRowKeys,
@@ -33659,7 +33653,9 @@ var Many2ManyField = (props) => {
33659
33653
  {
33660
33654
  columns,
33661
33655
  onToggleColumnOptional,
33662
- isDisplayCheckbox: false
33656
+ isDisplayCheckbox,
33657
+ checkedAll,
33658
+ handleCheckBoxAll
33663
33659
  }
33664
33660
  ),
33665
33661
  /* @__PURE__ */ jsx102(
@@ -33668,7 +33664,7 @@ var Many2ManyField = (props) => {
33668
33664
  columns,
33669
33665
  rows,
33670
33666
  rootField,
33671
- isDisplayCheckbox: false,
33667
+ isDisplayCheckbox,
33672
33668
  model: relation,
33673
33669
  renderField: ({
33674
33670
  row,
@@ -33689,7 +33685,11 @@ var Many2ManyField = (props) => {
33689
33685
  },
33690
33686
  onRemoveRow: null,
33691
33687
  onAddRow,
33692
- onClickRow
33688
+ onClickRow,
33689
+ typeTable,
33690
+ selectedRowKeysRef,
33691
+ selectedRowKeys,
33692
+ setSelectedRowKeys
33693
33693
  }
33694
33694
  )
33695
33695
  ]
@@ -33700,7 +33700,7 @@ var Many2ManyField = (props) => {
33700
33700
  }
33701
33701
  ) }) }) : /* @__PURE__ */ jsx102(LayerLoading, {}),
33702
33702
  /* @__PURE__ */ jsxs72("div", { className: "flex items-center gap-2 mt-auto", children: [
33703
- isCheckBox && /* @__PURE__ */ jsx102(
33703
+ isDisplayCheckbox && /* @__PURE__ */ jsx102(
33704
33704
  "button",
33705
33705
  {
33706
33706
  disabled: selectedRowKeys?.length === 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/sme-widget-ui",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",