@panneau/core 4.0.50 → 4.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as react from 'react';
3
2
  import { ElementType, ReactNode, ComponentType } from 'react';
4
3
  export { RoutesContext, RoutesProvider, useRoutes, useUrlGenerator } from '@folklore/routes';
@@ -130,7 +129,7 @@ interface ComponentsProviderProps {
130
129
  manager?: ComponentsManager | null;
131
130
  components?: Record<string, ElementType>;
132
131
  }
133
- declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps): react_jsx_runtime.JSX.Element;
132
+ declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps): react.JSX.Element;
134
133
 
135
134
  /**
136
135
  * Core UI Types
@@ -142,10 +141,6 @@ declare function ComponentsProvider({ components, manager, namespace, children,
142
141
  interface Font {
143
142
  name: string;
144
143
  }
145
- /**
146
- * Tracking variables
147
- */
148
- type TrackingVariables = Record<string, unknown>;
149
144
 
150
145
  /**
151
146
  * Form Types
@@ -158,25 +153,28 @@ type TrackingVariables = Record<string, unknown>;
158
153
  interface Field {
159
154
  name?: string;
160
155
  type?: string;
161
- component?: string;
156
+ component?: string | ElementType;
162
157
  label?: ReactNode;
163
158
  }
164
- /**
165
- * Table column definition
166
- */
167
- type TableColumn = string | {
168
- id?: string;
169
- component?: string;
170
- path?: string;
171
- field?: string;
172
- columnClassName?: string;
173
- };
174
159
 
175
160
  /**
176
161
  * Resource Types
177
162
  * TypeScript interfaces for resources, items, users, media, and other entities
178
163
  */
179
164
 
165
+ /**
166
+ * Table column definition
167
+ */
168
+ type TableColumn = string | Column;
169
+ interface Column extends Record<string, unknown> {
170
+ id?: string | null;
171
+ label?: unknown;
172
+ path?: string;
173
+ valueKey?: string;
174
+ component?: string | ElementType | null;
175
+ field?: Field | string | null;
176
+ actions?: ActionDefinition[] | null;
177
+ }
180
178
  interface Action {
181
179
  id?: string;
182
180
  component?: string;
@@ -282,10 +280,16 @@ interface PanneauIntl {
282
280
  values?: PanneauIntlValues;
283
281
  }
284
282
  /**
285
- * Panneau definition (main configuration)
283
+ * Generic definition
286
284
  */
287
- interface PanneauDefinition {
285
+ interface Definition {
288
286
  name?: string;
287
+ [key: string]: unknown;
288
+ }
289
+ /**
290
+ * Panneau definition (main configuration)
291
+ */
292
+ interface PanneauDefinition extends Definition {
289
293
  resources?: Resource[];
290
294
  routes?: Routes;
291
295
  pages?: Record<string, Page>;
@@ -295,12 +299,9 @@ interface PanneauDefinition {
295
299
  settings?: Record<string, unknown>;
296
300
  }
297
301
  /**
298
- * Generic definition
302
+ * Tracking variables
299
303
  */
300
- interface Definition {
301
- name?: string;
302
- [key: string]: unknown;
303
- }
304
+ type TrackingVariables = Record<string, unknown>;
304
305
 
305
306
  declare function useDefinitionContext(): Definition | null;
306
307
  declare function useDefinition(): Definition | null;
@@ -308,7 +309,7 @@ interface DefinitionProviderProps {
308
309
  definition: Definition;
309
310
  children: ReactNode;
310
311
  }
311
- declare function DefinitionProvider({ definition, children }: DefinitionProviderProps): react_jsx_runtime.JSX.Element;
312
+ declare function DefinitionProvider({ definition, children }: DefinitionProviderProps): react.JSX.Element;
312
313
 
313
314
  declare const FieldsContext: react.Context<FieldsManager>;
314
315
  declare function useFieldsManager(): FieldsManager | null;
@@ -319,7 +320,7 @@ interface FieldsProviderProps {
319
320
  manager?: FieldsManager | null;
320
321
  children: ReactNode;
321
322
  }
322
- declare function FieldsProvider({ fields, manager, children }: FieldsProviderProps): react_jsx_runtime.JSX.Element;
323
+ declare function FieldsProvider({ fields, manager, children }: FieldsProviderProps): react.JSX.Element;
323
324
 
324
325
  interface FontsContextValue {
325
326
  systemFonts: Font[] | null;
@@ -340,7 +341,7 @@ interface FontsProviderProps {
340
341
  systemFonts?: (Font | string)[] | null;
341
342
  customFonts?: (Font | string)[] | null;
342
343
  }
343
- declare function FontsProvider({ systemFonts, customFonts, children, }: FontsProviderProps): react_jsx_runtime.JSX.Element;
344
+ declare function FontsProvider({ systemFonts, customFonts, children, }: FontsProviderProps): react.JSX.Element;
344
345
 
345
346
  interface FormContextValue {
346
347
  value: Record<string, unknown>;
@@ -354,18 +355,18 @@ interface FormProviderProps {
354
355
  setValue: (value: Record<string, unknown>) => void;
355
356
  children: ReactNode;
356
357
  }
357
- declare function FormProvider({ value, setValue, children }: FormProviderProps): react_jsx_runtime.JSX.Element;
358
+ declare function FormProvider({ value, setValue, children }: FormProviderProps): react.JSX.Element;
358
359
 
359
360
  declare const GoogleApiClientContext: react.Context<any>;
360
361
  declare function useGoogleApiClient(): any | null;
361
362
  declare function withGoogleApiClient(WrappedComponent: ComponentType<any>): {
362
- (props: any): react_jsx_runtime.JSX.Element;
363
+ (props: any): react.JSX.Element;
363
364
  displayName: string;
364
365
  };
365
366
  interface GoogleApiClientProviderProps {
366
367
  children: ReactNode;
367
368
  }
368
- declare function GoogleApiClientProvider({ children }: GoogleApiClientProviderProps): react_jsx_runtime.JSX.Element;
369
+ declare function GoogleApiClientProvider({ children }: GoogleApiClientProviderProps): react.JSX.Element;
369
370
 
370
371
  interface GoogleKeysContextValue {
371
372
  apiKey: string | null;
@@ -376,12 +377,12 @@ interface GoogleKeysProviderProps {
376
377
  children: ReactNode;
377
378
  apiKey?: string | null;
378
379
  }
379
- declare function GoogleKeysProvider({ children, apiKey }: GoogleKeysProviderProps): react_jsx_runtime.JSX.Element;
380
+ declare function GoogleKeysProvider({ children, apiKey }: GoogleKeysProviderProps): react.JSX.Element;
380
381
 
381
382
  declare const GoogleMapsClientContext: react.Context<any>;
382
383
  declare function useGoogleMapsClient(): any | null;
383
384
  declare function withGoogleMapsClient(WrappedComponent: ComponentType<any>): {
384
- (props: any): react_jsx_runtime.JSX.Element;
385
+ (props: any): react.JSX.Element;
385
386
  displayName: string;
386
387
  };
387
388
  interface GoogleMapsClientProviderProps {
@@ -389,7 +390,7 @@ interface GoogleMapsClientProviderProps {
389
390
  locale?: string;
390
391
  libraries?: string[] | null;
391
392
  }
392
- declare function GoogleMapsClientProvider({ children, locale, libraries, }: GoogleMapsClientProviderProps): react_jsx_runtime.JSX.Element;
393
+ declare function GoogleMapsClientProvider({ children, locale, libraries, }: GoogleMapsClientProviderProps): react.JSX.Element;
393
394
 
394
395
  interface LocalesContextValue {
395
396
  locales: string[];
@@ -402,7 +403,7 @@ interface LocalesProviderProps {
402
403
  locales?: string[];
403
404
  children: ReactNode;
404
405
  }
405
- declare function LocalesProvider({ locales, children }: LocalesProviderProps): react_jsx_runtime.JSX.Element;
406
+ declare function LocalesProvider({ locales, children }: LocalesProviderProps): react.JSX.Element;
406
407
 
407
408
  interface ModalData {
408
409
  id: string;
@@ -426,7 +427,7 @@ interface ModalProviderProps {
426
427
  children: ReactNode;
427
428
  container?: unknown | null;
428
429
  }
429
- declare function ModalProvider({ children, container: initialContainer }: ModalProviderProps): react_jsx_runtime.JSX.Element;
430
+ declare function ModalProvider({ children, container: initialContainer }: ModalProviderProps): react.JSX.Element;
430
431
 
431
432
  interface PanelData {
432
433
  id: string;
@@ -442,14 +443,14 @@ interface PanelsContextValue {
442
443
  declare const PanelsContext: react.Context<PanelsContextValue>;
443
444
  declare function usePanels(): PanelsContextValue;
444
445
  declare function withPanels(WrappedComponent: ComponentType<any>): {
445
- (props: any): react_jsx_runtime.JSX.Element;
446
+ (props: any): react.JSX.Element;
446
447
  displayName: string;
447
448
  };
448
449
  interface PanelsProviderProps {
449
450
  children: ReactNode;
450
451
  container?: unknown | null;
451
452
  }
452
- declare function PanelsProvider({ children, container: initialContainer }: PanelsProviderProps): react_jsx_runtime.JSX.Element;
453
+ declare function PanelsProvider({ children, container: initialContainer }: PanelsProviderProps): react.JSX.Element;
453
454
 
454
455
  declare function usePanneau(): PanneauDefinition | null;
455
456
  declare function usePanneauResources(): Resource[];
@@ -468,14 +469,14 @@ interface PanneauProviderProps {
468
469
  definition: PanneauDefinition;
469
470
  children: ReactNode;
470
471
  }
471
- declare function PanneauProvider({ definition, children }: PanneauProviderProps): react_jsx_runtime.JSX.Element;
472
+ declare function PanneauProvider({ definition, children }: PanneauProviderProps): react.JSX.Element;
472
473
 
473
474
  declare function useResource(): Resource | null;
474
475
  interface ResourceProviderProps {
475
476
  resource: Resource;
476
477
  children: ReactNode;
477
478
  }
478
- declare function ResourceProvider({ resource, children }: ResourceProviderProps): react_jsx_runtime.JSX.Element;
479
+ declare function ResourceProvider({ resource, children }: ResourceProviderProps): react.JSX.Element;
479
480
 
480
481
  declare function useRoutePush(): (route: string | {
481
482
  pathname?: string | null;
@@ -488,7 +489,7 @@ interface TrackingProviderProps {
488
489
  children: ReactNode;
489
490
  variables?: TrackingVariables | null;
490
491
  }
491
- declare function TrackingProvider({ variables, children }: TrackingProviderProps): react_jsx_runtime.JSX.Element;
492
+ declare function TrackingProvider({ variables, children }: TrackingProviderProps): react.JSX.Element;
492
493
 
493
494
  export { ACTIONS_NAMESPACE, APP_NAMESPACE, BUTTONS_NAMESPACE, ComponentsContext, ComponentsProvider, DISPLAYS_NAMESPACE, DefinitionProvider, FIELDS_NAMESPACE, FILTERS_NAMESPACE, FORMS_NAMESPACE, FieldsContext, FieldsProvider, FontsContext, FontsProvider, FormProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, LISTS_NAMESPACE, LocalesContext, LocalesProvider, MODALS_NAMESPACE, ModalContext, ModalProvider, PAGES_NAMESPACE, PREVIEWS_NAMESPACE, PanelsContext, PanelsProvider, PanneauProvider, ResourceProvider, TrackingProvider, useActionComponent, useActionsComponents, useActionsComponentsManager, useAppComponent, useAppComponents, useAppComponentsManager, useButtonComponent, useButtonsComponents, useButtonsComponentsManager, useComponent, useComponents, useComponentsManager, useDefinition, useDefinitionContext, useDisplayComponent, useDisplaysComponents, useDisplaysComponentsManager, useField, useFieldComponent, useFields, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFilterComponent, useFiltersComponents, useFiltersComponentsManager, useFonts, useFormComponent, useFormContext, useFormSetValue, useFormValue, useFormsComponents, useFormsComponentsManager, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useListComponent, useListsComponents, useListsComponentsManager, useLocales, useLocalesContext, useModal, useModalComponent, useModalsComponents, useModalsComponentsManager, useOtherLocales, usePageComponent, usePagesComponents, usePagesComponentsManager, usePanels, usePanneau, usePanneauAuth, usePanneauColorScheme, usePanneauComponent, usePanneauComponents, usePanneauResource, usePanneauResources, usePanneauSettings, usePreviewComponent, usePreviewsComponents, usePreviewsComponentsManager, useResource, useRouteBack, useRoutePush, useTracking, withGoogleApiClient, withGoogleMapsClient, withPanels };
494
495
  export type { ModalContextValue, ModalData };
package/dist/contexts.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { c } from 'react/compiler-runtime';
2
- import isString from 'lodash/isString';
2
+ import isString from 'lodash-es/isString';
3
3
  import { createContext, useContext, useState, use, useEffect, useRef } from 'react';
4
4
  import { ComponentsManager, FieldsManager, Tracking } from '@panneau/core';
5
5
  import { jsx } from 'react/jsx-runtime';
6
- import uniqBy from 'lodash/uniqBy';
6
+ import uniqBy from 'lodash-es/uniqBy';
7
7
  import { getJSON } from '@folklore/fetch';
8
- import isObject from 'lodash/isObject';
8
+ import isObject from 'lodash-es/isObject';
9
9
  import { loadGoogleApi, loadGoogleMaps } from '@folklore/services';
10
10
  import { useIntl } from 'react-intl';
11
11
  import { getDisplayName } from '@panneau/core/utils';
package/dist/hooks.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Dayjs } from 'dayjs';
2
- import { ReactNode, SubmitEvent, RefObject } from 'react';
2
+ import { ElementType, ReactNode, SubmitEvent, RefObject } from 'react';
3
3
 
4
4
  interface UseAnimationFrameOptions {
5
5
  disabled?: boolean;
@@ -31,25 +31,28 @@ declare const useDocumentEvent: (event: string, callback: (...args: unknown[]) =
31
31
  interface Field$1 {
32
32
  name?: string;
33
33
  type?: string;
34
- component?: string;
34
+ component?: string | ElementType;
35
35
  label?: ReactNode;
36
36
  }
37
- /**
38
- * Table column definition
39
- */
40
- type TableColumn = string | {
41
- id?: string;
42
- component?: string;
43
- path?: string;
44
- field?: string;
45
- columnClassName?: string;
46
- };
47
37
 
48
38
  /**
49
39
  * Resource Types
50
40
  * TypeScript interfaces for resources, items, users, media, and other entities
51
41
  */
52
42
 
43
+ /**
44
+ * Table column definition
45
+ */
46
+ type TableColumn = string | Column;
47
+ interface Column extends Record<string, unknown> {
48
+ id?: string | null;
49
+ label?: unknown;
50
+ path?: string;
51
+ valueKey?: string;
52
+ component?: string | ElementType | null;
53
+ field?: Field$1 | string | null;
54
+ actions?: ActionDefinition[] | null;
55
+ }
53
56
  interface Action {
54
57
  id?: string;
55
58
  component?: string;
package/dist/hooks.js CHANGED
@@ -3,10 +3,10 @@ import { useRef, useEffect, useCallback, useState, useMemo } from 'react';
3
3
  import { EventsManager, MediasParser } from '@panneau/core';
4
4
  import { createUseEvent, loadPackage } from '@panneau/core/utils';
5
5
  import { getCsrfToken, postJSON, getCSRFHeaders } from '@folklore/fetch';
6
- import get from 'lodash/get';
7
- import isArray from 'lodash/isArray';
8
- import isObject from 'lodash/isObject';
9
- import isString from 'lodash/isString';
6
+ import get from 'lodash-es/get';
7
+ import isArray from 'lodash-es/isArray';
8
+ import isObject from 'lodash-es/isObject';
9
+ import isString from 'lodash-es/isString';
10
10
  import { useFieldsManager, usePanneauResources, useResource, useUrlGenerator } from '@panneau/core/contexts';
11
11
  import dayjs from 'dayjs';
12
12
  import { useIntl } from 'react-intl';
package/dist/index.d.ts CHANGED
@@ -171,6 +171,14 @@ declare class Tracking extends Tracking$1 {
171
171
  trackMedia(type: string, media: Media$1 | null, action: string, { value, ...opts }?: TrackingEventOptions): void;
172
172
  }
173
173
 
174
+ /**
175
+ * User definition
176
+ */
177
+ interface User {
178
+ id?: number | string;
179
+ [key: string]: unknown;
180
+ }
181
+
174
182
  /**
175
183
  * Core UI Types
176
184
  */
@@ -272,10 +280,6 @@ interface Breadcrumb {
272
280
  interface Font {
273
281
  name: string;
274
282
  }
275
- /**
276
- * Tracking variables
277
- */
278
- type TrackingVariables = Record<string, unknown>;
279
283
  /**
280
284
  * Trigger update identifier
281
285
  */
@@ -286,12 +290,11 @@ interface Pagination {
286
290
  total: number;
287
291
  last_page: number;
288
292
  }
289
-
290
293
  /**
291
- * User definition
294
+ * Generic item (base interface for data items)
292
295
  */
293
- interface User {
294
- id?: number | string;
296
+ interface Item {
297
+ id: string;
295
298
  [key: string]: unknown;
296
299
  }
297
300
 
@@ -320,7 +323,7 @@ type SelectOption = string | number | {
320
323
  interface Field {
321
324
  name?: string;
322
325
  type?: string;
323
- component?: string;
326
+ component?: string | ElementType;
324
327
  label?: ReactNode;
325
328
  }
326
329
  /**
@@ -330,22 +333,59 @@ interface Form {
330
333
  title: ReactNode;
331
334
  fields?: Field[];
332
335
  }
336
+
337
+ type MediaType = 'audio' | 'image' | 'video' | 'document' | 'font';
338
+ interface MediaFile {
339
+ url: string;
340
+ type: string;
341
+ }
333
342
  /**
334
- * Table column definition
343
+ * Media file definition
335
344
  */
336
- type TableColumn = string | {
337
- id?: string;
338
- component?: string;
339
- path?: string;
340
- field?: string;
341
- columnClassName?: string;
342
- };
345
+ interface Media extends Item {
346
+ id: string;
347
+ name: string;
348
+ type: string;
349
+ thumbnail_url?: string;
350
+ thumbnailUrl?: string;
351
+ url?: string;
352
+ provider?: string;
353
+ [key: string]: unknown;
354
+ files?: Record<string, MediaFile> | null;
355
+ }
356
+ interface VideoMedia extends Media {
357
+ type: 'video';
358
+ iframeUrl?: string;
359
+ width?: number | null;
360
+ height?: number | null;
361
+ duration?: number | null;
362
+ }
363
+ interface AudioMedia extends Media {
364
+ type: 'audio';
365
+ duration?: number | null;
366
+ }
367
+ interface ImageMedia extends Media {
368
+ type: 'image';
369
+ }
343
370
 
344
371
  /**
345
372
  * Resource Types
346
373
  * TypeScript interfaces for resources, items, users, media, and other entities
347
374
  */
348
375
 
376
+ /**
377
+ * Table column definition
378
+ */
379
+ type TableColumn = string | Column;
380
+ interface Column extends Record<string, unknown> {
381
+ id?: string | null;
382
+ label?: unknown;
383
+ path?: string;
384
+ valueKey?: string;
385
+ component?: string | ElementType | null;
386
+ field?: Field | string | null;
387
+ actions?: ActionDefinition[] | null;
388
+ }
349
389
  interface Action {
350
390
  id?: string;
351
391
  component?: string;
@@ -394,26 +434,9 @@ interface Resource {
394
434
  shows_in_navbar?: boolean;
395
435
  settings?: Record<string, unknown>;
396
436
  }
397
- /**
398
- * Generic item (base interface for data items)
399
- */
400
- interface Item {
401
- id: string;
402
- [key: string]: unknown;
403
- }
404
437
  interface ResourceItem extends Item {
405
438
  type?: string;
406
439
  }
407
- /**
408
- * Media file definition
409
- */
410
- interface Media extends Item {
411
- id: string;
412
- name: string;
413
- type: string;
414
- thumbnail_url?: string;
415
- [key: string]: unknown;
416
- }
417
440
  /**
418
441
  * Preview definition
419
442
  */
@@ -499,10 +522,16 @@ interface PanneauIntl {
499
522
  values?: PanneauIntlValues;
500
523
  }
501
524
  /**
502
- * Panneau definition (main configuration)
525
+ * Generic definition
503
526
  */
504
- interface PanneauDefinition {
527
+ interface Definition {
505
528
  name?: string;
529
+ [key: string]: unknown;
530
+ }
531
+ /**
532
+ * Panneau definition (main configuration)
533
+ */
534
+ interface PanneauDefinition extends Definition {
506
535
  resources?: Resource[];
507
536
  routes?: Routes;
508
537
  pages?: Record<string, Page>;
@@ -512,12 +541,9 @@ interface PanneauDefinition {
512
541
  settings?: Record<string, unknown>;
513
542
  }
514
543
  /**
515
- * Generic definition
544
+ * Tracking variables
516
545
  */
517
- interface Definition {
518
- name?: string;
519
- [key: string]: unknown;
520
- }
546
+ type TrackingVariables = Record<string, unknown>;
521
547
 
522
548
  export { ComponentsManager, DefinitionsManager, EventsManager, FieldsManager, FontsParser, FormsManager, MediasParser, Tracking };
523
- export type { Action, ActionDefinition, ActionValue, Breadcrumb, Button, ButtonElement, ButtonSize, ButtonTheme, ButtonType, ControlSize, Definition, DropdownAlign, Feedback, Field, FieldOption, Filter, Font, Form, FormError, FormStatus, Item, Label, Media, MenuItem, Message, Modal, Page, Pagination, PanneauComponents, PanneauDefinition, PanneauIntl, PanneauIntlValues, PanneauTheme, Preview, Resource, ResourceIndex, ResourceIntl, ResourceIntlValues, ResourceItem, Routes, SelectOption, StatusCode, TableColumn, Toggle, TrackingVariables, TriggerUpdate, Uppy, User, uppy };
549
+ export type { Action, ActionDefinition, ActionValue, AudioMedia, Breadcrumb, Button, ButtonElement, ButtonSize, ButtonTheme, ButtonType, Column, ControlSize, Definition, DropdownAlign, Feedback, Field, FieldOption, Filter, Font, Form, FormError, FormStatus, ImageMedia, Item, Label, Media, MediaFile, MediaType, MenuItem, Message, Modal, Page, Pagination, PanneauComponents, PanneauDefinition, PanneauIntl, PanneauIntlValues, PanneauTheme, Preview, Resource, ResourceIndex, ResourceIntl, ResourceIntlValues, ResourceItem, Routes, SelectOption, StatusCode, TableColumn, Toggle, TrackingVariables, TriggerUpdate, Uppy, User, VideoMedia, uppy };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { flattenComponents, getComponentFromName } from '@panneau/core/utils';
2
- import isArray from 'lodash/isArray';
3
- import uniqBy from 'lodash/uniqBy';
2
+ import isArray from 'lodash-es/isArray';
3
+ import uniqBy from 'lodash-es/uniqBy';
4
4
  import EventEmitter from 'wolfy87-eventemitter';
5
- import isObject from 'lodash/isObject';
6
- import uniq from 'lodash/uniq';
5
+ import isObject from 'lodash-es/isObject';
6
+ import uniq from 'lodash-es/uniq';
7
7
  import { Tracking as Tracking$1 } from '@folklore/tracking';
8
8
 
9
9
  class ComponentsManager {
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { kebabCase as dashCase, pascalCase, snakeCase } from 'change-case';
2
- import { ElementType, ReactNode, ComponentType, ReactElement, ForwardedRef } from 'react';
2
+ import { ElementType, ReactNode, ReactElement, ForwardedRef } from 'react';
3
3
  import { MessageDescriptor } from 'react-intl';
4
4
 
5
5
  interface CheckClickableOptions {
@@ -46,6 +46,13 @@ interface Message extends MessageDescriptor {
46
46
  * Label can be either a message object or any React node
47
47
  */
48
48
  type Label = Message | ReactNode;
49
+ /**
50
+ * Generic item (base interface for data items)
51
+ */
52
+ interface Item {
53
+ id: string;
54
+ [key: string]: unknown;
55
+ }
49
56
 
50
57
  /**
51
58
  * Form Types
@@ -65,25 +72,28 @@ type SelectOption = string | number | {
65
72
  interface Field {
66
73
  name?: string;
67
74
  type?: string;
68
- component?: string;
75
+ component?: string | ElementType;
69
76
  label?: ReactNode;
70
77
  }
71
- /**
72
- * Table column definition
73
- */
74
- type TableColumn = string | {
75
- id?: string;
76
- component?: string;
77
- path?: string;
78
- field?: string;
79
- columnClassName?: string;
80
- };
81
78
 
82
79
  /**
83
80
  * Resource Types
84
81
  * TypeScript interfaces for resources, items, users, media, and other entities
85
82
  */
86
83
 
84
+ /**
85
+ * Table column definition
86
+ */
87
+ type TableColumn = string | Column;
88
+ interface Column extends Record<string, unknown> {
89
+ id?: string | null;
90
+ label?: unknown;
91
+ path?: string;
92
+ valueKey?: string;
93
+ component?: string | ElementType | null;
94
+ field?: Field | string | null;
95
+ actions?: ActionDefinition[] | null;
96
+ }
87
97
  interface Action {
88
98
  id?: string;
89
99
  component?: string;
@@ -131,13 +141,6 @@ interface Resource {
131
141
  shows_in_navbar?: boolean;
132
142
  settings?: Record<string, unknown>;
133
143
  }
134
- /**
135
- * Generic item (base interface for data items)
136
- */
137
- interface Item {
138
- id: string;
139
- [key: string]: unknown;
140
- }
141
144
  /**
142
145
  * Filter definition
143
146
  */
@@ -160,22 +163,18 @@ interface Definition {
160
163
  [key: string]: unknown;
161
164
  }
162
165
 
163
- interface Column extends Record<string, unknown> {
164
- id?: string | null;
165
- label?: unknown;
166
- valueKey?: string;
167
- component?: string | null;
168
- field?: Field | string | null;
169
- }
170
166
  declare function getColumnsWithFields(resource: Resource, columns: TableColumn[] | null): Column[];
171
167
 
172
168
  interface ComponentResult {
173
- name: unknown;
169
+ name: string | ElementType | null;
174
170
  props: Record<string, unknown> | null;
175
171
  }
176
- declare function getComponent(component: unknown): ComponentResult;
172
+ declare function getComponent(component: string | {
173
+ component: string | ElementType;
174
+ [key: string]: unknown;
175
+ }): ComponentResult;
177
176
 
178
- declare function getComponentFromName<T = ComponentType<unknown> | 'string'>(name?: string | null, components?: Record<string, T> | null, defaultComponent?: T | null): T | null;
177
+ declare function getComponentFromName(name?: string | ElementType | null, components?: Record<string, ElementType> | null, defaultComponent?: ElementType | null): ElementType | null;
179
178
 
180
179
  declare function getDefinitionFromId<T extends Definition = Definition>(id?: string | null, items?: T[] | null, defaultObject?: T | null): T | null;
181
180
 
package/dist/utils.js CHANGED
@@ -1,14 +1,15 @@
1
- import isNumber from 'lodash/isNumber';
1
+ import isNumber from 'lodash-es/isNumber';
2
2
  import { snakeCase } from 'snake-case';
3
- import isObject from 'lodash/isObject';
3
+ import isObject from 'lodash-es/isObject';
4
4
  import { useEffect, isValidElement } from 'react';
5
5
  import { isValidElementType } from 'react-is';
6
- import isString from 'lodash/isString';
6
+ import isString from 'lodash-es/isString';
7
7
  import { pascalCase, kebabCase, snakeCase as snakeCase$1 } from 'change-case';
8
8
  export { kebabCase as dashCase, pascalCase, snakeCase } from 'change-case';
9
- import isArray from 'lodash/isArray';
10
- import get from 'lodash/get';
11
- import capitalize from 'lodash/capitalize';
9
+ import isFunction from 'lodash-es/isFunction';
10
+ import isArray from 'lodash-es/isArray';
11
+ import get from 'lodash-es/get';
12
+ import capitalize from 'lodash-es/capitalize';
12
13
  import EventEmitter from 'wolfy87-eventemitter';
13
14
  import slugify from 'slugify';
14
15
 
@@ -169,13 +170,13 @@ function formatDuration(timeInSeconds) {
169
170
 
170
171
  function getComponent(component) {
171
172
  const {
172
- component: name,
173
+ component: name = null,
173
174
  ...props
174
- } = isObject(component) ? component : {
175
+ } = isString(component) ? {
175
176
  component
176
- };
177
+ } : component || {};
177
178
  return {
178
- name: component,
179
+ name,
179
180
  props: Object.keys(props).length > 0 ? props : null
180
181
  };
181
182
  }
@@ -184,7 +185,6 @@ function getColumnFromField(field) {
184
185
  if (field === null) {
185
186
  return null;
186
187
  }
187
- // eslint-disable-next-line camelcase
188
188
  const {
189
189
  name,
190
190
  components: {
@@ -231,6 +231,9 @@ function getComponentFromName(name = null, components = {}, defaultComponent = n
231
231
  if (components === null || name === null) {
232
232
  return defaultComponent;
233
233
  }
234
+ if (isObject(name) || isFunction(name)) {
235
+ return name;
236
+ }
234
237
  const pascalName = pascalCase(name);
235
238
  const component = components[pascalName] || components[name] || defaultComponent;
236
239
  if (!component) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/core",
3
- "version": "4.0.50",
3
+ "version": "4.0.56",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -47,7 +47,7 @@
47
47
  }
48
48
  },
49
49
  "sideEffects": [
50
- "./dist/hooks.js"
50
+ "**/*.css"
51
51
  ],
52
52
  "files": [
53
53
  "dist",
@@ -96,5 +96,5 @@
96
96
  "publishConfig": {
97
97
  "access": "public"
98
98
  },
99
- "gitHead": "c5d4004686dae5529035f8eac83571739e24340d"
99
+ "gitHead": "9c3ba1bdd04699e0150f84a35f2bdbdec073bd59"
100
100
  }