sccoreui 6.3.83 → 6.3.85
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 +2 -4
- package/dist/App.scss +14 -1
- package/dist/assets/variables.scss +108 -0
- package/dist/components/ag-charts/AGCharts.js +0 -1
- package/dist/components/form/form-fields/FieldLabel.js +1 -1
- package/dist/components/form/form-fields/form-fields.js +1 -1
- package/dist/components/formula-template/FormulaCoponent.js +16 -455
- package/dist/components/formula-template/Tagify.js +49 -31
- package/dist/components/list-box-dropdown/list-box-dropdown.js +3 -3
- package/dist/components/multi-select-dropdown/multi-select-dropdown.js +3 -1
- package/dist/types/components/types/type.d.ts +1 -0
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
require("./App.scss");
|
|
5
|
-
// import
|
|
6
|
-
// import DataTableClientSide from "./pages/aggrid/TestingWithAdminClientSide";
|
|
7
|
-
// import Home from "./pages/home";
|
|
5
|
+
// import FroalaTextEditor from "./components/froala-editor/FroalaEditor";
|
|
8
6
|
// import Home from "./pages/home";
|
|
9
7
|
const App = () => {
|
|
10
8
|
// const [selectedCountries, setSelectedCountries] = useState(null);
|
|
11
|
-
return (
|
|
9
|
+
return (0, jsx_runtime_1.jsx)("div", { children: " " });
|
|
12
10
|
};
|
|
13
11
|
exports.default = App;
|
package/dist/App.scss
CHANGED
|
@@ -1601,7 +1601,7 @@ code {
|
|
|
1601
1601
|
.Multi_select_dropdown_panel {
|
|
1602
1602
|
.p-multiselect-header {
|
|
1603
1603
|
display: block;
|
|
1604
|
-
padding:
|
|
1604
|
+
padding: 6px;
|
|
1605
1605
|
|
|
1606
1606
|
.p-checkbox,
|
|
1607
1607
|
.p-multiselect-close {
|
|
@@ -1955,6 +1955,19 @@ div:has(ul.date_filter) .p-datepicker-footer {
|
|
|
1955
1955
|
}
|
|
1956
1956
|
}
|
|
1957
1957
|
|
|
1958
|
+
.p-multiselect {
|
|
1959
|
+
.p-multiselect-header {
|
|
1960
|
+
.p-multiselect-close {
|
|
1961
|
+
display: none !important;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
.p-multiselect-items {
|
|
1965
|
+
.p-multiselect-item {
|
|
1966
|
+
border-radius: 4px !important;
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1958
1971
|
.panel_withIcon.p-multiselect-panel {
|
|
1959
1972
|
.p-multiselect-items {
|
|
1960
1973
|
.p-multiselect-item {
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Primary colors
|
|
2
|
+
$primary-colors: (
|
|
3
|
+
25: #f5f6fd,
|
|
4
|
+
50: #e2e5fa,
|
|
5
|
+
100: #ced4f6,
|
|
6
|
+
200: #a8b2ef,
|
|
7
|
+
300: #8190e8,
|
|
8
|
+
400: #243dc6,
|
|
9
|
+
500: #162578,
|
|
10
|
+
600: #132067,
|
|
11
|
+
700: #111c5b,
|
|
12
|
+
800: #0e184f,
|
|
13
|
+
900: #0c1442,
|
|
14
|
+
);
|
|
15
|
+
// secondary colors
|
|
16
|
+
$neutral-colors: (
|
|
17
|
+
25: #fcfcfd,
|
|
18
|
+
50: #f9fafb,
|
|
19
|
+
100: #f2f4f7,
|
|
20
|
+
200: #eaecf0,
|
|
21
|
+
300: #d0d5dd,
|
|
22
|
+
400: #98a2b3,
|
|
23
|
+
500: #667085,
|
|
24
|
+
600: #475467,
|
|
25
|
+
700: #344054,
|
|
26
|
+
800: #1d2939,
|
|
27
|
+
900: #101828,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// warning colors
|
|
31
|
+
$warning-colors: (
|
|
32
|
+
25: #fff4ef,
|
|
33
|
+
50: #ffe8ca,
|
|
34
|
+
100: #ffddb0,
|
|
35
|
+
200: #ffce8d,
|
|
36
|
+
300: #ffbf6a,
|
|
37
|
+
400: #ff9200,
|
|
38
|
+
500: #e58300,
|
|
39
|
+
600: #be6c00,
|
|
40
|
+
700: #9e5a00,
|
|
41
|
+
800: #7e4800,
|
|
42
|
+
900: #5f3600,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// error colors
|
|
46
|
+
$warning-colors: (
|
|
47
|
+
25: #fffbfa,
|
|
48
|
+
50: #fef3f2,
|
|
49
|
+
100: #fee4e2,
|
|
50
|
+
200: #fecdca,
|
|
51
|
+
300: #fda29b,
|
|
52
|
+
400: #f97066,
|
|
53
|
+
500: #e58300,
|
|
54
|
+
600: #be6c00,
|
|
55
|
+
700: #9e5a00,
|
|
56
|
+
800: #7e4800,
|
|
57
|
+
900: #5f3600,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
//
|
|
61
|
+
|
|
62
|
+
:root {
|
|
63
|
+
@each $key, $value in $secondary-colors {
|
|
64
|
+
--_secondary-#{$key}: #{$value};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@each $key, $value in $primary-colors {
|
|
68
|
+
--_primary-#{$key}: #{$value};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Secondary Utilities
|
|
73
|
+
@each $key, $value in $secondary-colors {
|
|
74
|
+
.bg-secondary-#{$key} {
|
|
75
|
+
background-color: var(--_secondary-#{$key}) !important;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.text-secondary-#{$key} {
|
|
79
|
+
color: var(--_secondary-#{$key}) !important;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.hover\:bg-secondary-#{$key}:hover {
|
|
83
|
+
background-color: var(--_secondary-#{$key}) !important;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.hover\:text-secondary-#{$key}:hover {
|
|
87
|
+
color: var(--_secondary-#{$key}) !important;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Primary Utilities
|
|
92
|
+
@each $key, $value in $primary-colors {
|
|
93
|
+
.bg-primary-#{$key} {
|
|
94
|
+
background-color: var(--_primary-#{$key}) !important;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.text-primary-#{$key} {
|
|
98
|
+
color: var(--_primary-#{$key}) !important;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.hover\:bg-primary-#{$key}:hover {
|
|
102
|
+
background-color: var(--_primary-#{$key}) !important;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.hover\:text-primary-#{$key}:hover {
|
|
106
|
+
color: var(--_primary-#{$key}) !important;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -13,7 +13,6 @@ const AGCharts = ({ options }) => {
|
|
|
13
13
|
const chartRef = (0, react_1.useRef)(null);
|
|
14
14
|
const chartInstanceRef = (0, react_1.useRef)(null);
|
|
15
15
|
(0, react_1.useEffect)(() => {
|
|
16
|
-
debugger;
|
|
17
16
|
if (!chartRef.current)
|
|
18
17
|
return undefined;
|
|
19
18
|
const chartOptions = Object.assign(Object.assign({}, options), { container: chartRef.current });
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const svg_1 = require("../../../assets/svg/svg");
|
|
5
5
|
const FieldLabel = (props) => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center", style: { gap: "2px" } }, { children: [(props === null || props === void 0 ? void 0 : props.isRequired) && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (!(props === null || props === void 0 ? void 0 : props.error) && (props === null || props === void 0 ? void 0 : props.touched)) ||
|
|
7
7
|
((props === null || props === void 0 ? void 0 : props.value) && !(props === null || props === void 0 ? void 0 : props.touched)) ? ((0, jsx_runtime_1.jsx)(svg_1.LightningGreen, {})) : (props === null || props === void 0 ? void 0 : props.error) && (props === null || props === void 0 ? void 0 : props.touched) ? ((0, jsx_runtime_1.jsx)(svg_1.LightningRed, {})) : ((0, jsx_runtime_1.jsx)(svg_1.Lightning, {})) })), (0, jsx_runtime_1.jsx)("label", Object.assign({ htmlFor: props === null || props === void 0 ? void 0 : props.label, className: "mb-1" }, { children: props === null || props === void 0 ? void 0 : props.label }))] })) }));
|
|
8
8
|
};
|
|
9
9
|
exports.default = FieldLabel;
|
|
@@ -71,7 +71,7 @@ const DropDownField = (props) => {
|
|
|
71
71
|
onFocus && onFocus();
|
|
72
72
|
}, panelClassName: panelClassName, showClear: showClear, panelStyle: panelStyle || "", filter: filter || false, disabled: disabled, placeholder: placeholder }, field, {
|
|
73
73
|
// onChange={(e: any) => onChange && onChange(e)}
|
|
74
|
-
options: options, itemTemplate: customFieldsTemplate, valueTemplate: customSelectedTemplate, optionDisabled: optionDisabled, optionLabel: optionLabel, className: ` ${errors[name] && touched[name] ? "p-invalid" : ""} ${length === "full" ? "full_form_field" : "form_field"} ${className}`, id: name, filterPlaceholder: filterPlaceholder, emptyMessage: emptyMessage, emptyFilterMessage: emptyFilterMessage }))) })), errors[name] && touched[name] ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: errors[name] }) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u00A0" }) })))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex flex-column gap-1" }, { children: [(0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "16px", className: "w-5rem" }), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "40px" })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u00A0" }) }))] })) })));
|
|
74
|
+
options: options, itemTemplate: customFieldsTemplate, valueTemplate: customSelectedTemplate, optionDisabled: optionDisabled, optionLabel: optionLabel, className: ` ${errors[name] && touched[name] ? "p-invalid" : ""} ${length === "full" ? "full_form_field" : "form_field"} ${className}`, id: name, filterPlaceholder: filterPlaceholder ? filterPlaceholder : "Search", emptyMessage: emptyMessage ? emptyMessage : "No Data Found", emptyFilterMessage: emptyFilterMessage ? emptyFilterMessage : "No Results Found" }))) })), errors[name] && touched[name] ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: errors[name] }) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u00A0" }) })))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex flex-column gap-1" }, { children: [(0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "16px", className: "w-5rem" }), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "40px" })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u00A0" }) }))] })) })));
|
|
75
75
|
};
|
|
76
76
|
const MultiSelectField = (props) => {
|
|
77
77
|
const { errors, touched, name, length, label, placeholder, options, optional, customFieldsTemplate, optionLabel, optionDisabled, className, validate, disabled, isLoading, filter, isRequired = false, value, } = props;
|
|
@@ -4,29 +4,15 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const dropdown_1 = require("primereact/dropdown");
|
|
7
|
-
const inputtext_1 = require("primereact/inputtext");
|
|
8
7
|
const inputnumber_1 = require("primereact/inputnumber");
|
|
9
8
|
const svg_component_1 = tslib_1.__importDefault(require("../../directives/svg-component"));
|
|
10
9
|
const menu_1 = require("primereact/menu");
|
|
10
|
+
// import { InputText } from "primereact/inputtext";
|
|
11
|
+
const Tagify_1 = tslib_1.__importDefault(require("./Tagify"));
|
|
11
12
|
const FormulaComponent = (props) => {
|
|
12
13
|
const priceConditioRef = (0, react_1.useRef)(null);
|
|
13
|
-
const [isValid, setIsValid] = (0, react_1.useState)(false);
|
|
14
|
-
const [selectedItem, setSelectedItem] = (0, react_1.useState)();
|
|
15
14
|
const [fieldOptions, setFieldOptions] = (0, react_1.useState)(props === null || props === void 0 ? void 0 : props.fieldOptions);
|
|
16
|
-
const contentEditableDivRef = (0, react_1.useRef)(null);
|
|
17
|
-
const [content, setContent] = (0, react_1.useState)(`<span class='formulaSpanElm'></span>`);
|
|
18
|
-
const [contentEditableCursorIndex, setContentEditableCursorIndex] = (0, react_1.useState)(null);
|
|
19
15
|
const [conditionValue, setConditionValue] = (0, react_1.useState)((props === null || props === void 0 ? void 0 : props.conditionValue) ? props === null || props === void 0 ? void 0 : props.conditionValue : 1);
|
|
20
|
-
const [formulaPlaceholder, setFormulaPlaceholder] = (0, react_1.useState)(true);
|
|
21
|
-
const operators = {
|
|
22
|
-
addition: "+",
|
|
23
|
-
subtraction: "-",
|
|
24
|
-
multiplication: "*",
|
|
25
|
-
division: "/",
|
|
26
|
-
percentile: "%",
|
|
27
|
-
openBracket: "(",
|
|
28
|
-
closeBracket: ")",
|
|
29
|
-
};
|
|
30
16
|
(0, react_1.useEffect)(() => {
|
|
31
17
|
setConditionValue(props.conditionValue);
|
|
32
18
|
}, [props.conditionValue]);
|
|
@@ -34,330 +20,6 @@ const FormulaComponent = (props) => {
|
|
|
34
20
|
if (props === null || props === void 0 ? void 0 : props.fieldOptions)
|
|
35
21
|
setFieldOptions(props === null || props === void 0 ? void 0 : props.fieldOptions);
|
|
36
22
|
}, [props === null || props === void 0 ? void 0 : props.fieldOptions]);
|
|
37
|
-
const onSelecteItem = (item) => {
|
|
38
|
-
var _a, _b, _c, _d, _e;
|
|
39
|
-
if (selectedItem) {
|
|
40
|
-
if (selectedItem.find((id) => id === item.id))
|
|
41
|
-
setSelectedItem(selectedItem.filter((id) => id !== item.id));
|
|
42
|
-
else
|
|
43
|
-
setSelectedItem([item.id, ...selectedItem]);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
setSelectedItem([item.id]);
|
|
47
|
-
}
|
|
48
|
-
let chipElm = `<div class="formulaChipElm max-w-8rem w-max chip-h-25 overflow-hidden text-overflow-ellipsis white-space-nowrap bg-primary-25 border-primary-200 border-1 text-gray-600 border-round-sm p-1 ${props.formulaChipClassName}" contentEditable=${false} itemid="${item === null || item === void 0 ? void 0 : item.id}" title=${item === null || item === void 0 ? void 0 : item.name}>${item === null || item === void 0 ? void 0 : item.name}</div>`;
|
|
49
|
-
let currentText = contentEditableDivRef.current.innerHTML ===
|
|
50
|
-
'<span class="formulaSpanElm"></span>'
|
|
51
|
-
? '<span class="formulaSpanElm"></span>'
|
|
52
|
-
: contentEditableDivRef.current.innerHTML.replaceAll("<br>", "");
|
|
53
|
-
const index = contentEditableDivRef.current.innerHTML.indexOf((_a = document.querySelector(".formulaSpanElm.activeSpanElm")) === null || _a === void 0 ? void 0 : _a.outerHTML);
|
|
54
|
-
if (index === -1 &&
|
|
55
|
-
(contentEditableCursorIndex === null || contentEditableCursorIndex === 0)) {
|
|
56
|
-
let str = currentText +
|
|
57
|
-
chipElm +
|
|
58
|
-
`<span class='formulaSpanElm activeSpanElm'></span>`;
|
|
59
|
-
setContent(str);
|
|
60
|
-
// setContentEditableCursorIndex(str.length)
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
if (((_b = document.querySelector(".formulaSpanElm.activeSpanElm")) === null || _b === void 0 ? void 0 : _b.innerHTML.length) === contentEditableCursorIndex) {
|
|
64
|
-
let sliptText = currentText.split(document.querySelector(".formulaSpanElm.activeSpanElm").outerHTML);
|
|
65
|
-
let str = sliptText[0] +
|
|
66
|
-
document.querySelector(".formulaSpanElm.activeSpanElm").outerHTML +
|
|
67
|
-
chipElm +
|
|
68
|
-
`<span class='formulaSpanElm'></span>` +
|
|
69
|
-
sliptText[1];
|
|
70
|
-
setContent(str);
|
|
71
|
-
// setContentEditableCursorIndex(str.length)
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
// const index = contentEditableDivRef.current.innerHTML.indexOf(document.querySelector('.formulaSpanElm.activeSpanElm')?.outerHTML)
|
|
75
|
-
const firstContent = contentEditableDivRef.current.innerHTML.slice(0, index === -1 ? 0 : index) +
|
|
76
|
-
`<span class="formulaSpanElm activeSpanElm">${(_c = document
|
|
77
|
-
.querySelector(".formulaSpanElm.activeSpanElm")) === null || _c === void 0 ? void 0 : _c.innerHTML.substring(0, contentEditableCursorIndex)}</span>`;
|
|
78
|
-
const secondContent = `<span class="formulaSpanElm">${(_d = document
|
|
79
|
-
.querySelector(".formulaSpanElm.activeSpanElm")) === null || _d === void 0 ? void 0 : _d.innerHTML.substring(contentEditableCursorIndex)}</span>` +
|
|
80
|
-
contentEditableDivRef.current.innerHTML
|
|
81
|
-
.slice(index)
|
|
82
|
-
.split((_e = document.querySelector(".formulaSpanElm.activeSpanElm")) === null || _e === void 0 ? void 0 : _e.outerHTML)[1];
|
|
83
|
-
const str = firstContent + chipElm + secondContent;
|
|
84
|
-
setContent(str);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
setTimeout(() => {
|
|
88
|
-
onChangeCondition();
|
|
89
|
-
addEventListenerForSpan();
|
|
90
|
-
}, 500);
|
|
91
|
-
};
|
|
92
|
-
const onChangeCondition = () => {
|
|
93
|
-
// Here we are validating a formula for its end result.
|
|
94
|
-
// The end result should be a number, whether negative or positive.
|
|
95
|
-
if ((contentEditableDivRef === null || contentEditableDivRef === void 0 ? void 0 : contentEditableDivRef.current) === null) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
let elements = contentEditableDivRef === null || contentEditableDivRef === void 0 ? void 0 : contentEditableDivRef.current.children;
|
|
99
|
-
let formulaText = "";
|
|
100
|
-
let spanElms = Array.from(document.querySelectorAll(".formulaSpanElm"));
|
|
101
|
-
if (spanElms.length > 1) {
|
|
102
|
-
let spanInnerText = spanElms === null || spanElms === void 0 ? void 0 : spanElms.map((x) => x === null || x === void 0 ? void 0 : x.innerHTML);
|
|
103
|
-
// remove first and last span
|
|
104
|
-
const specialCharacters = /[/*\-+%(]/;
|
|
105
|
-
if (spanInnerText[0] !== "" &&
|
|
106
|
-
!specialCharacters.test(spanInnerText[0].charAt(spanInnerText[0].length - 1))) {
|
|
107
|
-
setIsValid(false);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
else if (specialCharacters.test(spanInnerText[0].charAt(spanInnerText[0].length - 1)) ||
|
|
111
|
-
spanInnerText[0] === "") {
|
|
112
|
-
spanInnerText.shift();
|
|
113
|
-
}
|
|
114
|
-
if (spanInnerText[spanInnerText.length - 1] === "" ||
|
|
115
|
-
specialCharacters.test(spanInnerText[spanInnerText.length - 1].charAt(0))) {
|
|
116
|
-
spanInnerText.pop();
|
|
117
|
-
}
|
|
118
|
-
// spanInnerText = spanInnerText.slice(0, 1)
|
|
119
|
-
// spanInnerText = spanInnerText.slice(0, spanElms.length - 1)
|
|
120
|
-
// const specialCharacters = /[/*\-+%(]/;
|
|
121
|
-
let findText = spanInnerText.find((x) => !specialCharacters.test(x.charAt(0)) ||
|
|
122
|
-
!specialCharacters.test(x.charAt(x.length - 1)));
|
|
123
|
-
if (findText)
|
|
124
|
-
findText = findText.replaceAll("<br>", "");
|
|
125
|
-
if (findText) {
|
|
126
|
-
setIsValid(false);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
let finalSanInnerText = spanInnerText.filter((x) => x === "");
|
|
131
|
-
if (finalSanInnerText.length !== 0) {
|
|
132
|
-
setIsValid(false);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
for (let i = 0; i < elements.length; i++) {
|
|
138
|
-
const element = elements[i];
|
|
139
|
-
if (element.classList.contains("formulaChipElm")) {
|
|
140
|
-
let id = element.getAttribute("itemid");
|
|
141
|
-
let findObj = fieldOptions.find((x) => x.id === id);
|
|
142
|
-
formulaText = formulaText + (findObj === null || findObj === void 0 ? void 0 : findObj.price);
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
let spanText = element.innerHTML ? element.innerHTML : "";
|
|
146
|
-
formulaText = formulaText + spanText;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
formulaText = formulaText.replaceAll("<br>", "");
|
|
150
|
-
// If the formula ends with any operator without ending with numbers, then the formula is not correct
|
|
151
|
-
const regex = /^(?!0+$)(?=.*[+\-*/%])(?!.*(?:\s|\+\+|--|%%|\*\*|\+\-|\+\*|\+\%|\-\-|\-\*|\-\%|\*\-|\*\+|\*\%|\%\+|\%\-|\%\/|\%\*|\/\+|\/\-|\/\*|\/\%))(?:(?:\([+\-*/%]*\)|[-+*/%])*)$/;
|
|
152
|
-
if (!regex.test(formulaText) && formulaText !== "0" && formulaText !== "") {
|
|
153
|
-
try {
|
|
154
|
-
// For example, if textContent (formula) value is like "<chip> + <chip> - 456 + 778 * 464 / 645 % 4736"
|
|
155
|
-
// That will be converted here like "0 + 0 - 0 + 0 * 0 / 0 % 0". If the total equals 0 or -0, it means the formula is correct.
|
|
156
|
-
// The eval() JavaScript method will give us a result from the string.
|
|
157
|
-
// If the eval() result is NOT A NUMBER it will go to the error block.
|
|
158
|
-
// const str = formula.replaceAll(' ', '')
|
|
159
|
-
let value = eval(formulaText);
|
|
160
|
-
console.log(value);
|
|
161
|
-
setIsValid(true);
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
setIsValid(false);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
setIsValid(false);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
function getCursorPosition(contentEditableElm) {
|
|
172
|
-
var _a;
|
|
173
|
-
const selection = window.getSelection();
|
|
174
|
-
if (selection.anchorNode) {
|
|
175
|
-
const range = selection.getRangeAt(0);
|
|
176
|
-
const clonedRange = range.cloneRange();
|
|
177
|
-
clonedRange.selectNodeContents(contentEditableElm);
|
|
178
|
-
clonedRange.setEnd(range.endContainer, range.endOffset);
|
|
179
|
-
setContentEditableCursorIndex((_a = clonedRange === null || clonedRange === void 0 ? void 0 : clonedRange.toString()) === null || _a === void 0 ? void 0 : _a.length);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
const onConditionKeyDown = (event) => {
|
|
183
|
-
const content = event.target.textContent.trim();
|
|
184
|
-
const lastChar = content.charAt(content.length - 1);
|
|
185
|
-
const operators = ["%", "*", "-", "+", "/"];
|
|
186
|
-
let selection = window.getSelection();
|
|
187
|
-
let actElm = document.querySelector(".formulaSpanElm.activeSpanElm");
|
|
188
|
-
if (actElm && actElm.innerHTML.indexOf("<br>") !== -1)
|
|
189
|
-
actElm.innerHTML = actElm.textContent;
|
|
190
|
-
if (event.keyCode === 37 ||
|
|
191
|
-
event.keyCode === 39 ||
|
|
192
|
-
event.keyCode === 38 ||
|
|
193
|
-
event.keyCode === 40) {
|
|
194
|
-
let actElm = document.querySelector(".formulaSpanElm.activeSpanElm");
|
|
195
|
-
let spanElms = Array.from(document.querySelectorAll(".formulaSpanElm"));
|
|
196
|
-
const range = document.createRange();
|
|
197
|
-
// range.setStart(selection.focusNode, selection.focusOffset);
|
|
198
|
-
let activeIndex;
|
|
199
|
-
spanElms.filter((elmt, index) => {
|
|
200
|
-
if (elmt.classList.contains("activeSpanElm")) {
|
|
201
|
-
activeIndex = index;
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
if (actElm) {
|
|
205
|
-
if (event.keyCode === 37 /* ArrowLeft */ ||
|
|
206
|
-
event.keyCode === 38 /* ArrowUp */) {
|
|
207
|
-
if (selection.getRangeAt(0).endOffset !== 0 &&
|
|
208
|
-
actElm.innerText.length !== 0) {
|
|
209
|
-
getCursorPosition(actElm);
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (activeIndex !== 0) {
|
|
213
|
-
// activeIndex = activeIndex + 1
|
|
214
|
-
activeIndex = activeIndex - 1;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
else if (event.keyCode === 39 /* ArrowRight */ ||
|
|
218
|
-
event.keyCode === 40 /* ArrowDown */) {
|
|
219
|
-
//&& selection.focusOffset === selection.focusNode.textContent.length
|
|
220
|
-
if (actElm.innerText.length === selection.getRangeAt(0).endOffset &&
|
|
221
|
-
activeIndex < spanElms.length - 1) {
|
|
222
|
-
activeIndex = activeIndex + 1;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (activeIndex !== -1 && spanElms.indexOf(actElm) !== activeIndex)
|
|
226
|
-
actElm.classList.remove("activeSpanElm");
|
|
227
|
-
}
|
|
228
|
-
if (activeIndex !== null &&
|
|
229
|
-
activeIndex !== -1 &&
|
|
230
|
-
spanElms.length > activeIndex &&
|
|
231
|
-
spanElms.indexOf(actElm) !== activeIndex) {
|
|
232
|
-
if (event.keyCode === 37 /* ArrowLeft */ ||
|
|
233
|
-
event.keyCode === 38 /* ArrowUp */)
|
|
234
|
-
range.selectNodeContents(spanElms[activeIndex]);
|
|
235
|
-
else if (event.keyCode === 39 /* ArrowRight */ || event.keyCode === 40)
|
|
236
|
-
range.setStart(spanElms[activeIndex], 0);
|
|
237
|
-
if (!range.startContainer.parentElement.getAttribute("id")) {
|
|
238
|
-
range.startContainer.parentElement.classList.add("activeSpanElm");
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
let eml = range.startContainer;
|
|
242
|
-
eml === null || eml === void 0 ? void 0 : eml.classList.add("activeSpanElm");
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
let CurrentActElm = document.querySelector(".formulaSpanElm.activeSpanElm");
|
|
246
|
-
if (CurrentActElm)
|
|
247
|
-
getCursorPosition(CurrentActElm);
|
|
248
|
-
}
|
|
249
|
-
// Allow numbers, *, -, +, %, /, (, ), and single space
|
|
250
|
-
if (!((event.keyCode >= "0" && event.keyCode <= "9") ||
|
|
251
|
-
event.keyCode === "*" ||
|
|
252
|
-
event.keyCode === "-" ||
|
|
253
|
-
event.keyCode === "+" ||
|
|
254
|
-
event.keyCode === "%" ||
|
|
255
|
-
event.keyCode === "/" ||
|
|
256
|
-
event.keyCode === "(" ||
|
|
257
|
-
event.keyCode === ")" ||
|
|
258
|
-
(event.keyCode !== " " &&
|
|
259
|
-
event.target.textContent.trim().slice(-1) === " "))) {
|
|
260
|
-
event.preventDefault();
|
|
261
|
-
}
|
|
262
|
-
// Prevent new lines (enter keypress)
|
|
263
|
-
if (event.keyCode === "Enter") {
|
|
264
|
-
event.preventDefault();
|
|
265
|
-
}
|
|
266
|
-
getCursorPosition(event.target);
|
|
267
|
-
// Prevent entering operators continuously after each other
|
|
268
|
-
if (operators.includes(event.keyCode) &&
|
|
269
|
-
operators.includes(lastChar) &&
|
|
270
|
-
operators.includes(content[contentEditableCursorIndex - 2])) {
|
|
271
|
-
event.preventDefault();
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
const onFilter = (e) => {
|
|
275
|
-
if (e.target.value) {
|
|
276
|
-
let opts = props === null || props === void 0 ? void 0 : props.fieldOptions.filter((x) => {
|
|
277
|
-
var _a, _b, _c, _d;
|
|
278
|
-
return (_b = (_a = x === null || x === void 0 ? void 0 : x[props === null || props === void 0 ? void 0 : props.fieldFilterOption]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes((_d = (_c = e === null || e === void 0 ? void 0 : e.target) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.toLowerCase());
|
|
279
|
-
});
|
|
280
|
-
setFieldOptions(opts);
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
setFieldOptions(props === null || props === void 0 ? void 0 : props.fieldOptions);
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
const onClickContentEditable = (e) => {
|
|
287
|
-
var _a, _b, _c;
|
|
288
|
-
let spanElms = Array.from(document.querySelectorAll(".formulaSpanElm"));
|
|
289
|
-
if (!e.target.classList.contains("formulaSpanElm") &&
|
|
290
|
-
spanElms.length !== 0) {
|
|
291
|
-
// let contentEditableElement = e.target
|
|
292
|
-
// contentEditableElement.focus(); // Set focus to the content editable element
|
|
293
|
-
const range = document.createRange(); // Create a new range
|
|
294
|
-
range.selectNodeContents(spanElms[spanElms.length - 1]); // Select the entire content of the element
|
|
295
|
-
range.collapse(false); // Collapse the range to the end
|
|
296
|
-
const selection = window.getSelection(); // Get the selection object
|
|
297
|
-
selection.removeAllRanges(); // Remove any existing ranges from the selection
|
|
298
|
-
selection.addRange(range);
|
|
299
|
-
(_a = document
|
|
300
|
-
.querySelector(".activeSpanElm")) === null || _a === void 0 ? void 0 : _a.classList.remove("activeSpanElm");
|
|
301
|
-
let elms = document.querySelectorAll(".formulaSpanElm");
|
|
302
|
-
(_c = (_b = elms[elms.length - 1]) === null || _b === void 0 ? void 0 : _b.classList) === null || _c === void 0 ? void 0 : _c.add("activeSpanElm");
|
|
303
|
-
e.preventDefault();
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
console.log(e);
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
const onAddOperator = (event, operator) => {
|
|
310
|
-
let elm = document.querySelector(".activeSpanElm");
|
|
311
|
-
console.log(event);
|
|
312
|
-
// const operators = ['%', '*', '-', '+', '/'];
|
|
313
|
-
// const lastChar = elm.innerHTML?.charAt(elm.innerHTML?.length - 1);
|
|
314
|
-
// // Prevent entering operators coonChangeCondition(str);ntinuously after each other
|
|
315
|
-
// if (lastChar && operators.includes(lastChar) && operators.includes(operator)) {
|
|
316
|
-
// event.preventDefault();
|
|
317
|
-
// return;
|
|
318
|
-
// }
|
|
319
|
-
if (contentEditableDivRef.current.innerHTML !==
|
|
320
|
-
`<span class='formulaSpanElm'></span>`) {
|
|
321
|
-
elm.innerHTML = elm.innerHTML + operator;
|
|
322
|
-
}
|
|
323
|
-
onChangeCondition();
|
|
324
|
-
};
|
|
325
|
-
const onSave = (event) => {
|
|
326
|
-
let elements = contentEditableDivRef.current.children;
|
|
327
|
-
let formula = "";
|
|
328
|
-
for (let i = 0; i < elements.length; i++) {
|
|
329
|
-
const element = elements[i];
|
|
330
|
-
if (element.classList.contains("formulaChipElm"))
|
|
331
|
-
formula = formula + element.getAttribute("itemid");
|
|
332
|
-
else
|
|
333
|
-
formula = formula + element.innerHTML;
|
|
334
|
-
}
|
|
335
|
-
// setContent(contentEditableDivRef.current.innerHTML)
|
|
336
|
-
priceConditioRef.current.toggle(event);
|
|
337
|
-
formula = formula.replaceAll("<br>", "");
|
|
338
|
-
props.onSaveFormula(formula);
|
|
339
|
-
};
|
|
340
|
-
const onKeyDownHandler = (event) => {
|
|
341
|
-
var _a;
|
|
342
|
-
if (event.keyCode === 8 || event.keyCode === 46) {
|
|
343
|
-
// let elm = document.querySelector('.activeSpanElm') as HTMLElement
|
|
344
|
-
let spanElms = Array.from(document.querySelectorAll(".formulaSpanElm"));
|
|
345
|
-
let activeIndex = spanElms.findIndex((x) => x.classList.contains("activeSpanElm"));
|
|
346
|
-
if (activeIndex && ((_a = spanElms[activeIndex]) === null || _a === void 0 ? void 0 : _a.innerHTML) === "") {
|
|
347
|
-
spanElms[activeIndex].previousElementSibling.remove();
|
|
348
|
-
let index = event.keyCode === 8 ? activeIndex - 1 : activeIndex;
|
|
349
|
-
spanElms[index].classList.add("activeSpanElm");
|
|
350
|
-
const range = document.createRange(); // Create a new range
|
|
351
|
-
spanElms[activeIndex].remove();
|
|
352
|
-
range.selectNodeContents(spanElms[index]); // Select the entire content of the element
|
|
353
|
-
range.collapse(false); // Collapse the range to the end
|
|
354
|
-
const selection = window.getSelection(); // Get the selection object
|
|
355
|
-
selection.removeAllRanges(); // Remove any existing ranges from the selection
|
|
356
|
-
selection.addRange(range);
|
|
357
|
-
event.preventDefault();
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
23
|
const menuContent = [
|
|
362
24
|
{
|
|
363
25
|
template: () => {
|
|
@@ -365,120 +27,10 @@ const FormulaComponent = (props) => {
|
|
|
365
27
|
? props === null || props === void 0 ? void 0 : props.headerLabel
|
|
366
28
|
: "Configure Value" })), (0, jsx_runtime_1.jsx)("span", { children: (props === null || props === void 0 ? void 0 : props.headerDescription)
|
|
367
29
|
? props === null || props === void 0 ? void 0 : props.headerDescription
|
|
368
|
-
: "Select price attribute and perform calculater." })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "help-circle", size: 16 }) }))] }))), (0, jsx_runtime_1.
|
|
369
|
-
// <div className="px-4 py-2 border-top-1 border-gray-200">
|
|
370
|
-
// <div className="relative flex aling-items-center w-full">
|
|
371
|
-
// <div className="h-full flex align-items-cente justify-content-center w-2rem absolute left-0">
|
|
372
|
-
// <SvgComponent icon="search-md" />
|
|
373
|
-
// </div>
|
|
374
|
-
// <InputText onInput={(e: any) => onFilter(e)} className="pl-8 w-full" placeholder={props.fieldOptionFilterPlaceholder} />
|
|
375
|
-
// </div>
|
|
376
|
-
// </div>
|
|
377
|
-
(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-input-icon-left p-input-icon-right w-full" }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: "p-input-prefix" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "search-md", size: 18 }) })), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "p-input-suffix" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 18 }) })), (0, jsx_runtime_1.jsx)(inputtext_1.InputText, { onInput: (e) => onFilter(e), className: "pl-8 w-full", placeholder: props.fieldOptionFilterPlaceholder })] })))] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: `condition_itemibute_list_sect overflow-auto flex flex-column row-gap-2 px-4 py-2` }, { children: fieldOptions.length > 0 ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "grid gap-2 p-2 py-4" }, { children: fieldOptions === null || fieldOptions === void 0 ? void 0 : fieldOptions.map((item, index) => {
|
|
378
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `max-w-8rem overflow-hidden text-overflow-ellipsis white-space-nowrap border-1 px-2 chip-h-25 border-gray-300 text-gray-600 cursor-pointer item_chip border-round-sm hover:bg-primary-25 hover:border-primary-200 ${props === null || props === void 0 ? void 0 : props.fieldOptionClassName}`, onClick: () => onSelecteItem(item), title: item === null || item === void 0 ? void 0 : item.name }, { children: item === null || item === void 0 ? void 0 : item.name }), "formula__option__" + index));
|
|
379
|
-
}) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-gray-700 fobt-bold text-lg text-center" }, { children: (props === null || props === void 0 ? void 0 : props.fieldFilterEmptyMessage)
|
|
380
|
-
? props === null || props === void 0 ? void 0 : props.fieldFilterEmptyMessage
|
|
381
|
-
: "No Results Found!" }))) }))] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "w-6" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "h-2rem px-4 border-bottom-1 flex column-gap-2 align-items-center border-gray-200" }, { children: props.formulaOperators.map((operator, index) => {
|
|
382
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "condition_operator flex align-items-center justify-content-center text-lg w-2 sc_icon_hover cursor-pointer hover:bg-primary-50 border-round-sm", onClick: (e) => onAddOperator(e, operators[operator]) }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-lg font-bold" }, { children: operators[operator] })) }), "formula__operator_" + index), (0, jsx_runtime_1.jsx)("span", { className: "operator_divider" })] }));
|
|
383
|
-
}) })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "relative h-17rem w-full" }, { children: [(0, jsx_runtime_1.jsx)("div", { onClick: (e) => onClickContentEditable(e), ref: contentEditableDivRef, dangerouslySetInnerHTML: { __html: content }, onKeyDown: (e) => onKeyDownHandler(e), onKeyUp: (e) => onConditionKeyDown(e), onInput: () => onChangeCondition(), onFocus: () => setFormulaPlaceholder(false), className: `condition_configure px-4 py-3 h-17rem overflow-auto w-full absolute top-0 left-0 z-5`, id: "condition_configure_elm", contentEditable: true }), content === `<span class='formulaSpanElm'></span>` &&
|
|
384
|
-
formulaPlaceholder && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: " px-4 py-2 top-0 text-lg left-0 absolute z-3" }, { children: (props === null || props === void 0 ? void 0 : props.formulaElemectPlaceholder)
|
|
385
|
-
? props === null || props === void 0 ? void 0 : props.formulaElemectPlaceholder
|
|
386
|
-
: "Please Enter Formula" })))] }))] }))] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: `condition_footer_section flex align-items-center p-2 ${props === null || props === void 0 ? void 0 : props.footerTemplateClassName}` }, { children: (props === null || props === void 0 ? void 0 : props.footerTemplate) ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props === null || props === void 0 ? void 0 : props.footerTemplate })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "w-6 px-4 py-2 hover:bg-primary-50 cursor-pointer sc_icon_hover", onClick: (e) => {
|
|
387
|
-
setContent(props === null || props === void 0 ? void 0 : props.formulaValue);
|
|
388
|
-
priceConditioRef.current.toggle(e);
|
|
389
|
-
} }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 20 }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ onClick: (e) => onSave(e), className: `w-6 px-4 py-2 hover:bg-primary-50 cursor-pointer sc_icon_hover ${!isValid && "p-disabled"}` }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "check", size: 20 }) }))] })) }))] }), "formula__dev"));
|
|
30
|
+
: "Select price attribute and perform calculater." })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "help-circle", size: 16 }) }))] }))), (0, jsx_runtime_1.jsx)(Tagify_1.default, { formulaOperators: props.formulaOperators, fieldOptions: fieldOptions })] }), "formula__dev"));
|
|
390
31
|
},
|
|
391
32
|
},
|
|
392
33
|
];
|
|
393
|
-
const addEventListenerForSpan = () => {
|
|
394
|
-
var _a;
|
|
395
|
-
// Select all div elements with the specified class name
|
|
396
|
-
const spanElements = document.querySelectorAll(".formulaSpanElm");
|
|
397
|
-
(_a = document.querySelector(".activeSpanElm")) === null || _a === void 0 ? void 0 : _a.classList.remove("activeSpanElm");
|
|
398
|
-
// Loop through each div element
|
|
399
|
-
spanElements.forEach((spanElement) => {
|
|
400
|
-
// Add an event listener for the 'click' event to each div element
|
|
401
|
-
spanElement.addEventListener("click", function (e) {
|
|
402
|
-
var _a;
|
|
403
|
-
(_a = document
|
|
404
|
-
.querySelector(".activeSpanElm")) === null || _a === void 0 ? void 0 : _a.classList.remove("activeSpanElm");
|
|
405
|
-
e.target.classList.add("activeSpanElm");
|
|
406
|
-
getCursorPosition(e.target);
|
|
407
|
-
// Your event handler code here
|
|
408
|
-
});
|
|
409
|
-
});
|
|
410
|
-
if (spanElements.length !== 0) {
|
|
411
|
-
spanElements[spanElements.length - 1].classList.add("activeSpanElm");
|
|
412
|
-
getCursorPosition(spanElements[spanElements.length - 1]);
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
const onShowMenu = () => {
|
|
416
|
-
if (props === null || props === void 0 ? void 0 : props.formulaValue) {
|
|
417
|
-
let formulatText = "";
|
|
418
|
-
const pattern = /(?:[a-f0-9]{24}|msrp|map|costprice)/g;
|
|
419
|
-
// const ids = props?.formulaValue.match(pattern);
|
|
420
|
-
// console.log(ids)
|
|
421
|
-
const splitPattern = /(?=[+\-*/%])/g;
|
|
422
|
-
// Split the text using the splitPattern
|
|
423
|
-
const splitText = props === null || props === void 0 ? void 0 : props.formulaValue.split(splitPattern);
|
|
424
|
-
for (let i = 0; i < splitText.length; i++) {
|
|
425
|
-
// let chipElm: string = '';
|
|
426
|
-
// let text = splitText[i];
|
|
427
|
-
const id = splitText[i].match(pattern);
|
|
428
|
-
let chipElm = "";
|
|
429
|
-
if (id) {
|
|
430
|
-
let item = fieldOptions.find((x) => x.id === id[0]);
|
|
431
|
-
chipElm = `<div class="formulaChipElm max-w-8rem w-max overflow-hidden text-overflow-ellipsis white-space-nowrap bg-primary-25 border-1 border-primary-200 text-gray-600 border-round-sm px-2 py-1" contentEditable=${false} itemid="${item === null || item === void 0 ? void 0 : item.id}" title="${item === null || item === void 0 ? void 0 : item.name}">${item === null || item === void 0 ? void 0 : item.name}</div>`;
|
|
432
|
-
}
|
|
433
|
-
// chipElm = text.replace(text, t)
|
|
434
|
-
const placeholderText = splitText[i].replace(pattern, "|");
|
|
435
|
-
const textParts = placeholderText
|
|
436
|
-
.split("|")
|
|
437
|
-
.filter((part) => part !== "");
|
|
438
|
-
if (textParts.length > 0) {
|
|
439
|
-
for (let z = 0; z < textParts.length; z++) {
|
|
440
|
-
if (z === 0 && splitText.length - 1 === i && chipElm)
|
|
441
|
-
formulatText = textParts[z]
|
|
442
|
-
? formulatText +
|
|
443
|
-
`<span class='formulaSpanElm'>${textParts[z]}</span>` +
|
|
444
|
-
chipElm +
|
|
445
|
-
`<span class='formulaSpanElm'></span>`
|
|
446
|
-
: `<span class='formulaSpanElm'></span>`;
|
|
447
|
-
else if (z === 0 && chipElm && id) {
|
|
448
|
-
// let lastSpanIndex = formulatText.lastIndexOf('</span>');
|
|
449
|
-
formulatText = textParts[z]
|
|
450
|
-
? formulatText +
|
|
451
|
-
`<span class='formulaSpanElm'>${textParts[z]}</span>` +
|
|
452
|
-
chipElm
|
|
453
|
-
: `<span class='formulaSpanElm'></span>`;
|
|
454
|
-
}
|
|
455
|
-
else
|
|
456
|
-
formulatText = textParts[z]
|
|
457
|
-
? formulatText +
|
|
458
|
-
`<span class='formulaSpanElm'>${textParts[z]}</span>`
|
|
459
|
-
: `<span class='formulaSpanElm'></span>`;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
463
|
-
if (splitText.length - 1 === i)
|
|
464
|
-
formulatText =
|
|
465
|
-
`<span class='formulaSpanElm'></span>` +
|
|
466
|
-
chipElm +
|
|
467
|
-
`<span class='formulaSpanElm'></span>`;
|
|
468
|
-
else
|
|
469
|
-
formulatText = `<span class='formulaSpanElm'></span>` + chipElm;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
setContent(formulatText);
|
|
473
|
-
}
|
|
474
|
-
else {
|
|
475
|
-
setFormulaPlaceholder(true);
|
|
476
|
-
}
|
|
477
|
-
setTimeout(() => {
|
|
478
|
-
addEventListenerForSpan();
|
|
479
|
-
setIsValid(false);
|
|
480
|
-
}, 1000);
|
|
481
|
-
};
|
|
482
34
|
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `condition_column border-1 flex border-gray-300 border-round-lg overflow-hidden w-full ${props === null || props === void 0 ? void 0 : props.className}` }, { children: [(0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { optionLabel: props === null || props === void 0 ? void 0 : props.optionLabel, panelClassName: "formula_panel_dropdown", "data-pr-classname": "block", placeholder: (props === null || props === void 0 ? void 0 : props.dropdownPlaceholder) ? props === null || props === void 0 ? void 0 : props.dropdownPlaceholder : "Select", value: conditionValue, onChange: (e) => {
|
|
483
35
|
if (props === null || props === void 0 ? void 0 : props.onConditionChange)
|
|
484
36
|
props === null || props === void 0 ? void 0 : props.onConditionChange(e);
|
|
@@ -489,14 +41,19 @@ const FormulaComponent = (props) => {
|
|
|
489
41
|
switch (optiontype) {
|
|
490
42
|
case "INCREASE_BY_VALUE":
|
|
491
43
|
case "DECREASE_BY_VALUE": {
|
|
492
|
-
return ((0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, minFractionDigits: 2, maxFractionDigits: 2, maxLength: (props === null || props === void 0 ? void 0 : props.maxLength) || Infinity }, props === null || props === void 0 ? void 0 : props.field, {
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, minFractionDigits: 2, maxFractionDigits: 2, maxLength: (props === null || props === void 0 ? void 0 : props.maxLength) || Infinity }, props === null || props === void 0 ? void 0 : props.field, { onValueChange: (e) => (props === null || props === void 0 ? void 0 : props.onChange) && (props === null || props === void 0 ? void 0 : props.onChange(e)), placeholder: "Enter Number", value: props === null || props === void 0 ? void 0 : props.inputValue, className: "border-none w-6", inputClassName: "border-none focus:shadow-none" })));
|
|
493
45
|
}
|
|
494
46
|
case "INCREASE_BY_PERCENTAGE":
|
|
495
47
|
case "DECREASE_BY_PERCENTAGE": {
|
|
496
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "w-6 relative" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "absolute left-0 h-full flex align-items-center px-2" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "percent-01", size: 16, color: "#344054" }) })), (0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, max:
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "w-6 relative" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "absolute left-0 h-full flex align-items-center px-2" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "percent-01", size: 16, color: "#344054" }) })), (0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, max: 100, minFractionDigits: 2, maxFractionDigits: 2, maxLength: (props === null || props === void 0 ? void 0 : props.maxLength) || Infinity }, props === null || props === void 0 ? void 0 : props.field, { onChange: (e) => {
|
|
49
|
+
const value = e.value > 100 ? 100 : e.value;
|
|
50
|
+
e.originalEvent.target.value = value
|
|
51
|
+
? value === null || value === void 0 ? void 0 : value.toFixed(2)
|
|
52
|
+
: 0;
|
|
53
|
+
}, onValueChange: (e) => (props === null || props === void 0 ? void 0 : props.onChange) && (props === null || props === void 0 ? void 0 : props.onChange(e)), placeholder: "Enter Number", value: props === null || props === void 0 ? void 0 : props.inputValue, className: "border-none w-full", inputClassName: "border-none pl-8 focus:shadow-none" }))] })));
|
|
497
54
|
}
|
|
498
55
|
case "MANUAL": {
|
|
499
|
-
return ((0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, minFractionDigits: 2, maxFractionDigits: 2, maxLength: (props === null || props === void 0 ? void 0 : props.maxLength) || Infinity }, props === null || props === void 0 ? void 0 : props.field, {
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, minFractionDigits: 2, maxFractionDigits: 2, maxLength: (props === null || props === void 0 ? void 0 : props.maxLength) || Infinity }, props === null || props === void 0 ? void 0 : props.field, { onValueChange: (e) => (props === null || props === void 0 ? void 0 : props.onChange) && (props === null || props === void 0 ? void 0 : props.onChange(e)), placeholder: "Enter Number", value: props === null || props === void 0 ? void 0 : props.inputValue, className: "border-none w-6", inputClassName: "border-none focus:shadow-none" })));
|
|
500
57
|
}
|
|
501
58
|
case "CALCULATION": {
|
|
502
59
|
const pattern = /(?:[a-f0-9]{24}|msrp|map|costprice)/g;
|
|
@@ -517,6 +74,10 @@ const FormulaComponent = (props) => {
|
|
|
517
74
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
518
75
|
}
|
|
519
76
|
}
|
|
520
|
-
})() }), (0, jsx_runtime_1.jsx)(menu_1.Menu
|
|
77
|
+
})() }), (0, jsx_runtime_1.jsx)(menu_1.Menu
|
|
78
|
+
// onShow={onShowMenu}
|
|
79
|
+
, {
|
|
80
|
+
// onShow={onShowMenu}
|
|
81
|
+
popup: true, popupAlignment: "left", className: `w-28rem p-0 ${props === null || props === void 0 ? void 0 : props.menuClassName}`, model: menuContent, ref: priceConditioRef, id: "condition_menu_popup" })] }), "asadssadsasdsdadasd"));
|
|
521
82
|
};
|
|
522
83
|
exports.default = FormulaComponent;
|
|
@@ -6,11 +6,12 @@ const tagify_1 = tslib_1.__importDefault(require("@yaireo/tagify"));
|
|
|
6
6
|
require("@yaireo/tagify/dist/tagify.css");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const svg_component_1 = tslib_1.__importDefault(require("../../directives/svg-component"));
|
|
9
|
+
const button_1 = require("primereact/button");
|
|
9
10
|
const TagifyComponent = (props) => {
|
|
11
|
+
var _a;
|
|
10
12
|
const tagifyRef = (0, react_1.useRef)(null);
|
|
11
13
|
const saveBtnRef = (0, react_1.useRef)(null);
|
|
12
|
-
|
|
13
|
-
const inputValue = `[[{"id": "660ab8748140c009b0af99a2","value": "Test1","code": "34sdf","price": 46}]] [[{"id": "660abaee8140c009b0afa3ef","value": "Test2","code": "t34sdf","price": 4}]]`;
|
|
14
|
+
const inputValue = `[[{"id": "660ab8748140c009b0af99a2","value": "Test1","code": "34sdf","price": 46}]] + 8 + [[{"id": "660abaee8140c009b0afa3ef","value": "Test2","code": "t34sdf","price": 4}]] + 86`;
|
|
14
15
|
let tagifyInstance;
|
|
15
16
|
(0, react_1.useEffect)(() => {
|
|
16
17
|
// Initialize tagify with new keyword and options
|
|
@@ -31,13 +32,18 @@ const TagifyComponent = (props) => {
|
|
|
31
32
|
enforceWhitelist: true,
|
|
32
33
|
});
|
|
33
34
|
tagifyInstance.on("change input", onInput);
|
|
35
|
+
tagifyInstance.on("change", onChange);
|
|
36
|
+
function onChange() {
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
onCalculateSum();
|
|
39
|
+
}, 1000);
|
|
40
|
+
}
|
|
34
41
|
function onInput() {
|
|
35
|
-
// onCalculateSum();
|
|
36
42
|
setTimeout(() => {
|
|
37
|
-
|
|
38
|
-
console.log(resultString);
|
|
43
|
+
onCalculateSum();
|
|
39
44
|
}, 1000);
|
|
40
45
|
}
|
|
46
|
+
onCalculateSum();
|
|
41
47
|
// Clean up the event listener on unmount
|
|
42
48
|
return () => {
|
|
43
49
|
tagifyInstance.destroy();
|
|
@@ -53,33 +59,46 @@ const TagifyComponent = (props) => {
|
|
|
53
59
|
closeBracket: ")",
|
|
54
60
|
};
|
|
55
61
|
const onCalculateSum = () => {
|
|
56
|
-
const tagRegex = /\[\[{"id":"[a-z0-9]+","value":"([a-zA-Z0-9]+)","code":"([a-zA-Z0-9]+)","price":(\d+)}\]\]/g;
|
|
57
|
-
const mathRegex = /\[\[{"value":"([+\-*/%()])","type":"math"}\]\]/g;
|
|
58
|
-
const validateRegex = /^(?![\+\-\*\/\%\(\)])(?:\[\[{.*?}\]\]|\d+)(?:[\+\-\*\/\%\(\)](?:\[\[{.*?}\]\]|\d+))*$(?![\+\-\*\/\%\(\)])$/;
|
|
59
62
|
if (tagifyRef === null || tagifyRef === void 0 ? void 0 : tagifyRef.current) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
const price = match[3]; // Extract price from the object
|
|
65
|
-
resultString = resultString.replace(match[0], price); // Replace the object with its price
|
|
66
|
-
}
|
|
67
|
-
while ((match = mathRegex.exec(tagifyRef.current.value)) !== null) {
|
|
68
|
-
const value = match[1]; // Extract value from the object
|
|
69
|
-
resultString = resultString.replace(match[0], value); // Replace the object with its value
|
|
70
|
-
}
|
|
71
|
-
const val = resultString.replace(/\s+/g, "");
|
|
72
|
-
const saveDivElm = saveBtnRef.current;
|
|
63
|
+
const pattern = /^(?![\+\-\*/]).*(?:[\+\-\*/]\d+[\+\-\*/])*(?:(?:\[\[{.*}\]\])([\+\-\*/](?:\[\[{.*}\]\]))+)*(?:\[\[{.*}\]\])*(?![\+\-\*/])$/;
|
|
64
|
+
// /^(?![\+\-\*/]).*(?:[\+\-\*/]\d+[\+\-\*/])*(?:\[\[{.*}\]\])*(?![\+\-\*/])$/;
|
|
65
|
+
// /^(?![\+\-\*/]).*[\+\-\*/].*(?:\d+|(\[\[{.*}\]\]))(?![\+\-\*/])$/;
|
|
66
|
+
///^(?![\+\-\*/]).*(?:\[\[{.*}\]\])(?:[\+\-\*/]\d+[\+\-\*/])*(?:\[\[{.*}\]\])?(?![\+\-\*/])$/
|
|
73
67
|
try {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
// Test the string against the pattern
|
|
69
|
+
let value = tagifyRef.current.value;
|
|
70
|
+
value = value.replaceAll("", "");
|
|
71
|
+
value = value.replaceAll(" ", "");
|
|
72
|
+
if (pattern.test(`${value.trim()}`)) {
|
|
73
|
+
const tagRegex = /\[\[({.*?})\]\]/g; // Match patterns starting with [[{ and ending with }]]
|
|
74
|
+
let str = tagifyRef.current.value;
|
|
75
|
+
let res = str.replace(tagRegex, (match) => {
|
|
76
|
+
try {
|
|
77
|
+
const tagData = JSON.parse(match.slice(2, -2)); // Remove [[{ and }]] to parse JSON
|
|
78
|
+
return tagData.price.toString(); // Replace with the price value
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error("Invalid tag format:", match);
|
|
82
|
+
return match; // Return original if parsing fails
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
res = res.replaceAll("", "");
|
|
86
|
+
res = res.replaceAll(" ", "");
|
|
87
|
+
eval(res);
|
|
88
|
+
if (saveBtnRef.current) {
|
|
89
|
+
saveBtnRef.current.disabled = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (saveBtnRef.current) {
|
|
94
|
+
saveBtnRef.current.disabled = true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
80
97
|
}
|
|
81
98
|
catch (error) {
|
|
82
|
-
|
|
99
|
+
if (saveBtnRef.current) {
|
|
100
|
+
saveBtnRef.current.disabled = true;
|
|
101
|
+
}
|
|
83
102
|
}
|
|
84
103
|
}
|
|
85
104
|
};
|
|
@@ -89,8 +108,7 @@ const TagifyComponent = (props) => {
|
|
|
89
108
|
{ value: operators[operator], type: "math" },
|
|
90
109
|
]);
|
|
91
110
|
setTimeout(() => {
|
|
92
|
-
|
|
93
|
-
console.log(resultString);
|
|
111
|
+
onCalculateSum();
|
|
94
112
|
}, 1000);
|
|
95
113
|
});
|
|
96
114
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "condition_section border-top-1 border-bottom-1 border-gray-200" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "h-2rem px-4 border-bottom-1 flex column-gap-2 align-items-center border-gray-200" }, { children: props.formulaOperators.map((operator, index) => {
|
|
@@ -98,6 +116,6 @@ const TagifyComponent = (props) => {
|
|
|
98
116
|
}) })), (0, jsx_runtime_1.jsx)("input", { ref: tagifyRef, type: "text", placeholder: "Enter text or tags...", value: inputValue })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: `condition_footer_section flex align-items-center p-2 ${props === null || props === void 0 ? void 0 : props.footerTemplateClassName}` }, { children: (props === null || props === void 0 ? void 0 : props.footerTemplate) ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props === null || props === void 0 ? void 0 : props.footerTemplate })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "w-6 px-4 py-2 hover:bg-primary-50 cursor-pointer sc_icon_hover", onClick: () => {
|
|
99
117
|
// setContent(props?.formulaValue);
|
|
100
118
|
// priceConditioRef.current.toggle(e);
|
|
101
|
-
} }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 20 }) })), (0, jsx_runtime_1.jsx)(
|
|
119
|
+
} }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 20 }) })), (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ ref: saveBtnRef, disabled: (_a = saveBtnRef === null || saveBtnRef === void 0 ? void 0 : saveBtnRef.current) === null || _a === void 0 ? void 0 : _a.disabled, className: `w-6 px-4 py-2 hover:bg-primary-50 cursor-pointer sc_icon_hover` }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "check", size: 20 }) }))] })) }))] }));
|
|
102
120
|
};
|
|
103
121
|
exports.default = TagifyComponent;
|
|
@@ -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, } = props;
|
|
18
|
+
showChips, chipTemplate, chipClassName, chipsParentClassName, showRemoveIcon, removeIconSize, removeIconClassName, onRemoveItem, isDraggable, onDranghandle, onShow, onHide, onFocus, confirmationOption, selectedOptionNone, type, emptyFilterMessage, emptyMessage, dataLabel, } = 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);
|
|
@@ -136,10 +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)(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) })) : ((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",
|
|
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
140
|
// className={`list_box_button focus:shadow-none p-0 h-max h-auto mx-2`}
|
|
141
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" : ""}
|
|
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 &&
|
|
143
143
|
(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map((item, index) => {
|
|
144
144
|
var _a, _b, _c, _d;
|
|
145
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"
|
|
@@ -67,7 +67,9 @@ const MultiSelectDropDown = (props) => {
|
|
|
67
67
|
// className="w-20rem"
|
|
68
68
|
showClear: true, panelStyle: {
|
|
69
69
|
width: props.panelWidth ? props.panelWidth + "px" : "",
|
|
70
|
-
}, emptyFilterMessage: props.emptyFilterMessage
|
|
70
|
+
}, emptyFilterMessage: props.emptyFilterMessage
|
|
71
|
+
? props.emptyFilterMessage
|
|
72
|
+
: "No Results Found", filterPlaceholder: props.filterPlaceholder ? props.filterPlaceholder : "Search by name" }))] }));
|
|
71
73
|
};
|
|
72
74
|
exports.MultiSelectDropDown = MultiSelectDropDown;
|
|
73
75
|
exports.default = exports.MultiSelectDropDown;
|