x4js 1.5.31 → 1.5.33
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 -9
- package/lib/cjs/index.js.map +3 -3
- package/lib/esm/index.mjs +81 -52
- package/lib/esm/index.mjs.map +2 -2
- package/lib/src/calendar.ts +1 -1
- package/lib/src/combobox.ts +1 -1
- package/lib/src/component.ts +27 -15
- package/lib/src/datastore.ts +48 -60
- package/lib/src/icon.ts +19 -0
- package/lib/src/input.ts +13 -5
- package/lib/src/menu.ts +1 -1
- package/lib/src/sidebarview.ts +6 -1
- package/lib/src/svgcomponent.ts +22 -12
- package/lib/src/version.ts +1 -1
- package/lib/types/component.d.ts +2 -2
- package/lib/types/datastore.d.ts +29 -29
- package/lib/types/icon.d.ts +7 -0
- package/lib/types/sidebarview.d.ts +2 -0
- package/lib/types/svgcomponent.d.ts +11 -10
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/types/datastore.d.ts
CHANGED
|
@@ -216,16 +216,16 @@ export interface DataProxyProps extends BaseComponentProps<DataEventMap> {
|
|
|
216
216
|
}
|
|
217
217
|
export declare class DataProxy extends BaseComponent<DataProxyProps, DataEventMap> {
|
|
218
218
|
constructor(props: DataProxyProps);
|
|
219
|
-
load(url?: string): void
|
|
220
|
-
private _refresh;
|
|
219
|
+
load(url?: string): Promise<void>;
|
|
221
220
|
}
|
|
222
221
|
/**
|
|
223
222
|
*
|
|
224
223
|
*/
|
|
225
|
-
interface DataStoreProps extends BaseComponentProps<DataStoreEventMap> {
|
|
226
|
-
model:
|
|
227
|
-
data?:
|
|
224
|
+
interface DataStoreProps<T extends Record> extends BaseComponentProps<DataStoreEventMap> {
|
|
225
|
+
model: T;
|
|
226
|
+
data?: T[];
|
|
228
227
|
url?: string;
|
|
228
|
+
autoload?: false;
|
|
229
229
|
}
|
|
230
230
|
interface DataStoreEventMap extends EventMap {
|
|
231
231
|
data_change: EvDataChange;
|
|
@@ -233,19 +233,19 @@ interface DataStoreEventMap extends EventMap {
|
|
|
233
233
|
/**
|
|
234
234
|
*
|
|
235
235
|
*/
|
|
236
|
-
export declare class DataStore extends EventSource<DataStoreEventMap> {
|
|
237
|
-
protected m_model:
|
|
236
|
+
export declare class DataStore<T extends Record = Record> extends EventSource<DataStoreEventMap> {
|
|
237
|
+
protected m_model: T;
|
|
238
238
|
protected m_fields: FieldInfo[];
|
|
239
|
-
protected m_records:
|
|
239
|
+
protected m_records: T[];
|
|
240
240
|
protected m_proxy: DataProxy;
|
|
241
241
|
protected m_rec_index: DataIndex;
|
|
242
|
-
constructor(props: DataStoreProps);
|
|
242
|
+
constructor(props: DataStoreProps<T>);
|
|
243
243
|
/**
|
|
244
244
|
*
|
|
245
245
|
* @param records
|
|
246
246
|
*/
|
|
247
|
-
load(url?: string): void
|
|
248
|
-
reload(): void
|
|
247
|
+
load(url?: string): Promise<void>;
|
|
248
|
+
reload(): Promise<void>;
|
|
249
249
|
/**
|
|
250
250
|
* convert raw objects to real records from model
|
|
251
251
|
* @param records
|
|
@@ -255,17 +255,17 @@ export declare class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
255
255
|
* just set the records
|
|
256
256
|
* @param records - must be of the same type as model
|
|
257
257
|
*/
|
|
258
|
-
setRawData(records:
|
|
258
|
+
setRawData(records: T[]): void;
|
|
259
259
|
private _rebuildIndex;
|
|
260
260
|
/**
|
|
261
261
|
*
|
|
262
262
|
*/
|
|
263
|
-
update(rec:
|
|
263
|
+
update(rec: T): boolean;
|
|
264
264
|
/**
|
|
265
265
|
*
|
|
266
266
|
* @param data
|
|
267
267
|
*/
|
|
268
|
-
append(rec:
|
|
268
|
+
append(rec: T | any): void;
|
|
269
269
|
/**
|
|
270
270
|
*
|
|
271
271
|
*/
|
|
@@ -291,19 +291,19 @@ export declare class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
291
291
|
* return the record by it's id
|
|
292
292
|
* @returns record or null
|
|
293
293
|
*/
|
|
294
|
-
getById(id: any):
|
|
294
|
+
getById(id: any): T;
|
|
295
295
|
/**
|
|
296
296
|
* return a record by it's index
|
|
297
297
|
* @returns record or null
|
|
298
298
|
*/
|
|
299
|
-
getByIndex(index: number):
|
|
299
|
+
getByIndex(index: number): T;
|
|
300
300
|
private _getRecord;
|
|
301
|
-
moveTo(other: DataStore): void;
|
|
301
|
+
moveTo(other: DataStore<T>): void;
|
|
302
302
|
/**
|
|
303
303
|
* create a new view on the DataStore
|
|
304
304
|
* @param opts
|
|
305
305
|
*/
|
|
306
|
-
createView(opts?: DataViewProps): DataView
|
|
306
|
+
createView(opts?: DataViewProps<T>): DataView<T>;
|
|
307
307
|
/**
|
|
308
308
|
*
|
|
309
309
|
*/
|
|
@@ -312,8 +312,8 @@ export declare class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
312
312
|
/**
|
|
313
313
|
*
|
|
314
314
|
*/
|
|
315
|
-
forEach(cb: (rec:
|
|
316
|
-
export():
|
|
315
|
+
forEach(cb: (rec: T, index: number) => any): void;
|
|
316
|
+
export(): T[];
|
|
317
317
|
changed(): void;
|
|
318
318
|
}
|
|
319
319
|
export interface EvViewChange extends BasicEvent {
|
|
@@ -323,8 +323,8 @@ export declare function EvViewChange(action: 'filter' | 'sort' | 'change'): EvVi
|
|
|
323
323
|
interface DataViewEventMap extends BaseComponentEventMap {
|
|
324
324
|
view_change: EvViewChange;
|
|
325
325
|
}
|
|
326
|
-
interface DataViewProps extends BaseComponentProps<DataViewEventMap> {
|
|
327
|
-
store?: DataStore
|
|
326
|
+
interface DataViewProps<T extends Record> extends BaseComponentProps<DataViewEventMap> {
|
|
327
|
+
store?: DataStore<T>;
|
|
328
328
|
filter?: FilterInfo;
|
|
329
329
|
order?: string | SortProp[] | SortProp;
|
|
330
330
|
}
|
|
@@ -344,12 +344,12 @@ export interface SortProp {
|
|
|
344
344
|
* You can sort the columns & filter data
|
|
345
345
|
* You can have multiple views for a single DataStore
|
|
346
346
|
*/
|
|
347
|
-
export declare class DataView extends BaseComponent<DataViewProps
|
|
347
|
+
export declare class DataView<T extends Record = Record> extends BaseComponent<DataViewProps<T>, DataViewEventMap> {
|
|
348
348
|
protected m_index: DataIndex;
|
|
349
|
-
protected m_store: DataStore
|
|
349
|
+
protected m_store: DataStore<T>;
|
|
350
350
|
protected m_sort: SortProp[];
|
|
351
351
|
protected m_filter: FilterInfo;
|
|
352
|
-
constructor(props: DataViewProps);
|
|
352
|
+
constructor(props: DataViewProps<T>);
|
|
353
353
|
private _storeChange;
|
|
354
354
|
/**
|
|
355
355
|
*
|
|
@@ -367,7 +367,7 @@ export declare class DataView extends BaseComponent<DataViewProps, DataViewEvent
|
|
|
367
367
|
/**
|
|
368
368
|
*
|
|
369
369
|
*/
|
|
370
|
-
get store(): DataStore
|
|
370
|
+
get store(): DataStore<T>;
|
|
371
371
|
/**
|
|
372
372
|
*
|
|
373
373
|
*/
|
|
@@ -381,16 +381,16 @@ export declare class DataView extends BaseComponent<DataViewProps, DataViewEvent
|
|
|
381
381
|
*
|
|
382
382
|
* @param index
|
|
383
383
|
*/
|
|
384
|
-
getByIndex(index: number):
|
|
384
|
+
getByIndex(index: number): T;
|
|
385
385
|
/**
|
|
386
386
|
*
|
|
387
387
|
* @param id
|
|
388
388
|
*/
|
|
389
|
-
getById(id: any):
|
|
389
|
+
getById(id: any): T;
|
|
390
390
|
changed(): void;
|
|
391
391
|
/**
|
|
392
392
|
*
|
|
393
393
|
*/
|
|
394
|
-
forEach(cb: (rec:
|
|
394
|
+
forEach(cb: (rec: T, index: number) => any): void;
|
|
395
395
|
}
|
|
396
396
|
export {};
|
package/lib/types/icon.d.ts
CHANGED
|
@@ -28,6 +28,13 @@
|
|
|
28
28
|
**/
|
|
29
29
|
import { Component, CProps } from './component';
|
|
30
30
|
import { BasicEvent } from './x4events';
|
|
31
|
+
/**
|
|
32
|
+
* iconID can be:
|
|
33
|
+
* - "url( <path to image> )" ex: "url(my/path/to/my/image.svg)"
|
|
34
|
+
* - "var( <css variable> )"
|
|
35
|
+
* - "cls( <font class> )"
|
|
36
|
+
* - "char( <character> )" ex: "font-char( \uf00d )"
|
|
37
|
+
*/
|
|
31
38
|
export type IconID = string | number;
|
|
32
39
|
export interface IconProps extends CProps {
|
|
33
40
|
icon: IconID;
|
|
@@ -29,11 +29,13 @@
|
|
|
29
29
|
import { Component } from './component';
|
|
30
30
|
import { VLayout } from './layout';
|
|
31
31
|
import { CardView, CardViewProps, ICardViewItem } from './cardview';
|
|
32
|
+
import { Image } from './image';
|
|
32
33
|
export interface SideBarItem extends ICardViewItem {
|
|
33
34
|
}
|
|
34
35
|
export interface SideBarProps extends CardViewProps {
|
|
35
36
|
bar_sizable?: boolean;
|
|
36
37
|
bar_width?: number;
|
|
38
|
+
logo?: Image;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
*
|
|
@@ -30,7 +30,7 @@ import { Component, CProps } from './component';
|
|
|
30
30
|
/**
|
|
31
31
|
*
|
|
32
32
|
*/
|
|
33
|
-
declare abstract class SVGItem {
|
|
33
|
+
export declare abstract class SVGItem {
|
|
34
34
|
private m_tag;
|
|
35
35
|
private m_attrs;
|
|
36
36
|
private m_style;
|
|
@@ -87,18 +87,18 @@ declare abstract class SVGItem {
|
|
|
87
87
|
/**
|
|
88
88
|
*
|
|
89
89
|
*/
|
|
90
|
-
transform(tr: string):
|
|
90
|
+
transform(tr: string): this;
|
|
91
91
|
/**
|
|
92
92
|
*
|
|
93
93
|
*/
|
|
94
|
-
rotate(deg: number, cx: number, cy: number):
|
|
95
|
-
translate(dx: number, dy: number):
|
|
96
|
-
scale(x: number):
|
|
94
|
+
rotate(deg: number, cx: number, cy: number): this;
|
|
95
|
+
translate(dx: number, dy: number): this;
|
|
96
|
+
scale(x: number): this;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
*
|
|
100
100
|
*/
|
|
101
|
-
declare class SVGPath extends SVGItem {
|
|
101
|
+
export declare class SVGPath extends SVGItem {
|
|
102
102
|
private m_path;
|
|
103
103
|
constructor();
|
|
104
104
|
renderAttrs(): string;
|
|
@@ -134,7 +134,7 @@ declare class SVGPath extends SVGItem {
|
|
|
134
134
|
/**
|
|
135
135
|
*
|
|
136
136
|
*/
|
|
137
|
-
declare class SVGText extends SVGItem {
|
|
137
|
+
export declare class SVGText extends SVGItem {
|
|
138
138
|
private m_text;
|
|
139
139
|
constructor(x: number, y: number, txt: string);
|
|
140
140
|
font(font: string): this;
|
|
@@ -147,14 +147,14 @@ declare class SVGText extends SVGItem {
|
|
|
147
147
|
/**
|
|
148
148
|
*
|
|
149
149
|
*/
|
|
150
|
-
declare class SVGShape extends SVGItem {
|
|
150
|
+
export declare class SVGShape extends SVGItem {
|
|
151
151
|
constructor(tag: string);
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
*
|
|
155
155
|
*/
|
|
156
156
|
type number_or_perc = number | `${string}%`;
|
|
157
|
-
declare class SVGGradient extends SVGItem {
|
|
157
|
+
export declare class SVGGradient extends SVGItem {
|
|
158
158
|
private static g_id;
|
|
159
159
|
private m_id;
|
|
160
160
|
private m_stops;
|
|
@@ -166,13 +166,14 @@ declare class SVGGradient extends SVGItem {
|
|
|
166
166
|
/**
|
|
167
167
|
*
|
|
168
168
|
*/
|
|
169
|
-
declare class SVGGroup extends SVGItem {
|
|
169
|
+
export declare class SVGGroup extends SVGItem {
|
|
170
170
|
protected m_items: SVGItem[];
|
|
171
171
|
constructor(tag?: string);
|
|
172
172
|
path(): SVGPath;
|
|
173
173
|
text(x: any, y: any, txt: any): SVGText;
|
|
174
174
|
ellipse(x: any, y: any, r1: any, r2?: any): SVGShape;
|
|
175
175
|
rect(x: any, y: any, w: any, h: any): SVGShape;
|
|
176
|
+
group(): SVGGroup;
|
|
176
177
|
/**
|
|
177
178
|
*
|
|
178
179
|
* example
|
package/lib/types/version.d.ts
CHANGED