@etsoo/materialui 1.0.1 → 1.0.4

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.
package/lib/SelectEx.d.ts CHANGED
@@ -17,6 +17,10 @@ export declare type SelectExProps<T extends object, D extends DataTypes.Keys<T>
17
17
  * Item icon renderer
18
18
  */
19
19
  itemIconRenderer?: (id: T[D]) => React.ReactNode;
20
+ /**
21
+ * Item style
22
+ */
23
+ itemStyle?: (option: T) => React.CSSProperties;
20
24
  /**
21
25
  * Label field
22
26
  */
package/lib/SelectEx.js CHANGED
@@ -12,7 +12,7 @@ import { ReactUtils } from '@etsoo/react';
12
12
  export function SelectEx(props) {
13
13
  var _a;
14
14
  // Destruct
15
- const { defaultValue, idField = 'id', itemIconRenderer, label, labelField = 'label', loadData, onItemClick, onLoadData, multiple = false, name, options = [], search = false, autoAddBlankItem = search, value, onChange, fullWidth, ...rest } = props;
15
+ const { defaultValue, idField = 'id', itemIconRenderer, itemStyle, label, labelField = 'label', loadData, onItemClick, onLoadData, multiple = false, name, options = [], search = false, autoAddBlankItem = search, value, onChange, fullWidth, ...rest } = props;
16
16
  // Options state
17
17
  const [localOptions, setOptions] = React.useState(options);
18
18
  const isMounted = React.useRef(true);
@@ -148,7 +148,9 @@ export function SelectEx(props) {
148
148
  }
149
149
  if (!multiple)
150
150
  setItemValue(id);
151
- } },
151
+ }, style: itemStyle == null
152
+ ? undefined
153
+ : itemStyle(option) },
152
154
  multiple && React.createElement(Checkbox, { checked: itemChecked(id) }),
153
155
  React.createElement(ListItemText, { primary: label }),
154
156
  itemIconRenderer && (React.createElement(ListItemRightIcon, null, itemIconRenderer(option[idField])))));
@@ -121,7 +121,7 @@ export class ReactApp extends CoreApp {
121
121
  * @param culture New culture definition
122
122
  */
123
123
  changeCulture(culture) {
124
- var _a, _b;
124
+ var _a, _b, _c;
125
125
  // Super call to update cultrue
126
126
  super.changeCulture(culture);
127
127
  // Update component labels
@@ -140,7 +140,9 @@ export class ReactApp extends CoreApp {
140
140
  // Notify host
141
141
  (_a = BridgeUtils.host) === null || _a === void 0 ? void 0 : _a.changeCulture(culture.name);
142
142
  // Document title
143
- document.title = (_b = this.get(this.name)) !== null && _b !== void 0 ? _b : this.name;
143
+ // Default is servier name's label or appName label
144
+ document.title =
145
+ (_c = (_b = this.get(this.name)) !== null && _b !== void 0 ? _b : this.get('appName')) !== null && _c !== void 0 ? _c : this.name;
144
146
  }
145
147
  /**
146
148
  * Change culture extended
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -49,17 +49,17 @@
49
49
  "@dnd-kit/core": "^6.0.5",
50
50
  "@dnd-kit/sortable": "^7.0.1",
51
51
  "@emotion/css": "^11.10.0",
52
- "@emotion/react": "^11.10.0",
53
- "@emotion/styled": "^11.10.0",
52
+ "@emotion/react": "^11.10.4",
53
+ "@emotion/styled": "^11.10.4",
54
54
  "@etsoo/appscript": "^1.2.88",
55
55
  "@etsoo/notificationbase": "^1.1.7",
56
- "@etsoo/react": "^1.5.81",
56
+ "@etsoo/react": "^1.5.86",
57
57
  "@etsoo/shared": "^1.1.51",
58
- "@mui/icons-material": "^5.10.2",
59
- "@mui/material": "^5.10.2",
58
+ "@mui/icons-material": "^5.10.3",
59
+ "@mui/material": "^5.10.3",
60
60
  "@types/pica": "^9.0.1",
61
61
  "@types/pulltorefreshjs": "^0.1.5",
62
- "@types/react": "^18.0.17",
62
+ "@types/react": "^18.0.18",
63
63
  "@types/react-avatar-editor": "^13.0.0",
64
64
  "@types/react-dom": "^18.0.6",
65
65
  "@types/react-input-mask": "^3.0.1",
@@ -82,9 +82,9 @@
82
82
  "@babel/runtime-corejs3": "^7.18.9",
83
83
  "@testing-library/jest-dom": "^5.16.5",
84
84
  "@testing-library/react": "^13.3.0",
85
- "@types/jest": "^28.1.8",
86
- "@typescript-eslint/eslint-plugin": "^5.35.1",
87
- "@typescript-eslint/parser": "^5.35.1",
85
+ "@types/jest": "^29.0.0",
86
+ "@typescript-eslint/eslint-plugin": "^5.36.1",
87
+ "@typescript-eslint/parser": "^5.36.1",
88
88
  "eslint": "^8.23.0",
89
89
  "eslint-config-airbnb-base": "^15.0.0",
90
90
  "eslint-plugin-import": "^2.26.0",
package/src/SelectEx.tsx CHANGED
@@ -44,6 +44,11 @@ export type SelectExProps<
44
44
  */
45
45
  itemIconRenderer?: (id: T[D]) => React.ReactNode;
46
46
 
47
+ /**
48
+ * Item style
49
+ */
50
+ itemStyle?: (option: T) => React.CSSProperties;
51
+
47
52
  /**
48
53
  * Label field
49
54
  */
@@ -90,6 +95,7 @@ export function SelectEx<
90
95
  defaultValue,
91
96
  idField = 'id' as D,
92
97
  itemIconRenderer,
98
+ itemStyle,
93
99
  label,
94
100
  labelField = 'label' as L,
95
101
  loadData,
@@ -273,6 +279,11 @@ export function SelectEx<
273
279
  }
274
280
  if (!multiple) setItemValue(id);
275
281
  }}
282
+ style={
283
+ itemStyle == null
284
+ ? undefined
285
+ : itemStyle(option)
286
+ }
276
287
  >
277
288
  {multiple && <Checkbox checked={itemChecked(id)} />}
278
289
  <ListItemText primary={label} />
@@ -309,7 +309,9 @@ export class ReactApp<
309
309
  BridgeUtils.host?.changeCulture(culture.name);
310
310
 
311
311
  // Document title
312
- document.title = this.get(this.name) ?? this.name;
312
+ // Default is servier name's label or appName label
313
+ document.title =
314
+ this.get(this.name) ?? this.get('appName') ?? this.name;
313
315
  }
314
316
 
315
317
  /**