x4js 1.4.48 → 1.4.51

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 (53) hide show
  1. package/lib/autocomplete.js +2 -1
  2. package/lib/base_component.d.ts +1 -0
  3. package/lib/button.js +1 -1
  4. package/lib/checkbox.js +1 -1
  5. package/lib/component.d.ts +10 -10
  6. package/lib/component.js +22 -16
  7. package/lib/dom_events.d.ts +2 -0
  8. package/lib/form.js +1 -1
  9. package/lib/gridview.js +3 -3
  10. package/lib/index.d.ts +1 -0
  11. package/lib/index.js +1 -0
  12. package/lib/input.d.ts +1 -0
  13. package/lib/input.js +7 -1
  14. package/lib/label.js +1 -1
  15. package/lib/layout.js +1 -1
  16. package/lib/link.js +1 -1
  17. package/lib/menu.js +1 -1
  18. package/lib/property_editor.d.ts +1 -1
  19. package/lib/radiobtn.js +1 -1
  20. package/lib/smartedit.js +1 -1
  21. package/lib/svgcomponent.js +1 -2
  22. package/lib/tabbar.d.ts +1 -1
  23. package/lib/textarea.js +2 -2
  24. package/lib/textedit.d.ts +1 -0
  25. package/lib/textedit.js +2 -1
  26. package/lib/version.d.ts +28 -0
  27. package/lib/version.js +28 -0
  28. package/lib/x4.css +4 -2
  29. package/lib/x4react.d.ts +6 -0
  30. package/lib/x4react.js +35 -0
  31. package/license.md +21 -0
  32. package/package.json +1 -1
  33. package/src/autocomplete.ts +2 -1
  34. package/src/base_component.ts +3 -1
  35. package/src/button.ts +1 -1
  36. package/src/checkbox.ts +2 -2
  37. package/src/component.ts +2344 -2339
  38. package/src/dom_events.ts +2 -0
  39. package/src/form.ts +1 -1
  40. package/src/gridview.ts +3 -3
  41. package/src/index.ts +1 -0
  42. package/src/input.ts +10 -1
  43. package/src/label.ts +1 -1
  44. package/src/layout.ts +1 -1
  45. package/src/link.ts +1 -1
  46. package/src/menu.ts +24 -24
  47. package/src/radiobtn.ts +2 -2
  48. package/src/svgcomponent.ts +1 -2
  49. package/src/textarea.ts +2 -2
  50. package/src/textedit.ts +4 -1
  51. package/src/x4.less +5 -2
  52. package/src/x4react.ts +42 -0
  53. package/tsconfig.json +3 -1
@@ -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)) {
@@ -46,6 +46,7 @@ export interface BaseComponentEventMap extends EventMap {
46
46
  */
47
47
  export interface BaseComponentProps<T = BaseComponentEventMap> {
48
48
  events?: MapEvents<T>;
49
+ [key: string]: any;
49
50
  }
50
51
  /**
51
52
  * BaseComponent class
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.setProp('tag', 'button');
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',
@@ -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<BaseComponentEventMap> = CProps<BaseComponentEventMap>, E extends BaseComponentEventMap = BaseComponentEventMap> extends BaseComponent<P, E> {
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;
@@ -163,16 +163,9 @@ export declare class Component<P extends CProps<BaseComponentEventMap> = CProps<
163
163
  */
164
164
  appendChild(content: ComponentContent): void;
165
165
  /**
166
- * get the Component value
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
166
+ *
174
167
  */
175
- setProp(name: string, value?: any): void;
168
+ setTag(tag: string, namespace?: string): void;
176
169
  /**
177
170
  * get the Component data value
178
171
  * @param name name to get
@@ -605,3 +598,10 @@ export declare class Container<P extends ContainerProps = ContainerProps, E exte
605
598
  private _handleKeydown;
606
599
  }
607
600
  export declare type ComponentConstructor<T> = new (props: CProps) => T;
601
+ /**
602
+ *
603
+ */
604
+ export declare class TSXComponent<P extends CProps<CEventMap> = CProps<CEventMap>, E extends CEventMap = CEventMap> extends Component<P, E> {
605
+ render(props: P): void;
606
+ renderTSX(props: P): Component | Component[];
607
+ }
package/lib/component.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.Container = exports.SizerOverlay = exports.EvOverlayResize = exports.Separator = exports.EvSize = exports.Space = exports.Flex = exports.flyWrap = exports.Component = exports.EvFocus = exports.EvDblClick = exports._x4_unitless = exports.html = exports.isHtmlString = exports.HtmlString = void 0;
31
+ exports.TSXComponent = exports.Container = exports.SizerOverlay = exports.EvOverlayResize = exports.Separator = exports.EvSize = exports.Space = exports.Flex = exports.flyWrap = exports.Component = exports.EvFocus = exports.EvDblClick = exports._x4_unitless = exports.html = exports.isHtmlString = exports.HtmlString = void 0;
32
32
  /**
33
33
  * @todo
34
34
  * create Container class
@@ -157,19 +157,13 @@ class Component extends base_component_1.BaseComponent {
157
157
  }
158
158
  }
159
159
  /**
160
- * get the Component value
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
160
+ *
170
161
  */
171
- setProp(name, value) {
172
- this.m_props[name] = value;
162
+ setTag(tag, namespace) {
163
+ this.m_props.tag = tag;
164
+ if (namespace) {
165
+ this.m_props.ns = namespace;
166
+ }
173
167
  }
174
168
  /**
175
169
  * get the Component data value
@@ -536,9 +530,6 @@ class Component extends base_component_1.BaseComponent {
536
530
  return this.m_dom;
537
531
  }
538
532
  render(props) {
539
- if (this.m_props.tag == 'footer') {
540
- debugger;
541
- }
542
533
  }
543
534
  _createDOM() {
544
535
  if (this.m_dom) {
@@ -1732,3 +1723,18 @@ class Container extends Component {
1732
1723
  }
1733
1724
  }
1734
1725
  exports.Container = Container;
1726
+ /**
1727
+ *
1728
+ */
1729
+ class TSXComponent extends Component {
1730
+ render(props) {
1731
+ const tsx = this.renderTSX(props);
1732
+ if (tsx) {
1733
+ this.setContent(tsx);
1734
+ }
1735
+ }
1736
+ renderTSX(props) {
1737
+ return undefined;
1738
+ }
1739
+ }
1740
+ exports.TSXComponent = TSXComponent;
@@ -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.setProp('tag', props.disableSuggestions ? 'section' : 'form');
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 cls = '';
833
+ let icon = '--x4-icon-square';
834
834
  if (this.m_marks.has(rec.getID())) {
835
- cls = ' checked';
835
+ icon = '--x4-icon-square-check';
836
836
  }
837
- return new component_1.Component({ cls: '@grid-checkbox' + cls });
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
@@ -79,4 +79,5 @@ export * from "./tools";
79
79
  export * from "./tooltips";
80
80
  export * from "./treeview";
81
81
  export * from "./x4events";
82
+ export * from "./x4react";
82
83
  export * from "./version";
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.d.ts CHANGED
@@ -48,6 +48,7 @@ export interface InputProps<P extends InputEventMap = InputEventMap> extends CPr
48
48
  value_hook?: ValueHook;
49
49
  min?: number;
50
50
  max?: number;
51
+ autosel?: boolean;
51
52
  }
52
53
  /**
53
54
  * base class for elements implementing an input
package/lib/input.js CHANGED
@@ -40,7 +40,7 @@ class Input extends component_1.Component {
40
40
  }
41
41
  /** @ignore */
42
42
  render(props) {
43
- this.setProp('tag', 'input');
43
+ this.setTag('input');
44
44
  this._setTabIndex(props.tabIndex);
45
45
  this.setAttributes({
46
46
  value: props.value,
@@ -56,9 +56,15 @@ class Input extends component_1.Component {
56
56
  max: props.max,
57
57
  ...props.attrs
58
58
  });
59
+ this.m_props.autosel = props.autosel ?? true;
59
60
  if (props.uppercase) {
60
61
  this.setStyleValue('textTransform', 'uppercase');
61
62
  }
63
+ if (this.m_props.autosel) {
64
+ this.setDomEvent("focus", () => {
65
+ this.selectAll();
66
+ });
67
+ }
62
68
  }
63
69
  getType() {
64
70
  return this.m_props.type;
package/lib/label.js CHANGED
@@ -54,7 +54,7 @@ class Label extends component_1.Component {
54
54
  this.setContent(text);
55
55
  }
56
56
  else {
57
- this.setProp('tag', 'span');
57
+ this.setTag('span');
58
58
  this.addClass('@hlayout');
59
59
  this.setContent([
60
60
  new icon_1.Icon({ icon: props.icon }),
package/lib/layout.js CHANGED
@@ -108,7 +108,7 @@ class TableLayout extends component_1.Container {
108
108
  m_cells;
109
109
  constructor(props) {
110
110
  super(props);
111
- this.setProp('tag', 'table');
111
+ this.setTag('table');
112
112
  this.m_cells = new Map();
113
113
  }
114
114
  _getCell(row, col, create = true) {
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.setProp('tag', 'a');
230
+ this.setTag('a');
231
231
  //@bug: do not kill focus on click
232
232
  // this.setAttribute( 'tabindex', '0' );
233
233
  this.setContent([
@@ -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<import("./base_component").BaseComponentEventMap>, import("./base_component").BaseComponentEventMap>;
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
@@ -301,7 +301,7 @@ class PopupTable extends popup_1.Popup {
301
301
  }
302
302
  /** @ignore */
303
303
  render() {
304
- this.setProp('tag', 'table');
304
+ this.setTag( 'table');
305
305
  if (this.m_minw) {
306
306
  this.setStyleValue('minWidth', this.m_minw);
307
307
  }
@@ -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.setProp('tag', 'svg');
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("./base_component").BaseComponentEventMap>, import("./base_component").BaseComponentEventMap>;
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.setProp('autoGrow', true);
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.d.ts CHANGED
@@ -46,6 +46,7 @@ export interface TextEditProps extends InputProps<TextEditEventMap> {
46
46
  pattern?: string;
47
47
  uppercase?: boolean;
48
48
  format?: string | 'native';
49
+ autosel?: boolean;
49
50
  gadgets?: Component[];
50
51
  validator?: ValidationFunction;
51
52
  change?: EventCallback<EvChange>;
package/lib/textedit.js CHANGED
@@ -75,7 +75,7 @@ class TextEdit extends component_1.Component {
75
75
  flex: 1,
76
76
  dom_events: {
77
77
  focus: () => this._focus(),
78
- blur: () => this._blur(),
78
+ focusout: () => this._blur(),
79
79
  input: () => this._change()
80
80
  },
81
81
  value: props.value,
@@ -91,6 +91,7 @@ class TextEdit extends component_1.Component {
91
91
  attrs: props.attrs,
92
92
  min: props.min,
93
93
  max: props.max,
94
+ autosel: props.autosel,
94
95
  };
95
96
  // date is handled manually with popupcalendar
96
97
  if (props.type == 'date') {
package/lib/version.d.ts CHANGED
@@ -1 +1,29 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file version.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
+ **/
1
29
  export declare const x4js_version = "1.4";
package/lib/version.js CHANGED
@@ -1,4 +1,32 @@
1
1
  "use strict";
2
+ /**
3
+ * ___ ___ __
4
+ * \ \_/ / / _
5
+ * \ / /_| |_
6
+ * / _ \____ _|
7
+ * /__/ \__\ |_|
8
+ *
9
+ * @file version.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
+ **/
2
30
  Object.defineProperty(exports, "__esModule", { value: true });
3
31
  exports.x4js_version = void 0;
4
32
  exports.x4js_version = "1.4";
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: "Helvetica, Arial, Sans-Serif";
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"><!--! 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>';
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 {
@@ -0,0 +1,6 @@
1
+ import { ComponentContent } from './component';
2
+ export declare let React: {
3
+ createElement: (clsOrTag: any, attrs: any, ...children: any[]) => ComponentContent;
4
+ createFragment: () => ComponentContent;
5
+ Fragment: symbol;
6
+ };
package/lib/x4react.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.React = void 0;
4
+ const component_1 = require("./component");
5
+ const createElement = (clsOrTag, attrs, ...children) => {
6
+ let comp;
7
+ // fragment
8
+ if (clsOrTag == createFragment || clsOrTag == Fragment) {
9
+ return children;
10
+ }
11
+ // class constructor, yes : dirty
12
+ else if (clsOrTag instanceof Function) {
13
+ comp = new clsOrTag(attrs);
14
+ }
15
+ // basic tag
16
+ else {
17
+ comp = new component_1.Component({
18
+ tag: clsOrTag,
19
+ ...attrs,
20
+ });
21
+ }
22
+ if (children && children.length) {
23
+ comp.setContent(children);
24
+ }
25
+ return comp;
26
+ };
27
+ const Fragment = Symbol("fragment");
28
+ const createFragment = () => {
29
+ return null;
30
+ };
31
+ exports.React = {
32
+ createElement,
33
+ createFragment,
34
+ Fragment,
35
+ };
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.4.48",
3
+ "version": "1.4.51",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -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
 
@@ -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.setProp('tag', 'button');
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
- this.setProp('tag', 'label');
90
-
90
+
91
91
  this.setContent([
92
92
  new Input({
93
93
  ref: 'input',