sccoreui 5.6.3 → 5.6.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.
@@ -120,17 +120,17 @@ const FormulaCoponent = (props) => {
120
120
  const content = event.target.textContent.trim();
121
121
  const lastChar = content.charAt(content.length - 1);
122
122
  const operators = ['%', '*', '-', '+', '/'];
123
- if (event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowUp' || event.key === 'ArrowDown') {
123
+ if (event.keyCode === 37 || event.keyCode === 39 || event.keyCode === 38 || event.keyCode === 40) {
124
124
  let actElm = document.querySelector('.formulaSpanElm.activeSpanElm');
125
125
  if (actElm)
126
126
  actElm.classList.remove('activeSpanElm');
127
127
  const selection = window.getSelection();
128
128
  const range = document.createRange();
129
129
  range.setStart(selection.focusNode, selection.focusOffset);
130
- if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {
130
+ if (event.keyCode === 37 /* ArrowLeft */ || event.keyCode === 38 /* ArrowUp */) {
131
131
  range.collapse(true);
132
132
  }
133
- else if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {
133
+ else if (event.keyCode === 39 /* ArrowRight */ || event.keyCode === 40 /* ArrowDown */) {
134
134
  range.collapse(false);
135
135
  }
136
136
  selection.removeAllRanges();
@@ -145,11 +145,11 @@ const FormulaCoponent = (props) => {
145
145
  }
146
146
  }
147
147
  // Allow backspace, delete, select all (Ctrl+A), and certain keys when text is selected
148
- if (event.key === 'Backspace' || event.key === 'Delete' ||
149
- (event.key === 'a' && event.ctrlKey) || (event.key === 'A' && event.ctrlKey) ||
150
- event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowUp' ||
151
- event.key === 'ArrowDown' || event.key === 'Home' || event.key === 'End' || event.key === 'Shift') {
152
- if (event.key === 'Backspace' || event.key === 'Delete') {
148
+ if (event.keyCode === 8 || event.keyCode === 46 ||
149
+ (event.keyCode === 65 && event.ctrlKey) || (event.keyCode === 65 && event.ctrlKey) ||
150
+ event.keyCode === 37 || event.keyCode === 39 || event.keyCode === 38 ||
151
+ event.keyCode === 40 || event.keyCode === 36 || event.keyCode === 35 || event.keyCode === 16) {
152
+ if (event.keyCode === 8 || event.keyCode === 46) {
153
153
  let spanElms = document.querySelectorAll('.formulaSpanElm');
154
154
  for (let i = 0; i < spanElms.length; i++) {
155
155
  if (((_a = spanElms[i]) === null || _a === void 0 ? void 0 : _a.classList.value) === 'formulaSpanElm activeSpanElm' && (spanElms[i].innerHTML === '' || spanElms[i].innerHTML === '<br>')) {
@@ -158,22 +158,21 @@ const FormulaCoponent = (props) => {
158
158
  }
159
159
  onChangeCondition();
160
160
  }
161
- return;
162
161
  }
163
162
  // Allow numbers, *, -, +, %, /, (, ), and single space
164
- if (!((event.key >= '0' && event.key <= '9') ||
165
- event.key === '*' || event.key === '-' || event.key === '+' ||
166
- event.key === '%' || event.key === '/' || event.key === '(' ||
167
- event.key === ')' || (event.key !== ' ' && event.target.textContent.trim().slice(-1) === ' '))) {
163
+ if (!((event.keyCode >= '0' && event.keyCode <= '9') ||
164
+ event.keyCode === '*' || event.keyCode === '-' || event.keyCode === '+' ||
165
+ event.keyCode === '%' || event.keyCode === '/' || event.keyCode === '(' ||
166
+ event.keyCode === ')' || (event.keyCode !== ' ' && event.target.textContent.trim().slice(-1) === ' '))) {
168
167
  event.preventDefault();
169
168
  }
170
169
  // Prevent new lines (enter keypress)
171
- if (event.key === 'Enter') {
170
+ if (event.keyCode === 'Enter') {
172
171
  event.preventDefault();
173
172
  }
174
173
  getCursorPosition(event.target);
175
174
  // Prevent entering operators continuously after each other
176
- if (operators.includes(event.key) && operators.includes(lastChar) && operators.includes(content[contentEditableCursorIndex - 2])) {
175
+ if (operators.includes(event.keyCode) && operators.includes(lastChar) && operators.includes(content[contentEditableCursorIndex - 2])) {
177
176
  event.preventDefault();
178
177
  }
179
178
  };
@@ -251,7 +250,7 @@ const FormulaCoponent = (props) => {
251
250
  (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) ? props === null || props === void 0 ? void 0 : props.formulaElemectPlaceholder : '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) ?
252
251
  (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props === null || props === void 0 ? void 0 : props.footerTemplate })
253
252
  :
254
- (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" }, { 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'));
253
+ (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) => priceConditioRef.current.toggle(e) }, { 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'));
255
254
  }
256
255
  }
257
256
  ];
@@ -324,14 +323,14 @@ const FormulaCoponent = (props) => {
324
323
  switch (optiontype) {
325
324
  case "INCREASE_BY_VALUE":
326
325
  case "DECREASE_BY_VALUE": {
327
- return (0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({}, props === null || props === void 0 ? void 0 : props.field, { onChange: (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-8', inputClassName: 'border-none \tfocus:shadow-none' }));
326
+ return (0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, minFractionDigits: 2, maxFractionDigits: 2 }, props === null || props === void 0 ? void 0 : props.field, { onChange: (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-8', inputClassName: 'border-none focus:shadow-none' }));
328
327
  }
329
328
  case "INCREASE_BY_PERCENTAGE":
330
329
  case "DECREASE_BY_PERCENTAGE": {
331
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'w-8 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({}, props === null || props === void 0 ? void 0 : props.field, { onChange: (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 \tpl-8 focus:shadow-none' }))] })));
330
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'w-8 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: 99, minFractionDigits: 2, maxFractionDigits: 2 }, props === null || props === void 0 ? void 0 : props.field, { onChange: (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' }))] })));
332
331
  }
333
332
  case "MANUAL": {
334
- return (0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({}, props === null || props === void 0 ? void 0 : props.field, { onChange: (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-8', inputClassName: 'border-none \tfocus:shadow-none' }));
333
+ return (0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, minFractionDigits: 2, maxFractionDigits: 2 }, props === null || props === void 0 ? void 0 : props.field, { onChange: (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-8', inputClassName: 'border-none focus:shadow-none' }));
335
334
  }
336
335
  case "CALCULATION": {
337
336
  const pattern = /[a-f0-9]{24}/g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "5.6.3",
3
+ "version": "5.6.4",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",