x4js 1.5.25 → 1.5.27

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.
@@ -33,7 +33,7 @@ import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base
33
33
  import { Component, flyWrap } from './component'
34
34
  import { Settings } from './settings'
35
35
  import { _tr } from './i18n'
36
- import { Router } from 'x4js'
36
+ import { Router } from './router'
37
37
 
38
38
  const _x4_touch_time = Symbol( );
39
39
 
@@ -35,7 +35,11 @@ import { TextEdit, TextEditProps } from './textedit';
35
35
  */
36
36
 
37
37
  interface AutoCompleteProps extends TextEditProps {
38
- enumValues: ( filter: string ) => string[];
38
+ // return an array of values to display in the popup list
39
+ enumValues: ( filter: string ) => string[] | Promise<string[]>;
40
+
41
+ // a way to change the real value vs displayed value in the popup list
42
+ selectValue?: ( text: string ) => string;
39
43
  }
40
44
 
41
45
  /**
@@ -87,8 +91,17 @@ export class AutoComplete extends TextEdit<AutoCompleteProps> {
87
91
  }
88
92
  }
89
93
 
90
- private _onChange( ) {
91
- const items = this.m_props.enumValues( this.value );
94
+ private async _onChange( ) {
95
+ let items = this.m_props.enumValues( this.value );
96
+ if( items instanceof Promise ) {
97
+ items = await items;
98
+ }
99
+
100
+ if( items.length==0 ) {
101
+ this._hidePopup( );
102
+ return;
103
+ }
104
+
92
105
  this.showPopup( items );
93
106
  }
94
107
 
@@ -125,7 +138,12 @@ export class AutoComplete extends TextEdit<AutoCompleteProps> {
125
138
  tabindex: 0
126
139
  },
127
140
  selectionChange: (e) => {
128
- this.value = (e.selection as ListViewItem).id
141
+ let value = (e.selection as ListViewItem).id
142
+ if( this.m_props.selectValue ) {
143
+ value = this.m_props.selectValue( value );
144
+ }
145
+
146
+ this.value = value;
129
147
  if( !this.m_lockpop ) {
130
148
  this._hidePopup( );
131
149
  this.focus( );
@@ -2206,9 +2206,11 @@ export class Container<P extends ContainerProps = ContainerProps, E extends Cont
2206
2206
 
2207
2207
  private m_shortcuts: Shortcut[];
2208
2208
 
2209
- constructor( props: P | ComponentOrString[] ) {
2209
+ constructor( props: P );
2210
+ constructor( items: ComponentOrString[], cls?: string );
2211
+ constructor( props: P | ComponentOrString[], cls?: string ) {
2210
2212
  if( isArray(props) ) {
2211
- super( {content: props} as P );
2213
+ super( {content: props,cls} as P );
2212
2214
  }
2213
2215
  else {
2214
2216
  super( props );
@@ -38,12 +38,12 @@ export type CalcCallback = () => string;
38
38
  export type FieldType = 'string' | 'int' | 'float' | 'date' | 'bool' | 'array' | 'object' | 'any' | 'calc';
39
39
  export type DataIndex = Uint32Array;
40
40
 
41
- interface EvDataChange extends BasicEvent {
41
+ export interface EvDataChange extends BasicEvent {
42
42
  type: string;
43
43
  id: any;
44
44
  }
45
45
 
46
- function EvDataChange( type: 'create' | 'update' | 'delete' | 'data' | 'change', id?: any ) {
46
+ export function EvDataChange( type: 'create' | 'update' | 'delete' | 'data' | 'change', id?: any ) {
47
47
  return BasicEvent<EvDataChange>( { type, id } );
48
48
  }
49
49
 
package/lib/src/input.ts CHANGED
@@ -84,7 +84,7 @@ export class Input extends Component<InputProps,InputEventMap>
84
84
  placeholder: props.placeHolder,
85
85
  autofocus: props.autoFocus,
86
86
  readonly: props.readOnly,
87
- autocomplete: 'new-password', // chrome ignore 'off' but not something else than 'on'
87
+ autocomplete: 'off', // chrome ignore 'off' but not something else than 'on'
88
88
  tabIndex: props.tabIndex,
89
89
  spellcheck: props.spellcheck===false ? 'false' : undefined,
90
90
  min: props.min,
@@ -27,4 +27,4 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- export const x4js_version = "1.5.25";
30
+ export const x4js_version = "1.5.27";
@@ -30,7 +30,7 @@ import { EvMessage } from './x4events';
30
30
  import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component';
31
31
  import { Component } from './component';
32
32
  import { Settings } from './settings';
33
- import { Router } from 'x4js';
33
+ import { Router } from './router';
34
34
  interface ApplicationEventMap extends BaseComponentEventMap {
35
35
  message: EvMessage;
36
36
  global: EvMessage;
@@ -31,7 +31,8 @@ import { TextEdit, TextEditProps } from './textedit';
31
31
  *
32
32
  */
33
33
  interface AutoCompleteProps extends TextEditProps {
34
- enumValues: (filter: string) => string[];
34
+ enumValues: (filter: string) => string[] | Promise<string[]>;
35
+ selectValue?: (text: string) => string;
35
36
  }
36
37
  /**
37
38
  *
@@ -584,7 +584,8 @@ export interface ContainerProps<E extends ContainerEventMap = ContainerEventMap>
584
584
  */
585
585
  export declare class Container<P extends ContainerProps = ContainerProps, E extends ContainerEventMap = ContainerEventMap> extends Component<P, E> {
586
586
  private m_shortcuts;
587
- constructor(props: P | ComponentOrString[]);
587
+ constructor(props: P);
588
+ constructor(items: ComponentOrString[], cls?: string);
588
589
  /**
589
590
  * add an application shortcut
590
591
  * @param sequence key sequence Shift+Ctrl+Alt+K
@@ -32,11 +32,11 @@ export type ChangeCallback = (type: string, id?: any) => void;
32
32
  export type CalcCallback = () => string;
33
33
  export type FieldType = 'string' | 'int' | 'float' | 'date' | 'bool' | 'array' | 'object' | 'any' | 'calc';
34
34
  export type DataIndex = Uint32Array;
35
- interface EvDataChange extends BasicEvent {
35
+ export interface EvDataChange extends BasicEvent {
36
36
  type: string;
37
37
  id: any;
38
38
  }
39
- declare function EvDataChange(type: 'create' | 'update' | 'delete' | 'data' | 'change', id?: any): EvDataChange;
39
+ export declare function EvDataChange(type: 'create' | 'update' | 'delete' | 'data' | 'change', id?: any): EvDataChange;
40
40
  /**
41
41
  * fields definition
42
42
  * field with index=0 is record id
@@ -26,4 +26,4 @@
26
26
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
- export declare const x4js_version = "1.5.25";
29
+ export declare const x4js_version = "1.5.27";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.5.25",
3
+ "version": "1.5.27",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",