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.
- package/lib/cjs/index.js +9 -41
- package/lib/cjs/index.js.map +4 -4
- package/lib/esm/index.js.map +7 -0
- package/lib/esm/index.mjs +1083 -48143
- package/lib/esm/index.mjs.map +4 -4
- package/lib/src/application.ts +1 -1
- package/lib/src/autocomplete.ts +22 -4
- package/lib/src/component.ts +4 -2
- package/lib/src/datastore.ts +2 -2
- package/lib/src/input.ts +1 -1
- package/lib/src/version.ts +1 -1
- package/lib/types/application.d.ts +1 -1
- package/lib/types/autocomplete.d.ts +2 -1
- package/lib/types/component.d.ts +2 -1
- package/lib/types/datastore.d.ts +2 -2
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/src/application.ts
CHANGED
|
@@ -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 '
|
|
36
|
+
import { Router } from './router'
|
|
37
37
|
|
|
38
38
|
const _x4_touch_time = Symbol( );
|
|
39
39
|
|
package/lib/src/autocomplete.ts
CHANGED
|
@@ -35,7 +35,11 @@ import { TextEdit, TextEditProps } from './textedit';
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
interface AutoCompleteProps extends TextEditProps {
|
|
38
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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( );
|
package/lib/src/component.ts
CHANGED
|
@@ -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
|
|
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 );
|
package/lib/src/datastore.ts
CHANGED
|
@@ -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: '
|
|
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,
|
package/lib/src/version.ts
CHANGED
|
@@ -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 '
|
|
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
|
*
|
package/lib/types/component.d.ts
CHANGED
|
@@ -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
|
|
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
|
package/lib/types/datastore.d.ts
CHANGED
|
@@ -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
|
package/lib/types/version.d.ts
CHANGED