dbm 1.2.0 → 1.2.2
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/core/source/FirstSource.js +36 -0
- package/core/source/index.js +21 -0
- package/dbm.js +8 -0
- package/flow/controllers/index.js +2 -1
- package/flow/controllers/select/InArray.js +67 -0
- package/flow/controllers/select/index.js +2 -1
- package/flow/controllers/timing/IntervalStep.js +60 -0
- package/flow/controllers/timing/index.js +1 -0
- package/flow/index.js +13 -3
- package/flow/updatefunctions/animation/AnimateValue.js +39 -0
- package/flow/updatefunctions/animation/index.js +13 -0
- package/flow/updatefunctions/basic/MappedList.js +49 -0
- package/flow/updatefunctions/basic/PropertyOf.js +1 -1
- package/flow/updatefunctions/basic/PropertyOfWithDefault.js +28 -0
- package/flow/updatefunctions/basic/Translation.js +71 -0
- package/flow/updatefunctions/basic/index.js +77 -0
- package/flow/updatefunctions/index.js +1 -0
- package/flow/updatefunctions/logic/FloatMod.js +26 -0
- package/flow/updatefunctions/logic/PositionedItems.js +1 -1
- package/flow/updatefunctions/logic/index.js +18 -0
- package/flow/updatefunctions/thirdparty/google/index.js +3 -0
- package/flow/updatefunctions/thirdparty/google/maps/AutoComplete.js +132 -0
- package/flow/updatefunctions/thirdparty/google/maps/PlaceDetails.js +80 -0
- package/flow/updatefunctions/thirdparty/google/maps/index.js +4 -0
- package/flow/updatefunctions/thirdparty/index.js +2 -1
- package/graphapi/webclient/ApiConnection.js +2 -0
- package/graphapi/webclient/WebSocketConnection.js +1 -0
- package/graphapi/webclient/admin/EditorGroup.js +1 -1
- package/graphapi/webclient/admin/ItemEditor.js +39 -0
- package/graphapi/webclient/admin/ItemSaveData.js +6 -0
- package/graphapi/webclient/admin/SaveFunctions.js +4 -0
- package/graphapi/webclient/admin/ValueEditor.js +15 -0
- package/graphapi/webclient/decode/DecodeBaseObject.js +4 -0
- package/graphapi/webclient/decode/index.js +32 -1
- package/graphapi/webclient/index.js +41 -0
- package/package.json +1 -1
- package/react/admin/EditObject.js +52 -0
- package/react/admin/EditObjectById.js +2 -3
- package/react/admin/EditPage.js +18 -0
- package/react/admin/EditorGroup.js +23 -0
- package/react/admin/SaveAllButton.js +34 -0
- package/react/admin/editorsgroup/EditField.js +2 -2
- package/react/admin/editorsgroup/EditFieldTranslation.js +27 -0
- package/react/admin/editorsgroup/EditIdentifer.js +3 -3
- package/react/admin/editorsgroup/EditItem.js +1 -1
- package/react/admin/editorsgroup/EditRelation.js +2 -2
- package/react/admin/editorsgroup/EditVisibility.js +2 -2
- package/react/admin/editorsgroup/index.js +2 -1
- package/react/admin/index.js +3 -0
- package/react/admin/objects/EditObject.js +9 -4
- package/react/admin/objects/itemeditors/Name.js +31 -29
- package/react/admin/pageeditors/LinkPreviews.js +98 -0
- package/react/admin/pageeditors/index.js +1 -0
- package/react/area/FixedWidthInfiniteSlideshow.js +50 -0
- package/react/area/List.js +4 -0
- package/react/area/index.js +1 -0
- package/react/blocks/admin/objects/RunObjectCommands.js +0 -14
- package/react/blocks/admin/objects/User.js +29 -1
- package/react/blocks/content/LinkList.js +67 -0
- package/react/blocks/content/LinkListCard.js +83 -0
- package/react/blocks/content/index.js +3 -1
- package/react/blocks/faq/AskAQuestion.js +1 -1
- package/react/blocks/index.js +34 -0
- package/react/form/Option.js +18 -0
- package/react/form/index.js +2 -1
- package/react/text/HtmlText.js +6 -1
- package/react/text/NumberDisplay.js +30 -0
- package/react/text/OptionalLink.js +21 -0
- package/react/text/TranslatedText.js +25 -0
- package/react/text/TranslationGroup.js +24 -0
- package/react/text/index.js +10 -2
- package/site/SiteDataLoader.js +8 -13
- package/site/index.js +2 -0
- package/site/translation/TranslationLoader.js +59 -0
- package/site/translation/index.js +27 -0
- package/utils/ArrayFunctions.js +16 -0
- package/utils/CompareFunctions.js +24 -0
- package/utils/StringFunctions.js +18 -3
- package/utils/index.js +3 -1
- package/utils/thirdparty/index.js +1 -0
- package/utils/thirdparty/wprrapi/WprrApiParser.js +31 -0
- package/utils/thirdparty/wprrapi/index.js +3 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import Dbm from "../../../../../index.js";
|
|
2
|
+
|
|
3
|
+
export default class AutoComplete extends Dbm.flow.FlowUpdateFunction {
|
|
4
|
+
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.input.register("text", "");
|
|
9
|
+
this.input.register("countries", []);
|
|
10
|
+
this.input.register("types", ["geocode"]);
|
|
11
|
+
this.input.register("language", "en");
|
|
12
|
+
|
|
13
|
+
this._loadedScript = false;
|
|
14
|
+
this._currentText = "";
|
|
15
|
+
|
|
16
|
+
this.output.register("updated", true);
|
|
17
|
+
this.output.register("results", []);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
loadScript() {
|
|
21
|
+
let key = Dbm.getRepositoryItem("googleMapsApi").apiKey;
|
|
22
|
+
let scriptLoader = Dbm.loading.loadScript("https://maps.googleapis.com/maps/api/js?key=" + key + "&libraries=places");
|
|
23
|
+
|
|
24
|
+
if(scriptLoader.item.properties.status === 1) {
|
|
25
|
+
this._scriptLoaded();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
Dbm.flow.addUpdateCommandWhenMatched(scriptLoader.item.properties.status, 1, Dbm.commands.callFunction(this._scriptLoaded.bind(this)));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_scriptLoaded() {
|
|
35
|
+
console.log("_scriptLoaded");
|
|
36
|
+
if(!this._loadedScript) {
|
|
37
|
+
this._loadedScript = true;
|
|
38
|
+
this._update();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
setLanguage(aLanguageCode) {
|
|
43
|
+
this.input.language = aLanguageCode;
|
|
44
|
+
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
setCountryRestrictions(aCountryCode) {
|
|
49
|
+
this.input.countries = Dbm.utils.ArrayFunctions.arrayOrSeparatedString(aCountryCode);
|
|
50
|
+
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_update() {
|
|
55
|
+
console.log("_update");
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
let text = this.input.text;
|
|
59
|
+
this._currentText = text;
|
|
60
|
+
this.output.updated = false;
|
|
61
|
+
|
|
62
|
+
if(text) {
|
|
63
|
+
this.output.properties.results.isDirty = false;
|
|
64
|
+
this.output.properties.updated.isDirty = false;
|
|
65
|
+
|
|
66
|
+
if(this._loadedScript) {
|
|
67
|
+
|
|
68
|
+
let requestData = {
|
|
69
|
+
input: text,
|
|
70
|
+
language: this.input.language,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
if(this.input.countries) {
|
|
74
|
+
requestData["includedRegionCodes"] = this.input.countries;
|
|
75
|
+
}
|
|
76
|
+
if(this.input.types) {
|
|
77
|
+
requestData["includedPrimaryTypes"] = this.input.types;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let request = google.maps.places.AutocompleteSuggestion.fetchAutocompleteSuggestions(requestData);
|
|
81
|
+
|
|
82
|
+
request.then((aResult) => {
|
|
83
|
+
let suggestions = aResult.suggestions;
|
|
84
|
+
this._resultsLoaded(text, Dbm.utils.ArrayFunctions.mapField(suggestions, "placePrediction"));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.loadScript();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.output.results = [];
|
|
93
|
+
this.output.updated = true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
_getResultDetails(aPlaceId) {
|
|
100
|
+
|
|
101
|
+
let place = new google.maps.places.Place({"id": aPlaceId});
|
|
102
|
+
|
|
103
|
+
let loadPromise = place.fetchFields({"fields": ["addressComponents"]});
|
|
104
|
+
|
|
105
|
+
loadPromise.then((aResult) => {
|
|
106
|
+
//console.log(place);
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
_resultsLoaded(aText, aPredictions) {
|
|
111
|
+
console.log("_resultsLoaded");
|
|
112
|
+
/*
|
|
113
|
+
for(let i = 0; i < aPredictions.length; i++) {
|
|
114
|
+
let currentPredition = aPredictions[i];
|
|
115
|
+
|
|
116
|
+
//console.log(currentPredition.text.text, currentPredition.mainText.text, currentPredition.secondaryText.text, currentPredition.placeId);
|
|
117
|
+
this._getResultDetails(currentPredition.placeId);
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
//console.log(this.isDirty, this.output.properties.results.isDirty, this._currentText, aText);
|
|
123
|
+
|
|
124
|
+
if(this._currentText === aText) {
|
|
125
|
+
this.output.properties.results._internal_setValueInFlowOutsideOfUpdate(aPredictions);
|
|
126
|
+
this.output.properties.updated._internal_setValueInFlowOutsideOfUpdate(true);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import Dbm from "../../../../../index.js";
|
|
2
|
+
|
|
3
|
+
export default class PlaceDetails extends Dbm.flow.FlowUpdateFunction {
|
|
4
|
+
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.input.register("id", null);
|
|
9
|
+
this.input.register("fields", ["addressComponents", "location"]);
|
|
10
|
+
|
|
11
|
+
//reviews
|
|
12
|
+
|
|
13
|
+
this._loadedScript = false;
|
|
14
|
+
this._currentId = "";
|
|
15
|
+
|
|
16
|
+
this.output.register("updated", true);
|
|
17
|
+
this.output.register("data", null);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
loadScript() {
|
|
21
|
+
console.log("loadScript");
|
|
22
|
+
let key = Dbm.getRepositoryItem("googleMapsApi").apiKey;
|
|
23
|
+
let scriptLoader = Dbm.loading.loadScript("https://maps.googleapis.com/maps/api/js?key=" + key + "&libraries=places");
|
|
24
|
+
|
|
25
|
+
console.log(scriptLoader.item.properties.status, scriptLoader);
|
|
26
|
+
if(scriptLoader.item.status === 1) {
|
|
27
|
+
this._scriptLoaded();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
Dbm.flow.addUpdateCommandWhenMatched(scriptLoader.item.properties.status, 1, Dbm.commands.callFunction(this._scriptLoaded.bind(this)));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_scriptLoaded() {
|
|
37
|
+
console.log("_scriptLoaded");
|
|
38
|
+
if(!this._loadedScript) {
|
|
39
|
+
this._loadedScript = true;
|
|
40
|
+
this._update();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_update() {
|
|
45
|
+
console.log("_update");
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
let id = this.input.id;
|
|
49
|
+
this._currentId = id;
|
|
50
|
+
this.output.updated = false;
|
|
51
|
+
|
|
52
|
+
if(id) {
|
|
53
|
+
this.output.properties.data.isDirty = false;
|
|
54
|
+
this.output.properties.updated.isDirty = false;
|
|
55
|
+
|
|
56
|
+
if(this._loadedScript) {
|
|
57
|
+
|
|
58
|
+
let place = new google.maps.places.Place({"id": this.input.id});
|
|
59
|
+
console.log(place);
|
|
60
|
+
|
|
61
|
+
let loadPromise = place.fetchFields({"fields": this.input.fields});
|
|
62
|
+
|
|
63
|
+
loadPromise.then((aResult) => {
|
|
64
|
+
console.log(id, place, aResult);
|
|
65
|
+
this.output.properties.data._internal_setValueInFlowOutsideOfUpdate(place);
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.loadScript();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.output.data = null;
|
|
74
|
+
this.output.updated = true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * as threejs from "./threejs/index.js";
|
|
1
|
+
export * as threejs from "./threejs/index.js";
|
|
2
|
+
export * as google from "./google/index.js";
|
|
@@ -28,6 +28,7 @@ export default class ApiConnection extends Dbm.core.BaseObject {
|
|
|
28
28
|
|
|
29
29
|
requestRange(aSelect, aEncode) {
|
|
30
30
|
let item = this._getRequestItem();
|
|
31
|
+
item.requireProperty("items", []);
|
|
31
32
|
|
|
32
33
|
let selectArray = [];
|
|
33
34
|
let encodeString = aEncode.join(",");
|
|
@@ -76,6 +77,7 @@ export default class ApiConnection extends Dbm.core.BaseObject {
|
|
|
76
77
|
|
|
77
78
|
requestData(aFunctionName, aData) {
|
|
78
79
|
let item = this._getRequestItem();
|
|
80
|
+
item.requireProperty("data", null);
|
|
79
81
|
|
|
80
82
|
let parametersArray = [];
|
|
81
83
|
|
|
@@ -94,6 +94,7 @@ export default class WebSocketConnection extends Dbm.core.BaseObject {
|
|
|
94
94
|
requestData(aFunctionName, aData) {
|
|
95
95
|
//console.log("requestData");
|
|
96
96
|
let item = this._getRequestItem();
|
|
97
|
+
item.requireProperty("data", null);
|
|
97
98
|
item.setValue("requestData", {"type": "data", "functionName": aFunctionName, "data": aData, "requestId": item.id});
|
|
98
99
|
this._runRequest(item);
|
|
99
100
|
|
|
@@ -18,7 +18,7 @@ export default class EditorGroup extends Dbm.core.BaseObject {
|
|
|
18
18
|
let itemEditor = this.item["editor_" + aId];
|
|
19
19
|
if(!itemEditor) {
|
|
20
20
|
itemEditor = new Dbm.graphapi.webclient.admin.ItemEditor();
|
|
21
|
-
itemEditor.item.setValue("editedItem", Dbm.
|
|
21
|
+
itemEditor.item.setValue("editedItem", Dbm.getRepositoryItem(aId));
|
|
22
22
|
this.item.setValue("editor_" + aId, itemEditor);
|
|
23
23
|
this.item.editors = [].concat(this.item.editors, itemEditor);
|
|
24
24
|
this.item.anyChange.addCheck(itemEditor.item.properties.changed);
|
|
@@ -42,6 +42,18 @@ export default class ItemEditor extends Dbm.core.BaseObject {
|
|
|
42
42
|
return this.addEditor(aField, aInitialValue, Dbm.graphapi.webclient.admin.SaveFunctions.setField, aUpdateEncoding);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
addFieldTranslationEditor(aField, aLanguage, aInitialValue, aUpdateEncoding = null) {
|
|
46
|
+
let name = "translation_" + aField + "_" + aLanguage;
|
|
47
|
+
let valueEditor = this.item["editor_" + name];
|
|
48
|
+
if(!valueEditor) {
|
|
49
|
+
valueEditor = this.addEditor(name, aInitialValue, Dbm.graphapi.webclient.admin.SaveFunctions.setFieldTranslation, aUpdateEncoding);
|
|
50
|
+
valueEditor.item.setValue("name", aField);
|
|
51
|
+
valueEditor.item.setValue("language", aLanguage);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return valueEditor;
|
|
55
|
+
}
|
|
56
|
+
|
|
45
57
|
_addRelationEditor(aName, aType, aObjectType, aInitialValue, aSaveFunction, aUpdateEncoding = null) {
|
|
46
58
|
let valueEditor = this.item["editor_relation_" + aName];
|
|
47
59
|
if(!valueEditor) {
|
|
@@ -104,6 +116,33 @@ export default class ItemEditor extends Dbm.core.BaseObject {
|
|
|
104
116
|
return this._addMultipleRelationsEditor(name, aType, aObjectType, aInitialValue, Dbm.graphapi.webclient.admin.SaveFunctions.multipleOutgoingRelations, aUpdateEncoding);
|
|
105
117
|
}
|
|
106
118
|
|
|
119
|
+
getAdminMultipleIncomingRelationsEditor(aType, aObjectType) {
|
|
120
|
+
let name = "in_" + aType + "_" + aObjectType;
|
|
121
|
+
let valueEditor = this.item["editor_relation_" + name];
|
|
122
|
+
if(!valueEditor) {
|
|
123
|
+
let relations = Dbm.utils.ArrayFunctions.filterByField(Dbm.objectPath(this.item.editedItem, "relations/in." + aType + ".objects"), "objectTypes", aObjectType, "arrayContains");
|
|
124
|
+
let ids = Dbm.utils.ArrayFunctions.mapField(relations, "id");
|
|
125
|
+
|
|
126
|
+
valueEditor = this.addMultipleIncomingRelationsEditor(aType, aObjectType, ids, "relations");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return valueEditor;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
getAdminMultipleOutgoingRelationsEditor(aType, aObjectType) {
|
|
133
|
+
let name = "out_" + aType + "_" + aObjectType;
|
|
134
|
+
let valueEditor = this.item["editor_relation_" + name];
|
|
135
|
+
if(!valueEditor) {
|
|
136
|
+
let relations = Dbm.utils.ArrayFunctions.filterByField(Dbm.objectPath(this.item.editedItem, "relations/in." + aType + ".objects"), "objectTypes", aObjectType, "arrayContains");
|
|
137
|
+
let ids = Dbm.utils.ArrayFunctions.mapField(relations, "id");
|
|
138
|
+
|
|
139
|
+
valueEditor = this.addMultipleOutgoingRelationsEditor(aType, aObjectType, ids, "relations");
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return valueEditor;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
107
146
|
getVisibilityEditor(aInitialValue) {
|
|
108
147
|
let name = "visibility";
|
|
109
148
|
let valueEditor = this.item["visibility"];
|
|
@@ -28,6 +28,12 @@ export default class ItemSaveData extends Dbm.core.BaseObject {
|
|
|
28
28
|
|
|
29
29
|
return this;
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
setFieldTranslation(aField, aLanguage, aValue) {
|
|
33
|
+
this.createChange("setFieldTranslation", {"value": aValue, "language": aLanguage, "field": aField});
|
|
34
|
+
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
31
37
|
|
|
32
38
|
addUpdateEncoding(aEncoding) {
|
|
33
39
|
this._updateEncodings.push(aEncoding);
|
|
@@ -4,6 +4,10 @@ export const setField = function(aEditor, aItemSaveData) {
|
|
|
4
4
|
aItemSaveData.setField(aEditor.item.name, aEditor.item.editValue.getValue());
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
export const setFieldTranslation = function(aEditor, aItemSaveData) {
|
|
8
|
+
aItemSaveData.setFieldTranslation(aEditor.item.name, aEditor.item.language, aEditor.item.editValue.getValue());
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
export const setUrl = function(aEditor, aItemSaveData) {
|
|
8
12
|
aItemSaveData.createChange("setUrl", {"value": aEditor.item.editValue.getValue()});
|
|
9
13
|
}
|
|
@@ -14,6 +14,21 @@ export default class ValueEditor extends Dbm.core.BaseObject {
|
|
|
14
14
|
this.item.requireProperty("changed", false).connectInput(editValue.item.properties.changed);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
get value() {
|
|
18
|
+
return this.valueProperty.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
set value(aValue) {
|
|
22
|
+
|
|
23
|
+
this.valueProperty.value = aValue;
|
|
24
|
+
|
|
25
|
+
return aValue;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get valueProperty() {
|
|
29
|
+
return this.item.editValue.value;
|
|
30
|
+
}
|
|
31
|
+
|
|
17
32
|
addSaveCommand(aCommand) {
|
|
18
33
|
|
|
19
34
|
this.item.saveCommands = [].concat(this.item.saveCommands, aCommand);
|
|
@@ -3,6 +3,20 @@ import Dbm from "../../../index.js";
|
|
|
3
3
|
export {default as DecodeBaseObject} from "./DecodeBaseObject.js";
|
|
4
4
|
export {default as Relations} from "./Relations.js";
|
|
5
5
|
|
|
6
|
+
export const setupDefaultDecoder = function(aName, aFields = [], aSingleLinks = [], aMultipleLinks = [], aSetupCommands = []) {
|
|
7
|
+
let decodePrefix = "graphApi/decode/";
|
|
8
|
+
|
|
9
|
+
let decoder = new Dbm.graphapi.webclient.decode.DecodeBaseObject();
|
|
10
|
+
decoder.item.setValue("copyFields", aFields);
|
|
11
|
+
decoder.item.setValue("copyLink", aSingleLinks);
|
|
12
|
+
decoder.item.setValue("copyLinks", aMultipleLinks);
|
|
13
|
+
decoder.item.setValue("setupCommands", aSetupCommands);
|
|
14
|
+
decoder.item.setValue("encodingType", aName);
|
|
15
|
+
decoder.item.register(decodePrefix + aName);
|
|
16
|
+
|
|
17
|
+
return decoder;
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
export const fullSetup = function() {
|
|
7
21
|
let decodePrefix = "graphApi/decode/";
|
|
8
22
|
|
|
@@ -60,7 +74,7 @@ export const fullSetup = function() {
|
|
|
60
74
|
let name = "urlRequest";
|
|
61
75
|
let currentDecoder = new Dbm.graphapi.webclient.decode.DecodeBaseObject();
|
|
62
76
|
currentDecoder.item.setValue("copyFields", ["meta/description", "seo/noIndex", "seo/noFollow", "publishDate"]);
|
|
63
|
-
currentDecoder.item.setValue("copyLink", ["category"]);
|
|
77
|
+
currentDecoder.item.setValue("copyLink", ["category", "translations"]);
|
|
64
78
|
currentDecoder.item.setValue("copyLinks", ["categories"]);
|
|
65
79
|
currentDecoder.item.setValue("encodingType", name);
|
|
66
80
|
currentDecoder.item.register(decodePrefix + name);
|
|
@@ -185,4 +199,21 @@ export const fullSetup = function() {
|
|
|
185
199
|
currentDecoder.item.setValue("encodingType", name);
|
|
186
200
|
currentDecoder.item.register(decodePrefix + name);
|
|
187
201
|
}
|
|
202
|
+
|
|
203
|
+
setupDefaultDecoder("linkPreview", ["title", "description", "link", "linkText"], ["page"]);
|
|
204
|
+
setupDefaultDecoder("publishDate", ["publishDate"], []);
|
|
205
|
+
setupDefaultDecoder("language", [], ["language"]);
|
|
206
|
+
setupDefaultDecoder("admin_fieldTranslations", ["fields/translations"], []);
|
|
207
|
+
setupDefaultDecoder("translationGroup", [], [], ["pages"]);
|
|
208
|
+
|
|
209
|
+
let connectTranslations = function(aItem, aTranslationsName, aOutputName, aDefaultFieldName) {
|
|
210
|
+
|
|
211
|
+
let updateFunction = Dbm.flow.updatefunctions.basic.propertyOfWithDefault(aItem.getProperty(aTranslationsName), Dbm.getRepositoryItem("site").properties.currentLanguageCode, aItem.getProperty(aDefaultFieldName));
|
|
212
|
+
aItem.requireProperty(aOutputName, null).connectInput(updateFunction.output.properties.value);
|
|
213
|
+
|
|
214
|
+
aItem.requireProperty(aOutputName + "/update", updateFunction);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
setupDefaultDecoder("name_translations", ["name/translations"], [], [], [Dbm.commands.callFunction(connectTranslations, [Dbm.core.source.event("item"), "name/translations", "name/translated", "name"])]);
|
|
218
|
+
setupDefaultDecoder("title_translations", ["title/translations"], [], [], [Dbm.commands.callFunction(connectTranslations, [Dbm.core.source.event("item"), "title/translations", "title/translated", "title"])]);
|
|
188
219
|
}
|
|
@@ -24,4 +24,45 @@ export const setup = function(aWsPath, aApiPath) {
|
|
|
24
24
|
|
|
25
25
|
let cachedRequests = new Dbm.graphapi.webclient.CachedRequests();
|
|
26
26
|
cachedRequests.item.register("cachedGraphApi");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const requireObjectEncoding = function(aObject, aEncoding, aCommand) {
|
|
30
|
+
console.log("requireObjectEncoding");
|
|
31
|
+
if(aObject["has/encoding/" + aEncoding]) {
|
|
32
|
+
console.log(aObject, aEncoding);
|
|
33
|
+
if(aCommand) {
|
|
34
|
+
aCommand.perform(null, null);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
let graphApi = Dbm.getRepositoryItem("cachedGraphApi").controller;
|
|
39
|
+
|
|
40
|
+
let request = graphApi.requestItem(aObject.id, [aEncoding]);
|
|
41
|
+
|
|
42
|
+
if(aCommand) {
|
|
43
|
+
Dbm.flow.runWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, aCommand);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const loadData = function(aType, aData, aCallback = null) {
|
|
49
|
+
let request = Dbm.getGraphApi().requestData(aType, aData);
|
|
50
|
+
|
|
51
|
+
if(aCallback) {
|
|
52
|
+
let callbackCommand = Dbm.commands.callFunction(aCallback, [Dbm.core.source.staticObject(request, "data")]);
|
|
53
|
+
Dbm.flow.runWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, callbackCommand);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return request.properties.data;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const performAction = function(aType, aData, aCallback = null) {
|
|
60
|
+
let request = Dbm.getGraphApi().performAction(aType, aData);
|
|
61
|
+
|
|
62
|
+
if(aCallback) {
|
|
63
|
+
let callbackCommand = Dbm.commands.callFunction(aCallback, [Dbm.core.source.staticObject(request, "data")]);
|
|
64
|
+
Dbm.flow.runWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, callbackCommand);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return request.properties.data;
|
|
27
68
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class EditObject extends Dbm.react.BaseObject {
|
|
5
|
+
_constructAfterProps() {
|
|
6
|
+
super._constructAfterProps();
|
|
7
|
+
|
|
8
|
+
let editorGroup = this.context.editorGroup;
|
|
9
|
+
if(!editorGroup) {
|
|
10
|
+
editorGroup = new Dbm.graphapi.webclient.admin.EditorGroup();
|
|
11
|
+
}
|
|
12
|
+
this.item.setValue("editorGroup", editorGroup);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
|
|
16
|
+
|
|
17
|
+
let item = this.getPropValue("item");
|
|
18
|
+
|
|
19
|
+
let allLoaded = Dbm.flow.updatefunctions.logic.allAtValue(Dbm.loading.LoadingStatus.LOADED);
|
|
20
|
+
this.item.requireProperty("loaded", false);
|
|
21
|
+
|
|
22
|
+
{
|
|
23
|
+
let request = graphApi.requestRange(
|
|
24
|
+
[
|
|
25
|
+
{"type": "includePrivate"},
|
|
26
|
+
{"type": "includeDraft"},
|
|
27
|
+
{"type": "idSelection", "ids": [item.id]},
|
|
28
|
+
],
|
|
29
|
+
["admin_fields", "admin_fieldTranslations", "relations"]
|
|
30
|
+
);
|
|
31
|
+
allLoaded.addCheck(request.properties.status);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
this.item.properties.loaded.connectInput(allLoaded.output.properties.value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_renderMainElement() {
|
|
38
|
+
|
|
39
|
+
let item = this.getPropValue("item");
|
|
40
|
+
let itemEditor = this.item.editorGroup.getItemEditor(item.id);
|
|
41
|
+
|
|
42
|
+
let children = this.getPropValue("children");
|
|
43
|
+
|
|
44
|
+
return React.createElement(React.Fragment, {},
|
|
45
|
+
React.createElement(Dbm.react.area.HasData, {check: this.item.properties.loaded},
|
|
46
|
+
React.createElement(Dbm.react.context.AddContextVariables, {values: {"editorGroup": this.item.editorGroup, "item": item, "itemEditor": itemEditor}},
|
|
47
|
+
children
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -15,7 +15,6 @@ export default class EditObjectById extends Dbm.react.BaseObject {
|
|
|
15
15
|
let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
|
|
16
16
|
|
|
17
17
|
let id = this.getPropValue("id");
|
|
18
|
-
console.log(id);
|
|
19
18
|
|
|
20
19
|
let allLoaded = Dbm.flow.updatefunctions.logic.allAtValue(Dbm.loading.LoadingStatus.LOADED);
|
|
21
20
|
this.item.requireProperty("loaded", false);
|
|
@@ -27,7 +26,7 @@ export default class EditObjectById extends Dbm.react.BaseObject {
|
|
|
27
26
|
{"type": "includeDraft"},
|
|
28
27
|
{"type": "idSelection", "ids": [id]},
|
|
29
28
|
],
|
|
30
|
-
["admin_fields", "relations"]
|
|
29
|
+
["admin_fields", "admin_fieldTranslations", "relations"]
|
|
31
30
|
);
|
|
32
31
|
allLoaded.addCheck(request.properties.status);
|
|
33
32
|
}
|
|
@@ -43,7 +42,7 @@ export default class EditObjectById extends Dbm.react.BaseObject {
|
|
|
43
42
|
|
|
44
43
|
let children = this.getPropValue("children");
|
|
45
44
|
|
|
46
|
-
return React.createElement(
|
|
45
|
+
return React.createElement(React.Fragment, {},
|
|
47
46
|
React.createElement(Dbm.react.area.HasData, {check: this.item.properties.loaded},
|
|
48
47
|
React.createElement(Dbm.react.context.AddContextVariables, {values: {"editorGroup": this.item.editorGroup, "item": item, "itemEditor": itemEditor}},
|
|
49
48
|
children
|
package/react/admin/EditPage.js
CHANGED
|
@@ -19,6 +19,8 @@ export default class EditPage extends Dbm.react.BaseObject {
|
|
|
19
19
|
itemEditor.addFieldEditor("content", page.content, "content");
|
|
20
20
|
itemEditor.addFieldEditor("publishDate", page.publishDate, "urlRequest");
|
|
21
21
|
itemEditor.addOutgoingRelationEditor("in", "group/pageCategory", page.category ? page.category.id : 0, "urlRequest");
|
|
22
|
+
itemEditor.addIncomingRelationEditor("for", "language", page.language ? page.language.id : 0, "urlRequest");
|
|
23
|
+
itemEditor.addOutgoingRelationEditor("in", "group/translationGroup", page.translations ? page.translations.id : 0, "urlRequest");
|
|
22
24
|
itemEditor.addEditor("url", page.url, Dbm.graphapi.webclient.admin.SaveFunctions.setUrl, "url");
|
|
23
25
|
|
|
24
26
|
let descriptionEditor = itemEditor.addFieldEditor("meta/description", page["meta/description"], "meta/description");
|
|
@@ -55,6 +57,8 @@ export default class EditPage extends Dbm.react.BaseObject {
|
|
|
55
57
|
itemSaveData.setField("contentPreloadTags", preloadImages);
|
|
56
58
|
itemSaveData.setField("lastModified", (new Date()).toISOString());
|
|
57
59
|
itemSaveData.createChange("clearCache", {});
|
|
60
|
+
itemSaveData.createChange("addAction", {"type": "pageUpdates/updateCategoryListing"});
|
|
61
|
+
|
|
58
62
|
|
|
59
63
|
saveData.save();
|
|
60
64
|
}
|
|
@@ -214,6 +218,20 @@ export default class EditPage extends Dbm.react.BaseObject {
|
|
|
214
218
|
),
|
|
215
219
|
React.createElement(Dbm.react.form.GraphApiObjectSelection, {"value": itemEditor.getEditor("relation_out_in_group/pageCategory").item.editValue.value, objectType: "group/pageCategory", className: "standard-field standard-field-padding full-width"}),
|
|
216
220
|
),
|
|
221
|
+
React.createElement("div", {className: "spacing standard"}),
|
|
222
|
+
React.createElement("div", {},
|
|
223
|
+
React.createElement("label", {className: "standard-field-label"},
|
|
224
|
+
"Language"
|
|
225
|
+
),
|
|
226
|
+
React.createElement(Dbm.react.form.GraphApiObjectSelection, {"value": itemEditor.getEditor("relation_in_for_language").item.editValue.value, objectType: "language", className: "standard-field standard-field-padding full-width"}),
|
|
227
|
+
),
|
|
228
|
+
React.createElement("div", {className: "spacing standard"}),
|
|
229
|
+
React.createElement("div", {},
|
|
230
|
+
React.createElement("label", {className: "standard-field-label"},
|
|
231
|
+
"Translations"
|
|
232
|
+
),
|
|
233
|
+
React.createElement(Dbm.react.form.GraphApiObjectSelection, {"value": itemEditor.getEditor("relation_out_in_group/translationGroup").item.editValue.value, objectType: "group/translationGroup", className: "standard-field standard-field-padding full-width"}),
|
|
234
|
+
),
|
|
217
235
|
),
|
|
218
236
|
React.createElement("div", {className: "spacing standard"}),
|
|
219
237
|
React.createElement("div", {"className": "dbm-admin-box dbm-admin-box-padding"},
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class EditorGroup extends Dbm.react.BaseObject {
|
|
5
|
+
_constructAfterProps() {
|
|
6
|
+
super._constructAfterProps();
|
|
7
|
+
|
|
8
|
+
let editorGroup = this.context.editorGroup;
|
|
9
|
+
if(!editorGroup) {
|
|
10
|
+
editorGroup = new Dbm.graphapi.webclient.admin.EditorGroup();
|
|
11
|
+
}
|
|
12
|
+
this.item.setValue("editorGroup", editorGroup);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
_renderMainElement() {
|
|
16
|
+
|
|
17
|
+
let children = this.getPropValue("children");
|
|
18
|
+
|
|
19
|
+
return React.createElement(Dbm.react.context.AddContextVariables, {values: {"editorGroup": this.item.editorGroup}},
|
|
20
|
+
children
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class SaveAllButton extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_save() {
|
|
10
|
+
console.log("_save");
|
|
11
|
+
|
|
12
|
+
let editorGroup = this.context.editorGroup;
|
|
13
|
+
|
|
14
|
+
let saveData = editorGroup.getSaveData();
|
|
15
|
+
|
|
16
|
+
saveData.save();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
_renderMainElement() {
|
|
20
|
+
|
|
21
|
+
let editorGroup = this.context.editorGroup;
|
|
22
|
+
|
|
23
|
+
return React.createElement("div", {},
|
|
24
|
+
React.createElement("div", {className: "save-all-position"},
|
|
25
|
+
React.createElement(Dbm.react.area.OpenCloseExpandableArea, {open: editorGroup.item.properties.changed},
|
|
26
|
+
React.createElement("div", {"className": "standard-button standard-button-padding", "onClick": () => {this._save()}},
|
|
27
|
+
"Save all changes"
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
@@ -2,8 +2,8 @@ import React from "react";
|
|
|
2
2
|
import Dbm from "../../../index.js";
|
|
3
3
|
|
|
4
4
|
export default class EditField extends Dbm.react.BaseObject {
|
|
5
|
-
|
|
6
|
-
super.
|
|
5
|
+
_constructAfterProps() {
|
|
6
|
+
super._constructAfterProps();
|
|
7
7
|
|
|
8
8
|
let item = this.context.item;
|
|
9
9
|
let itemEditor = this.context.itemEditor;
|