x4js 1.4.49 → 1.4.50
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/autocomplete.js +2 -1
- package/lib/base_component.d.ts +1 -0
- package/lib/button.js +1 -1
- package/lib/checkbox.js +1 -1
- package/lib/component.d.ts +17 -5
- package/lib/component.js +19 -6
- package/lib/dom_events.d.ts +2 -0
- package/lib/form.js +1 -1
- package/lib/gridview.js +3 -3
- package/lib/input.js +1 -1
- package/lib/label.js +1 -1
- package/lib/layout.js +1 -1
- package/lib/link.js +1 -1
- package/lib/menu.js +1 -1
- package/lib/radiobtn.js +1 -1
- package/lib/svgcomponent.js +1 -2
- package/lib/textarea.js +2 -2
- package/lib/textedit.js +1 -1
- package/lib/x4.css +4 -2
- package/package.json +1 -1
- package/src/autocomplete.ts +2 -1
- package/src/base_component.ts +1 -0
- package/src/button.ts +1 -1
- package/src/checkbox.ts +2 -2
- package/src/component.ts +16 -4
- package/src/dom_events.ts +2 -0
- package/src/form.ts +1 -1
- package/src/gridview.ts +3 -3
- package/src/input.ts +1 -1
- package/src/label.ts +1 -1
- package/src/layout.ts +1 -1
- package/src/link.ts +1 -1
- package/src/menu.ts +24 -24
- package/src/radiobtn.ts +2 -2
- package/src/svgcomponent.ts +1 -2
- package/src/textarea.ts +2 -2
- package/src/textedit.ts +1 -1
- package/src/x4.less +5 -2
package/lib/autocomplete.js
CHANGED
|
@@ -103,6 +103,7 @@ class AutoComplete extends textedit_1.TextEdit {
|
|
|
103
103
|
this.value = e.selection.id;
|
|
104
104
|
if (!this.m_lockpop) {
|
|
105
105
|
this._hidePopup();
|
|
106
|
+
this.focus();
|
|
106
107
|
}
|
|
107
108
|
},
|
|
108
109
|
style: {
|
|
@@ -130,7 +131,7 @@ class AutoComplete extends textedit_1.TextEdit {
|
|
|
130
131
|
}
|
|
131
132
|
_checkFocus() {
|
|
132
133
|
const focus = document.activeElement;
|
|
133
|
-
if (this.dom.contains(focus)) {
|
|
134
|
+
if (this.dom && this.dom.contains(focus)) {
|
|
134
135
|
return;
|
|
135
136
|
}
|
|
136
137
|
if (this.m_popup && this.m_popup.dom && this.m_popup.dom.contains(focus)) {
|
package/lib/base_component.d.ts
CHANGED
package/lib/button.js
CHANGED
|
@@ -41,7 +41,7 @@ const tools_1 = require("./tools");
|
|
|
41
41
|
class BaseButton extends component_1.Component {
|
|
42
42
|
constructor(props) {
|
|
43
43
|
super(props);
|
|
44
|
-
this.
|
|
44
|
+
this.setTag('button');
|
|
45
45
|
this.setDomEvent('click', (e) => this._handleClick(e));
|
|
46
46
|
this.setDomEvent('mousedown', () => { this._startAutoRep(true); });
|
|
47
47
|
this.setDomEvent('mouseup', () => { this._startAutoRep(false); });
|
package/lib/checkbox.js
CHANGED
|
@@ -50,9 +50,9 @@ class CheckBox extends component_1.Component {
|
|
|
50
50
|
// checkbox
|
|
51
51
|
let labelWidth = props.labelWidth ?? -1;
|
|
52
52
|
let uid = '__cb_' + this.uid;
|
|
53
|
+
this.setTag('label');
|
|
53
54
|
this.addClass('@hlayout');
|
|
54
55
|
this.addClass(props.align ?? 'left');
|
|
55
|
-
this.setProp('tag', 'label');
|
|
56
56
|
this.setContent([
|
|
57
57
|
new input_1.Input({
|
|
58
58
|
ref: 'input',
|
package/lib/component.d.ts
CHANGED
|
@@ -163,16 +163,28 @@ export declare class Component<P extends CProps<BaseComponentEventMap> = CProps<
|
|
|
163
163
|
*/
|
|
164
164
|
appendChild(content: ComponentContent): void;
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
167
|
-
* @param name name to get
|
|
166
|
+
*
|
|
168
167
|
*/
|
|
169
|
-
|
|
168
|
+
setTag(tag: string, namespace?: string): void;
|
|
170
169
|
/**
|
|
170
|
+
* get the Component value
|
|
171
|
+
* @param name name to get
|
|
172
|
+
* /
|
|
173
|
+
|
|
174
|
+
getProp(name: string): any {
|
|
175
|
+
return this.m_props[name];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/ **
|
|
171
179
|
* change a Component value
|
|
172
180
|
* @param name name to set
|
|
173
181
|
* @param value new value
|
|
174
|
-
|
|
175
|
-
|
|
182
|
+
* /
|
|
183
|
+
|
|
184
|
+
setProp(name: string, value?: any) {
|
|
185
|
+
(this.m_props as any)[name] = value;
|
|
186
|
+
}
|
|
187
|
+
*/
|
|
176
188
|
/**
|
|
177
189
|
* get the Component data value
|
|
178
190
|
* @param name name to get
|
package/lib/component.js
CHANGED
|
@@ -156,21 +156,34 @@ class Component extends base_component_1.BaseComponent {
|
|
|
156
156
|
append(content);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
*
|
|
161
|
+
*/
|
|
162
|
+
setTag(tag, namespace) {
|
|
163
|
+
this.m_props.tag = tag;
|
|
164
|
+
if (namespace) {
|
|
165
|
+
this.m_props.ns = namespace;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
159
168
|
/**
|
|
160
169
|
* get the Component value
|
|
161
170
|
* @param name name to get
|
|
162
|
-
|
|
163
|
-
|
|
171
|
+
* /
|
|
172
|
+
|
|
173
|
+
getProp(name: string): any {
|
|
164
174
|
return this.m_props[name];
|
|
165
175
|
}
|
|
166
|
-
|
|
176
|
+
|
|
177
|
+
/ **
|
|
167
178
|
* change a Component value
|
|
168
179
|
* @param name name to set
|
|
169
180
|
* @param value new value
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
181
|
+
* /
|
|
182
|
+
|
|
183
|
+
setProp(name: string, value?: any) {
|
|
184
|
+
(this.m_props as any)[name] = value;
|
|
173
185
|
}
|
|
186
|
+
*/
|
|
174
187
|
/**
|
|
175
188
|
* get the Component data value
|
|
176
189
|
* @param name name to get
|
package/lib/dom_events.d.ts
CHANGED
|
@@ -131,6 +131,8 @@ export interface IDOMEvents {
|
|
|
131
131
|
* Fires when the object receives focus.
|
|
132
132
|
* @param ev The event.
|
|
133
133
|
*/
|
|
134
|
+
focusin?: (ev: FocusEvent) => any;
|
|
135
|
+
focusout?: (ev: FocusEvent) => any;
|
|
134
136
|
focus?: (ev: FocusEvent) => any;
|
|
135
137
|
gotpointercapture?: (ev: PointerEvent) => any;
|
|
136
138
|
input?: (ev: Event) => any;
|
package/lib/form.js
CHANGED
|
@@ -52,7 +52,7 @@ class Form extends layout_1.VLayout {
|
|
|
52
52
|
let height = props.height;
|
|
53
53
|
props.height = undefined;
|
|
54
54
|
super(props);
|
|
55
|
-
this.
|
|
55
|
+
this.setTag(props.disableSuggestions ? 'section' : 'form');
|
|
56
56
|
this.mapPropEvents(props, 'btnClick');
|
|
57
57
|
this.updateContent(content, props.buttons, height);
|
|
58
58
|
this.m_dirty = false;
|
package/lib/gridview.js
CHANGED
|
@@ -830,11 +830,11 @@ class GridView extends layout_1.VLayout {
|
|
|
830
830
|
this.m_empty_msg.text = text;
|
|
831
831
|
}
|
|
832
832
|
_renderCheck(rec) {
|
|
833
|
-
let
|
|
833
|
+
let icon = '--x4-icon-square';
|
|
834
834
|
if (this.m_marks.has(rec.getID())) {
|
|
835
|
-
|
|
835
|
+
icon = '--x4-icon-square-check';
|
|
836
836
|
}
|
|
837
|
-
return new
|
|
837
|
+
return new icon_js_1.Icon({ icon: `var(${icon})` });
|
|
838
838
|
}
|
|
839
839
|
_toggleMark(rec) {
|
|
840
840
|
let id = rec.getID();
|
package/lib/input.js
CHANGED
package/lib/label.js
CHANGED
package/lib/layout.js
CHANGED
package/lib/link.js
CHANGED
|
@@ -47,8 +47,8 @@ class Link extends component_1.Component {
|
|
|
47
47
|
render(props) {
|
|
48
48
|
let text = props.text ?? '';
|
|
49
49
|
let href = props.href ?? '#';
|
|
50
|
+
this.setTag('a');
|
|
50
51
|
this.setAttribute('tabindex', 0);
|
|
51
|
-
this.setProp('tag', 'a');
|
|
52
52
|
this.setAttribute('href', href);
|
|
53
53
|
this.setAttribute('target', props.target);
|
|
54
54
|
if (text) {
|
package/lib/menu.js
CHANGED
|
@@ -227,7 +227,7 @@ class MenuItem extends component_1.Component {
|
|
|
227
227
|
if (props.cls) {
|
|
228
228
|
this.addClass(props.cls);
|
|
229
229
|
}
|
|
230
|
-
this.
|
|
230
|
+
this.setTag('a');
|
|
231
231
|
//@bug: do not kill focus on click
|
|
232
232
|
// this.setAttribute( 'tabindex', '0' );
|
|
233
233
|
this.setContent([
|
package/lib/radiobtn.js
CHANGED
|
@@ -52,8 +52,8 @@ class RadioBtn extends component_1.Component {
|
|
|
52
52
|
let align = props.align ?? 'left';
|
|
53
53
|
let value = props.value;
|
|
54
54
|
let icon = props.icon;
|
|
55
|
+
this.setTag('label');
|
|
55
56
|
this.addClass('@hlayout');
|
|
56
|
-
this.setProp('tag', 'label');
|
|
57
57
|
this.addClass(align);
|
|
58
58
|
this._setTabIndex(props.tabIndex);
|
|
59
59
|
if (checked) {
|
package/lib/svgcomponent.js
CHANGED
|
@@ -416,8 +416,7 @@ exports.SVGPathBuilder = SVGPathBuilder;
|
|
|
416
416
|
class SVGComponent extends component_1.Component {
|
|
417
417
|
constructor(props) {
|
|
418
418
|
super(props);
|
|
419
|
-
this.
|
|
420
|
-
this.setProp('ns', 'http://www.w3.org/2000/svg');
|
|
419
|
+
this.setTag('svg', 'http://www.w3.org/2000/svg');
|
|
421
420
|
this.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
422
421
|
this.setAttributes({
|
|
423
422
|
viewBox: props.viewBox,
|
package/lib/textarea.js
CHANGED
|
@@ -60,7 +60,7 @@ class TextArea extends component_1.Component {
|
|
|
60
60
|
this.setAttribute('name', props.name);
|
|
61
61
|
}
|
|
62
62
|
if (props.autoGrow) {
|
|
63
|
-
this.
|
|
63
|
+
this.m_props.autoGrow = true;
|
|
64
64
|
this.setAttribute('rows', this._calcHeight(props.text));
|
|
65
65
|
this.setDomEvent('keydown', () => {
|
|
66
66
|
(0, tools_1.asap)(() => this._updateHeight());
|
|
@@ -70,8 +70,8 @@ class TextArea extends component_1.Component {
|
|
|
70
70
|
this.setDomEvent('keydown', (e) => {
|
|
71
71
|
e.stopPropagation();
|
|
72
72
|
});
|
|
73
|
+
this.setTag('textarea');
|
|
73
74
|
this.setDomEvent('input', () => this._change());
|
|
74
|
-
this.setProp('tag', 'textarea');
|
|
75
75
|
}
|
|
76
76
|
_change() {
|
|
77
77
|
this.emit('change', (0, x4events_1.EvChange)(this.value));
|
package/lib/textedit.js
CHANGED
package/lib/x4.css
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
:root {
|
|
30
|
-
--x4-font:
|
|
30
|
+
--x4-font: Helvetica, Arial, Sans-Serif;
|
|
31
31
|
--x4-font-size: 13px;
|
|
32
32
|
--x4-base-color: #266888;
|
|
33
33
|
--x4-selection-color: #2458B3;
|
|
@@ -62,11 +62,13 @@
|
|
|
62
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>';
|
|
63
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
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"
|
|
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"><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
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
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
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
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>';
|
|
70
|
+
--x4-icon-square-check: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M211.8 339.8C200.9 350.7 183.1 350.7 172.2 339.8L108.2 275.8C97.27 264.9 97.27 247.1 108.2 236.2C119.1 225.3 136.9 225.3 147.8 236.2L192 280.4L300.2 172.2C311.1 161.3 328.9 161.3 339.8 172.2C350.7 183.1 350.7 200.9 339.8 211.8L211.8 339.8zM0 96C0 60.65 28.65 32 64 32H384C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96zM48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80H64C55.16 80 48 87.16 48 96z"/></svg>';
|
|
71
|
+
--x4-icon-square: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M384 32C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H384zM384 64H64C46.33 64 32 78.33 32 96V416C32 433.7 46.33 448 64 448H384C401.7 448 416 433.7 416 416V96C416 78.33 401.7 64 384 64z"/></svg>';
|
|
70
72
|
}
|
|
71
73
|
/* source: https://tailwindcss.com/docs/customizing-colors/#default-color-palette */
|
|
72
74
|
:root {
|
package/package.json
CHANGED
package/src/autocomplete.ts
CHANGED
|
@@ -128,6 +128,7 @@ export class AutoComplete extends TextEdit<AutoCompleteProps> {
|
|
|
128
128
|
this.value = (e.selection as ListViewItem).id
|
|
129
129
|
if( !this.m_lockpop ) {
|
|
130
130
|
this._hidePopup( );
|
|
131
|
+
this.focus( );
|
|
131
132
|
}
|
|
132
133
|
},
|
|
133
134
|
style: {
|
|
@@ -162,7 +163,7 @@ export class AutoComplete extends TextEdit<AutoCompleteProps> {
|
|
|
162
163
|
|
|
163
164
|
private _checkFocus( ) {
|
|
164
165
|
const focus = document.activeElement;
|
|
165
|
-
if( this.dom.contains(focus) ) {
|
|
166
|
+
if( this.dom && this.dom.contains(focus) ) {
|
|
166
167
|
return;
|
|
167
168
|
}
|
|
168
169
|
|
package/src/base_component.ts
CHANGED
|
@@ -53,6 +53,7 @@ export interface BaseComponentEventMap extends EventMap {
|
|
|
53
53
|
|
|
54
54
|
export interface BaseComponentProps<T = BaseComponentEventMap> {
|
|
55
55
|
events?: MapEvents<T>; // basic component event map in base interface, should specialised in derived interfaces
|
|
56
|
+
[key: string]: any; // added index signature to solve "Type 'X' has no properties with type 'Y'"
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
/**
|
package/src/button.ts
CHANGED
|
@@ -73,7 +73,7 @@ export class BaseButton<P extends ButtonProps = ButtonProps, E extends ButtonEve
|
|
|
73
73
|
constructor(props: P) {
|
|
74
74
|
super(props);
|
|
75
75
|
|
|
76
|
-
this.
|
|
76
|
+
this.setTag( 'button');
|
|
77
77
|
|
|
78
78
|
this.setDomEvent('click', (e) => this._handleClick(e));
|
|
79
79
|
this.setDomEvent('mousedown', () => { this._startAutoRep(true) });
|
package/src/checkbox.ts
CHANGED
|
@@ -84,10 +84,10 @@ export class CheckBox extends Component<CheckBoxProps, CheckBoxEventMap> {
|
|
|
84
84
|
let labelWidth = props.labelWidth ?? -1;
|
|
85
85
|
let uid = '__cb_' + this.uid;
|
|
86
86
|
|
|
87
|
+
this.setTag( 'label');
|
|
87
88
|
this.addClass('@hlayout');
|
|
88
89
|
this.addClass(props.align ?? 'left');
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
this.setContent([
|
|
92
92
|
new Input({
|
|
93
93
|
ref: 'input',
|
package/src/component.ts
CHANGED
|
@@ -275,24 +275,36 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
+
/**
|
|
279
|
+
*
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
setTag( tag: string, namespace?: string ) {
|
|
283
|
+
this.m_props.tag = tag;
|
|
284
|
+
if( namespace ) {
|
|
285
|
+
this.m_props.ns = namespace;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
278
289
|
/**
|
|
279
290
|
* get the Component value
|
|
280
291
|
* @param name name to get
|
|
281
|
-
|
|
292
|
+
* /
|
|
282
293
|
|
|
283
294
|
getProp(name: string): any {
|
|
284
295
|
return this.m_props[name];
|
|
285
296
|
}
|
|
286
297
|
|
|
287
|
-
|
|
298
|
+
/ **
|
|
288
299
|
* change a Component value
|
|
289
300
|
* @param name name to set
|
|
290
301
|
* @param value new value
|
|
291
|
-
|
|
302
|
+
* /
|
|
292
303
|
|
|
293
304
|
setProp(name: string, value?: any) {
|
|
294
|
-
this.m_props[name] = value;
|
|
305
|
+
(this.m_props as any)[name] = value;
|
|
295
306
|
}
|
|
307
|
+
*/
|
|
296
308
|
|
|
297
309
|
/**
|
|
298
310
|
* get the Component data value
|
package/src/dom_events.ts
CHANGED
|
@@ -137,6 +137,8 @@ export interface IDOMEvents {
|
|
|
137
137
|
* Fires when the object receives focus.
|
|
138
138
|
* @param ev The event.
|
|
139
139
|
*/
|
|
140
|
+
focusin?: (ev: FocusEvent) => any;
|
|
141
|
+
focusout?: (ev: FocusEvent) => any;
|
|
140
142
|
focus?: (ev: FocusEvent) => any;
|
|
141
143
|
gotpointercapture?: (ev: PointerEvent) => any;
|
|
142
144
|
input?: (ev: Event) => any;
|
package/src/form.ts
CHANGED
|
@@ -78,7 +78,7 @@ export class Form<T extends FormProps = FormProps, E extends FormEventMap = Form
|
|
|
78
78
|
|
|
79
79
|
super(props);
|
|
80
80
|
|
|
81
|
-
this.
|
|
81
|
+
this.setTag( props.disableSuggestions ? 'section' : 'form');
|
|
82
82
|
this.mapPropEvents(props, 'btnClick');
|
|
83
83
|
this.updateContent(content, props.buttons, height);
|
|
84
84
|
|
package/src/gridview.ts
CHANGED
|
@@ -1109,12 +1109,12 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
|
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
1111
|
private _renderCheck(rec: Record) {
|
|
1112
|
-
let
|
|
1112
|
+
let icon = '--x4-icon-square';
|
|
1113
1113
|
if (this.m_marks.has(rec.getID())) {
|
|
1114
|
-
|
|
1114
|
+
icon = '--x4-icon-square-check';
|
|
1115
1115
|
}
|
|
1116
1116
|
|
|
1117
|
-
return new
|
|
1117
|
+
return new Icon({ icon: `var(${icon})` });
|
|
1118
1118
|
}
|
|
1119
1119
|
|
|
1120
1120
|
private _toggleMark(rec: Record) {
|
package/src/input.ts
CHANGED
package/src/label.ts
CHANGED
package/src/layout.ts
CHANGED
package/src/link.ts
CHANGED
|
@@ -69,8 +69,8 @@ export class Link extends Component<LinkProps, LinkEventMap>
|
|
|
69
69
|
let text = props.text ?? '';
|
|
70
70
|
let href = props.href ?? '#';
|
|
71
71
|
|
|
72
|
+
this.setTag( 'a');
|
|
72
73
|
this.setAttribute('tabindex', 0);
|
|
73
|
-
this.setProp('tag', 'a');
|
|
74
74
|
this.setAttribute('href', href);
|
|
75
75
|
this.setAttribute('target', props.target);
|
|
76
76
|
|
package/src/menu.ts
CHANGED
|
@@ -206,24 +206,24 @@ export class Menu extends Popup<MenuProps>
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
public displayAt(ev: UIEvent
|
|
210
|
-
public displayAt(x: number, y?: number, align?: string, offset?: { x, y }
|
|
211
|
-
public displayAt(
|
|
212
|
-
|
|
209
|
+
public displayAt(ev: UIEvent): void;
|
|
210
|
+
public displayAt(x: number, y?: number, align?: string, offset?: { x, y }): void;
|
|
211
|
+
public displayAt(...args) {
|
|
212
|
+
|
|
213
213
|
if (!this.m_lock) {
|
|
214
214
|
Menu._discardAll();
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
let x, y, align, offset;
|
|
218
218
|
|
|
219
|
-
if(
|
|
220
|
-
({x,y} = getMousePos(
|
|
219
|
+
if (args.length == 1) {
|
|
220
|
+
({ x, y } = getMousePos(args[0], true));
|
|
221
221
|
}
|
|
222
222
|
else {
|
|
223
|
-
[x,y,align,offset] = args;
|
|
223
|
+
[x, y, align, offset] = args;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
if(
|
|
226
|
+
if (!align) {
|
|
227
227
|
align = 'top left';
|
|
228
228
|
}
|
|
229
229
|
|
|
@@ -247,7 +247,7 @@ export interface MenuItemProps extends CProps {
|
|
|
247
247
|
checked?: boolean;
|
|
248
248
|
cls?: string;
|
|
249
249
|
click?: EventCallback<EvClick>; // shortcut to events: { click ... }
|
|
250
|
-
|
|
250
|
+
|
|
251
251
|
action?: Action;
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -259,20 +259,20 @@ export class MenuItem extends Component<MenuItemProps, MenuItemEventMap> {
|
|
|
259
259
|
private m_isOpen: boolean;
|
|
260
260
|
private m_action: Action;
|
|
261
261
|
|
|
262
|
-
constructor(
|
|
263
|
-
constructor(
|
|
264
|
-
constructor(
|
|
265
|
-
constructor(
|
|
262
|
+
constructor(action: Action);
|
|
263
|
+
constructor(text: string, click: EventCallback<EvClick>);
|
|
264
|
+
constructor(props: MenuItemProps);
|
|
265
|
+
constructor(a, b?) {
|
|
266
266
|
|
|
267
|
-
if(
|
|
268
|
-
super(
|
|
269
|
-
click: (
|
|
267
|
+
if (a instanceof Action) {
|
|
268
|
+
super({
|
|
269
|
+
click: () => { a.fire(); }
|
|
270
270
|
});
|
|
271
271
|
|
|
272
272
|
this.m_action = a;
|
|
273
273
|
}
|
|
274
|
-
else if(
|
|
275
|
-
super(
|
|
274
|
+
else if (isString(a)) {
|
|
275
|
+
super({
|
|
276
276
|
text: a,
|
|
277
277
|
click: b
|
|
278
278
|
});
|
|
@@ -281,7 +281,7 @@ export class MenuItem extends Component<MenuItemProps, MenuItemEventMap> {
|
|
|
281
281
|
super(a);
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
this.mapPropEvents(
|
|
284
|
+
this.mapPropEvents(this.m_props, 'click');
|
|
285
285
|
|
|
286
286
|
this.m_menu = null;
|
|
287
287
|
this.m_isOpen = false;
|
|
@@ -300,12 +300,12 @@ export class MenuItem extends Component<MenuItemProps, MenuItemEventMap> {
|
|
|
300
300
|
icon = props.checked ? 'var( --x4-icon-check )' : 0;
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
-
if(
|
|
304
|
-
if(
|
|
303
|
+
if (this.m_action) {
|
|
304
|
+
if (!icon) {
|
|
305
305
|
icon = this.m_action.props.icon;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
if(
|
|
308
|
+
if (text === undefined) {
|
|
309
309
|
text = this.m_action.props.text;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
@@ -313,7 +313,7 @@ export class MenuItem extends Component<MenuItemProps, MenuItemEventMap> {
|
|
|
313
313
|
let popIco = null;
|
|
314
314
|
if (this.isPopup) {
|
|
315
315
|
this.addClass('@popup-menu-item');
|
|
316
|
-
popIco = new Icon(
|
|
316
|
+
popIco = new Icon({ icon: "var( --x4-icon-chevron-right )", cls: "pop-mark" });
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
if (!text && !icon) {
|
|
@@ -324,7 +324,7 @@ export class MenuItem extends Component<MenuItemProps, MenuItemEventMap> {
|
|
|
324
324
|
this.addClass(props.cls);
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
this.
|
|
327
|
+
this.setTag('a');
|
|
328
328
|
//@bug: do not kill focus on click
|
|
329
329
|
// this.setAttribute( 'tabindex', '0' );
|
|
330
330
|
|
package/src/radiobtn.ts
CHANGED
|
@@ -87,9 +87,9 @@ export class RadioBtn extends Component<RadioBtnProps,RadioBtnEventMap> {
|
|
|
87
87
|
let value = props.value;
|
|
88
88
|
let icon = props.icon;
|
|
89
89
|
|
|
90
|
+
this.setTag( 'label' );
|
|
90
91
|
this.addClass( '@hlayout' );
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
this.addClass( align );
|
|
94
94
|
this._setTabIndex( props.tabIndex );
|
|
95
95
|
|
package/src/svgcomponent.ts
CHANGED
|
@@ -520,8 +520,7 @@ export class SVGComponent<P extends SVGProps = SVGProps> extends Component<P> {
|
|
|
520
520
|
constructor( props: P ) {
|
|
521
521
|
super( props );
|
|
522
522
|
|
|
523
|
-
this.
|
|
524
|
-
this.setProp('ns','http://www.w3.org/2000/svg');
|
|
523
|
+
this.setTag('svg','http://www.w3.org/2000/svg');
|
|
525
524
|
this.setAttribute('xmlns','http://www.w3.org/2000/svg');
|
|
526
525
|
|
|
527
526
|
this.setAttributes( {
|
package/src/textarea.ts
CHANGED
|
@@ -89,7 +89,7 @@ export class TextArea extends Component<TextAreaProps, TextAreaEventMap> {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
if (props.autoGrow) {
|
|
92
|
-
this.
|
|
92
|
+
this.m_props.autoGrow = true;
|
|
93
93
|
this.setAttribute('rows', this._calcHeight(props.text));
|
|
94
94
|
this.setDomEvent('keydown', () => {
|
|
95
95
|
asap( ()=>this._updateHeight());
|
|
@@ -101,8 +101,8 @@ export class TextArea extends Component<TextAreaProps, TextAreaEventMap> {
|
|
|
101
101
|
e.stopPropagation();
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
this.setTag( 'textarea');
|
|
104
105
|
this.setDomEvent('input', () => this._change());
|
|
105
|
-
this.setProp('tag', 'textarea');
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
private _change() {
|
package/src/textedit.ts
CHANGED
|
@@ -128,7 +128,7 @@ export class TextEdit<T extends TextEditProps = TextEditProps, E extends TextEdi
|
|
|
128
128
|
flex: 1,
|
|
129
129
|
dom_events: {
|
|
130
130
|
focus: ( ) => this._focus( ),
|
|
131
|
-
|
|
131
|
+
focusout: ( ) => this._blur( ),
|
|
132
132
|
input: ( ) => this._change( )
|
|
133
133
|
},
|
|
134
134
|
value: props.value,
|
package/src/x4.less
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
**/
|
|
31
31
|
|
|
32
32
|
:root {
|
|
33
|
-
--x4-font:
|
|
33
|
+
--x4-font: Helvetica, Arial, Sans-Serif;
|
|
34
34
|
--x4-font-size: 13px;
|
|
35
35
|
|
|
36
36
|
--x4-base-color: #266888;
|
|
@@ -77,12 +77,15 @@
|
|
|
77
77
|
--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>';
|
|
78
78
|
--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>';
|
|
79
79
|
--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>';
|
|
80
|
-
--x4-icon-folder-opened: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"
|
|
80
|
+
--x4-icon-folder-opened: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><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>';
|
|
81
81
|
|
|
82
82
|
--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>';
|
|
83
83
|
--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>';
|
|
84
84
|
--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>';
|
|
85
85
|
--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>';
|
|
86
|
+
|
|
87
|
+
--x4-icon-square-check: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M211.8 339.8C200.9 350.7 183.1 350.7 172.2 339.8L108.2 275.8C97.27 264.9 97.27 247.1 108.2 236.2C119.1 225.3 136.9 225.3 147.8 236.2L192 280.4L300.2 172.2C311.1 161.3 328.9 161.3 339.8 172.2C350.7 183.1 350.7 200.9 339.8 211.8L211.8 339.8zM0 96C0 60.65 28.65 32 64 32H384C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96zM48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80H64C55.16 80 48 87.16 48 96z"/></svg>';
|
|
88
|
+
--x4-icon-square: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M384 32C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H384zM384 64H64C46.33 64 32 78.33 32 96V416C32 433.7 46.33 448 64 448H384C401.7 448 416 433.7 416 416V96C416 78.33 401.7 64 384 64z"/></svg>';
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
@BLACK10: rgba(0,0,0,0.1);
|