jsharmony-cms 1.5.6 → 1.7.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/.eslintrc.js +47 -0
- package/.eslintrc_clientjs.js +45 -0
- package/.eslintrc_models.js +63 -0
- package/.eslintrc_onroute.js +57 -0
- package/.eslintrc_test.js +53 -0
- package/clientjs/component/componentModel/componentTemplate.js +11 -11
- package/clientjs/component/componentModel/dataModelTemplate_formPreview.js +12 -12
- package/clientjs/component/componentModel/dataModelTemplate_gridPreview.js +17 -15
- package/clientjs/component/componentModel/fieldModel.js +4 -5
- package/clientjs/component/componentModel/propertiesModelTemplate_form.js +7 -7
- package/clientjs/component/dialogs/dialog.js +13 -15
- package/clientjs/component/dialogs/dialogResizer.js +11 -11
- package/clientjs/component/dialogs/formDialog.js +8 -8
- package/clientjs/component/dialogs/gridDialog.js +5 -5
- package/clientjs/component/dialogs/overlayService.js +4 -4
- package/clientjs/component/editors/dataEditor_form.js +18 -17
- package/clientjs/component/editors/dataEditor_gridPreview.js +13 -14
- package/clientjs/component/editors/dataEditor_gridPreviewController.js +56 -56
- package/clientjs/component/editors/gridDataStore.js +9 -9
- package/clientjs/component/editors/htmlPropertyEditorController.js +6 -6
- package/clientjs/component/editors/propertyEditor_form.js +6 -5
- package/clientjs/component/templateRenderer.js +14 -14
- package/clientjs/component/utils/cloner.js +1 -1
- package/clientjs/component/utils/convert.js +1 -1
- package/clientjs/component/utils/domSerializer.js +5 -5
- package/clientjs/jsHarmonyCMS.Component.js +16 -16
- package/clientjs/jsHarmonyCMS.ComponentManager.js +31 -29
- package/clientjs/jsHarmonyCMS.Controller.js +10 -10
- package/clientjs/jsHarmonyCMS.ControllerExtensions.js +11 -15
- package/clientjs/jsHarmonyCMS.Editor.Picker.js +15 -15
- package/clientjs/jsHarmonyCMS.Editor.TinyMCEPlugin.js +50 -49
- package/clientjs/jsHarmonyCMS.Editor.js +24 -26
- package/clientjs/jsHarmonyCMS.Loader.js +6 -6
- package/clientjs/jsHarmonyCMS.Toolbar.js +25 -25
- package/clientjs/jsHarmonyCMS.Util.js +11 -11
- package/clientjs/jsHarmonyCMS.js +13 -20
- package/init/install.app.config.local.js +14 -14
- package/jsHarmonyCMS.js +35 -38
- package/jsHarmonyCMSConfig.js +16 -17
- package/jsHarmonyCMSPreviewServer.js +4 -6
- package/jsHarmonyCMSSFTPServer.js +23 -24
- package/lint.cmd +10 -0
- package/models/Branch_Clone.js +2 -3
- package/models/Branch_Conflicts.js +16 -16
- package/models/Branch_Conflicts.onroute.js +1 -1
- package/models/Branch_Diff.js +12 -12
- package/models/Branch_Diff.onroute.js +1 -1
- package/models/Branch_Review.js +4 -4
- package/models/Branch_Summary.js +5 -9
- package/models/Branch_Validate.js +10 -10
- package/models/Dashboard_BranchOverview.js +3 -3
- package/models/Dashboard_NewContentPieChart.js +13 -23
- package/models/Dashboard_NewContentPieChart.json +2 -1
- package/models/Dashboard_UserPieChart.js +13 -23
- package/models/Dashboard_UserPieChart.json +2 -1
- package/models/Link_Browser_Base.onroute.js +4 -6
- package/models/Media_Tree.js +61 -65
- package/models/Media_Tree.onroute.js +4 -6
- package/models/Menu_Listing.js +6 -6
- package/models/Menu_Listing.onroute.js +10 -10
- package/models/Menu_Tree.js +44 -45
- package/models/Menu_Tree_Info.js +9 -9
- package/models/Page_Listing.js +2 -2
- package/models/Page_Listing.onroute.js +1 -2
- package/models/Page_Revision_Listing.onroute.js +1 -2
- package/models/Page_Tree.js +17 -17
- package/models/Page_Tree.onroute.js +2 -4
- package/models/Page_Tree_Listing.js +21 -24
- package/models/Publish_Add.onroute.js +1 -3
- package/models/Publish_Add_Branch.js +4 -4
- package/models/Publish_Add_Release.js +7 -7
- package/models/Publish_Add_Release.json +1 -1
- package/models/Publish_Change_Log.js +3 -3
- package/models/Publish_Log.js +6 -6
- package/models/Publish_Redeploy.js +3 -4
- package/models/Search.js +31 -31
- package/models/Site_Config.js +2 -2
- package/models/Site_Config.onroute.js +0 -1
- package/models/Site_Deployment_Target.js +26 -27
- package/models/Site_Deployment_Target_CmsHost_Listing.onroute.js +2 -2
- package/models/Site_Deployment_Target_IntegrationCode.js +7 -7
- package/models/Site_Deployment_Target_IntegrationCode.onroute.js +2 -7
- package/models/Site_Deployment_Target_Key.js +6 -6
- package/models/Site_Deployment_Target_Key_Upload.js +4 -4
- package/models/Site_Deployment_Target_Role.json +4 -1
- package/models/Site_Deployment_Target_Role_Base.json +3 -0
- package/models/Site_SFTP.js +1 -1
- package/models/Site_SFTP.onroute.js +4 -5
- package/models/Site_Template_Component.js +2 -2
- package/models/Site_Template_Component.onroute.js +11 -14
- package/models/Site_Template_Page.js +4 -6
- package/models/Site_Template_Page.onroute.js +11 -14
- package/models/Sitemap_Listing.js +4 -4
- package/models/Sitemap_Tree.js +61 -64
- package/models/Sitemap_Tree.onroute.js +1 -2
- package/models/Sitemap_Tree_Info.js +14 -14
- package/models/_funcs.branch.js +47 -51
- package/models/_funcs.component.js +35 -34
- package/models/_funcs.conflicts.js +70 -72
- package/models/_funcs.deploy.ftp.driver.ftp.js +20 -20
- package/models/_funcs.deploy.ftp.driver.sftp.js +38 -38
- package/models/_funcs.deploy.ftp.js +67 -67
- package/models/_funcs.deploy.js +270 -288
- package/models/_funcs.deployment_target.js +37 -37
- package/models/_funcs.diff.js +69 -70
- package/models/_funcs.js +1 -1
- package/models/_funcs.media.js +16 -18
- package/models/_funcs.menu.js +10 -10
- package/models/_funcs.merge.js +24 -27
- package/models/_funcs.page.js +42 -51
- package/models/_funcs.search.js +26 -44
- package/models/_funcs.sitemap.js +52 -54
- package/models/_funcs.template.js +100 -98
- package/models/_funcs.validate.js +35 -42
- package/models/js/branch.js +20 -20
- package/models/js/site.js +19 -19
- package/models/sql/_functions.json +22 -0
- package/models/sql/objects/deployment.json +16 -5
- package/models/sql/scripts/upgrade/1-7-0.01.sql +3 -0
- package/package.json +1 -1
- package/public/js/jsHarmonyCMS.Controller.page.js +49 -48
- package/public/js/jsHarmonyCMS.js +17701 -17711
- package/public/js/jsHarmonyCMS.local.js +2 -2
- package/public/js/tinymce/plugins/charmapmaterialicons/plugin.min.js +1661 -1660
- package/public/js/tinymce/plugins/jsHarmonyCmsWebSnippet/plugin.min.js +650 -647
- package/test/HTMLDoc.js +53 -54
- package/test/merge-matrix.js +101 -101
- package/test/merge.js +13 -15
- package/test/parseUrl.js +0 -2
- package/public/js/tinymce/plugins/charmapmaterialicons/plugin.orig.js +0 -1706
- package/public/js/tinymce/plugins/jsHarmonyCmsWebSnippet/plugin.orig.js +0 -556
|
@@ -38,7 +38,7 @@ var OverlayService = require('./overlayService');
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
42
|
* Called when the dialog wants to accept/save the changes
|
|
43
43
|
* @callback Dialog~acceptCallback
|
|
44
44
|
* @param {Function} successFunc - Call this function if successfully accepted (e.g., no data errors; valid save).
|
|
@@ -73,7 +73,7 @@ var OverlayService = require('./overlayService');
|
|
|
73
73
|
* @param {Function} cancelFunc - Call this function to trigger cancel logic
|
|
74
74
|
*/
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
/**
|
|
77
77
|
* @class
|
|
78
78
|
* @param {Object} jsh
|
|
79
79
|
* @param {Object} cms
|
|
@@ -92,7 +92,7 @@ function Dialog(jsh, cms, model, config) {
|
|
|
92
92
|
|
|
93
93
|
this.overlayService = new OverlayService(this);
|
|
94
94
|
|
|
95
|
-
this._jsh.$(this._jsh.root).append(this._$wrapper)
|
|
95
|
+
this._jsh.$(this._jsh.root).append(this._$wrapper);
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* @public
|
|
@@ -142,7 +142,7 @@ Dialog.prototype.destroy = function() {
|
|
|
142
142
|
if (this._$overlay) this._$overlay.remove();
|
|
143
143
|
delete Dialog._idLookup[this._id];
|
|
144
144
|
this._destroyed = true;
|
|
145
|
-
}
|
|
145
|
+
};
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* Get a CSS selector that can be used to find
|
|
@@ -152,7 +152,7 @@ Dialog.prototype.destroy = function() {
|
|
|
152
152
|
*/
|
|
153
153
|
Dialog.prototype.getFormSelector = function() {
|
|
154
154
|
return '.xdialogbox.' + this._id;
|
|
155
|
-
}
|
|
155
|
+
};
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
158
|
* Get a globally unique (W.R.T this dialog class)
|
|
@@ -170,7 +170,7 @@ Dialog.prototype.getNextId = function() {
|
|
|
170
170
|
} while (!id);
|
|
171
171
|
Dialog._idLookup[id] = true;
|
|
172
172
|
return id;
|
|
173
|
-
}
|
|
173
|
+
};
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* Get the scroll top position for the page.
|
|
@@ -180,7 +180,7 @@ Dialog.prototype.getNextId = function() {
|
|
|
180
180
|
*/
|
|
181
181
|
Dialog.prototype.getScrollTop = function($wrapper) {
|
|
182
182
|
return $wrapper.scrollParent().scrollTop();
|
|
183
|
-
}
|
|
183
|
+
};
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
186
|
* @private
|
|
@@ -190,7 +190,7 @@ Dialog.prototype.load = function(callback) {
|
|
|
190
190
|
this._jsh.XPage.LoadVirtualModel(_this._jsh.$(_this.getFormSelector()), this._model, function(xmodel) {
|
|
191
191
|
callback(xmodel);
|
|
192
192
|
});
|
|
193
|
-
}
|
|
193
|
+
};
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
196
|
* Create the dialog elements and append to the body DOM.
|
|
@@ -216,7 +216,7 @@ Dialog.prototype.makeDialog = function(id, config) {
|
|
|
216
216
|
.append($form);
|
|
217
217
|
|
|
218
218
|
return $wrapper;
|
|
219
|
-
}
|
|
219
|
+
};
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
222
|
* @public
|
|
@@ -230,14 +230,12 @@ Dialog.prototype.open = function() {
|
|
|
230
230
|
var _this = this;
|
|
231
231
|
var formSelector = this.getFormSelector();
|
|
232
232
|
var oldActive = document.activeElement;
|
|
233
|
-
var hasToolbarOffset = !!_this._cms.editor.getOffsetTop();
|
|
234
|
-
var wasAtTop = !_this._jsh.$(document).scrollTop();
|
|
235
233
|
|
|
236
234
|
this.load(function(xmodel) {
|
|
237
235
|
|
|
238
236
|
var $wrapper = _this._jsh.$(formSelector);
|
|
239
237
|
_this.registerLovs(xmodel);
|
|
240
|
-
var lastScrollTop = 0
|
|
238
|
+
var lastScrollTop = 0;
|
|
241
239
|
_this._jsh.XExt.execif(_this.onBeforeOpen,
|
|
242
240
|
function(f){
|
|
243
241
|
_this.onBeforeOpen(xmodel, f);
|
|
@@ -280,7 +278,7 @@ Dialog.prototype.open = function() {
|
|
|
280
278
|
}
|
|
281
279
|
);
|
|
282
280
|
});
|
|
283
|
-
}
|
|
281
|
+
};
|
|
284
282
|
|
|
285
283
|
/**
|
|
286
284
|
* Register the LOVs defined in the model.
|
|
@@ -304,7 +302,7 @@ Dialog.prototype.registerLovs = function(xmodel) {
|
|
|
304
302
|
xmodel.controller.setLOV(field.name, lovs);
|
|
305
303
|
}
|
|
306
304
|
});
|
|
307
|
-
}
|
|
305
|
+
};
|
|
308
306
|
|
|
309
307
|
/**
|
|
310
308
|
* Set the scroll top position for the page.
|
|
@@ -314,6 +312,6 @@ Dialog.prototype.registerLovs = function(xmodel) {
|
|
|
314
312
|
*/
|
|
315
313
|
Dialog.prototype.setScrollTop = function(position, $wrapper) {
|
|
316
314
|
$wrapper.scrollParent().scrollTop(position);
|
|
317
|
-
}
|
|
315
|
+
};
|
|
318
316
|
|
|
319
317
|
exports = module.exports = Dialog;
|
|
@@ -72,7 +72,7 @@ DialogResizer.addIntervalCallback = function(cb) {
|
|
|
72
72
|
this._intervalId = setInterval(function() {
|
|
73
73
|
_.forEach(DialogResizer._intervalCallbacks, function(item) { item.cb(); });
|
|
74
74
|
}, 100);
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
76
|
|
|
77
77
|
return function() {
|
|
78
78
|
var index = DialogResizer._intervalCallbacks.findIndex(function(item) { return item.id === id; });
|
|
@@ -83,8 +83,8 @@ DialogResizer.addIntervalCallback = function(cb) {
|
|
|
83
83
|
clearInterval(DialogResizer._intervalId);
|
|
84
84
|
DialogResizer._intervalId = undefined;
|
|
85
85
|
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* This must be called when the dialog is closed
|
|
@@ -95,7 +95,7 @@ DialogResizer.prototype.closeDialog = function() {
|
|
|
95
95
|
if (this._execCleanUp) {
|
|
96
96
|
this._execCleanUp();
|
|
97
97
|
}
|
|
98
|
-
}
|
|
98
|
+
};
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* Perform the resize on the given element.
|
|
@@ -104,7 +104,7 @@ DialogResizer.prototype.closeDialog = function() {
|
|
|
104
104
|
*/
|
|
105
105
|
DialogResizer.prototype.resize = function(wrapper) {
|
|
106
106
|
this._jsh.XWindowResize();
|
|
107
|
-
}
|
|
107
|
+
};
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* Use a interval resize strategy to resize the dialog.
|
|
@@ -118,7 +118,7 @@ DialogResizer.prototype.startIntervalResize = function(wrapper) {
|
|
|
118
118
|
this._execCleanUp = DialogResizer.addIntervalCallback(function() {
|
|
119
119
|
_this.resize(wrapper);
|
|
120
120
|
});
|
|
121
|
-
}
|
|
121
|
+
};
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Use a MutationObserver resize strategy to resize the dialog.
|
|
@@ -135,8 +135,8 @@ DialogResizer.prototype.startMutationObserver = function(wrapper) {
|
|
|
135
135
|
observer.observe(wrapper, { childList: true, subtree: true });
|
|
136
136
|
this._execCleanUp = function() {
|
|
137
137
|
observer.disconnect();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
142
|
* Use a ResizeObserver resize strategy to resize the dialog.
|
|
@@ -147,12 +147,12 @@ DialogResizer.prototype.startMutationObserver = function(wrapper) {
|
|
|
147
147
|
DialogResizer.prototype.startResizeObserver = function(wrapper) {
|
|
148
148
|
var _this = this;
|
|
149
149
|
var observer = new ResizeObserver(function() {
|
|
150
|
-
|
|
150
|
+
_this.resize(wrapper);
|
|
151
151
|
});
|
|
152
152
|
observer.observe(wrapper);
|
|
153
153
|
this._execCleanUp = function() {
|
|
154
154
|
observer.unobserve(wrapper);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
157
|
|
|
158
158
|
exports = module.exports = DialogResizer;
|
|
@@ -148,7 +148,7 @@ FormDialog.prototype.augmentModel = function(model, config) {
|
|
|
148
148
|
model.fields = newFields.length > 0 ? (model.fields || []).concat(newFields) : model.fields;
|
|
149
149
|
model.buttons = newButtons.length > 0 ? (model.buttons || []).concat(newButtons) : model.buttons;
|
|
150
150
|
return model;
|
|
151
|
-
}
|
|
151
|
+
};
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
154
|
* Open the form dialog
|
|
@@ -190,7 +190,7 @@ FormDialog.prototype.open = function(data) {
|
|
|
190
190
|
controller.Render(data, undefined, onComplete);
|
|
191
191
|
}
|
|
192
192
|
);
|
|
193
|
-
}
|
|
193
|
+
};
|
|
194
194
|
|
|
195
195
|
|
|
196
196
|
dialog.onOpened = function(_$dialog, _xmodel, acceptFunc, cancelFunc) {
|
|
@@ -199,13 +199,13 @@ FormDialog.prototype.open = function(data) {
|
|
|
199
199
|
$dialog.find('.save_button.xelem' + xmodel.id).off('click').on('click', acceptFunc).on('click', function(e){ e.preventDefault(); });
|
|
200
200
|
$dialog.find('.cancel_button.xelem' + xmodel.id).off('click').on('click', cancelFunc).on('click', function(e){ e.preventDefault(); });
|
|
201
201
|
if (_.isFunction(_this.onOpened)) _this.onOpened($dialog, xmodel);
|
|
202
|
-
}
|
|
202
|
+
};
|
|
203
203
|
|
|
204
204
|
// This callback is called when trying to set/save the data.
|
|
205
205
|
dialog.onAccept = function(success) {
|
|
206
206
|
var isSuccess = _.isFunction(_this.onAccept) && _this.onAccept($dialog, xmodel);
|
|
207
207
|
if (isSuccess) success();
|
|
208
|
-
}
|
|
208
|
+
};
|
|
209
209
|
|
|
210
210
|
dialog.onCancel = function(options) {
|
|
211
211
|
if (!options.force && xmodel.controller.HasUpdates()) {
|
|
@@ -221,18 +221,18 @@ FormDialog.prototype.open = function(data) {
|
|
|
221
221
|
}
|
|
222
222
|
return false;
|
|
223
223
|
}
|
|
224
|
-
}
|
|
224
|
+
};
|
|
225
225
|
|
|
226
226
|
// This is the final callback to be called and is
|
|
227
227
|
// called anytime (whether accepted or canceled) the
|
|
228
228
|
// dialog closes.
|
|
229
229
|
dialog.onClose = function() {
|
|
230
|
-
controller.form.Prop.Enabled = false
|
|
230
|
+
controller.form.Prop.Enabled = false;
|
|
231
231
|
if (_.isFunction(_this.onClose)) _this.onClose($dialog, xmodel);
|
|
232
|
-
}
|
|
232
|
+
};
|
|
233
233
|
|
|
234
234
|
dialog.open();
|
|
235
|
-
}
|
|
235
|
+
};
|
|
236
236
|
|
|
237
237
|
|
|
238
238
|
exports = module.exports = FormDialog;
|
|
@@ -127,7 +127,7 @@ GridDialog.prototype.open = function() {
|
|
|
127
127
|
if(onComplete) onComplete();
|
|
128
128
|
}
|
|
129
129
|
);
|
|
130
|
-
}
|
|
130
|
+
};
|
|
131
131
|
|
|
132
132
|
dialog.onOpened = function(_$dialog, _xmodel, acceptFunc, cancelFunc) {
|
|
133
133
|
$dialog = _$dialog;
|
|
@@ -135,7 +135,7 @@ GridDialog.prototype.open = function() {
|
|
|
135
135
|
controller.Render(function() {
|
|
136
136
|
if (_.isFunction(_this.onOpened)) _this.onOpened(_$dialog, xmodel);
|
|
137
137
|
});
|
|
138
|
-
}
|
|
138
|
+
};
|
|
139
139
|
|
|
140
140
|
dialog.onCancel = function(options) {
|
|
141
141
|
if (!options.force && controller.HasUpdates()) {
|
|
@@ -145,14 +145,14 @@ GridDialog.prototype.open = function() {
|
|
|
145
145
|
});
|
|
146
146
|
return false;
|
|
147
147
|
}
|
|
148
|
-
}
|
|
148
|
+
};
|
|
149
149
|
|
|
150
150
|
dialog.onClose = function() {
|
|
151
151
|
controller.grid.Prop.Enabled = false;
|
|
152
152
|
if (_.isFunction(_this.onClose)) _this.onClose($dialog, xmodel);
|
|
153
|
-
}
|
|
153
|
+
};
|
|
154
154
|
|
|
155
155
|
dialog.open();
|
|
156
|
-
}
|
|
156
|
+
};
|
|
157
157
|
|
|
158
158
|
exports = module.exports = GridDialog;
|
|
@@ -53,7 +53,7 @@ OverlayService.prototype.popDialog = function() {
|
|
|
53
53
|
var zIndex = this.getZIndex($dialog);
|
|
54
54
|
$overlay.css('z-index', zIndex);
|
|
55
55
|
$dialog.before($overlay);
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Add a dialog element to the overlay stack.
|
|
@@ -67,7 +67,7 @@ OverlayService.prototype.pushDialog = function(dialog) {
|
|
|
67
67
|
$overlay.css('z-index', zIndex);
|
|
68
68
|
OverlayService._dialogStack.push(this.jsh.$(dialog));
|
|
69
69
|
this.jsh.$(dialog).before($overlay);
|
|
70
|
-
}
|
|
70
|
+
};
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Get the overlay. Creates and adds to DOM if it doesn't already
|
|
@@ -91,7 +91,7 @@ OverlayService.prototype.getOverlay = function() {
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
return $childOverlay;
|
|
94
|
-
}
|
|
94
|
+
};
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* Get the z-index for the element.
|
|
@@ -103,6 +103,6 @@ OverlayService.prototype.getOverlay = function() {
|
|
|
103
103
|
OverlayService.prototype.getZIndex = function(element) {
|
|
104
104
|
var zIndex = parseInt(this.jsh.$(element).css('zIndex'));
|
|
105
105
|
return isNaN(zIndex) || zIndex == undefined ? 0 : zIndex;
|
|
106
|
-
}
|
|
106
|
+
};
|
|
107
107
|
|
|
108
108
|
exports = module.exports = OverlayService;
|
|
@@ -19,7 +19,6 @@ along with this package. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
|
|
20
20
|
var _ = require('lodash');
|
|
21
21
|
var FormDialog = require('../dialogs/formDialog');
|
|
22
|
-
var ComponentTemplate = require('../componentModel/componentTemplate');
|
|
23
22
|
var HTMLPropertyEditorController = require('./htmlPropertyEditorController');
|
|
24
23
|
var TemplateRenderer = require('../templateRenderer');
|
|
25
24
|
|
|
@@ -27,6 +26,8 @@ var TemplateRenderer = require('../templateRenderer');
|
|
|
27
26
|
|
|
28
27
|
/** @typedef {import('../componentModel/componentTemplate').MediaBrowserControlInfo} MediaBrowserControlInfo */
|
|
29
28
|
|
|
29
|
+
/** @typedef {import('../componentModel/componentTemplate').ComponentTemplate} ComponentTemplate */
|
|
30
|
+
|
|
30
31
|
/**
|
|
31
32
|
* @callback DataEditor_Form~beforeRenderDataItemPreview
|
|
32
33
|
* @param {RenderConfig} renderConfig
|
|
@@ -107,7 +108,7 @@ DataEditor_Form.prototype.attachEditors = function($dialog, $wrapper, $toolbar)
|
|
|
107
108
|
editor.initialize(function() {});
|
|
108
109
|
_this._htmlEditors.push(editor);
|
|
109
110
|
});
|
|
110
|
-
}
|
|
111
|
+
};
|
|
111
112
|
|
|
112
113
|
/**
|
|
113
114
|
* @private
|
|
@@ -120,7 +121,7 @@ DataEditor_Form.prototype.enableBrowserControl = function($dialog, info, enable)
|
|
|
120
121
|
if(jctrl.hasClass('editable')){
|
|
121
122
|
$dialog.find('.xform_ctrl.' + info.titleFieldName).attr('disabled', enable ? null : true);
|
|
122
123
|
}
|
|
123
|
-
}
|
|
124
|
+
};
|
|
124
125
|
|
|
125
126
|
/**
|
|
126
127
|
* Open the editor
|
|
@@ -141,7 +142,7 @@ DataEditor_Form.prototype.open = function(itemData, properties, onAcceptCb, onCl
|
|
|
141
142
|
modelConfig.actions = 'B';
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
itemData = modelTemplate.populateDataInstance(itemData || {});
|
|
145
146
|
|
|
146
147
|
var dialog = new FormDialog(this._jsh, this._cms, modelConfig, {
|
|
147
148
|
acceptButtonLabel: 'OK',
|
|
@@ -194,7 +195,7 @@ DataEditor_Form.prototype.open = function(itemData, properties, onAcceptCb, onCl
|
|
|
194
195
|
// Don't attach any events until after the onRenderGridItemPreview hook is called.
|
|
195
196
|
// Otherwise, the events might be attached to elements that get replaced or removed.
|
|
196
197
|
_this.attachEditors($dialog, $wrapper, $toolbar);
|
|
197
|
-
}
|
|
198
|
+
};
|
|
198
199
|
|
|
199
200
|
// This function NEEDS to be debounced.
|
|
200
201
|
// It SHOULD be anyway so it doesn't re-render the preview on every
|
|
@@ -239,9 +240,9 @@ DataEditor_Form.prototype.open = function(itemData, properties, onAcceptCb, onCl
|
|
|
239
240
|
}, xmodel.get(browserControlName));
|
|
240
241
|
}
|
|
241
242
|
else {
|
|
242
|
-
console.warn(new Error('Unknown browser type ' + info.browserType));
|
|
243
|
+
console.warn(new Error('Unknown editor browser type ' + info.browserType)); // eslint-disable-line no-console
|
|
243
244
|
}
|
|
244
|
-
}
|
|
245
|
+
};
|
|
245
246
|
|
|
246
247
|
editor.onChangeBrowserTitleControl = function(browserControlName) {
|
|
247
248
|
// When the user manually changes the link title,
|
|
@@ -250,7 +251,7 @@ DataEditor_Form.prototype.open = function(itemData, properties, onAcceptCb, onCl
|
|
|
250
251
|
if (info == undefined) return;
|
|
251
252
|
xmodel.set(browserControlName, xmodel.get(info.titleFieldName));
|
|
252
253
|
editor.onChangeData();
|
|
253
|
-
}
|
|
254
|
+
};
|
|
254
255
|
|
|
255
256
|
editor.resetEditorBrowser = function(linkControlName) {
|
|
256
257
|
var info = modelTemplate.getBrowserFieldInfo(linkControlName);
|
|
@@ -259,13 +260,13 @@ DataEditor_Form.prototype.open = function(itemData, properties, onAcceptCb, onCl
|
|
|
259
260
|
xmodel.set(linkControlName, '');
|
|
260
261
|
xmodel.set(info.titleFieldName, '');
|
|
261
262
|
editor.onChangeData();
|
|
262
|
-
}
|
|
263
|
+
};
|
|
263
264
|
|
|
264
265
|
_this._onBeforeRenderDataItemPreview = editor.onBeforeRenderDataItemPreview;
|
|
265
266
|
_this._onRenderDataItemPreview = editor.onRenderDataItemPreview;
|
|
266
267
|
|
|
267
268
|
if(onComplete) onComplete();
|
|
268
|
-
}
|
|
269
|
+
};
|
|
269
270
|
|
|
270
271
|
dialog.onOpened = function($dialog, xmodel) {
|
|
271
272
|
var editor = _this._jsh.App[xmodel.id];
|
|
@@ -276,14 +277,14 @@ DataEditor_Form.prototype.open = function(itemData, properties, onAcceptCb, onCl
|
|
|
276
277
|
$dialog.css('opacity', '1');
|
|
277
278
|
}, 50);
|
|
278
279
|
});
|
|
279
|
-
}
|
|
280
|
+
};
|
|
280
281
|
|
|
281
282
|
dialog.onAccept = function($dialog, xmodel) {
|
|
282
283
|
if(!xmodel.controller.Commit(itemData, 'U')) return false;
|
|
283
284
|
itemData = modelTemplate.makePristineCopy(itemData);
|
|
284
285
|
if (_.isFunction(onAcceptCb)) onAcceptCb(itemData);
|
|
285
286
|
return true;
|
|
286
|
-
}
|
|
287
|
+
};
|
|
287
288
|
|
|
288
289
|
dialog.onCancel = function(options, $dialog, xmodel) {
|
|
289
290
|
if (!options.force && xmodel.controller.HasUpdates()) {
|
|
@@ -293,7 +294,7 @@ DataEditor_Form.prototype.open = function(itemData, properties, onAcceptCb, onCl
|
|
|
293
294
|
});
|
|
294
295
|
return false;
|
|
295
296
|
}
|
|
296
|
-
}
|
|
297
|
+
};
|
|
297
298
|
|
|
298
299
|
dialog.onClose = function($dialog, xmodel) {
|
|
299
300
|
//Destroy model
|
|
@@ -304,10 +305,10 @@ DataEditor_Form.prototype.open = function(itemData, properties, onAcceptCb, onCl
|
|
|
304
305
|
delete _this._jsh.App[xmodel.id];
|
|
305
306
|
_.forEach(_this._htmlEditors, function(editor) { editor.destroy(); });
|
|
306
307
|
if (_.isFunction(onCloseCb)) onCloseCb();
|
|
307
|
-
}
|
|
308
|
+
};
|
|
308
309
|
|
|
309
310
|
dialog.open(itemData);
|
|
310
|
-
}
|
|
311
|
+
};
|
|
311
312
|
|
|
312
313
|
/**
|
|
313
314
|
* @private
|
|
@@ -336,7 +337,7 @@ DataEditor_Form.prototype.renderPreview = function($wrapper, template, data, pro
|
|
|
336
337
|
|
|
337
338
|
$wrapper.empty().append(rendered);
|
|
338
339
|
|
|
339
|
-
if(this._cms && this._cms.editor) this._cms.editor.disableLinks($wrapper)
|
|
340
|
+
if(this._cms && this._cms.editor) this._cms.editor.disableLinks($wrapper);
|
|
340
341
|
|
|
341
342
|
if (_.isFunction(this._onRenderDataItemPreview)) this._onRenderDataItemPreview($wrapper.children()[0], renderConfig.data, renderConfig.properties, _this._cms, _this._component);
|
|
342
343
|
|
|
@@ -345,6 +346,6 @@ DataEditor_Form.prototype.renderPreview = function($wrapper, template, data, pro
|
|
|
345
346
|
_this._cms.componentManager.renderContentComponent(el);
|
|
346
347
|
});
|
|
347
348
|
}, 50);
|
|
348
|
-
}
|
|
349
|
+
};
|
|
349
350
|
|
|
350
351
|
exports = module.exports = DataEditor_Form;
|
|
@@ -18,11 +18,10 @@ along with this package. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
var _ = require('lodash');
|
|
21
|
-
var ComponentTemplate = require('../componentModel/componentTemplate');
|
|
22
21
|
var GridDialog = require('../dialogs/gridDialog');
|
|
23
22
|
var DataEditor_GridPreviewController = require('./dataEditor_gridPreviewController');
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
/** @typedef {import('../componentModel/componentTemplate').ComponentTemplate} ComponentTemplate */
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* @class
|
|
@@ -86,41 +85,41 @@ DataEditor_GridPreview.prototype.open = function(data, properties, dataUpdatedCb
|
|
|
86
85
|
|
|
87
86
|
dataController.onDataUpdated = function(updatedData) {
|
|
88
87
|
if (_.isFunction(dataUpdatedCb)) dataUpdatedCb(updatedData);
|
|
89
|
-
}
|
|
88
|
+
};
|
|
90
89
|
|
|
91
90
|
dataController.onBeforeRenderGridRow = function(renderOptions) {
|
|
92
91
|
if (_.isFunction(componentInstance.onBeforeRenderGridRow)) componentInstance.onBeforeRenderGridRow(renderOptions);
|
|
93
|
-
}
|
|
92
|
+
};
|
|
94
93
|
|
|
95
94
|
dataController.onRenderGridRow = function(element, data, properties, cms, component) {
|
|
96
95
|
if (_.isFunction(componentInstance.onRenderGridRow)) componentInstance.onRenderGridRow(element, data, properties, cms, component);
|
|
97
|
-
}
|
|
96
|
+
};
|
|
98
97
|
|
|
99
98
|
var modelInterface = _this._jsh.App[xmodel.id];
|
|
100
99
|
|
|
101
100
|
modelInterface.onRowBind = function(xmodel, jobj, dataRow) {
|
|
102
101
|
if (!dataController) return;
|
|
103
102
|
dataController.addRow(jobj, dataRow);
|
|
104
|
-
}
|
|
103
|
+
};
|
|
105
104
|
|
|
106
105
|
modelInterface.onCommit = function(xmodel, rowId, callback) {
|
|
107
106
|
callback();
|
|
108
|
-
}
|
|
107
|
+
};
|
|
109
108
|
|
|
110
109
|
modelInterface.close = function() {
|
|
111
110
|
_this._jsh.XExt.CancelDialog();
|
|
112
|
-
}
|
|
111
|
+
};
|
|
113
112
|
|
|
114
113
|
modelInterface.addItem = function() {
|
|
115
114
|
dataController.addItem();
|
|
116
|
-
}
|
|
115
|
+
};
|
|
117
116
|
|
|
118
117
|
if(onComplete) onComplete();
|
|
119
|
-
}
|
|
118
|
+
};
|
|
120
119
|
|
|
121
120
|
dialog.onOpened = function($dialog, xmodel) {
|
|
122
121
|
dataController.initialize();
|
|
123
|
-
}
|
|
122
|
+
};
|
|
124
123
|
|
|
125
124
|
dialog.onClose = function($dialog, xmodel) {
|
|
126
125
|
//Destroy model
|
|
@@ -130,11 +129,11 @@ DataEditor_GridPreview.prototype.open = function(data, properties, dataUpdatedCb
|
|
|
130
129
|
delete _this._jsh.XModels[xmodel.id];
|
|
131
130
|
delete _this._jsh.App[xmodel.id];
|
|
132
131
|
delete _this._jsh.App[componentInstanceId];
|
|
133
|
-
}
|
|
132
|
+
};
|
|
134
133
|
|
|
135
134
|
dialog.open();
|
|
136
135
|
|
|
137
|
-
}
|
|
136
|
+
};
|
|
138
137
|
|
|
139
138
|
DataEditor_GridPreview.prototype.updateAddButtonText = function(selector, captions) {
|
|
140
139
|
|
|
@@ -143,7 +142,7 @@ DataEditor_GridPreview.prototype.updateAddButtonText = function(selector, captio
|
|
|
143
142
|
var $el = this._jsh.$(selector);
|
|
144
143
|
var $img = $el.find('img');
|
|
145
144
|
$el.empty().append($img).append(text);
|
|
146
|
-
}
|
|
145
|
+
};
|
|
147
146
|
|
|
148
147
|
|
|
149
148
|
exports = module.exports = DataEditor_GridPreview;
|