@gisce/ooui 2.40.0-alpha.4 → 2.40.0-alpha.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/ooui",
3
- "version": "2.40.0-alpha.4",
3
+ "version": "2.40.0-alpha.5",
4
4
  "engines": {
5
5
  "node": "20.5.0"
6
6
  },
package/src/Kanban.ts CHANGED
@@ -44,6 +44,11 @@ class Kanban {
44
44
  return this._string;
45
45
  }
46
46
 
47
+ _status: string | null = null;
48
+ get status(): string | null {
49
+ return this._status;
50
+ }
51
+
47
52
  /**
48
53
  * Widget type
49
54
  */
@@ -55,8 +60,8 @@ class Kanban {
55
60
  /**
56
61
  * Field that defines the columns (e.g., "state")
57
62
  */
58
- _column_field: string | null = null;
59
- get column_field(): string | null {
63
+ _column_field: string = "state";
64
+ get column_field(): string {
60
65
  return this._column_field;
61
66
  }
62
67
 
@@ -128,10 +133,7 @@ class Kanban {
128
133
  this._string = replaceEntities(this._string);
129
134
  }
130
135
 
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
- }
136
+ this._column_field = view.attributes.column_field || "state";
135
137
 
136
138
  this._drag =
137
139
  view.attributes.drag !== undefined
@@ -151,6 +153,11 @@ class Kanban {
151
153
  this._colors = replaceEntities(this._colors);
152
154
  }
153
155
 
156
+ this._status = view.attributes.status || null;
157
+ if (this._status) {
158
+ this._status = replaceEntities(this._status);
159
+ }
160
+
154
161
  const widgetFactory = new WidgetFactory();
155
162
 
156
163
  // Parse children (fields and buttons)
@@ -122,17 +122,16 @@ describe("A Kanban", () => {
122
122
  expect(tree.sort).toBe(false);
123
123
  });
124
124
 
125
- it("should throw error if column_field is missing", () => {
125
+ it("should fallback to 'state' when column_field is missing", () => {
126
126
  const tree = new Kanban(FIELDS);
127
- const invalidXml = `<?xml version="1.0"?>
128
- <kanban string="Invalid">
127
+ const xmlWithoutColumnField = `<?xml version="1.0"?>
128
+ <kanban string="Tasks">
129
129
  <field name="name"/>
130
130
  </kanban>
131
131
  `;
132
132
 
133
- expect(() => tree.parse(invalidXml)).toThrow(
134
- "Kanban view must have a column_field attribute",
135
- );
133
+ tree.parse(xmlWithoutColumnField);
134
+ expect(tree.column_field).toBe("state");
136
135
  });
137
136
 
138
137
  it("should parse fields correctly", () => {