@gisce/ooui 2.40.0-alpha.3 → 2.40.0
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/README.md +0 -2
- package/dist/WidgetFactory.d.ts.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/ooui.es.js +1056 -1245
- package/dist/ooui.es.js.map +1 -1
- package/package.json +1 -1
- package/src/WidgetFactory.ts +0 -4
- package/src/index.ts +0 -4
- package/dist/Icon.d.ts +0 -24
- package/dist/Icon.d.ts.map +0 -1
- package/dist/Kanban.d.ts +0 -80
- package/dist/Kanban.d.ts.map +0 -1
- package/src/Icon.ts +0 -59
- package/src/Kanban.ts +0 -285
- package/src/spec/Icon.spec.ts +0 -93
- package/src/spec/Kanban.spec.ts +0 -364
package/package.json
CHANGED
package/src/WidgetFactory.ts
CHANGED
|
@@ -25,7 +25,6 @@ import Separator from "./Separator";
|
|
|
25
25
|
import Reference from "./Reference";
|
|
26
26
|
import Binary from "./Binary";
|
|
27
27
|
import Image from "./Image";
|
|
28
|
-
import Icon from "./Icon";
|
|
29
28
|
import FiberGrid from "./FiberGrid";
|
|
30
29
|
import Timeline from "./Timeline";
|
|
31
30
|
import Indicator from "./Indicator";
|
|
@@ -142,9 +141,6 @@ class WidgetFactory {
|
|
|
142
141
|
case "image":
|
|
143
142
|
this._widgetClass = Image;
|
|
144
143
|
break;
|
|
145
|
-
case "icon":
|
|
146
|
-
this._widgetClass = Icon;
|
|
147
|
-
break;
|
|
148
144
|
case "fiber_grid":
|
|
149
145
|
this._widgetClass = FiberGrid;
|
|
150
146
|
break;
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Avatar from "./Avatar";
|
|
2
2
|
import Form from "./Form";
|
|
3
3
|
import Tree from "./Tree";
|
|
4
|
-
import Kanban from "./Kanban";
|
|
5
4
|
import Char from "./Char";
|
|
6
5
|
import Container from "./Container";
|
|
7
6
|
import ContainerWidget from "./ContainerWidget";
|
|
@@ -32,7 +31,6 @@ import ActionButtons from "./ActionButtons";
|
|
|
32
31
|
import Reference from "./Reference";
|
|
33
32
|
import Binary from "./Binary";
|
|
34
33
|
import Image from "./Image";
|
|
35
|
-
import Icon from "./Icon";
|
|
36
34
|
import { parseContext, parseContextFields } from "./helpers/contextParser";
|
|
37
35
|
import {
|
|
38
36
|
transformDomainForChildWidget,
|
|
@@ -88,7 +86,6 @@ export {
|
|
|
88
86
|
Widget,
|
|
89
87
|
Form,
|
|
90
88
|
Tree,
|
|
91
|
-
Kanban,
|
|
92
89
|
NewLine,
|
|
93
90
|
Boolean,
|
|
94
91
|
One2many,
|
|
@@ -114,7 +111,6 @@ export {
|
|
|
114
111
|
Reference,
|
|
115
112
|
Binary,
|
|
116
113
|
Image,
|
|
117
|
-
Icon,
|
|
118
114
|
parseContext,
|
|
119
115
|
parseContextFields,
|
|
120
116
|
transformDomainForChildWidget,
|
package/dist/Icon.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import Field from "./Field";
|
|
2
|
-
declare class Icon extends Field {
|
|
3
|
-
/**
|
|
4
|
-
* Icon name
|
|
5
|
-
*/
|
|
6
|
-
_name: string;
|
|
7
|
-
get name(): string;
|
|
8
|
-
set name(value: string);
|
|
9
|
-
/**
|
|
10
|
-
* Icon size
|
|
11
|
-
*/
|
|
12
|
-
_size: number;
|
|
13
|
-
get size(): number;
|
|
14
|
-
set size(value: number);
|
|
15
|
-
/**
|
|
16
|
-
* Icon color
|
|
17
|
-
*/
|
|
18
|
-
_color: string;
|
|
19
|
-
get color(): string;
|
|
20
|
-
set color(value: string);
|
|
21
|
-
constructor(props?: any);
|
|
22
|
-
}
|
|
23
|
-
export default Icon;
|
|
24
|
-
//# sourceMappingURL=Icon.d.ts.map
|
package/dist/Icon.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../src/Icon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,cAAM,IAAK,SAAQ,KAAK;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAM;IACnB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED;;OAEG;IACH,KAAK,EAAE,MAAM,CAAM;IACnB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED;;OAEG;IACH,MAAM,EAAE,MAAM,CAAM;IACpB,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;gBAEW,KAAK,CAAC,EAAE,GAAG;CAiBxB;AAED,eAAe,IAAI,CAAC"}
|
package/dist/Kanban.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import Widget from "./Widget";
|
|
2
|
-
import Button from "./Button";
|
|
3
|
-
export type KanbanField = Widget & {
|
|
4
|
-
sum?: string;
|
|
5
|
-
};
|
|
6
|
-
export type KanbanButton = Button & {
|
|
7
|
-
states?: string;
|
|
8
|
-
};
|
|
9
|
-
declare class Kanban {
|
|
10
|
-
/**
|
|
11
|
-
* Object containing fields specification of the kanban.
|
|
12
|
-
*/
|
|
13
|
-
_fields: any;
|
|
14
|
-
get fields(): any;
|
|
15
|
-
/**
|
|
16
|
-
* Array of field widgets to display in cards
|
|
17
|
-
*/
|
|
18
|
-
_card_fields: KanbanField[];
|
|
19
|
-
get card_fields(): KanbanField[];
|
|
20
|
-
/**
|
|
21
|
-
* Array of button widgets to display in cards
|
|
22
|
-
*/
|
|
23
|
-
_buttons: KanbanButton[];
|
|
24
|
-
get buttons(): KanbanButton[];
|
|
25
|
-
_string: string | null;
|
|
26
|
-
get string(): string | null;
|
|
27
|
-
/**
|
|
28
|
-
* Widget type
|
|
29
|
-
*/
|
|
30
|
-
_type: string;
|
|
31
|
-
get type(): string;
|
|
32
|
-
/**
|
|
33
|
-
* Field that defines the columns (e.g., "state")
|
|
34
|
-
*/
|
|
35
|
-
_column_field: string | null;
|
|
36
|
-
get column_field(): string | null;
|
|
37
|
-
/**
|
|
38
|
-
* Enable dragging cards between columns
|
|
39
|
-
*/
|
|
40
|
-
_drag: boolean;
|
|
41
|
-
get drag(): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Enable sorting cards within columns
|
|
44
|
-
*/
|
|
45
|
-
_sort: boolean;
|
|
46
|
-
get sort(): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Enable setting max cards per column (WIP limits)
|
|
49
|
-
*/
|
|
50
|
-
_set_max_cards: boolean;
|
|
51
|
-
get set_max_cards(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Color expression value (e.g., "blue:state=='draft';green:state=='done'")
|
|
54
|
-
*/
|
|
55
|
-
_colors: string | null;
|
|
56
|
-
get colors(): string | null;
|
|
57
|
-
/**
|
|
58
|
-
* Context for each field in the kanban
|
|
59
|
-
*/
|
|
60
|
-
_contextForFields: Record<string, any>;
|
|
61
|
-
get contextForFields(): Record<string, any>;
|
|
62
|
-
set contextForFields(value: Record<string, any>);
|
|
63
|
-
/**
|
|
64
|
-
* Map of fields that have sum aggregation
|
|
65
|
-
* Key: field name, Value: sum label (e.g., "Total hours")
|
|
66
|
-
*/
|
|
67
|
-
_aggregations: Record<string, string>;
|
|
68
|
-
get aggregations(): Record<string, string>;
|
|
69
|
-
constructor(fields: Object);
|
|
70
|
-
parse(xml: string): void;
|
|
71
|
-
private _parseField;
|
|
72
|
-
private _parseButton;
|
|
73
|
-
/**
|
|
74
|
-
* Find the widgets matching with param id
|
|
75
|
-
* @param {string} id id to find
|
|
76
|
-
*/
|
|
77
|
-
findById(id: string): Widget | null;
|
|
78
|
-
}
|
|
79
|
-
export default Kanban;
|
|
80
|
-
//# sourceMappingURL=Kanban.d.ts.map
|
package/dist/Kanban.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Kanban.d.ts","sourceRoot":"","sources":["../src/Kanban.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,MAAM,MAAM,UAAU,CAAC;AAM9B,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,cAAM,MAAM;IACV;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,MAAM,QAET;IAED;;OAEG;IACH,YAAY,EAAE,WAAW,EAAE,CAAM;IACjC,IAAI,WAAW,IAAI,WAAW,EAAE,CAE/B;IAED;;OAEG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAM;IAC9B,IAAI,OAAO,IAAI,YAAY,EAAE,CAE5B;IAED,OAAO,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC9B,IAAI,MAAM,IAAI,MAAM,GAAG,IAAI,CAE1B;IAED;;OAEG;IACH,KAAK,EAAE,MAAM,CAAY;IACzB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IACpC,IAAI,YAAY,IAAI,MAAM,GAAG,IAAI,CAEhC;IAED;;OAEG;IACH,KAAK,EAAE,OAAO,CAAQ;IACtB,IAAI,IAAI,IAAI,OAAO,CAElB;IAED;;OAEG;IACH,KAAK,EAAE,OAAO,CAAQ;IACtB,IAAI,IAAI,IAAI,OAAO,CAElB;IAED;;OAEG;IACH,cAAc,EAAE,OAAO,CAAS;IAChC,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC9B,IAAI,MAAM,IAAI,MAAM,GAAG,IAAI,CAE1B;IAED;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC5C,IAAI,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAE1C;IAED,IAAI,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAE9C;IAED;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAC3C,IAAI,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEzC;gBAEW,MAAM,EAAE,MAAM;IAI1B,KAAK,CAAC,GAAG,EAAE,MAAM;IAgDjB,OAAO,CAAC,WAAW;IAkEnB,OAAO,CAAC,YAAY;IAwBpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAqBpC;AAED,eAAe,MAAM,CAAC"}
|
package/src/Icon.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import Field from "./Field";
|
|
2
|
-
|
|
3
|
-
class Icon extends Field {
|
|
4
|
-
/**
|
|
5
|
-
* Icon name
|
|
6
|
-
*/
|
|
7
|
-
_name: string = "";
|
|
8
|
-
get name(): string {
|
|
9
|
-
return this._name;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
set name(value: string) {
|
|
13
|
-
this._name = value;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Icon size
|
|
18
|
-
*/
|
|
19
|
-
_size: number = 16;
|
|
20
|
-
get size(): number {
|
|
21
|
-
return this._size;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
set size(value: number) {
|
|
25
|
-
this._size = value;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Icon color
|
|
30
|
-
*/
|
|
31
|
-
_color: string = "";
|
|
32
|
-
get color(): string {
|
|
33
|
-
return this._color;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
set color(value: string) {
|
|
37
|
-
this._color = value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
constructor(props?: any) {
|
|
41
|
-
super({ ...props, nolabel: true });
|
|
42
|
-
|
|
43
|
-
if (props) {
|
|
44
|
-
if (props.name) {
|
|
45
|
-
this._name = props.name;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (props.size) {
|
|
49
|
-
this._size = props.size;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (props.color) {
|
|
53
|
-
this._color = props.color;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default Icon;
|
package/src/Kanban.ts
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import WidgetFactory from "./WidgetFactory";
|
|
2
|
-
import Widget from "./Widget";
|
|
3
|
-
import Button from "./Button";
|
|
4
|
-
import { replaceEntities } from "./helpers/attributeParser";
|
|
5
|
-
import { parseBoolAttribute, ParsedNode } from "./helpers/nodeParser";
|
|
6
|
-
import * as txml from "txml";
|
|
7
|
-
import { parseContext } from "./helpers/contextParser";
|
|
8
|
-
|
|
9
|
-
export type KanbanField = Widget & {
|
|
10
|
-
sum?: string; // Aggregation label (e.g., "Total hours")
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type KanbanButton = Button & {
|
|
14
|
-
states?: string; // Comma-separated states where button should show
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
class Kanban {
|
|
18
|
-
/**
|
|
19
|
-
* Object containing fields specification of the kanban.
|
|
20
|
-
*/
|
|
21
|
-
_fields: any;
|
|
22
|
-
get fields() {
|
|
23
|
-
return this._fields;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Array of field widgets to display in cards
|
|
28
|
-
*/
|
|
29
|
-
_card_fields: KanbanField[] = [];
|
|
30
|
-
get card_fields(): KanbanField[] {
|
|
31
|
-
return this._card_fields;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Array of button widgets to display in cards
|
|
36
|
-
*/
|
|
37
|
-
_buttons: KanbanButton[] = [];
|
|
38
|
-
get buttons(): KanbanButton[] {
|
|
39
|
-
return this._buttons;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
_string: string | null = null;
|
|
43
|
-
get string(): string | null {
|
|
44
|
-
return this._string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Widget type
|
|
49
|
-
*/
|
|
50
|
-
_type: string = "kanban";
|
|
51
|
-
get type(): string {
|
|
52
|
-
return this._type;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Field that defines the columns (e.g., "state")
|
|
57
|
-
*/
|
|
58
|
-
_column_field: string | null = null;
|
|
59
|
-
get column_field(): string | null {
|
|
60
|
-
return this._column_field;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Enable dragging cards between columns
|
|
65
|
-
*/
|
|
66
|
-
_drag: boolean = true;
|
|
67
|
-
get drag(): boolean {
|
|
68
|
-
return this._drag;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Enable sorting cards within columns
|
|
73
|
-
*/
|
|
74
|
-
_sort: boolean = true;
|
|
75
|
-
get sort(): boolean {
|
|
76
|
-
return this._sort;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Enable setting max cards per column (WIP limits)
|
|
81
|
-
*/
|
|
82
|
-
_set_max_cards: boolean = false;
|
|
83
|
-
get set_max_cards(): boolean {
|
|
84
|
-
return this._set_max_cards;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Color expression value (e.g., "blue:state=='draft';green:state=='done'")
|
|
89
|
-
*/
|
|
90
|
-
_colors: string | null = null;
|
|
91
|
-
get colors(): string | null {
|
|
92
|
-
return this._colors;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Context for each field in the kanban
|
|
97
|
-
*/
|
|
98
|
-
_contextForFields: Record<string, any> = {};
|
|
99
|
-
get contextForFields(): Record<string, any> {
|
|
100
|
-
return this._contextForFields;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
set contextForFields(value: Record<string, any>) {
|
|
104
|
-
this._contextForFields = value;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Map of fields that have sum aggregation
|
|
109
|
-
* Key: field name, Value: sum label (e.g., "Total hours")
|
|
110
|
-
*/
|
|
111
|
-
_aggregations: Record<string, string> = {};
|
|
112
|
-
get aggregations(): Record<string, string> {
|
|
113
|
-
return this._aggregations;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
constructor(fields: Object) {
|
|
117
|
-
this._fields = fields;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
parse(xml: string) {
|
|
121
|
-
const view = txml
|
|
122
|
-
.parse(xml)
|
|
123
|
-
.filter((el: ParsedNode) => el.tagName === "kanban")[0];
|
|
124
|
-
|
|
125
|
-
// Parse kanban attributes
|
|
126
|
-
this._string = view.attributes.string || null;
|
|
127
|
-
if (this._string) {
|
|
128
|
-
this._string = replaceEntities(this._string);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
this._column_field = view.attributes.column_field || null;
|
|
132
|
-
if (!this._column_field) {
|
|
133
|
-
throw new Error("Kanban view must have a column_field attribute");
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
this._drag =
|
|
137
|
-
view.attributes.drag !== undefined
|
|
138
|
-
? parseBoolAttribute(view.attributes.drag)
|
|
139
|
-
: true;
|
|
140
|
-
this._sort =
|
|
141
|
-
view.attributes.sort !== undefined
|
|
142
|
-
? parseBoolAttribute(view.attributes.sort)
|
|
143
|
-
: true;
|
|
144
|
-
this._set_max_cards =
|
|
145
|
-
view.attributes.set_max_cards !== undefined
|
|
146
|
-
? parseBoolAttribute(view.attributes.set_max_cards)
|
|
147
|
-
: false;
|
|
148
|
-
|
|
149
|
-
this._colors = view.attributes.colors || null;
|
|
150
|
-
if (this._colors) {
|
|
151
|
-
this._colors = replaceEntities(this._colors);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const widgetFactory = new WidgetFactory();
|
|
155
|
-
|
|
156
|
-
// Parse children (fields and buttons)
|
|
157
|
-
view.children.forEach((element: ParsedNode) => {
|
|
158
|
-
const { tagName, attributes } = element;
|
|
159
|
-
|
|
160
|
-
if (tagName === "field") {
|
|
161
|
-
this._parseField(element, attributes, widgetFactory);
|
|
162
|
-
} else if (tagName === "button") {
|
|
163
|
-
this._parseButton(element, attributes);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private _parseField(
|
|
169
|
-
_element: ParsedNode,
|
|
170
|
-
attributes: any,
|
|
171
|
-
widgetFactory: WidgetFactory,
|
|
172
|
-
) {
|
|
173
|
-
const { name, widget, sum } = attributes;
|
|
174
|
-
|
|
175
|
-
if (!name) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (!this._fields[name]) {
|
|
180
|
-
throw new Error(`Field ${name} doesn't exist in fields definition`);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
const fieldDef = this._fields[name];
|
|
184
|
-
let widgetType = fieldDef.type;
|
|
185
|
-
|
|
186
|
-
// Handle domain override
|
|
187
|
-
if (
|
|
188
|
-
((Array.isArray(fieldDef?.domain) && fieldDef?.domain.length === 0) ||
|
|
189
|
-
fieldDef?.domain === false) &&
|
|
190
|
-
attributes.domain &&
|
|
191
|
-
attributes.domain.length > 0
|
|
192
|
-
) {
|
|
193
|
-
delete fieldDef.domain;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Parse context
|
|
197
|
-
const widgetContext = parseContext({
|
|
198
|
-
context: attributes.context || fieldDef.context,
|
|
199
|
-
values: {},
|
|
200
|
-
fields: this._fields,
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
const mergedAttrs = {
|
|
204
|
-
...fieldDef,
|
|
205
|
-
...attributes,
|
|
206
|
-
fieldsWidgetType: fieldDef?.type,
|
|
207
|
-
context: widgetContext,
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
this._contextForFields[name] = widgetContext;
|
|
211
|
-
|
|
212
|
-
// Override widget type if specified
|
|
213
|
-
if (widget) {
|
|
214
|
-
widgetType = widget;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Create the widget
|
|
218
|
-
if (!mergedAttrs.invisible) {
|
|
219
|
-
const fieldWidget = widgetFactory.createWidget(
|
|
220
|
-
widgetType,
|
|
221
|
-
mergedAttrs,
|
|
222
|
-
) as KanbanField;
|
|
223
|
-
|
|
224
|
-
// Handle aggregation (sum)
|
|
225
|
-
if (sum) {
|
|
226
|
-
fieldWidget.sum = replaceEntities(sum);
|
|
227
|
-
this._aggregations[name] = replaceEntities(sum);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
this._card_fields.push(fieldWidget);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
private _parseButton(_element: ParsedNode, attributes: any) {
|
|
235
|
-
const { name, type, string, states } = attributes;
|
|
236
|
-
|
|
237
|
-
if (!name) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const buttonProps = {
|
|
242
|
-
...attributes,
|
|
243
|
-
name,
|
|
244
|
-
buttonType: type || "object",
|
|
245
|
-
string: string || "",
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
const button = new Button(buttonProps) as KanbanButton;
|
|
249
|
-
|
|
250
|
-
// Parse states attribute (e.g., "draft,open")
|
|
251
|
-
if (states) {
|
|
252
|
-
button.states = states;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
this._buttons.push(button);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Find the widgets matching with param id
|
|
260
|
-
* @param {string} id id to find
|
|
261
|
-
*/
|
|
262
|
-
findById(id: string): Widget | null {
|
|
263
|
-
const foundField = this._card_fields.find((item) => {
|
|
264
|
-
if (item.findById) {
|
|
265
|
-
return item.findById(id);
|
|
266
|
-
}
|
|
267
|
-
return false;
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
if (foundField) {
|
|
271
|
-
return foundField;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
const foundButton = this._buttons.find((item) => {
|
|
275
|
-
if (item.findById) {
|
|
276
|
-
return item.findById(id);
|
|
277
|
-
}
|
|
278
|
-
return false;
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
return foundButton || null;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
export default Kanban;
|
package/src/spec/Icon.spec.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import WidgetFactory from "../WidgetFactory";
|
|
2
|
-
import { it, expect, describe } from "vitest";
|
|
3
|
-
|
|
4
|
-
describe("An Icon", () => {
|
|
5
|
-
it("should have an id corresponding to field name", () => {
|
|
6
|
-
const widgetFactory = new WidgetFactory();
|
|
7
|
-
const props = {
|
|
8
|
-
name: "icon1",
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const widget = widgetFactory.createWidget("icon", props);
|
|
12
|
-
|
|
13
|
-
expect(widget.id).toBe("icon1");
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("should properly have nolabel as true by default", () => {
|
|
17
|
-
const widgetFactory = new WidgetFactory();
|
|
18
|
-
const props = {
|
|
19
|
-
name: "icon1",
|
|
20
|
-
};
|
|
21
|
-
const widget = widgetFactory.createWidget("icon", props);
|
|
22
|
-
|
|
23
|
-
expect(widget.nolabel).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("should properly set name", () => {
|
|
27
|
-
const widgetFactory = new WidgetFactory();
|
|
28
|
-
const props = {
|
|
29
|
-
name: "icon1",
|
|
30
|
-
};
|
|
31
|
-
const widget = widgetFactory.createWidget("icon", props);
|
|
32
|
-
|
|
33
|
-
widget.name = "home";
|
|
34
|
-
expect(widget.name).toBe("home");
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("should properly set size", () => {
|
|
38
|
-
const widgetFactory = new WidgetFactory();
|
|
39
|
-
const props = {
|
|
40
|
-
name: "icon1",
|
|
41
|
-
size: 24,
|
|
42
|
-
};
|
|
43
|
-
const widget = widgetFactory.createWidget("icon", props);
|
|
44
|
-
|
|
45
|
-
expect(widget.size).toBe(24);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("should have default size of 16", () => {
|
|
49
|
-
const widgetFactory = new WidgetFactory();
|
|
50
|
-
const props = {
|
|
51
|
-
name: "icon1",
|
|
52
|
-
};
|
|
53
|
-
const widget = widgetFactory.createWidget("icon", props);
|
|
54
|
-
|
|
55
|
-
expect(widget.size).toBe(16);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("should properly set color", () => {
|
|
59
|
-
const widgetFactory = new WidgetFactory();
|
|
60
|
-
const props = {
|
|
61
|
-
name: "icon1",
|
|
62
|
-
color: "#FF0000",
|
|
63
|
-
};
|
|
64
|
-
const widget = widgetFactory.createWidget("icon", props);
|
|
65
|
-
|
|
66
|
-
expect(widget.color).toBe("#FF0000");
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("should have empty color by default", () => {
|
|
70
|
-
const widgetFactory = new WidgetFactory();
|
|
71
|
-
const props = {
|
|
72
|
-
name: "icon1",
|
|
73
|
-
};
|
|
74
|
-
const widget = widgetFactory.createWidget("icon", props);
|
|
75
|
-
|
|
76
|
-
expect(widget.color).toBe("");
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("should properly parse all props together", () => {
|
|
80
|
-
const widgetFactory = new WidgetFactory();
|
|
81
|
-
const props = {
|
|
82
|
-
name: "icon1",
|
|
83
|
-
size: 32,
|
|
84
|
-
color: "blue",
|
|
85
|
-
};
|
|
86
|
-
const widget = widgetFactory.createWidget("icon", props);
|
|
87
|
-
|
|
88
|
-
widget.name = "star";
|
|
89
|
-
expect(widget.name).toBe("star");
|
|
90
|
-
expect(widget.size).toBe(32);
|
|
91
|
-
expect(widget.color).toBe("blue");
|
|
92
|
-
});
|
|
93
|
-
});
|