cx 22.1.1 → 22.1.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/dist/manifest.js +567 -567
- package/dist/ui.js +13 -9
- package/dist/widgets.css +8 -0
- package/dist/widgets.js +194 -151
- package/package.json +1 -1
- package/src/ui/FocusManager.d.ts +12 -10
- package/src/ui/FocusManager.js +9 -22
- package/src/ui/app/History.d.ts +4 -2
- package/src/ui/app/History.js +50 -51
- package/src/widgets/form/LookupField.d.ts +0 -3
- package/src/widgets/form/LookupField.js +12 -25
- package/src/widgets/grid/Grid.d.ts +3 -0
- package/src/widgets/grid/Grid.js +147 -115
- package/src/widgets/grid/Grid.scss +9 -0
- package/src/widgets/nav/MenuItem.d.ts +0 -2
- package/src/widgets/nav/MenuItem.js +8 -15
- package/src/widgets/nav/Tab.js +34 -35
- package/src/widgets/overlay/Dropdown.d.ts +3 -0
- package/src/widgets/overlay/Dropdown.js +23 -11
- package/src/widgets/overlay/Overlay.js +9 -11
- package/src/widgets/overlay/Tooltip.js +13 -10
package/src/ui/app/History.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { View } from
|
|
1
|
+
import { View } from "./../../data/View";
|
|
2
2
|
|
|
3
3
|
export class History {
|
|
4
4
|
static connect(store: View, urlBinding: string, hashBinding?: string);
|
|
@@ -11,5 +11,7 @@ export class History {
|
|
|
11
11
|
|
|
12
12
|
static reloadOnNextChange();
|
|
13
13
|
|
|
14
|
-
static addNavigateConfirmation(callback: (
|
|
14
|
+
static addNavigateConfirmation(callback: (url?: string) => boolean | Promise<boolean>, executeOnlyOnce?: boolean);
|
|
15
|
+
|
|
16
|
+
static confirm(continueCallback: () => void, state: any);
|
|
15
17
|
}
|
package/src/ui/app/History.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Url} from
|
|
2
|
-
import {batchUpdatesAndNotify} from
|
|
3
|
-
import {SubscriberList} from
|
|
1
|
+
import { Url } from "./Url";
|
|
2
|
+
import { batchUpdatesAndNotify } from "../batchUpdates";
|
|
3
|
+
import { SubscriberList } from "../../util/SubscriberList";
|
|
4
4
|
|
|
5
5
|
let last = 0,
|
|
6
6
|
next = 1,
|
|
@@ -10,16 +10,14 @@ let last = 0,
|
|
|
10
10
|
navigateConfirmationCallback = null,
|
|
11
11
|
permanentNavigateConfirmation = false;
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
export class History {
|
|
15
|
-
|
|
16
14
|
static connect(store, urlBinding, hashBinding) {
|
|
17
15
|
this.store = store;
|
|
18
16
|
this.urlBinding = urlBinding;
|
|
19
17
|
this.hashBinding = hashBinding;
|
|
20
18
|
this.updateStore();
|
|
21
19
|
window.onpopstate = () => {
|
|
22
|
-
this.updateStore()
|
|
20
|
+
this.updateStore();
|
|
23
21
|
};
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -40,24 +38,24 @@ export class History {
|
|
|
40
38
|
permanentNavigateConfirmation = permanent;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
static
|
|
44
|
-
if (!navigateConfirmationCallback)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
navigateConfirmationCallback = null;
|
|
55
|
-
this.navigate(state, title, url, replace);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
41
|
+
static confirm(continueCallback, state) {
|
|
42
|
+
if (!navigateConfirmationCallback) return continueCallback();
|
|
43
|
+
|
|
44
|
+
let result = navigateConfirmationCallback(state);
|
|
45
|
+
Promise.resolve(result).then((value) => {
|
|
46
|
+
if (value) {
|
|
47
|
+
if (!permanentNavigateConfirmation) navigateConfirmationCallback = null;
|
|
48
|
+
continueCallback();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
58
52
|
return false;
|
|
59
53
|
}
|
|
60
54
|
|
|
55
|
+
static confirmAndNavigate(state, title, url, replace) {
|
|
56
|
+
return this.confirm(() => this.navigate(state, title, url, replace), url);
|
|
57
|
+
}
|
|
58
|
+
|
|
61
59
|
static navigate(state, title, url, replace = false) {
|
|
62
60
|
url = Url.resolve(url);
|
|
63
61
|
|
|
@@ -66,50 +64,51 @@ export class History {
|
|
|
66
64
|
return true;
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
let transition,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
let transition,
|
|
68
|
+
changed = false;
|
|
69
|
+
batchUpdatesAndNotify(
|
|
70
|
+
() => {
|
|
71
|
+
changed = this.updateStore(url);
|
|
72
|
+
if (changed)
|
|
73
|
+
transitions[++last] = transition = {
|
|
74
|
+
url,
|
|
75
|
+
state,
|
|
76
|
+
title,
|
|
77
|
+
replace,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
() => {
|
|
81
|
+
if (transition) transition.completed = true;
|
|
82
|
+
|
|
83
|
+
//update history once the page is rendered and the title is set
|
|
84
|
+
while (transitions[next] && transitions[next].completed) {
|
|
85
|
+
let tr = transitions[next];
|
|
86
|
+
delete transitions[next];
|
|
87
|
+
next++;
|
|
88
|
+
let op = tr.replace ? "replaceState" : "pushState";
|
|
89
|
+
window.history[op](tr.state, tr.title, tr.url);
|
|
90
|
+
if (subscribers) subscribers.notify(tr.url, op);
|
|
78
91
|
}
|
|
79
|
-
}, () => {
|
|
80
|
-
if (transition)
|
|
81
|
-
transition.completed = true;
|
|
82
|
-
|
|
83
|
-
//update history once the page is rendered and the title is set
|
|
84
|
-
while (transitions[next] && transitions[next].completed) {
|
|
85
|
-
let tr = transitions[next];
|
|
86
|
-
delete transitions[next];
|
|
87
|
-
next++;
|
|
88
|
-
let op = tr.replace ? "replaceState" : "pushState";
|
|
89
|
-
window.history[op](tr.state, tr.title, tr.url);
|
|
90
|
-
if (subscribers)
|
|
91
|
-
subscribers.notify(tr.url, op);
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
);
|
|
94
94
|
|
|
95
95
|
return changed;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
static updateStore(href) {
|
|
99
|
-
let url = Url.unresolve(href || document.location.href),
|
|
100
|
-
|
|
99
|
+
let url = Url.unresolve(href || document.location.href),
|
|
100
|
+
hash = null;
|
|
101
|
+
let hashIndex = url.indexOf("#");
|
|
101
102
|
if (hashIndex !== -1) {
|
|
102
103
|
hash = url.substring(hashIndex);
|
|
103
104
|
url = url.substring(0, hashIndex);
|
|
104
105
|
}
|
|
105
|
-
if (this.hashBinding)
|
|
106
|
-
this.store.set(this.hashBinding, hash);
|
|
106
|
+
if (this.hashBinding) this.store.set(this.hashBinding, hash);
|
|
107
107
|
return this.store.set(this.urlBinding, url);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
static subscribe(callback) {
|
|
111
|
-
if (!subscribers)
|
|
112
|
-
|
|
113
|
-
return subscribers.subscribe(callback)
|
|
111
|
+
if (!subscribers) subscribers = new SubscriberList();
|
|
112
|
+
return subscribers.subscribe(callback);
|
|
114
113
|
}
|
|
115
114
|
}
|
|
@@ -152,9 +152,6 @@ interface LookupFieldProps extends FieldProps {
|
|
|
152
152
|
/** Number of additional items to be loaded in `infinite` mode. Default is 100. */
|
|
153
153
|
pageSize?: number;
|
|
154
154
|
|
|
155
|
-
/** The dropdown will be automatically closed if the page is scrolled a certain distance. */
|
|
156
|
-
closeDropdownOnScrollDistance?: number;
|
|
157
|
-
|
|
158
155
|
/** Set to `true` to allow quick selection of all displayed lookup items on `ctrl + a` keys combination. */
|
|
159
156
|
quickSelectAll?: boolean;
|
|
160
157
|
}
|
|
@@ -236,7 +236,6 @@ LookupField.prototype.submitOnEnterKey = false;
|
|
|
236
236
|
LookupField.prototype.submitOnDropdownEnterKey = false;
|
|
237
237
|
LookupField.prototype.pageSize = 100;
|
|
238
238
|
LookupField.prototype.infinite = false;
|
|
239
|
-
LookupField.prototype.closeDropdownOnScrollDistance = 100;
|
|
240
239
|
LookupField.prototype.quickSelectAll = false;
|
|
241
240
|
|
|
242
241
|
Localization.registerPrototype("cx/widgets/LookupField", LookupField);
|
|
@@ -371,16 +370,9 @@ class LookupComponent extends VDOM.Component {
|
|
|
371
370
|
};
|
|
372
371
|
}
|
|
373
372
|
},
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
if (!initialScreenPosition) initialScreenPosition = this.initialScreenPosition = params.parentBounds;
|
|
378
|
-
|
|
379
|
-
if (
|
|
380
|
-
Math.abs(parentBounds.top - initialScreenPosition.top) > widget.closeDropdownOnScrollDistance ||
|
|
381
|
-
Math.abs(parentBounds.left - initialScreenPosition.left) > widget.closeDropdownOnScrollDistance
|
|
382
|
-
)
|
|
383
|
-
this.closeDropdown(null, true);
|
|
373
|
+
onDismissAfterScroll: () => {
|
|
374
|
+
this.closeDropdown(null, true);
|
|
375
|
+
return false;
|
|
384
376
|
},
|
|
385
377
|
};
|
|
386
378
|
|
|
@@ -543,7 +535,6 @@ class LookupComponent extends VDOM.Component {
|
|
|
543
535
|
!data.disabled &&
|
|
544
536
|
!data.empty &&
|
|
545
537
|
(widget.alwaysShowClear || (!data.required && !this.props.multiple) || multipleEntries)
|
|
546
|
-
|
|
547
538
|
) {
|
|
548
539
|
insideButton = (
|
|
549
540
|
<div
|
|
@@ -720,15 +711,13 @@ class LookupComponent extends VDOM.Component {
|
|
|
720
711
|
let newRecords = reset ? [] : [...(records || [])];
|
|
721
712
|
let singleSelect = itemsData.length == 1;
|
|
722
713
|
let optionKey = null;
|
|
723
|
-
if (singleSelect)
|
|
724
|
-
optionKey = this.getOptionKey(itemsData[0]);
|
|
714
|
+
if (singleSelect) optionKey = this.getOptionKey(itemsData[0]);
|
|
725
715
|
|
|
726
716
|
// deselect
|
|
727
717
|
if (singleSelect && selectedKeys.find((k) => areKeysEqual(optionKey, k))) {
|
|
728
718
|
newRecords = records.filter((v) => !areKeysEqual(optionKey, this.getLocalKey({ $value: v })));
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
itemsData.forEach(itemData => {
|
|
719
|
+
} else {
|
|
720
|
+
itemsData.forEach((itemData) => {
|
|
732
721
|
let valueData = {
|
|
733
722
|
$value: {},
|
|
734
723
|
};
|
|
@@ -787,8 +776,8 @@ class LookupComponent extends VDOM.Component {
|
|
|
787
776
|
let { quickSelectAll, multiple } = this.props.instance.widget;
|
|
788
777
|
if (!quickSelectAll || !multiple) return;
|
|
789
778
|
|
|
790
|
-
let optionsToSelect = this.state.options.map(o => ({
|
|
791
|
-
$option: o
|
|
779
|
+
let optionsToSelect = this.state.options.map((o) => ({
|
|
780
|
+
$option: o,
|
|
792
781
|
}));
|
|
793
782
|
this.select(e, optionsToSelect, true);
|
|
794
783
|
e.stopPropagation();
|
|
@@ -798,7 +787,6 @@ class LookupComponent extends VDOM.Component {
|
|
|
798
787
|
default:
|
|
799
788
|
if (this.listKeyDown) this.listKeyDown(e);
|
|
800
789
|
break;
|
|
801
|
-
|
|
802
790
|
}
|
|
803
791
|
}
|
|
804
792
|
|
|
@@ -896,7 +884,6 @@ class LookupComponent extends VDOM.Component {
|
|
|
896
884
|
|
|
897
885
|
//delete results valid only while the dropdown is open
|
|
898
886
|
delete this.tmpCachedResult;
|
|
899
|
-
delete this.initialScreenPosition;
|
|
900
887
|
}
|
|
901
888
|
|
|
902
889
|
openDropdown(e) {
|
|
@@ -968,10 +955,10 @@ class LookupComponent extends VDOM.Component {
|
|
|
968
955
|
let params = !widget.infinite
|
|
969
956
|
? query
|
|
970
957
|
: {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
958
|
+
query,
|
|
959
|
+
page: 1,
|
|
960
|
+
pageSize,
|
|
961
|
+
};
|
|
975
962
|
|
|
976
963
|
if (!result) result = instance.invoke("onQuery", params, instance);
|
|
977
964
|
|
|
@@ -305,6 +305,9 @@ interface GridProps extends Cx.StyledContainerProps {
|
|
|
305
305
|
/** Set to true to enable cell editing. Please note that all editable columns should specify the editor field. */
|
|
306
306
|
cellEditable?: boolean;
|
|
307
307
|
|
|
308
|
+
/** A callback function which is executed before a cell editor is initalized. Return false from the callback to prevent the cell from going into the edit mode. */
|
|
309
|
+
onBeforeCellEdit?: (change, record) => any;
|
|
310
|
+
|
|
308
311
|
/** A callback function which is executed after a cell has been successfully edited. */
|
|
309
312
|
onCellEdited?: (change, record) => void;
|
|
310
313
|
|
package/src/widgets/grid/Grid.js
CHANGED
|
@@ -162,16 +162,16 @@ export class Grid extends Widget {
|
|
|
162
162
|
value: isDefined(c.aggregateValue)
|
|
163
163
|
? c.aggregateValue
|
|
164
164
|
: isDefined(c.value)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
? c.value
|
|
166
|
+
: c.aggregateField
|
|
167
|
+
? { bind: this.recordName + "." + c.aggregateField }
|
|
168
|
+
: null,
|
|
169
169
|
weight:
|
|
170
170
|
c.weight != null
|
|
171
171
|
? c.weight
|
|
172
172
|
: c.weightField && {
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
bind: this.recordName + "." + c.weightField,
|
|
174
|
+
},
|
|
175
175
|
type: c.aggregate,
|
|
176
176
|
};
|
|
177
177
|
}
|
|
@@ -486,6 +486,100 @@ export class Grid extends Widget {
|
|
|
486
486
|
);
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
+
renderResizer(instance, hdinst, header, colIndex, forPreviousColumn) {
|
|
490
|
+
let { widget } = instance;
|
|
491
|
+
|
|
492
|
+
let { CSS, baseClass } = widget;
|
|
493
|
+
|
|
494
|
+
let hdwidget = hdinst.widget;
|
|
495
|
+
|
|
496
|
+
let resizerClassName = "col-resizer";
|
|
497
|
+
if (forPreviousColumn) resizerClassName += "-prev-col";
|
|
498
|
+
|
|
499
|
+
return (
|
|
500
|
+
<div
|
|
501
|
+
className={CSS.element(baseClass, resizerClassName)}
|
|
502
|
+
onClick={(e) => {
|
|
503
|
+
e.stopPropagation();
|
|
504
|
+
}}
|
|
505
|
+
onMouseDown={(e) => {
|
|
506
|
+
if (e.buttons != 1) return;
|
|
507
|
+
let resizeOverlayEl = document.createElement("div");
|
|
508
|
+
let headerCell = e.target.parentElement;
|
|
509
|
+
if (forPreviousColumn) headerCell = headerCell.previousSibling;
|
|
510
|
+
|
|
511
|
+
let scrollAreaEl = headerCell.parentElement.parentElement.parentElement.parentElement;
|
|
512
|
+
let gridEl = scrollAreaEl.parentElement;
|
|
513
|
+
let initialWidth = headerCell.offsetWidth;
|
|
514
|
+
let initialPosition = getCursorPos(e);
|
|
515
|
+
resizeOverlayEl.className = CSS.element(baseClass, "resize-overlay");
|
|
516
|
+
resizeOverlayEl.style.width = `${initialWidth}px`;
|
|
517
|
+
resizeOverlayEl.style.left = `${
|
|
518
|
+
headerCell.getBoundingClientRect().left - gridEl.getBoundingClientRect().left
|
|
519
|
+
}px`;
|
|
520
|
+
gridEl.appendChild(resizeOverlayEl);
|
|
521
|
+
captureMouse2(e, {
|
|
522
|
+
onMouseMove: (e) => {
|
|
523
|
+
let cursor = getCursorPos(e);
|
|
524
|
+
let width = Math.max(30, Math.round(initialWidth + cursor.clientX - initialPosition.clientX));
|
|
525
|
+
resizeOverlayEl.style.width = `${width}px`;
|
|
526
|
+
},
|
|
527
|
+
onMouseUp: (e) => {
|
|
528
|
+
if (!resizeOverlayEl) return; //dblclick
|
|
529
|
+
let width = resizeOverlayEl.offsetWidth;
|
|
530
|
+
hdinst.assignedWidth = width;
|
|
531
|
+
gridEl.removeChild(resizeOverlayEl);
|
|
532
|
+
resizeOverlayEl = null;
|
|
533
|
+
if (widget.onColumnResize) instance.invoke("onColumnResize", { width, column: hdwidget }, hdinst);
|
|
534
|
+
header.set("width", width);
|
|
535
|
+
instance.setState({
|
|
536
|
+
dimensionsVersion: instance.state.dimensionsVersion + 1,
|
|
537
|
+
colWidth: {
|
|
538
|
+
...instance.state.colWidth,
|
|
539
|
+
[hdwidget.uniqueColumnId]: width,
|
|
540
|
+
},
|
|
541
|
+
});
|
|
542
|
+
},
|
|
543
|
+
onDblClick: () => {
|
|
544
|
+
let table = gridEl.querySelector("table");
|
|
545
|
+
let parentEl = table.parentElement;
|
|
546
|
+
let tableClone = table.cloneNode(true);
|
|
547
|
+
tableClone.childNodes.forEach((tbody) => {
|
|
548
|
+
tbody.childNodes.forEach((tr) => {
|
|
549
|
+
tr.childNodes.forEach((td, index) => {
|
|
550
|
+
if (index == colIndex) {
|
|
551
|
+
td.style.maxWidth = null;
|
|
552
|
+
td.style.minWidth = null;
|
|
553
|
+
td.style.width = "auto";
|
|
554
|
+
} else {
|
|
555
|
+
td.style.display = "none";
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
tableClone.style.position = "absolute";
|
|
561
|
+
tableClone.style.visibility = "hidden";
|
|
562
|
+
tableClone.style.top = 0;
|
|
563
|
+
tableClone.style.left = 0;
|
|
564
|
+
tableClone.style.width = "auto";
|
|
565
|
+
parentEl.appendChild(tableClone);
|
|
566
|
+
let width = tableClone.offsetWidth;
|
|
567
|
+
parentEl.removeChild(tableClone);
|
|
568
|
+
header.set("width", width);
|
|
569
|
+
instance.setState({
|
|
570
|
+
dimensionsVersion: instance.state.dimensionsVersion + 1,
|
|
571
|
+
colWidth: {
|
|
572
|
+
...instance.state.colWidth,
|
|
573
|
+
[hdwidget.uniqueColumnId]: width,
|
|
574
|
+
},
|
|
575
|
+
});
|
|
576
|
+
},
|
|
577
|
+
});
|
|
578
|
+
}}
|
|
579
|
+
/>
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
|
|
489
583
|
renderHeader(context, instance, key, fixed, fixedColumns) {
|
|
490
584
|
let { data, widget, header } = instance;
|
|
491
585
|
|
|
@@ -520,7 +614,8 @@ export class Grid extends Widget {
|
|
|
520
614
|
sortIcon,
|
|
521
615
|
tool;
|
|
522
616
|
|
|
523
|
-
let resizer = null
|
|
617
|
+
let resizer = null,
|
|
618
|
+
prevColumnResizer = null;
|
|
524
619
|
|
|
525
620
|
if (header) {
|
|
526
621
|
empty[l] = false;
|
|
@@ -578,89 +673,12 @@ export class Grid extends Widget {
|
|
|
578
673
|
}
|
|
579
674
|
|
|
580
675
|
if ((hdwidget.resizable || header.data.resizable) && header.data.colSpan < 2) {
|
|
581
|
-
resizer = (
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
onMouseDown={(e) => {
|
|
588
|
-
if (e.buttons != 1) return;
|
|
589
|
-
let resizeOverlayEl = document.createElement("div");
|
|
590
|
-
let headerCell = e.target.parentElement;
|
|
591
|
-
let scrollAreaEl = headerCell.parentElement.parentElement.parentElement.parentElement;
|
|
592
|
-
let gridEl = scrollAreaEl.parentElement;
|
|
593
|
-
let initialWidth = headerCell.offsetWidth;
|
|
594
|
-
let initialPosition = getCursorPos(e);
|
|
595
|
-
resizeOverlayEl.className = CSS.element(baseClass, "resize-overlay");
|
|
596
|
-
resizeOverlayEl.style.width = `${initialWidth}px`;
|
|
597
|
-
resizeOverlayEl.style.left = `${headerCell.getBoundingClientRect().left - gridEl.getBoundingClientRect().left
|
|
598
|
-
}px`;
|
|
599
|
-
gridEl.appendChild(resizeOverlayEl);
|
|
600
|
-
captureMouse2(e, {
|
|
601
|
-
onMouseMove: (e) => {
|
|
602
|
-
let cursor = getCursorPos(e);
|
|
603
|
-
let width = Math.max(
|
|
604
|
-
30,
|
|
605
|
-
Math.round(initialWidth + cursor.clientX - initialPosition.clientX)
|
|
606
|
-
);
|
|
607
|
-
resizeOverlayEl.style.width = `${width}px`;
|
|
608
|
-
},
|
|
609
|
-
onMouseUp: (e) => {
|
|
610
|
-
if (!resizeOverlayEl) return; //dblclick
|
|
611
|
-
let width = resizeOverlayEl.offsetWidth;
|
|
612
|
-
hdinst.assignedWidth = width;
|
|
613
|
-
gridEl.removeChild(resizeOverlayEl);
|
|
614
|
-
resizeOverlayEl = null;
|
|
615
|
-
if (widget.onColumnResize)
|
|
616
|
-
instance.invoke("onColumnResize", { width, column: hdwidget }, hdinst);
|
|
617
|
-
header.set("width", width);
|
|
618
|
-
instance.setState({
|
|
619
|
-
dimensionsVersion: instance.state.dimensionsVersion + 1,
|
|
620
|
-
colWidth: {
|
|
621
|
-
...instance.state.colWidth,
|
|
622
|
-
[hdwidget.uniqueColumnId]: width,
|
|
623
|
-
},
|
|
624
|
-
});
|
|
625
|
-
},
|
|
626
|
-
onDblClick: () => {
|
|
627
|
-
let table = gridEl.querySelector("table");
|
|
628
|
-
let parentEl = table.parentElement;
|
|
629
|
-
let tableClone = table.cloneNode(true);
|
|
630
|
-
tableClone.childNodes.forEach((tbody) => {
|
|
631
|
-
tbody.childNodes.forEach((tr) => {
|
|
632
|
-
tr.childNodes.forEach((td, index) => {
|
|
633
|
-
if (index == colIndex) {
|
|
634
|
-
td.style.maxWidth = null;
|
|
635
|
-
td.style.minWidth = null;
|
|
636
|
-
td.style.width = "auto";
|
|
637
|
-
} else {
|
|
638
|
-
td.style.display = "none";
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
});
|
|
643
|
-
tableClone.style.position = "absolute";
|
|
644
|
-
tableClone.style.visibility = "hidden";
|
|
645
|
-
tableClone.style.top = 0;
|
|
646
|
-
tableClone.style.left = 0;
|
|
647
|
-
tableClone.style.width = "auto";
|
|
648
|
-
parentEl.appendChild(tableClone);
|
|
649
|
-
let width = tableClone.offsetWidth;
|
|
650
|
-
parentEl.removeChild(tableClone);
|
|
651
|
-
header.set("width", width);
|
|
652
|
-
instance.setState({
|
|
653
|
-
dimensionsVersion: instance.state.dimensionsVersion + 1,
|
|
654
|
-
colWidth: {
|
|
655
|
-
...instance.state.colWidth,
|
|
656
|
-
[hdwidget.uniqueColumnId]: width,
|
|
657
|
-
},
|
|
658
|
-
});
|
|
659
|
-
},
|
|
660
|
-
});
|
|
661
|
-
}}
|
|
662
|
-
/>
|
|
663
|
-
);
|
|
676
|
+
resizer = this.renderResizer(instance, hdinst, header, colIndex);
|
|
677
|
+
if (colIndex > 0) {
|
|
678
|
+
let hdinstPrev = line.children[colIndex - 1];
|
|
679
|
+
let headerPrev = hdinstPrev.components[`header${l + 1}`];
|
|
680
|
+
prevColumnResizer = this.renderResizer(instance, hdinstPrev, headerPrev, colIndex, true);
|
|
681
|
+
}
|
|
664
682
|
}
|
|
665
683
|
}
|
|
666
684
|
|
|
@@ -686,6 +704,7 @@ export class Grid extends Widget {
|
|
|
686
704
|
{getContent(content)}
|
|
687
705
|
{sortIcon}
|
|
688
706
|
{tool}
|
|
707
|
+
{prevColumnResizer}
|
|
689
708
|
{resizer}
|
|
690
709
|
</th>
|
|
691
710
|
);
|
|
@@ -743,7 +762,7 @@ export class Grid extends Widget {
|
|
|
743
762
|
widget: () => <div className={CSS.element(baseClass, "col-header-drag-clone")}>{data.text}</div>,
|
|
744
763
|
},
|
|
745
764
|
},
|
|
746
|
-
() => {
|
|
765
|
+
() => {}
|
|
747
766
|
);
|
|
748
767
|
}
|
|
749
768
|
}
|
|
@@ -769,14 +788,14 @@ export class Grid extends Widget {
|
|
|
769
788
|
|
|
770
789
|
let sorters = direction
|
|
771
790
|
? [
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
791
|
+
{
|
|
792
|
+
field,
|
|
793
|
+
direction,
|
|
794
|
+
value,
|
|
795
|
+
comparer,
|
|
796
|
+
sortOptions,
|
|
797
|
+
},
|
|
798
|
+
]
|
|
780
799
|
: null;
|
|
781
800
|
|
|
782
801
|
instance.set("sorters", sorters);
|
|
@@ -1018,7 +1037,6 @@ export class Grid extends Widget {
|
|
|
1018
1037
|
)
|
|
1019
1038
|
);
|
|
1020
1039
|
|
|
1021
|
-
|
|
1022
1040
|
if (g.showHeader) {
|
|
1023
1041
|
record.vdom.push(this.renderHeader(context, instance, record.key + "-header", false, false));
|
|
1024
1042
|
if (hasFixedColumns)
|
|
@@ -1076,7 +1094,7 @@ export class Grid extends Widget {
|
|
|
1076
1094
|
instance,
|
|
1077
1095
|
record.grouping,
|
|
1078
1096
|
record.level,
|
|
1079
|
-
record.group || {
|
|
1097
|
+
record.group || { $key: "fixed-footer" },
|
|
1080
1098
|
record.key + "-footer",
|
|
1081
1099
|
record.store,
|
|
1082
1100
|
true,
|
|
@@ -1089,7 +1107,7 @@ export class Grid extends Widget {
|
|
|
1089
1107
|
instance,
|
|
1090
1108
|
record.grouping,
|
|
1091
1109
|
record.level,
|
|
1092
|
-
record.group || {
|
|
1110
|
+
record.group || { $key: "fixed-footer" },
|
|
1093
1111
|
record.key + "-footer",
|
|
1094
1112
|
record.store,
|
|
1095
1113
|
true,
|
|
@@ -1215,8 +1233,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1215
1233
|
style={
|
|
1216
1234
|
this.rowHeight > 0
|
|
1217
1235
|
? {
|
|
1218
|
-
|
|
1219
|
-
|
|
1236
|
+
height: this.rowHeight + 1,
|
|
1237
|
+
}
|
|
1220
1238
|
: null
|
|
1221
1239
|
}
|
|
1222
1240
|
>
|
|
@@ -1484,8 +1502,6 @@ class GridComponent extends VDOM.Component {
|
|
|
1484
1502
|
true
|
|
1485
1503
|
)
|
|
1486
1504
|
);
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
1505
|
}
|
|
1490
1506
|
}
|
|
1491
1507
|
}
|
|
@@ -1915,8 +1931,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1915
1931
|
};
|
|
1916
1932
|
instance.invoke("onColumnDrop", e, instance);
|
|
1917
1933
|
}
|
|
1918
|
-
}
|
|
1919
|
-
catch (err) {
|
|
1934
|
+
} catch (err) {
|
|
1920
1935
|
console.error("Grid drop operation failed. Please fix this error:", err);
|
|
1921
1936
|
}
|
|
1922
1937
|
|
|
@@ -2483,8 +2498,26 @@ class GridComponent extends VDOM.Component {
|
|
|
2483
2498
|
}
|
|
2484
2499
|
}
|
|
2485
2500
|
|
|
2486
|
-
if (futureState.cellEdit && !wasCellEditing)
|
|
2487
|
-
|
|
2501
|
+
if (futureState.cellEdit && !wasCellEditing) {
|
|
2502
|
+
let record = this.getRecordAt(futureState.cursor);
|
|
2503
|
+
let cellEditUndoData = record.data;
|
|
2504
|
+
|
|
2505
|
+
if (
|
|
2506
|
+
widget.onBeforeCellEdit &&
|
|
2507
|
+
this.props.instance.invoke(
|
|
2508
|
+
"onBeforeCellEdit",
|
|
2509
|
+
{
|
|
2510
|
+
column: visibleColumns[futureState.cursorCellIndex],
|
|
2511
|
+
data: cellEditUndoData,
|
|
2512
|
+
field: visibleColumns[futureState.cursorCellIndex].field,
|
|
2513
|
+
},
|
|
2514
|
+
record
|
|
2515
|
+
) === false
|
|
2516
|
+
)
|
|
2517
|
+
return;
|
|
2518
|
+
|
|
2519
|
+
this.cellEditUndoData = cellEditUndoData;
|
|
2520
|
+
}
|
|
2488
2521
|
|
|
2489
2522
|
this.setState(newState, () => {
|
|
2490
2523
|
if (this.state.focused && !this.state.cellEdit && wasCellEditing) FocusManager.focus(this.dom.el);
|
|
@@ -2501,7 +2534,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2501
2534
|
hscroll = true;
|
|
2502
2535
|
item =
|
|
2503
2536
|
item.firstChild.children[
|
|
2504
|
-
|
|
2537
|
+
this.state.cursorCellIndex - this.props.instance.fixedColumnCount
|
|
2505
2538
|
];
|
|
2506
2539
|
} else {
|
|
2507
2540
|
let fixedItem = this.dom.fixedTable.querySelector(`tbody[data-record-key="${record.key}"]`);
|
|
@@ -3155,7 +3188,6 @@ class AvgHeight {
|
|
|
3155
3188
|
}
|
|
3156
3189
|
}
|
|
3157
3190
|
|
|
3158
|
-
|
|
3159
3191
|
function getDragDropEvent(ev) {
|
|
3160
3192
|
return {
|
|
3161
3193
|
event: ev,
|
|
@@ -3164,7 +3196,7 @@ function getDragDropEvent(ev) {
|
|
|
3164
3196
|
source: {
|
|
3165
3197
|
width: 32,
|
|
3166
3198
|
height: 32,
|
|
3167
|
-
margin: []
|
|
3168
|
-
}
|
|
3199
|
+
margin: [],
|
|
3200
|
+
},
|
|
3169
3201
|
};
|
|
3170
|
-
}
|
|
3202
|
+
}
|
|
@@ -613,6 +613,15 @@
|
|
|
613
613
|
cursor: col-resize;
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
+
.#{$element}#{$name}-col-resizer-prev-col {
|
|
617
|
+
position: absolute;
|
|
618
|
+
left: 0;
|
|
619
|
+
top: 0;
|
|
620
|
+
bottom: 0;
|
|
621
|
+
width: 5px;
|
|
622
|
+
cursor: col-resize;
|
|
623
|
+
}
|
|
624
|
+
|
|
616
625
|
.#{$element}#{$name}-resize-overlay {
|
|
617
626
|
position: absolute;
|
|
618
627
|
display: block;
|