@etsoo/react 1.7.26 → 1.7.28

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,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES2019",
3
+ "target": "ES2020",
4
4
  "module": "ESNext",
5
5
  "allowJs": true,
6
6
  "skipLibCheck": true,
@@ -8,7 +8,7 @@
8
8
  "allowSyntheticDefaultImports": true,
9
9
  "strict": true,
10
10
  "forceConsistentCasingInFileNames": true,
11
- "moduleResolution": "node",
11
+ "moduleResolution": "Bundler",
12
12
  "resolveJsonModule": true,
13
13
  "isolatedModules": true,
14
14
  "noEmit": true,
@@ -54,7 +54,6 @@ export var ReactUtils;
54
54
  * @param cancelable Cancelable
55
55
  */
56
56
  function triggerChange(input, value, cancelable) {
57
- var _a;
58
57
  // Radio type not supported
59
58
  if (input.type === 'radio')
60
59
  return;
@@ -65,10 +64,10 @@ export var ReactUtils;
65
64
  // input.value = newValue will not trigger the change event
66
65
  // input type = 'hidden' will also not trigger the event
67
66
  // https://coryrylan.com/blog/trigger-input-updates-with-react-controlled-inputs
68
- var nativeInputValueSetter = (_a = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, property)) === null || _a === void 0 ? void 0 : _a.set;
67
+ var nativeInputValueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, property)?.set;
69
68
  if (checked) {
70
69
  const checkedValue = input.value == value;
71
- nativeInputValueSetter === null || nativeInputValueSetter === void 0 ? void 0 : nativeInputValueSetter.call(input, checkedValue);
70
+ nativeInputValueSetter?.call(input, checkedValue);
72
71
  const clickEvent = new Event('click', {
73
72
  bubbles: true,
74
73
  cancelable
@@ -76,7 +75,7 @@ export var ReactUtils;
76
75
  input.dispatchEvent(clickEvent);
77
76
  }
78
77
  else {
79
- nativeInputValueSetter === null || nativeInputValueSetter === void 0 ? void 0 : nativeInputValueSetter.call(input, value);
78
+ nativeInputValueSetter?.call(input, value);
80
79
  const inputEvent = new Event('change', {
81
80
  bubbles: true,
82
81
  cancelable
@@ -92,7 +91,6 @@ export var ReactUtils;
92
91
  * @param callback Callback to update refs' value, return false continue to process
93
92
  */
94
93
  function updateRefs(refs, data, callback) {
95
- var _a;
96
94
  const local = callback == null
97
95
  ? undefined
98
96
  : typeof callback === 'function'
@@ -103,7 +101,7 @@ export var ReactUtils;
103
101
  let k;
104
102
  for (k in refs) {
105
103
  const ref = refs[k];
106
- const item = ref === null || ref === void 0 ? void 0 : ref.current;
104
+ const item = ref?.current;
107
105
  if (item == null)
108
106
  continue;
109
107
  if (local && local(item, data[k]) !== false) {
@@ -116,10 +114,10 @@ export var ReactUtils;
116
114
  const isDateTime = item.type === 'datetime-local';
117
115
  if (isDateTime || item.type === 'date') {
118
116
  item.value =
119
- (_a = DateUtils.formatForInput(value, isDateTime ? false : undefined)) !== null && _a !== void 0 ? _a : '';
117
+ DateUtils.formatForInput(value, isDateTime ? false : undefined) ?? '';
120
118
  }
121
119
  else {
122
- item.value = `${value !== null && value !== void 0 ? value : ''}`;
120
+ item.value = `${value ?? ''}`;
123
121
  }
124
122
  }
125
123
  else {
@@ -149,7 +147,7 @@ export var ReactUtils;
149
147
  let k;
150
148
  for (k in refs) {
151
149
  const ref = refs[k];
152
- const item = ref === null || ref === void 0 ? void 0 : ref.current;
150
+ const item = ref?.current;
153
151
  if (item == null)
154
152
  continue;
155
153
  if (local) {
@@ -31,6 +31,6 @@ export function GridDataGetData(data, template) {
31
31
  DomUtils.clearFormData(data);
32
32
  }
33
33
  // Conditions
34
- const conditions = data == null ? {} : DomUtils.dataAs(data, template !== null && template !== void 0 ? template : {}, true); // Set keepSource to true to hold form data, even they are invisible from the conditions
34
+ const conditions = data == null ? {} : DomUtils.dataAs(data, template ?? {}, true); // Set keepSource to true to hold form data, even they are invisible from the conditions
35
35
  return conditions;
36
36
  }
@@ -149,20 +149,16 @@ export const ScrollerGrid = (props) => {
149
149
  setRows(newRows);
150
150
  },
151
151
  scrollTo(params) {
152
- var _a;
153
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollTo(params);
152
+ ref.current?.scrollTo(params);
154
153
  },
155
154
  scrollToItem(params) {
156
- var _a;
157
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollToItem(params);
155
+ ref.current?.scrollToItem(params);
158
156
  },
159
157
  scrollToRef(scrollOffset) {
160
- var _a;
161
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollTo({ scrollLeft: 0, scrollTop: scrollOffset });
158
+ ref.current?.scrollTo({ scrollLeft: 0, scrollTop: scrollOffset });
162
159
  },
163
160
  scrollToItemRef(index, align) {
164
- var _a;
165
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollToItem({ rowIndex: index, align });
161
+ ref.current?.scrollToItem({ rowIndex: index, align });
166
162
  },
167
163
  select(rowIndex) {
168
164
  // Select only one item
@@ -202,16 +198,13 @@ export const ScrollerGrid = (props) => {
202
198
  },
203
199
  reset,
204
200
  resetAfterColumnIndex(index, shouldForceUpdate) {
205
- var _a;
206
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.resetAfterColumnIndex(index, shouldForceUpdate);
201
+ ref.current?.resetAfterColumnIndex(index, shouldForceUpdate);
207
202
  },
208
203
  resetAfterIndices(params) {
209
- var _a;
210
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.resetAfterIndices(params);
204
+ ref.current?.resetAfterIndices(params);
211
205
  },
212
206
  resetAfterRowIndex(index, shouldForceUpdate) {
213
- var _a;
214
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.resetAfterRowIndex(index, shouldForceUpdate);
207
+ ref.current?.resetAfterRowIndex(index, shouldForceUpdate);
215
208
  }
216
209
  };
217
210
  React.useImperativeHandle(mRef, () => instance, [rows]);
@@ -222,8 +215,7 @@ export const ScrollerGrid = (props) => {
222
215
  }, []);
223
216
  // Force update to work with the new width and rowHeight
224
217
  React.useEffect(() => {
225
- var _a;
226
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.resetAfterIndices({
218
+ ref.current?.resetAfterIndices({
227
219
  columnIndex: 0,
228
220
  rowIndex: 0,
229
221
  shouldForceUpdate: true
@@ -186,5 +186,5 @@ export const ScrollerList = (props) => {
186
186
  loadDataLocal();
187
187
  }
188
188
  // Layout
189
- return typeof itemSize === 'function' ? (React.createElement(VariableSizeList, { height: height, width: width, itemCount: itemCount, itemKey: (index, data) => { var _a; return (_a = DataTypes.getIdValue1(data, idField)) !== null && _a !== void 0 ? _a : index; }, itemSize: itemSize, outerRef: refs, ref: listRef, style: style, onItemsRendered: onItemsRenderedLocal, ...rest }, itemRendererLocal)) : (React.createElement(FixedSizeList, { height: height, width: width, itemCount: itemCount, itemKey: (index, data) => { var _a; return (_a = DataTypes.getIdValue1(data, idField)) !== null && _a !== void 0 ? _a : index; }, itemSize: itemSize, outerRef: refs, ref: listRef, style: style, onItemsRendered: onItemsRenderedLocal, ...rest }, itemRendererLocal));
189
+ return typeof itemSize === 'function' ? (React.createElement(VariableSizeList, { height: height, width: width, itemCount: itemCount, itemKey: (index, data) => DataTypes.getIdValue1(data, idField) ?? index, itemSize: itemSize, outerRef: refs, ref: listRef, style: style, onItemsRendered: onItemsRenderedLocal, ...rest }, itemRendererLocal)) : (React.createElement(FixedSizeList, { height: height, width: width, itemCount: itemCount, itemKey: (index, data) => DataTypes.getIdValue1(data, idField) ?? index, itemSize: itemSize, outerRef: refs, ref: listRef, style: style, onItemsRendered: onItemsRenderedLocal, ...rest }, itemRendererLocal));
190
190
  };
@@ -24,7 +24,7 @@ export class CultureState {
24
24
  */
25
25
  constructor(item) {
26
26
  // Default
27
- const defaultItem = item !== null && item !== void 0 ? item : {};
27
+ const defaultItem = item ?? {};
28
28
  // Load resources
29
29
  if (item != null && typeof item.resources !== 'object')
30
30
  item.resources().then((result) => (item.resources = result));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.7.26",
3
+ "version": "1.7.28",
4
4
  "description": "TypeScript ReactJs UI Independent Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,12 +50,9 @@
50
50
  "@emotion/css": "^11.11.2",
51
51
  "@emotion/react": "^11.11.4",
52
52
  "@emotion/styled": "^11.11.0",
53
- "@etsoo/appscript": "^1.4.76",
54
- "@etsoo/notificationbase": "^1.1.35",
55
- "@etsoo/shared": "^1.2.26",
56
- "@types/react": "^18.2.60",
57
- "@types/react-dom": "^18.2.19",
58
- "@types/react-window": "^1.8.8",
53
+ "@etsoo/appscript": "^1.4.78",
54
+ "@etsoo/notificationbase": "^1.1.39",
55
+ "@etsoo/shared": "^1.2.28",
59
56
  "react": "^18.2.0",
60
57
  "react-dom": "^18.2.0",
61
58
  "react-router-dom": "^6.22.2",
@@ -70,6 +67,9 @@
70
67
  "@testing-library/jest-dom": "^6.4.2",
71
68
  "@testing-library/react": "^14.2.1",
72
69
  "@types/jest": "^29.5.12",
70
+ "@types/react": "^18.2.61",
71
+ "@types/react-dom": "^18.2.19",
72
+ "@types/react-window": "^1.8.8",
73
73
  "jest": "^29.7.0",
74
74
  "jest-environment-jsdom": "^29.7.0",
75
75
  "ts-jest": "^29.1.2",
package/tsconfig.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
- "target": "ES2019",
4
+ "target": "ES2020",
5
5
  "module": "ESNext",
6
6
  "allowJs": true,
7
- "moduleResolution": "node",
7
+ "moduleResolution": "Bundler",
8
8
  "isolatedModules": true,
9
9
  "outDir": "./lib",
10
10
  "noEmit": false,