@dashadmin/dash-components 1.3.73 → 1.3.74-srcfree.2

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 (111) hide show
  1. package/dist/components/AuditLog/AuditLog.d.ts +27 -0
  2. package/dist/components/AutoCompleteArrayInput/AutoCompleteCheckBoxInput.d.ts +22 -0
  3. package/dist/components/AutoCompleteArrayInput/AutocompleteCheckBoxArrayInput.d.ts +7 -0
  4. package/dist/components/AutoCompleteArrayInputAutoSearch/AutoCompleteCheckBoxInput.d.ts +22 -0
  5. package/dist/components/AutoCompleteArrayInputAutoSearch/AutocompleteCheckBoxArrayInput.d.ts +7 -0
  6. package/dist/components/Json/Json.d.ts +5 -0
  7. package/dist/components/JsonColorSelector/JsonColorSelector.d.ts +5 -0
  8. package/dist/components/JsonColorSelector/JsonColorSelectorEnhanced.d.ts +4 -0
  9. package/dist/components/JsonColorSelector/JsonCssVarValues.d.ts +5 -0
  10. package/dist/components/JsonColorSelector/components/BasicColorSelector.d.ts +9 -0
  11. package/dist/components/JsonColorSelector/components/ColorEditDialog.d.ts +12 -0
  12. package/dist/components/JsonColorSelector/components/ColorPaletteItem.d.ts +7 -0
  13. package/dist/components/JsonColorSelector/components/ImageColorExtractor.d.ts +9 -0
  14. package/dist/components/JsonColorSelector/helpers/functions.d.ts +11 -0
  15. package/dist/components/JsonColorSelector/helpers/paletteDerivation.d.ts +37 -0
  16. package/{src/components/JsonColorSelector/interfaces/interfaces.tsx → dist/components/JsonColorSelector/interfaces/interfaces.d.ts} +6 -8
  17. package/dist/components/JsonColorSelector/useAsyncColorThief.d.ts +11 -0
  18. package/dist/components/ListActive/ListActive.d.ts +10 -0
  19. package/dist/components/ListActive/ListBoolean.d.ts +10 -0
  20. package/dist/components/NotificationPreferences/NotificationPreferences.d.ts +6 -0
  21. package/dist/components/SearchableSelects/RASearchableSelect.d.ts +25 -0
  22. package/dist/components/SearchableSelects/RASearchableSelectCheckboxes.d.ts +35 -0
  23. package/dist/components/SearchableSelects/RASearchableSelectChips.d.ts +33 -0
  24. package/dist/components/SearchableSelects/RASearchableSelectChipsRecordContext.d.ts +30 -0
  25. package/dist/components/SearchableSelects/SearchableSelect.d.ts +25 -0
  26. package/dist/components/SearchableSelects/SearchableSelectCheckboxes.d.ts +29 -0
  27. package/dist/components/SortableDataGrid/SortableDataGrid.d.ts +7 -0
  28. package/dist/components/SortableDataGrid/SortableDataGridBody.d.ts +7 -0
  29. package/dist/components/SortableDataGrid/SortableDataGridHeader.d.ts +6 -0
  30. package/dist/components/SortableDataGrid/SortableDataGridRow.d.ts +5 -0
  31. package/dist/components/Upload/SingleImageUploader.d.ts +8 -0
  32. package/dist/components/custom/PackageCopyMethod.d.ts +15 -0
  33. package/dist/components/custom/PackageRadioButtonGroup.d.ts +8 -0
  34. package/dist/components/dialog/Basic.d.ts +2 -0
  35. package/dist/components/dialog/Correct.d.ts +2 -0
  36. package/dist/components/dialog/Error.d.ts +2 -0
  37. package/dist/components/dialog/Info.d.ts +2 -0
  38. package/dist/components/dialog/InfoV2.d.ts +2 -0
  39. package/dist/components/dialog/NotFound.d.ts +2 -0
  40. package/dist/components/dialog/QuickSearch.d.ts +6 -0
  41. package/dist/components/notifications/NotificationsCenter.d.ts +109 -0
  42. package/dist/components/notifications/index.d.ts +2 -0
  43. package/dist/components/tables/PaginationComponent.d.ts +4 -0
  44. package/dist/components/theme/AppLoadingFallback.d.ts +6 -0
  45. package/dist/components/theme/ErrorBoundary.d.ts +19 -0
  46. package/dist/components/theme/InitialLoader.d.ts +3 -0
  47. package/dist/components/theme/NotFound.d.ts +13 -0
  48. package/dist/components/theme/NotResults.d.ts +7 -0
  49. package/dist/hooks/useDraggable.d.ts +1 -0
  50. package/dist/hooks/useNotifications.d.ts +2 -0
  51. package/dist/hooks/useQuickSearch.d.ts +6 -0
  52. package/{src/index.tsx → dist/index.d.ts} +10 -58
  53. package/dist/utils/setNativeValue.d.ts +2 -0
  54. package/package.json +24 -21
  55. package/src/components/AuditLog/AuditLog.tsx +0 -490
  56. package/src/components/AutoCompleteArrayInput/AutoCompleteCheckBoxInput.tsx +0 -917
  57. package/src/components/AutoCompleteArrayInput/AutocompleteCheckBoxArrayInput.tsx +0 -39
  58. package/src/components/AutoCompleteArrayInputAutoSearch/AutoCompleteCheckBoxInput.tsx +0 -916
  59. package/src/components/AutoCompleteArrayInputAutoSearch/AutocompleteCheckBoxArrayAutoSearch.tsx.wip +0 -42
  60. package/src/components/AutoCompleteArrayInputAutoSearch/AutocompleteCheckBoxArrayInput.tsx +0 -44
  61. package/src/components/Json/Json.tsx +0 -312
  62. package/src/components/JsonColorSelector/JsonColorSelector.tsx +0 -1443
  63. package/src/components/JsonColorSelector/JsonColorSelector.tsx.bkup +0 -746
  64. package/src/components/JsonColorSelector/JsonColorSelectorEnhanced.tsx +0 -1135
  65. package/src/components/JsonColorSelector/JsonCssVarValues.tsx +0 -867
  66. package/src/components/JsonColorSelector/components/BasicColorSelector.tsx +0 -333
  67. package/src/components/JsonColorSelector/components/ColorEditDialog.tsx +0 -495
  68. package/src/components/JsonColorSelector/components/ColorPaletteItem.tsx +0 -80
  69. package/src/components/JsonColorSelector/components/ImageColorExtractor.tsx +0 -420
  70. package/src/components/JsonColorSelector/helpers/functions.tsx +0 -123
  71. package/src/components/JsonColorSelector/helpers/paletteDerivation.ts +0 -367
  72. package/src/components/JsonColorSelector/useAsyncColorThief.tsx +0 -97
  73. package/src/components/ListActive/ListActive.tsx +0 -106
  74. package/src/components/ListActive/ListBoolean.tsx +0 -96
  75. package/src/components/NotificationPreferences/NotificationPreferences.tsx +0 -480
  76. package/src/components/SearchableSelects/RASearchableSelect.tsx +0 -303
  77. package/src/components/SearchableSelects/RASearchableSelectCheckboxes.tsx +0 -617
  78. package/src/components/SearchableSelects/RASearchableSelectChips.tsx +0 -561
  79. package/src/components/SearchableSelects/RASearchableSelectChipsRecordContext.tsx +0 -366
  80. package/src/components/SearchableSelects/SearchableSelect.tsx +0 -323
  81. package/src/components/SearchableSelects/SearchableSelectCheckboxes.tsx +0 -358
  82. package/src/components/SortableDataGrid/README.md +0 -1
  83. package/src/components/SortableDataGrid/SortableDataGrid.tsx +0 -56
  84. package/src/components/SortableDataGrid/SortableDataGridBody.tsx +0 -175
  85. package/src/components/SortableDataGrid/SortableDataGridHeader.tsx +0 -171
  86. package/src/components/SortableDataGrid/SortableDataGridRow.tsx +0 -247
  87. package/src/components/Upload/SingleImageUploader.tsx +0 -55
  88. package/src/components/custom/PackageCopyMethod.tsx +0 -109
  89. package/src/components/custom/PackageRadioButtonGroup.tsx +0 -49
  90. package/src/components/dialog/Basic.tsx +0 -11
  91. package/src/components/dialog/Correct.tsx +0 -16
  92. package/src/components/dialog/Error.tsx +0 -15
  93. package/src/components/dialog/Info.tsx +0 -15
  94. package/src/components/dialog/InfoV2.tsx +0 -35
  95. package/src/components/dialog/NotFound.tsx +0 -18
  96. package/src/components/dialog/QuickSearch.tsx +0 -115
  97. package/src/components/notifications/NotificationsCenter.tsx +0 -743
  98. package/src/components/notifications/index.ts +0 -42
  99. package/src/components/tables/PaginationComponent.tsx +0 -17
  100. package/src/components/theme/AppLoadingFallback.tsx +0 -42
  101. package/src/components/theme/ErrorBoundary.tsx +0 -57
  102. package/src/components/theme/InitialLoader.tsx +0 -16
  103. package/src/components/theme/NotFound.tsx +0 -124
  104. package/src/components/theme/NotResults.tsx +0 -56
  105. package/src/hooks/useDraggable.ts +0 -11
  106. package/src/hooks/useNotifications.ts +0 -14
  107. package/src/hooks/useQuickSearch.tsx +0 -29
  108. package/src/styles/index.less +0 -0
  109. package/src/utils/setNativeValue.tsx +0 -23
  110. /package/{src/components/AuditLog/index.ts → dist/components/AuditLog/index.d.ts} +0 -0
  111. /package/{src/components/NotificationPreferences/index.tsx → dist/components/NotificationPreferences/index.d.ts} +0 -0
@@ -1,303 +0,0 @@
1
- /**
2
- * ISearchableSelect for AutoAdmin for ReactAdmin
3
- * @author Franisco Aranda <francisco.aranda@sudo.cl> <faranda@gmail.com>
4
- */
5
-
6
- import {
7
- Autocomplete,
8
- Box,
9
- CircularProgress,
10
- InputLabel,
11
- TextField,
12
- } from "@mui/material";
13
- import React, { useEffect, useState } from "react";
14
- import { useController } from "react-hook-form";
15
- import { useGetList } from "react-admin";
16
-
17
- import { useRecordContext } from "react-admin";
18
- import { Loading } from "react-admin";
19
- import { isArray } from "lodash";
20
- import { IDashAutoAdminCustomFieldComponent } from "dash-auto-admin";
21
-
22
- interface ISearchableSelect extends IDashAutoAdminCustomFieldComponent {
23
- name?: string;
24
- resource?: string;
25
- selectLabel?: string;
26
- title?: string;
27
- renderText?: (object: any) => any;
28
- transformData?: (val: string) => any;
29
- defaultValues?: any;
30
- isMultiple?: boolean;
31
- //pagination?: boolean,
32
- minSearch?: number;
33
- searchResults?: number;
34
- timerSearch?: number;
35
- isEmpty?: boolean;
36
- filter?: { [x: string]: any };
37
- queryFilter?: string;
38
- isOptionEqualToValue?: (option, value) => boolean;
39
- viewAttribute: string;
40
- elementKeyId?: string;
41
- }
42
-
43
- const SearchableSelect: React.FC<ISearchableSelect> = ({
44
- method,
45
- attribute,
46
- isMultiple = false,
47
- //pagination = true,
48
- searchResults = 50,
49
- minSearch = 3,
50
- timerSearch = 500,
51
- resource,
52
- selectLabel,
53
- renderText,
54
- transformData,
55
- queryFilter = "q",
56
- defaultValues = undefined,
57
- isEmpty = false,
58
- filter,
59
- isOptionEqualToValue = undefined,
60
- viewAttribute = null,
61
- elementKeyId = "id",
62
- }) => {
63
- //const element_key = "system_marketplace_category_id";
64
- const [open, setOpen] = useState(true);
65
- /* parsedOptions se setea null, esto para que el control no aparezca hasta que se obtenga la data */
66
- const [parsedOptions, setParsedOptions] = useState(null);
67
- const [q, setQ] = useState("");
68
- const record = useRecordContext();
69
- const field = useController({
70
- name: attribute.attribute,
71
- defaultValue: record ? record[attribute.attribute] : null,
72
- });
73
-
74
- const includes =
75
- record &&
76
- record[attribute.attribute] &&
77
- isArray(record[attribute.attribute])
78
- ? record[attribute.attribute].map((element) =>
79
- element.hasOwnProperty(elementKeyId)
80
- ? element[elementKeyId]
81
- : element
82
- )
83
- : record[attribute.attribute];
84
-
85
- const {
86
- data: resourceData,
87
- total,
88
- isLoading,
89
- error,
90
- } = useGetList(
91
- resource,
92
- {
93
- filter: { [queryFilter]: q, ...filter, includes: includes },
94
- },
95
- { refetchOnWindowFocus: false }
96
- );
97
-
98
- useEffect(() => {
99
- if (resourceData && !isLoading) {
100
- //Le agrega el key, para evitar el warning de react.
101
- //setParsedOptions([...parsedOptions,...resourceData.map(ele => { return {...ele,key:"option"+ele.id}})])
102
- if (parsedOptions)
103
- setParsedOptions([
104
- ...parsedOptions,
105
- ...resourceData.map((ele) => {
106
- return { ...ele, key: "option" + ele.id };
107
- }),
108
- ]);
109
- setParsedOptions(
110
- resourceData.map((ele) => {
111
- return { ...ele, key: "option" + ele.id };
112
- })
113
- );
114
- } /*else {
115
- // Setea la data a un arreglo vacío, ya que si es null, se ocultará el componente.
116
- //setParsedOptions([]);
117
- }*/
118
- return () => setParsedOptions([]);
119
- // TODO! reset callback, empty parsedOptions.
120
- }, [resourceData, isLoading]);
121
-
122
- const [timeOutSearch, setTimeOutSearch] = useState(undefined);
123
-
124
- const debounce = (fn: Function, delay = 500) => {
125
- clearTimeout(timeOutSearch);
126
- setTimeOutSearch(
127
- setTimeout(() => {
128
- fn();
129
- }, delay)
130
- );
131
- };
132
-
133
- return (
134
- <>
135
- {parsedOptions && (
136
- <Autocomplete
137
- key={"autocomplete-" + attribute.attribute}
138
- multiple={isMultiple}
139
- loading={isLoading && open}
140
- //sx={{ width: 373 }}
141
- fullWidth
142
- freeSolo={true}
143
- //options={!resourceData ? [] : !defaultValues ? resourceData : resourceData}
144
- //options={resourceData ? resourceData.map(ele => { return {...ele,key:ele.id}} ) : []}
145
- options={parsedOptions}
146
- open={open}
147
- onOpen={() => setOpen(true)}
148
- onClose={() => setOpen(false)}
149
- /*defaultValue={field.field?.value && field.field.value.map(item => parsedOptions.find(
150
- (element) => {
151
-
152
- return element.id === item.id
153
- }))}*/
154
- //value={isOptionEqualToValue && parsedOptions ? parsedOptions.find(ele => isOptionEqualToValue(ele,field.field.value))[viewAttribute] : field.field.value}
155
-
156
- defaultValue={field.field?.value}
157
- //value={field.field.value}
158
-
159
- isOptionEqualToValue={isOptionEqualToValue}
160
- autoHighlight
161
- //{...(!isEmpty && { value: field.field.value })}
162
- //{...(isEmpty && { renderTags: (value, getTagProps) => <></> })}
163
- // 8
164
-
165
- getOptionLabel={(option: any) => {
166
- const _option = !Array.isArray(option) // si es un numero como 'id', busca la opción en los valores con isOptionEqualToValue, sino devuelve el objeto original.
167
- ? parsedOptions &&
168
- parsedOptions.find((ele) =>
169
- isOptionEqualToValue(ele, field.field.value)
170
- )
171
- : option;
172
- if (!_option) return q; //es posbile que no se haya encontrado en parsedOptions o que parsedOptions aún no esté definido.
173
- const r =
174
- viewAttribute && !renderText
175
- ? _option[viewAttribute]
176
- : renderText(_option);
177
- console.log(
178
- "getOptionLabel",
179
- parsedOptions.find((ele) =>
180
- isOptionEqualToValue(ele, field.field.value)
181
- ),
182
- r
183
- );
184
- if (!r) return q;
185
- return r;
186
- }}
187
- //getOptionLabel={(option: any) => option}
188
-
189
- renderOption={(props, option: any) => {
190
- const { key, ...newProps } = props as any;
191
-
192
- return (
193
- <Box
194
- key={option.key}
195
- component="li"
196
- sx={{ "& > img": { mr: 2, flexShrink: 0 } }}
197
- {...newProps}
198
- >
199
- {viewAttribute && !renderText
200
- ? option[viewAttribute]
201
- : renderText(option)}
202
- </Box>
203
- );
204
- }}
205
- onChange={(event: any, rawValue) => {
206
- console.log("onChange", event, rawValue);
207
- let newValue = rawValue;
208
-
209
- if (Array.isArray(rawValue)) {
210
- newValue = isEmpty
211
- ? [...rawValue, ...field.field.value]
212
- : [
213
- ...new Map(
214
- newValue.map((v) => [v.id, v])
215
- ).values(),
216
- ];
217
- }
218
- transformData
219
- ? field.field.onChange(transformData(newValue))
220
- : field.field.onChange(newValue);
221
- }}
222
- renderInput={(params) => {
223
- console.log("renderInput", params.id);
224
- return (
225
- <TextField
226
- key={params.id}
227
- {...params}
228
- label={selectLabel}
229
- variant="outlined"
230
- onChange={(ev) => {
231
- // dont fire API if the user delete or not entered anything
232
- let searchValue = ev.target.value;
233
- //onSearch={(searchValue) => {}
234
-
235
- if (
236
- searchValue &&
237
- searchValue !== "" &&
238
- searchValue.length >= minSearch
239
- )
240
- debounce(
241
- () => setQ(searchValue),
242
- timerSearch
243
- );
244
-
245
- /*if (ev.target.value !== "" || ev.target.value !== null) {
246
- setQ(ev.target.value);
247
- }*/
248
- }}
249
- slotProps={{
250
- ...params.slotProps,
251
-
252
- input: {
253
- ...params.slotProps.input,
254
- autoComplete: "new-password",
255
- endAdornment: (
256
- <>
257
- {isLoading ? (
258
- <CircularProgress
259
- color="inherit"
260
- size={20}
261
- />
262
- ) : null}
263
- {params.slotProps.input.endAdornment}
264
- </>
265
- ),
266
- }
267
- }}
268
- />
269
- );
270
- }}
271
- />
272
- )}
273
- </>
274
- );
275
- };
276
-
277
- const RASearchableSelect = ({
278
- method,
279
- attribute,
280
- ...props
281
- }: ISearchableSelect) => {
282
- switch (method) {
283
- case "edit":
284
- case "create":
285
- return (
286
- <SearchableSelect
287
- attribute={attribute}
288
- method={method}
289
- {...props}
290
- />
291
- );
292
- case "view":
293
- return (
294
- <SearchableSelect
295
- attribute={attribute}
296
- method={method}
297
- {...props}
298
- />
299
- );
300
- }
301
- };
302
-
303
- export default RASearchableSelect;