@gisce/ooui 2.28.0 → 2.29.0-alpha.1
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/Field.d.ts +2 -0
- package/dist/Field.d.ts.map +1 -1
- package/dist/Tag.d.ts +1 -0
- package/dist/Tag.d.ts.map +1 -1
- package/dist/helpers/attributeParser.d.ts.map +1 -1
- package/dist/ooui.es.js +109 -96
- package/dist/ooui.es.js.map +1 -1
- package/package.json +1 -1
- package/src/Field.ts +6 -0
- package/src/Tag.ts +4 -0
- package/src/helpers/attributeParser.ts +12 -11
- package/src/spec/Tag.spec.ts +22 -0
package/package.json
CHANGED
package/src/Field.ts
CHANGED
|
@@ -147,6 +147,11 @@ class Field extends Widget {
|
|
|
147
147
|
super.readOnly = value;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
_raw_props: any;
|
|
151
|
+
get raw_props(): any {
|
|
152
|
+
return this._raw_props;
|
|
153
|
+
}
|
|
154
|
+
|
|
150
155
|
constructor(props: any) {
|
|
151
156
|
super(props);
|
|
152
157
|
|
|
@@ -154,6 +159,7 @@ class Field extends Widget {
|
|
|
154
159
|
this._activated = true;
|
|
155
160
|
|
|
156
161
|
if (props) {
|
|
162
|
+
this._raw_props = props;
|
|
157
163
|
if (props.name) {
|
|
158
164
|
this._id = props.name;
|
|
159
165
|
}
|
package/src/Tag.ts
CHANGED
|
@@ -278,15 +278,6 @@ const evaluateAttributes = ({
|
|
|
278
278
|
fallbackMode?: boolean;
|
|
279
279
|
}) => {
|
|
280
280
|
let finalTagAttributes = {};
|
|
281
|
-
let oldTagAttributes = {};
|
|
282
|
-
if (tagAttributes.attrs) {
|
|
283
|
-
oldTagAttributes = parseAttributes({
|
|
284
|
-
attrs: tagAttributes.attrs,
|
|
285
|
-
values,
|
|
286
|
-
fields,
|
|
287
|
-
widgetType,
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
281
|
|
|
291
282
|
if (tagAttributes.json_attrs) {
|
|
292
283
|
try {
|
|
@@ -298,13 +289,23 @@ const evaluateAttributes = ({
|
|
|
298
289
|
});
|
|
299
290
|
} catch (error) {
|
|
300
291
|
if (fallbackMode && tagAttributes.attrs) {
|
|
301
|
-
finalTagAttributes =
|
|
292
|
+
finalTagAttributes = parseAttributes({
|
|
293
|
+
attrs: tagAttributes.attrs,
|
|
294
|
+
values,
|
|
295
|
+
fields,
|
|
296
|
+
widgetType,
|
|
297
|
+
});
|
|
302
298
|
} else {
|
|
303
299
|
throw error;
|
|
304
300
|
}
|
|
305
301
|
}
|
|
306
302
|
} else if (tagAttributes.attrs) {
|
|
307
|
-
finalTagAttributes =
|
|
303
|
+
finalTagAttributes = parseAttributes({
|
|
304
|
+
attrs: tagAttributes.attrs,
|
|
305
|
+
values,
|
|
306
|
+
fields,
|
|
307
|
+
widgetType,
|
|
308
|
+
});
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
return {
|
package/src/spec/Tag.spec.ts
CHANGED
|
@@ -44,4 +44,26 @@ describe("A Tag widget", () => {
|
|
|
44
44
|
expect(widget.colors).toStrictEqual("auto");
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
describe("colorField property", () => {
|
|
49
|
+
it("should have default colorField to null", () => {
|
|
50
|
+
const widgetFactory = new WidgetFactory();
|
|
51
|
+
const props = {
|
|
52
|
+
name: "status",
|
|
53
|
+
};
|
|
54
|
+
const widget = widgetFactory.createWidget("tag", props);
|
|
55
|
+
|
|
56
|
+
expect(widget.colorField).toBeNull();
|
|
57
|
+
});
|
|
58
|
+
it("should parse colorField property", () => {
|
|
59
|
+
const widgetFactory = new WidgetFactory();
|
|
60
|
+
const props = {
|
|
61
|
+
name: "status",
|
|
62
|
+
widget_props: '{"colorField": "color"}',
|
|
63
|
+
};
|
|
64
|
+
const widget = widgetFactory.createWidget("tag", props);
|
|
65
|
+
|
|
66
|
+
expect(widget.colorField).toBe("color");
|
|
67
|
+
});
|
|
68
|
+
});
|
|
47
69
|
});
|