funda-ui 4.7.335 → 4.7.345

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.
Files changed (35) hide show
  1. package/CascadingSelect/index.css +86 -86
  2. package/CascadingSelect/index.d.ts +21 -4
  3. package/CascadingSelect/index.js +209 -53
  4. package/CascadingSelectE2E/index.css +86 -86
  5. package/CascadingSelectE2E/index.d.ts +22 -5
  6. package/CascadingSelectE2E/index.js +233 -69
  7. package/MultipleCheckboxes/index.js +71 -0
  8. package/MultipleSelect/index.js +71 -0
  9. package/TagInput/index.js +71 -0
  10. package/Utils/extract.d.ts +39 -1
  11. package/Utils/extract.js +65 -0
  12. package/Utils/useDragDropPosition.d.ts +0 -3
  13. package/Utils/useDragDropPosition.js +0 -3
  14. package/lib/cjs/CascadingSelect/index.d.ts +21 -4
  15. package/lib/cjs/CascadingSelect/index.js +209 -53
  16. package/lib/cjs/CascadingSelectE2E/index.d.ts +22 -5
  17. package/lib/cjs/CascadingSelectE2E/index.js +233 -69
  18. package/lib/cjs/MultipleCheckboxes/index.js +71 -0
  19. package/lib/cjs/MultipleSelect/index.js +71 -0
  20. package/lib/cjs/TagInput/index.js +71 -0
  21. package/lib/cjs/Utils/extract.d.ts +39 -1
  22. package/lib/cjs/Utils/extract.js +65 -0
  23. package/lib/cjs/Utils/useDragDropPosition.d.ts +0 -3
  24. package/lib/cjs/Utils/useDragDropPosition.js +0 -3
  25. package/lib/css/CascadingSelect/index.css +86 -86
  26. package/lib/css/CascadingSelectE2E/index.css +86 -86
  27. package/lib/esm/CascadingSelect/Group.tsx +4 -3
  28. package/lib/esm/CascadingSelect/index.scss +67 -65
  29. package/lib/esm/CascadingSelect/index.tsx +201 -60
  30. package/lib/esm/CascadingSelectE2E/Group.tsx +3 -3
  31. package/lib/esm/CascadingSelectE2E/index.scss +67 -65
  32. package/lib/esm/CascadingSelectE2E/index.tsx +235 -79
  33. package/lib/esm/Utils/hooks/useDragDropPosition.tsx +0 -3
  34. package/lib/esm/Utils/libs/extract.ts +77 -3
  35. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState, useRef, useImperativeHandle } from 'react';
1
+ import React, { useEffect, useState, forwardRef, useRef, useImperativeHandle } from 'react';
2
2
 
3
3
  import RootPortal from 'funda-root-portal';
4
4
 
@@ -8,6 +8,8 @@ import useClickOutside from 'funda-utils/dist/cjs/useClickOutside';
8
8
  import {
9
9
  extractorExist,
10
10
  extractContentsOfBraces,
11
+ extractContentsOfMixedCharactersWithBraces,
12
+ extractContentsOfMixedCharactersWithComma
11
13
  } from 'funda-utils/dist/cjs/extract';
12
14
  import {
13
15
  convertArrToValByBraces
@@ -24,7 +26,7 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
24
26
  import Group from './Group';
25
27
 
26
28
 
27
- export type CascadingSelectOptionChangeFnType = (input: any, currentData: any, index: any, depth: any, value: any, closeFunc: any) => void;
29
+ export type CascadingSelectOptionChangeFnType = (input: any, currentData: any, index: any, depth: any, value: string, closeFunc: any) => void;
28
30
 
29
31
 
30
32
  export type CascadingSelectProps = {
@@ -32,6 +34,8 @@ export type CascadingSelectProps = {
32
34
  wrapperClassName?: string;
33
35
  controlClassName?: string;
34
36
  controlExClassName?: string;
37
+ controlGroupWrapperClassName?: string;
38
+ controlGroupTextClassName?: string;
35
39
  searchable?: boolean;
36
40
  searchPlaceholder?: string;
37
41
  perColumnHeadersShow?: boolean;
@@ -40,8 +44,15 @@ export type CascadingSelectProps = {
40
44
  label?: React.ReactNode | string;
41
45
  name?: string;
42
46
  placeholder?: string;
47
+ readOnly?: any;
43
48
  disabled?: any;
44
49
  required?: any;
50
+ requiredLabel?: React.ReactNode | string;
51
+ units?: React.ReactNode | string;
52
+ iconLeft?: React.ReactNode | string;
53
+ iconRight?: React.ReactNode | string;
54
+ minLength?: any;
55
+ maxLength?: any;
45
56
  /** Whether to use curly braces to save result and initialize default value */
46
57
  extractValueByBraces?: boolean;
47
58
  /** Set headers for each column group */
@@ -58,8 +69,8 @@ export type CascadingSelectProps = {
58
69
  /** Set a loader component to show while the component waits for the next load of data.
59
70
  * e.g. `<span>Loading...</span>` or any fancy loader element */
60
71
  loader?: React.ReactNode;
61
- /** Whether to show breadcrumb result */
62
- displayResult?: boolean;
72
+ /** Whether it can be modified in the input box */
73
+ inputable?: boolean;
63
74
  /** Set an arrow of breadcrumb result */
64
75
  displayResultArrow?: React.ReactNode;
65
76
  /** Set an arrow of control */
@@ -85,21 +96,35 @@ export type CascadingSelectProps = {
85
96
  onChange?: CascadingSelectOptionChangeFnType | null;
86
97
  onBlur?: (e: any) => void;
87
98
  onFocus?: (e: any) => void;
99
+ /**
100
+ * Customize the function of formatting the value of the input input box, and the parameters are labels, values, and queryIds
101
+ * Returns a string as the value of the input
102
+ */
103
+ formatInputResult?: (param: Array<{label: string, value: string | number}>) => string;
88
104
  };
89
105
 
90
106
 
91
- const CascadingSelect = (props: CascadingSelectProps) => {
107
+ const CascadingSelect = forwardRef((props: CascadingSelectProps, externalRef: any) => {
92
108
  const {
93
109
  popupRef,
94
110
  wrapperClassName,
95
111
  controlClassName,
96
112
  controlExClassName,
113
+ controlGroupWrapperClassName,
114
+ controlGroupTextClassName,
97
115
  searchable = false,
98
116
  searchPlaceholder = '',
99
117
  perColumnHeadersShow = true,
100
118
  exceededSidePosOffset,
119
+ readOnly,
101
120
  disabled,
102
121
  required,
122
+ requiredLabel,
123
+ units,
124
+ iconLeft,
125
+ iconRight,
126
+ minLength,
127
+ maxLength,
103
128
  value,
104
129
  label,
105
130
  placeholder,
@@ -109,7 +134,7 @@ const CascadingSelect = (props: CascadingSelectProps) => {
109
134
  columnTitle,
110
135
  depth,
111
136
  loader,
112
- displayResult,
137
+ inputable = false,
113
138
  displayResultArrow,
114
139
  controlArrow,
115
140
  valueType,
@@ -128,6 +153,7 @@ const CascadingSelect = (props: CascadingSelectProps) => {
128
153
  onChange,
129
154
  onBlur,
130
155
  onFocus,
156
+ formatInputResult,
131
157
  ...attributes
132
158
  } = props;
133
159
 
@@ -139,12 +165,29 @@ const CascadingSelect = (props: CascadingSelectProps) => {
139
165
  const uniqueID = useComId();
140
166
  const idRes = id || uniqueID;
141
167
  const rootRef = useRef<any>(null);
142
- const valRef = useRef<any>(null);
168
+ const inputRef = useRef<any>(null);
143
169
  const listRef = useRef<any>(null);
144
170
 
145
171
  // searchable
146
172
  const [columnSearchKeywords, setColumnSearchKeywords] = useState<string[]>([]);
147
173
 
174
+
175
+ const propExist = (p: any) => {
176
+ return typeof p !== 'undefined' && p !== null && p !== '';
177
+ };
178
+
179
+ const resultInput = (curData: string[] | number[], curQueryIdsData: string[] | number[]) => {
180
+ return VALUE_BY_BRACES ? convertArrToValByBraces(curData.map((item: any, i: number) => `${item}[${curQueryIdsData[i]}]`)) : curData.map((item: any, i: number) => `${item}[${curQueryIdsData[i]}]`)!.join(',');
181
+ };
182
+
183
+ const resultInputPureText = (inputStr: string) => {
184
+ return VALUE_BY_BRACES ? `{${inputStr}[]}` : `${inputStr}[]`;
185
+
186
+ // value1: {{curLabel[curValue]}[]}
187
+ // value2: curLabel[curValue][]
188
+ };
189
+
190
+
148
191
  // exposes the following methods
149
192
  useImperativeHandle(
150
193
  popupRef,
@@ -214,18 +257,17 @@ const CascadingSelect = (props: CascadingSelectProps) => {
214
257
 
215
258
 
216
259
  function popwinPosInit(showAct: boolean = true) {
217
- if (rootRef.current === null || valRef.current === null) return
260
+ if (rootRef.current === null || inputRef.current === null) return
218
261
 
219
262
  // update modal position
220
- const _modalRef: any = document.querySelector(`#cas-select__items-wrapper-${idRes}`);
221
- const _triggerRef: any = valRef.current;
222
- const _triggerXaxisRef: any = rootRef.current;
263
+ const _modalRef: any = document.querySelector(`#casc-select__items-wrapper-${idRes}`);
264
+ const _triggerRef: any = inputRef.current;
223
265
 
224
266
  // console.log(getAbsolutePositionOfStage(_triggerRef));
225
267
 
226
268
  if (_modalRef === null) return;
227
269
 
228
- const { x } = getAbsolutePositionOfStage(_triggerXaxisRef);
270
+ const { x } = getAbsolutePositionOfStage(_triggerRef);
229
271
  const { y, width, height } = getAbsolutePositionOfStage(_triggerRef);
230
272
  const _triggerBox = _triggerRef.getBoundingClientRect();
231
273
  let targetPos = '';
@@ -301,7 +343,7 @@ const CascadingSelect = (props: CascadingSelectProps) => {
301
343
 
302
344
  function popwinPosHide() {
303
345
 
304
- const _modalRef: any = document.querySelector(`#cas-select__items-wrapper-${idRes}`);
346
+ const _modalRef: any = document.querySelector(`#casc-select__items-wrapper-${idRes}`);
305
347
 
306
348
  if (_modalRef !== null) {
307
349
  // remove classnames and styles
@@ -315,9 +357,9 @@ const CascadingSelect = (props: CascadingSelectProps) => {
315
357
  if (listRef.current === null) return;
316
358
 
317
359
  let latestDisplayColIndex: number = 0;
318
- const currentItemsInner: any = listRef.current.querySelector('.cas-select__items-inner');
360
+ const currentItemsInner: any = listRef.current.querySelector('.casc-select__items-inner');
319
361
  if (currentItemsInner !== null) {
320
- const colItemsWrapper = [].slice.call(currentItemsInner.querySelectorAll('.cas-select__items-col'));
362
+ const colItemsWrapper = [].slice.call(currentItemsInner.querySelectorAll('.casc-select__items-col'));
321
363
  colItemsWrapper.forEach((perCol: any) => {
322
364
  perCol.classList.remove('hide-col');
323
365
  });
@@ -481,8 +523,7 @@ const CascadingSelect = (props: CascadingSelectProps) => {
481
523
 
482
524
  function handleDisplayOptions(event: any) {
483
525
  if (event) event.preventDefault();
484
-
485
- //
526
+ if (isShow) return;
486
527
  activate();
487
528
 
488
529
  }
@@ -503,8 +544,15 @@ const CascadingSelect = (props: CascadingSelectProps) => {
503
544
 
504
545
  // callback
505
546
  //////////////////////////////////////////
506
- if (typeof (onChange) === 'function') {
507
- onChange(valRef.current, resValue, index, level, inputVal, cancel);
547
+ if (typeof onChange === 'function') {
548
+ const curValString = valueType === 'value' ? inputVal[0] : inputVal[1];
549
+ const curValCallback = typeof formatInputResult === 'function' ? formatInputResult(
550
+ VALUE_BY_BRACES
551
+ ? extractContentsOfMixedCharactersWithBraces(curValString)
552
+ : extractContentsOfMixedCharactersWithComma(curValString)
553
+ ) : curValString;
554
+
555
+ onChange(inputRef.current, resValue, index, level, curValCallback, cancel);
508
556
  }
509
557
 
510
558
 
@@ -515,6 +563,12 @@ const CascadingSelect = (props: CascadingSelectProps) => {
515
563
  // All the elements from start(array.length - start) to the end of the array will be deleted.
516
564
  newData.splice(level + 1);
517
565
 
566
+ // When requesting a return asynchronously, a new column is added only under the currently clicked column,
567
+ // and the previous column cannot be affected.
568
+ // Make sure that subsequent asynchronous requests will only insert new columns towards the level+1 position.
569
+ listData.current = [...newData];
570
+
571
+
518
572
  // active status
519
573
  if (resValue.children) {
520
574
  const childList = resValue.children;
@@ -541,10 +595,10 @@ const CascadingSelect = (props: CascadingSelectProps) => {
541
595
 
542
596
  // active current option with DOM
543
597
  //////////////////////////////////////////
544
- const currentItemsInner: any = e.currentTarget.closest('.cas-select__items-inner');
598
+ const currentItemsInner: any = e.currentTarget.closest('.casc-select__items-inner');
545
599
  if (currentItemsInner !== null) {
546
600
  curData.forEach((v: any, col: number) => {
547
- const colItemsWrapper = currentItemsInner.querySelectorAll('.cas-select__items-col');
601
+ const colItemsWrapper = currentItemsInner.querySelectorAll('.casc-select__items-col');
548
602
  colItemsWrapper.forEach((perCol: HTMLUListElement) => {
549
603
  const _col = Number(perCol.dataset.col);
550
604
 
@@ -608,7 +662,7 @@ const CascadingSelect = (props: CascadingSelectProps) => {
608
662
 
609
663
  function updateValue(arr: any[], targetVal: any, level: number | boolean = false) {
610
664
 
611
- const inputEl: any = valRef.current;
665
+ const inputEl: any = inputRef.current;
612
666
  let _valueData: any, _labelData: any;
613
667
 
614
668
 
@@ -655,11 +709,10 @@ const CascadingSelect = (props: CascadingSelectProps) => {
655
709
 
656
710
  }
657
711
 
658
-
659
712
  // update selected data
660
713
  //////////////////////////////////////////
661
- const inputVal_0 = VALUE_BY_BRACES ? convertArrToValByBraces(_valueData.map((item: any, i: number) => `${item}[${_valueData[i]}]`)) : _valueData.map((item: any, i: number) => `${item}[${_valueData[i]}]`)!.join(',');
662
- const inputVal_1 = VALUE_BY_BRACES ? convertArrToValByBraces(_labelData.map((item: any, i: number) => `${item}[${_valueData[i]}]`)) : _labelData.map((item: any, i: number) => `${item}[${_valueData[i]}]`)!.join(',');
714
+ const inputVal_0 = resultInput(_valueData, _valueData);
715
+ const inputVal_1 = resultInput(_labelData, _valueData);
663
716
 
664
717
  if (valueType === 'value') {
665
718
  if (inputEl !== null) setChangedVal(inputVal_0);
@@ -1102,14 +1155,14 @@ const CascadingSelect = (props: CascadingSelectProps) => {
1102
1155
  <>
1103
1156
 
1104
1157
  <div
1105
- className={clsWrite(wrapperClassName, 'cas-select__wrapper mb-3 position-relative', `cas-select__wrapper ${wrapperClassName}`)}
1158
+ className={clsWrite(wrapperClassName, 'casc-select__wrapper mb-3 position-relative', `casc-select__wrapper ${wrapperClassName}`)}
1106
1159
  ref={rootRef}
1107
- data-overlay-id={`cas-select__items-wrapper-${idRes}`}
1160
+ data-overlay-id={`casc-select__items-wrapper-${idRes}`}
1108
1161
  >
1109
1162
  {label ? <>{typeof label === 'string' ? <label htmlFor={idRes} className="form-label" dangerouslySetInnerHTML={{ __html: `${label}` }}></label> : <label htmlFor={idRes} className="form-label" >{label}</label>}</> : null}
1110
1163
 
1111
1164
  {triggerContent ? <>
1112
- <div className={clsWrite(wrapperClassName, 'cas-select__trigger d-inline w-auto', `cas-select__trigger ${triggerClassName}`)} onClick={handleDisplayOptions}>{triggerContent}</div>
1165
+ <div className={clsWrite(wrapperClassName, 'casc-select__trigger d-inline w-auto', `casc-select__trigger ${triggerClassName}`)} onClick={handleDisplayOptions}>{triggerContent}</div>
1113
1166
  </> : null}
1114
1167
 
1115
1168
 
@@ -1118,16 +1171,16 @@ const CascadingSelect = (props: CascadingSelectProps) => {
1118
1171
 
1119
1172
  <div
1120
1173
  ref={listRef}
1121
- id={`cas-select__items-wrapper-${idRes}`}
1122
- className="cas-select__items-wrapper position-absolute border shadow small"
1174
+ id={`casc-select__items-wrapper-${idRes}`}
1175
+ className="casc-select__items-wrapper position-absolute border shadow small"
1123
1176
  style={{ zIndex: DEPTH, display: 'none' }}
1124
1177
  >
1125
- <ul className="cas-select__items-inner">
1126
- {loading ? <><div className="cas-select__items-loader">{loader || <svg height="12px" width="12px" viewBox="0 0 512 512"><g><path fill="inherit" d="M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z" /><path fill="inherit" d="M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z" /><path fill="inherit" d="M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z" /><path fill="inherit" d="M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z" /><path fill="inherit" d="M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z" /><path fill="inherit" d="M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z" /><path fill="inherit" d="M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z" /><path fill="inherit" d="M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z" /></g></svg>}</div></> : null}
1178
+ <ul className="casc-select__items-inner">
1179
+ {loading ? <><div className="casc-select__items-loader">{loader || <svg height="12px" width="12px" viewBox="0 0 512 512"><g><path fill="inherit" d="M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z" /><path fill="inherit" d="M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z" /><path fill="inherit" d="M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z" /><path fill="inherit" d="M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z" /><path fill="inherit" d="M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z" /><path fill="inherit" d="M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z" /><path fill="inherit" d="M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z" /><path fill="inherit" d="M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z" /></g></svg>}</div></> : null}
1127
1180
  {showCloseBtn ? <a href="#" tabIndex={-1} onClick={(e) => {
1128
1181
  e.preventDefault();
1129
1182
  cancel();
1130
- }} className="cas-select__close position-absolute top-0 end-0 mt-0 mx-1"><svg width="10px" height="10px" viewBox="0 0 1024 1024"><path fill="#000" d="M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z" /></svg></a> : null}
1183
+ }} className="casc-select__close position-absolute top-0 end-0 mt-0 mx-1"><svg width="10px" height="10px" viewBox="0 0 1024 1024"><path fill="#000" d="M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z" /></svg></a> : null}
1131
1184
 
1132
1185
 
1133
1186
 
@@ -1146,11 +1199,11 @@ const CascadingSelect = (props: CascadingSelectProps) => {
1146
1199
 
1147
1200
 
1148
1201
  return (
1149
- <li key={level} data-col={level} className="cas-select__items-col">
1202
+ <li key={level} data-col={level} className="casc-select__items-col">
1150
1203
 
1151
1204
  {/* SEARCH BOX */}
1152
1205
  {searchable && (
1153
- <div className="cas-select__items-col-searchbox">
1206
+ <div className="casc-select__items-col-searchbox">
1154
1207
  <input
1155
1208
  type="text"
1156
1209
  placeholder={searchPlaceholder}
@@ -1189,36 +1242,124 @@ const CascadingSelect = (props: CascadingSelectProps) => {
1189
1242
  ) : null}
1190
1243
 
1191
1244
 
1245
+ <div className={combinedCls(
1246
+ 'casc-select__val',
1247
+ {
1248
+ 'inputable': inputable,
1249
+ }
1192
1250
 
1193
- <div className="cas-select__val" onClick={handleDisplayOptions}>
1251
+ )}
1252
+ onClick={handleDisplayOptions}
1253
+ >
1194
1254
 
1195
- {displayResult ? <div className="cas-select__result">{displayInfo()}</div> : null}
1196
1255
 
1197
-
1198
- <input
1199
- ref={valRef}
1200
- id={idRes}
1201
- data-overlay-id={`cas-select__items-wrapper-${idRes}`}
1202
- name={name}
1203
- className={combinedCls(
1204
- clsWrite(controlClassName, 'form-control'),
1205
- controlExClassName
1206
- )}
1207
- placeholder={placeholder}
1208
- value={changedVal} // placeholder will not change if defaultValue is used
1209
- onFocus={handleFocus}
1210
- onBlur={handleBlur}
1211
- disabled={disabled || null}
1212
- required={required || null}
1213
- style={style}
1214
- tabIndex={tabIndex || 0}
1215
- readOnly
1216
- {...attributes}
1217
- />
1256
+ {/* INPIT */}
1257
+ <div className={combinedCls(
1258
+ 'position-relative',
1259
+ clsWrite(controlGroupWrapperClassName, 'input-group'),
1260
+ {
1261
+ 'has-left-content': propExist(iconLeft),
1262
+ 'has-right-content': propExist(iconRight) || propExist(units)
1263
+ }
1218
1264
 
1265
+ )}>
1266
+
1267
+ {propExist(iconLeft) ? <><span className={clsWrite(controlGroupTextClassName, 'input-group-text')}>{iconLeft}</span></> : null}
1268
+
1269
+ <div className="input-group-control-container flex-fill position-relative">
1270
+ <input
1271
+ ref={(node) => {
1272
+ inputRef.current = node;
1273
+ if (typeof externalRef === 'function') {
1274
+ externalRef(node);
1275
+ } else if (externalRef) {
1276
+ externalRef.current = node;
1277
+ }
1278
+ }}
1279
+ id={idRes}
1280
+ data-overlay-id={`casc-select__items-wrapper-${idRes}`}
1281
+ name={name}
1282
+ className={combinedCls(
1283
+ clsWrite(controlClassName, 'form-control'),
1284
+ controlExClassName,
1285
+ {
1286
+ 'rounded': !propExist(iconLeft) && !propExist(iconRight) && !propExist(units),
1287
+ 'rounded-start-0': propExist(iconLeft),
1288
+ 'rounded-end-0': propExist(iconRight) || propExist(units)
1289
+ }
1290
+ )}
1291
+
1292
+ placeholder={placeholder}
1293
+ value={(() => {
1294
+ const curValForamt: string = resultInputPureText(changedVal);
1295
+ let curValCallback: string = curValForamt;
1296
+
1297
+ // STEP 1
1298
+ //============
1299
+ if (typeof formatInputResult === 'function') {
1300
+
1301
+ return formatInputResult(
1302
+ VALUE_BY_BRACES
1303
+ ? extractContentsOfMixedCharactersWithBraces(curValCallback)
1304
+ : extractContentsOfMixedCharactersWithComma(curValCallback)
1305
+ );
1306
+
1307
+ } else {
1308
+ return changedVal;
1309
+ }
1310
+
1311
+
1312
+ })()
1313
+ }
1314
+ // placeholder will not change if defaultValue is used
1315
+ onFocus={handleFocus}
1316
+ onBlur={handleBlur}
1317
+ autoComplete="off"
1318
+ disabled={disabled || null}
1319
+ readOnly={readOnly || null}
1320
+ required={required || null}
1321
+ minLength={minLength || null}
1322
+ maxLength={maxLength || null}
1323
+ style={style}
1324
+ tabIndex={tabIndex || 0}
1325
+ onChange={inputable ? (e) => {
1326
+ setChangedVal(e.target.value);
1327
+ if (typeof onChange === 'function') {
1328
+ onChange(
1329
+ e, // input dom event
1330
+ null, // currentData
1331
+ null, // index
1332
+ null, // depth
1333
+ e.target.value, // value
1334
+ cancel
1335
+ );
1336
+ }
1337
+ } : undefined}
1338
+ {...attributes}
1339
+
1340
+ />
1341
+
1342
+
1343
+
1344
+ {/** REVIEW RESULT */}
1345
+ {!inputable ? <div className="casc-select__result">{displayInfo()}</div> : null}
1346
+
1347
+
1348
+ {/* Required marking */}
1349
+ {required ? <>{requiredLabel || requiredLabel === '' ? requiredLabel : <span className="position-absolute end-0 top-0 my-2 mx-2 pe-3"><span className="text-danger">*</span></span>}</> : ''}
1350
+
1351
+ </div>
1352
+
1353
+
1354
+ {propExist(units) ? <><span className={clsWrite(controlGroupTextClassName, 'input-group-text')}>{units}</span></> : null}
1355
+ {propExist(iconRight) ? <><span className={clsWrite(controlGroupTextClassName, 'input-group-text')}>{iconRight}</span></> : null}
1356
+
1357
+ </div>
1358
+ {/* /INPIT */}
1359
+
1219
1360
 
1220
1361
  {isShow ? <div
1221
- className="cas-select__closemask"
1362
+ className="casc-select__closemask"
1222
1363
  onClick={(e) => {
1223
1364
  e.preventDefault();
1224
1365
  cancel();
@@ -1249,6 +1390,6 @@ const CascadingSelect = (props: CascadingSelectProps) => {
1249
1390
 
1250
1391
  </>
1251
1392
  )
1252
- };
1393
+ });
1253
1394
 
1254
1395
  export default CascadingSelect;
@@ -40,7 +40,7 @@ export default function Group(props: GroupProps) {
40
40
  data-level={level}
41
41
  data-query={item.queryId}
42
42
  className={combinedCls(
43
- 'cas-select-e2e__opt',
43
+ 'casc-select-e2e__opt',
44
44
  {
45
45
  'active': item.current
46
46
  }
@@ -53,12 +53,12 @@ export default function Group(props: GroupProps) {
53
53
  } else {
54
54
  return columnTitle[level] === '' || perColumnHeadersShow === false ? null : <h3
55
55
  key={index}
56
- className="cas-select-e2e__opt-header"
56
+ className="casc-select-e2e__opt-header"
57
57
  >
58
58
  <span dangerouslySetInnerHTML={{
59
59
  __html: columnTitle[level]
60
60
  }}></span>
61
- <div className="cas-select-e2e__opt-header__clean">
61
+ <div className="casc-select-e2e__opt-header__clean">
62
62
  <a
63
63
  tabIndex={-1}
64
64
  href="#"