x4js 1.4.4 → 1.4.7

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.
Files changed (85) hide show
  1. package/lib/application.d.ts +96 -0
  2. package/lib/application.js +146 -0
  3. package/lib/base64.d.ts +31 -0
  4. package/lib/base64.js +139 -0
  5. package/lib/base_component.d.ts +64 -0
  6. package/lib/base_component.js +81 -0
  7. package/lib/button.d.ts +145 -0
  8. package/lib/button.js +241 -0
  9. package/lib/calendar.d.ts +77 -0
  10. package/lib/calendar.js +241 -0
  11. package/lib/canvas.d.ts +88 -0
  12. package/lib/canvas.js +358 -0
  13. package/lib/cardview.d.ts +83 -0
  14. package/lib/cardview.js +156 -0
  15. package/lib/checkbox.d.ts +72 -0
  16. package/lib/checkbox.js +130 -0
  17. package/lib/color.d.ts +144 -0
  18. package/lib/color.js +588 -0
  19. package/lib/colorpicker.js +86 -80
  20. package/lib/combobox.js +26 -22
  21. package/lib/component.d.ts +572 -0
  22. package/lib/component.js +1729 -0
  23. package/lib/datastore.js +29 -20
  24. package/lib/dialog.js +41 -36
  25. package/lib/dom_events.d.ts +284 -0
  26. package/lib/dom_events.js +14 -0
  27. package/lib/drag_manager.js +4 -1
  28. package/lib/drawtext.js +9 -5
  29. package/lib/fileupload.js +19 -12
  30. package/lib/form.js +29 -25
  31. package/lib/formatters.js +19 -10
  32. package/lib/gridview.js +40 -35
  33. package/lib/hosts/host.d.ts +44 -0
  34. package/lib/hosts/host.js +73 -0
  35. package/lib/i18n.d.ts +67 -0
  36. package/lib/i18n.js +175 -0
  37. package/lib/icon.d.ts +56 -0
  38. package/lib/icon.js +178 -0
  39. package/lib/image.js +7 -3
  40. package/lib/index.js +71 -55
  41. package/lib/input.d.ts +86 -0
  42. package/lib/input.js +176 -0
  43. package/lib/label.d.ts +54 -0
  44. package/lib/label.js +90 -0
  45. package/lib/layout.d.ts +77 -0
  46. package/lib/layout.js +271 -0
  47. package/lib/link.js +9 -5
  48. package/lib/listview.js +34 -27
  49. package/lib/md5.js +5 -1
  50. package/lib/menu.d.ts +122 -0
  51. package/lib/menu.js +284 -0
  52. package/lib/messagebox.js +22 -17
  53. package/lib/panel.js +13 -9
  54. package/lib/popup.d.ts +71 -0
  55. package/lib/popup.js +378 -0
  56. package/lib/property_editor.js +20 -16
  57. package/lib/radiobtn.js +13 -9
  58. package/lib/rating.js +13 -9
  59. package/lib/request.js +16 -9
  60. package/lib/router.js +5 -1
  61. package/lib/settings.d.ts +33 -0
  62. package/lib/settings.js +67 -0
  63. package/lib/sidebarview.js +12 -8
  64. package/lib/smartedit.js +16 -11
  65. package/lib/spreadsheet.js +35 -31
  66. package/lib/styles.d.ts +81 -0
  67. package/lib/styles.js +268 -0
  68. package/lib/svgcomponent.js +8 -3
  69. package/lib/tabbar.js +10 -6
  70. package/lib/tabview.js +10 -6
  71. package/lib/textarea.js +10 -6
  72. package/lib/textedit.js +39 -35
  73. package/lib/texthiliter.js +8 -4
  74. package/lib/toaster.js +8 -4
  75. package/lib/tools.d.ts +382 -0
  76. package/lib/tools.js +1142 -0
  77. package/lib/tooltips.js +14 -9
  78. package/lib/treeview.js +30 -26
  79. package/lib/x4_events.d.ts +253 -0
  80. package/lib/x4_events.js +375 -0
  81. package/package.json +1 -1
  82. package/src/application.ts +9 -4
  83. package/src/x4.less +143 -107
  84. package/tsconfig.json +1 -1
  85. package/x4.css +1541 -0
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ /**
3
+ * ___ ___ __
4
+ * \ \/ / / _
5
+ * \ / /_| |_
6
+ * / \____ _|
7
+ * /__/\__\ |_|
8
+ *
9
+ * @file checkbox.ts
10
+ * @author Etienne Cochard
11
+ * @license
12
+ * Copyright (c) 2019-2021 R-libre ingenierie
13
+ *
14
+ * This program is free software; you can redistribute it and/or modify
15
+ * it under the terms of the GNU General Public License as published by
16
+ * the Free Software Foundation; either version 3 of the License, or
17
+ * (at your option) any later version.
18
+ *
19
+ * This program is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
25
+ **/
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.CheckBox = void 0;
28
+ const component_1 = require("./component");
29
+ const x4_events_1 = require("./x4_events");
30
+ const input_1 = require("./input");
31
+ const label_1 = require("./label");
32
+ /**
33
+ * Standard CheckBox
34
+ */
35
+ class CheckBox extends component_1.Component {
36
+ constructor(props) {
37
+ super(props);
38
+ this.setDomEvent('focus', () => this._setFocus());
39
+ this.mapPropEvents(props, 'change');
40
+ }
41
+ /** @ignore */
42
+ render(props) {
43
+ // checkbox
44
+ let labelWidth = props.labelWidth ?? -1;
45
+ let uid = '__cb_' + this.uid;
46
+ this.addClass('@hlayout');
47
+ this.addClass(props.align ?? 'left');
48
+ this.setProp('tag', 'label');
49
+ this.setContent([
50
+ new input_1.Input({
51
+ ref: 'input',
52
+ type: 'checkbox',
53
+ name: props.name,
54
+ id: uid,
55
+ tabIndex: props.tabIndex,
56
+ value: props.value ?? 'on',
57
+ attrs: {
58
+ checked: props.checked ? '' : undefined
59
+ },
60
+ dom_events: {
61
+ change: this._change.bind(this),
62
+ }
63
+ }),
64
+ new label_1.Label({
65
+ text: props.text ?? '',
66
+ width: labelWidth < 0 ? undefined : labelWidth,
67
+ flex: labelWidth < 0 ? -labelWidth : undefined,
68
+ align: props.labelAlign ?? 'left',
69
+ style: {
70
+ order: props.align == 'right' ? -1 : 1,
71
+ },
72
+ attrs: {
73
+ "for": uid
74
+ }
75
+ })
76
+ ]);
77
+ }
78
+ /**
79
+ * check state changed
80
+ */
81
+ _change() {
82
+ this.emit('change', (0, x4_events_1.EvChange)(this.check));
83
+ }
84
+ /**
85
+ * focus gained/loosed
86
+ */
87
+ _setFocus() {
88
+ let input = this.itemWithRef('input');
89
+ input.focus();
90
+ }
91
+ /**
92
+ * @return the checked value
93
+ */
94
+ get check() {
95
+ if (this.dom) {
96
+ let input = this.itemWithRef('input');
97
+ let dom = input.dom;
98
+ return dom.checked;
99
+ }
100
+ return this.m_props.checked;
101
+ }
102
+ /**
103
+ * change the checked value
104
+ * @param {boolean} ck new checked value
105
+ */
106
+ set check(ck) {
107
+ if (this.dom) {
108
+ let input = this.itemWithRef('input');
109
+ const dom = input.dom;
110
+ if (dom) {
111
+ dom.checked = ck;
112
+ }
113
+ }
114
+ this.m_props.checked = ck;
115
+ //this._change(); // todo: is it needed when changed by code ? -> no
116
+ }
117
+ get text() {
118
+ return this.itemWithRef('label').text;
119
+ }
120
+ set text(text) {
121
+ this.itemWithRef('label').text = text;
122
+ }
123
+ /**
124
+ * toggle the checkbox
125
+ */
126
+ toggle() {
127
+ this.check = !this.check;
128
+ }
129
+ }
130
+ exports.CheckBox = CheckBox;
package/lib/color.d.ts ADDED
@@ -0,0 +1,144 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file color.ts
9
+ * @author Etienne Cochard
10
+ * @license
11
+ * Copyright (c) 2019-2021 R-libre ingenierie
12
+ *
13
+ * This program is free software; you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License as published by
15
+ * the Free Software Foundation; either version 3 of the License, or
16
+ * (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+ **/
25
+ export declare class Color {
26
+ private m_value;
27
+ private static custom;
28
+ /**
29
+ * @example
30
+ * ```ts
31
+ * let c = new Color( 255, 255, 255, 0.2 );
32
+ * let d = new Color( "fff" );
33
+ * let e = new Color( "css:selection-color" );
34
+ * let f = new Color( "rgba(255,0,255,0.6)" );
35
+ * ```
36
+ */
37
+ constructor();
38
+ constructor(value: number | string);
39
+ constructor(value: number | string, alpha: number);
40
+ constructor(r: number, g: number, b: number);
41
+ constructor(r: number, g: number, b: number, a: number);
42
+ /**
43
+ *
44
+ */
45
+ private _shade;
46
+ /**
47
+ * return a color darken by percent
48
+ * @param percent
49
+ */
50
+ darken(percent: number): Color;
51
+ /**
52
+ * return a color lighten by percent
53
+ * @param percent
54
+ */
55
+ lighten(percent: number): Color;
56
+ /**
57
+ * mix 2 colors
58
+ * @param {rgb} c1 - color 1
59
+ * @param {rgb} c2 - color 2
60
+ * @param {float} percent - 0.0 to 1.0
61
+ * @example
62
+ * ```js
63
+ * let clr = Color.mix( color1, color2, 0.5 );
64
+ * ```
65
+ */
66
+ static mix(c1: Color, c2: Color, p: number): Color;
67
+ /**
68
+ * split the color into it's base element r,g,b & a (!a 1-255)
69
+ */
70
+ private _split;
71
+ /**
72
+ * change the alpha value
73
+ */
74
+ fadeout(percent: number): Color;
75
+ /**
76
+ *
77
+ */
78
+ static fromHSV(h: number, s: number, v: number, a?: number): Color;
79
+ /**
80
+ *
81
+ */
82
+ static toHSV(c: Color): {
83
+ h: any;
84
+ s: number;
85
+ v: number;
86
+ a: number;
87
+ };
88
+ /**
89
+ *
90
+ */
91
+ static fromHLS(h: number, l: number, s: number): Color;
92
+ /**
93
+ *
94
+ */
95
+ static toHLS(color: Color): {
96
+ h: number;
97
+ l: number;
98
+ s: any;
99
+ };
100
+ /**
101
+ * get the red value of the color
102
+ */
103
+ red(): number;
104
+ /**
105
+ * get the green value of the color
106
+ */
107
+ green(): number;
108
+ /**
109
+ * get the blue value of the color
110
+ */
111
+ blue(): number;
112
+ /**
113
+ * get the alpha value of the color
114
+ */
115
+ alpha(): number;
116
+ /**
117
+ *
118
+ */
119
+ value(): number;
120
+ /**
121
+ * convert the color into string value
122
+ */
123
+ toString(): string;
124
+ toHex(with_alpha?: boolean): string;
125
+ static addCustomColor(name: string, value: Color): void;
126
+ static addCssColor(name: string): void;
127
+ static parse(str: string): Color;
128
+ private _getCustomColor;
129
+ static contrastColor(color: Color): Color;
130
+ /**
131
+ *
132
+ */
133
+ static WHITE: Color;
134
+ /**
135
+ *
136
+ */
137
+ static BLACK: Color;
138
+ /**
139
+ *
140
+ */
141
+ static NONE: Color;
142
+ static valueFromColorName(name: string): Color;
143
+ static fromCssVar(varName: string): string;
144
+ }