jb-grid 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +138 -11
  2. package/package.json +5 -8
  3. package/react/README.md +207 -202
  4. package/react/dist/Content.d.ts +1 -2
  5. package/react/dist/Footer.d.ts +1 -2
  6. package/react/dist/Header.d.ts +3 -16
  7. package/react/dist/JBGrid.cjs.js +3631 -1
  8. package/react/dist/JBGrid.cjs.js.map +1 -1
  9. package/react/dist/JBGrid.d.ts +288 -26
  10. package/react/dist/JBGrid.js +3624 -1
  11. package/react/dist/JBGrid.js.map +1 -1
  12. package/react/dist/JBGrid.umd.js +3641 -1
  13. package/react/dist/JBGrid.umd.js.map +1 -1
  14. package/react/dist/JBGridData.d.ts +1 -5
  15. package/react/dist/JBGridViewModel.d.ts +28 -25
  16. package/react/dist/types.d.ts +17 -49
  17. package/react/lib/Components/Cell.tsx +17 -15
  18. package/react/lib/Components/ColumnHeader.tsx +44 -0
  19. package/react/lib/Components/ExpandToggle.tsx +14 -10
  20. package/react/lib/Components/FullscreenIcon.tsx +28 -0
  21. package/react/lib/Components/JBLoading.tsx +5 -4
  22. package/react/lib/Components/Pagination.tsx +1 -1
  23. package/react/lib/Components/PaginationInfo.tsx +71 -0
  24. package/react/lib/Components/RefreshIcon.tsx +11 -0
  25. package/react/lib/Components/Row.tsx +17 -15
  26. package/react/lib/Components/TableHeader.tsx +21 -0
  27. package/react/lib/Components/blob-loading.css +27 -23
  28. package/react/lib/Components/cell.css +7 -7
  29. package/react/lib/Components/content-error/ContentError.tsx +19 -16
  30. package/react/lib/Components/content-error/content-error.css +5 -11
  31. package/react/lib/Components/module-declaration.ts +61 -13
  32. package/react/lib/Content.tsx +23 -47
  33. package/react/lib/Footer.tsx +52 -79
  34. package/react/lib/Header.tsx +11 -24
  35. package/react/lib/JBGrid.tsx +129 -70
  36. package/react/lib/JBGridViewModel.ts +189 -452
  37. package/react/lib/footer.css +25 -55
  38. package/react/lib/header.css +20 -20
  39. package/react/lib/jb-grid.css +69 -55
  40. package/react/lib/types.ts +32 -129
  41. package/react/lib/variables.css +6 -0
  42. package/react/package.json +14 -10
  43. package/react/tsconfig.json +5 -4
  44. package/web-component/dist/index.cjs.js +559 -1
  45. package/web-component/dist/index.cjs.js.br +0 -0
  46. package/web-component/dist/index.cjs.js.gz +0 -0
  47. package/web-component/dist/index.cjs.js.map +1 -1
  48. package/web-component/dist/index.d.ts +161 -4
  49. package/web-component/dist/index.d.ts.map +1 -1
  50. package/web-component/dist/index.js +561 -1
  51. package/web-component/dist/index.js.br +0 -0
  52. package/web-component/dist/index.js.gz +0 -0
  53. package/web-component/dist/index.js.map +1 -1
  54. package/web-component/dist/index.umd.js +567 -1
  55. package/web-component/dist/index.umd.js.br +0 -0
  56. package/web-component/dist/index.umd.js.gz +0 -0
  57. package/web-component/dist/index.umd.js.map +1 -1
  58. package/web-component/dist/row/row.d.ts.map +1 -1
  59. package/web-component/dist/row/types.d.ts +3 -5
  60. package/web-component/dist/row/types.d.ts.map +1 -1
  61. package/web-component/dist/row/utils.d.ts +1 -2
  62. package/web-component/dist/row/utils.d.ts.map +1 -1
  63. package/web-component/dist/table-header/render.d.ts +2 -0
  64. package/web-component/dist/table-header/render.d.ts.map +1 -0
  65. package/web-component/dist/table-header/table-header.d.ts +9 -0
  66. package/web-component/dist/table-header/table-header.d.ts.map +1 -0
  67. package/web-component/dist/table-header/types.d.ts +4 -0
  68. package/web-component/dist/table-header/types.d.ts.map +1 -0
  69. package/web-component/dist/types.d.ts +6 -0
  70. package/web-component/dist/types.d.ts.map +1 -0
  71. package/web-component/dist/utils.d.ts +8 -0
  72. package/web-component/dist/utils.d.ts.map +1 -0
  73. package/web-component/lib/cell/cell.ts +10 -5
  74. package/web-component/lib/cell/style.css +2 -1
  75. package/web-component/lib/column-header/column-header.ts +117 -0
  76. package/web-component/lib/column-header/render.ts +14 -0
  77. package/web-component/lib/column-header/style.css +60 -0
  78. package/web-component/lib/column-header/types.ts +10 -0
  79. package/web-component/lib/fullscreen-icon/fullscreen-icon.ts +72 -0
  80. package/web-component/lib/fullscreen-icon/render.ts +23 -0
  81. package/web-component/lib/fullscreen-icon/style.css +44 -0
  82. package/web-component/lib/fullscreen-icon/types.ts +1 -0
  83. package/web-component/lib/i18n.ts +38 -0
  84. package/web-component/lib/index.ts +9 -4
  85. package/web-component/lib/pagination/README.md +4 -0
  86. package/web-component/lib/pagination/pagination.ts +25 -15
  87. package/web-component/lib/pagination/render.ts +13 -10
  88. package/web-component/lib/pagination/style.css +43 -31
  89. package/web-component/lib/pagination/types.ts +1 -1
  90. package/web-component/lib/pagination/variables.css +10 -0
  91. package/web-component/lib/pagination-info/pagination-info.ts +191 -0
  92. package/web-component/lib/pagination-info/render.ts +16 -0
  93. package/web-component/lib/pagination-info/style.css +47 -0
  94. package/web-component/lib/pagination-info/types.ts +12 -0
  95. package/web-component/lib/refresh-icon/refresh-icon.ts +79 -0
  96. package/web-component/lib/refresh-icon/render.ts +10 -0
  97. package/web-component/lib/refresh-icon/style.css +21 -0
  98. package/web-component/lib/row/render.ts +3 -3
  99. package/web-component/lib/row/row.ts +29 -15
  100. package/web-component/lib/row/style.css +30 -30
  101. package/web-component/lib/row/types.ts +7 -8
  102. package/web-component/lib/row/utils.ts +1 -40
  103. package/web-component/lib/row/variables.css +13 -0
  104. package/web-component/lib/table-header/render.ts +9 -0
  105. package/web-component/lib/table-header/style.css +29 -0
  106. package/web-component/lib/table-header/table-header.ts +50 -0
  107. package/web-component/lib/table-header/types.ts +4 -0
  108. package/web-component/lib/toggle/expand-toggle.ts +17 -13
  109. package/web-component/lib/toggle/render.ts +18 -13
  110. package/web-component/lib/toggle/style.css +18 -5
  111. package/web-component/lib/types.ts +6 -0
  112. package/web-component/lib/utils.ts +46 -0
  113. package/react/lib/JBGridBridgeExample.js +0 -90
  114. package/react/lib/JBGridData.ts +0 -51
  115. package/react/lib/global.d.ts +0 -15
  116. package/web-component/lib/global.d.ts +0 -15
  117. package/web-component/tsconfig.json +0 -17
@@ -1,11 +1,7 @@
1
- import { JBGridConfigStates, JBGridDataPage, JBGridTableConfig, JBGridCallbackConfig, JBGridDataConfig, JBGridConfigInterface, AnyObject } from './types.js';
1
+ import { JBGridConfigStates, JBGridTableConfig, JBGridConfigInterface, AnyObject } from './types.js';
2
2
  declare class JBGridData<T extends AnyObject> implements JBGridConfigInterface<T> {
3
- constructor();
4
3
  table: JBGridTableConfig;
5
- data: JBGridDataConfig<T>;
6
- page: JBGridDataPage;
7
4
  states: JBGridConfigStates;
8
- callbacks: JBGridCallbackConfig<any>;
9
5
  /**
10
6
  * @deprecated provide it as a prop
11
7
  */
@@ -1,44 +1,48 @@
1
1
  import React, { type RefObject } from 'react';
2
- import type { AnyObject, JBGridBridgeClassInterface, JBGridBridgeInterface, JBGridCallbacks, JBGridColumnDef, JBGridConfig, JBGridConfigInterface, JBGridFilter, JBGridI18nConfig, JBGridResponseData, JBGridRowData, JBGridStyles, SearchbarConfig } from './types.js';
3
- import type { JBSearchbarWebComponent, JBSearchbarValue } from 'jb-searchbar';
2
+ import type { AnyObject, JBGridCallbacks, JBGridColumnDef, JBGridConfig, JBGridI18nConfig, JBGridPaginationMeta, JBGridRowData, JBGridStyles } from './types.js';
3
+ type StateChangeCallback = (() => void) | undefined;
4
+ export type JBGridState<T extends AnyObject> = {
5
+ config: JBGridConfig<T>;
6
+ data: JBGridRowData<T>[];
7
+ pageIndex: number;
8
+ pageSize: number;
9
+ totalPages: number;
10
+ metaData: JBGridPaginationMeta;
11
+ };
4
12
  declare class JBGridViewModel<T extends AnyObject> {
13
+ #private;
5
14
  styles: JBGridStyles;
6
15
  elements: {
7
16
  refreshIcon: React.RefObject<SVGElement | null>;
8
- searchbar: React.RefObject<JBSearchbarWebComponent | null>;
9
17
  };
10
18
  JBGridComponentDom: RefObject<HTMLDivElement | null>;
11
19
  gridWrapperElement: HTMLElement | null;
12
- isLoading: boolean;
13
- dataBridge: JBGridBridgeInterface;
14
- paginationDebounce: any;
15
- isErrorOccurred: boolean;
16
- filter: JBGridFilter;
17
20
  callBacks: JBGridCallbacks;
18
21
  config: JBGridConfig<T>;
22
+ data: JBGridRowData<T>[];
23
+ page: {
24
+ index: number;
25
+ size: number;
26
+ totalPages: number;
27
+ };
28
+ metaData: JBGridPaginationMeta;
19
29
  i18n: JBGridI18nConfig;
20
- constructor(onFullscreenChange: ((isFullScreen: boolean) => void) | undefined, config: JBGridConfigInterface<T>, bridge: JBGridBridgeClassInterface);
21
- setI18n(newValue: JBGridI18nConfig): void;
30
+ constructor(callBacks: JBGridCallbacks | undefined, config: JBGridConfig<T>, onStateChange?: () => void);
31
+ bindMethods(): void;
32
+ setStateChangeCallback(callback: StateChangeCallback): void;
33
+ setCallbacks(callBacks: JBGridCallbacks | undefined): void;
34
+ setGridState(state: JBGridState<T>): void;
35
+ notifyStateChange(): void;
36
+ setI18n(newValue: JBGridI18nConfig, notifyStateChange?: boolean): void;
22
37
  InitGrid(): void;
23
- onComponentDidMount(searchbarConfig: SearchbarConfig | null): void;
24
- mergeObject(inputConfig: JBGridConfig<any>, defaultConfig: JBGridConfig<any>): JBGridConfig<any>;
25
- sendFirstRequest(): void;
26
- initFilter(searchbarConfig: SearchbarConfig | null): void;
27
38
  InitSize(): void;
28
39
  getScrollbarWidth(): number;
29
- fetchGridData(): Promise<unknown>;
30
- onFetchSuccess(data: JBGridResponseData<T>): void;
31
- standardData(data: AnyObject[]): Promise<JBGridRowData<T>[]>;
32
- CreateRequestBody(): any;
33
40
  goToFirstPage(): void;
34
41
  refreshBtnClick(): void;
35
42
  playRefreshBtnAnimation(): Animation;
36
43
  stopRefreshBtnAnimation(anime: Animation): void;
37
- goToPage(destinationPageIndex: number): Promise<unknown>;
38
- debounce(func: (...args: any[]) => any, delay: number): (...inputs: any[]) => Promise<unknown>;
39
- refreshData(): Promise<void>;
40
- onSearch(filterList: JBSearchbarValue): Promise<unknown>;
41
- onPageSizeChange(e: any): void;
44
+ goToPage(destinationPageIndex: number): void;
45
+ onPageSizeChange(e: React.ChangeEvent<HTMLSelectElement>): void;
42
46
  onFullScreenBtnClicked(currentValue: boolean): void;
43
47
  onFullscreenChanged(newValue: boolean): void;
44
48
  fullScreenGrid(): void;
@@ -47,8 +51,6 @@ declare class JBGridViewModel<T extends AnyObject> {
47
51
  changePageNumberToInput(): void;
48
52
  openSearchHeaderSection(): void;
49
53
  openMainHeaderSection(): void;
50
- showErrorPanel(): void;
51
- hideErrorPanel(): void;
52
54
  get paginationDisplayNumbers(): {
53
55
  currentPage: string | number;
54
56
  nextPage: string | number;
@@ -61,6 +63,7 @@ declare class JBGridViewModel<T extends AnyObject> {
61
63
  pageSizes: (string | number)[];
62
64
  };
63
65
  toPersianNumber(input: string | number): string | number;
66
+ private createConfig;
64
67
  }
65
68
  export default JBGridViewModel;
66
69
  export declare const JBGridContext: React.Context<JBGridViewModel<AnyObject> | null>;
@@ -1,4 +1,3 @@
1
- import type { FilterItem, JBSearchbarValue } from "jb-searchbar";
2
1
  export type JBGridRowDataDetail = {
3
2
  isDeleting: boolean;
4
3
  isDeleted: boolean;
@@ -36,25 +35,10 @@ export type JBGridResponseData<T extends AnyObject> = {
36
35
  totalPages: number;
37
36
  content: JBGridRowData<T>[];
38
37
  };
39
- export type JBGridFilter = {
40
- config: SearchbarConfig | null;
41
- value: JBSearchbarValue;
42
- };
43
- export type SearchbarConfig = {
44
- columnList: FilterItem[];
45
- searchOnChange?: boolean;
46
- };
47
- export interface JBGridBridgeInterface {
48
- mapServerResponseDataToGridData: (data: any) => JBGridResponseData<any>;
49
- getData: (data: JBGridConfigRequestParams, requestBody: any) => Promise<any>;
50
- createRequestBody: (page: JBGridDataPage, filter?: JBSearchbarValue, sortColumn?: JBGridColumnDef | null, requestConfig?: JBGridConfigRequestParams) => any;
51
- }
52
- type ClassBuilder<I, Args extends any[] = any[]> = new (...args: Args) => I;
53
- export type JBGridBridgeClassInterface = ClassBuilder<JBGridBridgeInterface, []>;
54
- export type JBGridDataPage = {
55
- index: number;
56
- size: number;
57
- totalPages: number;
38
+ export type JBGridPaginationMeta = {
39
+ startItemIndex: number;
40
+ endItemIndex: number;
41
+ totalItemsCount: number;
58
42
  };
59
43
  export type JBGridColumnDef = {
60
44
  width?: string | number;
@@ -64,20 +48,6 @@ export type JBGridColumnDef = {
64
48
  title: string;
65
49
  name: string;
66
50
  };
67
- export type JBGridConfigRequestParams = {
68
- method?: "POST" | "GET";
69
- url?: string;
70
- [key: string]: any;
71
- };
72
- export type JBGridDataConfig<T extends AnyObject> = {
73
- data: JBGridRowData<T>[];
74
- requestParams: JBGridConfigRequestParams;
75
- metaData: {
76
- startItemIndex: number;
77
- endItemIndex: number;
78
- totalItemsCount: number;
79
- };
80
- };
81
51
  export type JBGridTableConfig = {
82
52
  columns: JBGridColumnDef[];
83
53
  };
@@ -85,10 +55,6 @@ export type JBGridConfigStates = {
85
55
  headerSection: 'MAIN' | "SEARCH";
86
56
  isFullScreen: boolean;
87
57
  };
88
- export type JBGridCallbackConfig<T extends AnyObject> = {
89
- onDataStandardizing: ((data: JBGridRowData<AnyObject>[]) => JBGridRowData<T>[]) | (<T extends AnyObject>(data: JBGridRowData<AnyObject>[]) => Promise<JBGridRowData<T>[]>) | null | undefined;
90
- onPageIndexChange: ((newPageIndex: number) => unknown) | null | undefined;
91
- };
92
58
  export type JBGridI18nMessage = {
93
59
  serverErrorText?: string;
94
60
  serverErrorTitle?: string;
@@ -102,21 +68,23 @@ export type JBGridI18nConfig = {
102
68
  messages?: JBGridI18nMessage;
103
69
  showPersianNumber?: boolean;
104
70
  };
105
- export type ActionDispatchers = Readonly<{
106
- refreshData: () => Promise<void>;
107
- fullScreenGrid: () => void;
108
- exitFullScreenGrid: () => void;
71
+ export type JBGridRenderContext = Readonly<{
72
+ refreshView: () => void;
109
73
  }>;
110
74
  export interface JBGridConfigInterface<T extends AnyObject> {
111
75
  table: JBGridTableConfig;
112
- data: JBGridDataConfig<T>;
113
- page: JBGridDataPage;
114
- callbacks: JBGridCallbackConfig<T>;
115
- actionDispatchers?: ActionDispatchers;
116
- states: JBGridConfigStates;
76
+ states?: JBGridConfigStates;
117
77
  }
118
78
  export type JBGridConfig<T extends AnyObject> = JBGridConfigInterface<T>;
119
79
  export type JBGridCallbacks = {
120
- onFullscreenChange: (isFullscreen: boolean) => void;
80
+ /**
81
+ * @deprecated use onFullscreen and onExitFullscreen instead
82
+ */
83
+ onFullscreenChange?: (isFullscreen: boolean) => unknown;
84
+ onFullscreen?: () => unknown;
85
+ onPageIndexChange?: (newPageIndex: number) => unknown;
86
+ onPageSizeChange?: (newPageSize: number) => unknown;
87
+ onRefresh?: () => unknown | Promise<unknown>;
88
+ onExitFullscreen?: () => unknown;
89
+ onSortChange?: (column: JBGridColumnDef) => unknown;
121
90
  };
122
- export {};
@@ -1,15 +1,17 @@
1
- import React, { type ForwardedRef } from 'react';
2
- import type {JBCellAttributes} from './module-declaration.js';
3
- import type { JBCellWebComponent } from 'jb-grid';
4
-
5
- export type CellProps = JBCellAttributes & {
6
- ref?:ForwardedRef<JBCellWebComponent | null>,
7
- name:string,
8
- label?:string,
9
- }
10
- export function JBCell(props:CellProps) {
11
- const { children, ...otherProps} = props;
12
- return (
13
- <jb-cell slot="cell" {...otherProps}>{children}</jb-cell>
14
- );
15
- }
1
+ import React from 'react';
2
+ import 'jb-grid';
3
+ import type {JBCellAttributes} from './module-declaration.js';
4
+ import type { JBCellWebComponent } from 'jb-grid';
5
+
6
+ export type CellProps = Omit<JBCellAttributes, "ref" | "name"> & {
7
+ name:string,
8
+ label?:string,
9
+ }
10
+ export const JBCell = React.forwardRef<JBCellWebComponent | null, CellProps>((props, ref) => {
11
+ const { children, ...otherProps} = props;
12
+ return (
13
+ <jb-cell ref={ref} slot="cell" {...otherProps}>{children}</jb-cell>
14
+ );
15
+ });
16
+
17
+ JBCell.displayName = "JBCell";
@@ -0,0 +1,44 @@
1
+ import React, { useEffect, useImperativeHandle, useRef } from 'react';
2
+ import 'jb-grid';
3
+ import { useEvent } from 'jb-core/react';
4
+ import type { JBColumnHeaderAttributes } from './module-declaration.js';
5
+
6
+ type JBColumnHeaderSort = "asc" | "desc";
7
+ type JBColumnHeaderWebComponent = HTMLElement & {
8
+ name: string,
9
+ sortable: boolean,
10
+ sort: JBColumnHeaderSort | null
11
+ }
12
+ type JBColumnHeaderSortEvent = CustomEvent<{
13
+ name: string,
14
+ sort: JBColumnHeaderSort
15
+ }>
16
+
17
+ export type ColumnHeaderProps = Omit<JBColumnHeaderAttributes, "name" | "onSort" | "ref" | "sort" | "sortable"> & {
18
+ name: string,
19
+ sortable?: boolean,
20
+ sort?: JBColumnHeaderSort,
21
+ onSort?: (event: JBColumnHeaderSortEvent) => void
22
+ }
23
+
24
+ export const JBColumnHeader = React.forwardRef<JBColumnHeaderWebComponent | null, ColumnHeaderProps>((props, ref) => {
25
+ const { children, name, sortable, sort, onSort, ...otherProps } = props;
26
+ const element = useRef<JBColumnHeaderWebComponent | null>(null);
27
+ useImperativeHandle(ref, () => element.current as JBColumnHeaderWebComponent, [element]);
28
+ useEvent(element, 'sort', onSort);
29
+
30
+ useEffect(() => {
31
+ if (element.current) {
32
+ element.current.sortable = sortable === true;
33
+ element.current.sort = sort ?? null;
34
+ }
35
+ }, [sortable, sort]);
36
+
37
+ return (
38
+ <jb-col-header ref={element} name={name} {...otherProps}>
39
+ <span slot="title">{children}</span>
40
+ </jb-col-header>
41
+ );
42
+ });
43
+
44
+ JBColumnHeader.displayName = "JBColumnHeader";
@@ -1,10 +1,14 @@
1
- import React from 'react';
2
- import type {JBExpandToggleAttributes} from './module-declaration.js';
3
-
4
- export type ToggleProps = JBExpandToggleAttributes
5
- export function JBExpandToggle(props:ToggleProps) {
6
- const { children, ...otherProps} = props;
7
- return (
8
- <jb-expand-toggle {...otherProps}>{children}</jb-expand-toggle>
9
- );
10
- }
1
+ import React from 'react';
2
+ import 'jb-grid';
3
+ import type {JBExpandToggleAttributes} from './module-declaration.js';
4
+ import type { JBExpandToggleWebComponent } from 'jb-grid';
5
+
6
+ export type ToggleProps = Omit<JBExpandToggleAttributes, "ref">
7
+ export const JBExpandToggle = React.forwardRef<JBExpandToggleWebComponent | null, ToggleProps>((props, ref) => {
8
+ const { children, ...otherProps} = props;
9
+ return (
10
+ <jb-expand-toggle ref={ref} {...otherProps}>{children}</jb-expand-toggle>
11
+ );
12
+ });
13
+
14
+ JBExpandToggle.displayName = "JBExpandToggle";
@@ -0,0 +1,28 @@
1
+ import React, { useEffect, useImperativeHandle, useRef } from 'react';
2
+ import 'jb-grid';
3
+ import type { JBFullscreenIconAttributes } from './module-declaration.js';
4
+
5
+ type JBFullscreenIconState = "enter" | "exit";
6
+ type JBFullscreenIconWebComponent = HTMLElement & {
7
+ state: JBFullscreenIconState
8
+ }
9
+
10
+ export type FullscreenIconProps = Omit<JBFullscreenIconAttributes, "ref" | "state"> & {
11
+ state?: JBFullscreenIconState
12
+ }
13
+
14
+ export const JBFullscreenIcon = React.forwardRef<JBFullscreenIconWebComponent | null, FullscreenIconProps>((props, ref) => {
15
+ const { state, ...otherProps } = props;
16
+ const element = useRef<JBFullscreenIconWebComponent | null>(null);
17
+ useImperativeHandle(ref, () => element.current as JBFullscreenIconWebComponent, [element]);
18
+
19
+ useEffect(() => {
20
+ if (element.current) {
21
+ element.current.state = state ?? "enter";
22
+ }
23
+ }, [state]);
24
+
25
+ return <jb-fullscreen-icon ref={element} {...otherProps}></jb-fullscreen-icon>;
26
+ });
27
+
28
+ JBFullscreenIcon.displayName = "JBFullscreenIcon";
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- import CSS from './blob-loading.css';
2
+ import CSS from './blob-loading.css?inline';
3
3
  import { injectCss } from 'jb-core';
4
4
 
5
5
  injectCss(CSS as unknown as string);
6
6
  class JBLoading extends React.Component {
7
7
  render() {
8
8
  const renderDom = (
9
- <div className="jb-loading">
9
+ <output className="jb-loading" aria-label="Loading">
10
10
  <div className="blobs">
11
11
  <div className="blob-center"></div>
12
12
  <div className="blob"></div>
@@ -17,6 +17,7 @@ class JBLoading extends React.Component {
17
17
  <div className="blob"></div>
18
18
  </div>
19
19
  <svg xmlns="http://www.w3.org/2000/svg" version="1.1" className="style-svg">
20
+ <title>loading svg</title>
20
21
  <defs>
21
22
  <filter id="goo">
22
23
  <feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
@@ -25,9 +26,9 @@ class JBLoading extends React.Component {
25
26
  </filter>
26
27
  </defs>
27
28
  </svg>
28
- </div>
29
+ </output>
29
30
  );
30
31
  return (renderDom);
31
32
  }
32
33
  }
33
- export default JBLoading;
34
+ export default JBLoading;
@@ -1,4 +1,4 @@
1
- import React, { type DetailedHTMLProps, type FormEventHandler, type HTMLAttributes } from 'react';
1
+ import React, { type FormEventHandler, type HTMLAttributes } from 'react';
2
2
  import 'jb-grid'
3
3
  import type {JBPaginationWebComponent} from 'jb-grid'
4
4
  import type { JBElementStandardProps } from 'jb-core/react';
@@ -0,0 +1,71 @@
1
+ import React, { useEffect, useImperativeHandle, useRef } from 'react';
2
+ import 'jb-grid';
3
+ import { useEvent } from 'jb-core/react';
4
+ import type { JBPaginationInfoAttributes } from './module-declaration.js';
5
+
6
+ type JBPaginationInfoWebComponent = HTMLElement & {
7
+ pageSize: number,
8
+ pageSizes: number[],
9
+ startItemIndex: number,
10
+ endItemIndex: number,
11
+ totalItemsCount: number,
12
+ pageItemCountTitle: string,
13
+ fromLabel: string,
14
+ currentAvailableItemTitle: string,
15
+ showPersianNumber: boolean
16
+ }
17
+ type JBPaginationInfoPageSizeChangeEvent = CustomEvent<{
18
+ pageSize: number
19
+ }>
20
+
21
+ export type PaginationInfoProps = Omit<JBPaginationInfoAttributes, "onPageSizeChange" | "ref"> & {
22
+ pageSize: number,
23
+ pageSizes?: number[],
24
+ startItemIndex: number,
25
+ endItemIndex: number,
26
+ totalItemsCount: number,
27
+ pageItemCountTitle?: string,
28
+ fromLabel?: string,
29
+ currentAvailableItemTitle?: string,
30
+ showPersianNumber?: boolean,
31
+ onPageSizeChange?: (event: JBPaginationInfoPageSizeChangeEvent) => void
32
+ }
33
+
34
+ export const JBPaginationInfo = React.forwardRef<JBPaginationInfoWebComponent | null, PaginationInfoProps>((props, ref) => {
35
+ const {
36
+ pageSize,
37
+ pageSizes,
38
+ startItemIndex,
39
+ endItemIndex,
40
+ totalItemsCount,
41
+ pageItemCountTitle,
42
+ fromLabel,
43
+ currentAvailableItemTitle,
44
+ showPersianNumber,
45
+ onPageSizeChange,
46
+ ...otherProps
47
+ } = props;
48
+ const element = useRef<JBPaginationInfoWebComponent | null>(null);
49
+ useImperativeHandle(ref, () => element.current as JBPaginationInfoWebComponent, [element]);
50
+ useEvent(element, 'page-size-change', onPageSizeChange);
51
+
52
+ useEffect(() => {
53
+ if (element.current) {
54
+ element.current.showPersianNumber = showPersianNumber === true;
55
+ element.current.pageSize = pageSize;
56
+ element.current.pageSizes = pageSizes ?? [20, 30, 50, 100];
57
+ element.current.startItemIndex = startItemIndex;
58
+ element.current.endItemIndex = endItemIndex;
59
+ element.current.totalItemsCount = totalItemsCount;
60
+ element.current.pageItemCountTitle = pageItemCountTitle ?? "";
61
+ element.current.fromLabel = fromLabel ?? "";
62
+ element.current.currentAvailableItemTitle = currentAvailableItemTitle ?? "";
63
+ }
64
+ }, [pageSize, pageSizes, startItemIndex, endItemIndex, totalItemsCount, pageItemCountTitle, fromLabel, currentAvailableItemTitle, showPersianNumber]);
65
+
66
+ return (
67
+ <jb-pagination-info ref={element} {...otherProps}></jb-pagination-info>
68
+ );
69
+ });
70
+
71
+ JBPaginationInfo.displayName = "JBPaginationInfo";
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import 'jb-grid';
3
+ import type { JBRefreshIconAttributes, JBRefreshIconWebComponent } from './module-declaration.js';
4
+
5
+ export type RefreshIconProps = Omit<JBRefreshIconAttributes, "ref">
6
+
7
+ export const JBRefreshIcon = React.forwardRef<JBRefreshIconWebComponent | null, RefreshIconProps>((props, ref) => {
8
+ return <jb-refresh-icon ref={ref} {...props}></jb-refresh-icon>;
9
+ });
10
+
11
+ JBRefreshIcon.displayName = "JBRefreshIcon";
@@ -1,15 +1,17 @@
1
- import React, { type ForwardedRef } from 'react';
2
- import type {JBRowAttributes} from './module-declaration.js';
3
- import type { JBCellWebComponent, RowTemplate } from 'jb-grid';
4
-
5
- export type RowProps = JBRowAttributes & {
6
- ref?:ForwardedRef<JBCellWebComponent | null>,
7
- rowTemplate?:RowTemplate,
8
- isOpen?:boolean
9
- }
10
- export function JBRow(props:RowProps) {
11
- const { children, ...otherProps} = props;
12
- return (
13
- <jb-row {...otherProps}>{children}</jb-row>
14
- );
15
- }
1
+ import React from 'react';
2
+ import 'jb-grid';
3
+ import type {JBRowAttributes} from './module-declaration.js';
4
+ import type { JBRowWebComponent, RowTemplate } from 'jb-grid';
5
+
6
+ export type RowProps = Omit<JBRowAttributes, "ref" | "rowTemplate" | "isOpen"> & {
7
+ rowTemplate?:RowTemplate,
8
+ isOpen?:boolean
9
+ }
10
+ export const JBRow = React.forwardRef<JBRowWebComponent | null, RowProps>((props, ref) => {
11
+ const { children, ...otherProps} = props;
12
+ return (
13
+ <jb-row ref={ref} {...otherProps}>{children}</jb-row>
14
+ );
15
+ });
16
+
17
+ JBRow.displayName = "JBRow";
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import 'jb-grid';
3
+ import type { JBTableHeaderAttributes } from './module-declaration.js';
4
+
5
+ type TableHeaderTemplate = Array<{name: string, size?: string | number}>
6
+ type JBTableHeaderWebComponent = HTMLElement & {
7
+ headerTemplate: TableHeaderTemplate
8
+ }
9
+
10
+ export type TableHeaderProps = Omit<JBTableHeaderAttributes, "headerTemplate" | "ref"> & {
11
+ headerTemplate?: TableHeaderTemplate
12
+ }
13
+
14
+ export const JBTableHeader = React.forwardRef<JBTableHeaderWebComponent | null, TableHeaderProps>((props, ref) => {
15
+ const { children, ...otherProps } = props;
16
+ return (
17
+ <jb-table-header ref={ref} {...otherProps}>{children}</jb-table-header>
18
+ );
19
+ });
20
+
21
+ JBTableHeader.displayName = "JBTableHeader";
@@ -1,15 +1,18 @@
1
1
 
2
2
 
3
- .jb-loading{
4
- --blob-color:var(--jb-grid-loading-color, var(--jb-primary));
5
- /* Loader */
6
- .blobs {
7
- filter: url(#goo);
8
- width: 300px;
9
- height: 300px;
10
- position: relative;
11
- overflow: hidden;
12
- border-radius: 70px;
3
+ .jb-loading{
4
+ --blob-color: var(--loading-color);
5
+ width: 100%;
6
+ height: 100%;
7
+ display: block;
8
+ /* Loader */
9
+ .blobs {
10
+ filter: url(#goo);
11
+ width: 100%;
12
+ height: 100%;
13
+ position: relative;
14
+ overflow: hidden;
15
+ border-radius: 4.375rem;
13
16
  transform-style: preserve-3d;
14
17
 
15
18
  /* Blob center item */
@@ -19,8 +22,8 @@
19
22
  background: var(--blob-color);
20
23
  top: 50%;
21
24
  left: 50%;
22
- width: 30px;
23
- height: 30px;
25
+ width: 1.875rem;
26
+ height: 1.875rem;
24
27
  transform-origin: left top;
25
28
  transform: scale(.9) translate(-50%, -50%);
26
29
  animation: blob-grow
@@ -28,7 +31,7 @@
28
31
  3.4s
29
32
  infinite;
30
33
  border-radius: 50%;
31
- box-shadow: 0 -10px 40px -5px var(--blob-color);
34
+ box-shadow: 0 -0.625rem 2.5rem -5px var(--blob-color);
32
35
  }
33
36
  }
34
37
  .style-svg{
@@ -41,8 +44,8 @@
41
44
  background: var(--blob-color);
42
45
  top: 50%;
43
46
  left: 50%;
44
- width: 30px;
45
- height: 30px;
47
+ width: 1.875rem;
48
+ height: 1.875rem;
46
49
  border-radius: 50%;
47
50
  animation: blobs
48
51
  ease-out
@@ -53,16 +56,17 @@
53
56
  opacity: 0;
54
57
 
55
58
  /* Set animation delay for each of type */
56
- &:nth-child(1) { animation-delay: 0.2s; }
57
- &:nth-child(2) { animation-delay: 0.4s; }
58
- &:nth-child(3) { animation-delay: 0.6s; }
59
- &:nth-child(4) { animation-delay: 0.8s; }
60
- &:nth-child(5) { animation-delay: 1.0s; }
59
+ &:nth-child(2) { animation-delay: 0.2s; }
60
+ &:nth-child(3) { animation-delay: 0.4s; }
61
+ &:nth-child(4) { animation-delay: 0.6s; }
62
+ &:nth-child(5) { animation-delay: 0.8s; }
63
+ &:nth-child(6) { animation-delay: 1.0s; }
64
+ &:nth-child(7) { animation-delay: 1.2s; }
61
65
  }
62
66
 
63
67
  /* Keyframes variables */
64
- --left: calc(-330px - 50%);
65
- --right: calc(330px - 50%);
68
+ --left: calc(-20.625rem - 50%);
69
+ --right: calc(20.625rem - 50%);
66
70
 
67
71
 
68
72
  }
@@ -138,4 +142,4 @@
138
142
  92%, 100% {
139
143
  transform: scale(0) translate(-50%, -50%);
140
144
  }
141
- }
145
+ }
@@ -1,10 +1,10 @@
1
- @custom-media --tablet-until (max-width: 768px);
1
+ @custom-media --tablet-until (max-width: 48rem);
2
2
 
3
3
  .jb-grid-wrapper .jb-grid-content {
4
4
  .jb-grid-table-cell {
5
- padding: 4px 16px;
5
+ padding: 4px 1rem;
6
6
  overflow-x: hidden;
7
- grid-auto-rows: minmax(48px, auto);
7
+ grid-auto-rows: minmax(3rem, auto);
8
8
  align-self: center;
9
9
  display: grid;
10
10
  align-items: center;
@@ -22,12 +22,12 @@
22
22
 
23
23
 
24
24
  &.with-collapse-cell {
25
- grid-template-columns: 24px auto;
25
+ grid-template-columns: 1.5rem auto;
26
26
  }
27
27
 
28
28
  @media(--tablet-until) {
29
29
  &:first-child {
30
- box-shadow: 0px 6px 6px #dadada;
30
+ box-shadow: 0px 0.375rem 0.375rem #dadada;
31
31
  border-radius: 1rem;
32
32
  }
33
33
 
@@ -45,11 +45,11 @@
45
45
  .jb-grid-wrapper .jb-grid-content .collapse-btn {
46
46
  float: right;
47
47
  cursor: pointer;
48
- margin-left: 8px;
48
+ margin-left: 0.5rem;
49
49
  }
50
50
 
51
51
  .jb-grid-wrapper .jb-grid-content .collapse-btn svg {
52
- width: 12px;
52
+ width: 0.75rem;
53
53
  height: 100%;
54
54
  }
55
55