dbm 1.2.9 → 1.4.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/css/admin.css +99 -0
- package/css/all.css +8 -0
- package/css/elements.css +27 -0
- package/css/icons.css +40 -0
- package/css/ratio.css +11 -0
- package/css/rows.css +28 -0
- package/css/tags.css +114 -0
- package/css/utils.css +256 -0
- package/css/variables.css +3 -0
- package/graphapi/webclient/decode/Relations.js +18 -11
- package/loading/ImageLoader.js +65 -0
- package/loading/index.js +27 -1
- package/package.json +10 -4
- package/react/BaseObject.js +5 -3
- package/react/admin/CreatePage.js +2 -2
- package/react/admin/objects/itemeditors/FormattedField.js +21 -0
- package/react/admin/objects/itemeditors/FormattedFieldWithTranslations.js +38 -0
- package/react/admin/objects/itemeditors/MultipleRelations.js +147 -0
- package/react/admin/objects/itemeditors/RichTextField.js +21 -0
- package/react/admin/objects/itemeditors/RichTextFieldWithTranslations.js +38 -0
- package/react/admin/objects/itemeditors/index.js +5 -0
- package/react/area/InsertElement.js +2 -1
- package/react/blocks/faq/AskAQuestion.js +1 -0
- package/react/image/gallery/ImageGallery.js +84 -0
- package/react/image/gallery/ImageGallerySection.js +220 -0
- package/react/image/gallery/index.js +2 -0
- package/react/image/index.js +3 -1
- package/react/index.js +2 -0
- package/react/svg/GlobalFilters.js +22 -0
- package/react/svg/MatrixFilter.js +25 -0
- package/react/svg/index.js +43 -0
- package/react/thirdparty/index.js +2 -0
- package/react/thirdparty/tinymce/Editor.js +106 -0
- package/react/thirdparty/tinymce/InlineEditor.js +28 -0
- package/react/thirdparty/tinymce/index.js +2 -0
- package/react/thirdparty/vimeo/Player.js +65 -0
- package/react/thirdparty/vimeo/index.js +1 -0
- package/repository/Item.js +28 -0
- package/utils/ArrayFunctions.js +69 -0
- package/utils/StringFunctions.js +12 -1
- package/utils/index.js +2 -1
- package/utils/svg/ColorMatrixFunctions.js +12 -0
- package/utils/svg/index.js +1 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import Dbm from "../../../index.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export default class ImageGallerySection extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
let images = this.getPropValue("images");
|
|
9
|
+
console.log("images>>>>>", images);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
_removedUsedProps(aProps) {
|
|
13
|
+
delete aProps["images"];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
createLayout2(aImages, aSpacing = 20, aWidth = 800) {
|
|
17
|
+
|
|
18
|
+
let width1 = aImages[0].width;
|
|
19
|
+
let width2 = aImages[1].width;
|
|
20
|
+
|
|
21
|
+
let height1 = aImages[0].height;
|
|
22
|
+
let height2 = aImages[1].height;
|
|
23
|
+
|
|
24
|
+
let minHeight = Math.min(height1, height2);
|
|
25
|
+
let heightRatio1 = (minHeight / height1);
|
|
26
|
+
let heightRatio2 = (minHeight / height2);
|
|
27
|
+
|
|
28
|
+
let scaledWidth1 = width1*heightRatio1;
|
|
29
|
+
let scaledWidth2 = width2*heightRatio2;
|
|
30
|
+
|
|
31
|
+
let totalWidth = (scaledWidth1+scaledWidth2);
|
|
32
|
+
let widthRatio1 = (scaledWidth1/totalWidth);
|
|
33
|
+
let widthRatio2 = (scaledWidth2/totalWidth);
|
|
34
|
+
|
|
35
|
+
let newWidth1 = (aWidth-aSpacing)*widthRatio1;
|
|
36
|
+
let newWidth2 = (aWidth-aSpacing)*widthRatio2;
|
|
37
|
+
|
|
38
|
+
let newHeight1 = (height1/width1)*newWidth1;
|
|
39
|
+
let newHeight2 = (height2/width2)*newWidth2;
|
|
40
|
+
|
|
41
|
+
console.log(newWidth1, newHeight1, newWidth2, newHeight2);
|
|
42
|
+
|
|
43
|
+
let layout = React.createElement("div", {className: "flex-row"},
|
|
44
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth1, "height": newHeight1}},
|
|
45
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[0].url, "className": "full-size background-cover"})
|
|
46
|
+
),
|
|
47
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": aSpacing}}),
|
|
48
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth2, "height": newHeight2}},
|
|
49
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[1].url, "className": "full-size background-cover"})
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return layout;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
createLayout3(aImages, aSpacing = 20, aWidth = 800) {
|
|
57
|
+
|
|
58
|
+
let width1 = aImages[0].width;
|
|
59
|
+
let width2 = aImages[1].width;
|
|
60
|
+
let width3 = aImages[2].width;
|
|
61
|
+
|
|
62
|
+
let height1 = aImages[0].height;
|
|
63
|
+
let height2 = aImages[1].height;
|
|
64
|
+
let height3 = aImages[2].height;
|
|
65
|
+
|
|
66
|
+
let minHeight = Math.min(height1, height2, height3);
|
|
67
|
+
let heightRatio1 = (minHeight / height1);
|
|
68
|
+
let heightRatio2 = (minHeight / height2);
|
|
69
|
+
let heightRatio3 = (minHeight / height3);
|
|
70
|
+
|
|
71
|
+
let scaledWidth1 = width1*heightRatio1;
|
|
72
|
+
let scaledWidth2 = width2*heightRatio2;
|
|
73
|
+
let scaledWidth3 = width3*heightRatio3;
|
|
74
|
+
|
|
75
|
+
let totalWidth = (scaledWidth1+scaledWidth2+scaledWidth3);
|
|
76
|
+
let widthRatio1 = (scaledWidth1/totalWidth);
|
|
77
|
+
let widthRatio2 = (scaledWidth2/totalWidth);
|
|
78
|
+
let widthRatio3 = (scaledWidth3/totalWidth);
|
|
79
|
+
|
|
80
|
+
let newWidth1 = (aWidth-2*aSpacing)*widthRatio1;
|
|
81
|
+
let newWidth2 = (aWidth-2*aSpacing)*widthRatio2;
|
|
82
|
+
let newWidth3 = (aWidth-2*aSpacing)*widthRatio3;
|
|
83
|
+
|
|
84
|
+
let newHeight1 = (height1/width1)*newWidth1;
|
|
85
|
+
let newHeight2 = (height2/width2)*newWidth2;
|
|
86
|
+
let newHeight3 = (height3/width3)*newWidth3;
|
|
87
|
+
|
|
88
|
+
console.log(newWidth1, newHeight1, newWidth2, newHeight2, newWidth3, newHeight3);
|
|
89
|
+
|
|
90
|
+
let layout = React.createElement("div", {className: "flex-row"},
|
|
91
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth1, "height": newHeight1}},
|
|
92
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[0].url, "className": "full-size background-cover"})
|
|
93
|
+
),
|
|
94
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": aSpacing}}),
|
|
95
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth2, "height": newHeight2}},
|
|
96
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[1].url, "className": "full-size background-cover"})
|
|
97
|
+
),
|
|
98
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": aSpacing}}),
|
|
99
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth3, "height": newHeight3}},
|
|
100
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[2].url, "className": "full-size background-cover"})
|
|
101
|
+
),
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return layout;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
createLayout4(aImages, aSpacing = 20, aWidth = 800) {
|
|
108
|
+
let width1 = aImages[0].width;
|
|
109
|
+
let width2 = aImages[1].width;
|
|
110
|
+
let width3 = aImages[2].width;
|
|
111
|
+
let width4 = aImages[3].width;
|
|
112
|
+
|
|
113
|
+
let height1 = aImages[0].height;
|
|
114
|
+
let height2 = aImages[1].height;
|
|
115
|
+
let height3 = aImages[2].height;
|
|
116
|
+
let height4 = aImages[3].height;
|
|
117
|
+
|
|
118
|
+
let innerP = (height3/width3)/((height2/width2)+(height3/width3));
|
|
119
|
+
|
|
120
|
+
let fullWidth = (aWidth-aSpacing);
|
|
121
|
+
let p = (fullWidth*(height1/width1)-aSpacing+innerP*aSpacing*(height2/width2))/(fullWidth*((height4/width4)+innerP*(height2/width2)+(height1/width1)))
|
|
122
|
+
|
|
123
|
+
let innerWidth = fullWidth*p-aSpacing;
|
|
124
|
+
|
|
125
|
+
let newWidth1 = (1-p)*fullWidth;
|
|
126
|
+
let newWidth2 = (innerWidth)*innerP;
|
|
127
|
+
let newWidth3 = (innerWidth)*(1-innerP);
|
|
128
|
+
let newWidth4 = (p)*fullWidth;
|
|
129
|
+
|
|
130
|
+
let newHeight1 = (height1/width1)*newWidth1;
|
|
131
|
+
let newHeight2 = (height2/width2)*newWidth2;
|
|
132
|
+
let newHeight3 = (height3/width3)*newWidth3;
|
|
133
|
+
let newHeight4 = (height4/width4)*newWidth4;
|
|
134
|
+
|
|
135
|
+
let layout = React.createElement("div", {className: "flex-row"},
|
|
136
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth1, "height": newHeight1}},
|
|
137
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[0].url, "className": "full-size background-cover"})
|
|
138
|
+
),
|
|
139
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": aSpacing}}),
|
|
140
|
+
React.createElement("div", {className: "flex-row-item"},
|
|
141
|
+
React.createElement("div", {className: "flex-row"},
|
|
142
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth2, "height": newHeight2}},
|
|
143
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[1].url, "className": "full-size background-cover"})
|
|
144
|
+
),
|
|
145
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": aSpacing}}),
|
|
146
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth3, "height": newHeight3}},
|
|
147
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[2].url, "className": "full-size background-cover"})
|
|
148
|
+
),
|
|
149
|
+
),
|
|
150
|
+
React.createElement("div", {style: {"height": aSpacing}}),
|
|
151
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth4, "height": newHeight4}},
|
|
152
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[3].url, "className": "full-size background-cover"})
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
return layout;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
_renderMainElement() {
|
|
161
|
+
|
|
162
|
+
let images = this.getPropValue("images");
|
|
163
|
+
let width = this.getPropValueWithDefault("width", 800);
|
|
164
|
+
let spacing = this.getPropValueWithDefault("spacing", 20);
|
|
165
|
+
|
|
166
|
+
let layout = null;
|
|
167
|
+
switch(images.length) {
|
|
168
|
+
case 2:
|
|
169
|
+
layout = this.createLayout2(images, spacing, width);
|
|
170
|
+
break;
|
|
171
|
+
case 3:
|
|
172
|
+
layout = this.createLayout3(images, spacing, width);
|
|
173
|
+
break;
|
|
174
|
+
case 4:
|
|
175
|
+
layout = this.createLayout4(images, spacing, width);
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return this._createMainElement("div", {},
|
|
180
|
+
layout
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/*
|
|
185
|
+
createLayout4(aImages, aSpacing = 20, aWidth = 800) {
|
|
186
|
+
let width1 = aImages[0].width;
|
|
187
|
+
let width2 = aImages[1].width;
|
|
188
|
+
let width3 = aImages[2].width;
|
|
189
|
+
let width4 = aImages[3].width;
|
|
190
|
+
|
|
191
|
+
let height1 = aImages[0].height;
|
|
192
|
+
let height2 = aImages[1].height;
|
|
193
|
+
let height3 = aImages[2].height;
|
|
194
|
+
let height4 = aImages[3].height;
|
|
195
|
+
|
|
196
|
+
let innerP = (height2/width2)/((height1/width1)+(height2/width2));
|
|
197
|
+
let innerWidth = aWidth-aSpacing;
|
|
198
|
+
|
|
199
|
+
let newWidth1 = (innerWidth)*innerP;
|
|
200
|
+
let newWidth2 = (innerWidth)*(1-innerP);
|
|
201
|
+
|
|
202
|
+
let newHeight1 = (height1/width1)*newWidth1;
|
|
203
|
+
let newHeight2 = (height2/width2)*newWidth2;
|
|
204
|
+
|
|
205
|
+
console.log(innerP);
|
|
206
|
+
|
|
207
|
+
let layout = React.createElement("div", {className: "flex-row"},
|
|
208
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth1, "height": newHeight1}},
|
|
209
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[0].url, "className": "full-size background-cover"})
|
|
210
|
+
),
|
|
211
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": aSpacing}}),
|
|
212
|
+
React.createElement("div", {className: "flex-row-item", style: {"width": newWidth2, "height": newHeight2}},
|
|
213
|
+
React.createElement(Dbm.react.image.Image, {"src": aImages[1].url, "className": "full-size background-cover"})
|
|
214
|
+
),
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
return layout;
|
|
218
|
+
}
|
|
219
|
+
*/
|
|
220
|
+
}
|
package/react/image/index.js
CHANGED
|
@@ -2,4 +2,6 @@ export {default as Image} from "./Image.js";
|
|
|
2
2
|
export {default as WidthScaledImage} from "./WidthScaledImage.js";
|
|
3
3
|
export {default as CoverScaledImage} from "./CoverScaledImage.js";
|
|
4
4
|
export {default as ContainScaledImage} from "./ContainScaledImage.js";
|
|
5
|
-
export {default as LocalImage} from "./LocalImage.js";
|
|
5
|
+
export {default as LocalImage} from "./LocalImage.js";
|
|
6
|
+
|
|
7
|
+
export * as gallery from "./gallery/index.js";
|
package/react/index.js
CHANGED
|
@@ -16,3 +16,5 @@ export * as login from "./login/index.js";
|
|
|
16
16
|
export * as image from "./image/index.js";
|
|
17
17
|
export * as animation from "./animation/index.js";
|
|
18
18
|
export * as interaction from "./interaction/index.js";
|
|
19
|
+
export * as thirdparty from "./thirdparty/index.js";
|
|
20
|
+
export * as svg from "./svg/index.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Dbm from "../../index.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export default class GlobalFilters extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_renderMainElement() {
|
|
10
|
+
|
|
11
|
+
let colorFilters = Dbm.getRepositoryItem("globalSvg");
|
|
12
|
+
colorFilters.requireProperty("filters", []);
|
|
13
|
+
|
|
14
|
+
return this._createMainElement("svg", {xmlns: "http://www.w3.org/2000/svg", style: {display: "none"}},
|
|
15
|
+
React.createElement("defs", null,
|
|
16
|
+
React.createElement(Dbm.react.area.List, {items: colorFilters.properties.filters},
|
|
17
|
+
React.createElement(Dbm.react.area.InsertElement, {element: Dbm.react.source.item("element")})
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Dbm from "../../index.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export default class MatrixFilter extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_removedUsedProps(aProps) {
|
|
10
|
+
delete aProps["id"];
|
|
11
|
+
delete aProps["matrix"];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
_renderMainElement() {
|
|
15
|
+
|
|
16
|
+
let id = this.getPropValue("id");
|
|
17
|
+
let matrix = this.getPropValue("matrix");
|
|
18
|
+
|
|
19
|
+
console.log(id);
|
|
20
|
+
|
|
21
|
+
return this._createMainElement("filter", {id: id},
|
|
22
|
+
React.createElement("feColorMatrix", {type: "matrix", values: matrix})
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Dbm from "../../index.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export {default as GlobalFilters} from "./GlobalFilters.js";
|
|
5
|
+
export {default as MatrixFilter} from "./MatrixFilter.js";
|
|
6
|
+
|
|
7
|
+
export const addGlobalRgbColorFilter = function(aName, aR, aG, aB) {
|
|
8
|
+
|
|
9
|
+
let colorFilters = Dbm.getRepositoryItem("globalSvg");
|
|
10
|
+
colorFilters.requireProperty("filters", []);
|
|
11
|
+
|
|
12
|
+
let item = Dbm.getRepositoryItem("globalSvg/filters/" + aName);
|
|
13
|
+
item.setValue("element", React.createElement(Dbm.react.svg.MatrixFilter, {"id": aName, "matrix": Dbm.utils.svg.ColorMatrixFunctions.floodColor(aR, aG, aB)}));
|
|
14
|
+
|
|
15
|
+
let filters = [].concat(colorFilters.filters);
|
|
16
|
+
filters.push(item);
|
|
17
|
+
colorFilters.filters = filters;
|
|
18
|
+
|
|
19
|
+
return item;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const addGlobalHexColorFilter = function(aName, aColor) {
|
|
23
|
+
let value;
|
|
24
|
+
|
|
25
|
+
if (typeof aColor === "number") {
|
|
26
|
+
value = aColor;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
let hex = aColor.replace(/^#/, '');
|
|
30
|
+
|
|
31
|
+
if(hex.length === 3) {
|
|
32
|
+
hex = hex.split('').map(c => c + c).join('');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
value = parseInt(hex, 16);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let r = (value >> 16) & 255;
|
|
39
|
+
let g = (value >> 8) & 255;
|
|
40
|
+
let b = value & 255;
|
|
41
|
+
|
|
42
|
+
return addGlobalRgbColorFilter(aName, r, g, b)
|
|
43
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class Editor extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this._element = document.createElement("div");
|
|
9
|
+
this._editor = null;
|
|
10
|
+
|
|
11
|
+
let valueProperty = this.getDynamicPropWithoutState("value", "");
|
|
12
|
+
Dbm.flow.addUpdateCommand(valueProperty, Dbm.commands.callFunction(this._valueUpdated.bind(this)));
|
|
13
|
+
|
|
14
|
+
this._callback_changeBound = this._callback_change.bind(this);
|
|
15
|
+
|
|
16
|
+
let tinymce = Dbm.getRepositoryItem("tinymce");
|
|
17
|
+
let version = tinymce.version ? tinymce.version : "8";
|
|
18
|
+
|
|
19
|
+
let scriptLoader = Dbm.loading.loadScript("https://cdn.tiny.cloud/1/" + tinymce.key + "/tinymce/" + version + "/tinymce.min.js");
|
|
20
|
+
Dbm.flow.runWhenMatched(scriptLoader.item.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._scriptLoaded.bind(this)));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getSettings() {
|
|
24
|
+
let settings = {
|
|
25
|
+
menubar: false,
|
|
26
|
+
statusbar: false,
|
|
27
|
+
|
|
28
|
+
convert_urls: false,
|
|
29
|
+
relative_urls: false,
|
|
30
|
+
remove_script_host: false,
|
|
31
|
+
verify_url: false,
|
|
32
|
+
|
|
33
|
+
plugins: "link image code autoresize advlist lists",
|
|
34
|
+
toolbar: "undo redo | styleselect | bold italic | link | alignleft aligncenter alignright | numlist bullist | code removeformat | fontsizeselect"
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return settings;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_scriptLoaded() {
|
|
41
|
+
|
|
42
|
+
let settings = this.getSettings();
|
|
43
|
+
|
|
44
|
+
settings["target"] = this._element;
|
|
45
|
+
settings["setup"] = this._callback_setup.bind(this);
|
|
46
|
+
|
|
47
|
+
window.tinymce.init(settings);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_callback_setup(aEditor) {
|
|
51
|
+
this._editor = aEditor;
|
|
52
|
+
|
|
53
|
+
this._editor.on('change', this._callback_change.bind(this));
|
|
54
|
+
this._editor.on('input', this._callback_change.bind(this));
|
|
55
|
+
this._editor.on('init', this._callback_init.bind(this));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
_callback_init() {
|
|
59
|
+
let value = this.getDynamicProp("value").value;
|
|
60
|
+
if(value) {
|
|
61
|
+
this._editor.setContent(value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_callback_change() {
|
|
67
|
+
//console.log("_callback_change");
|
|
68
|
+
|
|
69
|
+
let value = this._editor.getContent();
|
|
70
|
+
|
|
71
|
+
this.getDynamicProp("value").getMostUpstreamProperty().setValue(value);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_valueUpdated() {
|
|
75
|
+
//console.log("_valueUpdated");
|
|
76
|
+
let value = this.getPropValue("value");
|
|
77
|
+
|
|
78
|
+
if(this._editor) {
|
|
79
|
+
let currentValue = this._editor.getContent();
|
|
80
|
+
|
|
81
|
+
if(value !== currentValue && value !== undefined && value !== null) {
|
|
82
|
+
this._editor.setContent(value);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
componentDidMount() {
|
|
88
|
+
//console.log("componentDidMount");
|
|
89
|
+
let parentElement = this.item.holder;
|
|
90
|
+
parentElement.appendChild(this._element);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
componentDidUpdate() {
|
|
94
|
+
//console.log("componentDidUpdate");
|
|
95
|
+
let parentElement = this.item.holder;
|
|
96
|
+
parentElement.appendChild(this._element);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
_renderMainElement() {
|
|
100
|
+
|
|
101
|
+
return this._createMainElement("div", {},
|
|
102
|
+
React.createElement("div", {"ref": this.createRef("holder")})
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class InlineEditor extends Dbm.react.thirdparty.tinymce.Editor {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getSettings() {
|
|
10
|
+
let settings = super.getSettings();
|
|
11
|
+
|
|
12
|
+
let additionalSettings = {
|
|
13
|
+
inline: true,
|
|
14
|
+
toolbar: false,
|
|
15
|
+
plugins: 'link quickbars',
|
|
16
|
+
quickbars_selection_toolbar: 'bold italic | link',
|
|
17
|
+
quickbars_insert_toolbar: false,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
settings = {
|
|
21
|
+
...settings,
|
|
22
|
+
...additionalSettings
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return settings;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class Player extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this._element = document.createElement("div");
|
|
9
|
+
this._element.classList.add("vimeo-player");
|
|
10
|
+
|
|
11
|
+
let scriptLoader = Dbm.loading.loadScript("https://player.vimeo.com/api/player.js");
|
|
12
|
+
Dbm.flow.runWhenMatched(scriptLoader.item.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._scriptLoaded.bind(this)));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
_removedUsedProps(aProps) {
|
|
16
|
+
delete aProps["video"];
|
|
17
|
+
delete aProps["responsive"];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getSettings() {
|
|
21
|
+
|
|
22
|
+
let data = {
|
|
23
|
+
responsive: this.getPropValueWithDefault("responsive", false),
|
|
24
|
+
title: false,
|
|
25
|
+
byline: false,
|
|
26
|
+
portrait: false,
|
|
27
|
+
color: "000000"
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_scriptLoaded() {
|
|
34
|
+
|
|
35
|
+
let video = this.getPropValue("video");
|
|
36
|
+
|
|
37
|
+
let data = this.getSettings();
|
|
38
|
+
|
|
39
|
+
if(typeof video === "number" || (typeof video === "string" && video.trim() !== "" && !isNaN(video))) {
|
|
40
|
+
data["id"] = video;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
data["url"] = video;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let player = new window.Vimeo.Player(this._element, data);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
componentDidMount() {
|
|
50
|
+
//console.log("componentDidMount");
|
|
51
|
+
let parentElement = this.item.holder;
|
|
52
|
+
parentElement.appendChild(this._element);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
componentDidUpdate() {
|
|
56
|
+
//console.log("componentDidUpdate");
|
|
57
|
+
let parentElement = this.item.holder;
|
|
58
|
+
parentElement.appendChild(this._element);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_renderMainElement() {
|
|
62
|
+
return this._createMainElement("div", {"className": "vimeo-player-holder", "ref": this.createRef("holder")});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default as Player} from "./Player.js";
|
package/repository/Item.js
CHANGED
|
@@ -71,4 +71,32 @@ export default class Item extends Dbm.core.LifeCycleObject {
|
|
|
71
71
|
}
|
|
72
72
|
return this.properties[aName];
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
addToArray(aName, aValue) {
|
|
76
|
+
let currentArray = this[aName];
|
|
77
|
+
if(!currentArray) {
|
|
78
|
+
this.setValue(aName, [aValue]);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
currentArray = [].concat(currentArray);
|
|
82
|
+
currentArray.push(aValue);
|
|
83
|
+
this[aName] = currentArray;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
removeFromArray(aName, aValue) {
|
|
90
|
+
let currentArray = this[aName];
|
|
91
|
+
if(currentArray) {
|
|
92
|
+
let index = currentArray.indexOf(aValue);
|
|
93
|
+
if(index !== -1) {
|
|
94
|
+
currentArray = [].concat(currentArray);
|
|
95
|
+
currentArray.splice(index, 1);
|
|
96
|
+
this[aName] = currentArray;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
74
102
|
}
|
package/utils/ArrayFunctions.js
CHANGED
|
@@ -391,5 +391,74 @@ export const scoreItems = function(aArray, aScoreFunction) {
|
|
|
391
391
|
|
|
392
392
|
sortOnField(returnArray, "value");
|
|
393
393
|
|
|
394
|
+
return returnArray;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export const splitArray = function(aArray, aGroupSize) {
|
|
398
|
+
let returnArray = [];
|
|
399
|
+
let currentGroup = null;
|
|
400
|
+
|
|
401
|
+
let currentArray = aArray;
|
|
402
|
+
let currentArrayLength = currentArray.length;
|
|
403
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
404
|
+
if(i % aGroupSize === 0) {
|
|
405
|
+
currentGroup = [];
|
|
406
|
+
returnArray.push(currentGroup);
|
|
407
|
+
}
|
|
408
|
+
currentGroup.push(currentArray[i]);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return returnArray;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export const mapArrayToObject = function(aArray, aKeyField, aDataField = null, aKeyPrefix = "") {
|
|
415
|
+
|
|
416
|
+
let returnObject = {};
|
|
417
|
+
|
|
418
|
+
let currentArray = aArray;
|
|
419
|
+
let currentArrayLength = currentArray.length;
|
|
420
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
421
|
+
let currentArrayEntry = currentArray[i];
|
|
422
|
+
let key = aKeyPrefix + Dbm.objectPath(currentArrayEntry, aKeyField);
|
|
423
|
+
let data = aDataField ? Dbm.objectPath(currentArrayEntry, aDataField) : currentArrayEntry;
|
|
424
|
+
|
|
425
|
+
returnObject[key] = data;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
return returnObject;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export const mapObjectToArray = function(aObject, aKeyField, aDataField = null, aKeyPrefix = "") {
|
|
432
|
+
let returnArray = [];
|
|
433
|
+
|
|
434
|
+
for(let objectName in aObject) {
|
|
435
|
+
let currentEntry = aObject[objectName];
|
|
436
|
+
let newObject = {};
|
|
437
|
+
|
|
438
|
+
if(aDataField !== null) {
|
|
439
|
+
newObject[aDataField] = currentEntry;
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
for(let objectName2 in currentEntry) {
|
|
443
|
+
newObject[objectName2] = currentEntry[objectName2];
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if(aKeyField) {
|
|
447
|
+
newObject[aKeyField] = objectName.substring(aKeyPrefix.length, objectName.length);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
returnArray.push(newObject);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return returnArray;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export const mapObjectToArrayWithoutKey = function(aObject) {
|
|
457
|
+
let returnArray = [];
|
|
458
|
+
|
|
459
|
+
for(let objectName in aObject) {
|
|
460
|
+
returnArray.push(aObject[objectName]);
|
|
461
|
+
}
|
|
462
|
+
|
|
394
463
|
return returnArray;
|
|
395
464
|
}
|
package/utils/StringFunctions.js
CHANGED
|
@@ -37,4 +37,15 @@ export const convertToCamelCase = function(aText) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
return returnText;
|
|
40
|
-
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const getMatchingPrefix = function(aString1, aString2) {
|
|
43
|
+
let maxLength = Math.min(aString1.length, aString2.length);
|
|
44
|
+
let i = 0;
|
|
45
|
+
|
|
46
|
+
while(i < maxLength && aString1[i] === aString2[i]) {
|
|
47
|
+
i++;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return aString1.slice(0, i);
|
|
51
|
+
}
|
package/utils/index.js
CHANGED
|
@@ -9,4 +9,5 @@ export * as LevenshteinDistance from "./LevenshteinDistance.js";
|
|
|
9
9
|
export {default as MultidimensionalArrayHolder} from "./MultidimensionalArrayHolder.js";
|
|
10
10
|
export {default as ArrayOperationResult} from "./ArrayOperationResult.js";
|
|
11
11
|
|
|
12
|
-
export * as thirdparty from "./thirdparty/index.js";
|
|
12
|
+
export * as thirdparty from "./thirdparty/index.js";
|
|
13
|
+
export * as svg from "./svg/index.js";
|