dbm 1.4.12 → 1.4.14
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/commands/index.js +6 -0
- package/css/all.css +2 -1
- package/css/tags.css +10 -1
- package/css/text.css +4 -0
- package/flow/updatefunctions/basic/GetItemBy.js +20 -0
- package/flow/updatefunctions/basic/index.js +12 -0
- package/flow/updatefunctions/logic/Condition.js +6 -6
- package/graphapi/webclient/admin/ItemEditor.js +2 -0
- package/graphapi/webclient/decode/Relations.js +12 -2
- package/graphapi/webclient/index.js +12 -0
- package/package.json +1 -1
- package/react/admin/objects/EditObject.js +17 -5
- package/react/form/CustomSelection.js +69 -0
- package/react/form/GraphApiObjectCustomSelection.js +105 -0
- package/react/form/index.js +2 -0
- package/react/svg/AddGlobalFilterClasses.js +34 -0
- package/react/svg/index.js +2 -0
package/commands/index.js
CHANGED
|
@@ -61,6 +61,12 @@ export const performCommands = function(aCommands, aFromObject = null, aEventDat
|
|
|
61
61
|
let currentArrayLength = currentArray.length;
|
|
62
62
|
for(let i = 0; i < currentArrayLength; i++) {
|
|
63
63
|
let currentCommand = currentArray[i];
|
|
64
|
+
|
|
65
|
+
if(currentCommand && currentCommand.isSource) {
|
|
66
|
+
currentCommand = currentCommand.getSource(aFromObject);
|
|
67
|
+
}
|
|
68
|
+
//METODO: add flow property
|
|
69
|
+
|
|
64
70
|
try {
|
|
65
71
|
currentCommand.perform(aFromObject, aEventData);
|
|
66
72
|
}
|
package/css/all.css
CHANGED
package/css/tags.css
CHANGED
|
@@ -107,8 +107,17 @@
|
|
|
107
107
|
overflow: hidden;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
.standard-tag-list .standard-tag-list-item{
|
|
110
|
+
.standard-tag-list .standard-tag-list-item {
|
|
111
111
|
float: left;
|
|
112
112
|
margin-right: var(--standard-tag-list-horizontal-margin, 10px);
|
|
113
113
|
margin-bottom: var(--standard-tag-list-vertical-margin, 5px);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.option {
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.option.selected {
|
|
121
|
+
background-color: var(--standard-tag-option-selected-background-color, #555555);
|
|
122
|
+
color: var(--standard-tag-option-selected-text-color, #ffffff);
|
|
114
123
|
}
|
package/css/text.css
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Dbm from "../../../index.js";
|
|
2
|
+
|
|
3
|
+
export default class GetItemBy extends Dbm.flow.FlowUpdateFunction {
|
|
4
|
+
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.input.register("value", null);
|
|
9
|
+
this.input.register("items", []);
|
|
10
|
+
this.input.register("path", "id");
|
|
11
|
+
|
|
12
|
+
this.output.register("value", null);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
_update() {
|
|
16
|
+
//console.log("GetItemBy::_update");
|
|
17
|
+
|
|
18
|
+
this.output.value = Dbm.utils.ArrayFunctions.getItemBy(this.input.items, this.input.path, this.input.value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -8,6 +8,7 @@ export {default as PropertyOfWithDefault} from "./PropertyOfWithDefault.js";
|
|
|
8
8
|
export {default as MappedList} from "./MappedList.js";
|
|
9
9
|
export {default as Translation} from "./Translation.js";
|
|
10
10
|
export {default as SetProperty} from "./SetProperty.js";
|
|
11
|
+
export {default as GetItemBy} from "./GetItemBy.js";
|
|
11
12
|
|
|
12
13
|
export const runCommand = function(aValue, aCommand) {
|
|
13
14
|
let updateFunction = new Dbm.flow.updatefunctions.basic.RunCommand();
|
|
@@ -134,5 +135,16 @@ export const setProperty = function(aObject, aPropertyName, aValue = null) {
|
|
|
134
135
|
properties.object.setOrConnect(aObject);
|
|
135
136
|
properties.propertyName.setOrConnect(aPropertyName);
|
|
136
137
|
|
|
138
|
+
return updateFunction;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export const getItemBy = function(aItems, aValue, aPath = "id") {
|
|
142
|
+
let updateFunction = new Dbm.flow.updatefunctions.basic.GetItemBy();
|
|
143
|
+
|
|
144
|
+
let properties = updateFunction.input.properties;
|
|
145
|
+
properties.value.setOrConnect(aValue);
|
|
146
|
+
properties.items.setOrConnect(aItems);
|
|
147
|
+
properties.path.setOrConnect(aPath);
|
|
148
|
+
|
|
137
149
|
return updateFunction;
|
|
138
150
|
}
|
|
@@ -17,13 +17,13 @@ export default class Condition extends Dbm.flow.FlowUpdateFunction {
|
|
|
17
17
|
|
|
18
18
|
let operation = this.input.operation;
|
|
19
19
|
if(typeof(operation) === "string") {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//METODO: add more operations
|
|
25
|
-
operation = function(aA, aB) {return aA === aB;}
|
|
20
|
+
let compareFunction = Dbm.getInstance().repository.getItem("compareFunctions/" + operation).compare;
|
|
21
|
+
if(!compareFunction) {
|
|
22
|
+
console.warn("No copmare function registered for: " + operation + ". Using ==", this);
|
|
23
|
+
compareFunction = Dbm.utils.CompareFunctions.equals;
|
|
26
24
|
}
|
|
25
|
+
|
|
26
|
+
operation = compareFunction
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
this.output.result = operation.call(this, this.input.input1, this.input.input2);
|
|
@@ -134,6 +134,7 @@ export default class ItemEditor extends Dbm.core.BaseObject {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
addMultipleIncomingRelationsEditor(aType, aObjectType, aInitialValue, aUpdateEncoding = null) {
|
|
137
|
+
//console.log("addMultipleIncomingRelationsEditor");
|
|
137
138
|
let name = "in_" + aType + "_" + aObjectType;
|
|
138
139
|
return this._addMultipleRelationsEditor(name, aType, aObjectType, aInitialValue, Dbm.graphapi.webclient.admin.SaveFunctions.multipleIncomingRelations, aUpdateEncoding);
|
|
139
140
|
}
|
|
@@ -144,6 +145,7 @@ export default class ItemEditor extends Dbm.core.BaseObject {
|
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
getAdminMultipleIncomingRelationsEditor(aType, aObjectType) {
|
|
148
|
+
//console.log("getAdminMultipleIncomingRelationsEditor");
|
|
147
149
|
let name = "in_" + aType + "_" + aObjectType;
|
|
148
150
|
let valueEditor = this.item["editor_multipleRelations_" + name];
|
|
149
151
|
if(!valueEditor) {
|
|
@@ -39,7 +39,12 @@ export default class Relations extends Dbm.graphapi.webclient.decode.DecodeBaseO
|
|
|
39
39
|
let relation = Dbm.getRepositoryItem(currentRelationData["relationId"]);
|
|
40
40
|
if(typeItem.relations.indexOf(relation) === -1) {
|
|
41
41
|
let linkedItem = Dbm.getRepositoryItem(currentRelationData["id"]);
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
relation.setValue("from", linkedItem);
|
|
44
|
+
relation.setValue("to", aItem);
|
|
45
|
+
relation.setValue("startAt", currentRelationData["startAt"]);
|
|
46
|
+
relation.setValue("endAt", currentRelationData["endAt"]);
|
|
47
|
+
|
|
43
48
|
if(this._isRelationValid(currentRelationData["startAt"], currentRelationData["endAt"])) {
|
|
44
49
|
typeItem.addToArray("objects", linkedItem);
|
|
45
50
|
typeItem.addToArray("relations", relation);
|
|
@@ -72,7 +77,12 @@ export default class Relations extends Dbm.graphapi.webclient.decode.DecodeBaseO
|
|
|
72
77
|
let relation = Dbm.getRepositoryItem(currentRelationData["relationId"]);
|
|
73
78
|
if(typeItem.relations.indexOf(relation) === -1) {
|
|
74
79
|
let linkedItem = Dbm.getRepositoryItem(currentRelationData["id"]);
|
|
75
|
-
|
|
80
|
+
|
|
81
|
+
relation.setValue("from", aItem);
|
|
82
|
+
relation.setValue("to", linkedItem);
|
|
83
|
+
relation.setValue("startAt", currentRelationData["startAt"]);
|
|
84
|
+
relation.setValue("endAt", currentRelationData["endAt"]);
|
|
85
|
+
|
|
76
86
|
if(this._isRelationValid(currentRelationData["startAt"], currentRelationData["endAt"])) {
|
|
77
87
|
typeItem.addToArray("objects", linkedItem);
|
|
78
88
|
typeItem.addToArray("relations", relation);
|
|
@@ -65,4 +65,16 @@ export const performAction = function(aType, aData, aCallback = null) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
return request.properties.data;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const loadRange = function(aSelects, aEncodings, aCommand) {
|
|
71
|
+
let graphApi = Dbm.getRepositoryItem("cachedGraphApi").controller;
|
|
72
|
+
|
|
73
|
+
let request = graphApi.requestRange(aSelects, aEncodings);
|
|
74
|
+
|
|
75
|
+
if(aCommand) {
|
|
76
|
+
Dbm.flow.runWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, aCommand);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return request.properties.items;
|
|
68
80
|
}
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ export default class EditObject extends Dbm.react.BaseObject {
|
|
|
19
19
|
{"type": "includeDraft"},
|
|
20
20
|
{"type": "idSelection", "ids": [id]},
|
|
21
21
|
],
|
|
22
|
-
["objectTypes"]
|
|
22
|
+
["objectTypes", "name", "identifier"]
|
|
23
23
|
);
|
|
24
24
|
allLoaded.addCheck(request.properties.status);
|
|
25
25
|
}
|
|
@@ -38,11 +38,23 @@ export default class EditObject extends Dbm.react.BaseObject {
|
|
|
38
38
|
|
|
39
39
|
React.createElement(Dbm.react.area.HasData, {check: this.item.properties.loaded},
|
|
40
40
|
React.createElement(Dbm.react.context.AddContextVariables, {"values": {"item": item}},
|
|
41
|
-
React.createElement(Dbm.react.admin.editorsgroup.EditItem, {},
|
|
42
|
-
React.createElement(
|
|
43
|
-
Dbm.react.text.text(Dbm.react.source.
|
|
41
|
+
React.createElement(Dbm.react.admin.editorsgroup.EditItem, {},
|
|
42
|
+
React.createElement("h2", {"className": "no-margins"},
|
|
43
|
+
Dbm.react.text.text(Dbm.react.source.item("id")),
|
|
44
|
+
" - ",
|
|
45
|
+
Dbm.react.text.text(Dbm.react.source.item("name")),
|
|
44
46
|
),
|
|
45
|
-
React.createElement(
|
|
47
|
+
React.createElement("div", {"className": "small-description"},
|
|
48
|
+
Dbm.react.text.text(Dbm.react.source.item("identifier"))
|
|
49
|
+
),
|
|
50
|
+
React.createElement("div", {"className": "spacing small"}),
|
|
51
|
+
React.createElement(Dbm.react.area.List, {items: Dbm.react.source.item("objectTypes"), className: "inline-list standard-tag-list standard-tag-list-expand", "as": "objectType", "keyField": "(root)"},
|
|
52
|
+
React.createElement("div", {"className": "standard-tag standard-tag-padding standard-tag-list-item inline-list-item display-inline-block"},
|
|
53
|
+
Dbm.react.text.text(Dbm.react.source.contextVariable("objectType"))
|
|
54
|
+
)
|
|
55
|
+
),
|
|
56
|
+
React.createElement("div", {"className": "spacing small"}),
|
|
57
|
+
React.createElement(Dbm.react.area.List, {items: Dbm.react.source.item("objectTypes"), "as": "objectType", "keyField": "(root)"},
|
|
46
58
|
React.createElement(Dbm.react.admin.objects.InjectObjectTypeEditor, {type: Dbm.react.source.contextVariable("objectType")})
|
|
47
59
|
)
|
|
48
60
|
)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class CustomSelection extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
let valueProperty = this.getDynamicPropWithoutState("value", null);
|
|
9
|
+
let itemsProperty = this.getDynamicPropWithoutState("items", []);
|
|
10
|
+
|
|
11
|
+
let openProperty = this.item.requireProperty("open", false);
|
|
12
|
+
this.item.requireProperty("rows", []);
|
|
13
|
+
|
|
14
|
+
this.item.requireProperty("selectedItem", null);
|
|
15
|
+
|
|
16
|
+
let mappedList = Dbm.flow.updatefunctions.basic.mappedList(itemsProperty, [this._getScopedCallFunctionCommand(this._newRow, [Dbm.core.source.event("mappedItem")])]);
|
|
17
|
+
this.item.setValue("mappedList", mappedList);
|
|
18
|
+
this.item.properties.rows.connectInput(mappedList.output.properties.items);
|
|
19
|
+
|
|
20
|
+
let singleSelection = new Dbm.flow.controllers.select.SingleSelection();
|
|
21
|
+
this.item.setValue("singleSelection", singleSelection.item);
|
|
22
|
+
singleSelection.item.properties.value.connectInput(valueProperty);
|
|
23
|
+
|
|
24
|
+
let closeCommand = Dbm.commands.setProperty(openProperty, false);
|
|
25
|
+
this.item.setValue("closeCommand", closeCommand);
|
|
26
|
+
|
|
27
|
+
let path = this.getPropValueWithDefault("path", "id");
|
|
28
|
+
let getItemBy = Dbm.flow.updatefunctions.basic.getItemBy(itemsProperty, valueProperty, path);
|
|
29
|
+
this.item.setValue("getItemBy", getItemBy);
|
|
30
|
+
|
|
31
|
+
this.item.properties.selectedItem.connectInput(getItemBy.output.properties.value);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_newRow(aRow) {
|
|
35
|
+
//console.log("_newRow");
|
|
36
|
+
//console.log(aRow);
|
|
37
|
+
|
|
38
|
+
let path = this.getPropValueWithDefault("path", "id");
|
|
39
|
+
|
|
40
|
+
let value = Dbm.objectPath(aRow, "forItem." + path);
|
|
41
|
+
|
|
42
|
+
let selectedProperty = this.item.singleSelection.controller.addSelectionValue(value);
|
|
43
|
+
|
|
44
|
+
aRow.setValue("value", value);
|
|
45
|
+
aRow.requireProperty("selected", false).connectInput(selectedProperty);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_renderMainElement() {
|
|
49
|
+
|
|
50
|
+
let children = Dbm.utils.ArrayFunctions.singleOrArray(this.getPropValue("children"));
|
|
51
|
+
|
|
52
|
+
let slots = Dbm.react.ChildFunctions.splitIntoSlots(children);
|
|
53
|
+
|
|
54
|
+
let buttonElement = slots["button"];
|
|
55
|
+
let mainChildren = slots.main;
|
|
56
|
+
|
|
57
|
+
let contextValues = {"value": this.item.properties["props/value"], "selectedItem": this.item.properties.selectedItem, "rows": this.item.properties.rows, "closeCommand": this.item.closeCommand};
|
|
58
|
+
|
|
59
|
+
return this._createMainElement(Dbm.react.form.Dropdown, {"open": this.item.properties.open},
|
|
60
|
+
React.createElement(Dbm.react.context.AddContextVariables, {"data-slot": "button", "values": contextValues},
|
|
61
|
+
React.createElement(Dbm.react.area.InsertElement, {"element": buttonElement})
|
|
62
|
+
),
|
|
63
|
+
React.createElement(Dbm.react.context.AddContextVariables, {"values": contextValues},
|
|
64
|
+
React.createElement(Dbm.react.area.InsertElement, {"element": mainChildren})
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class GraphApiObjectSelection extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.getDynamicProp("value", "");
|
|
9
|
+
this.item.requireProperty("items", []);
|
|
10
|
+
this.item.requireProperty("sortedItems", []);
|
|
11
|
+
|
|
12
|
+
let objectType = this.getPropValue("objectType");
|
|
13
|
+
let encodings = Dbm.utils.ArrayFunctions.arrayOrSeparatedString(this.getPropValueWithDefault("encoding", "name"), ",", true);
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
let selects = [
|
|
17
|
+
{"type": "byObjectType", "objectType": objectType},
|
|
18
|
+
{"type": "includeDraft"},
|
|
19
|
+
{"type": "includePrivate"}
|
|
20
|
+
];
|
|
21
|
+
if(this.getPropValue("anyStatus")) {
|
|
22
|
+
selects = [
|
|
23
|
+
{"type": "byObjectType", "objectType": objectType},
|
|
24
|
+
{"type": "includeAnyStatus"}
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let request = Dbm.getCachedGraphApi().requestRange(
|
|
29
|
+
selects,
|
|
30
|
+
encodings
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
this.item.properties.items.connectInput(request.properties.items);
|
|
34
|
+
|
|
35
|
+
Dbm.flow.runWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._itemsLoaded.bind(this), [request]));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_itemsLoaded(aRequest) {
|
|
40
|
+
|
|
41
|
+
let nameField = this.getPropValueWithDefault("nameField", "name");
|
|
42
|
+
|
|
43
|
+
let currentArray = [].concat(aRequest.items);
|
|
44
|
+
Dbm.utils.ArrayFunctions.naturalSortOnField(currentArray, nameField);
|
|
45
|
+
|
|
46
|
+
this.item.sortedItems = currentArray;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_renderMainElement() {
|
|
50
|
+
|
|
51
|
+
let value = this.getDynamicProp("value");
|
|
52
|
+
let nameField = this.getPropValueWithDefault("nameField", "name");
|
|
53
|
+
|
|
54
|
+
return this._createMainElement(Dbm.react.form.CustomSelection, {"value": value, "items": this.item.properties.sortedItems, "path": nameField},
|
|
55
|
+
|
|
56
|
+
React.createElement("div", {
|
|
57
|
+
"data-slot": "button",
|
|
58
|
+
children: [React.createElement(Dbm.react.area.HasData, {
|
|
59
|
+
check: Dbm.react.source.contextVariable("value"),
|
|
60
|
+
children: React.createElement(Dbm.react.context.AddItemToContext, {
|
|
61
|
+
item: Dbm.react.source.contextVariable("selectedItem"),
|
|
62
|
+
children: [React.createElement(Dbm.react.area.HasData, {
|
|
63
|
+
check: Dbm.react.source.item(),
|
|
64
|
+
children: React.createElement("div", {
|
|
65
|
+
children: Dbm.react.text.text(Dbm.react.source.item("name"))
|
|
66
|
+
})
|
|
67
|
+
}), React.createElement(Dbm.react.area.HasData, {
|
|
68
|
+
check: Dbm.react.source.item(),
|
|
69
|
+
checkType: "invert/default",
|
|
70
|
+
children: React.createElement("div", {
|
|
71
|
+
children: Dbm.react.text.text(Dbm.react.source.contextVariable("value"))
|
|
72
|
+
})
|
|
73
|
+
})]
|
|
74
|
+
})
|
|
75
|
+
}), React.createElement(Dbm.react.area.HasData, {
|
|
76
|
+
check: Dbm.react.source.contextVariable("value"),
|
|
77
|
+
checkType: "invert/default",
|
|
78
|
+
children: React.createElement("div", {
|
|
79
|
+
children: Dbm.react.text.translatedText("Select")
|
|
80
|
+
})
|
|
81
|
+
})]
|
|
82
|
+
}), React.createElement("div", {
|
|
83
|
+
children: React.createElement(Dbm.react.area.HasData, {
|
|
84
|
+
check: Dbm.react.source.contextVariable("isVisible"),
|
|
85
|
+
children: React.createElement(Dbm.react.area.List, {
|
|
86
|
+
items: Dbm.react.source.contextVariable("rows"),
|
|
87
|
+
as: "row",
|
|
88
|
+
children: React.createElement(Dbm.react.context.AddItemToContext, {
|
|
89
|
+
item: Dbm.react.source.contextVariable("row.forItem"),
|
|
90
|
+
children: React.createElement(Dbm.react.interaction.CommandButton, {
|
|
91
|
+
commands: [Dbm.commands.setProperty(Dbm.react.source.contextVariable("row.properties.selected"), true), Dbm.react.source.contextVariable("closeCommand")],
|
|
92
|
+
children: React.createElement("div", {
|
|
93
|
+
children: Dbm.react.text.text(Dbm.react.source.item("name"))
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
package/react/form/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export {default as LabelledArea} from "./LabelledArea.js";
|
|
|
7
7
|
export {default as FileDropArea} from "./FileDropArea.js";
|
|
8
8
|
export {default as Selection} from "./Selection.js";
|
|
9
9
|
export {default as GraphApiObjectSelection} from "./GraphApiObjectSelection.js";
|
|
10
|
+
export {default as GraphApiObjectCustomSelection} from "./GraphApiObjectCustomSelection.js";
|
|
10
11
|
export {default as GraphApiSelectOrCreateObject} from "./GraphApiSelectOrCreateObject.js";
|
|
11
12
|
export {default as GraphApiImage} from "./GraphApiImage.js";
|
|
12
13
|
export {default as EditArray} from "./EditArray.js";
|
|
@@ -16,6 +17,7 @@ export {default as Form} from "./Form.js";
|
|
|
16
17
|
export {default as Option} from "./Option.js";
|
|
17
18
|
export {default as Dropdown} from "./Dropdown.js";
|
|
18
19
|
export {default as GraphApiObjectOptions} from "./GraphApiObjectOptions.js";
|
|
20
|
+
export {default as CustomSelection} from "./CustomSelection.js";
|
|
19
21
|
|
|
20
22
|
export const validationStateClassName = function(aChildren) {
|
|
21
23
|
return React.createElement(Dbm.react.AddProps, {className: Dbm.react.source.contextVariable("field.properties.validationState")},
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Dbm from "../../index.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export default class GlobalFilters extends Dbm.core.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this._styleTag = null;
|
|
9
|
+
|
|
10
|
+
let colorFilters = Dbm.getRepositoryItem("globalSvg");
|
|
11
|
+
let filtersProperty = colorFilters.requireProperty("filters", []);
|
|
12
|
+
|
|
13
|
+
filtersProperty.addUpdate(this._getScopedCallFunctionCommand(this._updateStyles));
|
|
14
|
+
this._updateStyles();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
_updateStyles() {
|
|
18
|
+
console.log("_updateStyles");
|
|
19
|
+
|
|
20
|
+
let colorFilters = Dbm.getRepositoryItem("globalSvg");
|
|
21
|
+
console.log(colorFilters.filters.length);
|
|
22
|
+
|
|
23
|
+
if(colorFilters.filters.length) {
|
|
24
|
+
if(!this._styleTag) {
|
|
25
|
+
this._styleTag = document.createElement("style");
|
|
26
|
+
document.head.appendChild(this._styleTag);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let declarations = Dbm.utils.ArrayFunctions.mapField(colorFilters.filters, "classDeclaration");
|
|
30
|
+
this._styleTag.innerHTML = declarations.join("\n");
|
|
31
|
+
console.log(declarations);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
package/react/svg/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import React from "react";
|
|
|
3
3
|
|
|
4
4
|
export {default as GlobalFilters} from "./GlobalFilters.js";
|
|
5
5
|
export {default as MatrixFilter} from "./MatrixFilter.js";
|
|
6
|
+
export {default as AddGlobalFilterClasses} from "./AddGlobalFilterClasses.js";
|
|
6
7
|
|
|
7
8
|
export const addGlobalRgbColorFilter = function(aName, aR, aG, aB) {
|
|
8
9
|
|
|
@@ -11,6 +12,7 @@ export const addGlobalRgbColorFilter = function(aName, aR, aG, aB) {
|
|
|
11
12
|
|
|
12
13
|
let item = Dbm.getRepositoryItem("globalSvg/filters/" + aName);
|
|
13
14
|
item.setValue("element", React.createElement(Dbm.react.svg.MatrixFilter, {"id": aName, "matrix": Dbm.utils.svg.ColorMatrixFunctions.floodColor(aR, aG, aB)}));
|
|
15
|
+
item.setValue("classDeclaration", "." + aName + "{filter:url(\"#" + aName + "\")}");
|
|
14
16
|
|
|
15
17
|
let filters = [].concat(colorFilters.filters);
|
|
16
18
|
filters.push(item);
|