fields search on enter
This commit is contained in:
@@ -4,4 +4,4 @@
|
||||
</select>
|
||||
<div class="input-container">
|
||||
<input class="main-element" type="text" autocomplete="espo-off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,2 +1,12 @@
|
||||
|
||||
<input type="text" class="main-element form-control input-sm" data-name="{{name}}" value="{{searchParams.value}}" {{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}}{{#if params.size}} size="{{params.size}}"{{/if}} autocomplete="espo-{{name}}">
|
||||
<input
|
||||
type="text"
|
||||
class="main-element form-control input-sm search-input"
|
||||
data-name="{{name}}"
|
||||
value="{{searchParams.value}}" {{#if params.maxLength}}
|
||||
maxlength="{{params.maxLength}}"{{/if}}{{#if params.size}}
|
||||
size="{{params.size}}"{{/if}}
|
||||
autocomplete="espo-{{name}}"
|
||||
{{#if noSpellCheck}}
|
||||
spellcheck="false"
|
||||
{{/if}}
|
||||
>
|
||||
|
||||
@@ -2,17 +2,41 @@
|
||||
{{options searchTypeList searchType field='dateSearchRanges'}}
|
||||
</select>
|
||||
<div class="input-group primary">
|
||||
<input class="main-element form-control input-sm" type="text" data-name="{{name}}" value="{{dateValue}}" autocomplete="espo-{{name}}">
|
||||
<input
|
||||
class="main-element form-control input-sm search-input"
|
||||
type="text"
|
||||
data-name="{{name}}"
|
||||
value="{{dateValue}}"
|
||||
autocomplete="espo-{{name}}"
|
||||
>
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-default btn-icon btn-sm date-picker-btn" tabindex="-1"><i class="far fa-calendar"></i></button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default btn-icon btn-sm date-picker-btn"
|
||||
tabindex="-1"
|
||||
><i class="far fa-calendar"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="input-group{{#ifNotEqual searchType 'between'}} hidden{{/ifNotEqual}} additional">
|
||||
<input class="main-element form-control input-sm additional" type="text" value="{{dateValueTo}}" autocomplete="espo-{{name}}">
|
||||
<input
|
||||
class="main-element form-control input-sm additional search-input"
|
||||
type="text"
|
||||
value="{{dateValueTo}}"
|
||||
autocomplete="espo-{{name}}"
|
||||
>
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-default btn-icon btn-sm date-picker-btn" tabindex="-1"><i class="far fa-calendar"></i></button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default btn-icon btn-sm date-picker-btn"
|
||||
tabindex="-1"><i class="far fa-calendar"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="hidden additional-number">
|
||||
<input class="main-element form-control input-sm number" type="number" value="{{number}}" placeholder ="{{translate 'Number'}}" autocomplete="espo-{{name}}">
|
||||
<input
|
||||
class="main-element form-control input-sm number search-input"
|
||||
type="number"
|
||||
value="{{number}}"
|
||||
placeholder ="{{translate 'Number'}}"
|
||||
autocomplete="espo-{{name}}"
|
||||
>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,25 @@
|
||||
|
||||
<select class="form-control search-type input-sm">
|
||||
{{options searchTypeList searchType field='intSearchRanges'}}
|
||||
</select>
|
||||
<input type="text" class="form-control input-sm hidden" data-name="{{name}}" value="{{value}}" pattern="[\-]?[0-9]*" {{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}} placeholder="{{translate 'Value'}}" autocomplete="espo-{{name}}">
|
||||
<input type="text" class="form-control{{#ifNotEqual searchType 'between'}} hidden{{/ifNotEqual}} additional input-sm" data-name="{{name}}-additional" value="{{value2}}" pattern="[\-]?[0-9]*" {{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}} placeholder="{{translate 'Value'}}" autocomplete="espo-{{name}}-additional">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control input-sm hidden search-input"
|
||||
data-name="{{name}}"
|
||||
value="{{value}}"
|
||||
pattern="[\-]?[0-9]*"
|
||||
{{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}}
|
||||
placeholder="{{translate 'Value'}}"
|
||||
autocomplete="espo-{{name}}"
|
||||
spellcheck="false"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control{{#ifNotEqual searchType 'between'}} hidden{{/ifNotEqual}} additional input-sm search-input"
|
||||
data-name="{{name}}-additional"
|
||||
value="{{value2}}"
|
||||
pattern="[\-]?[0-9]*"
|
||||
{{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}}
|
||||
placeholder="{{translate 'Value'}}"
|
||||
autocomplete="espo-{{name}}-additional"
|
||||
spellcheck="false"
|
||||
>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<div class="input-group add-team">
|
||||
<input
|
||||
class="main-element form-control input-sm"
|
||||
class="main-element form-control input-sm search-input"
|
||||
type="text"
|
||||
value=""
|
||||
autocomplete="espo-{{name}}"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</select>
|
||||
<div class="input-group">
|
||||
<input
|
||||
class="form-control input-sm"
|
||||
class="form-control input-sm search-input"
|
||||
type="text"
|
||||
data-name="{{nameName}}"
|
||||
value="{{searchData.nameValue}}"
|
||||
@@ -16,8 +16,18 @@
|
||||
spellcheck="false"
|
||||
>
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-sm btn-default btn-icon" data-action="selectLink" tabindex="-1" title="{{translate 'Select'}}"><i class="fas fa-angle-up"></i></button>
|
||||
<button type="button" class="btn btn-sm btn-default btn-icon" data-action="clearLink" tabindex="-1"><i class="fas fa-times"></i></button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-default btn-icon"
|
||||
data-action="selectLink"
|
||||
tabindex="-1"
|
||||
title="{{translate 'Select'}}"><i class="fas fa-angle-up"></i></button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-default btn-icon"
|
||||
data-action="clearLink"
|
||||
tabindex="-1"
|
||||
><i class="fas fa-times"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
<input type="hidden" data-name="{{idName}}" value="{{searchData.idValue}}">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="primary">
|
||||
<div class="input-group">
|
||||
<input
|
||||
class="form-control input-sm"
|
||||
class="form-control input-sm search-input"
|
||||
type="text"
|
||||
data-name="{{nameName}}"
|
||||
value="{{searchData.nameValue}}"
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
|
||||
<select class="form-control search-type input-sm">
|
||||
{{options searchTypeList searchType field='varcharSearchRanges'}}
|
||||
</select>
|
||||
<input type="text" class="main-element form-control input-sm" data-name="{{name}}" value="{{searchData.value}}" {{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}}{{#if params.size}} size="{{params.size}}"{{/if}} autocomplete="espo-{{name}}" placeholder="{{translate 'Value'}}">
|
||||
<input
|
||||
type="text"
|
||||
class="main-element form-control input-sm search-input"
|
||||
data-name="{{name}}"
|
||||
value="{{searchData.value}}"
|
||||
{{#if params.maxLength}}maxlength="{{params.maxLength}}"{{/if}}
|
||||
{{#if params.size}} size="{{params.size}}"{{/if}}
|
||||
autocomplete="espo-{{name}}"
|
||||
placeholder="{{translate 'Value'}}"
|
||||
>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="primary">
|
||||
<div class="input-group">
|
||||
<input
|
||||
class="form-control input-sm"
|
||||
class="form-control input-sm search-input"
|
||||
type="text"
|
||||
data-name="{{nameName}}"
|
||||
value="{{searchData.nameValue}}"
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<div class="input-group add-team">
|
||||
<input
|
||||
class="form-control input-sm element-one-of"
|
||||
class="form-control input-sm element-one-of search-input"
|
||||
type="text"
|
||||
value=""
|
||||
autocomplete="espo-{{name}}"
|
||||
@@ -61,7 +61,7 @@
|
||||
</div>
|
||||
<div class="input-group add-team">
|
||||
<input
|
||||
class="form-control input-sm element-teams"
|
||||
class="form-control input-sm element-teams search-input"
|
||||
type="text"
|
||||
value=""
|
||||
autocomplete="espo-{{name}}"
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
|
||||
<select class="form-control search-type input-sm">
|
||||
{{options searchTypeList searchType field='varcharSearchRanges'}}
|
||||
</select>
|
||||
<input type="text" class="main-element form-control input-sm" data-name="{{name}}" value="{{searchData.value}}" {{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}}{{#if params.size}} size="{{params.size}}"{{/if}} autocomplete="espo-{{name}}" placeholder="{{translate 'Value'}}">
|
||||
<input
|
||||
type="text"
|
||||
class="main-element form-control input-sm search-input"
|
||||
data-name="{{name}}"
|
||||
value="{{searchData.value}}" {{#if params.maxLength}}
|
||||
maxlength="{{params.maxLength}}"{{/if}}{{#if params.size}}
|
||||
size="{{params.size}}"{{/if}}
|
||||
autocomplete="espo-{{name}}"
|
||||
placeholder="{{translate 'Value'}}"
|
||||
{{#if noSpellCheck}}
|
||||
spellcheck="false"
|
||||
{{/if}}
|
||||
>
|
||||
|
||||
@@ -176,11 +176,15 @@ function (Dep, Selectize, RegExpPattern, _) {
|
||||
},
|
||||
|
||||
setupSearch: function () {
|
||||
this.events = _.extend({
|
||||
'change select.search-type': (e) => {
|
||||
this.handleSearchType($(e.currentTarget).val());
|
||||
this.events['change select.search-type'] = e => {
|
||||
this.handleSearchType($(e.currentTarget).val());
|
||||
};
|
||||
|
||||
this.events['keydown .selectize-input input'] = e => {
|
||||
if ('keyCode' in e && e.keyCode === 13) {
|
||||
//this.trigger('search');
|
||||
}
|
||||
}, this.events || {});
|
||||
};
|
||||
},
|
||||
|
||||
handleSearchType: function (type) {
|
||||
@@ -411,6 +415,7 @@ function (Dep, Selectize, RegExpPattern, _) {
|
||||
highlight: false,
|
||||
searchField: ['label'],
|
||||
plugins: ['remove_button'],
|
||||
selectOnTab: false,
|
||||
};
|
||||
|
||||
if (!this.matchAnyWord) {
|
||||
|
||||
@@ -674,6 +674,12 @@ define('views/fields/base', ['view'], function (Dep) {
|
||||
this.searchParams = _.clone(this.options.searchParams || {});
|
||||
this.searchData = {};
|
||||
this.setupSearch();
|
||||
|
||||
this.events['keydown input.search-input'] = e => {
|
||||
if ('keyCode' in e && e.keyCode === 13) {
|
||||
this.trigger('search');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this.on('highlight', () => {
|
||||
|
||||
@@ -321,6 +321,7 @@ function (Dep, Selectize, _) {
|
||||
highlight: false,
|
||||
searchField: ['label'],
|
||||
plugins: ['remove_button'],
|
||||
selectOnTab: false,
|
||||
score: function (search) {
|
||||
// Method of selectize.
|
||||
let score = this.getScoreFunction(search);
|
||||
|
||||
@@ -212,6 +212,7 @@ function (Dep, RegExpPattern, Selectize) {
|
||||
searchField: ['label'],
|
||||
plugins: pluginList,
|
||||
copyClassesToDropdown: true,
|
||||
selectOnTab: false,
|
||||
};
|
||||
|
||||
if (!this.matchAnyWord) {
|
||||
|
||||
@@ -930,6 +930,11 @@ define('views/record/search', ['view'], function (Dep) {
|
||||
|
||||
this.showApplyFiltersButton();
|
||||
});
|
||||
|
||||
this.listenTo(view, 'search', () => {
|
||||
this.search();
|
||||
this.hideApplyFiltersButton();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -26,9 +26,15 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/search/filter', 'view', function (Dep) {
|
||||
define('views/search/filter', ['view'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
/**
|
||||
* @class
|
||||
* @name Class
|
||||
* @extends module:view.Class
|
||||
* @memberOf module:views/search/filter
|
||||
*/
|
||||
return Dep.extend(/** @lends module:views/search/filter.Class# */{
|
||||
|
||||
template: 'search/filter',
|
||||
|
||||
@@ -41,11 +47,12 @@ define('views/search/filter', 'view', function (Dep) {
|
||||
},
|
||||
|
||||
setup: function () {
|
||||
var name = this.name = this.options.name;
|
||||
var type = this.model.getFieldType(name);
|
||||
let name = this.name = this.options.name;
|
||||
let type = this.model.getFieldType(name);
|
||||
|
||||
if (type) {
|
||||
var viewName = this.model.getFieldParam(name, 'view') || this.getFieldManager().getViewName(type);
|
||||
let viewName = this.model.getFieldParam(name, 'view') ||
|
||||
this.getFieldManager().getViewName(type);
|
||||
|
||||
this.createView('field', viewName, {
|
||||
mode: 'search',
|
||||
@@ -55,16 +62,27 @@ define('views/search/filter', 'view', function (Dep) {
|
||||
name: name,
|
||||
},
|
||||
searchParams: this.options.params,
|
||||
}, function (view) {
|
||||
this.listenTo(view, 'change', function () {
|
||||
}, (view) => {
|
||||
this.listenTo(view, 'change', () => {
|
||||
this.trigger('change');
|
||||
}, this);
|
||||
});
|
||||
|
||||
this.listenTo(view, 'search', () => {
|
||||
this.trigger('search');
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {module:views/fields/base.Class}
|
||||
*/
|
||||
getFieldView: function () {
|
||||
return this.getView('field');
|
||||
},
|
||||
|
||||
populateDefaults: function () {
|
||||
var view = this.getView('field');
|
||||
let view = this.getView('field');
|
||||
|
||||
if (!view) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user