x4js 1.4.49 → 1.4.52
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 +4 -10
- package/lib/component.js +9 -15
- package/lib/dom_events.d.ts +2 -0
- package/lib/form.js +1 -1
- package/lib/gridview.js +3 -3
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- 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/property_editor.d.ts +1 -1
- package/lib/radiobtn.js +1 -1
- package/lib/smartedit.js +1 -1
- package/lib/svgcomponent.js +1 -2
- package/lib/tabbar.d.ts +1 -1
- package/lib/textarea.js +2 -2
- package/lib/textedit.js +1 -1
- package/lib/x4.css +15 -2
- package/lib/x4react.d.ts +41 -0
- package/lib/x4react.js +75 -0
- package/license.md +21 -0
- package/package.json +1 -1
- package/src/autocomplete.ts +2 -1
- package/src/base_component.ts +3 -1
- package/src/button.ts +1 -1
- package/src/checkbox.ts +2 -2
- package/src/component.ts +2329 -2339
- package/src/dom_events.ts +2 -0
- package/src/form.ts +1 -1
- package/src/gridview.ts +3 -3
- package/src/index.ts +1 -0
- 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 +19 -2
- package/src/x4react.ts +90 -0
- package/tsconfig.json +3 -1
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
|
@@ -136,7 +136,7 @@ export interface CProps<T extends CEventMap = CEventMap> extends BaseComponentPr
|
|
|
136
136
|
/**
|
|
137
137
|
*
|
|
138
138
|
*/
|
|
139
|
-
export declare class Component<P extends CProps<
|
|
139
|
+
export declare class Component<P extends CProps<CEventMap> = CProps<CEventMap>, E extends CEventMap = CEventMap> extends BaseComponent<P, E> {
|
|
140
140
|
private m_dom;
|
|
141
141
|
private m_iprops;
|
|
142
142
|
private static __sb_width;
|
|
@@ -157,22 +157,16 @@ export declare class Component<P extends CProps<BaseComponentEventMap> = CProps<
|
|
|
157
157
|
* @param content new content or null
|
|
158
158
|
*/
|
|
159
159
|
setContent(content: ComponentContent, refreshAll?: boolean): void;
|
|
160
|
+
getContent(): ComponentContent;
|
|
160
161
|
/**
|
|
161
162
|
* add a new child to the component content
|
|
162
163
|
* @param content
|
|
163
164
|
*/
|
|
164
165
|
appendChild(content: ComponentContent): void;
|
|
165
166
|
/**
|
|
166
|
-
*
|
|
167
|
-
* @param name name to get
|
|
168
|
-
*/
|
|
169
|
-
getProp(name: string): any;
|
|
170
|
-
/**
|
|
171
|
-
* change a Component value
|
|
172
|
-
* @param name name to set
|
|
173
|
-
* @param value new value
|
|
167
|
+
*
|
|
174
168
|
*/
|
|
175
|
-
|
|
169
|
+
setTag(tag: string, namespace?: string): void;
|
|
176
170
|
/**
|
|
177
171
|
* get the Component data value
|
|
178
172
|
* @param name name to get
|
package/lib/component.js
CHANGED
|
@@ -129,6 +129,9 @@ class Component extends base_component_1.BaseComponent {
|
|
|
129
129
|
this._updateContent();
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
+
getContent() {
|
|
133
|
+
return this.m_props.content;
|
|
134
|
+
}
|
|
132
135
|
/**
|
|
133
136
|
* add a new child to the component content
|
|
134
137
|
* @param content
|
|
@@ -157,19 +160,13 @@ class Component extends base_component_1.BaseComponent {
|
|
|
157
160
|
}
|
|
158
161
|
}
|
|
159
162
|
/**
|
|
160
|
-
*
|
|
161
|
-
* @param name name to get
|
|
162
|
-
*/
|
|
163
|
-
getProp(name) {
|
|
164
|
-
return this.m_props[name];
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* change a Component value
|
|
168
|
-
* @param name name to set
|
|
169
|
-
* @param value new value
|
|
163
|
+
*
|
|
170
164
|
*/
|
|
171
|
-
|
|
172
|
-
this.m_props
|
|
165
|
+
setTag(tag, namespace) {
|
|
166
|
+
this.m_props.tag = tag;
|
|
167
|
+
if (namespace) {
|
|
168
|
+
this.m_props.ns = namespace;
|
|
169
|
+
}
|
|
173
170
|
}
|
|
174
171
|
/**
|
|
175
172
|
* get the Component data value
|
|
@@ -536,9 +533,6 @@ class Component extends base_component_1.BaseComponent {
|
|
|
536
533
|
return this.m_dom;
|
|
537
534
|
}
|
|
538
535
|
render(props) {
|
|
539
|
-
if (this.m_props.tag == 'footer') {
|
|
540
|
-
debugger;
|
|
541
|
-
}
|
|
542
536
|
}
|
|
543
537
|
_createDOM() {
|
|
544
538
|
if (this.m_dom) {
|
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/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -98,4 +98,5 @@ __exportStar(require("./tools"), exports);
|
|
|
98
98
|
__exportStar(require("./tooltips"), exports);
|
|
99
99
|
__exportStar(require("./treeview"), exports);
|
|
100
100
|
__exportStar(require("./x4events"), exports);
|
|
101
|
+
__exportStar(require("./x4react"), exports);
|
|
101
102
|
__exportStar(require("./version"), exports);
|
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/property_editor.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export declare class PropertyEditor extends Component<PropertyEditorProps, Prope
|
|
|
64
64
|
private _updateProperties;
|
|
65
65
|
private _cellChange;
|
|
66
66
|
_renderCell(text: any, rec: any): any;
|
|
67
|
-
_editCell(props: any, row: number, col: number): Component<CProps<
|
|
67
|
+
_editCell(props: any, row: number, col: number): Component<CProps<CEventMap>, CEventMap>;
|
|
68
68
|
private _choicesFromArray;
|
|
69
69
|
private _choicesFromStore;
|
|
70
70
|
}
|
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/smartedit.js
CHANGED
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/tabbar.d.ts
CHANGED
|
@@ -53,6 +53,6 @@ export declare class TabBar extends Container<TabBarProps, TabBarEventMap> {
|
|
|
53
53
|
render(): void;
|
|
54
54
|
select(id: string | null, notify?: boolean): boolean;
|
|
55
55
|
private _select;
|
|
56
|
-
get selection(): Component<CProps<import("./
|
|
56
|
+
get selection(): Component<CProps<import("./component").CEventMap>, import("./component").CEventMap>;
|
|
57
57
|
}
|
|
58
58
|
export {};
|
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 {
|
|
@@ -215,6 +217,12 @@ textarea::selection {
|
|
|
215
217
|
flex: 1;
|
|
216
218
|
flex-basis: 0;
|
|
217
219
|
}
|
|
220
|
+
.x-hlayout > .x-min-content {
|
|
221
|
+
min-width: min-content;
|
|
222
|
+
}
|
|
223
|
+
.x-vlayout > .x-min-content {
|
|
224
|
+
min-height: min-content;
|
|
225
|
+
}
|
|
218
226
|
.x-fit {
|
|
219
227
|
position: absolute;
|
|
220
228
|
left: 0;
|
|
@@ -327,6 +335,11 @@ textarea::selection {
|
|
|
327
335
|
margin: 0 4px;
|
|
328
336
|
color: inherit;
|
|
329
337
|
}
|
|
338
|
+
.x-base-button .x-svg-icon {
|
|
339
|
+
width: 100%;
|
|
340
|
+
height: 100%;
|
|
341
|
+
margin: 0;
|
|
342
|
+
}
|
|
330
343
|
.x-base-button:focus {
|
|
331
344
|
border-color: var(--x4-focus-color);
|
|
332
345
|
background-color: var(--x4-focus-color);
|
package/lib/x4react.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \_/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / _ \____ _|
|
|
6
|
+
* /__/ \__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file x4react.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
* in the Software without restriction, including without limitation the rights
|
|
16
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
17
|
+
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
+
* subject to the following conditions:
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all copies
|
|
20
|
+
* or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
23
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
24
|
+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
25
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
**/
|
|
29
|
+
import { Component, ComponentContent, CProps, CEventMap } from './component';
|
|
30
|
+
export declare let React: {
|
|
31
|
+
createElement: (clsOrTag: any, attrs: any, ...children: any[]) => ComponentContent;
|
|
32
|
+
createFragment: () => ComponentContent;
|
|
33
|
+
Fragment: symbol;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export declare abstract class TSXComponent<P extends CProps<CEventMap> = CProps<CEventMap>, E extends CEventMap = CEventMap> extends Component<P, E> {
|
|
39
|
+
render(props: P): void;
|
|
40
|
+
abstract renderTSX(props: P): Component | Component[];
|
|
41
|
+
}
|
package/lib/x4react.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ___ ___ __
|
|
4
|
+
* \ \_/ / / _
|
|
5
|
+
* \ / /_| |_
|
|
6
|
+
* / _ \____ _|
|
|
7
|
+
* /__/ \__\ |_|
|
|
8
|
+
*
|
|
9
|
+
* @file x4react.ts
|
|
10
|
+
* @author Etienne Cochard
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
13
|
+
*
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
* in the Software without restriction, including without limitation the rights
|
|
17
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
18
|
+
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
19
|
+
* subject to the following conditions:
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all copies
|
|
21
|
+
* or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
24
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
25
|
+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
28
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
|
+
**/
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.TSXComponent = exports.React = void 0;
|
|
32
|
+
const component_1 = require("./component");
|
|
33
|
+
const createElement = (clsOrTag, attrs, ...children) => {
|
|
34
|
+
let comp;
|
|
35
|
+
// fragment
|
|
36
|
+
if (clsOrTag == createFragment || clsOrTag == Fragment) {
|
|
37
|
+
return children;
|
|
38
|
+
}
|
|
39
|
+
// class constructor, yes : dirty
|
|
40
|
+
else if (clsOrTag instanceof Function) {
|
|
41
|
+
comp = new clsOrTag(attrs);
|
|
42
|
+
}
|
|
43
|
+
// basic tag
|
|
44
|
+
else {
|
|
45
|
+
comp = new component_1.Component({
|
|
46
|
+
tag: clsOrTag,
|
|
47
|
+
...attrs,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (children && children.length) {
|
|
51
|
+
comp.setContent(children);
|
|
52
|
+
}
|
|
53
|
+
return comp;
|
|
54
|
+
};
|
|
55
|
+
const Fragment = Symbol("fragment");
|
|
56
|
+
const createFragment = () => {
|
|
57
|
+
return null;
|
|
58
|
+
};
|
|
59
|
+
exports.React = {
|
|
60
|
+
createElement,
|
|
61
|
+
createFragment,
|
|
62
|
+
Fragment,
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
class TSXComponent extends component_1.Component {
|
|
68
|
+
render(props) {
|
|
69
|
+
const tsx = this.renderTSX(props);
|
|
70
|
+
if (tsx) {
|
|
71
|
+
this.setContent(tsx);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.TSXComponent = TSXComponent;
|
package/license.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 R-Libre ingénierie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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
|
/**
|
|
@@ -147,4 +148,5 @@ export class BaseComponent< P extends BaseComponentProps<BaseComponentEventMap>,
|
|
|
147
148
|
}
|
|
148
149
|
})
|
|
149
150
|
}
|
|
150
|
-
}
|
|
151
|
+
}
|
|
152
|
+
|
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',
|