devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
40 lines (31 loc) • 1.42 kB
JavaScript
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var $ = require("../../core/renderer"),
map = require("../../core/utils/iterator").map,
PlainEditStrategy = require("../collection/ui.collection_widget.edit.strategy.plain");
var MenuBaseEditStrategy = PlainEditStrategy.inherit({
_getPlainItems: function _getPlainItems() {
return map(this._collectionWidget.option("items"), function getMenuItems(item) {
return item.items ? [item].concat(map(item.items, getMenuItems)) : item;
});
},
_stringifyItem: function _stringifyItem(item) {
var that = this;
return JSON.stringify(item, function (key, value) {
if (key === "template") {
return that._getTemplateString(value);
}
return value;
});
},
_getTemplateString: function _getTemplateString(template) {
var result;
if ((typeof template === "undefined" ? "undefined" : _typeof(template)) === "object") {
result = $(template).text();
} else {
result = template.toString();
}
return result;
}
});
module.exports = MenuBaseEditStrategy;
;