Minor fixes in the Inspector and Scrollbar classes. Minor updates in the Table widget.

This commit is contained in:
alekseybobkov 2015-01-11 20:56:17 -08:00
parent ac758b91c8
commit 090264e3b9
11 changed files with 49 additions and 9 deletions

View File

@ -13833,13 +13833,21 @@ html.cssanimations .fancy-layout .form-tabless-fields .loading-indicator-contain
line-height: 29px;
padding-left: 12px;
padding-right: 3px;
-webkit-border-radius: 0 !important;
-moz-border-radius: 0 !important;
border-radius: 0 !important;
}
.inspector-fields div.custom-select.select2-container .select2-choice.select2-default {
font-weight: normal!Important;
font-weight: normal!important;
}
.inspector-fields div.custom-select.select2-container .loading-indicator > span {
top: 15px;
}
.inspector-fields div.custom-select.select2-container.select2-dropdown-open {
-webkit-border-radius: 0 !important;
-moz-border-radius: 0 !important;
border-radius: 0 !important;
}
.inspector-fields div.custom-select.select2-container.select2-dropdown-open .select2-choice {
background: white;
}

View File

@ -46,7 +46,10 @@
return state.text
}
$('select.custom-select').select2({
$('select.custom-select:not([data-no-auto-update-on-render=true])').select2({
// The data-no-auto-update-on-render attribute allows to disable the
// selec2 automatic initialization for edge cases.
formatResult: formatSelectOption,
formatSelection: formatSelectOption,
escapeMarkup: function(m) { return m; }

View File

@ -166,7 +166,7 @@
Inspector.prototype.init = function() {
// Exit if there are no properties
if (this.config.length == 0)
if (!this.config || this.config.length == 0)
return
var self = this,
@ -736,6 +736,13 @@
})
$('[data-toggle=tooltip]', this.$el.data('oc.popover').$container).tooltip('hide')
if (!e.isDefaultPrevented()) {
$.each(this.editors, function() {
if (this.cleanup)
this.cleanup()
})
}
}
Inspector.prototype.editorExternalPropertyEnabled = function(editor) {
@ -970,6 +977,8 @@
var value = this.inspector.readProperty(this.fieldDef.property),
self = this
$(this.selector).attr('data-no-auto-update-on-render', 'true')
$(this.selector).val(value)
if (!Modernizr.touch) {
@ -1083,6 +1092,10 @@
this.loadOptions(false)
}
InspectorEditorDropdown.prototype.cleanup = function() {
$(this.selector).select2('destroy')
}
$.oc.inspector.editors.inspectorEditorDropdown = InspectorEditorDropdown;
// INSPECTOR PLUGIN DEFINITION

View File

@ -212,6 +212,9 @@
}
Scrollbar.prototype.update = function() {
if (!this.$scrollbar)
return
this.$scrollbar.hide()
this.setThumbSize()
this.setThumbPosition()

View File

@ -274,9 +274,10 @@
line-height: 29px;
padding-left: 12px;
padding-right: 3px;
.border-radius(0)!important;
&.select2-default {
font-weight: normal!Important;
font-weight: normal!important;
}
}
@ -287,6 +288,8 @@
}
&.select2-dropdown-open {
.border-radius(0)!important;
.select2-choice {
background: white;
}
@ -333,6 +336,8 @@ div.control-popover {
td {
font-weight: 400!important;
}
}
}
}

View File

@ -108,6 +108,7 @@ class Table extends WidgetBase
$this->vars['deleting'] = $this->getConfig('deleting', true);
$this->vars['toolbar'] = $this->getConfig('toolbar', true);
$this->vars['height'] = $this->getConfig('height', false) ?: 'false';
$this->vars['dynamicHeight'] = $this->getConfig('dynamicHeight', false) ?: 'false';
$isClientDataSource = $this->isClientDataSource();

View File

@ -176,6 +176,7 @@ The widget is configured with YAML file. Required parameters:
* `deleting` - indicates if record deleting is allowed, default is **true**.
* `toolbar` - specifies if the toolbar should be visible, default is **true**.
* `height` - specifies the data table height, in pixels. The default value is **false** - the height is not limited.
* `dynamicHeight` - determines if the `height` parameter should work as a max height. When this option is enabled and the table height is less than the `height` value, it won't be scrollable.
The `dataSource` parameter can take aliases for some data source classes for the simpler configuration syntax. Known aliases are:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -259,7 +259,11 @@
scrollbarContent = document.createElement('div')
scrollbar.setAttribute('class', 'control-scrollbar')
scrollbar.setAttribute('style', 'height: ' + this.options.height + 'px')
if (this.options.dynamicHeight)
scrollbar.setAttribute('style', 'max-height: ' + this.options.height + 'px')
else
scrollbar.setAttribute('style', 'height: ' + this.options.height + 'px')
scrollbar.appendChild(scrollbarContent)
this.tableContainer.appendChild(scrollbar)
@ -992,7 +996,8 @@
deleting: true,
toolbar: true,
rowSorting: false,
height: false
height: false,
dynamicHeight: false
}
// TABLE PLUGIN DEFINITION

View File

@ -12,4 +12,5 @@
data-records-per-page="<?= e($recordsPerPage) ?>"
data-key-column="<?= e($recordsKeyFrom) ?>"
data-client-data-source-class="<?= e($clientDataSourceClass) ?>"
data-dynamic-height="<?= e($dynamicHeight) ?>"
data-alias="<?= e($this->alias) ?>"></div>