jpf-mobx 1.0.6 → 1.0.8
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/dist/controls/custom/LabeledControl/LabeledControl.d.ts +8 -8
- package/dist/controls/custom/LabeledControl/LabeledControl.js +8 -8
- package/dist/controls/custom/LabeledControl/LabeledControl.js.map +1 -1
- package/dist/controls/html/Div/Div.d.ts +7 -7
- package/dist/controls/html/Div/Div.js +5 -5
- package/dist/controls/html/Div/Div.js.map +1 -1
- package/dist/controls/html/Image/Image.d.ts +6 -6
- package/dist/controls/html/Image/Image.js +7 -7
- package/dist/controls/html/Image/Image.js.map +1 -1
- package/dist/controls/html/Span/Span.d.ts +6 -6
- package/dist/controls/html/Span/Span.js +8 -8
- package/dist/controls/html/Span/Span.js.map +1 -1
- package/dist/controls/kendo/Grid/Grid.d.ts +54 -0
- package/dist/controls/kendo/Grid/Grid.js +211 -0
- package/dist/controls/kendo/Grid/Grid.js.map +1 -1
- package/dist/controls/leaflet/LabelControl/LabelControl.d.ts +3 -3
- package/dist/controls/leaflet/LabelControl/LabelControl.js +4 -4
- package/dist/controls/leaflet/LabelControl/LabelControl.js.map +1 -1
- package/dist/framework/element.d.ts +62 -0
- package/dist/framework/element.js +150 -0
- package/dist/framework/element.js.map +1 -0
- package/dist/framework/observable.d.ts +20 -5
- package/dist/framework/observable.js +51 -4
- package/dist/framework/observable.js.map +1 -1
- package/dist/framework/properties.d.ts +41 -0
- package/dist/framework/properties.js +261 -0
- package/dist/framework/properties.js.map +1 -0
- package/dist/framework/root.d.ts +9 -0
- package/dist/framework/root.js +38 -0
- package/dist/framework/root.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/controls/codeMirror/HtmlEditor/HtmlEditor.ts +3 -4
- package/src/controls/custom/LabeledControl/LabeledControl.ts +12 -12
- package/src/controls/html/Div/Div.ts +8 -8
- package/src/controls/html/Image/Image.ts +10 -10
- package/src/controls/html/Span/Span.ts +11 -11
- package/src/controls/kendo/Grid/Grid.ts +354 -289
- package/src/controls/kendo/ObservableObject/ObservableObject.ts +2 -2
- package/src/controls/leaflet/LabelControl/LabelControl.ts +7 -7
- package/src/framework/{View.ts → element.ts} +22 -26
- package/src/framework/observable.ts +91 -10
- package/src/framework/{ViewModel.ts → properties.ts} +11 -46
- package/src/framework/root.ts +45 -0
- package/src/index.ts +3 -2
- package/src/utilities/index.ts +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export interface LabeledViewProperties extends
|
|
1
|
+
import { Properties, IProperties } from "../../../framework/properties";
|
|
2
|
+
import { Element, IElement } from "../../../framework/element";
|
|
3
|
+
export interface LabeledViewProperties extends IProperties {
|
|
4
4
|
labelProperties: Properties;
|
|
5
|
-
|
|
5
|
+
element: IElement;
|
|
6
6
|
}
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class LabeledControlElement extends Element<LabeledViewProperties> {
|
|
8
8
|
constructor(properties: LabeledViewProperties);
|
|
9
9
|
}
|
|
10
|
-
export declare function labeledControlView(properties: LabeledViewProperties):
|
|
11
|
-
export declare class
|
|
10
|
+
export declare function labeledControlView(properties: LabeledViewProperties): LabeledControlElement;
|
|
11
|
+
export declare class LabeledControlProperties extends Properties implements LabeledViewProperties {
|
|
12
12
|
constructor(properties: LabeledViewProperties);
|
|
13
13
|
labelProperties: Properties;
|
|
14
|
-
|
|
14
|
+
element: IElement;
|
|
15
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Properties, extendProperties } from "../../../framework/properties";
|
|
2
|
+
import { Element, registerElement } from "../../../framework/element";
|
|
3
3
|
import { DivView } from "../../html/Div/Div";
|
|
4
|
-
export class
|
|
4
|
+
export class LabeledControlElement extends Element {
|
|
5
5
|
constructor(properties) {
|
|
6
6
|
super({
|
|
7
7
|
tagName: "div",
|
|
@@ -17,21 +17,21 @@ export class LabeledControlView extends View {
|
|
|
17
17
|
new DivView(extendProperties(properties.labelProperties, {
|
|
18
18
|
viewType: "Label"
|
|
19
19
|
})),
|
|
20
|
-
properties.
|
|
20
|
+
properties.element
|
|
21
21
|
]
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
export function labeledControlView(properties) {
|
|
26
|
-
return new
|
|
26
|
+
return new LabeledControlElement(properties);
|
|
27
27
|
}
|
|
28
|
-
export class
|
|
28
|
+
export class LabeledControlProperties extends Properties {
|
|
29
29
|
constructor(properties) {
|
|
30
30
|
super();
|
|
31
31
|
this.setProperties(this, properties);
|
|
32
32
|
}
|
|
33
33
|
labelProperties;
|
|
34
|
-
|
|
34
|
+
element;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
registerElement(LabeledControlProperties, LabeledControlElement);
|
|
37
37
|
//# sourceMappingURL=LabeledControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabeledControl.js","sourceRoot":"","sources":["../../../../src/controls/custom/LabeledControl/LabeledControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"LabeledControl.js","sourceRoot":"","sources":["../../../../src/controls/custom/LabeledControl/LabeledControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AACzF,OAAO,EAAE,OAAO,EAAY,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAO7C,MAAM,OAAO,qBAAsB,SAAQ,OAA8B;IACrE,YAAY,UAAiC;QACzC,KAAK,CACD;YACI,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,gBAAgB,CACxB;gBACI,QAAQ,EAAE,gBAAgB;gBAC1B,KAAK,EAAE;oBACH,OAAO,EAAE,MAAM;oBACf,UAAU,EAAE,QAAQ;iBACvB;gBACD,UAAU,EAAE,CAAC,kBAAkB,CAAC;aACnC,EACD,UAAU,CACb;YACD,QAAQ,EAAE;gBACN,IAAI,OAAO,CACP,gBAAgB,CACZ,UAAU,CAAC,eAAe,EAC1B;oBACI,QAAQ,EAAE,OAAO;iBACpB,CACJ,CACJ;gBACD,UAAU,CAAC,OAAO;aACrB;SACJ,CACJ,CAAC;IACN,CAAC;CACJ;AAED,MAAM,UAAU,kBAAkB,CAAC,UAAiC;IAChE,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IACpD,YAAY,UAAiC;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACzC,CAAC;IACD,eAAe,CAAa;IAC5B,OAAO,CAAW;CACrB;AAED,eAAe,CACX,wBAAwB,EACxB,qBAAqB,CACxB,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Element, IElement } from "../../../framework/element";
|
|
2
|
+
import { IProperties, Properties } from "../../../framework/properties";
|
|
3
3
|
import { Subscribable } from "../../../framework/observable";
|
|
4
|
-
export interface DivProperties extends
|
|
5
|
-
children?: Array<
|
|
4
|
+
export interface DivProperties extends IProperties {
|
|
5
|
+
children?: Array<IElement> | Subscribable<Array<IElement>>;
|
|
6
6
|
}
|
|
7
|
-
export declare class DivView extends
|
|
7
|
+
export declare class DivView extends Element<DivProperties> {
|
|
8
8
|
constructor(properties: DivProperties);
|
|
9
9
|
}
|
|
10
10
|
export declare function divView(properties: DivProperties): DivView;
|
|
11
|
-
export declare class DivViewModel extends
|
|
11
|
+
export declare class DivViewModel extends Properties implements DivProperties {
|
|
12
12
|
constructor(properties: DivProperties);
|
|
13
|
-
children?: Array<
|
|
13
|
+
children?: Array<IElement> | Subscribable<Array<IElement>>;
|
|
14
14
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { extendProperties,
|
|
3
|
-
export class DivView extends
|
|
1
|
+
import { Element, registerElement } from "../../../framework/element";
|
|
2
|
+
import { extendProperties, Properties } from "../../../framework/properties";
|
|
3
|
+
export class DivView extends Element {
|
|
4
4
|
constructor(properties) {
|
|
5
5
|
super({
|
|
6
6
|
tagName: "div",
|
|
@@ -14,12 +14,12 @@ export class DivView extends View {
|
|
|
14
14
|
export function divView(properties) {
|
|
15
15
|
return new DivView(properties);
|
|
16
16
|
}
|
|
17
|
-
export class DivViewModel extends
|
|
17
|
+
export class DivViewModel extends Properties {
|
|
18
18
|
constructor(properties) {
|
|
19
19
|
super();
|
|
20
20
|
this.setProperties(this, properties);
|
|
21
21
|
}
|
|
22
22
|
children;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
registerElement(DivViewModel, DivView);
|
|
25
25
|
//# sourceMappingURL=Div.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Div.js","sourceRoot":"","sources":["../../../../src/controls/html/Div/Div.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Div.js","sourceRoot":"","sources":["../../../../src/controls/html/Div/Div.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAgB,gBAAgB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAO3F,MAAM,OAAO,OAAQ,SAAQ,OAAsB;IAC/C,YAAY,UAAyB;QACjC,KAAK,CACD;YACI,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,gBAAgB,CACxB;gBACI,QAAQ,EAAE,KAAK;aAClB,EACD,UAAU,CACb;YACD,QAAQ,EAAE,UAAU,CAAC,QAAQ;SAChC,CACJ,CAAC;IACN,CAAC;CACJ;AAED,MAAM,UAAU,OAAO,CAAC,UAAyB;IAC7C,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,OAAO,YAAa,SAAQ,UAAU;IACxC,YAAY,UAAyB;QACjC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACzC,CAAC;IACD,QAAQ,CAAmD;CAC9D;AAED,eAAe,CACX,YAAY,EACZ,OAAO,CACV,CAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Element } from "../../../framework/element";
|
|
2
|
+
import { Properties, IProperties } from "../../../framework/properties";
|
|
3
3
|
import { Subscribable } from "../../../framework/observable";
|
|
4
|
-
export interface ImageProperties extends
|
|
4
|
+
export interface ImageProperties extends IProperties {
|
|
5
5
|
src: string | Subscribable<string>;
|
|
6
6
|
alt: string | Subscribable<string>;
|
|
7
7
|
}
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class ImageElement extends Element<ImageProperties> {
|
|
9
9
|
constructor(properties: ImageProperties);
|
|
10
10
|
}
|
|
11
|
-
export declare function
|
|
12
|
-
export declare class
|
|
11
|
+
export declare function imageElement(properties: ImageProperties): ImageElement;
|
|
12
|
+
export declare class ImageProperties extends Properties implements ImageProperties {
|
|
13
13
|
constructor(properties: ImageProperties);
|
|
14
14
|
src: string | Subscribable<string>;
|
|
15
15
|
alt: string | Subscribable<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export class
|
|
1
|
+
import { Element, registerElement } from "../../../framework/element";
|
|
2
|
+
import { Properties, extendProperties } from "../../../framework/properties";
|
|
3
|
+
export class ImageElement extends Element {
|
|
4
4
|
constructor(properties) {
|
|
5
5
|
super({
|
|
6
6
|
tagName: "img",
|
|
@@ -14,10 +14,10 @@ export class ImageView extends View {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
export function
|
|
18
|
-
return new
|
|
17
|
+
export function imageElement(properties) {
|
|
18
|
+
return new ImageElement(properties);
|
|
19
19
|
}
|
|
20
|
-
export class
|
|
20
|
+
export class ImageProperties extends Properties {
|
|
21
21
|
constructor(properties) {
|
|
22
22
|
super();
|
|
23
23
|
this.setProperties(this, properties);
|
|
@@ -25,5 +25,5 @@ export class ImageViewModel extends ViewModel {
|
|
|
25
25
|
src;
|
|
26
26
|
alt;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
registerElement(ImageProperties, ImageElement);
|
|
29
29
|
//# sourceMappingURL=Image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../../../src/controls/html/Image/Image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../../../src/controls/html/Image/Image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAQ1F,MAAM,OAAO,YAAa,SAAQ,OAAwB;IACtD,YAAY,UAA2B;QACnC,KAAK,CACD;YACI,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,gBAAgB,CACxB;gBACI,QAAQ,EAAE,OAAO;gBACjB,UAAU,EAAE;oBACR,GAAG,EAAE,UAAU,CAAC,GAAG;oBACnB,GAAG,EAAE,UAAU,CAAC,GAAG;iBACtB;aACJ,EACD,UAAU,CACb;SACJ,CACJ,CAAC;IACN,CAAC;CACJ;AAED,MAAM,UAAU,YAAY,CAAC,UAA2B;IACpD,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAC3C,YAAY,UAA2B;QACnC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACzC,CAAC;IACD,GAAG,CAAgC;IACnC,GAAG,CAAgC;CACtC;AAED,eAAe,CACX,eAAe,EACf,YAAY,CACf,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export interface SpanProperties extends
|
|
1
|
+
import { Element } from "../../../framework/element";
|
|
2
|
+
import { Properties, IProperties } from "../../../framework/properties";
|
|
3
|
+
export interface SpanProperties extends IProperties {
|
|
4
4
|
}
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class SpanElement extends Element<SpanProperties> {
|
|
6
6
|
constructor(properties: SpanProperties);
|
|
7
7
|
}
|
|
8
|
-
export declare function
|
|
9
|
-
export declare class
|
|
8
|
+
export declare function spanElement(properties: SpanProperties): SpanElement;
|
|
9
|
+
export declare class SpanProperties extends Properties implements SpanProperties {
|
|
10
10
|
constructor(properties: SpanProperties);
|
|
11
11
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export class
|
|
1
|
+
import { Element, registerElement } from "../../../framework/element";
|
|
2
|
+
import { Properties, extendProperties } from "../../../framework/properties";
|
|
3
|
+
export class SpanElement extends Element {
|
|
4
4
|
constructor(properties) {
|
|
5
5
|
super({
|
|
6
6
|
tagName: "span",
|
|
7
7
|
properties: extendProperties({
|
|
8
|
-
|
|
8
|
+
elementType: "Span"
|
|
9
9
|
}, properties)
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
export function
|
|
14
|
-
return new
|
|
13
|
+
export function spanElement(properties) {
|
|
14
|
+
return new SpanElement(properties);
|
|
15
15
|
}
|
|
16
|
-
export class
|
|
16
|
+
export class SpanProperties extends Properties {
|
|
17
17
|
constructor(properties) {
|
|
18
18
|
super();
|
|
19
19
|
this.setProperties(this, properties);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
registerElement(SpanProperties, SpanElement);
|
|
23
23
|
//# sourceMappingURL=Span.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Span.js","sourceRoot":"","sources":["../../../../src/controls/html/Span/Span.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Span.js","sourceRoot":"","sources":["../../../../src/controls/html/Span/Span.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAM1F,MAAM,OAAO,WAAY,SAAQ,OAAuB;IACpD,YAAY,UAA0B;QAClC,KAAK,CACD;YACI,OAAO,EAAE,MAAM;YACf,UAAU,EAAE,gBAAgB,CACxB;gBACI,WAAW,EAAE,MAAM;aACtB,EACD,UAAU,CACb;SACJ,CACJ,CAAC;IACN,CAAC;CACJ;AAED,MAAM,UAAU,WAAW,CAAC,UAA0B;IAClD,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC1C,YAAY,UAA0B;QAClC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACzC,CAAC;CACJ;AAED,eAAe,CACX,cAAc,EACd,WAAW,CACd,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as kendo from "@progress/kendo-ui/js/kendo.grid.js";
|
|
2
|
+
import { Element } from "../../../framework/element";
|
|
3
|
+
import { Properties } from "../../../framework/properties";
|
|
4
|
+
import { Subscribable } from "../../../framework/observable";
|
|
5
|
+
import { ChangedItem } from "../DataSource/DataSource";
|
|
6
|
+
export interface GridProperties<TItem> extends Properties {
|
|
7
|
+
items?: Array<TItem> | Subscribable<Array<TItem>>;
|
|
8
|
+
idProperty?: keyof TItem;
|
|
9
|
+
columns?: Array<kendo.ui.GridColumn>;
|
|
10
|
+
pageSize?: number;
|
|
11
|
+
sortable?: boolean | kendo.ui.GridSortable;
|
|
12
|
+
scrollable?: kendo.ui.GridScrollable;
|
|
13
|
+
editable?: kendo.ui.GridEditable;
|
|
14
|
+
filterable?: boolean | kendo.ui.GridFilterable | Subscribable<boolean | kendo.ui.GridFilterable>;
|
|
15
|
+
toolbar?: string | Array<string>;
|
|
16
|
+
selectable?: boolean | string;
|
|
17
|
+
selectedItem?: TItem | Subscribable<TItem>;
|
|
18
|
+
selectedItems?: Array<TItem> | Subscribable<Array<TItem>>;
|
|
19
|
+
onDataSourceChange?: (items: Array<ChangedItem>, dataSource: kendo.data.DataSource) => void;
|
|
20
|
+
onDataSourceAdd?: (items: Array<ChangedItem>, dataSource: kendo.data.DataSource) => void;
|
|
21
|
+
onDataSourceRemove?: (items: Array<ChangedItem>, dataSource: kendo.data.DataSource) => void;
|
|
22
|
+
onGridChange?: (selectedItems: Array<any>, grid: kendo.ui.Grid) => void;
|
|
23
|
+
onRowContextMenu?: (event: PointerEvent, dataItem: any) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare class GridElement<TItem = any> extends Element<GridProperties<TItem>> {
|
|
26
|
+
constructor(properties: GridProperties<TItem>);
|
|
27
|
+
private grid;
|
|
28
|
+
private dataSource;
|
|
29
|
+
private getItemById;
|
|
30
|
+
build(): void;
|
|
31
|
+
}
|
|
32
|
+
export declare function gridElement<TItem>(properties: GridProperties<TItem>): GridElement<TItem>;
|
|
33
|
+
export declare function getSelectedDataItem<TDataItem>(grid: kendo.ui.Grid): TDataItem;
|
|
34
|
+
export declare function getSelectedDataItems<TItem>(grid: kendo.ui.Grid): Array<TItem>;
|
|
35
|
+
export declare class GridProperties<TItem = any> extends Properties implements GridProperties<TItem> {
|
|
36
|
+
constructor(properties: GridProperties<TItem>);
|
|
37
|
+
items?: Array<TItem> | Subscribable<Array<TItem>>;
|
|
38
|
+
idProperty?: keyof TItem;
|
|
39
|
+
columns?: Array<kendo.ui.GridColumn>;
|
|
40
|
+
pageSize?: number;
|
|
41
|
+
sortable?: boolean | kendo.ui.GridSortable;
|
|
42
|
+
scrollable?: kendo.ui.GridScrollable;
|
|
43
|
+
editable?: kendo.ui.GridEditable;
|
|
44
|
+
filterable?: boolean | kendo.ui.GridFilterable | Subscribable<boolean | kendo.ui.GridFilterable>;
|
|
45
|
+
toolbar?: string | Array<string>;
|
|
46
|
+
selectable?: boolean | string;
|
|
47
|
+
selectedItem?: TItem | Subscribable<TItem>;
|
|
48
|
+
selectedItems?: Array<TItem> | Subscribable<Array<TItem>>;
|
|
49
|
+
onDataSourceChange?: (items: Array<ChangedItem>, dataSource: kendo.data.DataSource) => void;
|
|
50
|
+
onDataSourceAdd?: (items: Array<ChangedItem>, dataSource: kendo.data.DataSource) => void;
|
|
51
|
+
onDataSourceRemove?: (items: Array<ChangedItem>, dataSource: kendo.data.DataSource) => void;
|
|
52
|
+
onGridChange?: (selectedItems: Array<any>, grid: kendo.ui.Grid) => void;
|
|
53
|
+
onRowContextMenu?: (event: PointerEvent, dataItem: any) => void;
|
|
54
|
+
}
|
|
@@ -1 +1,212 @@
|
|
|
1
|
+
import * as kendo from "@progress/kendo-ui/js/kendo.grid.js";
|
|
2
|
+
import { Element, registerElement } from "../../../framework/element";
|
|
3
|
+
import { Properties, extendProperties } from "../../../framework/properties";
|
|
4
|
+
import { unwrap, isSubscribable, reaction } from "../../../framework/observable";
|
|
5
|
+
export class GridElement extends Element {
|
|
6
|
+
constructor(properties) {
|
|
7
|
+
super({
|
|
8
|
+
tagName: "div",
|
|
9
|
+
properties: extendProperties({
|
|
10
|
+
viewType: "KendoGrid"
|
|
11
|
+
}, properties)
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
grid;
|
|
15
|
+
dataSource;
|
|
16
|
+
getItemById(id) {
|
|
17
|
+
if (this.properties.idProperty) {
|
|
18
|
+
const items = this.dataSource.data();
|
|
19
|
+
return items.find((item) => {
|
|
20
|
+
return item[this.properties.idProperty] === id;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
throw "Can only getItem when idProperty is set";
|
|
24
|
+
}
|
|
25
|
+
build() {
|
|
26
|
+
super.build();
|
|
27
|
+
const properties = this.properties;
|
|
28
|
+
this.dataSource = new kendo.data.DataSource({
|
|
29
|
+
data: unwrap(properties.items),
|
|
30
|
+
pageSize: this.properties.pageSize || 30,
|
|
31
|
+
change: (event) => {
|
|
32
|
+
var items = event.items;
|
|
33
|
+
switch (event.action) {
|
|
34
|
+
case "itemchange":
|
|
35
|
+
if (properties.onDataSourceChange) {
|
|
36
|
+
properties.onDataSourceChange(items, event.sender);
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
case "add":
|
|
40
|
+
if (properties.onDataSourceAdd) {
|
|
41
|
+
properties.onDataSourceAdd(items, event.sender);
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case "remove":
|
|
45
|
+
if (properties.onDataSourceRemove) {
|
|
46
|
+
properties.onDataSourceRemove(items, event.sender);
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
this.grid = new kendo.ui.Grid(this.element, {
|
|
53
|
+
dataSource: this.dataSource,
|
|
54
|
+
columns: this.properties.columns,
|
|
55
|
+
toolbar: this.properties.toolbar,
|
|
56
|
+
scrollable: this.properties.scrollable,
|
|
57
|
+
sortable: this.properties.sortable,
|
|
58
|
+
editable: this.properties.editable,
|
|
59
|
+
filterable: unwrap(this.properties.filterable),
|
|
60
|
+
change: (event) => {
|
|
61
|
+
if (this.properties.selectedItem) {
|
|
62
|
+
const selectedItem = getSelectedDataItem(event.sender);
|
|
63
|
+
const observableProperty = this.properties.selectedItem;
|
|
64
|
+
if (observableProperty.set) {
|
|
65
|
+
observableProperty.set(selectedItem);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (this.properties.selectedItems) {
|
|
69
|
+
}
|
|
70
|
+
if (this.properties.onGridChange) {
|
|
71
|
+
this.properties.onGridChange(getSelectedDataItems(event.sender), event.sender);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
selectable: this.properties.selectable
|
|
75
|
+
});
|
|
76
|
+
if (properties.onRowContextMenu) {
|
|
77
|
+
this.grid.table.contextmenu((event) => {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
var target = event.target;
|
|
80
|
+
var row;
|
|
81
|
+
if (target instanceof HTMLElement) {
|
|
82
|
+
switch (target.tagName.toLowerCase()) {
|
|
83
|
+
case "td":
|
|
84
|
+
row = target.parentElement;
|
|
85
|
+
break;
|
|
86
|
+
case "tr":
|
|
87
|
+
row = target;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (row) {
|
|
92
|
+
let dataItem = this.grid.dataItem(row);
|
|
93
|
+
if (dataItem) {
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
properties.onRowContextMenu(event, dataItem);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (isSubscribable(properties.items)) {
|
|
103
|
+
this.disposers.push(reaction(() => {
|
|
104
|
+
return unwrap(properties.items);
|
|
105
|
+
}, (items) => {
|
|
106
|
+
if (items) {
|
|
107
|
+
this.dataSource.data(items);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.dataSource.data([]);
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
if (isSubscribable(properties.filterable)) {
|
|
115
|
+
this.disposers.push(reaction(() => {
|
|
116
|
+
return unwrap(properties.filterable);
|
|
117
|
+
}, (filterable) => {
|
|
118
|
+
this.grid.setOptions({ filterable: filterable });
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
if (isSubscribable(properties.selectedItem)) {
|
|
122
|
+
this.disposers.push(reaction(() => {
|
|
123
|
+
return unwrap(properties.selectedItem);
|
|
124
|
+
}, (selectedItem) => {
|
|
125
|
+
if (selectedItem && properties.idProperty) {
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
const id = selectedItem[properties.idProperty];
|
|
128
|
+
const item = this.getItemById(id);
|
|
129
|
+
this.grid.clearSelection();
|
|
130
|
+
this.grid.tbody.find("tr[data-uid='" + item.uid + "']").addClass("k-state-selected");
|
|
131
|
+
}, 10);
|
|
132
|
+
}
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
if (isSubscribable(properties.selectedItems)) {
|
|
136
|
+
this.disposers.push(reaction(() => {
|
|
137
|
+
return unwrap(properties.selectedItems);
|
|
138
|
+
}, (selectedItems) => {
|
|
139
|
+
if (selectedItems && selectedItems.length > 0 && properties.idProperty) {
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
this.grid.clearSelection();
|
|
142
|
+
for (let index = 0; index < selectedItems.length; index++) {
|
|
143
|
+
const selectedItem = selectedItems[index];
|
|
144
|
+
const id = selectedItem[properties.idProperty];
|
|
145
|
+
const item = this.getItemById(id);
|
|
146
|
+
this.grid.tbody.find("tr[data-uid='" + item.uid + "']").addClass("k-state-selected");
|
|
147
|
+
}
|
|
148
|
+
}, 10);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.grid.select();
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
setTimeout(() => {
|
|
156
|
+
this.grid.resize(true);
|
|
157
|
+
}, 5);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
export function gridElement(properties) {
|
|
161
|
+
return new GridElement(properties);
|
|
162
|
+
}
|
|
163
|
+
export function getSelectedDataItem(grid) {
|
|
164
|
+
const selection = grid.select();
|
|
165
|
+
if (selection.length === 1) {
|
|
166
|
+
const dataItem = grid.dataItem(selection[0]);
|
|
167
|
+
return dataItem.toJSON();
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
export function getSelectedDataItems(grid) {
|
|
172
|
+
const selection = grid.select();
|
|
173
|
+
const selectedDataItems = new Array();
|
|
174
|
+
if (selection && selection.length > 0) {
|
|
175
|
+
for (let index = 0; index < selection.length; index++) {
|
|
176
|
+
const dataItem = grid.dataItem(selection[index]);
|
|
177
|
+
const underlyingObject = null;
|
|
178
|
+
if (underlyingObject) {
|
|
179
|
+
selectedDataItems.push(underlyingObject);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
selectedDataItems.push(dataItem.toJSON());
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return selectedDataItems;
|
|
187
|
+
}
|
|
188
|
+
export class GridProperties extends Properties {
|
|
189
|
+
constructor(properties) {
|
|
190
|
+
super();
|
|
191
|
+
this.setProperties(this, properties);
|
|
192
|
+
}
|
|
193
|
+
items;
|
|
194
|
+
idProperty;
|
|
195
|
+
columns;
|
|
196
|
+
pageSize;
|
|
197
|
+
sortable;
|
|
198
|
+
scrollable;
|
|
199
|
+
editable;
|
|
200
|
+
filterable;
|
|
201
|
+
toolbar;
|
|
202
|
+
selectable;
|
|
203
|
+
selectedItem;
|
|
204
|
+
selectedItems;
|
|
205
|
+
onDataSourceChange;
|
|
206
|
+
onDataSourceAdd;
|
|
207
|
+
onDataSourceRemove;
|
|
208
|
+
onGridChange;
|
|
209
|
+
onRowContextMenu;
|
|
210
|
+
}
|
|
211
|
+
registerElement(GridProperties, GridElement);
|
|
1
212
|
//# sourceMappingURL=Grid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../../../src/controls/kendo/Grid/Grid.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../../../src/controls/kendo/Grid/Grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE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,CAAU;IAClB,QAAQ,CAAmC;IAC3C,UAAU,CAA2B;IACrC,QAAQ,CAAyB;IACjC,UAAU,CAAuF;IACjG,OAAO,CAA0B;IACjC,UAAU,CAAoB;IAC9B,YAAY,CAA+B;IAC3C,aAAa,CAA6C;IAC1D,kBAAkB,CAA0E;IAC5F,eAAe,CAA0E;IACzF,kBAAkB,CAA0E;IAC5F,YAAY,CAA4D;IACxE,gBAAgB,CAAgD;CACnE;AAED,eAAe,CACX,cAAc,EACd,WAAW,CACd,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as leaflet from "leaflet";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { IElement } from "../../../framework/element";
|
|
3
|
+
import { Properties } from "../../../framework/properties";
|
|
4
4
|
export interface LeafletLabelControlOptions extends leaflet.ControlOptions {
|
|
5
|
-
content: string |
|
|
5
|
+
content: string | IElement | Properties;
|
|
6
6
|
}
|
|
7
7
|
export declare class LeafletLabelControl extends leaflet.Control {
|
|
8
8
|
constructor(options: LeafletLabelControlOptions);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as leaflet from "leaflet";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getElement } from "../../../framework/element";
|
|
3
|
+
import { Properties } from "../../../framework/properties";
|
|
4
4
|
export class LeafletLabelControl extends leaflet.Control {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super(options);
|
|
@@ -10,8 +10,8 @@ export class LeafletLabelControl extends leaflet.Control {
|
|
|
10
10
|
onAdd(map) {
|
|
11
11
|
const div = document.createElement("div");
|
|
12
12
|
let view;
|
|
13
|
-
if (this.content instanceof
|
|
14
|
-
view =
|
|
13
|
+
if (this.content instanceof Properties) {
|
|
14
|
+
view = getElement(this.content);
|
|
15
15
|
if (view) {
|
|
16
16
|
div.appendChild(view.render());
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabelControl.js","sourceRoot":"","sources":["../../../../src/controls/leaflet/LabelControl/LabelControl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"LabelControl.js","sourceRoot":"","sources":["../../../../src/controls/leaflet/LabelControl/LabelControl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAY,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAM3D,MAAM,OAAO,mBAAoB,SAAQ,OAAO,CAAC,OAAO;IACpD,YAAY,OAAmC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACnC,CAAC;IAEgB,OAAO,CAAiC;IAEzD,KAAK,CAAC,GAAgB;QAClB,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE1C,IAAI,IAAI,CAAC;QACT,IAAI,IAAI,CAAC,OAAO,YAAY,UAAU,EAAE;YACpC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAChC,IAAI,IAAI,EAAE;gBACN,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aAClC;SACJ;aAAM,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE;YACzC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;SAChC;aAAM;YACH,IAAI,GAAG,IAAI,CAAC,OAAmB,CAAC;YAChC,IAAI,IAAI,CAAC,MAAM,EAAE;gBACb,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aAClC;SACJ;QAED,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAmC;IACnE,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import "tocca";
|
|
2
|
+
import { Subscribable } from "./observable";
|
|
3
|
+
import { Properties } from "./properties";
|
|
4
|
+
import { IReactionDisposer } from "mobx";
|
|
5
|
+
declare const htmlTags: {
|
|
6
|
+
a: boolean;
|
|
7
|
+
div: boolean;
|
|
8
|
+
img: boolean;
|
|
9
|
+
pre: boolean;
|
|
10
|
+
form: boolean;
|
|
11
|
+
span: boolean;
|
|
12
|
+
input: boolean;
|
|
13
|
+
button: boolean;
|
|
14
|
+
select: boolean;
|
|
15
|
+
textarea: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare const svgTags: {
|
|
18
|
+
g: boolean;
|
|
19
|
+
svg: boolean;
|
|
20
|
+
rect: boolean;
|
|
21
|
+
text: boolean;
|
|
22
|
+
line: boolean;
|
|
23
|
+
title: boolean;
|
|
24
|
+
circle: boolean;
|
|
25
|
+
pattern: boolean;
|
|
26
|
+
ellipse: boolean;
|
|
27
|
+
polygon: boolean;
|
|
28
|
+
polyline: boolean;
|
|
29
|
+
foreignObject: boolean;
|
|
30
|
+
};
|
|
31
|
+
type TagName = keyof typeof htmlTags | keyof typeof svgTags;
|
|
32
|
+
export interface IElement {
|
|
33
|
+
render(): HTMLElement;
|
|
34
|
+
dispose(): void;
|
|
35
|
+
}
|
|
36
|
+
export interface ElementOptions<TProperties> {
|
|
37
|
+
tagName: TagName;
|
|
38
|
+
properties?: TProperties;
|
|
39
|
+
children?: Array<IElement> | Subscribable<Array<IElement>>;
|
|
40
|
+
}
|
|
41
|
+
export declare class Element<TProperties = any> implements IElement {
|
|
42
|
+
constructor(properties: ElementOptions<TProperties>);
|
|
43
|
+
private readonly tagName;
|
|
44
|
+
private readonly optionsChildren;
|
|
45
|
+
private children;
|
|
46
|
+
private buildChildren;
|
|
47
|
+
protected element: HTMLElement;
|
|
48
|
+
protected readonly properties: TProperties;
|
|
49
|
+
protected readonly disposers: IReactionDisposer[];
|
|
50
|
+
protected build(): void;
|
|
51
|
+
protected remove(): void;
|
|
52
|
+
protected addChild(child: IElement): Element<TProperties>;
|
|
53
|
+
protected setChildren(...children: Array<IElement>): Element<TProperties>;
|
|
54
|
+
protected empty(): void;
|
|
55
|
+
render(): HTMLElement;
|
|
56
|
+
dispose(): void;
|
|
57
|
+
focus(options?: FocusOptions): void;
|
|
58
|
+
}
|
|
59
|
+
export declare function registerElement(viewModel: any, view: any): void;
|
|
60
|
+
export declare function getElement(viewModel: Properties): Element;
|
|
61
|
+
export declare function render(viewModel: Properties): HTMLElement;
|
|
62
|
+
export {};
|