sccoreui 6.3.93 → 6.3.94
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/App.js +1 -1
- package/dist/App.scss +8 -18
- package/dist/components/list-box-dropdown/list-box-dropdown.js +6 -3
- package/dist/components/virtual-scroll-drop-down/VirtualScrollDropDown.js +51 -0
- package/dist/types/components/types/type.d.ts +2 -0
- package/dist/types/components/virtual-scroll-drop-down/VirtualScrollDropDown.d.ts +2 -0
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -6,6 +6,6 @@ require("./App.scss");
|
|
|
6
6
|
// import Home from "./pages/home";
|
|
7
7
|
const App = () => {
|
|
8
8
|
// const [selectedCountries, setSelectedCountries] = useState(null);
|
|
9
|
-
return (0, jsx_runtime_1.jsx)("div", {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "m-6" }));
|
|
10
10
|
};
|
|
11
11
|
exports.default = App;
|
package/dist/App.scss
CHANGED
|
@@ -1161,7 +1161,14 @@ button[aria-expanded="true"] {
|
|
|
1161
1161
|
padding-inline: 6px 10px !important;
|
|
1162
1162
|
color: var(--primary-400);
|
|
1163
1163
|
background: transparent;
|
|
1164
|
-
|
|
1164
|
+
&.assign_value {
|
|
1165
|
+
.p-button-label {
|
|
1166
|
+
max-width: 120px;
|
|
1167
|
+
white-space: nowrap;
|
|
1168
|
+
text-overflow: ellipsis;
|
|
1169
|
+
overflow: hidden;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1165
1172
|
&:not(.section_btn) {
|
|
1166
1173
|
height: 28px;
|
|
1167
1174
|
}
|
|
@@ -1189,23 +1196,6 @@ button[aria-expanded="true"] {
|
|
|
1189
1196
|
}
|
|
1190
1197
|
}
|
|
1191
1198
|
|
|
1192
|
-
.p-button.data_label {
|
|
1193
|
-
color: var(--gray-600);
|
|
1194
|
-
background-color: transparent;
|
|
1195
|
-
display: flex;
|
|
1196
|
-
gap: 4px;
|
|
1197
|
-
svg {
|
|
1198
|
-
path {
|
|
1199
|
-
stroke: var(--gray-700);
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
&:hover {
|
|
1204
|
-
background-color: var(--gray-200);
|
|
1205
|
-
color: var(--gray-700);
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
1199
|
.list_box_chips {
|
|
1210
1200
|
display: flex;
|
|
1211
1201
|
flex-wrap: wrap;
|
|
@@ -15,7 +15,7 @@ const ListBoxDropdown = (props) => {
|
|
|
15
15
|
// onSelectAll,
|
|
16
16
|
onChange, footeTemplate, headerTemplate, labelIcon, labelIconPos, label, labelIconSize, listItems, filter, multiple, filterPlaceholder, optionLabel, listClassName, menuClassName, listBoxParentClassName, listBoxclassName, optionTemplate, values, link, className, scrollElementId, optionsMenuRef = boxRef,
|
|
17
17
|
// buttonClassName,
|
|
18
|
-
showChips, chipTemplate, chipClassName, chipsParentClassName, showRemoveIcon, removeIconSize, removeIconClassName, onRemoveItem, isDraggable, onDranghandle, onShow, onHide, onFocus, confirmationOption, selectedOptionNone, type, emptyFilterMessage, emptyMessage, dataLabel, } = props;
|
|
18
|
+
showChips, chipTemplate, chipClassName, chipsParentClassName, showRemoveIcon, removeIconSize, removeIconClassName, onRemoveItem, isDraggable, onDranghandle, onShow, onHide, onFocus, confirmationOption, selectedOptionNone, type, emptyFilterMessage, emptyMessage, dataLabel, onFilterValueChange, virtualScrollerOptions, } = props;
|
|
19
19
|
const [selectedItems, setSelectedItems] = (0, react_1.useState)([]);
|
|
20
20
|
// const [inpValue, setInpValue] = useState<any>();
|
|
21
21
|
// const [checked, setChecked] = useState<boolean>(false);
|
|
@@ -106,7 +106,7 @@ const ListBoxDropdown = (props) => {
|
|
|
106
106
|
template: () => ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: listBoxParentClassName
|
|
107
107
|
? listBoxParentClassName +
|
|
108
108
|
" list_box_dropdown border-round-lg border-1 overflow-hidden border-gray-200"
|
|
109
|
-
: "list_box_dropdown" }, { children: [headerTemplate && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: headerTemplate() }), (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 ? listClassName : " h-18rem overflow-auto "} ${selectAll && ""}`, filter: filter ? true : false, multiple: multiple ? true : false, value: selectedItems, onChange: (e) => onSelectOption(e), options: selectedOptionNone
|
|
109
|
+
: "list_box_dropdown" }, { children: [headerTemplate && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: headerTemplate() }), (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 ? listClassName : " h-18rem overflow-auto "} ${selectAll && ""}`, filter: filter ? true : false, multiple: multiple ? true : false, value: selectedItems, onChange: (e) => onSelectOption(e), onFilterValueChange: onFilterValueChange, virtualScrollerOptions: virtualScrollerOptions, options: selectedOptionNone
|
|
110
110
|
? listItems.length === selectedItems.length
|
|
111
111
|
? []
|
|
112
112
|
: listItems
|
|
@@ -136,7 +136,10 @@ const ListBoxDropdown = (props) => {
|
|
|
136
136
|
? emptyFilterMessage
|
|
137
137
|
: "No Results Found", emptyMessage: emptyMessage ? emptyMessage : "No Data Found" }), footeTemplate && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: footeTemplate() })] }))),
|
|
138
138
|
},
|
|
139
|
-
] }), !showChips ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !dataLabel ? ((0, jsx_runtime_1.jsx)(button_1.Button, { type: "button", className: `list_box_btn ${type === "sectionHeader" ? "section_btn" : ""}`, link: link ? true : false, icon: labelIcon ? labelIcon : "", size: labelIconSize ? labelIconSize : "", iconPos: labelIconPos ? labelIconPos : "", label: label, onClick: (event) => optionsMenuRef.current.toggle(event), title: label })) : ((0, jsx_runtime_1.jsx)(
|
|
139
|
+
] }), !showChips ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !dataLabel ? ((0, jsx_runtime_1.jsx)(button_1.Button, { type: "button", className: `list_box_btn ${type === "sectionHeader" ? "section_btn" : ""}`, link: link ? true : false, icon: labelIcon ? labelIcon : "", size: labelIconSize ? labelIconSize : "", iconPos: labelIconPos ? labelIconPos : "", label: label, onClick: (event) => optionsMenuRef.current.toggle(event), title: label })) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ onClick: (event) => optionsMenuRef.current.toggle(event), title: label, className: "listbox_label" }, { children: dataLabel }))) })) : ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex flex-wrap gap-2" }, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { type: "button",
|
|
140
|
+
// className={`list_box_button focus:shadow-none p-0 h-max h-auto mx-2`}
|
|
141
|
+
// link={link ? true : false}
|
|
142
|
+
icon: labelIcon ? labelIcon : "", size: labelIconSize ? labelIconSize : "", iconPos: labelIconPos ? labelIconPos : "", label: label, onClick: (event) => optionsMenuRef.current.toggle(event), "aria-controls": "popup_menu_right", "aria-haspopup": true, ref: buttonRef, className: `list_box_btn ${type === "sectionHeader" ? "section_btn" : ""}`, title: label }), (0, jsx_runtime_1.jsx)("ul", Object.assign({ className: `list_box_chips ${chipsParentClassName}` }, { children: selectedItems &&
|
|
140
143
|
(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map((item, index) => {
|
|
141
144
|
var _a, _b, _c, _d;
|
|
142
145
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isDraggable !== undefined ? ((0, jsx_runtime_1.jsx)("li", Object.assign({ draggable: isDraggable, onDragStart: (e) => handleDragStart(e, index), onDragOver: (e) => handleDragOver(e), onDrop: (e) => handleDrop(e, index), className: `select-none ${chipClassName ? chipClassName : "list_box_chip"} ${showRemoveIcon ? "relative text-gray-700" : ""}` }, { children: chipTemplate ? (chipTemplate(item)) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: "text-truncate max-w-10rem inline-block", title: typeof item === "object"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
// import { VirtualScroller } from 'primereact/virtualscroller';
|
|
7
|
+
// import { OverlayPanel } from 'primereact/overlaypanel';
|
|
8
|
+
// import { InputText } from 'primereact/inputtext';
|
|
9
|
+
const button_1 = require("primereact/button");
|
|
10
|
+
// import { classNames } from 'primereact/utils';
|
|
11
|
+
const dropdown_1 = require("primereact/dropdown");
|
|
12
|
+
const VirtualScrollDropDown = () => {
|
|
13
|
+
const [items] = (0, react_1.useState)(Array.from({ length: 100000 }).map((_, i) => `Item #${i}`));
|
|
14
|
+
// const [totalRecords] = useState(300); // total from API
|
|
15
|
+
// const [searchTerm, setSearchTerm] = useState('');
|
|
16
|
+
const [selectedItem] = (0, react_1.useState)(null);
|
|
17
|
+
const op = (0, react_1.useRef)(null);
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
19
|
+
loadData(0, 100); // Load initial 100 items
|
|
20
|
+
}, []);
|
|
21
|
+
const loadData = (offset, limit, search = '') => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
console.log(offset, limit, search, "onscroll");
|
|
23
|
+
// replace with your API
|
|
24
|
+
// const response = await fetch(`/api/items?offset=${offset}&limit=${limit}&search=${search}`);
|
|
25
|
+
// const data = await response.json();
|
|
26
|
+
// setItems(prev => offset === 0 ? data : [...prev, ...data]);
|
|
27
|
+
});
|
|
28
|
+
// const itemTemplate = (item, options) => {
|
|
29
|
+
// const className = classNames('flex align-items-center p-2', {
|
|
30
|
+
// 'surface-hover': options.odd
|
|
31
|
+
// });
|
|
32
|
+
// return (
|
|
33
|
+
// <div className={className} style={{ height: options.props.itemSize + 'px' }}>
|
|
34
|
+
// {item}
|
|
35
|
+
// </div>
|
|
36
|
+
// );
|
|
37
|
+
// };
|
|
38
|
+
// const onLazyLoad = (event) => {
|
|
39
|
+
// console.log(event)
|
|
40
|
+
// if (items.length < totalRecords) {
|
|
41
|
+
// loadData(items.length, 100, searchTerm);
|
|
42
|
+
// }
|
|
43
|
+
// };
|
|
44
|
+
// const onSearch = (e) => {
|
|
45
|
+
// const term = e.target.value;
|
|
46
|
+
// setSearchTerm(term);
|
|
47
|
+
// loadData(0, 100, term);
|
|
48
|
+
// };
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { label: selectedItem ? selectedItem.name : "Select Item", onClick: (e) => op.current.toggle(e) }), (0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { options: items, filter: true, virtualScrollerOptions: { itemSize: 40 } })] }));
|
|
50
|
+
};
|
|
51
|
+
exports.default = VirtualScrollDropDown;
|
|
@@ -265,6 +265,8 @@ export interface ListBoxDropdownTypes {
|
|
|
265
265
|
emptyMessage?: any;
|
|
266
266
|
optionsMenuRef?: any;
|
|
267
267
|
dataLabel?: any;
|
|
268
|
+
onFilterValueChange?: (payload: any) => void;
|
|
269
|
+
virtualScrollerOptions?: any;
|
|
268
270
|
}
|
|
269
271
|
export interface DatePickerTypes {
|
|
270
272
|
value: any;
|