unifyedx-storybook-new 0.1.39 → 0.1.41
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.
|
@@ -5,9 +5,6 @@ import { Popover as Popover$1, PopoverButton, PopoverPanel, Transition, Dialog,
|
|
|
5
5
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
6
6
|
import { useFloating, offset as offset$2, flip as flip$2, shift as shift$2, autoUpdate as autoUpdate$1, useClick, useDismiss, useInteractions, FloatingPortal } from '@floating-ui/react';
|
|
7
7
|
import { unstable_batchedUpdates, createPortal } from 'react-dom';
|
|
8
|
-
import { CKEditor } from '@ckeditor/ckeditor5-react';
|
|
9
|
-
import { Essentials, Paragraph, Heading, Alignment, BlockQuote, Bold, Italic, Underline, Strikethrough, Link, List, Indent, IndentBlock, Table, SourceEditing, Undo, ClassicEditor } from 'ckeditor5';
|
|
10
|
-
import 'ckeditor5/ckeditor5.css';
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -126,11 +123,11 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
126
123
|
*/
|
|
127
124
|
|
|
128
125
|
|
|
129
|
-
const __iconNode$
|
|
126
|
+
const __iconNode$w = [
|
|
130
127
|
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
131
128
|
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
132
129
|
];
|
|
133
|
-
const ArrowLeft = createLucideIcon("arrow-left", __iconNode$
|
|
130
|
+
const ArrowLeft = createLucideIcon("arrow-left", __iconNode$w);
|
|
134
131
|
|
|
135
132
|
/**
|
|
136
133
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -140,13 +137,13 @@ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$o);
|
|
|
140
137
|
*/
|
|
141
138
|
|
|
142
139
|
|
|
143
|
-
const __iconNode$
|
|
140
|
+
const __iconNode$v = [
|
|
144
141
|
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
145
142
|
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
146
143
|
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
147
144
|
["path", { d: "M3 10h18", key: "8toen8" }]
|
|
148
145
|
];
|
|
149
|
-
const Calendar$1 = createLucideIcon("calendar", __iconNode$
|
|
146
|
+
const Calendar$1 = createLucideIcon("calendar", __iconNode$v);
|
|
150
147
|
|
|
151
148
|
/**
|
|
152
149
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -156,8 +153,8 @@ const Calendar$1 = createLucideIcon("calendar", __iconNode$n);
|
|
|
156
153
|
*/
|
|
157
154
|
|
|
158
155
|
|
|
159
|
-
const __iconNode$
|
|
160
|
-
const Check = createLucideIcon("check", __iconNode$
|
|
156
|
+
const __iconNode$u = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
157
|
+
const Check = createLucideIcon("check", __iconNode$u);
|
|
161
158
|
|
|
162
159
|
/**
|
|
163
160
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -167,8 +164,8 @@ const Check = createLucideIcon("check", __iconNode$m);
|
|
|
167
164
|
*/
|
|
168
165
|
|
|
169
166
|
|
|
170
|
-
const __iconNode$
|
|
171
|
-
const ChevronDown = createLucideIcon("chevron-down", __iconNode$
|
|
167
|
+
const __iconNode$t = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
168
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode$t);
|
|
172
169
|
|
|
173
170
|
/**
|
|
174
171
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -178,11 +175,11 @@ const ChevronDown = createLucideIcon("chevron-down", __iconNode$l);
|
|
|
178
175
|
*/
|
|
179
176
|
|
|
180
177
|
|
|
181
|
-
const __iconNode$
|
|
178
|
+
const __iconNode$s = [
|
|
182
179
|
["path", { d: "m17 18-6-6 6-6", key: "1yerx2" }],
|
|
183
180
|
["path", { d: "M7 6v12", key: "1p53r6" }]
|
|
184
181
|
];
|
|
185
|
-
const ChevronFirst = createLucideIcon("chevron-first", __iconNode$
|
|
182
|
+
const ChevronFirst = createLucideIcon("chevron-first", __iconNode$s);
|
|
186
183
|
|
|
187
184
|
/**
|
|
188
185
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -192,11 +189,11 @@ const ChevronFirst = createLucideIcon("chevron-first", __iconNode$k);
|
|
|
192
189
|
*/
|
|
193
190
|
|
|
194
191
|
|
|
195
|
-
const __iconNode$
|
|
192
|
+
const __iconNode$r = [
|
|
196
193
|
["path", { d: "m7 18 6-6-6-6", key: "lwmzdw" }],
|
|
197
194
|
["path", { d: "M17 6v12", key: "1o0aio" }]
|
|
198
195
|
];
|
|
199
|
-
const ChevronLast = createLucideIcon("chevron-last", __iconNode$
|
|
196
|
+
const ChevronLast = createLucideIcon("chevron-last", __iconNode$r);
|
|
200
197
|
|
|
201
198
|
/**
|
|
202
199
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -206,8 +203,8 @@ const ChevronLast = createLucideIcon("chevron-last", __iconNode$j);
|
|
|
206
203
|
*/
|
|
207
204
|
|
|
208
205
|
|
|
209
|
-
const __iconNode$
|
|
210
|
-
const ChevronLeft = createLucideIcon("chevron-left", __iconNode$
|
|
206
|
+
const __iconNode$q = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
|
|
207
|
+
const ChevronLeft = createLucideIcon("chevron-left", __iconNode$q);
|
|
211
208
|
|
|
212
209
|
/**
|
|
213
210
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -217,8 +214,8 @@ const ChevronLeft = createLucideIcon("chevron-left", __iconNode$i);
|
|
|
217
214
|
*/
|
|
218
215
|
|
|
219
216
|
|
|
220
|
-
const __iconNode$
|
|
221
|
-
const ChevronRight = createLucideIcon("chevron-right", __iconNode$
|
|
217
|
+
const __iconNode$p = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
218
|
+
const ChevronRight = createLucideIcon("chevron-right", __iconNode$p);
|
|
222
219
|
|
|
223
220
|
/**
|
|
224
221
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -228,11 +225,11 @@ const ChevronRight = createLucideIcon("chevron-right", __iconNode$h);
|
|
|
228
225
|
*/
|
|
229
226
|
|
|
230
227
|
|
|
231
|
-
const __iconNode$
|
|
228
|
+
const __iconNode$o = [
|
|
232
229
|
["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
|
|
233
230
|
["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
|
|
234
231
|
];
|
|
235
|
-
const ChevronsUpDown = createLucideIcon("chevrons-up-down", __iconNode$
|
|
232
|
+
const ChevronsUpDown = createLucideIcon("chevrons-up-down", __iconNode$o);
|
|
236
233
|
|
|
237
234
|
/**
|
|
238
235
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -242,11 +239,11 @@ const ChevronsUpDown = createLucideIcon("chevrons-up-down", __iconNode$g);
|
|
|
242
239
|
*/
|
|
243
240
|
|
|
244
241
|
|
|
245
|
-
const __iconNode$
|
|
242
|
+
const __iconNode$n = [
|
|
246
243
|
["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
|
|
247
244
|
["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
|
|
248
245
|
];
|
|
249
|
-
const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$
|
|
246
|
+
const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$n);
|
|
250
247
|
|
|
251
248
|
/**
|
|
252
249
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -256,12 +253,12 @@ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$f);
|
|
|
256
253
|
*/
|
|
257
254
|
|
|
258
255
|
|
|
259
|
-
const __iconNode$
|
|
256
|
+
const __iconNode$m = [
|
|
260
257
|
["path", { d: "M12 13v8", key: "1l5pq0" }],
|
|
261
258
|
["path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242", key: "1pljnt" }],
|
|
262
259
|
["path", { d: "m8 17 4-4 4 4", key: "1quai1" }]
|
|
263
260
|
];
|
|
264
|
-
const CloudUpload = createLucideIcon("cloud-upload", __iconNode$
|
|
261
|
+
const CloudUpload = createLucideIcon("cloud-upload", __iconNode$m);
|
|
265
262
|
|
|
266
263
|
/**
|
|
267
264
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -271,12 +268,36 @@ const CloudUpload = createLucideIcon("cloud-upload", __iconNode$e);
|
|
|
271
268
|
*/
|
|
272
269
|
|
|
273
270
|
|
|
274
|
-
const __iconNode$
|
|
271
|
+
const __iconNode$l = [
|
|
272
|
+
["path", { d: "M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5", key: "1g2yzs" }],
|
|
273
|
+
["path", { d: "m14.3 19.6 1-.4", key: "11sv9r" }],
|
|
274
|
+
["path", { d: "M15 3v7.5", key: "7lm50a" }],
|
|
275
|
+
["path", { d: "m15.2 16.9-.9-.3", key: "1t7mvx" }],
|
|
276
|
+
["path", { d: "m16.6 21.7.3-.9", key: "1j67ps" }],
|
|
277
|
+
["path", { d: "m16.8 15.3-.4-1", key: "1ei7r6" }],
|
|
278
|
+
["path", { d: "m19.1 15.2.3-.9", key: "18r7jp" }],
|
|
279
|
+
["path", { d: "m19.6 21.7-.4-1", key: "z2vh2" }],
|
|
280
|
+
["path", { d: "m20.7 16.8 1-.4", key: "19m87a" }],
|
|
281
|
+
["path", { d: "m21.7 19.4-.9-.3", key: "1qgwi9" }],
|
|
282
|
+
["path", { d: "M9 3v18", key: "fh3hqa" }],
|
|
283
|
+
["circle", { cx: "18", cy: "18", r: "3", key: "1xkwt0" }]
|
|
284
|
+
];
|
|
285
|
+
const Columns3Cog = createLucideIcon("columns-3-cog", __iconNode$l);
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @license lucide-react v0.525.0 - ISC
|
|
289
|
+
*
|
|
290
|
+
* This source code is licensed under the ISC license.
|
|
291
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
292
|
+
*/
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
const __iconNode$k = [
|
|
275
296
|
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
276
297
|
["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
|
|
277
298
|
["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
|
|
278
299
|
];
|
|
279
|
-
const EllipsisVertical = createLucideIcon("ellipsis-vertical", __iconNode$
|
|
300
|
+
const EllipsisVertical = createLucideIcon("ellipsis-vertical", __iconNode$k);
|
|
280
301
|
|
|
281
302
|
/**
|
|
282
303
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -286,12 +307,12 @@ const EllipsisVertical = createLucideIcon("ellipsis-vertical", __iconNode$d);
|
|
|
286
307
|
*/
|
|
287
308
|
|
|
288
309
|
|
|
289
|
-
const __iconNode$
|
|
310
|
+
const __iconNode$j = [
|
|
290
311
|
["path", { d: "M12 17h.01", key: "p32p05" }],
|
|
291
312
|
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z", key: "1mlx9k" }],
|
|
292
313
|
["path", { d: "M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3", key: "mhlwft" }]
|
|
293
314
|
];
|
|
294
|
-
const FileQuestionMark = createLucideIcon("file-question-mark", __iconNode$
|
|
315
|
+
const FileQuestionMark = createLucideIcon("file-question-mark", __iconNode$j);
|
|
295
316
|
|
|
296
317
|
/**
|
|
297
318
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -301,7 +322,42 @@ const FileQuestionMark = createLucideIcon("file-question-mark", __iconNode$c);
|
|
|
301
322
|
*/
|
|
302
323
|
|
|
303
324
|
|
|
304
|
-
const __iconNode$
|
|
325
|
+
const __iconNode$i = [
|
|
326
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
327
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
328
|
+
["path", { d: "M8 13h2", key: "yr2amv" }],
|
|
329
|
+
["path", { d: "M14 13h2", key: "un5t4a" }],
|
|
330
|
+
["path", { d: "M8 17h2", key: "2yhykz" }],
|
|
331
|
+
["path", { d: "M14 17h2", key: "10kma7" }]
|
|
332
|
+
];
|
|
333
|
+
const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$i);
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* @license lucide-react v0.525.0 - ISC
|
|
337
|
+
*
|
|
338
|
+
* This source code is licensed under the ISC license.
|
|
339
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
+
*/
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
const __iconNode$h = [
|
|
344
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
345
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
346
|
+
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
347
|
+
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
348
|
+
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
349
|
+
];
|
|
350
|
+
const FileText = createLucideIcon("file-text", __iconNode$h);
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* @license lucide-react v0.525.0 - ISC
|
|
354
|
+
*
|
|
355
|
+
* This source code is licensed under the ISC license.
|
|
356
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
357
|
+
*/
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
const __iconNode$g = [
|
|
305
361
|
[
|
|
306
362
|
"path",
|
|
307
363
|
{
|
|
@@ -310,7 +366,7 @@ const __iconNode$b = [
|
|
|
310
366
|
}
|
|
311
367
|
]
|
|
312
368
|
];
|
|
313
|
-
const Folder = createLucideIcon("folder", __iconNode$
|
|
369
|
+
const Folder = createLucideIcon("folder", __iconNode$g);
|
|
314
370
|
|
|
315
371
|
/**
|
|
316
372
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -320,7 +376,7 @@ const Folder = createLucideIcon("folder", __iconNode$b);
|
|
|
320
376
|
*/
|
|
321
377
|
|
|
322
378
|
|
|
323
|
-
const __iconNode$
|
|
379
|
+
const __iconNode$f = [
|
|
324
380
|
["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
|
|
325
381
|
["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
|
|
326
382
|
["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
|
|
@@ -328,7 +384,7 @@ const __iconNode$a = [
|
|
|
328
384
|
["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
|
|
329
385
|
["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
|
|
330
386
|
];
|
|
331
|
-
const GripVertical = createLucideIcon("grip-vertical", __iconNode$
|
|
387
|
+
const GripVertical = createLucideIcon("grip-vertical", __iconNode$f);
|
|
332
388
|
|
|
333
389
|
/**
|
|
334
390
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -338,12 +394,12 @@ const GripVertical = createLucideIcon("grip-vertical", __iconNode$a);
|
|
|
338
394
|
*/
|
|
339
395
|
|
|
340
396
|
|
|
341
|
-
const __iconNode$
|
|
397
|
+
const __iconNode$e = [
|
|
342
398
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
343
399
|
["path", { d: "M12 16v-4", key: "1dtifu" }],
|
|
344
400
|
["path", { d: "M12 8h.01", key: "e9boi3" }]
|
|
345
401
|
];
|
|
346
|
-
const Info = createLucideIcon("info", __iconNode$
|
|
402
|
+
const Info = createLucideIcon("info", __iconNode$e);
|
|
347
403
|
|
|
348
404
|
/**
|
|
349
405
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -353,8 +409,12 @@ const Info = createLucideIcon("info", __iconNode$9);
|
|
|
353
409
|
*/
|
|
354
410
|
|
|
355
411
|
|
|
356
|
-
const __iconNode$
|
|
357
|
-
|
|
412
|
+
const __iconNode$d = [
|
|
413
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
414
|
+
["path", { d: "M7 12h10", key: "b7w52i" }],
|
|
415
|
+
["path", { d: "M10 18h4", key: "1ulq68" }]
|
|
416
|
+
];
|
|
417
|
+
const ListFilter = createLucideIcon("list-filter", __iconNode$d);
|
|
358
418
|
|
|
359
419
|
/**
|
|
360
420
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -364,12 +424,23 @@ const LoaderCircle = createLucideIcon("loader-circle", __iconNode$8);
|
|
|
364
424
|
*/
|
|
365
425
|
|
|
366
426
|
|
|
367
|
-
const __iconNode$
|
|
427
|
+
const __iconNode$c = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
|
|
428
|
+
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$c);
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* @license lucide-react v0.525.0 - ISC
|
|
432
|
+
*
|
|
433
|
+
* This source code is licensed under the ISC license.
|
|
434
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
435
|
+
*/
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
const __iconNode$b = [
|
|
368
439
|
["path", { d: "m16 17 5-5-5-5", key: "1bji2h" }],
|
|
369
440
|
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
370
441
|
["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4", key: "1uf3rs" }]
|
|
371
442
|
];
|
|
372
|
-
const LogOut = createLucideIcon("log-out", __iconNode$
|
|
443
|
+
const LogOut = createLucideIcon("log-out", __iconNode$b);
|
|
373
444
|
|
|
374
445
|
/**
|
|
375
446
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -379,12 +450,12 @@ const LogOut = createLucideIcon("log-out", __iconNode$7);
|
|
|
379
450
|
*/
|
|
380
451
|
|
|
381
452
|
|
|
382
|
-
const __iconNode$
|
|
453
|
+
const __iconNode$a = [
|
|
383
454
|
["path", { d: "M4 12h16", key: "1lakjw" }],
|
|
384
455
|
["path", { d: "M4 18h16", key: "19g7jn" }],
|
|
385
456
|
["path", { d: "M4 6h16", key: "1o0s65" }]
|
|
386
457
|
];
|
|
387
|
-
const Menu = createLucideIcon("menu", __iconNode$
|
|
458
|
+
const Menu = createLucideIcon("menu", __iconNode$a);
|
|
388
459
|
|
|
389
460
|
/**
|
|
390
461
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -394,11 +465,11 @@ const Menu = createLucideIcon("menu", __iconNode$6);
|
|
|
394
465
|
*/
|
|
395
466
|
|
|
396
467
|
|
|
397
|
-
const __iconNode$
|
|
468
|
+
const __iconNode$9 = [
|
|
398
469
|
["path", { d: "M6 8L2 12L6 16", key: "kyvwex" }],
|
|
399
470
|
["path", { d: "M2 12H22", key: "1m8cig" }]
|
|
400
471
|
];
|
|
401
|
-
const MoveLeft = createLucideIcon("move-left", __iconNode$
|
|
472
|
+
const MoveLeft = createLucideIcon("move-left", __iconNode$9);
|
|
402
473
|
|
|
403
474
|
/**
|
|
404
475
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -408,11 +479,62 @@ const MoveLeft = createLucideIcon("move-left", __iconNode$5);
|
|
|
408
479
|
*/
|
|
409
480
|
|
|
410
481
|
|
|
411
|
-
const __iconNode$
|
|
482
|
+
const __iconNode$8 = [
|
|
483
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
484
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
485
|
+
];
|
|
486
|
+
const Plus = createLucideIcon("plus", __iconNode$8);
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* @license lucide-react v0.525.0 - ISC
|
|
490
|
+
*
|
|
491
|
+
* This source code is licensed under the ISC license.
|
|
492
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
493
|
+
*/
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
const __iconNode$7 = [
|
|
497
|
+
[
|
|
498
|
+
"path",
|
|
499
|
+
{
|
|
500
|
+
d: "M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",
|
|
501
|
+
key: "143wyd"
|
|
502
|
+
}
|
|
503
|
+
],
|
|
504
|
+
["path", { d: "M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6", key: "1itne7" }],
|
|
505
|
+
["rect", { x: "6", y: "14", width: "12", height: "8", rx: "1", key: "1ue0tg" }]
|
|
506
|
+
];
|
|
507
|
+
const Printer = createLucideIcon("printer", __iconNode$7);
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* @license lucide-react v0.525.0 - ISC
|
|
511
|
+
*
|
|
512
|
+
* This source code is licensed under the ISC license.
|
|
513
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
514
|
+
*/
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
const __iconNode$6 = [
|
|
518
|
+
["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
|
|
519
|
+
["path", { d: "M3 3v5h5", key: "1xhq8a" }],
|
|
520
|
+
["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
|
|
521
|
+
["path", { d: "M16 16h5v5", key: "ccwih5" }]
|
|
522
|
+
];
|
|
523
|
+
const RefreshCcw = createLucideIcon("refresh-ccw", __iconNode$6);
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* @license lucide-react v0.525.0 - ISC
|
|
527
|
+
*
|
|
528
|
+
* This source code is licensed under the ISC license.
|
|
529
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
530
|
+
*/
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
const __iconNode$5 = [
|
|
412
534
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
413
535
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
414
536
|
];
|
|
415
|
-
const Search = createLucideIcon("search", __iconNode$
|
|
537
|
+
const Search = createLucideIcon("search", __iconNode$5);
|
|
416
538
|
|
|
417
539
|
/**
|
|
418
540
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -422,14 +544,29 @@ const Search = createLucideIcon("search", __iconNode$4);
|
|
|
422
544
|
*/
|
|
423
545
|
|
|
424
546
|
|
|
425
|
-
const __iconNode$
|
|
547
|
+
const __iconNode$4 = [
|
|
426
548
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
427
549
|
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
428
550
|
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
429
551
|
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
430
552
|
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
431
553
|
];
|
|
432
|
-
const Trash2 = createLucideIcon("trash-2", __iconNode$
|
|
554
|
+
const Trash2 = createLucideIcon("trash-2", __iconNode$4);
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* @license lucide-react v0.525.0 - ISC
|
|
558
|
+
*
|
|
559
|
+
* This source code is licensed under the ISC license.
|
|
560
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
561
|
+
*/
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
const __iconNode$3 = [
|
|
565
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
566
|
+
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
567
|
+
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }]
|
|
568
|
+
];
|
|
569
|
+
const Trash = createLucideIcon("trash", __iconNode$3);
|
|
433
570
|
|
|
434
571
|
/**
|
|
435
572
|
* @license lucide-react v0.525.0 - ISC
|
|
@@ -681,7 +818,7 @@ const Avatar = ({
|
|
|
681
818
|
showIcon && /* @__PURE__ */ jsx("span", { className: "avatar-icon", children: /* @__PURE__ */ jsx(User, {}) })
|
|
682
819
|
] });
|
|
683
820
|
};
|
|
684
|
-
const AvatarGroup = ({ children, max = 4, truncatedMessage = "Members", ...props }) => {
|
|
821
|
+
const AvatarGroup$1 = ({ children, max = 4, truncatedMessage = "Members", ...props }) => {
|
|
685
822
|
const avatars = React__default.Children.toArray(children);
|
|
686
823
|
const visibleAvatars = avatars.slice(0, max);
|
|
687
824
|
const hiddenCount = avatars.length - max;
|
|
@@ -69508,7 +69645,7 @@ const AvatarGroupDisplay = ({
|
|
|
69508
69645
|
"div",
|
|
69509
69646
|
{
|
|
69510
69647
|
className: "flex items-center justify-between p-3 border border-dashed border-gray-400 rounded-lg hover:bg-gray-50",
|
|
69511
|
-
children: /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "Not shared with anyone yet
|
|
69648
|
+
children: /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "Not shared with anyone yet....." })
|
|
69512
69649
|
}
|
|
69513
69650
|
);
|
|
69514
69651
|
}
|
|
@@ -69669,9 +69806,9 @@ const InviteFlow = ({
|
|
|
69669
69806
|
case ADD_USERS_GROUPS_ROLES_MODAL.INTEREST:
|
|
69670
69807
|
return "Add Audience";
|
|
69671
69808
|
case ADD_USERS_GROUPS_ROLES_MODAL.ARTICLE:
|
|
69672
|
-
return "Add Users, Groups or Roles";
|
|
69809
|
+
return "Add Users, Groups or Roles test";
|
|
69673
69810
|
default:
|
|
69674
|
-
return "Add User, Groups or Roles";
|
|
69811
|
+
return "Add User, Groups or Roles test";
|
|
69675
69812
|
}
|
|
69676
69813
|
};
|
|
69677
69814
|
const isDisabled = useMemo(() => {
|
|
@@ -74993,78 +75130,1639 @@ function TreeView({
|
|
|
74993
75130
|
] });
|
|
74994
75131
|
}
|
|
74995
75132
|
|
|
74996
|
-
|
|
74997
|
-
|
|
74998
|
-
|
|
74999
|
-
|
|
75000
|
-
|
|
75001
|
-
|
|
75002
|
-
|
|
75003
|
-
|
|
75004
|
-
|
|
75005
|
-
|
|
75006
|
-
|
|
75007
|
-
|
|
75008
|
-
|
|
75009
|
-
|
|
75010
|
-
|
|
75011
|
-
|
|
75012
|
-
|
|
75013
|
-
|
|
75014
|
-
|
|
75015
|
-
|
|
75016
|
-
|
|
75017
|
-
|
|
75018
|
-
|
|
75019
|
-
|
|
75020
|
-
|
|
75021
|
-
|
|
75022
|
-
|
|
75023
|
-
|
|
75024
|
-
|
|
75025
|
-
|
|
75026
|
-
|
|
75027
|
-
|
|
75028
|
-
|
|
75029
|
-
|
|
75030
|
-
|
|
75031
|
-
|
|
75032
|
-
|
|
75033
|
-
|
|
75034
|
-
|
|
75035
|
-
|
|
75036
|
-
|
|
75037
|
-
"
|
|
75038
|
-
|
|
75039
|
-
|
|
75040
|
-
|
|
75041
|
-
|
|
75042
|
-
|
|
75043
|
-
|
|
75044
|
-
|
|
75045
|
-
|
|
75046
|
-
|
|
75047
|
-
|
|
75048
|
-
|
|
75049
|
-
|
|
75050
|
-
|
|
75051
|
-
|
|
75052
|
-
data: value,
|
|
75053
|
-
onReady: (editor) => {
|
|
75054
|
-
if (mergedConfig.height) {
|
|
75055
|
-
editor.ui.view.editable.element.style.minHeight = mergedConfig.height;
|
|
75133
|
+
function SectionRenderer({ item, data: initialData, updateHandler, validationErrors = {} }) {
|
|
75134
|
+
console.log(item);
|
|
75135
|
+
const [section, setSection] = React__default.useState(item);
|
|
75136
|
+
const [data, setData] = React__default.useState(() => {
|
|
75137
|
+
const sectionData = initialData && initialData[item.key] || {};
|
|
75138
|
+
console.log("Initial Section data for", item.key, sectionData);
|
|
75139
|
+
return sectionData;
|
|
75140
|
+
});
|
|
75141
|
+
const prevInitialDataRef = useRef(initialData);
|
|
75142
|
+
useEffect(() => {
|
|
75143
|
+
if (prevInitialDataRef.current !== initialData) {
|
|
75144
|
+
prevInitialDataRef.current = initialData;
|
|
75145
|
+
const sectionData = initialData && initialData[item.key] || {};
|
|
75146
|
+
console.log("Updated Section data for", item.key, sectionData);
|
|
75147
|
+
setData(sectionData);
|
|
75148
|
+
}
|
|
75149
|
+
}, [initialData, item.key]);
|
|
75150
|
+
console.log("Section data", data);
|
|
75151
|
+
const prevDataRef = useRef(data);
|
|
75152
|
+
useEffect(() => {
|
|
75153
|
+
if (prevDataRef.current !== data && updateHandler && typeof updateHandler === "function") {
|
|
75154
|
+
prevDataRef.current = data;
|
|
75155
|
+
updateHandler(section.key, data);
|
|
75156
|
+
}
|
|
75157
|
+
}, [section.key, data, updateHandler]);
|
|
75158
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { style: { marginBottom: "20px" }, children: [
|
|
75159
|
+
/* @__PURE__ */ jsxs(
|
|
75160
|
+
"h2",
|
|
75161
|
+
{
|
|
75162
|
+
style: {
|
|
75163
|
+
fontSize: "20px",
|
|
75164
|
+
fontWeight: "bold",
|
|
75165
|
+
marginBottom: "10px"
|
|
75166
|
+
},
|
|
75167
|
+
children: [
|
|
75168
|
+
section.title,
|
|
75169
|
+
" - ",
|
|
75170
|
+
section.type
|
|
75171
|
+
]
|
|
75172
|
+
}
|
|
75173
|
+
),
|
|
75174
|
+
/* @__PURE__ */ jsx("p", { style: { fontSize: "14px", marginBottom: "10px" }, children: section.description }),
|
|
75175
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: section.fields.map((field, idx) => /* @__PURE__ */ jsxs("div", { style: { marginBottom: "10px" }, children: [
|
|
75176
|
+
/* @__PURE__ */ jsxs(
|
|
75177
|
+
"label",
|
|
75178
|
+
{
|
|
75179
|
+
style: {
|
|
75180
|
+
display: "block",
|
|
75181
|
+
fontWeight: "600",
|
|
75182
|
+
marginBottom: "5px"
|
|
75183
|
+
},
|
|
75184
|
+
children: [
|
|
75185
|
+
field.label,
|
|
75186
|
+
" ",
|
|
75187
|
+
field.required && /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: "*" })
|
|
75188
|
+
]
|
|
75056
75189
|
}
|
|
75057
|
-
|
|
75058
|
-
|
|
75190
|
+
),
|
|
75191
|
+
field.fieldtype === "text" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75192
|
+
/* @__PURE__ */ jsx(
|
|
75193
|
+
Input,
|
|
75194
|
+
{
|
|
75195
|
+
type: "text",
|
|
75196
|
+
name: field.key,
|
|
75197
|
+
defaultValue: field.default,
|
|
75198
|
+
placeholder: field.placeholder,
|
|
75199
|
+
value: data[field.key] || "",
|
|
75200
|
+
onChange: (e) => {
|
|
75201
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75202
|
+
setData(newData);
|
|
75203
|
+
if (updateHandler) {
|
|
75204
|
+
updateHandler(section.key, newData);
|
|
75205
|
+
}
|
|
75206
|
+
},
|
|
75207
|
+
required: field.required,
|
|
75208
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75209
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75210
|
+
}
|
|
75211
|
+
),
|
|
75212
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75213
|
+
] }),
|
|
75214
|
+
field.fieldtype === "textarea" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75215
|
+
/* @__PURE__ */ jsx(
|
|
75216
|
+
Textarea,
|
|
75217
|
+
{
|
|
75218
|
+
name: field.key,
|
|
75219
|
+
defaultValue: field.default,
|
|
75220
|
+
placeholder: field.placeholder,
|
|
75221
|
+
value: data[field.key] || "",
|
|
75222
|
+
onChange: (e) => {
|
|
75223
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75224
|
+
setData(newData);
|
|
75225
|
+
if (updateHandler) {
|
|
75226
|
+
updateHandler(section.key, newData);
|
|
75227
|
+
}
|
|
75228
|
+
},
|
|
75229
|
+
rows: 3,
|
|
75230
|
+
required: field.required,
|
|
75231
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75232
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75233
|
+
}
|
|
75234
|
+
),
|
|
75235
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75236
|
+
] }),
|
|
75237
|
+
field.fieldtype === "number" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75238
|
+
/* @__PURE__ */ jsx(
|
|
75239
|
+
Input,
|
|
75240
|
+
{
|
|
75241
|
+
type: "number",
|
|
75242
|
+
name: field.key,
|
|
75243
|
+
defaultValue: field.default,
|
|
75244
|
+
placeholder: field.placeholder,
|
|
75245
|
+
value: data[field.key] || "",
|
|
75246
|
+
onChange: (e) => {
|
|
75247
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75248
|
+
setData(newData);
|
|
75249
|
+
if (updateHandler) {
|
|
75250
|
+
updateHandler(section.key, newData);
|
|
75251
|
+
}
|
|
75252
|
+
},
|
|
75253
|
+
required: field.required,
|
|
75254
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75255
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75256
|
+
}
|
|
75257
|
+
),
|
|
75258
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75259
|
+
] }),
|
|
75260
|
+
field.fieldtype === "checkbox" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75261
|
+
/* @__PURE__ */ jsx(
|
|
75262
|
+
Checkbox,
|
|
75263
|
+
{
|
|
75264
|
+
name: field.key,
|
|
75265
|
+
checked: Boolean(data[field.key] || field.default),
|
|
75266
|
+
onChange: (checked) => {
|
|
75267
|
+
const newData = { ...data, [field.key]: checked };
|
|
75268
|
+
setData(newData);
|
|
75269
|
+
if (updateHandler) {
|
|
75270
|
+
updateHandler(section.key, newData);
|
|
75271
|
+
}
|
|
75272
|
+
},
|
|
75273
|
+
label: field.placeholder || field.label,
|
|
75274
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75275
|
+
className: "w-full"
|
|
75276
|
+
}
|
|
75277
|
+
),
|
|
75278
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75279
|
+
] }),
|
|
75280
|
+
field.fieldtype === "select" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75281
|
+
/* @__PURE__ */ jsx(
|
|
75282
|
+
Select,
|
|
75283
|
+
{
|
|
75284
|
+
name: field.key,
|
|
75285
|
+
defaultValue: field.default,
|
|
75286
|
+
value: data[field.key] || "",
|
|
75287
|
+
onChange: (value) => {
|
|
75288
|
+
const newData = { ...data, [field.key]: value };
|
|
75289
|
+
setData(newData);
|
|
75290
|
+
if (updateHandler) {
|
|
75291
|
+
updateHandler(section.key, newData);
|
|
75292
|
+
}
|
|
75293
|
+
},
|
|
75294
|
+
options: field.options || [],
|
|
75295
|
+
placeholder: field.placeholder || `Select ${field.label}`,
|
|
75296
|
+
required: field.required,
|
|
75297
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75298
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75299
|
+
}
|
|
75300
|
+
),
|
|
75301
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75302
|
+
] }),
|
|
75303
|
+
field.fieldtype === "email" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75304
|
+
/* @__PURE__ */ jsx(
|
|
75305
|
+
Input,
|
|
75306
|
+
{
|
|
75307
|
+
type: "email",
|
|
75308
|
+
name: field.key,
|
|
75309
|
+
defaultValue: field.default,
|
|
75310
|
+
placeholder: field.placeholder || "Enter email address",
|
|
75311
|
+
value: data[field.key] || "",
|
|
75312
|
+
onChange: (e) => {
|
|
75313
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75314
|
+
setData(newData);
|
|
75315
|
+
if (updateHandler) {
|
|
75316
|
+
updateHandler(section.key, newData);
|
|
75317
|
+
}
|
|
75318
|
+
},
|
|
75319
|
+
required: field.required,
|
|
75320
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75321
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75322
|
+
}
|
|
75323
|
+
),
|
|
75324
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75325
|
+
] }),
|
|
75326
|
+
field.fieldtype === "url" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75327
|
+
/* @__PURE__ */ jsx(
|
|
75328
|
+
Input,
|
|
75329
|
+
{
|
|
75330
|
+
type: "url",
|
|
75331
|
+
name: field.key,
|
|
75332
|
+
defaultValue: field.default,
|
|
75333
|
+
placeholder: field.placeholder || "Enter URL",
|
|
75334
|
+
value: data[field.key] || "",
|
|
75335
|
+
onChange: (e) => {
|
|
75336
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75337
|
+
setData(newData);
|
|
75338
|
+
if (updateHandler) {
|
|
75339
|
+
updateHandler(section.key, newData);
|
|
75340
|
+
}
|
|
75341
|
+
},
|
|
75342
|
+
required: field.required,
|
|
75343
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75344
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75345
|
+
}
|
|
75346
|
+
),
|
|
75347
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75348
|
+
] }),
|
|
75349
|
+
field.fieldtype === "password" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75350
|
+
/* @__PURE__ */ jsx(
|
|
75351
|
+
Input,
|
|
75352
|
+
{
|
|
75353
|
+
type: "password",
|
|
75354
|
+
name: field.key,
|
|
75355
|
+
defaultValue: field.default,
|
|
75356
|
+
placeholder: field.placeholder || "Enter password",
|
|
75357
|
+
value: data[field.key] || "",
|
|
75358
|
+
onChange: (e) => {
|
|
75359
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75360
|
+
setData(newData);
|
|
75361
|
+
if (updateHandler) {
|
|
75362
|
+
updateHandler(section.key, newData);
|
|
75363
|
+
}
|
|
75364
|
+
},
|
|
75365
|
+
required: field.required,
|
|
75366
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75367
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75368
|
+
}
|
|
75369
|
+
),
|
|
75370
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75371
|
+
] }),
|
|
75372
|
+
field.fieldtype === "multiselect" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75373
|
+
/* @__PURE__ */ jsx(
|
|
75374
|
+
MultiSelect,
|
|
75375
|
+
{
|
|
75376
|
+
selectedItems: data[field.key] || [],
|
|
75377
|
+
onSelectionChange: (selectedItems) => {
|
|
75378
|
+
const newData = { ...data, [field.key]: selectedItems };
|
|
75379
|
+
setData(newData);
|
|
75380
|
+
if (updateHandler) {
|
|
75381
|
+
updateHandler(section.key, newData);
|
|
75382
|
+
}
|
|
75383
|
+
},
|
|
75384
|
+
options: field.options || [],
|
|
75385
|
+
placeholder: field.placeholder || `Select ${field.label}`,
|
|
75386
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75387
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75388
|
+
}
|
|
75389
|
+
),
|
|
75390
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75391
|
+
] }),
|
|
75392
|
+
field.fieldtype === "toggle" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75393
|
+
/* @__PURE__ */ jsx(
|
|
75394
|
+
ToggleSwitch,
|
|
75395
|
+
{
|
|
75396
|
+
checked: Boolean(data[field.key] || field.default),
|
|
75397
|
+
onChange: (isOn) => {
|
|
75398
|
+
console.log("Toggle changed:", field.key, isOn);
|
|
75399
|
+
const newData = { ...data, [field.key]: isOn };
|
|
75400
|
+
setData(newData);
|
|
75401
|
+
if (updateHandler) {
|
|
75402
|
+
updateHandler(section.key, newData);
|
|
75403
|
+
}
|
|
75404
|
+
},
|
|
75405
|
+
label: field.placeholder || field.label,
|
|
75406
|
+
disabled: field.disabled ? field.disabled : false
|
|
75407
|
+
}
|
|
75408
|
+
),
|
|
75409
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75410
|
+
] }),
|
|
75411
|
+
field.fieldtype === "date" && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
75412
|
+
DatePicker,
|
|
75413
|
+
{
|
|
75414
|
+
label: field.label,
|
|
75415
|
+
value: data[field.key] ? new Date(data[field.key]) : null,
|
|
75416
|
+
onChange: (date) => {
|
|
75417
|
+
const newData = { ...data, [field.key]: date ? date.toISOString().split("T")[0] : "" };
|
|
75418
|
+
setData(newData);
|
|
75419
|
+
if (updateHandler) {
|
|
75420
|
+
updateHandler(section.key, newData);
|
|
75421
|
+
}
|
|
75422
|
+
},
|
|
75423
|
+
placeholder: field.placeholder || "Select date",
|
|
75424
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75425
|
+
error: validationErrors[section.key]?.[field.key],
|
|
75426
|
+
className: "w-full"
|
|
75427
|
+
}
|
|
75428
|
+
) }),
|
|
75429
|
+
field.fieldtype === "daterange" && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
75430
|
+
DateRangePicker$1,
|
|
75431
|
+
{
|
|
75432
|
+
label: field.label,
|
|
75433
|
+
value: data[field.key] || { from: null, to: null },
|
|
75434
|
+
onChange: (dateRange) => {
|
|
75435
|
+
const newData = { ...data, [field.key]: dateRange };
|
|
75436
|
+
setData(newData);
|
|
75437
|
+
if (updateHandler) {
|
|
75438
|
+
updateHandler(section.key, newData);
|
|
75439
|
+
}
|
|
75440
|
+
},
|
|
75441
|
+
placeholder: field.placeholder || "Select date range",
|
|
75442
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75443
|
+
error: validationErrors[section.key]?.[field.key],
|
|
75444
|
+
className: "w-full"
|
|
75445
|
+
}
|
|
75446
|
+
) }),
|
|
75447
|
+
field.fieldtype === "radio" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75448
|
+
/* @__PURE__ */ jsx(
|
|
75449
|
+
RadioGroup,
|
|
75450
|
+
{
|
|
75451
|
+
selectedValue: data[field.key] || "",
|
|
75452
|
+
onValueChange: (value) => {
|
|
75453
|
+
const newData = { ...data, [field.key]: value };
|
|
75454
|
+
setData(newData);
|
|
75455
|
+
if (updateHandler) {
|
|
75456
|
+
updateHandler(section.key, newData);
|
|
75457
|
+
}
|
|
75458
|
+
},
|
|
75459
|
+
options: field.options || [],
|
|
75460
|
+
disabled: field.disabled ? field.disabled : false,
|
|
75461
|
+
className: "w-full"
|
|
75462
|
+
}
|
|
75463
|
+
),
|
|
75464
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75465
|
+
] }),
|
|
75466
|
+
field.fieldtype === "search" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75467
|
+
/* @__PURE__ */ jsx(
|
|
75468
|
+
SearchBar,
|
|
75469
|
+
{
|
|
75470
|
+
value: data[field.key] || "",
|
|
75471
|
+
onChange: (value) => {
|
|
75472
|
+
const newData = { ...data, [field.key]: value };
|
|
75473
|
+
setData(newData);
|
|
75474
|
+
if (updateHandler) {
|
|
75475
|
+
updateHandler(section.key, newData);
|
|
75476
|
+
}
|
|
75477
|
+
},
|
|
75478
|
+
placeholder: field.placeholder || `Search ${field.label}`,
|
|
75479
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75480
|
+
}
|
|
75481
|
+
),
|
|
75482
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75483
|
+
] }),
|
|
75484
|
+
(field.fieldtype === "datetime" || field.fieldtype === "datetime-local") && /* @__PURE__ */ jsxs("div", { children: [
|
|
75485
|
+
/* @__PURE__ */ jsx(
|
|
75486
|
+
Input,
|
|
75487
|
+
{
|
|
75488
|
+
type: "datetime-local",
|
|
75489
|
+
name: field.key,
|
|
75490
|
+
defaultValue: field.default,
|
|
75491
|
+
placeholder: field.placeholder || "Select date and time",
|
|
75492
|
+
value: data[field.key] || "",
|
|
75493
|
+
onChange: (e) => {
|
|
75494
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75495
|
+
setData(newData);
|
|
75496
|
+
if (updateHandler) {
|
|
75497
|
+
updateHandler(section.key, newData);
|
|
75498
|
+
}
|
|
75499
|
+
},
|
|
75500
|
+
required: field.required,
|
|
75501
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75502
|
+
}
|
|
75503
|
+
),
|
|
75504
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75505
|
+
] }),
|
|
75506
|
+
field.fieldtype === "time" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75507
|
+
/* @__PURE__ */ jsx(
|
|
75508
|
+
Input,
|
|
75509
|
+
{
|
|
75510
|
+
type: "time",
|
|
75511
|
+
name: field.key,
|
|
75512
|
+
defaultValue: field.default,
|
|
75513
|
+
placeholder: field.placeholder || "Select time",
|
|
75514
|
+
value: data[field.key] || "",
|
|
75515
|
+
onChange: (e) => {
|
|
75516
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75517
|
+
setData(newData);
|
|
75518
|
+
if (updateHandler) {
|
|
75519
|
+
updateHandler(section.key, newData);
|
|
75520
|
+
}
|
|
75521
|
+
},
|
|
75522
|
+
required: field.required,
|
|
75523
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75524
|
+
}
|
|
75525
|
+
),
|
|
75526
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75527
|
+
] }),
|
|
75528
|
+
field.fieldtype === "color" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75529
|
+
/* @__PURE__ */ jsx(
|
|
75530
|
+
Input,
|
|
75531
|
+
{
|
|
75532
|
+
type: "color",
|
|
75533
|
+
name: field.key,
|
|
75534
|
+
defaultValue: field.default || "#000000",
|
|
75535
|
+
value: data[field.key] || "#000000",
|
|
75536
|
+
onChange: (e) => {
|
|
75537
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75538
|
+
setData(newData);
|
|
75539
|
+
if (updateHandler) {
|
|
75540
|
+
updateHandler(section.key, newData);
|
|
75541
|
+
}
|
|
75542
|
+
},
|
|
75543
|
+
className: `w-full h-10 ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75544
|
+
}
|
|
75545
|
+
),
|
|
75546
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75547
|
+
] }),
|
|
75548
|
+
field.fieldtype === "range" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75549
|
+
/* @__PURE__ */ jsx(
|
|
75550
|
+
Input,
|
|
75551
|
+
{
|
|
75552
|
+
type: "range",
|
|
75553
|
+
name: field.key,
|
|
75554
|
+
defaultValue: field.default || field.min || 0,
|
|
75555
|
+
value: data[field.key] || field.min || 0,
|
|
75556
|
+
onChange: (e) => {
|
|
75557
|
+
const newData = { ...data, [field.key]: e.target.value };
|
|
75558
|
+
setData(newData);
|
|
75559
|
+
if (updateHandler) {
|
|
75560
|
+
updateHandler(section.key, newData);
|
|
75561
|
+
}
|
|
75562
|
+
},
|
|
75563
|
+
min: field.min || 0,
|
|
75564
|
+
max: field.max || 100,
|
|
75565
|
+
step: field.step || 1,
|
|
75566
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75567
|
+
}
|
|
75568
|
+
),
|
|
75569
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm text-gray-500 mt-1", children: [
|
|
75570
|
+
/* @__PURE__ */ jsx("span", { children: field.min || 0 }),
|
|
75571
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
75572
|
+
"Current: ",
|
|
75573
|
+
data[field.key] || field.min || 0
|
|
75574
|
+
] }),
|
|
75575
|
+
/* @__PURE__ */ jsx("span", { children: field.max || 100 })
|
|
75576
|
+
] }),
|
|
75577
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75578
|
+
] }),
|
|
75579
|
+
field.fieldtype === "file" && /* @__PURE__ */ jsxs("div", { children: [
|
|
75580
|
+
/* @__PURE__ */ jsx(
|
|
75581
|
+
Input,
|
|
75582
|
+
{
|
|
75583
|
+
type: "file",
|
|
75584
|
+
name: field.key,
|
|
75585
|
+
onChange: (e) => {
|
|
75586
|
+
const file = e.target.files[0];
|
|
75587
|
+
const newData = { ...data, [field.key]: file ? file.name : "" };
|
|
75588
|
+
setData(newData);
|
|
75589
|
+
if (updateHandler) {
|
|
75590
|
+
updateHandler(section.key, newData);
|
|
75591
|
+
}
|
|
75592
|
+
},
|
|
75593
|
+
accept: field.accept,
|
|
75594
|
+
className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
|
|
75595
|
+
}
|
|
75596
|
+
),
|
|
75597
|
+
validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
|
|
75598
|
+
] }),
|
|
75599
|
+
field.info && /* @__PURE__ */ jsx(
|
|
75600
|
+
"p",
|
|
75601
|
+
{
|
|
75602
|
+
style: {
|
|
75603
|
+
fontSize: "12px",
|
|
75604
|
+
color: "#666",
|
|
75605
|
+
marginTop: "5px"
|
|
75606
|
+
},
|
|
75607
|
+
children: field.info
|
|
75608
|
+
}
|
|
75609
|
+
)
|
|
75610
|
+
] }, idx)) })
|
|
75611
|
+
] }) });
|
|
75612
|
+
}
|
|
75613
|
+
|
|
75614
|
+
const AvatarGroup = ({ children }) => /* @__PURE__ */ jsx("div", { className: "flex -space-x-2", children });
|
|
75615
|
+
function DataTableRenderer({ item, data: initialData, updateHandler, validationErrors = {} }) {
|
|
75616
|
+
console.log(`[DynamicConfig/DataTableRenderer] Component loaded for section: ${item.key}`);
|
|
75617
|
+
const [section, setSection] = useState(item);
|
|
75618
|
+
const [audienceRowId, setAudienceRowId] = useState(null);
|
|
75619
|
+
const [audienceFieldName, setAudienceFieldName] = useState(null);
|
|
75620
|
+
console.log(`[DataTableRenderer] ${section.key} - Received props:`, { item, initialData });
|
|
75621
|
+
const [data, setData] = useState(() => {
|
|
75622
|
+
const existingData = initialData && initialData[section.key] || [];
|
|
75623
|
+
const result = existingData.length > 0 ? existingData : [{ id: 0 }];
|
|
75624
|
+
console.log(`[DataTableRenderer] ${section.key} - Initial data:`, result);
|
|
75625
|
+
return result;
|
|
75626
|
+
});
|
|
75627
|
+
const prevInitialDataRef = useRef(initialData);
|
|
75628
|
+
useEffect(() => {
|
|
75629
|
+
console.log(`[DataTableRenderer] ${section.key} - Checking for initialData changes`);
|
|
75630
|
+
console.log(`[DataTableRenderer] ${section.key} - Previous:`, prevInitialDataRef.current);
|
|
75631
|
+
console.log(`[DataTableRenderer] ${section.key} - Current:`, initialData);
|
|
75632
|
+
if (prevInitialDataRef.current !== initialData) {
|
|
75633
|
+
prevInitialDataRef.current = initialData;
|
|
75634
|
+
const existingData = initialData && initialData[section.key] || [];
|
|
75635
|
+
const newData = existingData.length > 0 ? existingData : [{ id: 0 }];
|
|
75636
|
+
console.log(`[DataTableRenderer] ${section.key} - Setting new data:`, newData);
|
|
75637
|
+
setData(newData);
|
|
75638
|
+
}
|
|
75639
|
+
}, [initialData, section.key]);
|
|
75640
|
+
const prevDataRef = useRef(data);
|
|
75641
|
+
const updateTimeoutRef = useRef(null);
|
|
75642
|
+
useEffect(() => {
|
|
75643
|
+
if (prevDataRef.current !== data && updateHandler && typeof updateHandler === "function") {
|
|
75644
|
+
prevDataRef.current = data;
|
|
75645
|
+
if (updateTimeoutRef.current) {
|
|
75646
|
+
clearTimeout(updateTimeoutRef.current);
|
|
75647
|
+
}
|
|
75648
|
+
updateTimeoutRef.current = setTimeout(() => {
|
|
75649
|
+
updateHandler(section.key, data);
|
|
75650
|
+
}, 300);
|
|
75059
75651
|
}
|
|
75060
|
-
);
|
|
75061
|
-
|
|
75652
|
+
}, [section.key, data, updateHandler]);
|
|
75653
|
+
useEffect(() => {
|
|
75654
|
+
return () => {
|
|
75655
|
+
if (updateTimeoutRef.current) {
|
|
75656
|
+
clearTimeout(updateTimeoutRef.current);
|
|
75657
|
+
}
|
|
75658
|
+
};
|
|
75659
|
+
}, []);
|
|
75660
|
+
const getFieldRenderer = (field) => {
|
|
75661
|
+
const updateFieldValue = (rowIndex, value) => {
|
|
75662
|
+
console.log(`[DataTableRenderer] updateFieldValue called with:`, { rowIndex, value, type: typeof value });
|
|
75663
|
+
setData((prevData) => {
|
|
75664
|
+
const newData = [...prevData];
|
|
75665
|
+
newData[rowIndex][field.key] = value;
|
|
75666
|
+
return newData;
|
|
75667
|
+
});
|
|
75668
|
+
};
|
|
75669
|
+
const getFieldError = (rowIndex) => {
|
|
75670
|
+
return validationErrors[section.key]?.[rowIndex]?.[field.key];
|
|
75671
|
+
};
|
|
75672
|
+
const renderError = (rowIndex) => {
|
|
75673
|
+
const error = getFieldError(rowIndex);
|
|
75674
|
+
return error ? /* @__PURE__ */ jsx("div", { className: "text-red-500 text-xs mt-1", children: error }) : null;
|
|
75675
|
+
};
|
|
75676
|
+
switch (field.fieldtype) {
|
|
75677
|
+
case "text":
|
|
75678
|
+
return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
|
|
75679
|
+
/* @__PURE__ */ jsx(
|
|
75680
|
+
Input,
|
|
75681
|
+
{
|
|
75682
|
+
value: props[field.key] || "",
|
|
75683
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75684
|
+
placeholder: field.placeholder || `Enter ${field.label}`,
|
|
75685
|
+
required: field.required,
|
|
75686
|
+
className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
|
|
75687
|
+
}
|
|
75688
|
+
),
|
|
75689
|
+
renderError(rowIndex)
|
|
75690
|
+
] });
|
|
75691
|
+
case "textarea":
|
|
75692
|
+
return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
|
|
75693
|
+
/* @__PURE__ */ jsx(
|
|
75694
|
+
Textarea,
|
|
75695
|
+
{
|
|
75696
|
+
value: props[field.key] || "",
|
|
75697
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75698
|
+
placeholder: field.placeholder || `Enter ${field.label}`,
|
|
75699
|
+
required: field.required,
|
|
75700
|
+
className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`,
|
|
75701
|
+
rows: 3
|
|
75702
|
+
}
|
|
75703
|
+
),
|
|
75704
|
+
renderError(rowIndex)
|
|
75705
|
+
] });
|
|
75706
|
+
case "number":
|
|
75707
|
+
return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
|
|
75708
|
+
/* @__PURE__ */ jsx(
|
|
75709
|
+
Input,
|
|
75710
|
+
{
|
|
75711
|
+
type: "number",
|
|
75712
|
+
value: props[field.key] || "",
|
|
75713
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75714
|
+
placeholder: field.placeholder || `Enter ${field.label}`,
|
|
75715
|
+
required: field.required,
|
|
75716
|
+
className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
|
|
75717
|
+
}
|
|
75718
|
+
),
|
|
75719
|
+
renderError(rowIndex)
|
|
75720
|
+
] });
|
|
75721
|
+
case "email":
|
|
75722
|
+
return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
|
|
75723
|
+
/* @__PURE__ */ jsx(
|
|
75724
|
+
Input,
|
|
75725
|
+
{
|
|
75726
|
+
type: "email",
|
|
75727
|
+
value: props[field.key] || "",
|
|
75728
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75729
|
+
placeholder: field.placeholder || "Enter email address",
|
|
75730
|
+
required: field.required,
|
|
75731
|
+
className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
|
|
75732
|
+
}
|
|
75733
|
+
),
|
|
75734
|
+
renderError(rowIndex)
|
|
75735
|
+
] });
|
|
75736
|
+
case "url":
|
|
75737
|
+
return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
|
|
75738
|
+
/* @__PURE__ */ jsx(
|
|
75739
|
+
Input,
|
|
75740
|
+
{
|
|
75741
|
+
type: "url",
|
|
75742
|
+
value: props[field.key] || "",
|
|
75743
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75744
|
+
placeholder: field.placeholder || "Enter URL",
|
|
75745
|
+
required: field.required,
|
|
75746
|
+
className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
|
|
75747
|
+
}
|
|
75748
|
+
),
|
|
75749
|
+
renderError(rowIndex)
|
|
75750
|
+
] });
|
|
75751
|
+
case "password":
|
|
75752
|
+
return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
|
|
75753
|
+
/* @__PURE__ */ jsx(
|
|
75754
|
+
Input,
|
|
75755
|
+
{
|
|
75756
|
+
type: "password",
|
|
75757
|
+
value: props[field.key] || "",
|
|
75758
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75759
|
+
placeholder: field.placeholder || "Enter password",
|
|
75760
|
+
required: field.required,
|
|
75761
|
+
className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
|
|
75762
|
+
}
|
|
75763
|
+
),
|
|
75764
|
+
renderError(rowIndex)
|
|
75765
|
+
] });
|
|
75766
|
+
case "select":
|
|
75767
|
+
case "dropdown":
|
|
75768
|
+
return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
|
|
75769
|
+
/* @__PURE__ */ jsx(
|
|
75770
|
+
Select,
|
|
75771
|
+
{
|
|
75772
|
+
value: props[field.key] || "",
|
|
75773
|
+
onChange: (value) => updateFieldValue(rowIndex, value),
|
|
75774
|
+
options: field.options || [],
|
|
75775
|
+
placeholder: field.placeholder || `Select ${field.label}`,
|
|
75776
|
+
required: field.required,
|
|
75777
|
+
className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
|
|
75778
|
+
}
|
|
75779
|
+
),
|
|
75780
|
+
renderError(rowIndex)
|
|
75781
|
+
] });
|
|
75782
|
+
case "multiselect":
|
|
75783
|
+
return (props, rowIndex) => {
|
|
75784
|
+
const currentValue = props[field.key] || [];
|
|
75785
|
+
return /* @__PURE__ */ jsx(
|
|
75786
|
+
MultiSelect,
|
|
75787
|
+
{
|
|
75788
|
+
selectedItems: currentValue,
|
|
75789
|
+
onSelectionChange: (selectedItems) => updateFieldValue(rowIndex, selectedItems),
|
|
75790
|
+
options: field.options || [],
|
|
75791
|
+
placeholder: field.placeholder || `Select ${field.label}`,
|
|
75792
|
+
className: "w-full"
|
|
75793
|
+
}
|
|
75794
|
+
);
|
|
75795
|
+
};
|
|
75796
|
+
case "checkbox":
|
|
75797
|
+
case "boolean":
|
|
75798
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75799
|
+
Checkbox,
|
|
75800
|
+
{
|
|
75801
|
+
checked: Boolean(props[field.key]),
|
|
75802
|
+
onChange: (checked) => updateFieldValue(rowIndex, checked),
|
|
75803
|
+
label: field.placeholder || field.label,
|
|
75804
|
+
className: "w-full"
|
|
75805
|
+
}
|
|
75806
|
+
);
|
|
75807
|
+
case "toggle":
|
|
75808
|
+
case "switch":
|
|
75809
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75810
|
+
ToggleSwitch,
|
|
75811
|
+
{
|
|
75812
|
+
isOn: Boolean(props[field.key]),
|
|
75813
|
+
onToggle: (isOn) => updateFieldValue(rowIndex, isOn),
|
|
75814
|
+
label: field.placeholder || field.label,
|
|
75815
|
+
className: "w-full"
|
|
75816
|
+
}
|
|
75817
|
+
);
|
|
75818
|
+
case "date":
|
|
75819
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75820
|
+
DatePicker,
|
|
75821
|
+
{
|
|
75822
|
+
selectedDate: props[field.key] ? new Date(props[field.key]) : null,
|
|
75823
|
+
onDateChange: (date) => updateFieldValue(rowIndex, date ? date.toISOString().split("T")[0] : ""),
|
|
75824
|
+
placeholder: field.placeholder || "Select date",
|
|
75825
|
+
className: "w-full"
|
|
75826
|
+
}
|
|
75827
|
+
);
|
|
75828
|
+
case "datetime":
|
|
75829
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75830
|
+
Input,
|
|
75831
|
+
{
|
|
75832
|
+
type: "datetime-local",
|
|
75833
|
+
value: props[field.key] || "",
|
|
75834
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75835
|
+
placeholder: field.placeholder || "Select date and time",
|
|
75836
|
+
required: field.required,
|
|
75837
|
+
className: "w-full"
|
|
75838
|
+
}
|
|
75839
|
+
);
|
|
75840
|
+
case "time":
|
|
75841
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75842
|
+
Input,
|
|
75843
|
+
{
|
|
75844
|
+
type: "time",
|
|
75845
|
+
value: props[field.key] || "",
|
|
75846
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75847
|
+
placeholder: field.placeholder || "Select time",
|
|
75848
|
+
required: field.required,
|
|
75849
|
+
className: "w-full"
|
|
75850
|
+
}
|
|
75851
|
+
);
|
|
75852
|
+
case "radio":
|
|
75853
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75854
|
+
RadioGroup,
|
|
75855
|
+
{
|
|
75856
|
+
selectedValue: props[field.key] || "",
|
|
75857
|
+
onValueChange: (value) => updateFieldValue(rowIndex, value),
|
|
75858
|
+
options: field.options || [],
|
|
75859
|
+
className: "w-full"
|
|
75860
|
+
}
|
|
75861
|
+
);
|
|
75862
|
+
case "search":
|
|
75863
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75864
|
+
SearchBar,
|
|
75865
|
+
{
|
|
75866
|
+
value: props[field.key] || "",
|
|
75867
|
+
onChange: (value) => updateFieldValue(rowIndex, value),
|
|
75868
|
+
placeholder: field.placeholder || `Search ${field.label}`,
|
|
75869
|
+
className: "w-full"
|
|
75870
|
+
}
|
|
75871
|
+
);
|
|
75872
|
+
case "audience":
|
|
75873
|
+
return (props, rowIndex) => {
|
|
75874
|
+
const audienceData = props[field.key] || { users: [], groups: [], roles: [] };
|
|
75875
|
+
const allAudience = [
|
|
75876
|
+
...audienceData.users || [],
|
|
75877
|
+
...audienceData.groups || [],
|
|
75878
|
+
...audienceData.roles || []
|
|
75879
|
+
];
|
|
75880
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
75881
|
+
/* @__PURE__ */ jsx(AvatarGroup, { children: allAudience.length > 0 ? allAudience.slice(0, 3).map((aud, idx) => /* @__PURE__ */ jsx(
|
|
75882
|
+
Avatar,
|
|
75883
|
+
{
|
|
75884
|
+
size: "small",
|
|
75885
|
+
name: aud.name || aud.displayName || aud.id,
|
|
75886
|
+
src: aud.avatarUrl
|
|
75887
|
+
},
|
|
75888
|
+
idx
|
|
75889
|
+
)) : null }),
|
|
75890
|
+
/* @__PURE__ */ jsx(
|
|
75891
|
+
"button",
|
|
75892
|
+
{
|
|
75893
|
+
className: "text-blue-600 font-semibold hover:text-blue-800",
|
|
75894
|
+
onClick: () => {
|
|
75895
|
+
setAudienceFieldName(field.key);
|
|
75896
|
+
setAudienceRowId(rowIndex);
|
|
75897
|
+
},
|
|
75898
|
+
children: allAudience.length > 0 ? "Edit" : "Assign"
|
|
75899
|
+
}
|
|
75900
|
+
)
|
|
75901
|
+
] });
|
|
75902
|
+
};
|
|
75903
|
+
case "color":
|
|
75904
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75905
|
+
Input,
|
|
75906
|
+
{
|
|
75907
|
+
type: "color",
|
|
75908
|
+
value: props[field.key] || "#000000",
|
|
75909
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75910
|
+
className: "w-full h-10"
|
|
75911
|
+
}
|
|
75912
|
+
);
|
|
75913
|
+
case "range":
|
|
75914
|
+
return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
75915
|
+
/* @__PURE__ */ jsx(
|
|
75916
|
+
Input,
|
|
75917
|
+
{
|
|
75918
|
+
type: "range",
|
|
75919
|
+
value: props[field.key] || field.min || 0,
|
|
75920
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75921
|
+
min: field.min || 0,
|
|
75922
|
+
max: field.max || 100,
|
|
75923
|
+
step: field.step || 1,
|
|
75924
|
+
className: "w-full"
|
|
75925
|
+
}
|
|
75926
|
+
),
|
|
75927
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-gray-500", children: props[field.key] || field.min || 0 })
|
|
75928
|
+
] });
|
|
75929
|
+
case "file":
|
|
75930
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75931
|
+
Input,
|
|
75932
|
+
{
|
|
75933
|
+
type: "file",
|
|
75934
|
+
onChange: (e) => {
|
|
75935
|
+
const file = e.target.files[0];
|
|
75936
|
+
updateFieldValue(rowIndex, file ? file.name : "");
|
|
75937
|
+
},
|
|
75938
|
+
accept: field.accept,
|
|
75939
|
+
className: "w-full"
|
|
75940
|
+
}
|
|
75941
|
+
);
|
|
75942
|
+
case "hidden":
|
|
75943
|
+
return (props, rowIndex) => /* @__PURE__ */ jsx(
|
|
75944
|
+
Input,
|
|
75945
|
+
{
|
|
75946
|
+
type: "hidden",
|
|
75947
|
+
value: props[field.key] || "",
|
|
75948
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value)
|
|
75949
|
+
}
|
|
75950
|
+
);
|
|
75951
|
+
// Default fallback for unknown field types
|
|
75952
|
+
default:
|
|
75953
|
+
return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
|
|
75954
|
+
/* @__PURE__ */ jsx(
|
|
75955
|
+
Input,
|
|
75956
|
+
{
|
|
75957
|
+
value: props[field.key] || "",
|
|
75958
|
+
onChange: (e) => updateFieldValue(rowIndex, e.target.value),
|
|
75959
|
+
placeholder: field.placeholder || `Enter ${field.label}`,
|
|
75960
|
+
required: field.required,
|
|
75961
|
+
className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
|
|
75962
|
+
}
|
|
75963
|
+
),
|
|
75964
|
+
renderError(rowIndex)
|
|
75965
|
+
] });
|
|
75966
|
+
}
|
|
75967
|
+
};
|
|
75968
|
+
const addBlankRow = useCallback(() => {
|
|
75969
|
+
console.log("[DataTableRenderer] Adding blank row");
|
|
75970
|
+
setData((prevData) => {
|
|
75971
|
+
console.log("[DataTableRenderer] Current data before add:", prevData);
|
|
75972
|
+
const blankRow = {
|
|
75973
|
+
id: prevData.length
|
|
75974
|
+
// Assign next available ID
|
|
75975
|
+
};
|
|
75976
|
+
section.fields.forEach((field) => {
|
|
75977
|
+
if (field.fieldtype === "audience") {
|
|
75978
|
+
blankRow[field.key] = { users: [], groups: [], roles: [] };
|
|
75979
|
+
} else {
|
|
75980
|
+
blankRow[field.key] = field.default || "";
|
|
75981
|
+
}
|
|
75982
|
+
});
|
|
75983
|
+
console.log("[DataTableRenderer] New blank row:", blankRow);
|
|
75984
|
+
const newData = [...prevData, blankRow];
|
|
75985
|
+
console.log("[DataTableRenderer] Updated data:", newData);
|
|
75986
|
+
return newData;
|
|
75987
|
+
});
|
|
75988
|
+
}, [section.fields]);
|
|
75989
|
+
const removeRow = useCallback((index) => {
|
|
75990
|
+
setData((prevData) => {
|
|
75991
|
+
if (prevData.length <= 1) {
|
|
75992
|
+
return prevData;
|
|
75993
|
+
}
|
|
75994
|
+
const newData = [...prevData];
|
|
75995
|
+
newData.splice(index, 1);
|
|
75996
|
+
return newData;
|
|
75997
|
+
});
|
|
75998
|
+
}, []);
|
|
75999
|
+
const [draggedIndex, setDraggedIndex] = useState(null);
|
|
76000
|
+
const handleDragStart = useCallback((e, index) => {
|
|
76001
|
+
setDraggedIndex(index);
|
|
76002
|
+
e.dataTransfer.effectAllowed = "move";
|
|
76003
|
+
e.dataTransfer.setData("text/html", "");
|
|
76004
|
+
}, []);
|
|
76005
|
+
const handleDragOver = useCallback((e) => {
|
|
76006
|
+
e.preventDefault();
|
|
76007
|
+
e.dataTransfer.dropEffect = "move";
|
|
76008
|
+
}, []);
|
|
76009
|
+
const handleDrop = useCallback((e, dropIndex) => {
|
|
76010
|
+
e.preventDefault();
|
|
76011
|
+
if (draggedIndex === null || draggedIndex === dropIndex) return;
|
|
76012
|
+
setData((prevData) => {
|
|
76013
|
+
const newData = [...prevData];
|
|
76014
|
+
const draggedItem = newData[draggedIndex];
|
|
76015
|
+
newData.splice(draggedIndex, 1);
|
|
76016
|
+
newData.splice(dropIndex, 0, draggedItem);
|
|
76017
|
+
return newData;
|
|
76018
|
+
});
|
|
76019
|
+
setDraggedIndex(null);
|
|
76020
|
+
}, [draggedIndex]);
|
|
76021
|
+
const handleDragEnd = useCallback(() => {
|
|
76022
|
+
setDraggedIndex(null);
|
|
76023
|
+
}, []);
|
|
76024
|
+
const handleAddAudience = useCallback((selectedEntities) => {
|
|
76025
|
+
console.log("[DataTableRenderer] handleAddAudience called with:", selectedEntities);
|
|
76026
|
+
setData((prevData) => {
|
|
76027
|
+
const newData = [...prevData];
|
|
76028
|
+
if (audienceRowId !== null && audienceFieldName && newData[audienceRowId]) {
|
|
76029
|
+
const pendingInvites = selectedEntities.pendingInvites || [];
|
|
76030
|
+
const users = pendingInvites.filter((invite) => invite.type === "User");
|
|
76031
|
+
const groups = pendingInvites.filter((invite) => invite.type === "Group");
|
|
76032
|
+
const roles = pendingInvites.filter((invite) => invite.type === "Role");
|
|
76033
|
+
newData[audienceRowId][audienceFieldName] = {
|
|
76034
|
+
users: [...newData[audienceRowId][audienceFieldName]?.users || [], ...users],
|
|
76035
|
+
groups: [...newData[audienceRowId][audienceFieldName]?.groups || [], ...groups],
|
|
76036
|
+
roles: [...newData[audienceRowId][audienceFieldName]?.roles || [], ...roles]
|
|
76037
|
+
};
|
|
76038
|
+
console.log("[DataTableRenderer] Updated audience data:", newData[audienceRowId][audienceFieldName]);
|
|
76039
|
+
}
|
|
76040
|
+
return newData;
|
|
76041
|
+
});
|
|
76042
|
+
setAudienceRowId(null);
|
|
76043
|
+
setAudienceFieldName(null);
|
|
76044
|
+
}, [audienceRowId, audienceFieldName]);
|
|
76045
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
76046
|
+
/* @__PURE__ */ jsxs("div", { style: { marginBottom: "20px" }, children: [
|
|
76047
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
76048
|
+
/* @__PURE__ */ jsx("h2", { style: { fontSize: "20px", fontWeight: "bold", marginBottom: "10px" }, children: section.title }),
|
|
76049
|
+
/* @__PURE__ */ jsx(
|
|
76050
|
+
"button",
|
|
76051
|
+
{
|
|
76052
|
+
className: "btn btn-primary text-white px-6 py-2 rounded-2xl cursor-pointer hover:bg-gray-800",
|
|
76053
|
+
onClick: addBlankRow,
|
|
76054
|
+
children: "Add"
|
|
76055
|
+
}
|
|
76056
|
+
)
|
|
76057
|
+
] }),
|
|
76058
|
+
/* @__PURE__ */ jsx("p", { style: { fontSize: "14px", marginBottom: "10px" }, children: section.description })
|
|
76059
|
+
] }),
|
|
76060
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full bg-white border border-gray-300", children: [
|
|
76061
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "bg-gray-50", children: [
|
|
76062
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 w-10" }),
|
|
76063
|
+
section.fields.map((field, idx) => /* @__PURE__ */ jsx(
|
|
76064
|
+
"th",
|
|
76065
|
+
{
|
|
76066
|
+
className: "px-4 py-2 text-left text-sm font-medium text-gray-700",
|
|
76067
|
+
children: field.label || field.key
|
|
76068
|
+
},
|
|
76069
|
+
idx
|
|
76070
|
+
)),
|
|
76071
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 w-16" })
|
|
76072
|
+
] }) }),
|
|
76073
|
+
/* @__PURE__ */ jsx("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ jsxs(
|
|
76074
|
+
"tr",
|
|
76075
|
+
{
|
|
76076
|
+
className: `hover:bg-gray-50 ${draggedIndex === rowIndex ? "opacity-50" : ""}`,
|
|
76077
|
+
draggable: true,
|
|
76078
|
+
onDragStart: (e) => handleDragStart(e, rowIndex),
|
|
76079
|
+
onDragOver: handleDragOver,
|
|
76080
|
+
onDrop: (e) => handleDrop(e, rowIndex),
|
|
76081
|
+
onDragEnd: handleDragEnd,
|
|
76082
|
+
children: [
|
|
76083
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-2 ", children: /* @__PURE__ */ jsx("div", { className: "cursor-move text-gray-400 hover:text-gray-600", children: /* @__PURE__ */ jsx(GripVertical, { size: 16 }) }) }),
|
|
76084
|
+
section.fields.map((field, fieldIndex) => /* @__PURE__ */ jsx("td", { className: "px-4 py-2 ", children: getFieldRenderer(field)(row, rowIndex) }, fieldIndex)),
|
|
76085
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-2 ", children: /* @__PURE__ */ jsx(
|
|
76086
|
+
"button",
|
|
76087
|
+
{
|
|
76088
|
+
onClick: () => removeRow(rowIndex),
|
|
76089
|
+
className: "text-red-500 hover:text-red-700",
|
|
76090
|
+
title: "Delete row",
|
|
76091
|
+
children: /* @__PURE__ */ jsx(Trash, { size: 16 })
|
|
76092
|
+
}
|
|
76093
|
+
) })
|
|
76094
|
+
]
|
|
76095
|
+
},
|
|
76096
|
+
rowIndex
|
|
76097
|
+
)) })
|
|
76098
|
+
] }) }),
|
|
76099
|
+
audienceRowId !== null && (() => {
|
|
76100
|
+
const existingAudienceData = data[audienceRowId] && data[audienceRowId][audienceFieldName] ? {
|
|
76101
|
+
users: data[audienceRowId][audienceFieldName].users || [],
|
|
76102
|
+
groups: data[audienceRowId][audienceFieldName].groups || [],
|
|
76103
|
+
roles: data[audienceRowId][audienceFieldName].roles || []
|
|
76104
|
+
} : { users: [], groups: [], roles: [] };
|
|
76105
|
+
console.log("[DataTableRenderer] Opening modal with existing data:", existingAudienceData);
|
|
76106
|
+
console.log("[DataTableRenderer] Row data:", data[audienceRowId]);
|
|
76107
|
+
console.log("[DataTableRenderer] Field name:", audienceFieldName);
|
|
76108
|
+
return /* @__PURE__ */ jsx(
|
|
76109
|
+
AddUserGroupsRolesModal,
|
|
76110
|
+
{
|
|
76111
|
+
isOpen: true,
|
|
76112
|
+
onClose: () => {
|
|
76113
|
+
setAudienceRowId(null);
|
|
76114
|
+
setAudienceFieldName(null);
|
|
76115
|
+
},
|
|
76116
|
+
onFinalSubmit: handleAddAudience,
|
|
76117
|
+
existingShares: existingAudienceData,
|
|
76118
|
+
allowedPermissions: ["view", "remove"]
|
|
76119
|
+
}
|
|
76120
|
+
);
|
|
76121
|
+
})()
|
|
76122
|
+
] });
|
|
76123
|
+
}
|
|
76124
|
+
|
|
76125
|
+
const UnknownType = ({ item }) => /* @__PURE__ */ jsxs("div", { className: "p-3 rounded-xl border border-dashed text-sm opacity-70", children: [
|
|
76126
|
+
"Unknown type:",
|
|
76127
|
+
" ",
|
|
76128
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono", children: String(item?.type ?? "N/A") })
|
|
76129
|
+
] });
|
|
76130
|
+
const REGISTRY = /* @__PURE__ */ Object.create(null);
|
|
76131
|
+
REGISTRY.section = SectionRenderer;
|
|
76132
|
+
REGISTRY.datatable = DataTableRenderer;
|
|
76133
|
+
function toType(input) {
|
|
76134
|
+
if (typeof input === "string") return input.trim();
|
|
76135
|
+
if (input && typeof input === "object")
|
|
76136
|
+
return String(input.type || "").trim();
|
|
76137
|
+
return "";
|
|
76138
|
+
}
|
|
76139
|
+
function getComponentForType(input) {
|
|
76140
|
+
const t = toType(input);
|
|
76141
|
+
const C = REGISTRY[t] || REGISTRY[t.toLowerCase?.()] || UnknownType;
|
|
76142
|
+
return C;
|
|
76143
|
+
}
|
|
76144
|
+
function renderByType(input, props = {}) {
|
|
76145
|
+
const C = getComponentForType(input);
|
|
76146
|
+
const pass = input && typeof input === "object" ? { item: input, ...props } : props;
|
|
76147
|
+
return /* @__PURE__ */ jsx(C, { ...pass });
|
|
76148
|
+
}
|
|
76149
|
+
function register(type, component) {
|
|
76150
|
+
if (!type || !component) return;
|
|
76151
|
+
const key = String(type).trim();
|
|
76152
|
+
REGISTRY[key] = component;
|
|
76153
|
+
REGISTRY[key.toLowerCase()] = component;
|
|
76154
|
+
}
|
|
76155
|
+
function ConfigRenderFactory(input, props = {}) {
|
|
76156
|
+
return renderByType(input, props);
|
|
76157
|
+
}
|
|
75062
76158
|
|
|
75063
76159
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
75064
76160
|
|
|
75065
76161
|
function Mt(t){if(typeof document=="undefined")return;let o=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",o.firstChild?o.insertBefore(e,o.firstChild):o.appendChild(e),e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t));}Mt(`:root{--toastify-color-light: #fff;--toastify-color-dark: #121212;--toastify-color-info: #3498db;--toastify-color-success: #07bc0c;--toastify-color-warning: #f1c40f;--toastify-color-error: hsl(6, 78%, 57%);--toastify-color-transparent: rgba(255, 255, 255, .7);--toastify-icon-color-info: var(--toastify-color-info);--toastify-icon-color-success: var(--toastify-color-success);--toastify-icon-color-warning: var(--toastify-color-warning);--toastify-icon-color-error: var(--toastify-color-error);--toastify-container-width: fit-content;--toastify-toast-width: 320px;--toastify-toast-offset: 16px;--toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));--toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));--toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));--toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));--toastify-toast-background: #fff;--toastify-toast-padding: 14px;--toastify-toast-min-height: 64px;--toastify-toast-max-height: 800px;--toastify-toast-bd-radius: 6px;--toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toastify-font-family: sans-serif;--toastify-z-index: 9999;--toastify-text-color-light: #757575;--toastify-text-color-dark: #fff;--toastify-text-color-info: #fff;--toastify-text-color-success: #fff;--toastify-text-color-warning: #fff;--toastify-text-color-error: #fff;--toastify-spinner-color: #616161;--toastify-spinner-color-empty-area: #e0e0e0;--toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);--toastify-color-progress-dark: #bb86fc;--toastify-color-progress-info: var(--toastify-color-info);--toastify-color-progress-success: var(--toastify-color-success);--toastify-color-progress-warning: var(--toastify-color-warning);--toastify-color-progress-error: var(--toastify-color-error);--toastify-color-progress-bgo: .2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translate3d(0,0,var(--toastify-z-index));position:fixed;width:var(--toastify-container-width);box-sizing:border-box;color:#fff;display:flex;flex-direction:column}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right);align-items:end}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right);align-items:end}.Toastify__toast{--y: 0;position:relative;touch-action:none;width:var(--toastify-toast-width);min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:var(--toastify-toast-padding);border-radius:var(--toastify-toast-bd-radius);box-shadow:var(--toastify-toast-shadow);max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);z-index:0;display:flex;flex:1 auto;align-items:center;word-break:break-word}@media only screen and (max-width: 480px){.Toastify__toast-container{width:100vw;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-left,.Toastify__toast-container--top-center,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translate(0)}.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translate(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:initial}.Toastify__toast{--toastify-toast-width: 100%;margin-bottom:0;border-radius:0}}.Toastify__toast-container[data-stacked=true]{width:var(--toastify-toast-width)}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,.Toastify__toast--stacked[data-collapsed] .Toastify__close-button{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-icon{margin-inline-end:10px;width:22px;flex-shrink:0;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--light,.Toastify__toast-theme--colored.Toastify__toast--default{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;position:absolute;top:6px;right:6px;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;z-index:1}.Toastify__toast--rtl .Toastify__close-button{left:6px;right:unset}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:hover,.Toastify__close-button:focus{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:1;opacity:.7;transform-origin:left}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:initial;transform-origin:right;border-bottom-left-radius:initial}.Toastify__progress-bar--wrp{position:absolute;overflow:hidden;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius);border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--top-left,.Toastify__bounce-enter--bottom-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--top-right,.Toastify__bounce-enter--bottom-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--top-left,.Toastify__bounce-exit--bottom-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--top-right,.Toastify__bounce-exit--bottom-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--top-left,.Toastify__slide-enter--bottom-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--top-right,.Toastify__slide-enter--bottom-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--top-left,.Toastify__slide-exit--bottom-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-right,.Toastify__slide-exit--bottom-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
|
75066
76162
|
`);var L=t=>typeof t=="number"&&!isNaN(t),N=t=>typeof t=="string",P=t=>typeof t=="function",mt=t=>N(t)||L(t),B=t=>N(t)||P(t)?t:null,pt=(t,o)=>t===false||L(t)&&t>0?t:o,z=t=>isValidElement(t)||N(t)||P(t)||L(t);function Z(t,o,e=300){let{scrollHeight:r,style:s}=t;requestAnimationFrame(()=>{s.minHeight="initial",s.height=r+"px",s.transition=`all ${e}ms`,requestAnimationFrame(()=>{s.height="0",s.padding="0",s.margin="0",setTimeout(o,e);});});}function $({enter:t,exit:o,appendPosition:e=false,collapse:r=true,collapseDuration:s=300}){return function({children:a,position:d,preventExitTransition:c,done:T,nodeRef:g,isIn:v,playToast:x}){let C=e?`${t}--${d}`:t,S=e?`${o}--${d}`:o,E=useRef(0);return useLayoutEffect(()=>{let f=g.current,p=C.split(" "),b=n=>{n.target===g.current&&(x(),f.removeEventListener("animationend",b),f.removeEventListener("animationcancel",b),E.current===0&&n.type!=="animationcancel"&&f.classList.remove(...p));};(()=>{f.classList.add(...p),f.addEventListener("animationend",b),f.addEventListener("animationcancel",b);})();},[]),useEffect(()=>{let f=g.current,p=()=>{f.removeEventListener("animationend",p),r?Z(f,T,s):T();};v||(c?p():(()=>{E.current=1,f.className+=` ${S}`,f.addEventListener("animationend",p);})());},[v]),React__default.createElement(React__default.Fragment,null,a)}}function J(t,o){return {content:tt(t.content,t.props),containerId:t.props.containerId,id:t.props.toastId,theme:t.props.theme,type:t.props.type,data:t.props.data||{},isLoading:t.props.isLoading,icon:t.props.icon,reason:t.removalReason,status:o}}function tt(t,o,e=false){return isValidElement(t)&&!N(t.type)?cloneElement(t,{closeToast:o.closeToast,toastProps:o,data:o.data,isPaused:e}):P(t)?t({closeToast:o.closeToast,toastProps:o,data:o.data,isPaused:e}):t}function yt({closeToast:t,theme:o,ariaLabel:e="close"}){return React__default.createElement("button",{className:`Toastify__close-button Toastify__close-button--${o}`,type:"button",onClick:r=>{r.stopPropagation(),t(true);},"aria-label":e},React__default.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},React__default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function gt({delay:t,isRunning:o,closeToast:e,type:r="default",hide:s,className:l,controlledProgress:a,progress:d,rtl:c,isIn:T,theme:g}){let v=s||a&&d===0,x={animationDuration:`${t}ms`,animationPlayState:o?"running":"paused"};a&&(x.transform=`scaleX(${d})`);let C=clsx("Toastify__progress-bar",a?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${g}`,`Toastify__progress-bar--${r}`,{["Toastify__progress-bar--rtl"]:c}),S=P(l)?l({rtl:c,type:r,defaultClassName:C}):clsx(C,l),E={[a&&d>=1?"onTransitionEnd":"onAnimationEnd"]:a&&d<1?null:()=>{T&&e();}};return React__default.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":v},React__default.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${g} Toastify__progress-bar--${r}`}),React__default.createElement("div",{role:"progressbar","aria-hidden":v?"true":"false","aria-label":"notification timer",className:S,style:x,...E}))}var Xt=1,at=()=>`${Xt++}`;function _t(t,o,e){let r=1,s=0,l=[],a=[],d=o,c=new Map,T=new Set,g=i=>(T.add(i),()=>T.delete(i)),v=()=>{a=Array.from(c.values()),T.forEach(i=>i());},x=({containerId:i,toastId:n,updateId:u})=>{let h=i?i!==t:t!==1,m=c.has(n)&&u==null;return h||m},C=(i,n)=>{c.forEach(u=>{var h;(n==null||n===u.props.toastId)&&((h=u.toggle)==null||h.call(u,i));});},S=i=>{var n,u;(u=(n=i.props)==null?void 0:n.onClose)==null||u.call(n,i.removalReason),i.isActive=false;},E=i=>{if(i==null)c.forEach(S);else {let n=c.get(i);n&&S(n);}v();},f=()=>{s-=l.length,l=[];},p=i=>{var m,_;let{toastId:n,updateId:u}=i.props,h=u==null;i.staleId&&c.delete(i.staleId),i.isActive=true,c.set(n,i),v(),e(J(i,h?"added":"updated")),h&&((_=(m=i.props).onOpen)==null||_.call(m));};return {id:t,props:d,observe:g,toggle:C,removeToast:E,toasts:c,clearQueue:f,buildToast:(i,n)=>{if(x(n))return;let{toastId:u,updateId:h,data:m,staleId:_,delay:k}=n,M=h==null;M&&s++;let A={...d,style:d.toastStyle,key:r++,...Object.fromEntries(Object.entries(n).filter(([D,Y])=>Y!=null)),toastId:u,updateId:h,data:m,isIn:false,className:B(n.className||d.toastClassName),progressClassName:B(n.progressClassName||d.progressClassName),autoClose:n.isLoading?false:pt(n.autoClose,d.autoClose),closeToast(D){c.get(u).removalReason=D,E(u);},deleteToast(){let D=c.get(u);if(D!=null){if(e(J(D,"removed")),c.delete(u),s--,s<0&&(s=0),l.length>0){p(l.shift());return}v();}}};A.closeButton=d.closeButton,n.closeButton===false||z(n.closeButton)?A.closeButton=n.closeButton:n.closeButton===true&&(A.closeButton=z(d.closeButton)?d.closeButton:true);let R={content:i,props:A,staleId:_};d.limit&&d.limit>0&&s>d.limit&&M?l.push(R):L(k)?setTimeout(()=>{p(R);},k):p(R);},setProps(i){d=i;},setToggle:(i,n)=>{let u=c.get(i);u&&(u.toggle=n);},isToastActive:i=>{var n;return (n=c.get(i))==null?void 0:n.isActive},getSnapshot:()=>a}}var I=new Map,F=[],st=new Set,Vt=t=>st.forEach(o=>o(t)),bt=()=>I.size>0;function Qt(){F.forEach(t=>nt(t.content,t.options)),F=[];}var vt=(t,{containerId:o})=>{var e;return (e=I.get(o||1))==null?void 0:e.toasts.get(t)};function X(t,o){var r;if(o)return !!((r=I.get(o))!=null&&r.isToastActive(t));let e=false;return I.forEach(s=>{s.isToastActive(t)&&(e=true);}),e}function ht(t){if(!bt()){F=F.filter(o=>t!=null&&o.options.toastId!==t);return}if(t==null||mt(t))I.forEach(o=>{o.removeToast(t);});else if(t&&("containerId"in t||"id"in t)){let o=I.get(t.containerId);o?o.removeToast(t.id):I.forEach(e=>{e.removeToast(t.id);});}}var Ct=(t={})=>{I.forEach(o=>{o.props.limit&&(!t.containerId||o.id===t.containerId)&&o.clearQueue();});};function nt(t,o){z(t)&&(bt()||F.push({content:t,options:o}),I.forEach(e=>{e.buildToast(t,o);}));}function xt(t){var o;(o=I.get(t.containerId||1))==null||o.setToggle(t.id,t.fn);}function rt(t,o){I.forEach(e=>{(o==null||!(o!=null&&o.containerId)||(o==null?void 0:o.containerId)===e.id)&&e.toggle(t,o==null?void 0:o.id);});}function Et(t){let o=t.containerId||1;return {subscribe(e){let r=_t(o,t,Vt);I.set(o,r);let s=r.observe(e);return Qt(),()=>{s(),I.delete(o);}},setProps(e){var r;(r=I.get(o))==null||r.setProps(e);},getSnapshot(){var e;return (e=I.get(o))==null?void 0:e.getSnapshot()}}}function Pt(t){return st.add(t),()=>{st.delete(t);}}function Wt(t){return t&&(N(t.toastId)||L(t.toastId))?t.toastId:at()}function U(t,o){return nt(t,o),o.toastId}function V(t,o){return {...o,type:o&&o.type||t,toastId:Wt(o)}}function Q(t){return (o,e)=>U(o,V(t,e))}function y(t,o){return U(t,V("default",o))}y.loading=(t,o)=>U(t,V("default",{isLoading:true,autoClose:false,closeOnClick:false,closeButton:false,draggable:false,...o}));function Gt(t,{pending:o,error:e,success:r},s){let l;o&&(l=N(o)?y.loading(o,s):y.loading(o.render,{...s,...o}));let a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},d=(T,g,v)=>{if(g==null){y.dismiss(l);return}let x={type:T,...a,...s,data:v},C=N(g)?{render:g}:g;return l?y.update(l,{...x,...C}):y(C.render,{...x,...C}),v},c=P(t)?t():t;return c.then(T=>d("success",r,T)).catch(T=>d("error",e,T)),c}y.promise=Gt;y.success=Q("success");y.info=Q("info");y.error=Q("error");y.warning=Q("warning");y.warn=y.warning;y.dark=(t,o)=>U(t,V("default",{theme:"dark",...o}));function qt(t){ht(t);}y.dismiss=qt;y.clearWaitingQueue=Ct;y.isActive=X;y.update=(t,o={})=>{let e=vt(t,o);if(e){let{props:r,content:s}=e,l={delay:100,...r,...o,toastId:o.toastId||t,updateId:at()};l.toastId!==t&&(l.staleId=t);let a=l.render||s;delete l.render,U(a,l);}};y.done=t=>{y.update(t,{progress:1});};y.onChange=Pt;y.play=t=>rt(true,t);y.pause=t=>rt(false,t);function It(t){var a;let{subscribe:o,getSnapshot:e,setProps:r}=useRef(Et(t)).current;r(t);let s=(a=useSyncExternalStore(o,e,e))==null?void 0:a.slice();function l(d){if(!s)return [];let c=new Map;return t.newestOnTop&&s.reverse(),s.forEach(T=>{let{position:g}=T.props;c.has(g)||c.set(g,[]),c.get(g).push(T);}),Array.from(c,T=>d(T[0],T[1]))}return {getToastToRender:l,isToastActive:X,count:s==null?void 0:s.length}}function At(t){let[o,e]=useState(false),[r,s]=useState(false),l=useRef(null),a=useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:true,canDrag:false,didMove:false}).current,{autoClose:d,pauseOnHover:c,closeToast:T,onClick:g,closeOnClick:v}=t;xt({id:t.toastId,containerId:t.containerId,fn:e}),useEffect(()=>{if(t.pauseOnFocusLoss)return x(),()=>{C();}},[t.pauseOnFocusLoss]);function x(){document.hasFocus()||p(),window.addEventListener("focus",f),window.addEventListener("blur",p);}function C(){window.removeEventListener("focus",f),window.removeEventListener("blur",p);}function S(m){if(t.draggable===true||t.draggable===m.pointerType){b();let _=l.current;a.canCloseOnClick=true,a.canDrag=true,_.style.transition="none",t.draggableDirection==="x"?(a.start=m.clientX,a.removalDistance=_.offsetWidth*(t.draggablePercent/100)):(a.start=m.clientY,a.removalDistance=_.offsetHeight*(t.draggablePercent===80?t.draggablePercent*1.5:t.draggablePercent)/100);}}function E(m){let{top:_,bottom:k,left:M,right:A}=l.current.getBoundingClientRect();m.nativeEvent.type!=="touchend"&&t.pauseOnHover&&m.clientX>=M&&m.clientX<=A&&m.clientY>=_&&m.clientY<=k?p():f();}function f(){e(true);}function p(){e(false);}function b(){a.didMove=false,document.addEventListener("pointermove",n),document.addEventListener("pointerup",u);}function i(){document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",u);}function n(m){let _=l.current;if(a.canDrag&&_){a.didMove=true,o&&p(),t.draggableDirection==="x"?a.delta=m.clientX-a.start:a.delta=m.clientY-a.start,a.start!==m.clientX&&(a.canCloseOnClick=false);let k=t.draggableDirection==="x"?`${a.delta}px, var(--y)`:`0, calc(${a.delta}px + var(--y))`;_.style.transform=`translate3d(${k},0)`,_.style.opacity=`${1-Math.abs(a.delta/a.removalDistance)}`;}}function u(){i();let m=l.current;if(a.canDrag&&a.didMove&&m){if(a.canDrag=false,Math.abs(a.delta)>a.removalDistance){s(true),t.closeToast(true),t.collapseAll();return}m.style.transition="transform 0.2s, opacity 0.2s",m.style.removeProperty("transform"),m.style.removeProperty("opacity");}}let h={onPointerDown:S,onPointerUp:E};return d&&c&&(h.onMouseEnter=p,t.stacked||(h.onMouseLeave=f)),v&&(h.onClick=m=>{g&&g(m),a.canCloseOnClick&&T(true);}),{playToast:f,pauseToast:p,isRunning:o,preventExitTransition:r,toastRef:l,eventHandlers:h}}var Ot=typeof window!="undefined"?useLayoutEffect:useEffect;var G=({theme:t,type:o,isLoading:e,...r})=>React__default.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${o})`,...r});function ao(t){return React__default.createElement(G,{...t},React__default.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function so(t){return React__default.createElement(G,{...t},React__default.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function no(t){return React__default.createElement(G,{...t},React__default.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function ro(t){return React__default.createElement(G,{...t},React__default.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function io(){return React__default.createElement("div",{className:"Toastify__spinner"})}var W={info:so,warning:ao,success:no,error:ro,spinner:io},lo=t=>t in W;function Nt({theme:t,type:o,isLoading:e,icon:r}){let s=null,l={theme:t,type:o};return r===false||(P(r)?s=r({...l,isLoading:e}):isValidElement(r)?s=cloneElement(r,l):e?s=W.spinner():lo(o)&&(s=W[o](l))),s}var wt=t=>{let{isRunning:o,preventExitTransition:e,toastRef:r,eventHandlers:s,playToast:l}=At(t),{closeButton:a,children:d,autoClose:c,onClick:T,type:g,hideProgressBar:v,closeToast:x,transition:C,position:S,className:E,style:f,progressClassName:p,updateId:b,role:i,progress:n,rtl:u,toastId:h,deleteToast:m,isIn:_,isLoading:k,closeOnClick:M,theme:A,ariaLabel:R}=t,D=clsx("Toastify__toast",`Toastify__toast-theme--${A}`,`Toastify__toast--${g}`,{["Toastify__toast--rtl"]:u},{["Toastify__toast--close-on-click"]:M}),Y=P(E)?E({rtl:u,position:S,type:g,defaultClassName:D}):clsx(D,E),ft=Nt(t),dt=!!n||!c,j={closeToast:x,type:g,theme:A},H=null;return a===false||(P(a)?H=a(j):isValidElement(a)?H=cloneElement(a,j):H=yt(j)),React__default.createElement(C,{isIn:_,done:m,position:S,preventExitTransition:e,nodeRef:r,playToast:l},React__default.createElement("div",{id:h,tabIndex:0,onClick:T,"data-in":_,className:Y,...s,style:f,ref:r,..._&&{role:i,"aria-label":R}},ft!=null&&React__default.createElement("div",{className:clsx("Toastify__toast-icon",{["Toastify--animate-icon Toastify__zoom-enter"]:!k})},ft),tt(d,t,!o),H,!t.customProgressBar&&React__default.createElement(gt,{...b&&!dt?{key:`p-${b}`}:{},rtl:u,theme:A,delay:c,isRunning:o,isIn:_,closeToast:x,hide:v,type:g,className:p,controlledProgress:dt,progress:n||0})))};var K=(t,o=false)=>({enter:`Toastify--animate Toastify__${t}-enter`,exit:`Toastify--animate Toastify__${t}-exit`,appendPosition:o}),lt=$(K("bounce",true)),mo=$(K("slide",true));var _o={position:"top-right",transition:lt,autoClose:5e3,closeButton:true,pauseOnHover:true,pauseOnFocusLoss:true,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light","aria-label":"Notifications Alt+T",hotKeys:t=>t.altKey&&t.code==="KeyT"};function Lt(t){let o={..._o,...t},e=t.stacked,[r,s]=useState(true),l=useRef(null),{getToastToRender:a,isToastActive:d,count:c}=It(o),{className:T,style:g,rtl:v,containerId:x,hotKeys:C}=o;function S(f){let p=clsx("Toastify__toast-container",`Toastify__toast-container--${f}`,{["Toastify__toast-container--rtl"]:v});return P(T)?T({position:f,rtl:v,defaultClassName:p}):clsx(p,B(T))}function E(){e&&(s(true),y.play());}return Ot(()=>{var f;if(e){let p=l.current.querySelectorAll('[data-in="true"]'),b=12,i=(f=o.position)==null?void 0:f.includes("top"),n=0,u=0;Array.from(p).reverse().forEach((h,m)=>{let _=h;_.classList.add("Toastify__toast--stacked"),m>0&&(_.dataset.collapsed=`${r}`),_.dataset.pos||(_.dataset.pos=i?"top":"bot");let k=n*(r?.2:1)+(r?0:b*m);_.style.setProperty("--y",`${i?k:k*-1}px`),_.style.setProperty("--g",`${b}`),_.style.setProperty("--s",`${1-(r?u:0)}`),n+=_.offsetHeight,u+=.025;});}},[r,c,e]),useEffect(()=>{function f(p){var i;let b=l.current;C(p)&&((i=b.querySelector('[tabIndex="0"]'))==null||i.focus(),s(false),y.pause()),p.key==="Escape"&&(document.activeElement===b||b!=null&&b.contains(document.activeElement))&&(s(true),y.play());}return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f);}},[C]),React__default.createElement("section",{ref:l,className:"Toastify",id:x,onMouseEnter:()=>{e&&(s(false),y.pause());},onMouseLeave:E,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":o["aria-label"]},a((f,p)=>{let b=p.length?{...g}:{...g,pointerEvents:"none"};return React__default.createElement("div",{tabIndex:-1,className:S(f),"data-stacked":e,style:b,key:`c-${f}`},p.map(({content:i,props:n})=>React__default.createElement(wt,{...n,stacked:e,collapseAll:E,isIn:d(n.toastId,n.containerId),key:`t-${n.key}`},i)))}))}
|
|
75067
76163
|
|
|
76164
|
+
function DynamicConfig({
|
|
76165
|
+
appid,
|
|
76166
|
+
configdata = null,
|
|
76167
|
+
disableApi = false
|
|
76168
|
+
}) {
|
|
76169
|
+
const [config, setConfig] = React__default.useState(configdata);
|
|
76170
|
+
const [data, setData] = React__default.useState(null);
|
|
76171
|
+
const [loading, setLoading] = useState(false);
|
|
76172
|
+
const [validationErrors, setValidationErrors] = useState({});
|
|
76173
|
+
const configEndPoint = `${gatewayBase()}/unifyedxappmodulemanagement/api/v1/appmanager/${appid}/configuration`;
|
|
76174
|
+
const updateEndPoint = configEndPoint;
|
|
76175
|
+
const [reload, setReload] = useState(1);
|
|
76176
|
+
const transformApiResponse = (apiResponse) => {
|
|
76177
|
+
if (!configdata || !configdata.configuration) {
|
|
76178
|
+
return apiResponse;
|
|
76179
|
+
}
|
|
76180
|
+
const transformedData = {};
|
|
76181
|
+
const configurationData = apiResponse?.configuration || {};
|
|
76182
|
+
configdata.configuration.forEach((section) => {
|
|
76183
|
+
if (section.key && section.type === "datatable" && section.key === "newsFeeds") {
|
|
76184
|
+
const newsFeeds = configurationData.newsFeeds || [];
|
|
76185
|
+
const transformedRows = newsFeeds.map((nf, index) => {
|
|
76186
|
+
let audienceData = { users: [], groups: [], roles: [] };
|
|
76187
|
+
if (nf.audience) {
|
|
76188
|
+
if (Array.isArray(nf.audience)) {
|
|
76189
|
+
audienceData = { users: [], groups: [], roles: [] };
|
|
76190
|
+
} else if (typeof nf.audience === "object") {
|
|
76191
|
+
audienceData = {
|
|
76192
|
+
users: nf.audience.users || [],
|
|
76193
|
+
groups: nf.audience.groups || [],
|
|
76194
|
+
roles: nf.audience.roles || []
|
|
76195
|
+
};
|
|
76196
|
+
}
|
|
76197
|
+
}
|
|
76198
|
+
const transformedRow = {
|
|
76199
|
+
id: nf.id || 0,
|
|
76200
|
+
category: nf.category || "",
|
|
76201
|
+
url: nf.url || "",
|
|
76202
|
+
// Keep as 'url' to match config.json
|
|
76203
|
+
audience: audienceData
|
|
76204
|
+
};
|
|
76205
|
+
return transformedRow;
|
|
76206
|
+
});
|
|
76207
|
+
if (transformedRows.length === 0) {
|
|
76208
|
+
const emptyRow = { id: 0 };
|
|
76209
|
+
if (section.fields) {
|
|
76210
|
+
section.fields.forEach((field) => {
|
|
76211
|
+
if (field.fieldtype === "audience") {
|
|
76212
|
+
emptyRow[field.key] = { users: [], groups: [], roles: [] };
|
|
76213
|
+
} else {
|
|
76214
|
+
emptyRow[field.key] = field.default || "";
|
|
76215
|
+
}
|
|
76216
|
+
});
|
|
76217
|
+
}
|
|
76218
|
+
transformedRows.push(emptyRow);
|
|
76219
|
+
}
|
|
76220
|
+
transformedData[section.key] = transformedRows;
|
|
76221
|
+
} else if (section.key) {
|
|
76222
|
+
transformedData[section.key] = configurationData[section.key] || {};
|
|
76223
|
+
}
|
|
76224
|
+
});
|
|
76225
|
+
return transformedData;
|
|
76226
|
+
};
|
|
76227
|
+
const initializeEmptyData = () => {
|
|
76228
|
+
if (configdata && configdata.configuration) {
|
|
76229
|
+
const configDataState = {};
|
|
76230
|
+
configdata.configuration.forEach((section) => {
|
|
76231
|
+
if (section.key) {
|
|
76232
|
+
if (section.type === "datatable") {
|
|
76233
|
+
const emptyRow = { id: 0 };
|
|
76234
|
+
if (section.fields) {
|
|
76235
|
+
section.fields.forEach((field) => {
|
|
76236
|
+
if (field.fieldtype === "audience") {
|
|
76237
|
+
emptyRow[field.key] = { users: [], groups: [], roles: [] };
|
|
76238
|
+
} else {
|
|
76239
|
+
emptyRow[field.key] = field.default || "";
|
|
76240
|
+
}
|
|
76241
|
+
});
|
|
76242
|
+
}
|
|
76243
|
+
configDataState[section.key] = [emptyRow];
|
|
76244
|
+
} else if (section.type === "section") {
|
|
76245
|
+
const sectionData = {};
|
|
76246
|
+
if (section.fields && Array.isArray(section.fields)) {
|
|
76247
|
+
section.fields.forEach((field) => {
|
|
76248
|
+
if (field.key) {
|
|
76249
|
+
sectionData[field.key] = field.default || "";
|
|
76250
|
+
}
|
|
76251
|
+
});
|
|
76252
|
+
}
|
|
76253
|
+
configDataState[section.key] = sectionData;
|
|
76254
|
+
} else {
|
|
76255
|
+
configDataState[section.key] = {};
|
|
76256
|
+
}
|
|
76257
|
+
}
|
|
76258
|
+
});
|
|
76259
|
+
setData(configDataState);
|
|
76260
|
+
}
|
|
76261
|
+
};
|
|
76262
|
+
useEffect(() => {
|
|
76263
|
+
if (disableApi) {
|
|
76264
|
+
setLoading(false);
|
|
76265
|
+
return;
|
|
76266
|
+
}
|
|
76267
|
+
const fetchData = async () => {
|
|
76268
|
+
try {
|
|
76269
|
+
setLoading(true);
|
|
76270
|
+
let response = await axiosGet(configEndPoint);
|
|
76271
|
+
if (response) {
|
|
76272
|
+
const transformedData = transformApiResponse(response);
|
|
76273
|
+
setData(transformedData);
|
|
76274
|
+
} else {
|
|
76275
|
+
initializeEmptyData();
|
|
76276
|
+
}
|
|
76277
|
+
} catch (error) {
|
|
76278
|
+
console.error("Error fetching configuration:", error);
|
|
76279
|
+
let errorMessage = "Failed to load configuration";
|
|
76280
|
+
if (error.response) {
|
|
76281
|
+
const status = error.response.status;
|
|
76282
|
+
const serverMessage = error.response.data?.message || error.response.data?.error;
|
|
76283
|
+
if (status === 400) {
|
|
76284
|
+
errorMessage = serverMessage || "Invalid request. Please check the application ID.";
|
|
76285
|
+
} else if (status === 401) {
|
|
76286
|
+
errorMessage = "You are not authorized to access this configuration.";
|
|
76287
|
+
} else if (status === 403) {
|
|
76288
|
+
errorMessage = "Access denied. You don't have permission to view this configuration.";
|
|
76289
|
+
} else if (status === 404) {
|
|
76290
|
+
errorMessage = "Configuration not found. It may not exist yet or the application ID is incorrect.";
|
|
76291
|
+
} else if (status >= 500) {
|
|
76292
|
+
errorMessage = serverMessage || "Server error. Please try again later.";
|
|
76293
|
+
} else {
|
|
76294
|
+
errorMessage = serverMessage || `Failed to load configuration (Error ${status})`;
|
|
76295
|
+
}
|
|
76296
|
+
} else if (error.request) {
|
|
76297
|
+
errorMessage = "Network error. Please check your connection and try again.";
|
|
76298
|
+
} else {
|
|
76299
|
+
errorMessage = error.message || "An unexpected error occurred while loading configuration.";
|
|
76300
|
+
}
|
|
76301
|
+
y.error(errorMessage, {
|
|
76302
|
+
autoClose: 6e3,
|
|
76303
|
+
hideProgressBar: false,
|
|
76304
|
+
closeOnClick: true,
|
|
76305
|
+
pauseOnHover: true,
|
|
76306
|
+
draggable: true
|
|
76307
|
+
});
|
|
76308
|
+
initializeEmptyData();
|
|
76309
|
+
} finally {
|
|
76310
|
+
setLoading(false);
|
|
76311
|
+
}
|
|
76312
|
+
};
|
|
76313
|
+
if (configdata) {
|
|
76314
|
+
setConfig(configdata);
|
|
76315
|
+
if (appid) {
|
|
76316
|
+
fetchData();
|
|
76317
|
+
} else {
|
|
76318
|
+
initializeEmptyData();
|
|
76319
|
+
}
|
|
76320
|
+
}
|
|
76321
|
+
}, [configdata, reload, appid, disableApi]);
|
|
76322
|
+
const handleSectionChange = (name, sectiondata) => {
|
|
76323
|
+
setData((prev) => {
|
|
76324
|
+
const newData = {
|
|
76325
|
+
...prev,
|
|
76326
|
+
[name]: sectiondata
|
|
76327
|
+
};
|
|
76328
|
+
return newData;
|
|
76329
|
+
});
|
|
76330
|
+
setValidationErrors((prevErrors) => {
|
|
76331
|
+
const newErrors = { ...prevErrors };
|
|
76332
|
+
if (newErrors[name]) {
|
|
76333
|
+
delete newErrors[name];
|
|
76334
|
+
}
|
|
76335
|
+
return newErrors;
|
|
76336
|
+
});
|
|
76337
|
+
};
|
|
76338
|
+
const validateRequiredFields = () => {
|
|
76339
|
+
const errors = {};
|
|
76340
|
+
if (!config || !data) {
|
|
76341
|
+
return errors;
|
|
76342
|
+
}
|
|
76343
|
+
config.configuration.forEach((section) => {
|
|
76344
|
+
if (section.type === "section") {
|
|
76345
|
+
section.fields.forEach((field) => {
|
|
76346
|
+
if (field.required) {
|
|
76347
|
+
const value = data[section.key]?.[field.key];
|
|
76348
|
+
if (!value || typeof value === "string" && value.trim() === "") {
|
|
76349
|
+
if (!errors[section.key]) errors[section.key] = {};
|
|
76350
|
+
errors[section.key][field.key] = `${field.label} is required`;
|
|
76351
|
+
}
|
|
76352
|
+
}
|
|
76353
|
+
});
|
|
76354
|
+
} else if (section.type === "datatable") {
|
|
76355
|
+
const tableData = data[section.key];
|
|
76356
|
+
if (Array.isArray(tableData)) {
|
|
76357
|
+
tableData.forEach((row, rowIndex) => {
|
|
76358
|
+
section.fields.forEach((field) => {
|
|
76359
|
+
if (field.required) {
|
|
76360
|
+
const value = row[field.key];
|
|
76361
|
+
if (!value || typeof value === "string" && value.trim() === "") {
|
|
76362
|
+
if (!errors[section.key]) errors[section.key] = {};
|
|
76363
|
+
if (!errors[section.key][rowIndex]) errors[section.key][rowIndex] = {};
|
|
76364
|
+
errors[section.key][rowIndex][field.key] = `${field.label} is required`;
|
|
76365
|
+
}
|
|
76366
|
+
}
|
|
76367
|
+
});
|
|
76368
|
+
});
|
|
76369
|
+
}
|
|
76370
|
+
}
|
|
76371
|
+
});
|
|
76372
|
+
return errors;
|
|
76373
|
+
};
|
|
76374
|
+
const hasValidationErrors = (errors) => {
|
|
76375
|
+
return Object.keys(errors).length > 0;
|
|
76376
|
+
};
|
|
76377
|
+
const handleSave = () => {
|
|
76378
|
+
const errors = validateRequiredFields();
|
|
76379
|
+
setValidationErrors(errors);
|
|
76380
|
+
if (hasValidationErrors(errors)) {
|
|
76381
|
+
let errorCount = 0;
|
|
76382
|
+
let errorDetails = [];
|
|
76383
|
+
Object.keys(errors).forEach((sectionKey) => {
|
|
76384
|
+
if (typeof errors[sectionKey] === "object") {
|
|
76385
|
+
Object.keys(errors[sectionKey]).forEach((itemKey) => {
|
|
76386
|
+
if (typeof errors[sectionKey][itemKey] === "object") {
|
|
76387
|
+
Object.keys(errors[sectionKey][itemKey]).forEach((fieldKey) => {
|
|
76388
|
+
errorCount++;
|
|
76389
|
+
errorDetails.push(`${sectionKey} row ${parseInt(itemKey) + 1}: ${errors[sectionKey][itemKey][fieldKey]}`);
|
|
76390
|
+
});
|
|
76391
|
+
} else {
|
|
76392
|
+
errorCount++;
|
|
76393
|
+
errorDetails.push(`${sectionKey}: ${errors[sectionKey][itemKey]}`);
|
|
76394
|
+
}
|
|
76395
|
+
});
|
|
76396
|
+
}
|
|
76397
|
+
});
|
|
76398
|
+
const errorMessage = errorCount === 1 ? "Please fill in the required field before saving" : `Please fill in all ${errorCount} required fields before saving`;
|
|
76399
|
+
y.error(errorMessage, {
|
|
76400
|
+
autoClose: 6e3,
|
|
76401
|
+
hideProgressBar: false,
|
|
76402
|
+
closeOnClick: true,
|
|
76403
|
+
pauseOnHover: true,
|
|
76404
|
+
draggable: true
|
|
76405
|
+
});
|
|
76406
|
+
return;
|
|
76407
|
+
}
|
|
76408
|
+
const saveData = async () => {
|
|
76409
|
+
try {
|
|
76410
|
+
setLoading(true);
|
|
76411
|
+
const transformedPayload = {};
|
|
76412
|
+
if (data) {
|
|
76413
|
+
Object.keys(data).forEach((key) => {
|
|
76414
|
+
if (key === "newsFeeds" && Array.isArray(data[key])) {
|
|
76415
|
+
transformedPayload[key] = data[key].map((item) => {
|
|
76416
|
+
let audienceData = { users: [], groups: [], roles: [] };
|
|
76417
|
+
if (item.audience) {
|
|
76418
|
+
if (typeof item.audience === "object" && !Array.isArray(item.audience)) {
|
|
76419
|
+
audienceData = {
|
|
76420
|
+
users: item.audience.users || [],
|
|
76421
|
+
groups: item.audience.groups || [],
|
|
76422
|
+
roles: item.audience.roles || []
|
|
76423
|
+
};
|
|
76424
|
+
}
|
|
76425
|
+
}
|
|
76426
|
+
return {
|
|
76427
|
+
id: item.id || 0,
|
|
76428
|
+
category: item.category || "",
|
|
76429
|
+
url: item.url || "",
|
|
76430
|
+
// Keep as 'url' to match API and config
|
|
76431
|
+
audience: audienceData
|
|
76432
|
+
};
|
|
76433
|
+
});
|
|
76434
|
+
} else {
|
|
76435
|
+
transformedPayload[key] = data[key];
|
|
76436
|
+
}
|
|
76437
|
+
});
|
|
76438
|
+
}
|
|
76439
|
+
let response = await axiosPost(updateEndPoint, transformedPayload);
|
|
76440
|
+
if (response && response.data?.status != "fail") {
|
|
76441
|
+
setValidationErrors({});
|
|
76442
|
+
const successMessage = response.message || "Configuration has been saved successfully";
|
|
76443
|
+
y.success(successMessage, {
|
|
76444
|
+
autoClose: 4e3,
|
|
76445
|
+
hideProgressBar: false,
|
|
76446
|
+
closeOnClick: true,
|
|
76447
|
+
pauseOnHover: true,
|
|
76448
|
+
draggable: true
|
|
76449
|
+
});
|
|
76450
|
+
} else {
|
|
76451
|
+
throw new Error("No response received from server");
|
|
76452
|
+
}
|
|
76453
|
+
} catch (error) {
|
|
76454
|
+
let errorMessage = "Failed to save configuration";
|
|
76455
|
+
if (error.response) {
|
|
76456
|
+
const status = error.response.status;
|
|
76457
|
+
const serverMessage = error.response.data?.message || error.response.data?.error;
|
|
76458
|
+
if (status === 400) {
|
|
76459
|
+
errorMessage = serverMessage || "Invalid configuration data. Please check your inputs.";
|
|
76460
|
+
} else if (status === 401) {
|
|
76461
|
+
errorMessage = "You are not authorized to save this configuration.";
|
|
76462
|
+
} else if (status === 403) {
|
|
76463
|
+
errorMessage = "Access denied. You don't have permission to save this configuration.";
|
|
76464
|
+
} else if (status === 404) {
|
|
76465
|
+
errorMessage = "Configuration endpoint not found. Please contact support.";
|
|
76466
|
+
} else if (status >= 500) {
|
|
76467
|
+
errorMessage = serverMessage || "Server error. Please try again later.";
|
|
76468
|
+
} else {
|
|
76469
|
+
errorMessage = serverMessage || `Failed to save configuration (Error ${status})`;
|
|
76470
|
+
}
|
|
76471
|
+
} else if (error.request) {
|
|
76472
|
+
errorMessage = "Network error. Please check your connection and try again.";
|
|
76473
|
+
} else {
|
|
76474
|
+
errorMessage = error.message || "An unexpected error occurred while saving.";
|
|
76475
|
+
}
|
|
76476
|
+
y.error(errorMessage, {
|
|
76477
|
+
autoClose: 8e3,
|
|
76478
|
+
hideProgressBar: false,
|
|
76479
|
+
closeOnClick: true,
|
|
76480
|
+
pauseOnHover: true,
|
|
76481
|
+
draggable: true
|
|
76482
|
+
});
|
|
76483
|
+
} finally {
|
|
76484
|
+
setLoading(false);
|
|
76485
|
+
}
|
|
76486
|
+
};
|
|
76487
|
+
saveData();
|
|
76488
|
+
};
|
|
76489
|
+
const handleCancel = () => {
|
|
76490
|
+
const hasUnsavedChanges = validationErrors && Object.keys(validationErrors).length > 0;
|
|
76491
|
+
if (hasUnsavedChanges) {
|
|
76492
|
+
const confirmed = window.confirm(
|
|
76493
|
+
"You have validation errors that will be lost. Are you sure you want to cancel?"
|
|
76494
|
+
);
|
|
76495
|
+
if (!confirmed) {
|
|
76496
|
+
return;
|
|
76497
|
+
}
|
|
76498
|
+
}
|
|
76499
|
+
setValidationErrors({});
|
|
76500
|
+
setData(null);
|
|
76501
|
+
setReload((prev) => prev + 1);
|
|
76502
|
+
y.info("Configuration changes cancelled", {
|
|
76503
|
+
autoClose: 2e3,
|
|
76504
|
+
hideProgressBar: false,
|
|
76505
|
+
closeOnClick: true,
|
|
76506
|
+
pauseOnHover: true,
|
|
76507
|
+
draggable: true
|
|
76508
|
+
});
|
|
76509
|
+
};
|
|
76510
|
+
if (!config?.configuration && !configdata?.configuration) {
|
|
76511
|
+
return /* @__PURE__ */ jsxs("div", { className: "min-h-screen flex items-center justify-center", children: [
|
|
76512
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "No configuration available" }),
|
|
76513
|
+
/* @__PURE__ */ jsx(
|
|
76514
|
+
Lt,
|
|
76515
|
+
{
|
|
76516
|
+
position: "top-right",
|
|
76517
|
+
autoClose: 5e3,
|
|
76518
|
+
hideProgressBar: false,
|
|
76519
|
+
newestOnTop: false,
|
|
76520
|
+
closeOnClick: true,
|
|
76521
|
+
rtl: false,
|
|
76522
|
+
pauseOnFocusLoss: true,
|
|
76523
|
+
draggable: true,
|
|
76524
|
+
pauseOnHover: true,
|
|
76525
|
+
theme: "light"
|
|
76526
|
+
}
|
|
76527
|
+
)
|
|
76528
|
+
] });
|
|
76529
|
+
}
|
|
76530
|
+
const configurationSections = configdata?.configuration || config?.configuration;
|
|
76531
|
+
useEffect(() => {
|
|
76532
|
+
if (disableApi && configdata) {
|
|
76533
|
+
const transformedData = transformApiResponse(configdata);
|
|
76534
|
+
setData(transformedData);
|
|
76535
|
+
} else if (disableApi && !configdata) {
|
|
76536
|
+
initializeEmptyData();
|
|
76537
|
+
}
|
|
76538
|
+
}, [disableApi, configdata]);
|
|
76539
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
76540
|
+
/* @__PURE__ */ jsxs(
|
|
76541
|
+
"div",
|
|
76542
|
+
{
|
|
76543
|
+
className: "dynamic-config bg-white w-full h-[calc(100vh-350px)] overflow-y-auto",
|
|
76544
|
+
style: { padding: "0px 20px 0px 0px" },
|
|
76545
|
+
children: [
|
|
76546
|
+
loading && /* @__PURE__ */ jsx(Spinner, { size: "small" }),
|
|
76547
|
+
configurationSections?.map((section, index) => {
|
|
76548
|
+
const C = getComponentForType(section.type);
|
|
76549
|
+
if (C && C !== "UnknownType") {
|
|
76550
|
+
return /* @__PURE__ */ jsx(
|
|
76551
|
+
C,
|
|
76552
|
+
{
|
|
76553
|
+
item: section,
|
|
76554
|
+
data,
|
|
76555
|
+
updateHandler: handleSectionChange,
|
|
76556
|
+
validationErrors
|
|
76557
|
+
},
|
|
76558
|
+
index
|
|
76559
|
+
);
|
|
76560
|
+
}
|
|
76561
|
+
})
|
|
76562
|
+
]
|
|
76563
|
+
}
|
|
76564
|
+
),
|
|
76565
|
+
/* @__PURE__ */ jsxs("div", { className: "w-full gap-5 bg-white flex justify-end py-3 px-7 rounded-t-md rounded-b-2xl border border-gray-300", style: "box-shadow: 0 -2px 10px 0 rgba(0, 0, 0, 0.20); margin-top: 20px;", children: [
|
|
76566
|
+
/* @__PURE__ */ jsx(
|
|
76567
|
+
UnifyedCoreButton,
|
|
76568
|
+
{
|
|
76569
|
+
category: "secondary",
|
|
76570
|
+
onClick: handleCancel,
|
|
76571
|
+
label: "Cancel",
|
|
76572
|
+
disabled: loading
|
|
76573
|
+
}
|
|
76574
|
+
),
|
|
76575
|
+
/* @__PURE__ */ jsx(
|
|
76576
|
+
UnifyedCoreButton,
|
|
76577
|
+
{
|
|
76578
|
+
category: "primary",
|
|
76579
|
+
onClick: handleSave,
|
|
76580
|
+
disabled: loading,
|
|
76581
|
+
label: loading ? "Saving..." : "Apply",
|
|
76582
|
+
type: "submit"
|
|
76583
|
+
}
|
|
76584
|
+
)
|
|
76585
|
+
] }),
|
|
76586
|
+
/* @__PURE__ */ jsx(
|
|
76587
|
+
Lt,
|
|
76588
|
+
{
|
|
76589
|
+
position: "top-right",
|
|
76590
|
+
autoClose: 5e3,
|
|
76591
|
+
hideProgressBar: false,
|
|
76592
|
+
newestOnTop: false,
|
|
76593
|
+
closeOnClick: true,
|
|
76594
|
+
rtl: false,
|
|
76595
|
+
pauseOnFocusLoss: true,
|
|
76596
|
+
draggable: true,
|
|
76597
|
+
pauseOnHover: true,
|
|
76598
|
+
theme: "light",
|
|
76599
|
+
style: { zIndex: 9999 }
|
|
76600
|
+
}
|
|
76601
|
+
)
|
|
76602
|
+
] });
|
|
76603
|
+
}
|
|
76604
|
+
|
|
76605
|
+
const DynamicConfig_stories = {
|
|
76606
|
+
title: "Utils/Configuration/DynamicConfig",
|
|
76607
|
+
parameters: {
|
|
76608
|
+
layout: "fullscreen",
|
|
76609
|
+
docs: {
|
|
76610
|
+
description: {
|
|
76611
|
+
component: "DynamicConfig is a powerful configuration component that automatically generates UI forms based on JSON schema. It handles API calls, data transformation, and form validation."
|
|
76612
|
+
}
|
|
76613
|
+
}
|
|
76614
|
+
}
|
|
76615
|
+
};
|
|
76616
|
+
|
|
76617
|
+
const FullConfigPage = ({
|
|
76618
|
+
config,
|
|
76619
|
+
appid = "default-app",
|
|
76620
|
+
disableApi = false
|
|
76621
|
+
}) => {
|
|
76622
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
76623
|
+
const {
|
|
76624
|
+
pageHeader = {},
|
|
76625
|
+
appletHeader = {},
|
|
76626
|
+
breadcrumb = [],
|
|
76627
|
+
overview = {},
|
|
76628
|
+
configuration = []
|
|
76629
|
+
} = config;
|
|
76630
|
+
const defaultPageHeader = {
|
|
76631
|
+
heading: "App Details",
|
|
76632
|
+
subHeading: "View app details and customize configurations to align with institutional requirements.",
|
|
76633
|
+
isLeftArrow: true,
|
|
76634
|
+
...pageHeader
|
|
76635
|
+
};
|
|
76636
|
+
const defaultAppletHeader = {
|
|
76637
|
+
heading: "Application",
|
|
76638
|
+
subHeading: "Application configuration and details",
|
|
76639
|
+
tags: [],
|
|
76640
|
+
...appletHeader
|
|
76641
|
+
};
|
|
76642
|
+
const defaultOverview = {
|
|
76643
|
+
about: "This application provides comprehensive functionality for your organization.",
|
|
76644
|
+
images: {
|
|
76645
|
+
desktop: "https://via.placeholder.com/600x400?text=Desktop+View",
|
|
76646
|
+
mobile1: "https://via.placeholder.com/200x400?text=Mobile+View+1",
|
|
76647
|
+
mobile2: "https://via.placeholder.com/200x400?text=Mobile+View+2"
|
|
76648
|
+
},
|
|
76649
|
+
features: [
|
|
76650
|
+
{
|
|
76651
|
+
title: "Feature 1",
|
|
76652
|
+
description: "Description of feature 1"
|
|
76653
|
+
},
|
|
76654
|
+
{
|
|
76655
|
+
title: "Feature 2",
|
|
76656
|
+
description: "Description of feature 2"
|
|
76657
|
+
}
|
|
76658
|
+
],
|
|
76659
|
+
...overview
|
|
76660
|
+
};
|
|
76661
|
+
const tabs = [
|
|
76662
|
+
{ label: "Overview", content: renderOverview(defaultOverview) },
|
|
76663
|
+
{ label: "Configuration", content: /* @__PURE__ */ jsx(DynamicConfig, { appid, configdata: { configuration }, disableApi }) }
|
|
76664
|
+
];
|
|
76665
|
+
function renderIcon(icon) {
|
|
76666
|
+
if (!icon) {
|
|
76667
|
+
return "📱";
|
|
76668
|
+
}
|
|
76669
|
+
if (icon.includes("<svg")) {
|
|
76670
|
+
return /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: icon } });
|
|
76671
|
+
}
|
|
76672
|
+
return icon;
|
|
76673
|
+
}
|
|
76674
|
+
function renderOverview(overviewData) {
|
|
76675
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl p-1", children: [
|
|
76676
|
+
/* @__PURE__ */ jsxs("section", { className: "mb-8", children: [
|
|
76677
|
+
/* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold mb-2", children: "About" }),
|
|
76678
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-700 text-base", children: overviewData.about })
|
|
76679
|
+
] }),
|
|
76680
|
+
/* @__PURE__ */ jsxs("section", { className: "flex flex-row gap-6 justify-center items-center mb-8", children: [
|
|
76681
|
+
/* @__PURE__ */ jsx(
|
|
76682
|
+
"img",
|
|
76683
|
+
{
|
|
76684
|
+
src: overviewData.images.desktop,
|
|
76685
|
+
alt: "Desktop View",
|
|
76686
|
+
className: "rounded-xl border border-gray-200 w-[340px] h-[220px] object-cover"
|
|
76687
|
+
}
|
|
76688
|
+
),
|
|
76689
|
+
/* @__PURE__ */ jsx(
|
|
76690
|
+
"img",
|
|
76691
|
+
{
|
|
76692
|
+
src: overviewData.images.mobile1,
|
|
76693
|
+
alt: "Mobile View 1",
|
|
76694
|
+
className: "rounded-2xl border border-gray-200 w-[120px] h-[220px] object-cover"
|
|
76695
|
+
}
|
|
76696
|
+
),
|
|
76697
|
+
/* @__PURE__ */ jsx(
|
|
76698
|
+
"img",
|
|
76699
|
+
{
|
|
76700
|
+
src: overviewData.images.mobile2,
|
|
76701
|
+
alt: "Mobile View 2",
|
|
76702
|
+
className: "rounded-2xl border border-gray-200 w-[120px] h-[220px] object-cover"
|
|
76703
|
+
}
|
|
76704
|
+
)
|
|
76705
|
+
] }),
|
|
76706
|
+
/* @__PURE__ */ jsxs("section", { children: [
|
|
76707
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-4", children: "Key Features" }),
|
|
76708
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-3", children: overviewData.features.map((feature, index) => /* @__PURE__ */ jsxs("li", { children: [
|
|
76709
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: feature.title }),
|
|
76710
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
76711
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-700", children: feature.description })
|
|
76712
|
+
] }, index)) })
|
|
76713
|
+
] })
|
|
76714
|
+
] });
|
|
76715
|
+
}
|
|
76716
|
+
return /* @__PURE__ */ jsxs("div", { className: "full-config-page", children: [
|
|
76717
|
+
/* @__PURE__ */ jsxs("div", { className: "py-3 flex items-center gap-4", children: [
|
|
76718
|
+
defaultPageHeader.isLeftArrow && /* @__PURE__ */ jsx(
|
|
76719
|
+
"button",
|
|
76720
|
+
{
|
|
76721
|
+
className: "cursor-pointer flex-shrink-0 mt-1",
|
|
76722
|
+
"aria-label": "Go back",
|
|
76723
|
+
onClick: () => window.history.back(),
|
|
76724
|
+
children: /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M19 12H5M12 19l-7-7 7-7", stroke: "#6b7280", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
76725
|
+
}
|
|
76726
|
+
),
|
|
76727
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
|
|
76728
|
+
/* @__PURE__ */ jsx("h1", { className: "text-[18px] font-semibold leading-tight truncate m-0", children: defaultPageHeader.heading }),
|
|
76729
|
+
/* @__PURE__ */ jsx("p", { className: "text-[13px] font-normal text-[#6b7280] opacity-90 mt-1 truncate mb-0", children: defaultPageHeader.subHeading })
|
|
76730
|
+
] })
|
|
76731
|
+
] }),
|
|
76732
|
+
breadcrumb && breadcrumb.length > 0 && /* @__PURE__ */ jsx("nav", { className: "flex gap-2 items-center text-[13px] text-[#6b7280] mb-4", "aria-label": "Breadcrumb", children: breadcrumb.map((item, index) => /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
|
|
76733
|
+
index > 0 && /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", style: { margin: "0 2px" }, children: /* @__PURE__ */ jsx("path", { d: "M9 18L15 12L9 6", stroke: "#6b7280", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
76734
|
+
item.isCurrent ? /* @__PURE__ */ jsx("span", { className: "font-semibold text-[#252525]", children: item.text }) : /* @__PURE__ */ jsx("a", { href: item.href, className: "hover:text-[#1f6ed4] cursor-pointer", style: { textDecoration: "none" }, children: item.text })
|
|
76735
|
+
] }, index)) }),
|
|
76736
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-[#ffffff] border border-[#eef2f6] rounded-[12px] px-6 py-5 flex gap-4 items-start mb-4 shadow-sm", children: [
|
|
76737
|
+
/* @__PURE__ */ jsx("div", { className: "icon w-[72px] h-[72px] rounded-full flex items-center justify-center bg-[#F5F5F6] text-[#1C274C] font-bold text-[18px]", children: renderIcon(defaultAppletHeader.icon) }),
|
|
76738
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
|
|
76739
|
+
/* @__PURE__ */ jsx("h2", { className: "text-[24px] font-semibold m-0 leading-tight truncate", children: defaultAppletHeader.heading }),
|
|
76740
|
+
/* @__PURE__ */ jsx("p", { className: "text-[13px] text-[#101112] mt-1 mb-0 max-w-[800px] leading-normal", children: defaultAppletHeader.subHeading }),
|
|
76741
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: defaultAppletHeader.tags && defaultAppletHeader.tags.map((tag, index) => /* @__PURE__ */ jsx(
|
|
76742
|
+
"span",
|
|
76743
|
+
{
|
|
76744
|
+
className: "pill inline-block px-[10px] py-[6px] rounded-[14px] text-[11px] border border-[#e6e9ee] text-[#767676] font-semibold mt-1",
|
|
76745
|
+
children: tag
|
|
76746
|
+
},
|
|
76747
|
+
index
|
|
76748
|
+
)) })
|
|
76749
|
+
] })
|
|
76750
|
+
] }),
|
|
76751
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-white border border-gray-300 rounded-2xl w-full mt-5 ", children: [
|
|
76752
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-gray-200", children: /* @__PURE__ */ jsx("nav", { className: "flex space-x-8", "aria-label": "Tabs", children: tabs.map((tab, index) => /* @__PURE__ */ jsx(
|
|
76753
|
+
"button",
|
|
76754
|
+
{
|
|
76755
|
+
onClick: () => setActiveTab(index),
|
|
76756
|
+
className: `${activeTab === index ? "border-black text-black" : "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"} whitespace-nowrap py-3 px-6 border-b-2 font-medium text-sm transition-colors duration-200`,
|
|
76757
|
+
children: tab.label
|
|
76758
|
+
},
|
|
76759
|
+
index
|
|
76760
|
+
)) }) }),
|
|
76761
|
+
/* @__PURE__ */ jsx("div", { className: "p-8 h-full overflow-y-auto", children: tabs[activeTab].content })
|
|
76762
|
+
] })
|
|
76763
|
+
] });
|
|
76764
|
+
};
|
|
76765
|
+
|
|
75068
76766
|
function ToastProvider({ children }) {
|
|
75069
76767
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
75070
76768
|
children,
|
|
@@ -75143,5 +76841,169 @@ const notify = {
|
|
|
75143
76841
|
)
|
|
75144
76842
|
};
|
|
75145
76843
|
|
|
75146
|
-
|
|
76844
|
+
const CustomGridToolbar = ({
|
|
76845
|
+
heading = "Data Grid",
|
|
76846
|
+
subheading = "",
|
|
76847
|
+
totalCount = 0,
|
|
76848
|
+
gridRef,
|
|
76849
|
+
onAdd,
|
|
76850
|
+
onFilterOpen,
|
|
76851
|
+
addBtnText = "Add",
|
|
76852
|
+
// Feature toggles
|
|
76853
|
+
showSearch = true,
|
|
76854
|
+
showColumnChooser = true,
|
|
76855
|
+
showFilter = false,
|
|
76856
|
+
showPrint = false,
|
|
76857
|
+
showExcel = false,
|
|
76858
|
+
showPdf = false,
|
|
76859
|
+
showRefresh = false,
|
|
76860
|
+
showAdd = false,
|
|
76861
|
+
// Additional props
|
|
76862
|
+
searchPlaceholder = "Search...",
|
|
76863
|
+
handleRefreshClick = () => {
|
|
76864
|
+
},
|
|
76865
|
+
handleSearchChange = () => {
|
|
76866
|
+
}
|
|
76867
|
+
}) => {
|
|
76868
|
+
const handleAction = (action, event) => {
|
|
76869
|
+
const grid = gridRef?.current;
|
|
76870
|
+
console.log("Grid Ref:", gridRef);
|
|
76871
|
+
console.log("the grid", grid?.value);
|
|
76872
|
+
if (!grid) {
|
|
76873
|
+
console.warn("Grid reference is not available");
|
|
76874
|
+
return;
|
|
76875
|
+
}
|
|
76876
|
+
switch (action) {
|
|
76877
|
+
case "ColumnChooser":
|
|
76878
|
+
if (event) {
|
|
76879
|
+
const target = event.currentTarget || event.target;
|
|
76880
|
+
if (target && typeof target.getBoundingClientRect === "function") {
|
|
76881
|
+
const rect = target.getBoundingClientRect();
|
|
76882
|
+
const viewportWidth = window.innerWidth;
|
|
76883
|
+
const viewportHeight = window.innerHeight;
|
|
76884
|
+
let x = rect.left - 130;
|
|
76885
|
+
let y = rect.bottom - 80;
|
|
76886
|
+
x = Math.max(10, Math.min(x, viewportWidth - 320));
|
|
76887
|
+
y = Math.max(10, Math.min(y, viewportHeight - 400));
|
|
76888
|
+
grid.columnChooserModule?.openColumnChooser(x, y);
|
|
76889
|
+
} else {
|
|
76890
|
+
const fallbackX = Math.min(1240, window.innerWidth - 320);
|
|
76891
|
+
grid.columnChooserModule?.openColumnChooser(fallbackX, 55);
|
|
76892
|
+
}
|
|
76893
|
+
} else {
|
|
76894
|
+
grid.columnChooserModule?.openColumnChooser();
|
|
76895
|
+
}
|
|
76896
|
+
break;
|
|
76897
|
+
case "Print":
|
|
76898
|
+
grid.print?.();
|
|
76899
|
+
break;
|
|
76900
|
+
case "Excel":
|
|
76901
|
+
grid.excelExport?.({ fileName: `${heading}.xlsx` });
|
|
76902
|
+
break;
|
|
76903
|
+
case "Pdf":
|
|
76904
|
+
grid.pdfExport?.({ fileName: `${heading}.pdf` });
|
|
76905
|
+
break;
|
|
76906
|
+
case "Refresh":
|
|
76907
|
+
handleRefreshClick();
|
|
76908
|
+
break;
|
|
76909
|
+
}
|
|
76910
|
+
};
|
|
76911
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center flex-wrap justify-between w-full px-4 py-2 bg-red border-t border-gray-400/50 rounded-t-2xl shadow", children: [
|
|
76912
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col ", children: [
|
|
76913
|
+
/* @__PURE__ */ jsxs("div", { className: "text-lg font-semibold text-gray-800", children: [
|
|
76914
|
+
heading,
|
|
76915
|
+
" (",
|
|
76916
|
+
totalCount,
|
|
76917
|
+
")"
|
|
76918
|
+
] }),
|
|
76919
|
+
subheading && /* @__PURE__ */ jsx("div", { className: "text-sm font-light", children: subheading })
|
|
76920
|
+
] }),
|
|
76921
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
76922
|
+
showSearch && /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
|
|
76923
|
+
SearchBar,
|
|
76924
|
+
{
|
|
76925
|
+
placeholder: searchPlaceholder,
|
|
76926
|
+
onDebouncedChange: (searchValue) => {
|
|
76927
|
+
handleSearchChange(searchValue);
|
|
76928
|
+
}
|
|
76929
|
+
}
|
|
76930
|
+
) }),
|
|
76931
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
76932
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
76933
|
+
showColumnChooser && /* @__PURE__ */ jsx(
|
|
76934
|
+
UnifyedCoreButton,
|
|
76935
|
+
{
|
|
76936
|
+
icon: Columns3Cog,
|
|
76937
|
+
onClick: (e) => handleAction("ColumnChooser", e),
|
|
76938
|
+
size: "small",
|
|
76939
|
+
ariaLabel: "Column Chooser",
|
|
76940
|
+
category: "secondary"
|
|
76941
|
+
}
|
|
76942
|
+
),
|
|
76943
|
+
showFilter && /* @__PURE__ */ jsx(
|
|
76944
|
+
UnifyedCoreButton,
|
|
76945
|
+
{
|
|
76946
|
+
icon: ListFilter,
|
|
76947
|
+
onClick: onFilterOpen,
|
|
76948
|
+
size: "small",
|
|
76949
|
+
ariaLabel: "Filters",
|
|
76950
|
+
category: "secondary"
|
|
76951
|
+
}
|
|
76952
|
+
),
|
|
76953
|
+
showPrint && /* @__PURE__ */ jsx(
|
|
76954
|
+
UnifyedCoreButton,
|
|
76955
|
+
{
|
|
76956
|
+
icon: Printer,
|
|
76957
|
+
onClick: () => handleAction("Print"),
|
|
76958
|
+
ariaLabel: "Print",
|
|
76959
|
+
size: "small",
|
|
76960
|
+
category: "secondary"
|
|
76961
|
+
}
|
|
76962
|
+
),
|
|
76963
|
+
showExcel && /* @__PURE__ */ jsx(
|
|
76964
|
+
UnifyedCoreButton,
|
|
76965
|
+
{
|
|
76966
|
+
icon: FileSpreadsheet,
|
|
76967
|
+
onClick: () => handleAction("Excel"),
|
|
76968
|
+
ariaLabel: "Excel Download",
|
|
76969
|
+
size: "small",
|
|
76970
|
+
category: "secondary"
|
|
76971
|
+
}
|
|
76972
|
+
),
|
|
76973
|
+
showPdf && /* @__PURE__ */ jsx(
|
|
76974
|
+
UnifyedCoreButton,
|
|
76975
|
+
{
|
|
76976
|
+
icon: FileText,
|
|
76977
|
+
onClick: () => handleAction("Pdf"),
|
|
76978
|
+
ariaLabel: "Pdf Download",
|
|
76979
|
+
size: "small",
|
|
76980
|
+
category: "secondary"
|
|
76981
|
+
}
|
|
76982
|
+
),
|
|
76983
|
+
showRefresh && /* @__PURE__ */ jsx(
|
|
76984
|
+
UnifyedCoreButton,
|
|
76985
|
+
{
|
|
76986
|
+
icon: RefreshCcw,
|
|
76987
|
+
onClick: () => handleAction("Refresh"),
|
|
76988
|
+
ariaLabel: "Refresh",
|
|
76989
|
+
size: "small",
|
|
76990
|
+
category: "secondary"
|
|
76991
|
+
}
|
|
76992
|
+
)
|
|
76993
|
+
] }),
|
|
76994
|
+
/* @__PURE__ */ jsx("div", { children: showAdd && onAdd && /* @__PURE__ */ jsx(
|
|
76995
|
+
UnifyedCoreButton,
|
|
76996
|
+
{
|
|
76997
|
+
label: addBtnText,
|
|
76998
|
+
icon: Plus,
|
|
76999
|
+
onClick: onAdd,
|
|
77000
|
+
size: "small"
|
|
77001
|
+
}
|
|
77002
|
+
) })
|
|
77003
|
+
] })
|
|
77004
|
+
] })
|
|
77005
|
+
] });
|
|
77006
|
+
};
|
|
77007
|
+
|
|
77008
|
+
export { AddUserGroupsRolesModal, Avatar, AvatarGroup$1 as AvatarGroup, Badge, Breadcrumbs, Button$1 as Button, Checkbox, ConfigRenderFactory, CustomDialog, CustomGridToolbar, DataTableRenderer, DatePicker, DateRangePicker$1 as DateRangePicker, DynamicConfig, DynamicConfig_stories as DynamicConfigStory, FileUploadModal, FullConfigPage, FullScreenLoader, GenericFilter, Input, Modal, MultiSelect, OptionsMenu, PageHeader, PageLayout, Pagination, RadioGroup, SearchBar, SectionRenderer, Select, Sidebar, Spinner, Textarea, ToastProvider, ToggleSwitch, Tooltip, TreeView, UnifyedCoreButton, WizardModal, adGroupsListSearchApi, axiosDelete, axiosGet, axiosPatch, axiosPost, axiosPut, cookies$1 as cookies, createHttpClient, directoryPermissionsApi, filePermissionsApi, gateWayUrl, gatewayBase, getBaseUrl, getComponentForType, getSnapshot, http, localStore, myDriveGatewayBaseV2, notify, provisioningBase, rbacBase, register, renderByType, searchRolesApi, sessionStore, userSearchBase };
|
|
75147
77009
|
//# sourceMappingURL=unifyedx-storybook-new.es.js.map
|