@sheetxl/react 0.7.5 → 0.7.7

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sheetxl/react",
3
3
  "description": "React - React components needed to build advanced grid and spreadsheet UIs.",
4
- "version": "0.7.5",
4
+ "version": "0.7.7",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -49,16 +49,16 @@
49
49
  "@dnd-kit/sortable": "^10.0.0",
50
50
  "@dnd-kit/utilities": "^3.2.2",
51
51
  "@monaco-editor/react": "^4.6.0",
52
- "@sheetxl/grid-react": "^0.7.5",
53
- "@sheetxl/sdk": "^0.7.5",
54
- "@sheetxl/utils": "^0.7.5",
55
- "@sheetxl/utils-react": "^0.7.5",
52
+ "@sheetxl/grid-react": "^0.7.7",
53
+ "@sheetxl/sdk": "^0.7.7",
54
+ "@sheetxl/utils": "^0.7.7",
55
+ "@sheetxl/utils-react": "^0.7.7",
56
56
  "clsx": "^2.1.1",
57
57
  "monaco-editor-auto-typings": "^0.4.6",
58
58
  "react-merge-refs": "^3.0.2",
59
59
  "react-moveable": "^0.56.0",
60
60
  "react-use": "^17.6.0",
61
- "rooks": "^9.0.1"
61
+ "rooks": "^9.3.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "react": "^19.1.0",
package/types/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { CellEditorProps } from '@sheetxl/grid-react';
4
4
  import { CellEditorRefAttribute } from '@sheetxl/grid-react';
5
5
  import { CellLayout } from '@sheetxl/utils-react';
6
6
  import { CellRendererProps } from '@sheetxl/grid-react';
7
+ import { CommandButtonProps } from '@sheetxl/utils-react';
7
8
  import { Context } from 'react';
8
9
  import { CopyPasteProps } from '@sheetxl/utils-react';
9
10
  import { CopyPasteResults } from '@sheetxl/utils-react';
@@ -49,7 +50,9 @@ import { IWorkbook } from '@sheetxl/sdk';
49
50
  import { JSX } from 'react/jsx-runtime';
50
51
  import { LicenseDetails } from '@sheetxl/sdk';
51
52
  import { LicenseManager } from '@sheetxl/sdk';
53
+ import { ReactNode } from 'react';
52
54
  import { ReferenceableClipboard } from '@sheetxl/utils';
55
+ import { RemoveListener } from '@sheetxl/utils';
53
56
  import { ScrollableViewport } from '@sheetxl/utils-react';
54
57
  import { ScrollbarOrientation } from '@sheetxl/utils-react';
55
58
  import { ScrollButtonProps } from '@sheetxl/utils-react';
@@ -279,6 +282,8 @@ export declare namespace DateUtils {
279
282
  */
280
283
  declare const DefaultFontSizes: readonly number[];
281
284
 
285
+ export declare const DefaultTaskPaneRegistry: TaskPaneRegistry;
286
+
282
287
  export declare const DocThemesContext: Context<IThemeCollection>;
283
288
 
284
289
  /**
@@ -536,6 +541,60 @@ export declare interface ISheetElement extends HTMLDivElement, SheetAttributes {
536
541
  declare interface ISheetHeaderElement extends HTMLDivElement, SheetHeaderAttributes {
537
542
  }
538
543
 
544
+ export declare interface ITaskPaneArea {
545
+ /**
546
+ * This will show and focus a task pane by key.
547
+ * @param key The task pane key.
548
+ */
549
+ activateTaskPane: (key: string, options?: {
550
+ focus?: boolean;
551
+ } & any) => void;
552
+ }
553
+
554
+ export declare interface ITaskPaneAreaElement extends HTMLDivElement, ITaskPaneArea {
555
+ }
556
+
557
+ export declare interface ITaskPaneContainerListener {
558
+ onShow?: () => void;
559
+ onBeforeHide?: () => void | Promise<boolean>;
560
+ onHide?: () => void;
561
+ }
562
+
563
+ export declare interface ITaskPaneFrame {
564
+ addListener: (listener: ITaskPaneContainerListener) => RemoveListener;
565
+ close: () => void;
566
+ }
567
+
568
+ export declare interface ITaskPaneRegistry {
569
+ /**
570
+ * Registers a task pane container.
571
+ * @param entry The task pane entry.
572
+ * @param replace Whether to replace an existing task pane. Default is false.
573
+ */
574
+ registerTaskPane(entry: TaskPaneEntry, replace?: boolean): void;
575
+ /**
576
+ * Unregister a task pane container.
577
+ *
578
+ * @param key The unique key for the task pane.
579
+ */
580
+ unregisterTaskPane(key: string): void;
581
+ /**
582
+ * Gets a registered task pane container.
583
+ *
584
+ * @param key The unique key for the task pane.
585
+ * @returns The registered task pane or null if not found.
586
+ */
587
+ getRegisteredTaskPane(key: string): TaskPaneEntry | null;
588
+ /**
589
+ * Finds contributions for a specific entry.
590
+ * @param contributionKey
591
+ */
592
+ findContributions(contributionKey: string): TaskPaneEntry[];
593
+ }
594
+
595
+ export declare interface ITaskPaneStrip extends HTMLDivElement, TaskPaneStripAttributes {
596
+ }
597
+
539
598
  export declare const Item: default_2.NamedExoticComponent<Props & default_2.RefAttributes<HTMLDivElement>>;
540
599
 
541
600
  export { LicenseDetails }
@@ -773,9 +832,9 @@ export declare interface ScriptEditorProps extends default_2.HTMLAttributes<HTML
773
832
  */
774
833
  readOnly?: boolean;
775
834
  /**
776
- * Called when the user request a close.
835
+ * Handle to the frame
777
836
  */
778
- onClose?: () => void;
837
+ frame?: ITaskPaneFrame;
779
838
  /**
780
839
  * Allows for component to be autoFocused.
781
840
  */
@@ -1313,6 +1372,207 @@ export declare interface TabStripRef extends HTMLDivElement {
1313
1372
  cancel(index: number): void;
1314
1373
  }
1315
1374
 
1375
+ /**
1376
+ * The TaskPaneArea is a React component that renders multiple task panes.
1377
+ *
1378
+ * Container component implements 2 interfaces. If
1379
+ * implements the ITaskPaneArea interface to be given to the TaskPaneProvider
1380
+ * and it implement the ITaskPaneParent to be given to the TaskPane component.
1381
+ * This provides a simple implementation but can be swapped out later.
1382
+ */
1383
+ export declare const TaskPaneArea: default_2.NamedExoticComponent<TaskPaneAreaProps<any> & default_2.RefAttributes<ITaskPaneAreaElement>>;
1384
+
1385
+ export declare interface TaskPaneAreaProps<T = any> extends default_2.HTMLAttributes<HTMLDivElement> {
1386
+ /**
1387
+ * The model to pass to taskpane
1388
+ */
1389
+ model?: T;
1390
+ /**
1391
+ * The commands to use for the toolbar.
1392
+ */
1393
+ commands?: ICommands.IGroup;
1394
+ /**
1395
+ * Called when the task pane is should open.
1396
+ *
1397
+ * @remarks
1398
+ * This is called when the first task pane is activated but it does not actually open.
1399
+ */
1400
+ onOpen?: () => void;
1401
+ /**
1402
+ * Called when the task pane is closed.
1403
+ *
1404
+ * @remarks
1405
+ * This is called when the last task pane is deactivated but it does not actually close.
1406
+ */
1407
+ onClose?: () => void;
1408
+ /**
1409
+ * Props that can be injected to pane
1410
+ */
1411
+ paneProps?: default_2.HTMLAttributes<HTMLDivElement>;
1412
+ /**
1413
+ * Allows users to Wrap pane children in Top level Context
1414
+ */
1415
+ paneWrapper?: (children: default_2.ReactNode) => default_2.ReactNode;
1416
+ /**
1417
+ * Wrap frame in a context
1418
+ */
1419
+ frameWrapper?: (children: default_2.ReactNode) => default_2.ReactNode;
1420
+ /**
1421
+ * Props that can be injected to the frame
1422
+ */
1423
+ frameProps?: default_2.HTMLAttributes<HTMLDivElement>;
1424
+ /**
1425
+ * Override the default title renderer.
1426
+ *
1427
+ * @remarks
1428
+ * If the registry also provides a custom title renderer that will be used instead.
1429
+ */
1430
+ renderTaskPanelTitle?(props: TaskPaneTitleProps, ref: default_2.Ref<HTMLDivElement>): default_2.ReactElement;
1431
+ /**
1432
+ * Override the default task pane strip renderer.
1433
+ *
1434
+ */
1435
+ renderTaskPaneStrip?(props: TaskPaneStripProps, ref: default_2.Ref<ITaskPaneStrip>): default_2.ReactElement;
1436
+ /**
1437
+ * Allow for custom registry of task panes.
1438
+ */
1439
+ registry?: ITaskPaneRegistry;
1440
+ /**
1441
+ * If true always show the strip even with one pane.
1442
+ */
1443
+ alwaysShowStrip?: boolean;
1444
+ }
1445
+
1446
+ export declare interface TaskPaneAreaPropsRefProps extends TaskPaneAreaProps {
1447
+ ref?: default_2.Ref<HTMLDivElement>;
1448
+ }
1449
+
1450
+ export declare interface TaskPaneEntry {
1451
+ /**
1452
+ * The unique key for the task pane.
1453
+ *
1454
+ * @remarks
1455
+ * * Must not change.
1456
+ */
1457
+ readonly key: string;
1458
+ /**
1459
+ * The command paths to use to open the task pane.
1460
+ *
1461
+ * @remarks
1462
+ * * Must not change.
1463
+ * If this is not provided the task pane can only be opened programmatically.
1464
+ */
1465
+ readonly contributionPoints?: string[];
1466
+ /**
1467
+ * The title to display to identify the task pane.
1468
+ */
1469
+ getTitle(): string;
1470
+ /**
1471
+ * The icon to display to identify the task pane.
1472
+ *
1473
+ * @remarks
1474
+ * This can be either a string (glyph key) or a React element.
1475
+ */
1476
+ getIcon?(): React.ReactElement | string;
1477
+ /**
1478
+ * Renders the task pane.
1479
+ *
1480
+ * @param props The props for the task pane.
1481
+ * @param ref The ref to the task pane container.
1482
+ */
1483
+ renderTaskPane(props: TaskPaneProps, ref: React.Ref<HTMLDivElement>): React.ReactElement;
1484
+ /**
1485
+ * Optional function to render a custom title for the task pane.
1486
+ */
1487
+ renderTaskPanelTitle?(props: TaskPaneTitleProps, ref: React.Ref<HTMLDivElement>): React.ReactElement;
1488
+ createCommand?(taskPaneArea: ITaskPaneArea): ICommand;
1489
+ /**
1490
+ * Optional function to create a button that can be placed in the command bar.
1491
+ *
1492
+ * @remarks
1493
+ * If not provided a default button will be created.
1494
+ */
1495
+ createCommandButton?(props: CommandButtonProps): React.ReactElement;
1496
+ }
1497
+
1498
+ export declare interface TaskPaneProps<T = any> {
1499
+ /**
1500
+ * The key used to register the taskPane.
1501
+ */
1502
+ entryKey: string;
1503
+ model?: T;
1504
+ commands?: ICommands.IGroup;
1505
+ frame?: ITaskPaneFrame;
1506
+ }
1507
+
1508
+ export declare const TaskPaneProvider: default_2.FC<TaskPaneProviderProps>;
1509
+
1510
+ /**
1511
+ * Context provider for task panes. Allows custom task pane manager
1512
+ * to be provided to components within the provider tree.
1513
+ *
1514
+ * ```tsx
1515
+ * <TaskPaneProvider
1516
+ * createArea={() => ITaskPaneArea}
1517
+ * onUpdateArea={(area) => { }}
1518
+ * >
1519
+ * <App />
1520
+ * </TaskPaneProvider>
1521
+ * ```
1522
+ */
1523
+ export declare interface TaskPaneProviderProps {
1524
+ children: ReactNode;
1525
+ createArea: (props: TaskPaneAreaProps, ref: default_2.Ref<ITaskPaneAreaElement>) => default_2.ReactElement<ITaskPaneAreaElement>;
1526
+ onUpdateArea: (areaElement: default_2.ReactElement<ITaskPaneAreaElement>) => void;
1527
+ registry?: ITaskPaneRegistry;
1528
+ }
1529
+
1530
+ declare class TaskPaneRegistry implements ITaskPaneRegistry {
1531
+ protected _taskPanes: Map<string, TaskPaneEntry>;
1532
+ /** @inheritdoc ITaskPaneRegistry.registerTaskPane */
1533
+ registerTaskPane(entry: TaskPaneEntry, replace?: boolean): void;
1534
+ /** @inheritdoc ITaskPaneRegistry.unregisterTaskPane */
1535
+ unregisterTaskPane(key: string): void;
1536
+ /** @inheritdoc ITaskPaneRegistry.getRegisteredTaskPane */
1537
+ getRegisteredTaskPane(key: string): TaskPaneEntry | null;
1538
+ findContributions(contributionKey: string): TaskPaneEntry[];
1539
+ }
1540
+
1541
+ export declare const TaskPaneStrip: default_2.NamedExoticComponent<TaskPaneStripProps & default_2.RefAttributes<ITaskPaneStrip>>;
1542
+
1543
+ export declare interface TaskPaneStripAttributes {
1544
+ isTaskPaneStrip: () => true;
1545
+ }
1546
+
1547
+ export declare interface TaskPaneStripProps extends Omit<default_2.HTMLAttributes<HTMLElement>, 'onSelect' | 'selected'> {
1548
+ taskPanes: string[];
1549
+ onSelect(key: string): void;
1550
+ selected: string;
1551
+ /**
1552
+ * Allow for custom registry of task panes.
1553
+ */
1554
+ registry?: ITaskPaneRegistry;
1555
+ /**
1556
+ * If true, only show icons in the strip (no text).
1557
+ */
1558
+ iconsOnly?: boolean;
1559
+ }
1560
+
1561
+ export declare const TaskPaneTitle: default_2.FC<TaskPaneTitleProps & {
1562
+ ref?: default_2.Ref<HTMLDivElement>;
1563
+ }>;
1564
+
1565
+ export declare interface TaskPaneTitleProps extends Omit<default_2.HTMLAttributes<HTMLElement>, 'title'> {
1566
+ title: default_2.ReactNode;
1567
+ icon: default_2.ReactNode;
1568
+ onClose: () => void;
1569
+ readOnly: boolean;
1570
+ /**
1571
+ * If the task pane is focused
1572
+ */
1573
+ focused: boolean;
1574
+ }
1575
+
1316
1576
  declare interface Theme {
1317
1577
  readonly theme: ITheme;
1318
1578
  readonly themes: IThemeCollection;
@@ -1434,6 +1694,12 @@ export declare interface useSheetRangeListenerOptions extends ICellRange.Listene
1434
1694
  fireOnAddressChange: boolean;
1435
1695
  }
1436
1696
 
1697
+ /**
1698
+ * Hook to get the task pane manager directly.
1699
+ * Useful for registering new task panes or managing instances.
1700
+ */
1701
+ export declare const useTaskPaneArea: () => ITaskPaneArea;
1702
+
1437
1703
 
1438
1704
  export * from "@sheetxl/utils-react";
1439
1705