@etsoo/materialui 1.3.11 → 1.3.12

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,18 @@
1
+ import { DataTableProps } from "./DataTable";
2
+ import React from "react";
3
+ import { ListType1 } from "@etsoo/shared";
4
+ /**
5
+ * Culture table props
6
+ */
7
+ export type CultureDataTableProps = Omit<DataTableProps, "columns"> & {
8
+ cultures: ListType1[];
9
+ cultureLabel?: string;
10
+ editable?: boolean;
11
+ titleLabel?: string;
12
+ };
13
+ /**
14
+ * Culture DataTable
15
+ * @param props Props
16
+ * @returns Component
17
+ */
18
+ export declare function CultureDataTable(props: CultureDataTableProps): React.JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { DataTable } from "./DataTable";
2
+ import React from "react";
3
+ import { globalApp } from "./app/ReactApp";
4
+ /**
5
+ * Culture DataTable
6
+ * @param props Props
7
+ * @returns Component
8
+ */
9
+ export function CultureDataTable(props) {
10
+ // Destruct
11
+ const { cultures, cultureLabel = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("culture"), editable = true, titleLabel, ...rest } = props;
12
+ const getCultureLabel = React.useCallback((value) => { var _a, _b; return (_b = (_a = cultures.find((c) => c.id == value.id)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : `${value.value}`; }, [cultures]);
13
+ return (React.createElement(DataTable, { columns: [
14
+ {
15
+ field: "id",
16
+ headerName: cultureLabel,
17
+ valueFormatter: getCultureLabel,
18
+ width: 150,
19
+ editable: false,
20
+ sortable: false
21
+ },
22
+ {
23
+ field: "title",
24
+ headerName: titleLabel,
25
+ flex: 1,
26
+ editable,
27
+ sortable: false
28
+ }
29
+ ], ...rest }));
30
+ }
package/lib/index.d.ts CHANGED
@@ -44,6 +44,7 @@ export * from "./ComboBoxMultiple";
44
44
  export * from "./ComboBoxPro";
45
45
  export * from "./CountdownButton";
46
46
  export * from "./CountryList";
47
+ export * from "./CultureDataTable";
47
48
  export * from "./CustomFabProps";
48
49
  export * from "./DataGridEx";
49
50
  export * from "./DataGridRenderers";
package/lib/index.js CHANGED
@@ -44,6 +44,7 @@ export * from "./ComboBoxMultiple";
44
44
  export * from "./ComboBoxPro";
45
45
  export * from "./CountdownButton";
46
46
  export * from "./CountryList";
47
+ export * from "./CultureDataTable";
47
48
  export * from "./CustomFabProps";
48
49
  export * from "./DataGridEx";
49
50
  export * from "./DataGridRenderers";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "@emotion/css": "^11.11.2",
51
51
  "@emotion/react": "^11.11.1",
52
52
  "@emotion/styled": "^11.11.0",
53
- "@etsoo/appscript": "^1.4.45",
53
+ "@etsoo/appscript": "^1.4.48",
54
54
  "@etsoo/notificationbase": "^1.1.28",
55
55
  "@etsoo/react": "^1.7.8",
56
56
  "@etsoo/shared": "^1.2.12",
@@ -85,10 +85,10 @@
85
85
  "@testing-library/jest-dom": "^6.1.3",
86
86
  "@testing-library/react": "^14.0.0",
87
87
  "@types/jest": "^29.5.4",
88
- "@typescript-eslint/eslint-plugin": "^6.6.0",
89
- "@typescript-eslint/parser": "^6.6.0",
90
- "jest": "^29.6.4",
91
- "jest-environment-jsdom": "^29.6.4",
88
+ "@typescript-eslint/eslint-plugin": "^6.7.0",
89
+ "@typescript-eslint/parser": "^6.7.0",
90
+ "jest": "^29.7.0",
91
+ "jest-environment-jsdom": "^29.7.0",
92
92
  "typescript": "^5.2.2"
93
93
  }
94
94
  }
@@ -0,0 +1,60 @@
1
+ import { DataTable, DataTableProps } from "./DataTable";
2
+ import React from "react";
3
+ import { globalApp } from "./app/ReactApp";
4
+ import { ListType1 } from "@etsoo/shared";
5
+ import { GridValueFormatterParams } from "@mui/x-data-grid";
6
+
7
+ /**
8
+ * Culture table props
9
+ */
10
+ export type CultureDataTableProps = Omit<DataTableProps, "columns"> & {
11
+ cultures: ListType1[];
12
+ cultureLabel?: string;
13
+ editable?: boolean;
14
+ titleLabel?: string;
15
+ };
16
+
17
+ /**
18
+ * Culture DataTable
19
+ * @param props Props
20
+ * @returns Component
21
+ */
22
+ export function CultureDataTable(props: CultureDataTableProps) {
23
+ // Destruct
24
+ const {
25
+ cultures,
26
+ cultureLabel = globalApp?.get("culture"),
27
+ editable = true,
28
+ titleLabel,
29
+ ...rest
30
+ } = props;
31
+
32
+ const getCultureLabel = React.useCallback(
33
+ (value: GridValueFormatterParams) =>
34
+ cultures.find((c) => c.id == value.id)?.label ?? `${value.value}`,
35
+ [cultures]
36
+ );
37
+
38
+ return (
39
+ <DataTable
40
+ columns={[
41
+ {
42
+ field: "id",
43
+ headerName: cultureLabel,
44
+ valueFormatter: getCultureLabel,
45
+ width: 150,
46
+ editable: false,
47
+ sortable: false
48
+ },
49
+ {
50
+ field: "title",
51
+ headerName: titleLabel,
52
+ flex: 1,
53
+ editable,
54
+ sortable: false
55
+ }
56
+ ]}
57
+ {...rest}
58
+ />
59
+ );
60
+ }
package/src/index.ts CHANGED
@@ -48,6 +48,7 @@ export * from "./ComboBoxMultiple";
48
48
  export * from "./ComboBoxPro";
49
49
  export * from "./CountdownButton";
50
50
  export * from "./CountryList";
51
+ export * from "./CultureDataTable";
51
52
  export * from "./CustomFabProps";
52
53
  export * from "./DataGridEx";
53
54
  export * from "./DataGridRenderers";