x4js 1.5.31 → 1.5.32
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 +68 -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/input.ts +13 -5
- package/lib/src/menu.ts +1 -1
- package/lib/src/sidebarview.ts +6 -1
- package/lib/src/svgcomponent.ts +16 -6
- 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/sidebarview.d.ts +2 -0
- package/lib/types/svgcomponent.d.ts +5 -4
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/src/calendar.ts
CHANGED
|
@@ -241,7 +241,7 @@ export class Calendar extends VLayout<CalendarProps, CalendarEventMap>
|
|
|
241
241
|
let min = this.m_props.minDate?.getFullYear() ?? 1900;
|
|
242
242
|
let max = this.m_props.maxDate?.getFullYear() ?? 2037;
|
|
243
243
|
|
|
244
|
-
for (let m =
|
|
244
|
+
for (let m = max; m >= min; m--) {
|
|
245
245
|
items.push(new MenuItem({
|
|
246
246
|
text: '' + m,
|
|
247
247
|
click: () => { this.m_date.setFullYear(m); this.update(); }
|
package/lib/src/combobox.ts
CHANGED
package/lib/src/component.ts
CHANGED
|
@@ -170,8 +170,13 @@ export interface CProps<T extends CEventMap = CEventMap> extends BaseComponentPr
|
|
|
170
170
|
enabled?: boolean; // add @disabled to the element if false
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
interface DomListener {
|
|
174
|
+
listener: EventListener,
|
|
175
|
+
passive?: boolean
|
|
176
|
+
}
|
|
177
|
+
|
|
173
178
|
interface CInternalProps {
|
|
174
|
-
dom_events:
|
|
179
|
+
dom_events: Record<string,DomListener[]>;
|
|
175
180
|
classes: IMap<boolean>;
|
|
176
181
|
uid: number;
|
|
177
182
|
created: boolean;
|
|
@@ -205,6 +210,7 @@ export class Component<P extends CProps<CEventMap> = CProps<CEventMap>, E extend
|
|
|
205
210
|
dom_events: {},
|
|
206
211
|
uid: Component.__comp_guid++,
|
|
207
212
|
inrender: false,
|
|
213
|
+
created: false,
|
|
208
214
|
};
|
|
209
215
|
|
|
210
216
|
// prepare iprops
|
|
@@ -538,11 +544,12 @@ export class Component<P extends CProps<CEventMap> = CProps<CEventMap>, E extend
|
|
|
538
544
|
return this.m_dom.getAttribute(name);
|
|
539
545
|
}
|
|
540
546
|
else {
|
|
541
|
-
|
|
542
|
-
|
|
547
|
+
//todo move to attrs
|
|
548
|
+
if( name=='id' ) {
|
|
549
|
+
return this.m_props.id;
|
|
543
550
|
}
|
|
544
551
|
|
|
545
|
-
return this.m_props.attrs[name];
|
|
552
|
+
return this.m_props.attrs ? this.m_props.attrs[name] : undefined;
|
|
546
553
|
}
|
|
547
554
|
}
|
|
548
555
|
|
|
@@ -844,7 +851,7 @@ export class Component<P extends CProps<CEventMap> = CProps<CEventMap>, E extend
|
|
|
844
851
|
for (let e in evt) {
|
|
845
852
|
let handlers = evt[e];
|
|
846
853
|
for (let h of handlers) {
|
|
847
|
-
this.
|
|
854
|
+
this._createEvent(e, h.listener, h.passive );
|
|
848
855
|
}
|
|
849
856
|
}
|
|
850
857
|
}
|
|
@@ -1109,12 +1116,12 @@ export class Component<P extends CProps<CEventMap> = CProps<CEventMap>, E extend
|
|
|
1109
1116
|
* this.setDomEvent( 'dblclick', this._handleDblClick, this );
|
|
1110
1117
|
*/
|
|
1111
1118
|
|
|
1112
|
-
public setDomEvent<K extends keyof X4ElementEventMap>(type: K, listener: (this: HTMLDivElement, ev: X4ElementEventMap[K]) => void) {
|
|
1119
|
+
public setDomEvent<K extends keyof X4ElementEventMap>(type: K, listener: (this: HTMLDivElement, ev: X4ElementEventMap[K]) => void, passive?: boolean ) {
|
|
1113
1120
|
let _listener = listener as EventListener;
|
|
1114
|
-
this._setDomEvent(type as string, _listener);
|
|
1121
|
+
this._setDomEvent(type as string, _listener, passive);
|
|
1115
1122
|
}
|
|
1116
1123
|
|
|
1117
|
-
private _setDomEvent(type: string, listener: EventListener) {
|
|
1124
|
+
private _setDomEvent(type: string, listener: EventListener, passive?: boolean) {
|
|
1118
1125
|
|
|
1119
1126
|
// add event to the vdom
|
|
1120
1127
|
if (!this.m_iprops.dom_events) {
|
|
@@ -1123,15 +1130,15 @@ export class Component<P extends CProps<CEventMap> = CProps<CEventMap>, E extend
|
|
|
1123
1130
|
|
|
1124
1131
|
let listeners = this.m_iprops.dom_events[type];
|
|
1125
1132
|
if (!listeners) {
|
|
1126
|
-
listeners = this.m_iprops.dom_events[type] = [listener];
|
|
1133
|
+
listeners = this.m_iprops.dom_events[type] = [{listener,passive}];
|
|
1127
1134
|
}
|
|
1128
1135
|
else {
|
|
1129
|
-
listeners.push(listener);
|
|
1136
|
+
listeners.push({listener,passive});
|
|
1130
1137
|
}
|
|
1131
1138
|
|
|
1132
1139
|
if (this.m_dom) {
|
|
1133
1140
|
//this.m_dom.addEventListener(type, listener);
|
|
1134
|
-
this.
|
|
1141
|
+
this._createEvent(type, listener,passive);
|
|
1135
1142
|
}
|
|
1136
1143
|
}
|
|
1137
1144
|
|
|
@@ -1161,7 +1168,7 @@ export class Component<P extends CProps<CEventMap> = CProps<CEventMap>, E extend
|
|
|
1161
1168
|
* @param handler
|
|
1162
1169
|
*/
|
|
1163
1170
|
|
|
1164
|
-
|
|
1171
|
+
private _createEvent(name: string, handler: Function, passive?: boolean) {
|
|
1165
1172
|
|
|
1166
1173
|
let _dom = this.m_dom;
|
|
1167
1174
|
let store = _dom[_x4_el_store];
|
|
@@ -1185,11 +1192,16 @@ export class Component<P extends CProps<CEventMap> = CProps<CEventMap>, E extend
|
|
|
1185
1192
|
else if (!Component.__privateEvents[name]) {
|
|
1186
1193
|
Component.__privateEvents[name] = true; // todo count it
|
|
1187
1194
|
|
|
1188
|
-
if
|
|
1189
|
-
|
|
1195
|
+
if( passive===undefined ) {
|
|
1196
|
+
if ( passiveEvents[name] ) {
|
|
1197
|
+
x4document.addEventListener(name as any, Component._dispatchEvent, { passive: false, capture: true });
|
|
1198
|
+
}
|
|
1199
|
+
else {
|
|
1200
|
+
x4document.addEventListener(name as any, Component._dispatchEvent, true);
|
|
1201
|
+
}
|
|
1190
1202
|
}
|
|
1191
1203
|
else {
|
|
1192
|
-
x4document.addEventListener(name as any, Component._dispatchEvent, true);
|
|
1204
|
+
x4document.addEventListener(name as any, Component._dispatchEvent, { passive, capture: passive ? true : false } );
|
|
1193
1205
|
}
|
|
1194
1206
|
}
|
|
1195
1207
|
|
package/lib/src/datastore.ts
CHANGED
|
@@ -572,41 +572,28 @@ export class DataProxy extends BaseComponent<DataProxyProps,DataEventMap> {
|
|
|
572
572
|
super( props );
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
-
load( url?: string ) {
|
|
575
|
+
async load( url?: string ) {
|
|
576
576
|
if( url ) {
|
|
577
577
|
this.m_props.url = url;
|
|
578
578
|
}
|
|
579
|
+
else {
|
|
580
|
+
url = this.m_props.url;
|
|
581
|
+
}
|
|
579
582
|
|
|
580
|
-
this.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
private _refresh( delay: number = 0 ) {
|
|
584
|
-
|
|
585
|
-
const load = async ( ) => {
|
|
586
|
-
|
|
587
|
-
let url = this.m_props.url;
|
|
588
|
-
if( this.m_props.params ) {
|
|
589
|
-
url += '?' + this.m_props.params.join( '&' );
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
const r = await fetch( url );
|
|
593
|
-
if( r.ok ) {
|
|
594
|
-
const raw = await r.json( );
|
|
595
|
-
|
|
596
|
-
let json = raw;
|
|
597
|
-
if( this.m_props.solver ) {
|
|
598
|
-
json = this.m_props.solver( json );
|
|
599
|
-
}
|
|
583
|
+
if( this.m_props.params ) {
|
|
584
|
+
url += '?' + this.m_props.params.join( '&' );
|
|
585
|
+
}
|
|
600
586
|
|
|
601
|
-
|
|
587
|
+
const r = await fetch( url );
|
|
588
|
+
if( r.ok ) {
|
|
589
|
+
const raw = await r.json( );
|
|
590
|
+
|
|
591
|
+
let json = raw;
|
|
592
|
+
if( this.m_props.solver ) {
|
|
593
|
+
json = this.m_props.solver( json );
|
|
602
594
|
}
|
|
603
|
-
}
|
|
604
595
|
|
|
605
|
-
|
|
606
|
-
setTimeout( load, delay );
|
|
607
|
-
}
|
|
608
|
-
else {
|
|
609
|
-
load( );
|
|
596
|
+
this.emit( 'change', EvChange(json,raw) );
|
|
610
597
|
}
|
|
611
598
|
}
|
|
612
599
|
}
|
|
@@ -616,10 +603,11 @@ export class DataProxy extends BaseComponent<DataProxyProps,DataEventMap> {
|
|
|
616
603
|
*
|
|
617
604
|
*/
|
|
618
605
|
|
|
619
|
-
interface DataStoreProps extends BaseComponentProps<DataStoreEventMap> {
|
|
620
|
-
model:
|
|
621
|
-
data?:
|
|
606
|
+
interface DataStoreProps<T extends Record> extends BaseComponentProps<DataStoreEventMap> {
|
|
607
|
+
model: T;
|
|
608
|
+
data?: T[];
|
|
622
609
|
url?: string;
|
|
610
|
+
autoload?: false;
|
|
623
611
|
}
|
|
624
612
|
|
|
625
613
|
|
|
@@ -633,16 +621,16 @@ interface DataStoreEventMap extends EventMap {
|
|
|
633
621
|
*
|
|
634
622
|
*/
|
|
635
623
|
|
|
636
|
-
export class DataStore extends EventSource<DataStoreEventMap> {
|
|
624
|
+
export class DataStore<T extends Record = Record> extends EventSource<DataStoreEventMap> {
|
|
637
625
|
|
|
638
|
-
protected m_model:
|
|
626
|
+
protected m_model: T;
|
|
639
627
|
protected m_fields: FieldInfo[];
|
|
640
|
-
protected m_records:
|
|
628
|
+
protected m_records: T[];
|
|
641
629
|
|
|
642
630
|
protected m_proxy: DataProxy;
|
|
643
631
|
protected m_rec_index: DataIndex;
|
|
644
632
|
|
|
645
|
-
constructor(props: DataStoreProps) {
|
|
633
|
+
constructor(props: DataStoreProps<T> ) {
|
|
646
634
|
super( );
|
|
647
635
|
|
|
648
636
|
this.m_fields = undefined;
|
|
@@ -661,7 +649,9 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
661
649
|
events: { change: (ev) => { this.setData( ev.value ); } }
|
|
662
650
|
});
|
|
663
651
|
|
|
664
|
-
|
|
652
|
+
if( props.autoload!=false ) {
|
|
653
|
+
this.m_proxy.load( );
|
|
654
|
+
}
|
|
665
655
|
}
|
|
666
656
|
}
|
|
667
657
|
|
|
@@ -670,12 +660,12 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
670
660
|
* @param records
|
|
671
661
|
*/
|
|
672
662
|
|
|
673
|
-
load( url?: string ) {
|
|
674
|
-
this.m_proxy.load( url );
|
|
663
|
+
async load( url?: string ) {
|
|
664
|
+
return this.m_proxy.load( url );
|
|
675
665
|
}
|
|
676
666
|
|
|
677
|
-
reload( ) {
|
|
678
|
-
this.m_proxy.load( );
|
|
667
|
+
async reload( ) {
|
|
668
|
+
return this.m_proxy.load( );
|
|
679
669
|
}
|
|
680
670
|
|
|
681
671
|
/**
|
|
@@ -685,7 +675,7 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
685
675
|
|
|
686
676
|
public setData( records: any[] ) {
|
|
687
677
|
|
|
688
|
-
let realRecords:
|
|
678
|
+
let realRecords: T[] = [];
|
|
689
679
|
|
|
690
680
|
records.forEach( (rec) => {
|
|
691
681
|
realRecords.push( this.m_model.clone(rec) );
|
|
@@ -699,7 +689,7 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
699
689
|
* @param records - must be of the same type as model
|
|
700
690
|
*/
|
|
701
691
|
|
|
702
|
-
public setRawData(records:
|
|
692
|
+
public setRawData(records: T[]) {
|
|
703
693
|
|
|
704
694
|
this.m_records = records;
|
|
705
695
|
this._rebuildIndex( );
|
|
@@ -717,7 +707,7 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
717
707
|
*
|
|
718
708
|
*/
|
|
719
709
|
|
|
720
|
-
public update( rec:
|
|
710
|
+
public update( rec: T ) {
|
|
721
711
|
let id = rec.getID();
|
|
722
712
|
let index = this.indexOfId(id);
|
|
723
713
|
if (index < 0) {
|
|
@@ -734,7 +724,7 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
734
724
|
* @param data
|
|
735
725
|
*/
|
|
736
726
|
|
|
737
|
-
public append( rec:
|
|
727
|
+
public append( rec: T | any ) {
|
|
738
728
|
|
|
739
729
|
if( !(rec instanceof Record) ) {
|
|
740
730
|
let nrec = this.m_model.clone( );
|
|
@@ -835,7 +825,7 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
835
825
|
* @returns record or null
|
|
836
826
|
*/
|
|
837
827
|
|
|
838
|
-
public getById(id: any):
|
|
828
|
+
public getById(id: any): T {
|
|
839
829
|
let idx = this.indexOfId( id );
|
|
840
830
|
if( idx<0 ) {
|
|
841
831
|
return null;
|
|
@@ -850,16 +840,16 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
850
840
|
* @returns record or null
|
|
851
841
|
*/
|
|
852
842
|
|
|
853
|
-
public getByIndex( index: number ):
|
|
843
|
+
public getByIndex( index: number ): T {
|
|
854
844
|
let idx = this.m_rec_index[index];
|
|
855
845
|
return this._getRecord( idx );
|
|
856
846
|
}
|
|
857
847
|
|
|
858
|
-
private _getRecord( index: number ) :
|
|
848
|
+
private _getRecord( index: number ) : T {
|
|
859
849
|
return this.m_records[index] ?? null;
|
|
860
850
|
}
|
|
861
851
|
|
|
862
|
-
public moveTo( other: DataStore ) {
|
|
852
|
+
public moveTo( other: DataStore<T> ) {
|
|
863
853
|
other.setRawData( this.m_records );
|
|
864
854
|
}
|
|
865
855
|
|
|
@@ -868,7 +858,7 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
868
858
|
* @param opts
|
|
869
859
|
*/
|
|
870
860
|
|
|
871
|
-
createView( opts?: DataViewProps ) : DataView {
|
|
861
|
+
createView( opts?: DataViewProps<T> ) : DataView<T> {
|
|
872
862
|
let eopts = { ...opts, store: this };
|
|
873
863
|
return new DataView( eopts );
|
|
874
864
|
}
|
|
@@ -1074,7 +1064,7 @@ export class DataStore extends EventSource<DataStoreEventMap> {
|
|
|
1074
1064
|
*
|
|
1075
1065
|
*/
|
|
1076
1066
|
|
|
1077
|
-
forEach( cb: ( rec:
|
|
1067
|
+
forEach( cb: ( rec:T, index: number ) => any ) {
|
|
1078
1068
|
|
|
1079
1069
|
if( this.m_rec_index ) {
|
|
1080
1070
|
this.m_rec_index.some( (ri,index) => {
|
|
@@ -1118,8 +1108,8 @@ interface DataViewEventMap extends BaseComponentEventMap {
|
|
|
1118
1108
|
view_change: EvViewChange;
|
|
1119
1109
|
}
|
|
1120
1110
|
|
|
1121
|
-
interface DataViewProps extends BaseComponentProps<DataViewEventMap> {
|
|
1122
|
-
store?: DataStore
|
|
1111
|
+
interface DataViewProps<T extends Record> extends BaseComponentProps<DataViewEventMap> {
|
|
1112
|
+
store?: DataStore<T>;
|
|
1123
1113
|
filter?: FilterInfo;
|
|
1124
1114
|
order?: string | SortProp[] | SortProp;
|
|
1125
1115
|
}
|
|
@@ -1147,15 +1137,15 @@ export interface SortProp {
|
|
|
1147
1137
|
* You can have multiple views for a single DataStore
|
|
1148
1138
|
*/
|
|
1149
1139
|
|
|
1150
|
-
export class DataView extends BaseComponent<DataViewProps
|
|
1140
|
+
export class DataView<T extends Record = Record> extends BaseComponent<DataViewProps<T>,DataViewEventMap>
|
|
1151
1141
|
{
|
|
1152
1142
|
protected m_index: DataIndex;
|
|
1153
|
-
protected m_store: DataStore
|
|
1143
|
+
protected m_store: DataStore<T>;
|
|
1154
1144
|
|
|
1155
1145
|
protected m_sort: SortProp[];
|
|
1156
1146
|
protected m_filter: FilterInfo;
|
|
1157
1147
|
|
|
1158
|
-
constructor( props: DataViewProps ) {
|
|
1148
|
+
constructor( props: DataViewProps<T> ) {
|
|
1159
1149
|
super( props );
|
|
1160
1150
|
|
|
1161
1151
|
this.m_store = props.store;
|
|
@@ -1269,7 +1259,7 @@ export class DataView extends BaseComponent<DataViewProps,DataViewEventMap>
|
|
|
1269
1259
|
* @param index
|
|
1270
1260
|
*/
|
|
1271
1261
|
|
|
1272
|
-
public getByIndex(index: number):
|
|
1262
|
+
public getByIndex(index: number): T {
|
|
1273
1263
|
|
|
1274
1264
|
if (index >= 0 && index < this.m_index.length) {
|
|
1275
1265
|
let rid = this.m_index[index];
|
|
@@ -1284,7 +1274,7 @@ export class DataView extends BaseComponent<DataViewProps,DataViewEventMap>
|
|
|
1284
1274
|
* @param id
|
|
1285
1275
|
*/
|
|
1286
1276
|
|
|
1287
|
-
public getById( id: any):
|
|
1277
|
+
public getById( id: any): T {
|
|
1288
1278
|
return this.m_store.getById( id );
|
|
1289
1279
|
}
|
|
1290
1280
|
|
|
@@ -1296,9 +1286,7 @@ export class DataView extends BaseComponent<DataViewProps,DataViewEventMap>
|
|
|
1296
1286
|
*
|
|
1297
1287
|
*/
|
|
1298
1288
|
|
|
1299
|
-
forEach( cb: ( rec:
|
|
1300
|
-
|
|
1301
|
-
debugger;
|
|
1289
|
+
forEach( cb: ( rec:T, index: number ) => any ) {
|
|
1302
1290
|
this.m_index.some( ( index ) => {
|
|
1303
1291
|
let rec = this.m_store.getByIndex( index );
|
|
1304
1292
|
if( rec ) {
|
package/lib/src/input.ts
CHANGED
|
@@ -152,14 +152,16 @@ export class Input extends Component<InputProps,InputEventMap>
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
public getValue( ): string {
|
|
155
|
+
const dom = this.dom as HTMLInputElement;
|
|
156
|
+
|
|
155
157
|
if( this.dom ) {
|
|
156
|
-
this.m_props.value =
|
|
158
|
+
this.m_props.value = dom.value;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
if( this.m_props.uppercase ) {
|
|
160
162
|
let upper = this.m_props.value.toUpperCase( ); // todo: locale ?
|
|
161
|
-
if(
|
|
162
|
-
|
|
163
|
+
if( dom && upper!=this.m_props.value ) {
|
|
164
|
+
dom.value = upper; // update the input
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
this.m_props.value = upper;
|
|
@@ -194,8 +196,8 @@ export class Input extends Component<InputProps,InputEventMap>
|
|
|
194
196
|
let type = this.getAttribute('type');
|
|
195
197
|
if( type ) { type = type.toLowerCase( ); }
|
|
196
198
|
|
|
197
|
-
let value
|
|
198
|
-
|
|
199
|
+
let value;
|
|
200
|
+
const dom = this.dom as HTMLInputElement;
|
|
199
201
|
|
|
200
202
|
if( type === "file") {
|
|
201
203
|
value = [];
|
|
@@ -221,6 +223,12 @@ export class Input extends Component<InputProps,InputEventMap>
|
|
|
221
223
|
else if( type === 'date' ) {
|
|
222
224
|
debugger;
|
|
223
225
|
}
|
|
226
|
+
else if( type=='number' ) {
|
|
227
|
+
value = this.value;
|
|
228
|
+
if (value.indexOf(",") >= 0) {
|
|
229
|
+
value = value.replace(",", ".");
|
|
230
|
+
}
|
|
231
|
+
}
|
|
224
232
|
else {
|
|
225
233
|
value = this.value;
|
|
226
234
|
}
|
package/lib/src/menu.ts
CHANGED
|
@@ -329,7 +329,7 @@ export class MenuItem extends Component<MenuItemProps, MenuItemEventMap> {
|
|
|
329
329
|
// this.setAttribute( 'tabindex', '0' );
|
|
330
330
|
|
|
331
331
|
this.setContent([
|
|
332
|
-
icon
|
|
332
|
+
icon ? null : new Icon({ icon }),
|
|
333
333
|
new Label({ flex: 1, text }),
|
|
334
334
|
popIco
|
|
335
335
|
]);
|
package/lib/src/sidebarview.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { Component, CProps, Flex, Separator } from './component'
|
|
|
31
31
|
import { HLayout, VLayout } from './layout'
|
|
32
32
|
import { Button } from './button'
|
|
33
33
|
import { CardView, CardViewProps, ICardViewItem } from './cardview'
|
|
34
|
+
import { Image } from './image';
|
|
34
35
|
|
|
35
36
|
export interface SideBarItem extends ICardViewItem {
|
|
36
37
|
}
|
|
@@ -38,6 +39,7 @@ export interface SideBarItem extends ICardViewItem {
|
|
|
38
39
|
export interface SideBarProps extends CardViewProps {
|
|
39
40
|
bar_sizable?: boolean;
|
|
40
41
|
bar_width?: number;
|
|
42
|
+
logo?: Image;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -74,7 +76,10 @@ export class SideBarView extends CardView<SideBarProps> {
|
|
|
74
76
|
this.m_sidebar.setContent( new VLayout( {
|
|
75
77
|
flex: 1,
|
|
76
78
|
cls: 'content',
|
|
77
|
-
content:
|
|
79
|
+
content: [
|
|
80
|
+
this.m_props.logo,
|
|
81
|
+
...tabs
|
|
82
|
+
]
|
|
78
83
|
}) );
|
|
79
84
|
|
|
80
85
|
this.setContent( [
|
package/lib/src/svgcomponent.ts
CHANGED
|
@@ -135,7 +135,7 @@ abstract class SVGItem {
|
|
|
135
135
|
|
|
136
136
|
if (value === undefined || value==='' || value===undefined ) {
|
|
137
137
|
this.m_style.delete( name );
|
|
138
|
-
return;
|
|
138
|
+
return this;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
if (!_x4_unitless[name] && (isNumber(value) || reNumber.test(value))) {
|
|
@@ -204,7 +204,7 @@ abstract class SVGItem {
|
|
|
204
204
|
*
|
|
205
205
|
*/
|
|
206
206
|
|
|
207
|
-
clip( id: string ) {
|
|
207
|
+
clip( id: string ): this {
|
|
208
208
|
this.attr( "clip-path", `url(#${id})` );
|
|
209
209
|
return this;
|
|
210
210
|
}
|
|
@@ -213,24 +213,28 @@ abstract class SVGItem {
|
|
|
213
213
|
*
|
|
214
214
|
*/
|
|
215
215
|
|
|
216
|
-
transform( tr: string ) {
|
|
216
|
+
transform( tr: string ): this {
|
|
217
217
|
this.attr( "transform", tr );
|
|
218
|
+
return this;
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
/**
|
|
221
222
|
*
|
|
222
223
|
*/
|
|
223
224
|
|
|
224
|
-
rotate( deg: number, cx: number, cy: number ) {
|
|
225
|
+
rotate( deg: number, cx: number, cy: number ): this {
|
|
225
226
|
this.transform( `rotate( ${deg} ${cx} ${cy} )` );
|
|
227
|
+
return this;
|
|
226
228
|
}
|
|
227
229
|
|
|
228
|
-
translate( dx: number, dy: number ) {
|
|
230
|
+
translate( dx: number, dy: number ): this {
|
|
229
231
|
this.transform( `translate( ${dx} ${dy} )` );
|
|
232
|
+
return this;
|
|
230
233
|
}
|
|
231
234
|
|
|
232
|
-
scale( x: number ) {
|
|
235
|
+
scale( x: number ): this {
|
|
233
236
|
this.transform( `scale( ${x} )` );
|
|
237
|
+
return this;
|
|
234
238
|
}
|
|
235
239
|
}
|
|
236
240
|
|
|
@@ -471,6 +475,12 @@ class SVGGroup extends SVGItem {
|
|
|
471
475
|
return shape;
|
|
472
476
|
}
|
|
473
477
|
|
|
478
|
+
group( ) {
|
|
479
|
+
const group = new SVGGroup( );
|
|
480
|
+
this.m_items.push( group );
|
|
481
|
+
return group;
|
|
482
|
+
}
|
|
483
|
+
|
|
474
484
|
/**
|
|
475
485
|
*
|
|
476
486
|
* example
|
package/lib/src/version.ts
CHANGED
package/lib/types/component.d.ts
CHANGED
|
@@ -340,7 +340,7 @@ export declare class Component<P extends CProps<CEventMap> = CProps<CEventMap>,
|
|
|
340
340
|
* this.setDomEvent( 'drag drop', this._handleDrag, this );
|
|
341
341
|
* this.setDomEvent( 'dblclick', this._handleDblClick, this );
|
|
342
342
|
*/
|
|
343
|
-
setDomEvent<K extends keyof X4ElementEventMap>(type: K, listener: (this: HTMLDivElement, ev: X4ElementEventMap[K]) => void): void;
|
|
343
|
+
setDomEvent<K extends keyof X4ElementEventMap>(type: K, listener: (this: HTMLDivElement, ev: X4ElementEventMap[K]) => void, passive?: boolean): void;
|
|
344
344
|
private _setDomEvent;
|
|
345
345
|
/**
|
|
346
346
|
*
|
|
@@ -351,7 +351,7 @@ export declare class Component<P extends CProps<CEventMap> = CProps<CEventMap>,
|
|
|
351
351
|
* @param name
|
|
352
352
|
* @param handler
|
|
353
353
|
*/
|
|
354
|
-
|
|
354
|
+
private _createEvent;
|
|
355
355
|
/**
|
|
356
356
|
* dispatch a dom event to the appropriated component
|
|
357
357
|
* called by the system
|