x4js 1.4.43 → 1.4.44
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/action.d.ts +2 -2
- package/lib/action.js +2 -3
- package/lib/application.js +1 -2
- package/lib/gridview.d.ts +4 -0
- package/lib/gridview.js +41 -15
- package/lib/tools.d.ts +7 -0
- package/lib/tools.js +49 -1
- package/lib/x4.css +5 -8
- package/package.json +1 -1
- package/src/action.ts +2 -2
- package/src/application.ts +1 -3
- package/src/component.ts +1 -2
- package/src/gridview.ts +48 -18
- package/src/tools.ts +60 -0
- package/src/x4.less +5 -5
package/lib/action.d.ts
CHANGED
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
|
-
import { BasicEvent } from './x4events';
|
|
29
|
+
import { BasicEvent, EvChange } from './x4events';
|
|
30
30
|
import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component';
|
|
31
31
|
import { IconID } from "./icon";
|
|
32
|
-
import {
|
|
32
|
+
import { EventHandler } from './component';
|
|
33
33
|
export interface EvAction extends BasicEvent {
|
|
34
34
|
}
|
|
35
35
|
export declare function EvAction(source: Action): EvAction;
|
package/lib/action.js
CHANGED
|
@@ -31,7 +31,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
exports.Action = exports.EvAction = void 0;
|
|
32
32
|
const x4events_1 = require("./x4events");
|
|
33
33
|
const base_component_1 = require("./base_component");
|
|
34
|
-
const x4js_1 = require("x4js");
|
|
35
34
|
function EvAction(source) {
|
|
36
35
|
return (0, x4events_1.BasicEvent)({ source });
|
|
37
36
|
}
|
|
@@ -46,11 +45,11 @@ class Action extends base_component_1.BaseComponent {
|
|
|
46
45
|
}
|
|
47
46
|
set text(t) {
|
|
48
47
|
this.m_props.text = t;
|
|
49
|
-
this.emit("change", (0,
|
|
48
|
+
this.emit("change", (0, x4events_1.EvChange)(this));
|
|
50
49
|
}
|
|
51
50
|
set icon(i) {
|
|
52
51
|
this.m_props.icon = i;
|
|
53
|
-
this.emit("change", (0,
|
|
52
|
+
this.emit("change", (0, x4events_1.EvChange)(this));
|
|
54
53
|
}
|
|
55
54
|
fire() {
|
|
56
55
|
this.emit("run", EvAction(this));
|
package/lib/application.js
CHANGED
|
@@ -33,7 +33,6 @@ const x4dom_1 = require("./x4dom");
|
|
|
33
33
|
const base_component_1 = require("./base_component");
|
|
34
34
|
const component_1 = require("./component");
|
|
35
35
|
const settings_1 = require("./settings");
|
|
36
|
-
const x4js_1 = require("x4js");
|
|
37
36
|
const _x4_touch_time = Symbol();
|
|
38
37
|
/**
|
|
39
38
|
* Represents an x4 application, which is typically a single page app.
|
|
@@ -128,7 +127,7 @@ class Application extends base_component_1.BaseComponent {
|
|
|
128
127
|
*/
|
|
129
128
|
setMainView(root, clearBefore) {
|
|
130
129
|
const ddom = this.m_props.renderTo ?? x4dom_1.x4document.body;
|
|
131
|
-
const dest = (0,
|
|
130
|
+
const dest = (0, component_1.flyWrap)(ddom);
|
|
132
131
|
if (!this.m_props.renderTo) {
|
|
133
132
|
dest.setStyleValue('position', 'absolute');
|
|
134
133
|
}
|
package/lib/gridview.d.ts
CHANGED
package/lib/gridview.js
CHANGED
|
@@ -69,17 +69,24 @@ class ColHeader extends component_1.Component {
|
|
|
69
69
|
get sorted() {
|
|
70
70
|
return this.m_sorted;
|
|
71
71
|
}
|
|
72
|
-
set sorted(v) {
|
|
72
|
+
//set sorted( v ) {
|
|
73
|
+
// this.m_sorted = v;
|
|
74
|
+
// this.m_sens = 'dn';
|
|
75
|
+
// this.itemWithRef<Icon>( 'sorter' ).show( v );
|
|
76
|
+
//}
|
|
77
|
+
sort(v, sens) {
|
|
73
78
|
this.m_sorted = v;
|
|
74
|
-
this.m_sens =
|
|
75
|
-
this.itemWithRef('sorter')
|
|
79
|
+
this.m_sens = sens;
|
|
80
|
+
const ic = this.itemWithRef('sorter');
|
|
81
|
+
ic.icon = this.m_sens == 'up' ? 'var( --x4-icon-arrow-down )' : 'var( --x4-icon-arrow-up )';
|
|
82
|
+
ic.show(v);
|
|
76
83
|
}
|
|
77
84
|
get sens() {
|
|
78
85
|
return this.m_sens;
|
|
79
86
|
}
|
|
80
87
|
toggleSens() {
|
|
81
88
|
this.m_sens = this.m_sens == 'up' ? 'dn' : 'up';
|
|
82
|
-
this.itemWithRef('sorter').icon = this.m_sens == '
|
|
89
|
+
this.itemWithRef('sorter').icon = this.m_sens == 'up' ? 'var( --x4-icon-arrow-down )' : 'var( --x4-icon-arrow-up )';
|
|
83
90
|
}
|
|
84
91
|
}
|
|
85
92
|
/**
|
|
@@ -426,13 +433,24 @@ class GridView extends layout_1.VLayout {
|
|
|
426
433
|
/**
|
|
427
434
|
*
|
|
428
435
|
*/
|
|
429
|
-
|
|
436
|
+
sortCol(name, asc = true) {
|
|
437
|
+
const col = this.m_columns.find(c => c.id == name);
|
|
438
|
+
if (col === undefined) {
|
|
439
|
+
console.assert(false, "unknown field " + name + " in grid.sortCol");
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
this._sortCol(col, asc ? "dn" : "up");
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
*
|
|
446
|
+
*/
|
|
447
|
+
_sortCol(col, sens = "up") {
|
|
430
448
|
if (col.sortable === false) {
|
|
431
449
|
return;
|
|
432
450
|
}
|
|
433
451
|
this.m_columns.forEach((c) => {
|
|
434
452
|
if (c !== col) {
|
|
435
|
-
c.$hdr.
|
|
453
|
+
c.$hdr.sort(false, "dn");
|
|
436
454
|
}
|
|
437
455
|
});
|
|
438
456
|
const $hdr = col.$hdr;
|
|
@@ -440,7 +458,7 @@ class GridView extends layout_1.VLayout {
|
|
|
440
458
|
$hdr.toggleSens();
|
|
441
459
|
}
|
|
442
460
|
else {
|
|
443
|
-
$hdr.
|
|
461
|
+
$hdr.sort(true, sens);
|
|
444
462
|
}
|
|
445
463
|
if (this.m_dataview) {
|
|
446
464
|
this.m_dataview.sort([
|
|
@@ -852,15 +870,23 @@ class GridView extends layout_1.VLayout {
|
|
|
852
870
|
let cid = c.getData('col');
|
|
853
871
|
if (cid) {
|
|
854
872
|
let col = this.m_columns[cid];
|
|
855
|
-
let
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
873
|
+
let value = rec[col.id];
|
|
874
|
+
if (value !== undefined) {
|
|
875
|
+
if ((0, tools_1.isFunction)(value)) { // FooterRenderer
|
|
876
|
+
value(c);
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
let text;
|
|
880
|
+
const fmt = col.formatter;
|
|
881
|
+
if (fmt && fmt instanceof Function) {
|
|
882
|
+
text = fmt(value, rec);
|
|
883
|
+
}
|
|
884
|
+
else {
|
|
885
|
+
text = value;
|
|
886
|
+
}
|
|
887
|
+
c.setContent(text, false);
|
|
888
|
+
}
|
|
862
889
|
}
|
|
863
|
-
c.setContent(text, false);
|
|
864
890
|
}
|
|
865
891
|
});
|
|
866
892
|
}
|
package/lib/tools.d.ts
CHANGED
|
@@ -384,4 +384,11 @@ interface PasswordRule {
|
|
|
384
384
|
min: number;
|
|
385
385
|
}
|
|
386
386
|
export declare function generatePassword(length: number, rules?: PasswordRule[]): string;
|
|
387
|
+
/**
|
|
388
|
+
* taken from live-server
|
|
389
|
+
* https://github.com/tapio/live-server
|
|
390
|
+
* @param host
|
|
391
|
+
* @param port
|
|
392
|
+
*/
|
|
393
|
+
export declare function installHMR(host?: string, port?: string, reloadCallback?: Function): void;
|
|
387
394
|
export {};
|
package/lib/tools.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.generatePassword = exports.classNames = exports.mix = exports.crc32 = exports.Clipboard = exports.isHtmlString = exports.html = exports.HtmlString = exports.clamp = exports.getMousePos = exports.NetworkError = exports.markdownToHtml = exports.asap = exports.deferCall = exports.waitFontLoading = exports.isNumber = exports.pad = exports.isLiteralObject = exports.isFunction = exports.isArray = exports.isString = exports.downloadData = exports.calcAge = exports.formatIntlDate = exports.parseIntlDate = exports.date_calc_weeknum = exports.date_clone = exports.date_hash = exports.date_sql_utc = exports.date_to_sql = exports.date_diff = exports.date_format = exports._date_set_locale = exports.removeHtmlTags = exports.escapeHtml = exports.sprintf = exports.Rect = exports.Size = exports.Point = exports.camelCase = exports.pascalCase = exports.parseIntlFloat = exports.roundTo = exports.isTouchDevice = void 0;
|
|
31
|
+
exports.installHMR = exports.generatePassword = exports.classNames = exports.mix = exports.crc32 = exports.Clipboard = exports.isHtmlString = exports.html = exports.HtmlString = exports.clamp = exports.getMousePos = exports.NetworkError = exports.markdownToHtml = exports.asap = exports.deferCall = exports.waitFontLoading = exports.isNumber = exports.pad = exports.isLiteralObject = exports.isFunction = exports.isArray = exports.isString = exports.downloadData = exports.calcAge = exports.formatIntlDate = exports.parseIntlDate = exports.date_calc_weeknum = exports.date_clone = exports.date_hash = exports.date_sql_utc = exports.date_to_sql = exports.date_diff = exports.date_format = exports._date_set_locale = exports.removeHtmlTags = exports.escapeHtml = exports.sprintf = exports.Rect = exports.Size = exports.Point = exports.camelCase = exports.pascalCase = exports.parseIntlFloat = exports.roundTo = exports.isTouchDevice = void 0;
|
|
32
32
|
const x4dom_1 = require("./x4dom");
|
|
33
33
|
const i18n_1 = require("./i18n"); // you MUST create a file named translation.js
|
|
34
34
|
// :: ENVIRONMENT ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
@@ -1153,3 +1153,51 @@ function shuffle(str, maxlength) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
return shuffled;
|
|
1155
1155
|
}
|
|
1156
|
+
/**
|
|
1157
|
+
* taken from live-server
|
|
1158
|
+
* https://github.com/tapio/live-server
|
|
1159
|
+
* @param host
|
|
1160
|
+
* @param port
|
|
1161
|
+
*/
|
|
1162
|
+
function installHMR(host = "127.0.0.1", port = "9876", reloadCallback) {
|
|
1163
|
+
let tm;
|
|
1164
|
+
function refreshCSS() {
|
|
1165
|
+
document.body.style.visibility = "hidden";
|
|
1166
|
+
let sheets = [].slice.call(document.getElementsByTagName("link"));
|
|
1167
|
+
let head = document.getElementsByTagName("head")[0];
|
|
1168
|
+
for (let i = 0; i < sheets.length; ++i) {
|
|
1169
|
+
let elem = sheets[i];
|
|
1170
|
+
head.removeChild(elem);
|
|
1171
|
+
let rel = elem.rel;
|
|
1172
|
+
if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") {
|
|
1173
|
+
let url = elem.href.replace(/(&|\?)_cacheOverride=\d+/, '');
|
|
1174
|
+
elem.href = url + (url.indexOf('?') >= 0 ? '&' : '?') + '_cacheOverride=' + (new Date().valueOf());
|
|
1175
|
+
}
|
|
1176
|
+
head.appendChild(elem);
|
|
1177
|
+
}
|
|
1178
|
+
if (tm) {
|
|
1179
|
+
clearTimeout(tm);
|
|
1180
|
+
}
|
|
1181
|
+
tm = setTimeout(() => {
|
|
1182
|
+
document.body.style.visibility = "unset";
|
|
1183
|
+
}, 50);
|
|
1184
|
+
}
|
|
1185
|
+
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
|
1186
|
+
const address = `${protocol}${host}:${port}/ws`;
|
|
1187
|
+
const socket = new WebSocket(address);
|
|
1188
|
+
socket.onmessage = function (msg) {
|
|
1189
|
+
if (msg.data == 'reload') {
|
|
1190
|
+
if (reloadCallback) {
|
|
1191
|
+
reloadCallback();
|
|
1192
|
+
}
|
|
1193
|
+
else {
|
|
1194
|
+
window.location.reload();
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
else if (msg.data == 'refreshcss') {
|
|
1198
|
+
refreshCSS();
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
console.log('Live reload enabled.');
|
|
1202
|
+
}
|
|
1203
|
+
exports.installHMR = installHMR;
|
package/lib/x4.css
CHANGED
|
@@ -1115,17 +1115,17 @@ textarea::selection {
|
|
|
1115
1115
|
.x-spreadsheet .x-header .x-cell,
|
|
1116
1116
|
.x-grid-view .x-header .x-cell {
|
|
1117
1117
|
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
1118
|
-
height:
|
|
1118
|
+
height: 100%;
|
|
1119
|
+
display: flex;
|
|
1120
|
+
align-items: center;
|
|
1119
1121
|
}
|
|
1120
1122
|
.x-spreadsheet .x-footer .x-cell span,
|
|
1121
1123
|
.x-grid-view .x-footer .x-cell span,
|
|
1122
1124
|
.x-spreadsheet .x-header .x-cell span,
|
|
1123
1125
|
.x-grid-view .x-header .x-cell span {
|
|
1124
1126
|
min-width: 0;
|
|
1125
|
-
text-transform: uppercase;
|
|
1126
1127
|
text-overflow: ellipsis;
|
|
1127
1128
|
overflow: hidden;
|
|
1128
|
-
font-weight: bold;
|
|
1129
1129
|
}
|
|
1130
1130
|
.x-spreadsheet .x-footer .x-cell.sort,
|
|
1131
1131
|
.x-grid-view .x-footer .x-cell.sort,
|
|
@@ -1134,14 +1134,11 @@ textarea::selection {
|
|
|
1134
1134
|
height: 0.7rem;
|
|
1135
1135
|
opacity: 0.7;
|
|
1136
1136
|
}
|
|
1137
|
-
.x-spreadsheet .x-header .x-cell,
|
|
1138
|
-
.x-grid-view .x-header .x-cell {
|
|
1139
|
-
display: flex;
|
|
1140
|
-
align-items: center;
|
|
1141
|
-
}
|
|
1142
1137
|
.x-spreadsheet .x-header .x-cell span,
|
|
1143
1138
|
.x-grid-view .x-header .x-cell span {
|
|
1144
1139
|
width: unset;
|
|
1140
|
+
text-transform: uppercase;
|
|
1141
|
+
font-weight: bold;
|
|
1145
1142
|
}
|
|
1146
1143
|
.x-spreadsheet .x-header .x-cell .sort,
|
|
1147
1144
|
.x-grid-view .x-header .x-cell .sort {
|
package/package.json
CHANGED
package/src/action.ts
CHANGED
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
|
-
import { BasicEvent } from './x4events'
|
|
30
|
+
import { BasicEvent, EvChange } from './x4events'
|
|
31
31
|
import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component'
|
|
32
32
|
import { IconID } from "./icon"
|
|
33
|
-
import {
|
|
33
|
+
import { EventHandler } from './component';
|
|
34
34
|
|
|
35
35
|
//TODO: implement all
|
|
36
36
|
|
package/src/application.ts
CHANGED
|
@@ -30,11 +30,9 @@
|
|
|
30
30
|
import { x4document } from './x4dom'
|
|
31
31
|
import { EvMessage } from './x4events'
|
|
32
32
|
import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component'
|
|
33
|
-
import { Component } from './component'
|
|
33
|
+
import { Component, flyWrap } from './component'
|
|
34
34
|
import { Settings } from './settings'
|
|
35
|
-
import { deferCall } from './tools'
|
|
36
35
|
import { _tr } from './i18n'
|
|
37
|
-
import { flyWrap } from 'x4js'
|
|
38
36
|
|
|
39
37
|
const _x4_touch_time = Symbol( );
|
|
40
38
|
|
package/src/component.ts
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* create Container class
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
-
import { pascalCase, Rect, isString, isArray, Size,
|
|
36
|
+
import { pascalCase, Rect, isString, isArray, Size, isNumber, asap, HtmlString, isHtmlString, Constructor, getMousePos } from './tools';
|
|
37
37
|
import { x4document } from './x4dom';
|
|
38
38
|
|
|
39
39
|
import { Stylesheet, ComputedStyle } from './styles';
|
|
@@ -41,7 +41,6 @@ import { _tr } from './i18n';
|
|
|
41
41
|
import { BasicEvent, EventCallback } from './x4events';
|
|
42
42
|
import { BaseComponent, BaseComponentProps, BaseComponentEventMap } from './base_component';
|
|
43
43
|
import { IDOMEvents, X4ElementEventMap } from './dom_events';
|
|
44
|
-
import { IconID } from 'x4js';
|
|
45
44
|
|
|
46
45
|
export { HtmlString, isHtmlString, html } from './tools'
|
|
47
46
|
|
package/src/gridview.ts
CHANGED
|
@@ -41,7 +41,7 @@ import { Component, ContainerEventMap, EvSize, EvDblClick, CProps, flyWrap, html
|
|
|
41
41
|
import { Label } from './label'
|
|
42
42
|
import { _tr } from './i18n'
|
|
43
43
|
import * as Formatters from './formatters'
|
|
44
|
-
import { downloadData } from './tools'
|
|
44
|
+
import { downloadData, isFunction } from './tools'
|
|
45
45
|
import { DataView, DataStore, Record } from './datastore'
|
|
46
46
|
|
|
47
47
|
import { EvContextMenu, EvSelectionChange, BasicEvent, EventDisposer } from "./x4events";
|
|
@@ -134,10 +134,19 @@ class ColHeader extends Component {
|
|
|
134
134
|
return this.m_sorted;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
set sorted( v ) {
|
|
137
|
+
//set sorted( v ) {
|
|
138
|
+
// this.m_sorted = v;
|
|
139
|
+
// this.m_sens = 'dn';
|
|
140
|
+
// this.itemWithRef<Icon>( 'sorter' ).show( v );
|
|
141
|
+
//}
|
|
142
|
+
|
|
143
|
+
sort( v: boolean, sens: "up" | "dn" ) {
|
|
138
144
|
this.m_sorted = v;
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
this.m_sens = sens;
|
|
146
|
+
|
|
147
|
+
const ic = this.itemWithRef<Icon>('sorter');
|
|
148
|
+
ic.icon = this.m_sens == 'up' ? 'var( --x4-icon-arrow-down )' : 'var( --x4-icon-arrow-up )';
|
|
149
|
+
ic.show(v);
|
|
141
150
|
}
|
|
142
151
|
|
|
143
152
|
get sens( ) {
|
|
@@ -146,7 +155,7 @@ class ColHeader extends Component {
|
|
|
146
155
|
|
|
147
156
|
toggleSens( ) {
|
|
148
157
|
this.m_sens = this.m_sens=='up' ? 'dn' : 'up';
|
|
149
|
-
this.itemWithRef<Icon>( 'sorter' ).icon = this.m_sens=='
|
|
158
|
+
this.itemWithRef<Icon>( 'sorter' ).icon = this.m_sens=='up' ? 'var( --x4-icon-arrow-down )' : 'var( --x4-icon-arrow-up )';
|
|
150
159
|
}
|
|
151
160
|
}
|
|
152
161
|
|
|
@@ -588,7 +597,21 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
|
|
|
588
597
|
*
|
|
589
598
|
*/
|
|
590
599
|
|
|
591
|
-
|
|
600
|
+
sortCol( name: string, asc = true ) {
|
|
601
|
+
const col = this.m_columns.find(c => c.id==name );
|
|
602
|
+
if( col===undefined ) {
|
|
603
|
+
console.assert( false, "unknown field "+name+" in grid.sortCol" );
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
this._sortCol( col, asc ? "dn" : "up" );
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
*
|
|
612
|
+
*/
|
|
613
|
+
|
|
614
|
+
private _sortCol(col: GridColumn, sens: "up" | "dn" = "up" ) {
|
|
592
615
|
|
|
593
616
|
if (col.sortable === false) {
|
|
594
617
|
return;
|
|
@@ -596,7 +619,7 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
|
|
|
596
619
|
|
|
597
620
|
this.m_columns.forEach((c) => {
|
|
598
621
|
if (c !== col) {
|
|
599
|
-
(c as GridColumnInternal).$hdr.
|
|
622
|
+
(c as GridColumnInternal).$hdr.sort( false, "dn" );
|
|
600
623
|
}
|
|
601
624
|
});
|
|
602
625
|
|
|
@@ -606,7 +629,7 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
|
|
|
606
629
|
$hdr.toggleSens( );
|
|
607
630
|
}
|
|
608
631
|
else {
|
|
609
|
-
$hdr.
|
|
632
|
+
$hdr.sort( true, sens );
|
|
610
633
|
}
|
|
611
634
|
|
|
612
635
|
if (this.m_dataview) {
|
|
@@ -1137,17 +1160,24 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
|
|
|
1137
1160
|
if( cid ) {
|
|
1138
1161
|
let col = this.m_columns[cid];
|
|
1139
1162
|
|
|
1140
|
-
let
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1163
|
+
let value = rec[col.id];
|
|
1164
|
+
if( value!==undefined ) {
|
|
1165
|
+
if( isFunction(value) ) { // FooterRenderer
|
|
1166
|
+
value( c );
|
|
1167
|
+
}
|
|
1168
|
+
else {
|
|
1169
|
+
let text;
|
|
1170
|
+
const fmt = col.formatter;
|
|
1171
|
+
if (fmt && fmt instanceof Function) {
|
|
1172
|
+
text = fmt(value, rec);
|
|
1173
|
+
}
|
|
1174
|
+
else {
|
|
1175
|
+
text = value;
|
|
1176
|
+
}
|
|
1149
1177
|
|
|
1150
|
-
|
|
1178
|
+
c.setContent( text, false );
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1151
1181
|
}
|
|
1152
1182
|
});
|
|
1153
1183
|
}
|
package/src/tools.ts
CHANGED
|
@@ -1406,3 +1406,63 @@ function shuffle(str: string, maxlength?: number) {
|
|
|
1406
1406
|
|
|
1407
1407
|
return shuffled;
|
|
1408
1408
|
}
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* taken from live-server
|
|
1414
|
+
* https://github.com/tapio/live-server
|
|
1415
|
+
* @param host
|
|
1416
|
+
* @param port
|
|
1417
|
+
*/
|
|
1418
|
+
|
|
1419
|
+
export function installHMR(host = "127.0.0.1", port = "9876", reloadCallback?: Function ) {
|
|
1420
|
+
|
|
1421
|
+
let tm;
|
|
1422
|
+
|
|
1423
|
+
function refreshCSS() {
|
|
1424
|
+
|
|
1425
|
+
document.body.style.visibility = "hidden";
|
|
1426
|
+
|
|
1427
|
+
let sheets = [].slice.call(document.getElementsByTagName("link"));
|
|
1428
|
+
let head = document.getElementsByTagName("head")[0];
|
|
1429
|
+
|
|
1430
|
+
for (let i = 0; i < sheets.length; ++i) {
|
|
1431
|
+
let elem = sheets[i];
|
|
1432
|
+
head.removeChild(elem);
|
|
1433
|
+
|
|
1434
|
+
let rel = elem.rel;
|
|
1435
|
+
if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") {
|
|
1436
|
+
let url = elem.href.replace(/(&|\?)_cacheOverride=\d+/, '');
|
|
1437
|
+
elem.href = url + (url.indexOf('?') >= 0 ? '&' : '?') + '_cacheOverride=' + (new Date().valueOf());
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
head.appendChild(elem);
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
if( tm ) { clearTimeout(tm); }
|
|
1444
|
+
tm = setTimeout( () => {
|
|
1445
|
+
document.body.style.visibility = "unset";
|
|
1446
|
+
}, 50 );
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
|
1450
|
+
const address = `${protocol}${host}:${port}/ws`;
|
|
1451
|
+
const socket = new WebSocket(address);
|
|
1452
|
+
|
|
1453
|
+
socket.onmessage = function (msg) {
|
|
1454
|
+
if (msg.data == 'reload') {
|
|
1455
|
+
if( reloadCallback ) {
|
|
1456
|
+
reloadCallback( );
|
|
1457
|
+
}
|
|
1458
|
+
else {
|
|
1459
|
+
window.location.reload();
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
else if (msg.data == 'refreshcss') {
|
|
1463
|
+
refreshCSS();
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
|
|
1467
|
+
console.log('Live reload enabled.');
|
|
1468
|
+
}
|
package/src/x4.less
CHANGED
|
@@ -1366,14 +1366,14 @@ textarea {
|
|
|
1366
1366
|
|
|
1367
1367
|
.x-cell {
|
|
1368
1368
|
border-right: 1px solid rgba(0,0,0,0.1);
|
|
1369
|
-
height:
|
|
1369
|
+
height: 100%;
|
|
1370
|
+
display: flex;
|
|
1371
|
+
align-items: center;
|
|
1370
1372
|
|
|
1371
1373
|
span {
|
|
1372
1374
|
min-width: 0;
|
|
1373
|
-
text-transform: uppercase;
|
|
1374
1375
|
text-overflow: ellipsis;
|
|
1375
1376
|
overflow: hidden;
|
|
1376
|
-
font-weight: bold;
|
|
1377
1377
|
}
|
|
1378
1378
|
|
|
1379
1379
|
&.sort {
|
|
@@ -1385,10 +1385,10 @@ textarea {
|
|
|
1385
1385
|
|
|
1386
1386
|
.x-header {
|
|
1387
1387
|
.x-cell {
|
|
1388
|
-
display: flex;
|
|
1389
|
-
align-items: center;
|
|
1390
1388
|
span {
|
|
1391
1389
|
width: unset;
|
|
1390
|
+
text-transform: uppercase;
|
|
1391
|
+
font-weight: bold;
|
|
1392
1392
|
}
|
|
1393
1393
|
|
|
1394
1394
|
.sort {
|