sccoreui 6.5.21 → 6.5.22

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.
@@ -16,7 +16,7 @@ const ListBoxDropdown = (props) => {
16
16
  // onSelectAll,
17
17
  onSelectionChange, onChange, footeTemplate, headerTemplate, labelIcon, labelIconPos, label, labelIconSize, listItems, filter, multiple, filterPlaceholder, optionLabel, listClassName, menuClassName, listBoxParentClassName, listBoxclassName, optionTemplate, values, link, className, scrollElementId, optionsMenuRef = boxRef,
18
18
  // buttonClassName,
19
- showChips, chipTemplate, chipClassName, chipsParentClassName, showRemoveIcon, removeIconSize, removeIconClassName, onRemoveItem, isDraggable, onDranghandle, onShow, onHide, onFocus, confirmationOption, selectedOptionNone, type, emptyFilterMessage, emptyMessage, dataLabel, onFilterValueChange, filterBy, virtualScrollerOptions, virtualScroll, fetchData, } = props;
19
+ showChips, chipTemplate, chipClassName, chipsParentClassName, showRemoveIcon, removeIconSize, removeIconClassName, onRemoveItem, isDraggable, onDranghandle, onShow, onHide, onFocus, confirmationOption, selectedOptionNone, type, emptyFilterMessage, emptyMessage, dataLabel, onFilterValueChange, filterBy, virtualScrollerOptions, virtualScroll, fetchData, refetchKey, } = props;
20
20
  const [selectedItems, setSelectedItems] = (0, react_1.useState)([]);
21
21
  // const [inpValue, setInpValue] = useState<any>();
22
22
  // const [checked, setChecked] = useState<boolean>(false);
@@ -126,7 +126,7 @@ const ListBoxDropdown = (props) => {
126
126
  template: () => ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: listBoxParentClassName
127
127
  ? listBoxParentClassName +
128
128
  " list_box_dropdown border-round-lg border-1 overflow-hidden border-gray-200"
129
- : "list_box_dropdown" }, { children: [headerTemplate && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: headerTemplate() }), virtualScroll ? ((0, jsx_runtime_1.jsx)(virtualization_component_1.default, { emptyFilterMessage: emptyFilterMessage, listBoxclassName: listBoxclassName, emptyMessage: emptyMessage, multiple: multiple, onSelectionChange: onSelectionChange, listClassName: listClassName, filterPlaceholder: filterPlaceholder, optionTemplate: optionTemplate, optionLabel: optionLabel, values: values, fetchData: fetchData })) : ((0, jsx_runtime_1.jsx)(listbox_1.ListBox, { type: "sectionHeader", itemTemplate: (option) => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: optionTemplate ? (optionTemplate(option)) : ((0, jsx_runtime_1.jsx)("span", { children: option[`${optionLabel}`] })) })), listClassName: `${selectedOptionNone ? "selected-none" : ""} ${listClassName
129
+ : "list_box_dropdown" }, { children: [headerTemplate && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: headerTemplate() }), virtualScroll ? ((0, jsx_runtime_1.jsx)(virtualization_component_1.default, { emptyFilterMessage: emptyFilterMessage, listBoxclassName: listBoxclassName, emptyMessage: emptyMessage, multiple: multiple, onSelectionChange: onSelectionChange, listClassName: listClassName, filterPlaceholder: filterPlaceholder, optionTemplate: optionTemplate, optionLabel: optionLabel, values: values, fetchData: fetchData, refetchKey: refetchKey })) : ((0, jsx_runtime_1.jsx)(listbox_1.ListBox, { type: "sectionHeader", itemTemplate: (option) => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: optionTemplate ? (optionTemplate(option)) : ((0, jsx_runtime_1.jsx)("span", { children: option[`${optionLabel}`] })) })), listClassName: `${selectedOptionNone ? "selected-none" : ""} ${listClassName
130
130
  ? listClassName
131
131
  : " h-18rem overflow-auto "} ${selectAll && ""}`, filter: filter ? true : false, filterBy: filterBy, multiple: multiple ? true : false, value: selectedItems, onChange: (e) => onSelectOption(e), onFilterValueChange: onFilterValueChange, virtualScrollerOptions: virtualScrollerOptions, options: selectedOptionNone
132
132
  ? listItems.length === selectedItems.length
@@ -10,8 +10,10 @@ const hooks_1 = require("primereact/hooks");
10
10
  const skeleton_1 = require("primereact/skeleton");
11
11
  function RowVirtualizerDynamic(props) {
12
12
  var _a, _b;
13
- const { optionTemplate, optionLabel, filterPlaceholder, matchKey = "id", values, multiple = false, onSelectionChange, fetchData, emptyMessage, emptyFilterMessage, } = props;
13
+ const { optionTemplate, optionLabel, filterPlaceholder, matchKey = "id", values, multiple = false, onSelectionChange, fetchData, emptyMessage, emptyFilterMessage, refetchKey, } = props;
14
14
  const parentRef = React.useRef(null);
15
+ const fetchDataRef = React.useRef(fetchData);
16
+ fetchDataRef.current = fetchData;
15
17
  const loadingRef = React.useRef(false);
16
18
  const allCount = React.useRef(null);
17
19
  const totalRecordsCount = React.useRef(null);
@@ -50,7 +52,7 @@ function RowVirtualizerDynamic(props) {
50
52
  const fetchMoreData = (props) => tslib_1.__awaiter(this, void 0, void 0, function* () {
51
53
  var _c;
52
54
  try {
53
- const object = yield fetchData(props);
55
+ const object = yield fetchDataRef.current(props);
54
56
  if (object) {
55
57
  loadingRef.current = false;
56
58
  if (lastSearchTerm.current && !(props === null || props === void 0 ? void 0 : props.searchTerm)) {
@@ -85,6 +87,20 @@ function RowVirtualizerDynamic(props) {
85
87
  setLoading(true);
86
88
  fetchMoreData(Object.assign(Object.assign({}, initialFetch), { searchTerm: debouncedValue }));
87
89
  }, [debouncedValue]);
90
+ const isFirstRender = React.useRef(true);
91
+ React.useEffect(() => {
92
+ if (isFirstRender.current) {
93
+ isFirstRender.current = false;
94
+ return;
95
+ }
96
+ if (refetchKey !== undefined) {
97
+ pageIndex.current = 0;
98
+ setData([]);
99
+ loadingRef.current = true;
100
+ setLoading(true);
101
+ fetchMoreData(Object.assign(Object.assign({}, initialFetch), { searchTerm: debouncedValue }));
102
+ }
103
+ }, [refetchKey]);
88
104
  React.useEffect(() => {
89
105
  const el = parentRef.current;
90
106
  el && el.addEventListener("scroll", handleScroll);
@@ -274,6 +274,7 @@ export interface ListBoxDropdownTypes {
274
274
  onSelectionChange?: (data: any) => void;
275
275
  fetchData?: (data: any) => void;
276
276
  disabled?: boolean;
277
+ refetchKey?: number | string;
277
278
  }
278
279
  export interface DatePickerTypes {
279
280
  value: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "6.5.21",
3
+ "version": "6.5.22",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -60,7 +60,7 @@
60
60
  "@types/react": "18",
61
61
  "@types/react-dom": "18",
62
62
  "@yaireo/tagify": "^4.33.2",
63
- "ag-charts-enterprise": "^11.2.0",
63
+ "ag-charts-enterprise": "11.2.3",
64
64
  "ag-grid-react": "^31.2.1",
65
65
  "axios": "^1.6.8",
66
66
  "chart.js": "^4.3.0",