@etsoo/materialui 1.4.48 → 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; value?: 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,16 +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
- {
33
- field: "value",
34
- header: "Value",
35
- valueFormatter: ({ data }) => data?.value ?? data?.name
36
- }
37
- ]}
39
+ fields={[<SearchField label="Keyword" name="keyword" minChars={2} />]}
38
40
  height={200}
39
41
  itemSize={[118, MUGlobal.pagePaddings]}
40
42
  fieldTemplate={fieldTemplate}
@@ -45,6 +47,15 @@ it("Render ResponsePage", async () => {
45
47
  { id: id ?? 0, name: "auto" }
46
48
  ])
47
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
+ ]}
48
59
  innerItemRenderer={(props) =>
49
60
  MobileListItemRenderer(props, (data) => {
50
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,
@@ -2,9 +2,8 @@ import type { DataGridExProps } from "../DataGridEx";
2
2
  import type { SearchPageProps } from "./SearchPageProps";
3
3
  /**
4
4
  * DataGrid page props
5
- * Change it to interface extends can find the conflicts quickly
6
5
  */
7
- export type DataGridPageProps<T extends object, F> = SearchPageProps<T, F> & Omit<DataGridExProps<T>, "loadData" | "cacheKey" | "cacheMinutes" | "height"> & {
6
+ export type DataGridPageProps<T extends object, F> = Omit<DataGridExProps<T>, "loadData" | "height"> & SearchPageProps<T, F> & {
8
7
  /**
9
8
  * Height will be deducted
10
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.48",
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",
@@ -3,13 +3,12 @@ import type { SearchPageProps } from "./SearchPageProps";
3
3
 
4
4
  /**
5
5
  * DataGrid page props
6
- * Change it to interface extends can find the conflicts quickly
7
6
  */
8
- export type DataGridPageProps<T extends object, F> = SearchPageProps<T, F> &
9
- Omit<
10
- DataGridExProps<T>,
11
- "loadData" | "cacheKey" | "cacheMinutes" | "height"
12
- > & {
7
+ export type DataGridPageProps<T extends object, F> = Omit<
8
+ DataGridExProps<T>,
9
+ "loadData" | "height"
10
+ > &
11
+ SearchPageProps<T, F> & {
13
12
  /**
14
13
  * Height will be deducted
15
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,