awing-library 2.1.2-dev.538 → 2.1.2-dev.539

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.
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleChoice/component.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,6BAA6B,EAAW,MAAM,aAAa,CAAC;AAarE,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,KAAK,EAAE,6BAA6B,2CAwHnF"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleChoice/component.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,6BAA6B,EAAyB,MAAM,aAAa,CAAC;AAgEnF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,KAAK,EAAE,6BAA6B,2CAwUnF"}
@@ -1,7 +1,16 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { createElement } from "react";
2
+ import { createElement, useEffect, useMemo, useRef, useState } from "react";
3
+ import ChevronRight from "@mui/icons-material/ChevronRight";
4
+ import ExpandMore from "@mui/icons-material/ExpandMore";
3
5
  import { Autocomplete, Box, Checkbox, Chip, IconButton, TextField, Typography } from "@mui/material";
4
6
  import { makeStyles } from "@mui/styles";
7
+ import { SimpleTreeView } from "@mui/x-tree-view";
8
+ import { TreeItem } from "@mui/x-tree-view/TreeItem";
9
+ const TREE_SENTINEL_ID = '__multiple_choice_tree__';
10
+ const TREE_SENTINEL_OPTION = {
11
+ id: TREE_SENTINEL_ID,
12
+ name: ''
13
+ };
5
14
  const useStyles = makeStyles({
6
15
  hideIndicator: {
7
16
  '& .MuiAutocomplete-popupIndicator': {
@@ -10,12 +19,100 @@ const useStyles = makeStyles({
10
19
  '& .MuiAutocomplete-clearIndicator': {
11
20
  marginRight: '8px'
12
21
  }
22
+ },
23
+ treeOption: {
24
+ padding: '0 !important',
25
+ '&.MuiAutocomplete-option': {
26
+ padding: '0 !important'
27
+ }
13
28
  }
14
29
  });
30
+ const flattenTreeOptions = (nodes)=>nodes.flatMap((node)=>[
31
+ node,
32
+ ...flattenTreeOptions(node.children || [])
33
+ ]);
34
+ const buildOptionMap = (nodes)=>{
35
+ const entries = flattenTreeOptions(nodes).map((node)=>[
36
+ node.id,
37
+ node
38
+ ]);
39
+ return new Map(entries);
40
+ };
41
+ const buildExpandedIds = (nodes, keyword)=>{
42
+ if (!keyword) return [];
43
+ const normalizedKeyword = keyword.toLowerCase();
44
+ const expandedIds = new Set();
45
+ const traverse = (items)=>{
46
+ let hasMatch = false;
47
+ items.forEach((item)=>{
48
+ const selfMatched = item.name.toLowerCase().includes(normalizedKeyword);
49
+ const childMatched = item.children?.length ? traverse(item.children) : false;
50
+ if (childMatched) expandedIds.add(item.id);
51
+ if (selfMatched || childMatched) hasMatch = true;
52
+ });
53
+ return hasMatch;
54
+ };
55
+ traverse(nodes);
56
+ return [
57
+ ...expandedIds
58
+ ];
59
+ };
15
60
  function MultipleChoiceComponent(props) {
16
61
  const classes = useStyles();
17
- const { label, selected, options, onChange, popupOpen = true, onOpen, onClose, variant, placeholder, error, helperText, operators, operator, onOperatorChange } = props;
18
- const renderTags = (options, getTagProps)=>options.map((option, i)=>{
62
+ const suppressBlurCloseRef = useRef(false);
63
+ const suppressBlurCloseTimeoutRef = useRef(null);
64
+ const markSuppressBlurClose = ()=>{
65
+ suppressBlurCloseRef.current = true;
66
+ if (suppressBlurCloseTimeoutRef.current) window.clearTimeout(suppressBlurCloseTimeoutRef.current);
67
+ suppressBlurCloseTimeoutRef.current = window.setTimeout(()=>{
68
+ suppressBlurCloseRef.current = false;
69
+ suppressBlurCloseTimeoutRef.current = null;
70
+ }, 150);
71
+ };
72
+ const { label, selected, options, onChange, popupOpen = true, onOpen, onClose, variant, placeholder, error, helperText, operators, operator, onOperatorChange, isFolderTree } = props;
73
+ const [inputText, setInputText] = useState('');
74
+ const [expandedItems, setExpandedItems] = useState([]);
75
+ const rootRef = useRef(null);
76
+ const treePopupRef = useRef(null);
77
+ const flatOptions = useMemo(()=>flattenTreeOptions(options), [
78
+ options
79
+ ]);
80
+ const optionMap = useMemo(()=>buildOptionMap(options), [
81
+ options
82
+ ]);
83
+ const selectedIds = useMemo(()=>new Set(selected.map((item)=>item.id)), [
84
+ selected
85
+ ]);
86
+ useEffect(()=>{
87
+ setExpandedItems(buildExpandedIds(options, inputText));
88
+ }, [
89
+ inputText,
90
+ options
91
+ ]);
92
+ useEffect(()=>{
93
+ if (!isFolderTree || !popupOpen) return;
94
+ const handleDocumentMouseDown = (event)=>{
95
+ const target = event.target;
96
+ if (rootRef.current?.contains(target) || treePopupRef.current?.contains(target)) return;
97
+ onClose({}, 'toggleInput');
98
+ };
99
+ document.addEventListener('mousedown', handleDocumentMouseDown);
100
+ return ()=>{
101
+ document.removeEventListener('mousedown', handleDocumentMouseDown);
102
+ };
103
+ }, [
104
+ isFolderTree,
105
+ onClose,
106
+ popupOpen
107
+ ]);
108
+ useEffect(()=>()=>{
109
+ if (suppressBlurCloseTimeoutRef.current) window.clearTimeout(suppressBlurCloseTimeoutRef.current);
110
+ }, []);
111
+ const handleAutocompleteClose = (event, reason)=>{
112
+ if (isFolderTree && suppressBlurCloseRef.current && ('blur' === reason || 'toggleInput' === reason)) return;
113
+ onClose(event, reason);
114
+ };
115
+ const renderTags = (values, getTagProps)=>values.map((option, i)=>{
19
116
  const { key, ...tagProps } = getTagProps({
20
117
  index: i
21
118
  });
@@ -74,10 +171,10 @@ function MultipleChoiceComponent(props) {
74
171
  })
75
172
  ]
76
173
  });
77
- const renderOption = (props, option, { selected })=>{
78
- const { key: _key, ...optionProps } = props;
174
+ const renderOption = (optionProps, option, { selected: isSelected })=>{
175
+ const { key: _key, ...liProps } = optionProps;
79
176
  return /*#__PURE__*/ createElement(Box, {
80
- ...optionProps,
177
+ ...liProps,
81
178
  component: "li",
82
179
  key: option.id,
83
180
  style: {
@@ -88,7 +185,7 @@ function MultipleChoiceComponent(props) {
88
185
  children: [
89
186
  /*#__PURE__*/ jsx(Checkbox, {
90
187
  color: "primary",
91
- checked: selected
188
+ checked: isSelected
92
189
  }),
93
190
  /*#__PURE__*/ jsx(Typography, {
94
191
  children: option.name
@@ -96,6 +193,135 @@ function MultipleChoiceComponent(props) {
96
193
  ]
97
194
  });
98
195
  };
196
+ const handleTreeSelection = (event, node)=>{
197
+ const shouldSelect = event.target.checked;
198
+ const nextSelectedIds = new Set(selectedIds);
199
+ if (shouldSelect) nextSelectedIds.add(node.id);
200
+ else nextSelectedIds.delete(node.id);
201
+ const nextSelected = [
202
+ ...nextSelectedIds
203
+ ].map((nodeId)=>optionMap.get(nodeId)).filter(Boolean);
204
+ onChange(event, nextSelected, 'selectOption');
205
+ };
206
+ const renderTreeNodes = (nodes)=>nodes.map((node)=>{
207
+ const childNodes = renderTreeNodes(node.children || []);
208
+ const matchedBySearch = inputText ? node.name.toLowerCase().includes(inputText.toLowerCase()) : true;
209
+ const childMatched = childNodes.some(Boolean);
210
+ if (!matchedBySearch && !childMatched) return null;
211
+ return /*#__PURE__*/ jsx(TreeItem, {
212
+ itemId: node.id,
213
+ label: /*#__PURE__*/ jsxs(Box, {
214
+ sx: {
215
+ display: 'flex',
216
+ alignItems: 'center',
217
+ py: 0.5
218
+ },
219
+ onMouseDown: (event)=>{
220
+ markSuppressBlurClose();
221
+ event.preventDefault();
222
+ event.stopPropagation();
223
+ },
224
+ onClick: (event)=>{
225
+ event.stopPropagation();
226
+ },
227
+ children: [
228
+ /*#__PURE__*/ jsx(Checkbox, {
229
+ checked: selectedIds.has(node.id),
230
+ onClick: (event)=>{
231
+ event.stopPropagation();
232
+ },
233
+ onChange: (event)=>handleTreeSelection(event, node)
234
+ }),
235
+ /*#__PURE__*/ jsx(Typography, {
236
+ children: node.name
237
+ })
238
+ ]
239
+ }, node.id),
240
+ children: childNodes
241
+ }, node.id);
242
+ });
243
+ if (isFolderTree) return /*#__PURE__*/ jsx(Box, {
244
+ ref: rootRef,
245
+ children: /*#__PURE__*/ jsx(Autocomplete, {
246
+ className: operator ? classes.hideIndicator : '',
247
+ size: "small",
248
+ fullWidth: true,
249
+ multiple: true,
250
+ autoComplete: true,
251
+ disableCloseOnSelect: true,
252
+ options: [
253
+ TREE_SENTINEL_OPTION,
254
+ ...flatOptions
255
+ ],
256
+ filterOptions: ()=>[
257
+ TREE_SENTINEL_OPTION
258
+ ],
259
+ onChange: onChange,
260
+ value: selected,
261
+ inputValue: inputText,
262
+ onInputChange: (_event, value)=>setInputText(value),
263
+ getOptionLabel: (option)=>option.name,
264
+ getOptionKey: (option)=>option.id,
265
+ isOptionEqualToValue: (option, value)=>option?.id === value?.id,
266
+ renderTags: renderTags,
267
+ renderInput: renderInput,
268
+ open: popupOpen,
269
+ onOpen: onOpen,
270
+ onClose: handleAutocompleteClose,
271
+ renderOption: (optionProps, option)=>{
272
+ if (option.id !== TREE_SENTINEL_ID) return /*#__PURE__*/ createElement(Box, {
273
+ component: "li",
274
+ ...optionProps,
275
+ key: option.id,
276
+ style: {
277
+ display: 'none'
278
+ }
279
+ });
280
+ const { key: _key, ...liProps } = optionProps;
281
+ return /*#__PURE__*/ createElement(Box, {
282
+ component: "li",
283
+ ...liProps,
284
+ ref: treePopupRef,
285
+ key: option.id,
286
+ className: classes.treeOption,
287
+ onMouseDown: (event)=>{
288
+ markSuppressBlurClose();
289
+ event.preventDefault();
290
+ event.stopPropagation();
291
+ },
292
+ onClick: (event)=>{
293
+ event.stopPropagation();
294
+ }
295
+ }, /*#__PURE__*/ jsx(SimpleTreeView, {
296
+ onMouseDownCapture: (event)=>{
297
+ markSuppressBlurClose();
298
+ event.preventDefault();
299
+ event.stopPropagation();
300
+ },
301
+ onClickCapture: ()=>{
302
+ markSuppressBlurClose();
303
+ },
304
+ slots: {
305
+ collapseIcon: ExpandMore,
306
+ expandIcon: ChevronRight
307
+ },
308
+ expandedItems: expandedItems,
309
+ onExpandedItemsChange: (_event, itemIds)=>{
310
+ setExpandedItems(itemIds);
311
+ },
312
+ style: {
313
+ overflow: 'hidden',
314
+ width: '100%'
315
+ },
316
+ children: renderTreeNodes(options).some(Boolean) ? renderTreeNodes(options) : /*#__PURE__*/ jsx(Typography, {
317
+ padding: 3,
318
+ paddingLeft: 2,
319
+ children: "No options"
320
+ })
321
+ }));
322
+ }
323
+ })
324
+ });
99
325
  return /*#__PURE__*/ jsx(Autocomplete, {
100
326
  className: operator ? classes.hideIndicator : '',
101
327
  size: "small",
@@ -1,5 +1,5 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { fireEvent, render, screen } from "@testing-library/react";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { fireEvent, render, screen, within } from "@testing-library/react";
3
3
  import component from "./component.js";
4
4
  const mockProps = {
5
5
  label: 'Test Label',
@@ -36,6 +36,14 @@ const mockProps = {
36
36
  onOperatorChange: jest.fn()
37
37
  };
38
38
  describe('MultipleChoiceComponent', ()=>{
39
+ beforeEach(()=>{
40
+ jest.clearAllMocks();
41
+ jest.useFakeTimers();
42
+ });
43
+ afterEach(()=>{
44
+ jest.runOnlyPendingTimers();
45
+ jest.useRealTimers();
46
+ });
39
47
  it('renders without crashing', ()=>{
40
48
  render(/*#__PURE__*/ jsx(component, {
41
49
  ...mockProps
@@ -97,7 +105,7 @@ describe('MultipleChoiceComponent', ()=>{
97
105
  }));
98
106
  expect(screen.getByText('Error message')).toBeInTheDocument();
99
107
  });
100
- it('operator is empty', async ()=>{
108
+ it('operator is empty', ()=>{
101
109
  render(/*#__PURE__*/ jsx(component, {
102
110
  ...mockProps,
103
111
  operator: void 0
@@ -133,4 +141,207 @@ describe('MultipleChoiceComponent', ()=>{
133
141
  const chip1 = screen.getByText('Option 1');
134
142
  expect(chip1).toBeInTheDocument();
135
143
  });
144
+ it('renders tree view when isFolderTree is true', ()=>{
145
+ render(/*#__PURE__*/ jsx(component, {
146
+ ...mockProps,
147
+ isFolderTree: true,
148
+ popupOpen: true,
149
+ options: [
150
+ {
151
+ id: 'parent',
152
+ name: 'Parent',
153
+ children: [
154
+ {
155
+ id: 'child',
156
+ name: 'Child'
157
+ }
158
+ ]
159
+ }
160
+ ]
161
+ }));
162
+ expect(screen.getByText('Parent')).toBeInTheDocument();
163
+ fireEvent.click(screen.getByTestId('ChevronRightIcon'));
164
+ expect(screen.getByText('Child')).toBeInTheDocument();
165
+ });
166
+ it('filters tree nodes by input text', ()=>{
167
+ render(/*#__PURE__*/ jsx(component, {
168
+ ...mockProps,
169
+ isFolderTree: true,
170
+ popupOpen: true,
171
+ options: [
172
+ {
173
+ id: 'parent',
174
+ name: 'Parent',
175
+ children: [
176
+ {
177
+ id: 'child',
178
+ name: 'Child'
179
+ }
180
+ ]
181
+ }
182
+ ]
183
+ }));
184
+ const input = screen.getByRole('combobox');
185
+ fireEvent.change(input, {
186
+ target: {
187
+ value: 'Child'
188
+ }
189
+ });
190
+ expect(screen.getByText('Child')).toBeInTheDocument();
191
+ });
192
+ it('selects only parent in tree mode when parent is checked', ()=>{
193
+ const onChange = jest.fn();
194
+ render(/*#__PURE__*/ jsx(component, {
195
+ ...mockProps,
196
+ onChange: onChange,
197
+ isFolderTree: true,
198
+ popupOpen: true,
199
+ options: [
200
+ {
201
+ id: 'parent',
202
+ name: 'Parent',
203
+ children: [
204
+ {
205
+ id: 'child',
206
+ name: 'Child'
207
+ }
208
+ ]
209
+ }
210
+ ]
211
+ }));
212
+ const parentRow = screen.getByText('Parent').closest('li');
213
+ const checkbox = within(parentRow).getByRole('checkbox');
214
+ fireEvent.click(checkbox);
215
+ expect(onChange).toHaveBeenCalledWith(expect.anything(), [
216
+ expect.objectContaining({
217
+ id: 'parent',
218
+ name: 'Parent'
219
+ })
220
+ ], 'selectOption');
221
+ });
222
+ it('selects only child in tree mode when child is checked', ()=>{
223
+ const onChange = jest.fn();
224
+ render(/*#__PURE__*/ jsx(component, {
225
+ ...mockProps,
226
+ onChange: onChange,
227
+ isFolderTree: true,
228
+ popupOpen: true,
229
+ options: [
230
+ {
231
+ id: 'parent',
232
+ name: 'Parent',
233
+ children: [
234
+ {
235
+ id: 'child',
236
+ name: 'Child'
237
+ }
238
+ ]
239
+ }
240
+ ]
241
+ }));
242
+ fireEvent.mouseDown(screen.getByTestId('ChevronRightIcon'));
243
+ fireEvent.click(screen.getByTestId('ChevronRightIcon'));
244
+ const childRow = screen.getByText('Child').closest('li');
245
+ const checkbox = within(childRow).getByRole('checkbox');
246
+ fireEvent.click(checkbox);
247
+ expect(onChange).toHaveBeenCalledWith(expect.anything(), [
248
+ expect.objectContaining({
249
+ id: 'child',
250
+ name: 'Child'
251
+ })
252
+ ], 'selectOption');
253
+ });
254
+ it('keeps popup open when expanding tree nodes', ()=>{
255
+ const onClose = jest.fn();
256
+ render(/*#__PURE__*/ jsx(component, {
257
+ ...mockProps,
258
+ onClose: onClose,
259
+ isFolderTree: true,
260
+ popupOpen: true,
261
+ options: [
262
+ {
263
+ id: 'parent',
264
+ name: 'Parent',
265
+ children: [
266
+ {
267
+ id: 'child',
268
+ name: 'Child'
269
+ }
270
+ ]
271
+ }
272
+ ]
273
+ }));
274
+ const expandIcon = screen.getByTestId('ChevronRightIcon');
275
+ fireEvent.mouseDown(expandIcon);
276
+ fireEvent.blur(screen.getByRole('combobox'));
277
+ fireEvent.click(expandIcon);
278
+ fireEvent.mouseDown(expandIcon);
279
+ fireEvent.click(expandIcon);
280
+ jest.advanceTimersByTime(100);
281
+ expect(onClose).not.toHaveBeenCalledWith(expect.anything(), 'blur');
282
+ expect(onClose).not.toHaveBeenCalledWith(expect.anything(), 'toggleInput');
283
+ expect(screen.getByRole('listbox')).toBeInTheDocument();
284
+ expect(screen.getByText('Child')).toBeInTheDocument();
285
+ });
286
+ it('keeps popup open when clicking tree row', ()=>{
287
+ const onClose = jest.fn();
288
+ render(/*#__PURE__*/ jsx(component, {
289
+ ...mockProps,
290
+ onClose: onClose,
291
+ isFolderTree: true,
292
+ popupOpen: true,
293
+ options: [
294
+ {
295
+ id: 'parent',
296
+ name: 'Parent',
297
+ children: [
298
+ {
299
+ id: 'child',
300
+ name: 'Child'
301
+ }
302
+ ]
303
+ }
304
+ ]
305
+ }));
306
+ const parentLabel = screen.getByText('Parent');
307
+ fireEvent.mouseDown(parentLabel);
308
+ fireEvent.blur(screen.getByRole('combobox'));
309
+ fireEvent.click(parentLabel);
310
+ jest.advanceTimersByTime(100);
311
+ expect(onClose).not.toHaveBeenCalledWith(expect.anything(), 'blur');
312
+ expect(screen.getByRole('listbox')).toBeInTheDocument();
313
+ });
314
+ it('closes popup when clicking outside tree popup', ()=>{
315
+ const onClose = jest.fn();
316
+ render(/*#__PURE__*/ jsxs(Fragment, {
317
+ children: [
318
+ /*#__PURE__*/ jsx("button", {
319
+ type: "button",
320
+ children: "outside"
321
+ }),
322
+ /*#__PURE__*/ jsx(component, {
323
+ ...mockProps,
324
+ onClose: onClose,
325
+ isFolderTree: true,
326
+ popupOpen: true,
327
+ options: [
328
+ {
329
+ id: 'parent',
330
+ name: 'Parent',
331
+ children: [
332
+ {
333
+ id: 'child',
334
+ name: 'Child'
335
+ }
336
+ ]
337
+ }
338
+ ]
339
+ })
340
+ ]
341
+ }));
342
+ fireEvent.mouseDown(screen.getByRole('button', {
343
+ name: 'outside'
344
+ }));
345
+ expect(onClose).toHaveBeenCalledWith(expect.anything(), 'toggleInput');
346
+ });
136
347
  });
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleChoice/container.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAW,MAAM,aAAa,CAAC;AAE5D,eAAO,MAAM,cAAc,UAAW,oBAAoB,4CAgFzD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleChoice/container.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAyB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE1E,eAAO,MAAM,cAAc,UAAW,oBAAoB,4CAwFzD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
4
4
  import { DEFAULT_LOGIC_OPERATOR, USE_LOGIC_OPERATOR } from "../../Commons/Constant.js";
5
5
  import component from "./component.js";
6
6
  const MultipleChoice = (props)=>{
7
- const { label = '', placeholder = '', options = [], onChange, value, defaultValue = [], variant = 'outlined', error = false, helperText = '', endAdornmentOptions, endAdornmentValue, onEndAdornmentValueChange } = props;
7
+ const { label = '', placeholder = '', options = [], onChange, value, defaultValue = [], variant = 'outlined', error = false, helperText = '', endAdornmentOptions, endAdornmentValue, onEndAdornmentValueChange, isFolderTree } = props;
8
8
  const operators = endAdornmentOptions === USE_LOGIC_OPERATOR ? DEFAULT_LOGIC_OPERATOR : endAdornmentOptions;
9
9
  const [popupOpen, setPopupOpen] = useState(false);
10
10
  const [relativeOperator, setRelativeOperator] = useState(operators?.[0]?.id);
@@ -15,6 +15,7 @@ const MultipleChoice = (props)=>{
15
15
  value
16
16
  ]);
17
17
  const handleChange = (_event, value, reason, details)=>{
18
+ console.log('value', value);
18
19
  if ('removeOption' === reason) {
19
20
  const newSelected = selected.filter((item)=>item.id !== details?.option.id);
20
21
  setSelected(newSelected);
@@ -54,7 +55,8 @@ const MultipleChoice = (props)=>{
54
55
  helperText: helperText,
55
56
  onOperatorChange: handleOperatorChange,
56
57
  operators: operators,
57
- operator: endAdornmentValue || relativeOperator
58
+ operator: endAdornmentValue || relativeOperator,
59
+ isFolderTree: isFolderTree
58
60
  });
59
61
  };
60
62
  const container = MultipleChoice;
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { render, screen } from "@testing-library/react";
2
+ import { fireEvent, render, screen } from "@testing-library/react";
3
3
  import user_event from "@testing-library/user-event";
4
4
  import { DEFAULT_LOGIC_OPERATOR, USE_LOGIC_OPERATOR } from "../../Commons/Constant.js";
5
5
  import container from "./container.js";
@@ -17,6 +17,18 @@ const mockOptions = [
17
17
  name: 'Option 3'
18
18
  }
19
19
  ];
20
+ const treeOptions = [
21
+ {
22
+ id: 'parent',
23
+ name: 'Parent',
24
+ children: [
25
+ {
26
+ id: 'child',
27
+ name: 'Child'
28
+ }
29
+ ]
30
+ }
31
+ ];
20
32
  const defaultProps = {
21
33
  label: 'Test Label',
22
34
  placeholder: 'Select options',
@@ -173,4 +185,26 @@ describe('MultipleChoice Component', ()=>{
173
185
  }));
174
186
  expect(screen.getByText('Option 1')).toBeInTheDocument();
175
187
  });
188
+ it('renders tree mode when isFolderTree is true', async ()=>{
189
+ render(/*#__PURE__*/ jsx(container, {
190
+ ...defaultProps,
191
+ options: treeOptions,
192
+ isFolderTree: true
193
+ }));
194
+ const input = screen.getByRole('combobox');
195
+ await user_event.click(input);
196
+ expect(screen.getByText('Parent')).toBeInTheDocument();
197
+ });
198
+ it('closes tree popup when clicking outside', async ()=>{
199
+ render(/*#__PURE__*/ jsx(container, {
200
+ ...defaultProps,
201
+ options: treeOptions,
202
+ isFolderTree: true
203
+ }));
204
+ const input = screen.getByRole('combobox');
205
+ await user_event.click(input);
206
+ expect(screen.getByText('Parent')).toBeInTheDocument();
207
+ fireEvent.mouseDown(document.body);
208
+ expect(screen.queryByText('Parent')).not.toBeInTheDocument();
209
+ });
176
210
  });
@@ -0,0 +1,15 @@
1
+ import { IMultipleChoiceOption } from './interface';
2
+ export interface IDirectoryDemoItem {
3
+ __typename: 'Directory';
4
+ directoryPath: string;
5
+ id: number;
6
+ level: number;
7
+ name: string;
8
+ parentObjectId?: number | null;
9
+ relativePath: string;
10
+ }
11
+ export declare const convertDirectoriesToFolderTreeOptions: (directories: IDirectoryDemoItem[]) => IMultipleChoiceOption[];
12
+ declare const data: IDirectoryDemoItem[];
13
+ export default data;
14
+ export declare const folderTreeOptions: IMultipleChoiceOption[];
15
+ //# sourceMappingURL=data-demo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-demo.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleChoice/data-demo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IAC/B,UAAU,EAAE,WAAW,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,qCAAqC,gBACjC,kBAAkB,EAAE,KAClC,qBAAqB,EAuDvB,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,kBAAkB,EAsZ7B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,iBAAiB,yBAA8C,CAAC"}
@@ -0,0 +1,442 @@
1
+ const convertDirectoriesToFolderTreeOptions = (directories)=>{
2
+ const nodes = new Map();
3
+ const getParentDirectoryPath = (directoryPath, relativePath)=>{
4
+ if (!directoryPath.endsWith(relativePath)) return null;
5
+ const parentPath = directoryPath.slice(0, directoryPath.length - relativePath.length);
6
+ return parentPath || null;
7
+ };
8
+ directories.forEach((directory)=>{
9
+ nodes.set(directory.directoryPath, {
10
+ id: directory.relativePath,
11
+ name: directory.name,
12
+ children: []
13
+ });
14
+ });
15
+ const roots = [];
16
+ directories.forEach((directory)=>{
17
+ const node = nodes.get(directory.directoryPath);
18
+ const parentPath = getParentDirectoryPath(directory.directoryPath, directory.relativePath);
19
+ const parentNode = parentPath ? nodes.get(parentPath) : void 0;
20
+ if (!node) return;
21
+ if (parentNode) return void parentNode.children.push(node);
22
+ roots.push(node);
23
+ });
24
+ const normalizeTree = (items)=>items.map((item)=>({
25
+ id: item.id,
26
+ name: item.name,
27
+ ...item.children.length ? {
28
+ children: normalizeTree(item.children)
29
+ } : {}
30
+ }));
31
+ return normalizeTree(roots);
32
+ };
33
+ const data = [
34
+ {
35
+ __typename: "Directory",
36
+ directoryPath: ".0.11.7035.7384.9937.",
37
+ id: 9943,
38
+ level: 4,
39
+ name: "kvtest4",
40
+ parentObjectId: 7384,
41
+ relativePath: ".9937."
42
+ },
43
+ {
44
+ __typename: "Directory",
45
+ directoryPath: ".0.11.7035.7384.10595.",
46
+ id: 133212,
47
+ level: 4,
48
+ name: "KV_OK",
49
+ parentObjectId: 7384,
50
+ relativePath: ".10595."
51
+ },
52
+ {
53
+ __typename: "Directory",
54
+ directoryPath: ".0.11.7035.7384.11714.",
55
+ id: 133230,
56
+ level: 4,
57
+ name: "Workspace của Log",
58
+ parentObjectId: 7384,
59
+ relativePath: ".11714."
60
+ },
61
+ {
62
+ __typename: "Directory",
63
+ directoryPath: ".0.11.7035.7384.12715.",
64
+ id: 133248,
65
+ level: 4,
66
+ name: "Workspace Log and Log",
67
+ parentObjectId: 7384,
68
+ relativePath: ".12715."
69
+ },
70
+ {
71
+ __typename: "Directory",
72
+ directoryPath: ".0.11.7035.7384.13840.",
73
+ id: 133268,
74
+ level: 4,
75
+ name: "aaa",
76
+ parentObjectId: 7384,
77
+ relativePath: ".13840."
78
+ },
79
+ {
80
+ __typename: "Directory",
81
+ directoryPath: ".0.11.7035.7384.15109.",
82
+ id: 133289,
83
+ level: 4,
84
+ name: "WS_LinhTest",
85
+ parentObjectId: 7384,
86
+ relativePath: ".15109."
87
+ },
88
+ {
89
+ __typename: "Directory",
90
+ directoryPath: ".0.11.7035.7384.15529.",
91
+ id: 133310,
92
+ level: 4,
93
+ name: "kvtest tiếp",
94
+ parentObjectId: 7384,
95
+ relativePath: ".15529."
96
+ },
97
+ {
98
+ __typename: "Directory",
99
+ directoryPath: ".0.11.7035.7384.17013.",
100
+ id: 133328,
101
+ level: 4,
102
+ name: "kvTestAuthenprofile",
103
+ parentObjectId: 7384,
104
+ relativePath: ".17013."
105
+ },
106
+ {
107
+ __typename: "Directory",
108
+ directoryPath: ".0.11.7035.7384.18507.",
109
+ id: 133346,
110
+ level: 4,
111
+ name: "KvTestStorage",
112
+ parentObjectId: 7384,
113
+ relativePath: ".18507."
114
+ },
115
+ {
116
+ __typename: "Directory",
117
+ directoryPath: ".0.11.7035.7384.21223.",
118
+ id: 133366,
119
+ level: 4,
120
+ name: "Đổi tên lần 2",
121
+ parentObjectId: 7384,
122
+ relativePath: ".21223."
123
+ },
124
+ {
125
+ __typename: "Directory",
126
+ directoryPath: ".0.11.7035.7384.26738.",
127
+ id: 133419,
128
+ level: 4,
129
+ name: "KV_test10",
130
+ parentObjectId: 7384,
131
+ relativePath: ".26738."
132
+ },
133
+ {
134
+ __typename: "Directory",
135
+ directoryPath: ".0.11.7035.7384.28343.",
136
+ id: 133433,
137
+ level: 4,
138
+ name: "kv_test11",
139
+ parentObjectId: 7384,
140
+ relativePath: ".28343."
141
+ },
142
+ {
143
+ __typename: "Directory",
144
+ directoryPath: ".0.11.7035.7384.30258.",
145
+ id: 133451,
146
+ level: 4,
147
+ name: "kv_test100",
148
+ parentObjectId: 7384,
149
+ relativePath: ".30258."
150
+ },
151
+ {
152
+ __typename: "Directory",
153
+ directoryPath: ".0.11.7035.7384.32315.",
154
+ id: 133469,
155
+ level: 4,
156
+ name: "kv_test101",
157
+ parentObjectId: 7384,
158
+ relativePath: ".32315."
159
+ },
160
+ {
161
+ __typename: "Directory",
162
+ directoryPath: ".0.11.7035.7384.40741.",
163
+ id: 133522,
164
+ level: 4,
165
+ name: "KVtest0",
166
+ parentObjectId: 7384,
167
+ relativePath: ".40741."
168
+ },
169
+ {
170
+ __typename: "Directory",
171
+ directoryPath: ".0.11.7035.7384.52082.",
172
+ id: 134693,
173
+ level: 4,
174
+ name: "AKKA",
175
+ parentObjectId: 7384,
176
+ relativePath: ".52082."
177
+ },
178
+ {
179
+ __typename: "Directory",
180
+ directoryPath: ".0.11.7035.7384.52330.",
181
+ id: 134727,
182
+ level: 4,
183
+ name: "AWING 002",
184
+ parentObjectId: 7384,
185
+ relativePath: ".52330."
186
+ },
187
+ {
188
+ __typename: "Directory",
189
+ directoryPath: ".0.11.7035.7384.58698.",
190
+ id: 135059,
191
+ level: 4,
192
+ name: "AWING 004",
193
+ parentObjectId: 7384,
194
+ relativePath: ".58698."
195
+ },
196
+ {
197
+ __typename: "Directory",
198
+ directoryPath: ".0.11.7035.7384.59249.",
199
+ id: 135130,
200
+ level: 4,
201
+ name: "QA test QA",
202
+ parentObjectId: 7384,
203
+ relativePath: ".59249."
204
+ },
205
+ {
206
+ __typename: "Directory",
207
+ directoryPath: ".0.11.7035.7384.59599.",
208
+ id: 135158,
209
+ level: 4,
210
+ name: "QA_WS_New_07.01",
211
+ parentObjectId: 7384,
212
+ relativePath: ".59599."
213
+ },
214
+ {
215
+ __typename: "Directory",
216
+ directoryPath: ".0.11.7035.7384.60757.",
217
+ id: 135209,
218
+ level: 4,
219
+ name: "QA_WS_new_08.01_2",
220
+ parentObjectId: 7384,
221
+ relativePath: ".60757."
222
+ },
223
+ {
224
+ __typename: "Directory",
225
+ directoryPath: ".0.11.7035.7384.70867.",
226
+ id: 135242,
227
+ level: 4,
228
+ name: "AWING QA 007",
229
+ parentObjectId: 7384,
230
+ relativePath: ".70867."
231
+ },
232
+ {
233
+ __typename: "Directory",
234
+ directoryPath: ".0.11.7035.7384.76283.",
235
+ id: 135262,
236
+ level: 4,
237
+ name: "QA_NhatNT",
238
+ parentObjectId: 7384,
239
+ relativePath: ".76283."
240
+ },
241
+ {
242
+ __typename: "Directory",
243
+ directoryPath: ".0.11.7035.7384.76904.",
244
+ id: 135299,
245
+ level: 4,
246
+ name: "QA_WS_12.01",
247
+ parentObjectId: 7384,
248
+ relativePath: ".76904."
249
+ },
250
+ {
251
+ __typename: "Directory",
252
+ directoryPath: ".0.11.7035.7384.77360.",
253
+ id: 135344,
254
+ level: 4,
255
+ name: "QA Test QA 2",
256
+ parentObjectId: 7384,
257
+ relativePath: ".77360."
258
+ },
259
+ {
260
+ __typename: "Directory",
261
+ directoryPath: ".0.11.7035.7384.93697.",
262
+ id: 135382,
263
+ level: 4,
264
+ name: "QA test QA 3",
265
+ parentObjectId: 7384,
266
+ relativePath: ".93697."
267
+ },
268
+ {
269
+ __typename: "Directory",
270
+ directoryPath: ".0.11.7035.7384.94037.",
271
+ id: 135405,
272
+ level: 4,
273
+ name: "QA_NhatNT_test01",
274
+ parentObjectId: 7384,
275
+ relativePath: ".94037."
276
+ },
277
+ {
278
+ __typename: "Directory",
279
+ directoryPath: ".0.11.7035.7384.94839.",
280
+ id: 135456,
281
+ level: 4,
282
+ name: "QA_15.01_1",
283
+ parentObjectId: 7384,
284
+ relativePath: ".94839."
285
+ },
286
+ {
287
+ __typename: "Directory",
288
+ directoryPath: ".0.11.7035.7384.95204.",
289
+ id: 135475,
290
+ level: 4,
291
+ name: "QA_15.01_2",
292
+ parentObjectId: 7384,
293
+ relativePath: ".95204."
294
+ },
295
+ {
296
+ __typename: "Directory",
297
+ directoryPath: ".0.11.7035.7384.95492.",
298
+ id: 135493,
299
+ level: 4,
300
+ name: "QA_NhatNT_Test02",
301
+ parentObjectId: 7384,
302
+ relativePath: ".95492."
303
+ },
304
+ {
305
+ __typename: "Directory",
306
+ directoryPath: ".0.11.7035.7384.96450.",
307
+ id: 135529,
308
+ level: 4,
309
+ name: "AKtest123",
310
+ parentObjectId: 7384,
311
+ relativePath: ".96450."
312
+ },
313
+ {
314
+ __typename: "Directory",
315
+ directoryPath: ".0.11.7035.7384.96749.",
316
+ id: 135555,
317
+ level: 4,
318
+ name: "WS_New_27/01",
319
+ parentObjectId: 7384,
320
+ relativePath: ".96749."
321
+ },
322
+ {
323
+ __typename: "Directory",
324
+ directoryPath: ".0.11.7035.7384.98362.",
325
+ id: 135634,
326
+ level: 4,
327
+ name: "QA_WS_27.01_4",
328
+ parentObjectId: 7384,
329
+ relativePath: ".98362."
330
+ },
331
+ {
332
+ __typename: "Directory",
333
+ directoryPath: ".0.11.7035.7384.100701.",
334
+ id: 135676,
335
+ level: 4,
336
+ name: "Hạ tầng 2",
337
+ parentObjectId: 7384,
338
+ relativePath: ".100701."
339
+ },
340
+ {
341
+ __typename: "Directory",
342
+ directoryPath: ".0.11.7035.7384.101111.",
343
+ id: 135730,
344
+ level: 4,
345
+ name: "WS_new_29.01_1",
346
+ parentObjectId: 7384,
347
+ relativePath: ".101111."
348
+ },
349
+ {
350
+ __typename: "Directory",
351
+ directoryPath: ".0.11.7035.7384.102467.",
352
+ id: 135824,
353
+ level: 4,
354
+ name: "QA_WS_04.02",
355
+ parentObjectId: 7384,
356
+ relativePath: ".102467."
357
+ },
358
+ {
359
+ __typename: "Directory",
360
+ directoryPath: ".0.11.7035.7384.102798.",
361
+ id: 135842,
362
+ level: 4,
363
+ name: "QA_New_WS_11.02_1",
364
+ parentObjectId: 7384,
365
+ relativePath: ".102798."
366
+ },
367
+ {
368
+ __typename: "Directory",
369
+ directoryPath: ".0.11.7035.7384.103109.",
370
+ id: 135943,
371
+ level: 4,
372
+ name: "QA_test_25.02",
373
+ parentObjectId: 7384,
374
+ relativePath: ".103109."
375
+ },
376
+ {
377
+ __typename: "Directory",
378
+ directoryPath: ".0.11.7035.7384.104674.",
379
+ id: 136046,
380
+ level: 4,
381
+ name: "QA_WS_002",
382
+ parentObjectId: 7384,
383
+ relativePath: ".104674."
384
+ },
385
+ {
386
+ __typename: "Directory",
387
+ directoryPath: ".0.11.7035.7384.104940.",
388
+ id: 151656,
389
+ level: 4,
390
+ name: "QA_WS_003",
391
+ parentObjectId: 7384,
392
+ relativePath: ".104940."
393
+ },
394
+ {
395
+ __typename: "Directory",
396
+ directoryPath: ".0.11.7035.7384.105450.",
397
+ id: 136140,
398
+ level: 4,
399
+ name: "QA_WS_004",
400
+ parentObjectId: 7384,
401
+ relativePath: ".105450."
402
+ },
403
+ {
404
+ __typename: "Directory",
405
+ directoryPath: ".0.11.7035.7384.105716.",
406
+ id: 136166,
407
+ level: 4,
408
+ name: "QA_WS_005",
409
+ parentObjectId: 7384,
410
+ relativePath: ".105716."
411
+ },
412
+ {
413
+ __typename: "Directory",
414
+ directoryPath: ".0.11.7035.7384.109266.",
415
+ id: 136203,
416
+ level: 4,
417
+ name: "QA_WS_006",
418
+ parentObjectId: 7384,
419
+ relativePath: ".109266."
420
+ },
421
+ {
422
+ __typename: "Directory",
423
+ directoryPath: ".0.11.7035.7384.109849.",
424
+ id: 136240,
425
+ level: 4,
426
+ name: "LongCommit Workspace",
427
+ parentObjectId: 7384,
428
+ relativePath: ".109849."
429
+ },
430
+ {
431
+ __typename: "Directory",
432
+ directoryPath: ".0.11.7035.7384.110879.",
433
+ id: 136325,
434
+ level: 4,
435
+ name: "LinhWs",
436
+ parentObjectId: 7384,
437
+ relativePath: ".110879."
438
+ }
439
+ ];
440
+ const data_demo = data;
441
+ const folderTreeOptions = convertDirectoriesToFolderTreeOptions(data);
442
+ export { convertDirectoriesToFolderTreeOptions, data_demo as default, folderTreeOptions };
@@ -1,26 +1,30 @@
1
1
  import { AutocompleteChangeDetails, TextFieldVariants } from '@mui/material';
2
2
  import { IOption } from './interface';
3
- export interface IMultipleChoiceComponentProps<Value = IOption> {
3
+ export interface IMultipleChoiceOption extends IOption {
4
+ children?: IMultipleChoiceOption[];
5
+ }
6
+ export interface IMultipleChoiceComponentProps<Value = IMultipleChoiceOption> {
4
7
  label?: string;
5
- options: IOption[];
8
+ options: IMultipleChoiceOption[];
6
9
  placeholder?: string;
7
10
  popupOpen?: boolean;
8
11
  variant?: TextFieldVariants;
9
12
  error?: boolean;
10
13
  helperText?: string;
11
14
  operators?: IOption[];
12
- selected: IOption[];
13
- onChange: (event: React.SyntheticEvent, value: IOption[], reason: string, details?: AutocompleteChangeDetails<Value>) => void;
15
+ selected: IMultipleChoiceOption[];
16
+ onChange: (event: React.SyntheticEvent, value: IMultipleChoiceOption[], reason: string, details?: AutocompleteChangeDetails<Value>) => void;
14
17
  onOpen: (e: React.SyntheticEvent) => void;
15
18
  onClose: (e: React.SyntheticEvent, reason: string) => void;
16
19
  operator?: string;
17
20
  onOperatorChange?: (operator: string) => void;
21
+ isFolderTree?: boolean;
18
22
  }
19
23
  export interface IMultipleChoiceProps extends Omit<IMultipleChoiceComponentProps, 'selected' | 'onChange' | 'onOpen' | 'onClose' | 'operator' | 'onOperatorChange'> {
20
24
  operators?: IOption[];
21
- onChange: (values: IOption[]) => void;
22
- value?: IOption[];
23
- defaultValue?: IOption[];
25
+ onChange: (values: IMultipleChoiceOption[]) => void;
26
+ value?: IMultipleChoiceOption[];
27
+ defaultValue?: IMultipleChoiceOption[];
24
28
  endAdornmentOptions?: 'use-logic-operator' | IOption[];
25
29
  endAdornmentValue?: string;
26
30
  onEndAdornmentValueChange?: (operator: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleChoice/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,6BAA6B,CAAC,KAAK,GAAG,OAAO;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;IACtB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,yBAAyB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IAC9H,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc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cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../../src/AWING/PlaceFilter/Input/component/MultiSelect.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,WAAW,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAiBjF,CAAC"}
1
+ {"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../../src/AWING/PlaceFilter/Input/component/MultiSelect.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,WAAW,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAsBjF,CAAC"}
@@ -12,6 +12,7 @@ const renderMultiSelect = ({ filterField, index, onChange })=>/*#__PURE__*/ jsx(
12
12
  },
13
13
  value: filterField.value,
14
14
  endAdornmentOptions: filterField?.endAdornmentOptions,
15
- endAdornmentValue: filterField?.endAdornmentValue
15
+ endAdornmentValue: filterField?.endAdornmentValue,
16
+ isFolderTree: filterField?.isFolderTree
16
17
  });
17
18
  export { renderMultiSelect };
@@ -68,6 +68,7 @@ export interface IMultipleSelect extends IFilterFieldBase {
68
68
  value: IOption[];
69
69
  endAdornmentOptions?: typeof USE_LOGIC_OPERATOR | IOption[];
70
70
  endAdornmentValue?: string;
71
+ isFolderTree?: boolean;
71
72
  }
72
73
  export type IFilterField = IText | IAreaSelect | ISelect | IMultipleHierarchicalChoice | IGeoFencing | IAutoComplete | IMultipleSelect;
73
74
  interface IFilterFieldInputProps<T extends IFilterField> {
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/AWING/PlaceFilter/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gCAAgC,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,OAAO;IACpB,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,IAAI;IACjB,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B,YAAY,CAAC,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAC1C,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE;QACH,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;KAC7B,CAAC;CACL;AAED,MAAM,WAAW,KAAM,SAAQ,gBAAgB;IAC3C,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,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