x4js 1.4.43 → 1.4.46
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/button.js +4 -0
- package/lib/form.d.ts +2 -2
- package/lib/gridview.d.ts +4 -0
- package/lib/gridview.js +41 -15
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/listview.d.ts +2 -1
- package/lib/listview.js +7 -3
- package/lib/sidebarview.d.ts +2 -1
- package/lib/sidebarview.js +3 -1
- package/lib/svgcomponent.d.ts +19 -3
- package/lib/svgcomponent.js +37 -2
- package/lib/textedit.d.ts +3 -3
- package/lib/tools.d.ts +7 -0
- package/lib/tools.js +50 -2
- package/lib/treeview.js +6 -4
- package/lib/version.d.ts +1 -0
- package/lib/version.js +4 -0
- package/lib/x4.css +24 -15
- package/package.json +1 -1
- package/src/action.ts +2 -2
- package/src/application.ts +1 -3
- package/src/autocomplete.ts +196 -0
- package/src/button.ts +5 -1
- package/src/component.ts +1 -2
- package/src/form.ts +2 -2
- package/src/gridview.ts +48 -18
- package/src/index.ts +2 -0
- package/src/listview.ts +9 -3
- package/src/sidebarview.ts +5 -3
- package/src/svgcomponent.ts +55 -6
- package/src/textedit.ts +3 -3
- package/src/tools.ts +61 -1
- package/src/treeview.ts +7 -5
- package/src/version.ts +1 -0
- package/src/x4.less +28 -22
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/button.js
CHANGED
|
@@ -63,6 +63,9 @@ class BaseButton extends component_1.Component {
|
|
|
63
63
|
const ui_icon = icon ? new icon_1.Icon({ icon, cls: 'left', ref: 'l_icon' }) : null;
|
|
64
64
|
const ui_label = new label_1.Label({ flex: 1, text: text ?? '', align: props.align, ref: 'label' });
|
|
65
65
|
const ui_ricon = props.rightIcon ? new icon_1.Icon({ icon: props.rightIcon, cls: 'right', ref: 'r_icon' }) : null;
|
|
66
|
+
if (text === undefined) {
|
|
67
|
+
ui_label.addClass("@hidden");
|
|
68
|
+
}
|
|
66
69
|
this.setContent([ui_icon, ui_label, ui_ricon]);
|
|
67
70
|
this._setTabIndex(props.tabIndex);
|
|
68
71
|
}
|
|
@@ -147,6 +150,7 @@ class BaseButton extends component_1.Component {
|
|
|
147
150
|
let label = this.itemWithRef('label');
|
|
148
151
|
if (label) {
|
|
149
152
|
label.text = text;
|
|
153
|
+
label.removeClass("@hidden");
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
get text() {
|
package/lib/form.d.ts
CHANGED
|
@@ -45,13 +45,13 @@ export interface FormProps extends CProps<FormEventMap> {
|
|
|
45
45
|
/**
|
|
46
46
|
*
|
|
47
47
|
*/
|
|
48
|
-
export declare class Form extends
|
|
48
|
+
export declare class Form<T extends FormProps = FormProps, E extends FormEventMap = FormEventMap> extends VLayout<T, E> {
|
|
49
49
|
protected m_height: string | number;
|
|
50
50
|
protected m_container: Container;
|
|
51
51
|
protected m_buttons: HLayout;
|
|
52
52
|
protected m_dirty: boolean;
|
|
53
53
|
protected m_watchChanges: boolean;
|
|
54
|
-
constructor(props:
|
|
54
|
+
constructor(props: T);
|
|
55
55
|
/**
|
|
56
56
|
* returns the container object
|
|
57
57
|
*/
|
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/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/listview.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export declare class ListView extends VLayout<ListViewProps, ListViewEventMap> {
|
|
|
109
109
|
* @param items - new array of items
|
|
110
110
|
*/
|
|
111
111
|
setItems(items: ListViewItem[], keepSel?: boolean): void;
|
|
112
|
-
|
|
112
|
+
handleKey(ev: KeyboardEvent): void;
|
|
113
113
|
/** @ignore */
|
|
114
114
|
private _buildContent;
|
|
115
115
|
/**
|
|
@@ -167,6 +167,7 @@ export declare class PopupListView extends Popup<PopupListViewProps, PopupListVi
|
|
|
167
167
|
m_list: ListView;
|
|
168
168
|
constructor(props: ListViewProps);
|
|
169
169
|
set items(items: ListViewItem[]);
|
|
170
|
+
handleKey(ev: KeyboardEvent): void;
|
|
170
171
|
private _handleClick;
|
|
171
172
|
show(modal?: boolean): void;
|
|
172
173
|
hide(): void;
|
package/lib/listview.js
CHANGED
|
@@ -50,7 +50,7 @@ class ListView extends layout_1.VLayout {
|
|
|
50
50
|
m_cache; // recycling elements
|
|
51
51
|
constructor(props) {
|
|
52
52
|
super(props);
|
|
53
|
-
this.setDomEvent('keydown', (e) => this.
|
|
53
|
+
this.setDomEvent('keydown', (e) => this.handleKey(e));
|
|
54
54
|
this.setDomEvent('click', (e) => this._handleClick(e));
|
|
55
55
|
this.setDomEvent('dblclick', (e) => this._handleClick(e));
|
|
56
56
|
this.setDomEvent('contextmenu', (e) => this._handleCtxMenu(e));
|
|
@@ -110,7 +110,7 @@ class ListView extends layout_1.VLayout {
|
|
|
110
110
|
this._buildItems();
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
handleKey(ev) {
|
|
114
114
|
let moveSel = (sens) => {
|
|
115
115
|
let items;
|
|
116
116
|
if ((0, tools_1.isFunction)(this.m_props.items)) {
|
|
@@ -144,11 +144,13 @@ class ListView extends layout_1.VLayout {
|
|
|
144
144
|
switch (ev.key) {
|
|
145
145
|
case 'ArrowDown': {
|
|
146
146
|
moveSel(1);
|
|
147
|
+
ev.preventDefault();
|
|
147
148
|
ev.stopPropagation();
|
|
148
149
|
break;
|
|
149
150
|
}
|
|
150
151
|
case 'ArrowUp': {
|
|
151
152
|
moveSel(-1);
|
|
153
|
+
ev.preventDefault();
|
|
152
154
|
ev.stopPropagation();
|
|
153
155
|
break;
|
|
154
156
|
}
|
|
@@ -491,7 +493,9 @@ class PopupListView extends popup_1.Popup {
|
|
|
491
493
|
set items(items) {
|
|
492
494
|
this.m_list.items = items;
|
|
493
495
|
}
|
|
494
|
-
|
|
496
|
+
handleKey(ev) {
|
|
497
|
+
this.m_list.handleKey(ev);
|
|
498
|
+
}
|
|
495
499
|
// todo: move into popup
|
|
496
500
|
_handleClick = (e) => {
|
|
497
501
|
if (!this.dom) {
|
package/lib/sidebarview.d.ts
CHANGED
|
@@ -33,11 +33,12 @@ export interface SideBarItem extends ICardViewItem {
|
|
|
33
33
|
}
|
|
34
34
|
export interface SideBarProps extends CardViewProps {
|
|
35
35
|
bar_sizable?: boolean;
|
|
36
|
+
bar_width?: number;
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
*
|
|
39
40
|
*/
|
|
40
|
-
export declare class SideBarView extends CardView {
|
|
41
|
+
export declare class SideBarView extends CardView<SideBarProps> {
|
|
41
42
|
m_sidebar: VLayout;
|
|
42
43
|
m_content: Component;
|
|
43
44
|
constructor(props: SideBarProps);
|
package/lib/sidebarview.js
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.SideBarView = void 0;
|
|
32
|
+
const component_1 = require("./component");
|
|
32
33
|
const layout_1 = require("./layout");
|
|
33
34
|
const button_1 = require("./button");
|
|
34
35
|
const cardview_1 = require("./cardview");
|
|
@@ -43,7 +44,7 @@ class SideBarView extends cardview_1.CardView {
|
|
|
43
44
|
this.addClass('@hlayout');
|
|
44
45
|
this.m_sidebar = new layout_1.VLayout({
|
|
45
46
|
cls: '@side-bar',
|
|
46
|
-
|
|
47
|
+
width: props.bar_width ?? undefined,
|
|
47
48
|
});
|
|
48
49
|
this.m_content = new layout_1.HLayout({ flex: 1, cls: '@tab-container' });
|
|
49
50
|
}
|
|
@@ -60,6 +61,7 @@ class SideBarView extends cardview_1.CardView {
|
|
|
60
61
|
}));
|
|
61
62
|
this.setContent([
|
|
62
63
|
this.m_sidebar,
|
|
64
|
+
this.m_props.bar_sizable ? new component_1.Separator({ orientation: "horizontal", sizing: "before" }) : undefined,
|
|
63
65
|
this.m_content
|
|
64
66
|
]);
|
|
65
67
|
}
|
package/lib/svgcomponent.d.ts
CHANGED
|
@@ -76,7 +76,14 @@ declare abstract class SVGItem {
|
|
|
76
76
|
*
|
|
77
77
|
*/
|
|
78
78
|
renderStyle(): string;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
79
82
|
renderContent(): string;
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
clip(id: string): this;
|
|
80
87
|
}
|
|
81
88
|
/**
|
|
82
89
|
*
|
|
@@ -148,9 +155,9 @@ declare class SVGGradient extends SVGItem {
|
|
|
148
155
|
/**
|
|
149
156
|
*
|
|
150
157
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
constructor();
|
|
158
|
+
declare class SVGGroup extends SVGItem {
|
|
159
|
+
protected m_items: SVGItem[];
|
|
160
|
+
constructor(tag?: string);
|
|
154
161
|
path(): SVGPath;
|
|
155
162
|
text(x: any, y: any, txt: any): SVGText;
|
|
156
163
|
ellipse(x: any, y: any, r1: any, r2?: any): SVGShape;
|
|
@@ -160,6 +167,15 @@ export declare class SVGPathBuilder {
|
|
|
160
167
|
* clear
|
|
161
168
|
*/
|
|
162
169
|
clear(): void;
|
|
170
|
+
renderContent(): string;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
export declare class SVGPathBuilder extends SVGGroup {
|
|
176
|
+
private static g_clip_id;
|
|
177
|
+
constructor();
|
|
178
|
+
addClip(x: number, y: number, w: number, h: number): string;
|
|
163
179
|
render(): string;
|
|
164
180
|
}
|
|
165
181
|
/**
|
package/lib/svgcomponent.js
CHANGED
|
@@ -159,9 +159,19 @@ class SVGItem {
|
|
|
159
159
|
});
|
|
160
160
|
return result + '"';
|
|
161
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
*
|
|
164
|
+
*/
|
|
162
165
|
renderContent() {
|
|
163
166
|
return '';
|
|
164
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
*
|
|
170
|
+
*/
|
|
171
|
+
clip(id) {
|
|
172
|
+
this.attr("clip-path", `url(#${id})`);
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
165
175
|
}
|
|
166
176
|
/**
|
|
167
177
|
*
|
|
@@ -325,9 +335,10 @@ class SVGGradient extends SVGItem {
|
|
|
325
335
|
/**
|
|
326
336
|
*
|
|
327
337
|
*/
|
|
328
|
-
class
|
|
338
|
+
class SVGGroup extends SVGItem {
|
|
329
339
|
m_items;
|
|
330
|
-
constructor() {
|
|
340
|
+
constructor(tag = "g") {
|
|
341
|
+
super(tag);
|
|
331
342
|
this.m_items = [];
|
|
332
343
|
}
|
|
333
344
|
path() {
|
|
@@ -369,6 +380,30 @@ class SVGPathBuilder {
|
|
|
369
380
|
clear() {
|
|
370
381
|
this.m_items = [];
|
|
371
382
|
}
|
|
383
|
+
renderContent() {
|
|
384
|
+
let result = [];
|
|
385
|
+
this.m_items.forEach(i => {
|
|
386
|
+
result.push(i.render());
|
|
387
|
+
});
|
|
388
|
+
return result.join('\n');
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
*
|
|
393
|
+
*/
|
|
394
|
+
class SVGPathBuilder extends SVGGroup {
|
|
395
|
+
static g_clip_id = 1;
|
|
396
|
+
constructor() {
|
|
397
|
+
super('');
|
|
398
|
+
}
|
|
399
|
+
addClip(x, y, w, h) {
|
|
400
|
+
const id = 'c-' + SVGPathBuilder.g_clip_id++;
|
|
401
|
+
const clip = new SVGGroup('clipPath');
|
|
402
|
+
clip.attr('id', id);
|
|
403
|
+
clip.rect(x, y, w, h);
|
|
404
|
+
this.m_items.push(clip);
|
|
405
|
+
return id;
|
|
406
|
+
}
|
|
372
407
|
render() {
|
|
373
408
|
let result = [];
|
|
374
409
|
this.m_items.forEach(i => {
|
package/lib/textedit.d.ts
CHANGED
|
@@ -55,11 +55,11 @@ export interface TextEditProps extends InputProps<TextEditEventMap> {
|
|
|
55
55
|
/**
|
|
56
56
|
* TextEdit is a single line editor, it can have a label and an error descriptor.
|
|
57
57
|
*/
|
|
58
|
-
export declare class TextEdit<T extends TextEditProps = TextEditProps> extends Component<
|
|
58
|
+
export declare class TextEdit<T extends TextEditProps = TextEditProps, E extends TextEditEventMap = TextEditEventMap> extends Component<T, E> {
|
|
59
59
|
private m_cal_popup;
|
|
60
60
|
protected m_ui_input: Input;
|
|
61
61
|
private m_error_tip;
|
|
62
|
-
constructor(props:
|
|
62
|
+
constructor(props: T);
|
|
63
63
|
componentCreated(): void;
|
|
64
64
|
componentDisposed(): void;
|
|
65
65
|
focus(): void;
|
|
@@ -113,7 +113,7 @@ export declare class TextEdit<T extends TextEditProps = TextEditProps> extends C
|
|
|
113
113
|
* @returns
|
|
114
114
|
*/
|
|
115
115
|
validate(): boolean;
|
|
116
|
-
|
|
116
|
+
protected _validate(value: string): boolean;
|
|
117
117
|
_date_validator(value: string): string;
|
|
118
118
|
private _showDatePicker;
|
|
119
119
|
get input(): Input;
|
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 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
@@ -407,7 +407,7 @@ exports.date_clone = date_clone;
|
|
|
407
407
|
function date_calc_weeknum(date) {
|
|
408
408
|
const firstDayOfYear = new Date(date.getFullYear(), 0, 1);
|
|
409
409
|
const pastDaysOfYear = (date.valueOf() - firstDayOfYear.valueOf()) / 86400000;
|
|
410
|
-
return Math.
|
|
410
|
+
return Math.floor((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);
|
|
411
411
|
}
|
|
412
412
|
exports.date_calc_weeknum = date_calc_weeknum;
|
|
413
413
|
/**
|
|
@@ -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/treeview.js
CHANGED
|
@@ -196,10 +196,12 @@ class TreeView extends layout_1.VLayout {
|
|
|
196
196
|
let icon = node.icon;
|
|
197
197
|
if (icon === undefined) {
|
|
198
198
|
if (node.children) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
if (node.open === true) {
|
|
200
|
+
icon = 'var(--x4-icon-chevron-down)';
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
icon = 'var(--x4-icon-chevron-right)';
|
|
204
|
+
}
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
if (level >= 0) {
|
package/lib/version.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const x4js_version = "1.4";
|
package/lib/version.js
ADDED
package/lib/x4.css
CHANGED
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
--x4-default-border-color: rgba(0, 0, 0, 0.1);
|
|
50
50
|
--x4-icon-font-family: "fonteawesome";
|
|
51
51
|
--x4-icon-circle-exclamation: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM232 152C232 138.8 242.8 128 256 128s24 10.75 24 24v128c0 13.25-10.75 24-24 24S232 293.3 232 280V152zM256 400c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 385.9 273.4 400 256 400z"/></svg>';
|
|
52
|
-
--x4-icon-chevron-right: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z"/></svg>';
|
|
53
52
|
--x4-icon-arrow-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M9.375 329.4c12.51-12.51 32.76-12.49 45.25 0L128 402.8V32c0-17.69 14.31-32 32-32s32 14.31 32 32v370.8l73.38-73.38c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-128 128c-12.5 12.5-32.75 12.5-45.25 0l-128-128C-3.125 362.1-3.125 341.9 9.375 329.4z"/></svg>';
|
|
54
53
|
--x4-icon-arrow-up: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M310.6 182.6c-12.51 12.51-32.76 12.49-45.25 0L192 109.3V480c0 17.69-14.31 32-32 32s-32-14.31-32-32V109.3L54.63 182.6c-12.5 12.5-32.75 12.5-45.25 0s-12.5-32.75 0-45.25l128-128c12.5-12.5 32.75-12.5 45.25 0l128 128C323.1 149.9 323.1 170.1 310.6 182.6z"/></svg>';
|
|
55
54
|
--x4-icon-exclamation: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512" fill="currentColor"><path d="M64 352c17.69 0 32-14.32 32-31.1V64.01c0-17.67-14.31-32.01-32-32.01S32 46.34 32 64.01v255.1C32 337.7 46.31 352 64 352zM64 400c-22.09 0-40 17.91-40 40s17.91 39.1 40 39.1s40-17.9 40-39.1S86.09 400 64 400z"/></svg>';
|
|
@@ -62,6 +61,12 @@
|
|
|
62
61
|
--x4-icon-calendar-days: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z"/></svg>';
|
|
63
62
|
--x4-icon-tip: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM296 336h-16V248C280 234.8 269.3 224 256 224H224C210.8 224 200 234.8 200 248S210.8 272 224 272h8v64h-16C202.8 336 192 346.8 192 360S202.8 384 216 384h80c13.25 0 24-10.75 24-24S309.3 336 296 336zM256 192c17.67 0 32-14.33 32-32c0-17.67-14.33-32-32-32S224 142.3 224 160C224 177.7 238.3 192 256 192z"/></svg>';
|
|
64
63
|
--x4-icon-check: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M440.1 103C450.3 112.4 450.3 127.6 440.1 136.1L176.1 400.1C167.6 410.3 152.4 410.3 143 400.1L7.029 264.1C-2.343 255.6-2.343 240.4 7.029 231C16.4 221.7 31.6 221.7 40.97 231L160 350.1L407 103C416.4 93.66 431.6 93.66 440.1 103V103z"/></svg>';
|
|
64
|
+
--x4-icon-folder-closed: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M448 96h-172.1L226.7 50.75C214.7 38.74 198.5 32 181.5 32H64C28.65 32 0 60.66 0 96v320c0 35.34 28.65 64 64 64h384c35.35 0 64-28.66 64-64V160C512 124.7 483.3 96 448 96zM64 80h117.5c4.273 0 8.293 1.664 11.31 4.688L256 144h192c8.822 0 16 7.176 16 16v32h-416V96C48 87.18 55.18 80 64 80zM448 432H64c-8.822 0-16-7.176-16-16V240h416V416C464 424.8 456.8 432 448 432z"/></svg>';
|
|
65
|
+
--x4-icon-folder-opened: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><!--! Font Awesome Pro 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M572.6 270.3l-96 192C471.2 473.2 460.1 480 447.1 480H64c-35.35 0-64-28.66-64-64V96c0-35.34 28.65-64 64-64h117.5c16.97 0 33.25 6.742 45.26 18.75L275.9 96H416c35.35 0 64 28.66 64 64v32h-48V160c0-8.824-7.178-16-16-16H256L192.8 84.69C189.8 81.66 185.8 80 181.5 80H64C55.18 80 48 87.18 48 96v288l71.16-142.3C124.6 230.8 135.7 224 147.8 224h396.2C567.7 224 583.2 249 572.6 270.3z"/></svg>';
|
|
66
|
+
--x4-icon-chevron-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M432.6 209.3l-191.1 183.1C235.1 397.8 229.1 400 224 400s-11.97-2.219-16.59-6.688L15.41 209.3C5.814 200.2 5.502 184.1 14.69 175.4c9.125-9.625 24.38-9.938 33.91-.7187L224 342.8l175.4-168c9.5-9.219 24.78-8.906 33.91 .7187C442.5 184.1 442.2 200.2 432.6 209.3z"/></svg>';
|
|
67
|
+
--x4-icon-chevron-right: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z"/></svg>';
|
|
68
|
+
--x4-icon-chevron-left: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M206.7 464.6l-183.1-191.1C18.22 267.1 16 261.1 16 256s2.219-11.97 6.688-16.59l183.1-191.1c9.152-9.594 24.34-9.906 33.9-.7187c9.625 9.125 9.938 24.37 .7187 33.91L73.24 256l168 175.4c9.219 9.5 8.906 24.78-.7187 33.91C231 474.5 215.8 474.2 206.7 464.6z"/></svg>';
|
|
69
|
+
--x4-icon-chevron-up: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M15.41 302.7l191.1-183.1C212 114.2 218 111.1 224 111.1s11.97 2.219 16.59 6.688l191.1 183.1c9.594 9.152 9.906 24.34 .7187 33.9c-9.125 9.625-24.38 9.938-33.91 .7187L224 169.2l-175.4 168c-9.5 9.219-24.78 8.906-33.91-.7187C5.502 327 5.814 311.8 15.41 302.7z"/></svg>';
|
|
65
70
|
}
|
|
66
71
|
/* source: https://tailwindcss.com/docs/customizing-colors/#default-color-palette */
|
|
67
72
|
:root {
|
|
@@ -416,7 +421,7 @@ textarea::selection {
|
|
|
416
421
|
.x-combo-box {
|
|
417
422
|
display: flex;
|
|
418
423
|
align-items: center;
|
|
419
|
-
width: min-content;
|
|
424
|
+
min-width: min-content;
|
|
420
425
|
min-height: 32px;
|
|
421
426
|
padding: 0;
|
|
422
427
|
margin: 0;
|
|
@@ -1115,17 +1120,17 @@ textarea::selection {
|
|
|
1115
1120
|
.x-spreadsheet .x-header .x-cell,
|
|
1116
1121
|
.x-grid-view .x-header .x-cell {
|
|
1117
1122
|
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
1118
|
-
height:
|
|
1123
|
+
height: 100%;
|
|
1124
|
+
display: flex;
|
|
1125
|
+
align-items: center;
|
|
1119
1126
|
}
|
|
1120
1127
|
.x-spreadsheet .x-footer .x-cell span,
|
|
1121
1128
|
.x-grid-view .x-footer .x-cell span,
|
|
1122
1129
|
.x-spreadsheet .x-header .x-cell span,
|
|
1123
1130
|
.x-grid-view .x-header .x-cell span {
|
|
1124
1131
|
min-width: 0;
|
|
1125
|
-
text-transform: uppercase;
|
|
1126
1132
|
text-overflow: ellipsis;
|
|
1127
1133
|
overflow: hidden;
|
|
1128
|
-
font-weight: bold;
|
|
1129
1134
|
}
|
|
1130
1135
|
.x-spreadsheet .x-footer .x-cell.sort,
|
|
1131
1136
|
.x-grid-view .x-footer .x-cell.sort,
|
|
@@ -1134,14 +1139,11 @@ textarea::selection {
|
|
|
1134
1139
|
height: 0.7rem;
|
|
1135
1140
|
opacity: 0.7;
|
|
1136
1141
|
}
|
|
1137
|
-
.x-spreadsheet .x-header .x-cell,
|
|
1138
|
-
.x-grid-view .x-header .x-cell {
|
|
1139
|
-
display: flex;
|
|
1140
|
-
align-items: center;
|
|
1141
|
-
}
|
|
1142
1142
|
.x-spreadsheet .x-header .x-cell span,
|
|
1143
1143
|
.x-grid-view .x-header .x-cell span {
|
|
1144
1144
|
width: unset;
|
|
1145
|
+
text-transform: uppercase;
|
|
1146
|
+
font-weight: bold;
|
|
1145
1147
|
}
|
|
1146
1148
|
.x-spreadsheet .x-header .x-cell .sort,
|
|
1147
1149
|
.x-grid-view .x-header .x-cell .sort {
|
|
@@ -1622,15 +1624,22 @@ textarea::selection {
|
|
|
1622
1624
|
}
|
|
1623
1625
|
.x-tree-view .x-tree-item .tree-icon {
|
|
1624
1626
|
width: 2em;
|
|
1627
|
+
color: #999;
|
|
1628
|
+
height: 0.8em;
|
|
1629
|
+
}
|
|
1630
|
+
.x-tree-view .x-tree-item.selected {
|
|
1631
|
+
background-color: var(--x4-selection-color);
|
|
1632
|
+
color: var(--x4-selection-text);
|
|
1625
1633
|
}
|
|
1626
|
-
.x-tree-view .x-tree-item.
|
|
1627
|
-
|
|
1634
|
+
.x-tree-view .x-tree-item.selected .tree-icon {
|
|
1635
|
+
color: var(--x4-selection-text);
|
|
1628
1636
|
}
|
|
1629
1637
|
.x-tree-view .x-tree-item:hover {
|
|
1630
|
-
background-color:
|
|
1638
|
+
background-color: var(--x4-hover-color);
|
|
1639
|
+
color: var(--x4-hover-text);
|
|
1631
1640
|
}
|
|
1632
|
-
.x-tree-view .x-tree-item.
|
|
1633
|
-
|
|
1641
|
+
.x-tree-view .x-tree-item:hover .tree-icon {
|
|
1642
|
+
color: var(--x4-hover-text);
|
|
1634
1643
|
}
|
|
1635
1644
|
.x-tree-view .x-tree-item .indent {
|
|
1636
1645
|
position: absolute;
|