@fctc/sme-widget-ui 1.1.2 → 1.1.4

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/widgets.js CHANGED
@@ -12010,9 +12010,12 @@ var TableBodyRow = (props) => {
12010
12010
  isForm,
12011
12011
  typeCo,
12012
12012
  selectedRowKeys,
12013
+ tableGroupController,
12014
+ groupByList,
12015
+ setIsAutoSelect,
12016
+ isAutoSelect,
12013
12017
  isEditTable
12014
12018
  } = props;
12015
- const [isAutoSelect, setIsAutoSelect] = (0, import_react11.useState)(false);
12016
12019
  const rootStyle = getComputedStyle(document.documentElement);
12017
12020
  const colorPrimary = rootStyle.getPropertyValue("--primary").trim();
12018
12021
  return rows && rows?.length > 0 ? rows?.map((row, index4) => {
@@ -12020,21 +12023,24 @@ var TableBodyRow = (props) => {
12020
12023
  TableGroup,
12021
12024
  {
12022
12025
  columns,
12023
- indexRow: index4,
12024
12026
  rows,
12025
12027
  row,
12028
+ indexRow: index4,
12026
12029
  model,
12027
12030
  viewData,
12028
12031
  renderField,
12029
12032
  level: level + 1,
12030
12033
  specification,
12031
- domain: row?.__domain,
12032
12034
  context,
12033
12035
  checkedAll,
12034
12036
  isDisplayCheckbox,
12035
12037
  selectedRowKeysRef,
12036
12038
  isAutoSelect,
12037
- setIsAutoSelect
12039
+ setIsAutoSelect,
12040
+ groupByList,
12041
+ tableGroupController,
12042
+ setSelectedRowKeys,
12043
+ selectedRowKeys
12038
12044
  },
12039
12045
  `record-group-${index4}`
12040
12046
  ) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
@@ -12073,7 +12079,15 @@ var TableBodyRow = (props) => {
12073
12079
  ) }) });
12074
12080
  };
12075
12081
  var TableBody = (props) => {
12076
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tbody", { className: "overflow-hidden z-0", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TableBodyRow, { ...props }) });
12082
+ const [isAutoSelect, setIsAutoSelect] = (0, import_react11.useState)(false);
12083
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tbody", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
12084
+ TableBodyRow,
12085
+ {
12086
+ ...props,
12087
+ isAutoSelect,
12088
+ setIsAutoSelect
12089
+ }
12090
+ ) });
12077
12091
  };
12078
12092
 
12079
12093
  // src/widgets/advanced/table/table-filter.tsx
@@ -33672,176 +33686,185 @@ var Many2ManyField = (props) => {
33672
33686
  clearSearch
33673
33687
  } = searchController;
33674
33688
  return (0, import_react_dom8.createPortal)(
33675
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[9999]", children: [
33676
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
33677
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "absolute inset-0 overflow-auto px-6 flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
33678
- "div",
33679
- {
33680
- style: {
33681
- zIndex: 1
33682
- },
33683
- className: "relative p-4 flex flex-col gap-2 max-w-full lg:max-w-[1000px] lg:min-w-[1000px] transform rounded-3xl bg-[#FFF] min-h-[90%] max-h-[90%] h-fit",
33684
- children: [
33685
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex justify-between items-center border-b border-[rgba(0,0,0,0.1)] pb-2", children: [
33686
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "text-[20px] font-semibold", children: title }),
33687
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(CloseIcon, {}) })
33688
- ] }),
33689
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "grid grid-cols-3 gap-2 items-center py-2", children: [
33690
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "col-span-3 sm:col-span-2 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33691
- Search,
33692
- {
33693
- removeSearchItems,
33694
- selectedTags,
33695
- filterBy,
33696
- setFilterBy,
33697
- searchString,
33698
- onSearchString,
33699
- handleAddTagSearch,
33700
- searchBy,
33701
- groupBy,
33702
- showFiltersGroups: true,
33703
- setGroupBy,
33704
- setDomainList: setDomain,
33705
- setPage: (pages) => {
33706
- setPage?.(pages);
33707
- },
33708
- fieldsList: [
33709
- ...columns?.filter(
33710
- (col) => col?.field?.type_co === "field" && col?.optional !== "hide"
33711
- )?.map((col) => ({ ...col.field })) ?? []
33712
- ],
33713
- setSelectedRowKeys,
33714
- viewData,
33715
- context,
33716
- selectedRowKeys,
33717
- aid,
33718
- domainSearch,
33719
- evalJSONContext,
33720
- clearSearch
33721
- }
33722
- ) }),
33723
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33724
- PaginationView,
33725
- {
33726
- className: "pagination-bar col-span-3 sm:col-span-1 justify-end flex-1",
33727
- currentPage: page,
33728
- totalCount: totalRows ?? 0,
33729
- pageSize: 10,
33730
- onPageChange: (page2) => {
33731
- if (typeof setPage === "function") {
33732
- setPage(page2);
33689
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
33690
+ "div",
33691
+ {
33692
+ style: {
33693
+ zIndex: 99999
33694
+ },
33695
+ className: "fixed bottom-0 left-0 right-0 top-0",
33696
+ children: [
33697
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
33698
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "absolute inset-0 overflow-auto px-6 flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
33699
+ "div",
33700
+ {
33701
+ style: {
33702
+ zIndex: 1
33703
+ },
33704
+ className: "relative p-4 flex flex-col gap-2 max-w-full lg:max-w-[1000px] lg:min-w-[1000px] transform rounded-3xl bg-[#FFF] min-h-[90%] max-h-[90%] h-fit",
33705
+ children: [
33706
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex justify-between items-center border-b border-[rgba(0,0,0,0.1)] pb-2", children: [
33707
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "text-[20px] font-semibold", children: title }),
33708
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(CloseIcon, {}) })
33709
+ ] }),
33710
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "grid grid-cols-3 gap-2 items-center py-2", children: [
33711
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "col-span-3 sm:col-span-2 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33712
+ Search,
33713
+ {
33714
+ removeSearchItems,
33715
+ selectedTags,
33716
+ filterBy,
33717
+ setFilterBy,
33718
+ searchString,
33719
+ onSearchString,
33720
+ handleAddTagSearch,
33721
+ searchBy,
33722
+ groupBy,
33723
+ showFiltersGroups: true,
33724
+ setGroupBy,
33725
+ setDomainList: setDomain,
33726
+ setPage: (pages) => {
33727
+ setPage?.(pages);
33728
+ },
33729
+ fieldsList: [
33730
+ ...columns?.filter(
33731
+ (col) => col?.field?.type_co === "field" && col?.optional !== "hide"
33732
+ )?.map((col) => ({ ...col.field })) ?? []
33733
+ ],
33734
+ setSelectedRowKeys,
33735
+ viewData,
33736
+ context,
33737
+ selectedRowKeys,
33738
+ aid,
33739
+ domainSearch,
33740
+ evalJSONContext,
33741
+ clearSearch
33733
33742
  }
33734
- },
33735
- displayPageNumberDots: false,
33736
- displayRowsNumberOption: false
33737
- }
33738
- )
33739
- ] }),
33740
- !isDataLoading && isDataFetched || isPlaceholderData ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "relative overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "relative h-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33741
- "div",
33742
- {
33743
- className: `border-[1px] h-full border-solid border-[#dbe0e6] rounded-[10px] relative w-full overflow-hidden`,
33744
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "flex flex-col gap-[16px] w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: `relative w-full h-full`, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33743
+ ) }),
33744
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33745
+ PaginationView,
33746
+ {
33747
+ className: "pagination-bar col-span-3 sm:col-span-1 justify-end flex-1",
33748
+ currentPage: page,
33749
+ totalCount: totalRows ?? 0,
33750
+ pageSize: 10,
33751
+ onPageChange: (page2) => {
33752
+ if (typeof setPage === "function") {
33753
+ setPage(page2);
33754
+ }
33755
+ },
33756
+ displayPageNumberDots: false,
33757
+ displayRowsNumberOption: false
33758
+ }
33759
+ )
33760
+ ] }),
33761
+ !isDataLoading && isDataFetched || isPlaceholderData ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "relative overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "relative h-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33745
33762
  "div",
33746
33763
  {
33747
- className: `flex w-full items-center h-full overflow-auto `,
33748
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "w-full h-full max-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
33749
- "table",
33764
+ className: `border-[1px] h-full border-solid border-[#dbe0e6] rounded-[10px] relative w-full overflow-hidden`,
33765
+ children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "flex flex-col gap-[16px] w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: `relative w-full h-full`, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33766
+ "div",
33750
33767
  {
33751
- className: `relative w-full bg-white custom-dropdown `,
33752
- children: [
33753
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33754
- TableHead,
33755
- {
33756
- columns,
33757
- onToggleColumnOptional,
33758
- isDisplayCheckbox,
33759
- checkedAll,
33760
- handleCheckBoxAll
33761
- }
33762
- ),
33763
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33764
- TableBody,
33765
- {
33766
- columns,
33767
- rows,
33768
- rootField,
33769
- isDisplayCheckbox,
33770
- model: relation,
33771
- renderField: ({
33772
- row,
33773
- col,
33774
- indexRow,
33775
- onChangeData,
33776
- rootField: rootField2
33777
- }) => {
33778
- if (typeof renderField === "function") {
33779
- return renderField({
33768
+ className: `flex w-full items-center h-full overflow-auto `,
33769
+ children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "w-full h-full max-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
33770
+ "table",
33771
+ {
33772
+ className: `relative w-full bg-white custom-dropdown `,
33773
+ children: [
33774
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33775
+ TableHead,
33776
+ {
33777
+ columns,
33778
+ onToggleColumnOptional,
33779
+ isDisplayCheckbox,
33780
+ checkedAll,
33781
+ handleCheckBoxAll
33782
+ }
33783
+ ),
33784
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33785
+ TableBody,
33786
+ {
33787
+ columns,
33788
+ rows,
33789
+ rootField,
33790
+ isDisplayCheckbox,
33791
+ model: relation,
33792
+ renderField: ({
33780
33793
  row,
33781
33794
  col,
33782
33795
  indexRow,
33783
33796
  onChangeData,
33784
33797
  rootField: rootField2
33785
- });
33798
+ }) => {
33799
+ if (typeof renderField === "function") {
33800
+ return renderField({
33801
+ row,
33802
+ col,
33803
+ indexRow,
33804
+ onChangeData,
33805
+ rootField: rootField2
33806
+ });
33807
+ }
33808
+ },
33809
+ onRemoveRow: null,
33810
+ onAddRow,
33811
+ onClickRow,
33812
+ typeTable,
33813
+ selectedRowKeysRef,
33814
+ selectedRowKeys,
33815
+ setSelectedRowKeys
33786
33816
  }
33787
- },
33788
- onRemoveRow: null,
33789
- onAddRow,
33790
- onClickRow,
33791
- typeTable,
33792
- selectedRowKeysRef,
33793
- selectedRowKeys,
33794
- setSelectedRowKeys
33795
- }
33796
- )
33797
- ]
33817
+ )
33818
+ ]
33819
+ }
33820
+ ) })
33798
33821
  }
33799
- ) })
33822
+ ) }) })
33800
33823
  }
33801
- ) }) })
33802
- }
33803
- ) }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LayerLoading, {}),
33804
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-2 mt-auto", children: [
33805
- isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33806
- "button",
33807
- {
33808
- disabled: selectedRowKeys?.length === 0,
33809
- type: "button",
33810
- onClick: () => onChoose(selectedRowKeys),
33811
- className: "button-primary",
33812
- children: instance.t("choose")
33813
- }
33814
- ),
33815
- optionsObject && "no_create" in optionsObject && optionsObject?.no_create === false && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33816
- "button",
33817
- {
33818
- type: "button",
33819
- onClick: () => {
33820
- if (typeof onAddNew === "function") {
33821
- onAddNew();
33822
- onClose();
33823
- } else {
33824
- handleCreateNewOnPage();
33824
+ ) }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LayerLoading, {}),
33825
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-2 mt-auto", children: [
33826
+ isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33827
+ "button",
33828
+ {
33829
+ disabled: selectedRowKeys?.length === 0,
33830
+ type: "button",
33831
+ onClick: () => onChoose(selectedRowKeys),
33832
+ className: "button-primary",
33833
+ children: instance.t("choose")
33825
33834
  }
33826
- },
33827
- className: "button-primary",
33828
- children: instance.t("new")
33829
- }
33830
- ),
33831
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33832
- "button",
33833
- {
33834
- type: "button",
33835
- onClick: onClose,
33836
- className: "button-secondary",
33837
- children: instance.t("cancel_button")
33838
- }
33839
- )
33840
- ] })
33841
- ]
33842
- }
33843
- ) })
33844
- ] }),
33835
+ ),
33836
+ optionsObject && "no_create" in optionsObject && optionsObject?.no_create === false && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33837
+ "button",
33838
+ {
33839
+ type: "button",
33840
+ onClick: () => {
33841
+ if (typeof onAddNew === "function") {
33842
+ onAddNew();
33843
+ onClose();
33844
+ } else {
33845
+ handleCreateNewOnPage();
33846
+ }
33847
+ },
33848
+ className: "button-primary",
33849
+ children: instance.t("new")
33850
+ }
33851
+ ),
33852
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
33853
+ "button",
33854
+ {
33855
+ type: "button",
33856
+ onClick: onClose,
33857
+ className: "button-secondary",
33858
+ children: instance.t("cancel_button")
33859
+ }
33860
+ )
33861
+ ] })
33862
+ ]
33863
+ }
33864
+ ) })
33865
+ ]
33866
+ }
33867
+ ),
33845
33868
  document.body
33846
33869
  );
33847
33870
  };