@etsoo/materialui 1.4.47 → 1.4.49

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,5 +1,10 @@
1
1
  import { act, render } from "@testing-library/react";
2
- import { MUGlobal, MobileListItemRenderer, ResponsivePage } from "../src";
2
+ import {
3
+ MUGlobal,
4
+ MobileListItemRenderer,
5
+ ResponsivePage,
6
+ SearchField
7
+ } from "../src";
3
8
  import React from "react";
4
9
 
5
10
  globalThis.ResizeObserver = vi.fn().mockImplementation(() => ({
@@ -8,7 +13,13 @@ globalThis.ResizeObserver = vi.fn().mockImplementation(() => ({
8
13
  disconnect: vi.fn()
9
14
  }));
10
15
 
11
- type Data = { id: number; name: string };
16
+ type Data = {
17
+ id: number;
18
+ name: string;
19
+ deviceName?: string;
20
+ data?: string;
21
+ creation?: Date;
22
+ };
12
23
 
13
24
  // Timer mock
14
25
  // https://jestjs.io/docs/en/timer-mocks
@@ -25,11 +36,7 @@ it("Render ResponsePage", async () => {
25
36
  // Act
26
37
  render(
27
38
  <ResponsivePage<Data, typeof fieldTemplate>
28
- fields={[]}
29
- columns={[
30
- { field: "id", header: "ID" },
31
- { field: "name", header: "Name" }
32
- ]}
39
+ fields={[<SearchField label="Keyword" name="keyword" minChars={2} />]}
33
40
  height={200}
34
41
  itemSize={[118, MUGlobal.pagePaddings]}
35
42
  fieldTemplate={fieldTemplate}
@@ -40,6 +47,15 @@ it("Render ResponsePage", async () => {
40
47
  { id: id ?? 0, name: "auto" }
41
48
  ])
42
49
  }
50
+ columns={[
51
+ { field: "id", header: "ID" },
52
+ { field: "name", header: "Name" },
53
+ {
54
+ field: "deviceName",
55
+ header: "Value",
56
+ valueFormatter: ({ data }) => data?.deviceName ?? data?.name
57
+ }
58
+ ]}
43
59
  innerItemRenderer={(props) =>
44
60
  MobileListItemRenderer(props, (data) => {
45
61
  return [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "ESNext",
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
5
  "moduleResolution": "bundler",
6
6
  "allowJs": false,
7
7
  "skipLibCheck": true,
@@ -3,7 +3,7 @@ import type { SearchPageProps } from "./SearchPageProps";
3
3
  /**
4
4
  * DataGrid page props
5
5
  */
6
- export type DataGridPageProps<T extends object, F> = SearchPageProps<T, F> & Omit<DataGridExProps<T>, "loadData"> & {
6
+ export type DataGridPageProps<T extends object, F> = Omit<DataGridExProps<T>, "loadData" | "height"> & SearchPageProps<T, F> & {
7
7
  /**
8
8
  * Height will be deducted
9
9
  * @param height Current calcuated height
@@ -3,7 +3,7 @@ import type { CommonPageProps } from "./CommonPage";
3
3
  /**
4
4
  * Search page props
5
5
  */
6
- export type SearchPageProps<T extends object, F> = Omit<GridLoader<T>, "loadData"> & {
6
+ export type SearchPageProps<T extends object, F> = GridLoader<T, GridJsonData & GridTemplateType<F>> & {
7
7
  /**
8
8
  * Cache key
9
9
  */
@@ -20,10 +20,6 @@ export type SearchPageProps<T extends object, F> = Omit<GridLoader<T>, "loadData
20
20
  * Search field template
21
21
  */
22
22
  readonly fieldTemplate: F;
23
- /**
24
- * Load data callback
25
- */
26
- loadData: (data: GridJsonData & GridTemplateType<F>, lastItem?: T) => PromiseLike<T[] | null | undefined>;
27
23
  /**
28
24
  * Page props
29
25
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.4.47",
3
+ "version": "1.4.49",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -37,7 +37,7 @@
37
37
  "@emotion/styled": "^11.13.5",
38
38
  "@etsoo/appscript": "^1.5.78",
39
39
  "@etsoo/notificationbase": "^1.1.54",
40
- "@etsoo/react": "^1.8.11",
40
+ "@etsoo/react": "^1.8.13",
41
41
  "@etsoo/shared": "^1.2.55",
42
42
  "@mui/icons-material": "^6.1.10",
43
43
  "@mui/material": "^6.1.10",
@@ -4,8 +4,11 @@ import type { SearchPageProps } from "./SearchPageProps";
4
4
  /**
5
5
  * DataGrid page props
6
6
  */
7
- export type DataGridPageProps<T extends object, F> = SearchPageProps<T, F> &
8
- Omit<DataGridExProps<T>, "loadData"> & {
7
+ export type DataGridPageProps<T extends object, F> = Omit<
8
+ DataGridExProps<T>,
9
+ "loadData" | "height"
10
+ > &
11
+ SearchPageProps<T, F> & {
9
12
  /**
10
13
  * Height will be deducted
11
14
  * @param height Current calcuated height
@@ -4,9 +4,9 @@ import type { CommonPageProps } from "./CommonPage";
4
4
  /**
5
5
  * Search page props
6
6
  */
7
- export type SearchPageProps<T extends object, F> = Omit<
8
- GridLoader<T>,
9
- "loadData"
7
+ export type SearchPageProps<T extends object, F> = GridLoader<
8
+ T,
9
+ GridJsonData & GridTemplateType<F>
10
10
  > & {
11
11
  /**
12
12
  * Cache key
@@ -30,14 +30,6 @@ export type SearchPageProps<T extends object, F> = Omit<
30
30
  */
31
31
  readonly fieldTemplate: F;
32
32
 
33
- /**
34
- * Load data callback
35
- */
36
- loadData: (
37
- data: GridJsonData & GridTemplateType<F>,
38
- lastItem?: T
39
- ) => PromiseLike<T[] | null | undefined>;
40
-
41
33
  /**
42
34
  * Page props
43
35
  */
package/tsconfig.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
4
  "target": "ES2022",
5
- "module": "ESNext",
5
+ "module": "ES2022",
6
6
  "moduleResolution": "bundler",
7
7
  "allowJs": false,
8
8
  "isolatedModules": true,