onekijs-ui 0.19.15 → 0.19.17

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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const TableToolbarBottomComponent: React.FC;
3
+ export default TableToolbarBottomComponent;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const TableToolbarTopComponent: React.FC;
3
+ export default TableToolbarTopComponent;
@@ -1,7 +1,6 @@
1
1
  import { Collection, CollectionBy, CollectionProxy, FormDisplayerProps, FormFieldProps, Item, ItemAdaptee, Primitive, QueryFilterCriteriaOperator, QueryFilterOrCriteria, QuerySortBy, UseCollectionOptions, ValidationStatus } from 'onekijs-framework';
2
2
  import React, { ComponentType, FC, PropsWithChildren, ReactNode } from 'react';
3
3
  import { StylableProps, TshirtSize } from '../../styles/typings';
4
- import { ButtonProps } from '../button/typings';
5
4
  import { CheckboxProps } from '../checkbox/typings';
6
5
  import { FieldLayoutProps } from '../field/typings';
7
6
  import { InputProps } from '../input/typings';
@@ -93,7 +92,6 @@ export type TableBodyRowProps<T = any, I extends TableItem<T> = TableItem<T>> =
93
92
  onCollapsed?: (item: I | undefined, index: number) => void;
94
93
  };
95
94
  export type TableConfig<T = any, I extends TableItem<T> = TableItem<T>> = {
96
- ActionComponent?: React.FC;
97
95
  autoRefresh?: number;
98
96
  bodyClassName?: string;
99
97
  BodyComponent?: React.FC<TableBodyProps<T, I>>;
@@ -128,11 +126,17 @@ export type TableConfig<T = any, I extends TableItem<T> = TableItem<T>> = {
128
126
  preload?: number;
129
127
  rowClassName?: string | ((item: I | undefined, rowIndex: number, columns: TableColumn<T, I>[]) => string);
130
128
  RowComponent?: React.FC<TableBodyRowProps<T, I>>;
131
- refreshButtonKind?: ButtonProps['kind'];
132
- showRefreshButton?: boolean;
133
129
  sortable?: boolean;
134
130
  stripRows?: boolean;
135
131
  tail?: boolean;
132
+ ToolbarBottomComponent?: React.FC;
133
+ ToolbarTopComponent?: React.FC;
134
+ ToolbarBottomCenterComponent?: React.FC;
135
+ ToolbarBottomLeftComponent?: React.FC;
136
+ ToolbarBottomRightComponent?: React.FC;
137
+ ToolbarTopCenterComponent?: React.FC;
138
+ ToolbarTopLeftComponent?: React.FC;
139
+ ToolbarTopRightComponent?: React.FC;
136
140
  };
137
141
  export type TableController<T = any, I extends TableItem<T> = TableItem<T>, S extends TableState<T, I> = TableState<T, I>> = Collection<T, I, S> & {
138
142
  addColumn(column: TableColumn<T, I>, position?: number): void;
package/dist/index.d.ts CHANGED
@@ -31,6 +31,7 @@ export { default as DashboardOverlay, dashboardOverlayStyle } from './components
31
31
  export { default as DashboardRight } from './components/dashboard/components/DashboardRight';
32
32
  export { default as DashboardToggler } from './components/dashboard/components/DashboardToggler';
33
33
  export { default as useDashboard } from './components/dashboard/hooks/useDashboard';
34
+ export { default as RefreshIcon } from './components/icon/RefreshIcon';
34
35
  export { useDashboardHorizontalPanel, useDashboardVerticalPanel, useDashoardBodyPanel, } from './components/dashboard/hooks/useDashboardPanel';
35
36
  export { DashboardServiceContext, default as useDashboardService, } from './components/dashboard/hooks/useDashboardService';
36
37
  export { DashboardStateContext, default as useDashboardState } from './components/dashboard/hooks/useDashboardState';
package/dist/index.js CHANGED
@@ -3843,6 +3843,24 @@ const useDashboard = () => {
3843
3843
  return [DashboardRef.current, service];
3844
3844
  };
3845
3845
 
3846
+ const RefreshIconComponent = (props) => {
3847
+ return (React.createElement("div", { ...props },
3848
+ React.createElement("svg", { className: "o-icon-refresh-svg", stroke: "currentColor", fill: "none", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg" },
3849
+ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }))));
3850
+ };
3851
+ var RefreshIcon = styled(RefreshIconComponent) `
3852
+ ${({ width = '16px', height = '16px', color: cssColor = 'inherit' }) => styled.css `
3853
+ width: ${width};
3854
+ height: ${height};
3855
+ ${display('flex')};
3856
+ ${alignItems('center')};
3857
+ ${color(cssColor)}
3858
+ .o-icon-refresh-svg {
3859
+ display: inline-block;
3860
+ }
3861
+ `}
3862
+ `;
3863
+
3846
3864
  const useDashboardHorizontalPanel = (area) => {
3847
3865
  const state = React.useContext(DashboardStateContext);
3848
3866
  return area === 'header' ? state.header : state.footer;
@@ -9252,33 +9270,6 @@ const useTableState = () => {
9252
9270
  return React.useContext(TableStateContext);
9253
9271
  };
9254
9272
 
9255
- const RefreshIconComponent = (props) => {
9256
- return (React.createElement("div", { ...props },
9257
- React.createElement("svg", { className: "o-icon-refresh-svg", stroke: "currentColor", fill: "none", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg" },
9258
- React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }))));
9259
- };
9260
- var RefreshIcon = styled(RefreshIconComponent) `
9261
- ${({ width = '16px', height = '16px', color: cssColor = 'inherit' }) => styled.css `
9262
- width: ${width};
9263
- height: ${height};
9264
- ${display('flex')};
9265
- ${alignItems('center')};
9266
- ${color(cssColor)}
9267
- .o-icon-refresh-svg {
9268
- display: inline-block;
9269
- }
9270
- `}
9271
- `;
9272
-
9273
- const TableActionComponent = () => {
9274
- const { showRefreshButton, refreshButtonKind } = useTableConfig();
9275
- const table = useTableService();
9276
- return (React.createElement("div", { className: "o-table-actions" },
9277
- React.createElement("div", { className: "o-table-action" }),
9278
- showRefreshButton && React.createElement("div", { className: "o-table-refresh" },
9279
- React.createElement(Button, { kind: refreshButtonKind, size: "small", IconComponent: () => React.createElement(RefreshIcon, null), onClick: () => table.reload() }, "Refresh"))));
9280
- };
9281
-
9282
9273
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9283
9274
  const useTableColumns = () => {
9284
9275
  return useTableState().columns;
@@ -9608,12 +9599,23 @@ const tableStyle = ({ theme, fit = true }) => {
9608
9599
  ${display('flex')}
9609
9600
  }
9610
9601
 
9611
- .o-table-action {
9602
+ .o-table-actions-top {
9603
+ }
9604
+
9605
+ .o-table-action-top-left {
9612
9606
  ${flexGrow(1)}
9613
9607
  }
9614
9608
 
9615
- .o-table-refresh {
9616
- ${marginBottom('sm')}
9609
+ .o-table-action-top-center {
9610
+ ${flexGrow(1)}
9611
+ ${display('flex')}
9612
+ ${justifyContent('center')}
9613
+ }
9614
+
9615
+ .o-table-action-top-right {
9616
+ ${flexGrow(1)}
9617
+ ${display('flex')}
9618
+ ${justifyContent('flex-end')}
9617
9619
  ${marginRight('xl')}
9618
9620
  }
9619
9621
 
@@ -10074,7 +10076,23 @@ const ExpandedCellComponent = ({ item, className }) => {
10074
10076
  React.createElement(TogglerIcon, { open: item.expanded, model: "plus", color: "primary" })));
10075
10077
  };
10076
10078
 
10077
- const ControllerTableComponent = ({ ActionComponent = TableActionComponent, autoRefresh, controller, className, bodyClassName, BodyComponent = TableBodyComponent, ExpandedComponent, filterable, fit, fixHeader = true, follow, grow, FooterComponent = TableFooterComponent, footerClassName, header = true, headerClassName, HeaderComponent = TableHeaderComponent, increment, itemHeight, LoadingComponent, LoadingRowComponent, NotFoundComponent, footer = false, height, highlightRow, onRowClick, onRowEnter, onRowLeave, onRowOver, onRowOut, paddingEnd, paddingStart, parentRef, preload, refreshButtonKind = 'primary', rowClassName, RowComponent, showRefreshButton, sortable, stripRows, tail, }) => {
10079
+ const TableToolbarBottomComponent = () => {
10080
+ const { ToolbarBottomCenterComponent, ToolbarBottomLeftComponent, ToolbarBottomRightComponent } = useTableConfig();
10081
+ return (React.createElement("div", { className: `o-table-actions o-table-actions-bottom` },
10082
+ React.createElement("div", { className: "o-table-action-bottom-left" }, ToolbarBottomLeftComponent && React.createElement(ToolbarBottomLeftComponent, null)),
10083
+ React.createElement("div", { className: "o-table-action-bottom-center" }, ToolbarBottomCenterComponent && React.createElement(ToolbarBottomCenterComponent, null)),
10084
+ React.createElement("div", { className: "o-table-action-bottom-center" }, ToolbarBottomRightComponent && React.createElement(ToolbarBottomRightComponent, null))));
10085
+ };
10086
+
10087
+ const TableToolbarTopComponent = () => {
10088
+ const { ToolbarTopCenterComponent, ToolbarTopLeftComponent, ToolbarTopRightComponent, } = useTableConfig();
10089
+ return (React.createElement("div", { className: `o-table-actions o-table-actions-top` },
10090
+ React.createElement("div", { className: "o-table-action-top-left" }, ToolbarTopLeftComponent && React.createElement(ToolbarTopLeftComponent, null)),
10091
+ React.createElement("div", { className: "o-table-action-top-center" }, ToolbarTopCenterComponent && React.createElement(ToolbarTopCenterComponent, null)),
10092
+ React.createElement("div", { className: "o-table-action-top-right" }, ToolbarTopRightComponent && React.createElement(ToolbarTopRightComponent, null))));
10093
+ };
10094
+
10095
+ const ControllerTableComponent = ({ autoRefresh, controller, className, bodyClassName, BodyComponent = TableBodyComponent, ExpandedComponent, filterable, fit, fixHeader = true, follow, grow, FooterComponent = TableFooterComponent, footerClassName, header = true, headerClassName, HeaderComponent = TableHeaderComponent, increment, itemHeight, LoadingComponent, LoadingRowComponent, NotFoundComponent, footer = false, height, highlightRow, onRowClick, onRowEnter, onRowLeave, onRowOver, onRowOut, paddingEnd, paddingStart, parentRef, preload, rowClassName, RowComponent, sortable, stripRows, tail, ToolbarBottomComponent = TableToolbarBottomComponent, ToolbarTopComponent = TableToolbarTopComponent, ToolbarBottomCenterComponent, ToolbarBottomLeftComponent, ToolbarBottomRightComponent, ToolbarTopCenterComponent, ToolbarTopLeftComponent, ToolbarTopRightComponent, }) => {
10078
10096
  const classNames = addClassname('o-table', className);
10079
10097
  const { columns, items } = controller.state;
10080
10098
  const contentRef = React.useRef(null);
@@ -10082,7 +10100,6 @@ const ControllerTableComponent = ({ ActionComponent = TableActionComponent, auto
10082
10100
  const service = controller.asService();
10083
10101
  const config = React.useMemo(() => {
10084
10102
  return {
10085
- ActionComponent,
10086
10103
  autoRefresh,
10087
10104
  bodyClassName,
10088
10105
  BodyComponent,
@@ -10115,16 +10132,21 @@ const ControllerTableComponent = ({ ActionComponent = TableActionComponent, auto
10115
10132
  paddingStart,
10116
10133
  parentRef,
10117
10134
  preload,
10118
- refreshButtonKind,
10119
10135
  rowClassName,
10120
10136
  RowComponent,
10121
- showRefreshButton,
10122
10137
  sortable,
10123
10138
  stripRows,
10124
10139
  tail,
10140
+ ToolbarBottomComponent,
10141
+ ToolbarTopComponent,
10142
+ ToolbarBottomCenterComponent,
10143
+ ToolbarBottomLeftComponent,
10144
+ ToolbarBottomRightComponent,
10145
+ ToolbarTopCenterComponent,
10146
+ ToolbarTopLeftComponent,
10147
+ ToolbarTopRightComponent,
10125
10148
  };
10126
10149
  }, [
10127
- ActionComponent,
10128
10150
  autoRefresh,
10129
10151
  bodyClassName,
10130
10152
  BodyComponent,
@@ -10157,13 +10179,19 @@ const ControllerTableComponent = ({ ActionComponent = TableActionComponent, auto
10157
10179
  paddingStart,
10158
10180
  parentRef,
10159
10181
  preload,
10160
- refreshButtonKind,
10161
10182
  rowClassName,
10162
10183
  RowComponent,
10163
- showRefreshButton,
10164
10184
  sortable,
10165
10185
  stripRows,
10166
10186
  tail,
10187
+ ToolbarBottomComponent,
10188
+ ToolbarTopComponent,
10189
+ ToolbarBottomCenterComponent,
10190
+ ToolbarBottomLeftComponent,
10191
+ ToolbarBottomRightComponent,
10192
+ ToolbarTopCenterComponent,
10193
+ ToolbarTopLeftComponent,
10194
+ ToolbarTopRightComponent,
10167
10195
  ]);
10168
10196
  service.config = config;
10169
10197
  React.useEffect(() => {
@@ -10186,14 +10214,15 @@ const ControllerTableComponent = ({ ActionComponent = TableActionComponent, auto
10186
10214
  React.createElement(TableStateContext.Provider, { value: controller.state },
10187
10215
  React.createElement(TableConfigContext.Provider, { value: config },
10188
10216
  React.createElement("div", { className: className },
10189
- React.createElement(ActionComponent, null),
10217
+ React.createElement(ToolbarTopComponent, null),
10190
10218
  React.createElement("div", { id: id, className: classNames, ref: tableRef, style: {
10191
10219
  maxHeight: height,
10192
10220
  overflow: 'auto',
10193
10221
  } },
10194
10222
  header && React.createElement(HeaderComponent, { columns: columns, className: headerClassName }),
10195
10223
  React.createElement(BodyComponent, { items: items || [], columns: columns, tableRef: tableRef, contentRef: contentRef, className: bodyClassName }),
10196
- footer && React.createElement(FooterComponent, { columns: columns, className: footerClassName })))))));
10224
+ footer && React.createElement(FooterComponent, { columns: columns, className: footerClassName }))),
10225
+ React.createElement(ToolbarBottomComponent, null)))));
10197
10226
  };
10198
10227
  ControllerTableComponent.displayName = 'Table';
10199
10228
 
@@ -12424,6 +12453,7 @@ exports.PasswordComponent = PasswordComponent$1;
12424
12453
  exports.Properties = Properties;
12425
12454
  exports.PropertiesComponent = PropertiesComponent;
12426
12455
  exports.Property = Property;
12456
+ exports.RefreshIcon = RefreshIcon;
12427
12457
  exports.Row = Row;
12428
12458
  exports.SearchIcon = SearchIcon;
12429
12459
  exports.Select = Select;