cx 22.5.3 → 22.6.0
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/dist/manifest.js +453 -453
- package/dist/widgets.js +32 -18
- package/package.json +1 -1
- package/src/widgets/form/LookupField.js +22 -13
- package/src/widgets/grid/Grid.js +7 -5
package/dist/widgets.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
registerKeyboardShortcut,
|
|
29
29
|
unfocusElement,
|
|
30
30
|
Culture,
|
|
31
|
+
bind,
|
|
31
32
|
enableCultureSensitiveFormatting,
|
|
32
33
|
Format,
|
|
33
34
|
ContentResolver,
|
|
@@ -129,6 +130,7 @@ import {
|
|
|
129
130
|
isSelector,
|
|
130
131
|
ReadOnlyDataView,
|
|
131
132
|
StringTemplate,
|
|
133
|
+
isAccessorChain,
|
|
132
134
|
getSelector,
|
|
133
135
|
enableFatArrowExpansion
|
|
134
136
|
} from "cx/data";
|
|
@@ -9835,19 +9837,28 @@ var LookupField = /*#__PURE__*/ (function(_Field) {
|
|
|
9835
9837
|
|
|
9836
9838
|
if (!this.bindings) {
|
|
9837
9839
|
var b = [];
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9840
|
+
|
|
9841
|
+
if (this.value) {
|
|
9842
|
+
if (isAccessorChain(this.value)) this.value = bind(this.value);
|
|
9843
|
+
if (this.value.bind)
|
|
9844
|
+
b.push({
|
|
9845
|
+
key: true,
|
|
9846
|
+
local: this.value.bind,
|
|
9847
|
+
remote: "$option." + this.optionIdField,
|
|
9848
|
+
set: this.value.set
|
|
9849
|
+
});
|
|
9850
|
+
}
|
|
9851
|
+
|
|
9852
|
+
if (this.text) {
|
|
9853
|
+
if (isAccessorChain(this.text)) this.value = bind(this.text);
|
|
9854
|
+
if (this.text.bind)
|
|
9855
|
+
b.push({
|
|
9856
|
+
local: this.text.bind,
|
|
9857
|
+
remote: "$option." + this.optionTextField,
|
|
9858
|
+
set: this.text.set
|
|
9859
|
+
});
|
|
9860
|
+
}
|
|
9861
|
+
|
|
9851
9862
|
this.bindings = b;
|
|
9852
9863
|
}
|
|
9853
9864
|
|
|
@@ -18853,7 +18864,7 @@ var GridComponent = /*#__PURE__*/ (function(_VDOM$Component) {
|
|
|
18853
18864
|
isDraggedOver: mod.over,
|
|
18854
18865
|
cursor: mod.cursor,
|
|
18855
18866
|
cursorCellIndex: index == cursor && cursorCellIndex,
|
|
18856
|
-
cellEdit: index == cursor && cursorCellIndex && cellEdit,
|
|
18867
|
+
cellEdit: index == cursor && cursorCellIndex != null && cellEdit,
|
|
18857
18868
|
shouldUpdate: row.shouldUpdate,
|
|
18858
18869
|
dimensionsVersion: dimensionsVersion,
|
|
18859
18870
|
fixed: fixed,
|
|
@@ -18939,7 +18950,7 @@ var GridComponent = /*#__PURE__*/ (function(_VDOM$Component) {
|
|
|
18939
18950
|
cursorIndex: index,
|
|
18940
18951
|
data: record.data,
|
|
18941
18952
|
cursorCellIndex: index == cursor && cursorCellIndex,
|
|
18942
|
-
cellEdit: index == cursor && cursorCellIndex && cellEdit
|
|
18953
|
+
cellEdit: index == cursor && cursorCellIndex != null && cellEdit
|
|
18943
18954
|
}
|
|
18944
18955
|
)
|
|
18945
18956
|
},
|
|
@@ -20172,8 +20183,8 @@ var GridComponent = /*#__PURE__*/ (function(_VDOM$Component) {
|
|
|
20172
20183
|
var futureState = _objectSpread2(_objectSpread2({}, _this11.state), newState);
|
|
20173
20184
|
|
|
20174
20185
|
if (!futureState.cellEdit && wasCellEditing) {
|
|
20175
|
-
//If cell editing is in progress, moving the cursor may cause that the cell editor
|
|
20176
|
-
//the blur event which may cause data loss for components which do not have reactOn=change set, e.g. NumberField.
|
|
20186
|
+
// If cell editing is in progress, moving the cursor may cause that the cell editor to unmount before
|
|
20187
|
+
// the blur event which may cause data loss for components which do not have reactOn=change set, e.g. NumberField.
|
|
20177
20188
|
unfocusElement(null, false);
|
|
20178
20189
|
|
|
20179
20190
|
var record = _this11.getRecordAt(prevState.cursor);
|
|
@@ -20183,7 +20194,7 @@ var GridComponent = /*#__PURE__*/ (function(_VDOM$Component) {
|
|
|
20183
20194
|
else {
|
|
20184
20195
|
var newData = record.store.get(widget.recordName); //record.data might be stale at this point
|
|
20185
20196
|
|
|
20186
|
-
if (widget.onCellEdited && newData != _this11.cellEditUndoData)
|
|
20197
|
+
if (widget.onCellEdited && newData != _this11.cellEditUndoData) {
|
|
20187
20198
|
_this11.props.instance.invoke(
|
|
20188
20199
|
"onCellEdited",
|
|
20189
20200
|
{
|
|
@@ -20194,6 +20205,9 @@ var GridComponent = /*#__PURE__*/ (function(_VDOM$Component) {
|
|
|
20194
20205
|
},
|
|
20195
20206
|
record
|
|
20196
20207
|
);
|
|
20208
|
+
|
|
20209
|
+
_this11.cellEditUndoData = newData;
|
|
20210
|
+
}
|
|
20197
20211
|
}
|
|
20198
20212
|
}
|
|
20199
20213
|
|
package/package.json
CHANGED
|
@@ -34,6 +34,8 @@ import { List } from "../List";
|
|
|
34
34
|
import { Selection } from "../../ui/selection/Selection";
|
|
35
35
|
import { HighlightedSearchText } from "../HighlightedSearchText";
|
|
36
36
|
import { autoFocus } from "../autoFocus";
|
|
37
|
+
import { bind } from "../../ui";
|
|
38
|
+
import { isAccessorChain } from "../../data/createAccessorModelProxy";
|
|
37
39
|
|
|
38
40
|
export class LookupField extends Field {
|
|
39
41
|
declareData() {
|
|
@@ -64,20 +66,27 @@ export class LookupField extends Field {
|
|
|
64
66
|
|
|
65
67
|
if (!this.bindings) {
|
|
66
68
|
let b = [];
|
|
67
|
-
if (this.value
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
if (this.value) {
|
|
70
|
+
if (isAccessorChain(this.value)) this.value = bind(this.value);
|
|
71
|
+
if (this.value.bind)
|
|
72
|
+
b.push({
|
|
73
|
+
key: true,
|
|
74
|
+
local: this.value.bind,
|
|
75
|
+
remote: `$option.${this.optionIdField}`,
|
|
76
|
+
set: this.value.set,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (this.text) {
|
|
81
|
+
if (isAccessorChain(this.text)) this.value = bind(this.text);
|
|
82
|
+
if (this.text.bind)
|
|
83
|
+
b.push({
|
|
84
|
+
local: this.text.bind,
|
|
85
|
+
remote: `$option.${this.optionTextField}`,
|
|
86
|
+
set: this.text.set,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
74
89
|
|
|
75
|
-
if (this.text && this.text.bind)
|
|
76
|
-
b.push({
|
|
77
|
-
local: this.text.bind,
|
|
78
|
-
remote: `$option.${this.optionTextField}`,
|
|
79
|
-
set: this.text.set,
|
|
80
|
-
});
|
|
81
90
|
this.bindings = b;
|
|
82
91
|
}
|
|
83
92
|
|
package/src/widgets/grid/Grid.js
CHANGED
|
@@ -1315,7 +1315,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1315
1315
|
isDraggedOver={mod.over}
|
|
1316
1316
|
cursor={mod.cursor}
|
|
1317
1317
|
cursorCellIndex={index == cursor && cursorCellIndex}
|
|
1318
|
-
cellEdit={index == cursor && cursorCellIndex && cellEdit}
|
|
1318
|
+
cellEdit={index == cursor && cursorCellIndex != null && cellEdit}
|
|
1319
1319
|
shouldUpdate={row.shouldUpdate}
|
|
1320
1320
|
dimensionsVersion={dimensionsVersion}
|
|
1321
1321
|
fixed={fixed}
|
|
@@ -1382,7 +1382,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1382
1382
|
cursorIndex: index,
|
|
1383
1383
|
data: record.data,
|
|
1384
1384
|
cursorCellIndex: index == cursor && cursorCellIndex,
|
|
1385
|
-
cellEdit: index == cursor && cursorCellIndex && cellEdit,
|
|
1385
|
+
cellEdit: index == cursor && cursorCellIndex != null && cellEdit,
|
|
1386
1386
|
}}
|
|
1387
1387
|
/>
|
|
1388
1388
|
);
|
|
@@ -2495,15 +2495,15 @@ class GridComponent extends VDOM.Component {
|
|
|
2495
2495
|
let futureState = { ...this.state, ...newState };
|
|
2496
2496
|
|
|
2497
2497
|
if (!futureState.cellEdit && wasCellEditing) {
|
|
2498
|
-
//If cell editing is in progress, moving the cursor may cause that the cell editor
|
|
2499
|
-
//the blur event which may cause data loss for components which do not have reactOn=change set, e.g. NumberField.
|
|
2498
|
+
// If cell editing is in progress, moving the cursor may cause that the cell editor to unmount before
|
|
2499
|
+
// the blur event which may cause data loss for components which do not have reactOn=change set, e.g. NumberField.
|
|
2500
2500
|
unfocusElement(null, false);
|
|
2501
2501
|
let record = this.getRecordAt(prevState.cursor);
|
|
2502
2502
|
if ((!this.cellEditorValid || cancelEdit) && this.cellEditUndoData)
|
|
2503
2503
|
record.store.set(widget.recordName, this.cellEditUndoData);
|
|
2504
2504
|
else {
|
|
2505
2505
|
let newData = record.store.get(widget.recordName); //record.data might be stale at this point
|
|
2506
|
-
if (widget.onCellEdited && newData != this.cellEditUndoData)
|
|
2506
|
+
if (widget.onCellEdited && newData != this.cellEditUndoData) {
|
|
2507
2507
|
this.props.instance.invoke(
|
|
2508
2508
|
"onCellEdited",
|
|
2509
2509
|
{
|
|
@@ -2514,6 +2514,8 @@ class GridComponent extends VDOM.Component {
|
|
|
2514
2514
|
},
|
|
2515
2515
|
record
|
|
2516
2516
|
);
|
|
2517
|
+
this.cellEditUndoData = newData;
|
|
2518
|
+
}
|
|
2517
2519
|
}
|
|
2518
2520
|
}
|
|
2519
2521
|
|