@bennerinformatics/ember-fw-table 2.1.4 → 2.1.6
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/addon/components/fw-table-resort.js +18 -4
- package/addon/components/fw-table-sortable.js +23 -0
- package/addon/templates/components/fw-table-resort.hbs +3 -0
- package/addon/templates/components/fw-table-sortable.hbs +10 -1
- package/docs/api.js +61 -0
- package/docs/assets/css/custom.css +82 -0
- package/docs/assets/css/external-small.png +0 -0
- package/docs/assets/css/logo.png +0 -0
- package/docs/assets/css/main.css +793 -0
- package/docs/assets/css/theme.css +547 -0
- package/docs/assets/favicon.ico +0 -0
- package/docs/assets/icons/android-icon-144x144.png +0 -0
- package/docs/assets/icons/android-icon-192x192.png +0 -0
- package/docs/assets/icons/android-icon-36x36.png +0 -0
- package/docs/assets/icons/android-icon-48x48.png +0 -0
- package/docs/assets/icons/android-icon-72x72.png +0 -0
- package/docs/assets/icons/android-icon-96x96.png +0 -0
- package/docs/assets/icons/apple-icon-114x114.png +0 -0
- package/docs/assets/icons/apple-icon-120x120.png +0 -0
- package/docs/assets/icons/apple-icon-144x144.png +0 -0
- package/docs/assets/icons/apple-icon-152x152.png +0 -0
- package/docs/assets/icons/apple-icon-180x180.png +0 -0
- package/docs/assets/icons/apple-icon-57x57.png +0 -0
- package/docs/assets/icons/apple-icon-60x60.png +0 -0
- package/docs/assets/icons/apple-icon-72x72.png +0 -0
- package/docs/assets/icons/apple-icon-76x76.png +0 -0
- package/docs/assets/icons/apple-icon-precomposed.png +0 -0
- package/docs/assets/icons/apple-icon.png +0 -0
- package/docs/assets/icons/browserconfig.xml +2 -0
- package/docs/assets/icons/favicon-16x16.png +0 -0
- package/docs/assets/icons/favicon-32x32.png +0 -0
- package/docs/assets/icons/favicon-96x96.png +0 -0
- package/docs/assets/icons/favicon.ico +0 -0
- package/docs/assets/icons/manifest.json +41 -0
- package/docs/assets/icons/ms-icon-144x144.png +0 -0
- package/docs/assets/icons/ms-icon-150x150.png +0 -0
- package/docs/assets/icons/ms-icon-310x310.png +0 -0
- package/docs/assets/icons/ms-icon-70x70.png +0 -0
- package/docs/assets/img/ember-logo.png +0 -0
- package/docs/assets/img/fw-logo.png +0 -0
- package/docs/assets/img/spinner.gif +0 -0
- package/docs/assets/index.html +10 -0
- package/docs/assets/js/api-filter.js +56 -0
- package/docs/assets/js/api-list.js +255 -0
- package/docs/assets/js/api-search.js +98 -0
- package/docs/assets/js/apidocs.js +376 -0
- package/docs/assets/js/yui-prettify.js +17 -0
- package/docs/assets/js/yuidoc-bootstrap.js +274 -0
- package/docs/assets/vendor/bootstrap/css/bootstrap.css +6760 -0
- package/docs/assets/vendor/bootstrap/css/bootstrap.min.css +6 -0
- package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
- package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
- package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
- package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/docs/assets/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
- package/docs/assets/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
- package/docs/assets/vendor/bootstrap/js/bootstrap.js +2363 -0
- package/docs/assets/vendor/bootstrap/js/bootstrap.min.js +7 -0
- package/docs/assets/vendor/font-awesome/css/font-awesome.css +2199 -0
- package/docs/assets/vendor/font-awesome/css/font-awesome.min.css +4 -0
- package/docs/assets/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
- package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.svg +685 -0
- package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/docs/assets/vendor/github-slugger/slugger.js +59 -0
- package/docs/assets/vendor/jquery/jquery.min.js +6 -0
- package/docs/assets/vendor/jquery-ui/jquery-ui.min.js +6 -0
- package/docs/assets/vendor/prettify/CHANGES.html +130 -0
- package/docs/assets/vendor/prettify/COPYING +202 -0
- package/docs/assets/vendor/prettify/README.html +203 -0
- package/docs/assets/vendor/prettify/prettify-min.css +1 -0
- package/docs/assets/vendor/prettify/prettify-min.js +1 -0
- package/docs/classes/BaseCells.html +484 -0
- package/docs/classes/Export.html +457 -0
- package/docs/classes/Format.html +577 -0
- package/docs/classes/FwCellAction.html +312 -0
- package/docs/classes/FwCellBoolean.html +311 -0
- package/docs/classes/FwCellNullable.html +312 -0
- package/docs/classes/FwCellPermissionIcon.html +321 -0
- package/docs/classes/FwColumnSortable.html +358 -0
- package/docs/classes/FwColumnTitle.html +314 -0
- package/docs/classes/FwDeleteModal.html +485 -0
- package/docs/classes/FwExpandableRow.html +307 -0
- package/docs/classes/FwPaginationWrapper.html +2129 -0
- package/docs/classes/FwRowToggle.html +355 -0
- package/docs/classes/FwRowToggleIndex.html +312 -0
- package/docs/classes/FwTableExpandedRow.html +307 -0
- package/docs/classes/FwTableResort.html +827 -0
- package/docs/classes/FwTableSortable.html +1293 -0
- package/docs/classes/Row.html +352 -0
- package/docs/classes/Table.html +672 -0
- package/docs/classes/TableUtil.html +410 -0
- package/docs/classes/index.html +10 -0
- package/docs/data.json +2324 -0
- package/docs/elements/index.html +10 -0
- package/docs/files/addon_classes_Row.js.html +318 -0
- package/docs/files/addon_classes_Table.js.html +390 -0
- package/docs/files/addon_components_fw-cell-action.js.html +257 -0
- package/docs/files/addon_components_fw-cell-boolean.js.html +251 -0
- package/docs/files/addon_components_fw-cell-nullable.js.html +253 -0
- package/docs/files/addon_components_fw-cell-permission-icon.js.html +266 -0
- package/docs/files/addon_components_fw-column-sortable.js.html +281 -0
- package/docs/files/addon_components_fw-column-title.js.html +259 -0
- package/docs/files/addon_components_fw-delete-modal.js.html +318 -0
- package/docs/files/addon_components_fw-expandable-row.js.html +248 -0
- package/docs/files/addon_components_fw-pagination-wrapper.js.html +838 -0
- package/docs/files/addon_components_fw-row-toggle-index.js.html +252 -0
- package/docs/files/addon_components_fw-row-toggle.js.html +270 -0
- package/docs/files/addon_components_fw-table-expanded-row.js.html +261 -0
- package/docs/files/addon_components_fw-table-expanded-rows.js.html +263 -0
- package/docs/files/addon_components_fw-table-resort.js.html +457 -0
- package/docs/files/addon_components_fw-table-sortable.js.html +663 -0
- package/docs/files/addon_documentation.js.html +301 -0
- package/docs/files/addon_initializers_responsive.js.html +253 -0
- package/docs/files/addon_utils_base-cells.js.html +313 -0
- package/docs/files/addon_utils_export.js.html +316 -0
- package/docs/files/addon_utils_formats.js.html +335 -0
- package/docs/files/addon_utils_table.js.html +274 -0
- package/docs/files/index.html +10 -0
- package/docs/index.html +252 -0
- package/docs/modules/CellComponents.html +313 -0
- package/docs/modules/ColumnComponents.html +284 -0
- package/docs/modules/Components.html +285 -0
- package/docs/modules/Introduction.html +261 -0
- package/docs/modules/Utils.html +285 -0
- package/docs/modules/index.html +10 -0
- package/package.json +64 -64
- package/.yalc/ember-sortable/.huskyrc +0 -5
- package/.yalc/ember-sortable/CHANGELOG.md +0 -755
- package/.yalc/ember-sortable/CODE_OF_CONDUCT.md +0 -6
- package/.yalc/ember-sortable/LICENSE.md +0 -9
- package/.yalc/ember-sortable/MIGRATION_GUIDE_MODIFIERS.md +0 -95
- package/.yalc/ember-sortable/MIGRATION_GUIDE_V2.md +0 -120
- package/.yalc/ember-sortable/Makefile +0 -24
- package/.yalc/ember-sortable/README.md +0 -423
- package/.yalc/ember-sortable/RELEASE.md +0 -60
- package/.yalc/ember-sortable/V2_MIGRATION_RFC.md +0 -1100
- package/.yalc/ember-sortable/addon/modifiers/sortable-group.js +0 -754
- package/.yalc/ember-sortable/addon/modifiers/sortable-handle.js +0 -29
- package/.yalc/ember-sortable/addon/modifiers/sortable-item.js +0 -869
- package/.yalc/ember-sortable/addon/services/ember-sortable.js +0 -92
- package/.yalc/ember-sortable/addon/system/scroll-container.js +0 -53
- package/.yalc/ember-sortable/addon/system/scroll-parent.js +0 -33
- package/.yalc/ember-sortable/addon/utils/constant.js +0 -9
- package/.yalc/ember-sortable/addon/utils/coordinate.js +0 -34
- package/.yalc/ember-sortable/addon/utils/css-calculation.js +0 -20
- package/.yalc/ember-sortable/addon/utils/defaults.js +0 -26
- package/.yalc/ember-sortable/addon/utils/keyboard.js +0 -32
- package/.yalc/ember-sortable/addon-test-support/helpers/drag.js +0 -111
- package/.yalc/ember-sortable/addon-test-support/helpers/index.js +0 -4
- package/.yalc/ember-sortable/addon-test-support/helpers/reorder.js +0 -41
- package/.yalc/ember-sortable/addon-test-support/utils/keyboard.js +0 -32
- package/.yalc/ember-sortable/addon-test-support/utils/offset.js +0 -14
- package/.yalc/ember-sortable/app/modifiers/sortable-group.js +0 -1
- package/.yalc/ember-sortable/app/modifiers/sortable-handle.js +0 -1
- package/.yalc/ember-sortable/app/modifiers/sortable-item.js +0 -1
- package/.yalc/ember-sortable/app/services/ember-sortable-internal-state.js +0 -1
- package/.yalc/ember-sortable/config/environment.js +0 -5
- package/.yalc/ember-sortable/demo.gif +0 -0
- package/.yalc/ember-sortable/index.js +0 -5
- package/.yalc/ember-sortable/package.json +0 -65
- package/.yalc/ember-sortable/yalc.sig +0 -1
- package/yalc.lock +0 -10
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
YUI.add('api-filter', function (Y) {
|
|
2
|
+
|
|
3
|
+
Y.APIFilter = Y.Base.create('apiFilter', Y.Base, [Y.AutoCompleteBase], {
|
|
4
|
+
// -- Initializer ----------------------------------------------------------
|
|
5
|
+
initializer: function () {
|
|
6
|
+
this._bindUIACBase();
|
|
7
|
+
this._syncUIACBase();
|
|
8
|
+
},
|
|
9
|
+
getDisplayName: function(name) {
|
|
10
|
+
|
|
11
|
+
Y.each(Y.YUIDoc.meta.allModules, function(i) {
|
|
12
|
+
if (i.name === name && i.displayName) {
|
|
13
|
+
name = i.displayName;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
if (this.get('queryType') === 'elements') {
|
|
18
|
+
name = '<' + name + '>';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return name;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}, {
|
|
25
|
+
// -- Attributes -----------------------------------------------------------
|
|
26
|
+
ATTRS: {
|
|
27
|
+
resultHighlighter: {
|
|
28
|
+
value: 'phraseMatch'
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
// May be set to "classes", "elements" or "modules".
|
|
32
|
+
queryType: {
|
|
33
|
+
value: 'classes'
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
source: {
|
|
37
|
+
valueFn: function() {
|
|
38
|
+
var self = this;
|
|
39
|
+
return function(q) {
|
|
40
|
+
var data = Y.YUIDoc.meta[self.get('queryType')],
|
|
41
|
+
out = [];
|
|
42
|
+
Y.each(data, function(v) {
|
|
43
|
+
if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) {
|
|
44
|
+
out.push(v);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return out;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
}, '3.4.0', {requires: [
|
|
55
|
+
'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources'
|
|
56
|
+
]});
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
YUI.add('api-list', function (Y) {
|
|
2
|
+
|
|
3
|
+
var Lang = Y.Lang,
|
|
4
|
+
YArray = Y.Array,
|
|
5
|
+
|
|
6
|
+
APIList = Y.namespace('APIList'),
|
|
7
|
+
|
|
8
|
+
classesNode = Y.one('#api-classes'),
|
|
9
|
+
elementsNode = Y.one('#api-elements'),
|
|
10
|
+
inputNode = Y.one('#api-filter'),
|
|
11
|
+
modulesNode = Y.one('#api-modules'),
|
|
12
|
+
tabviewNode = Y.one('#api-tabview'),
|
|
13
|
+
|
|
14
|
+
tabs = APIList.tabs = {},
|
|
15
|
+
|
|
16
|
+
filter = APIList.filter = new Y.APIFilter({
|
|
17
|
+
inputNode : inputNode,
|
|
18
|
+
maxResults: 1000,
|
|
19
|
+
|
|
20
|
+
on: {
|
|
21
|
+
results: onFilterResults
|
|
22
|
+
}
|
|
23
|
+
}),
|
|
24
|
+
|
|
25
|
+
search = APIList.search = new Y.APISearch({
|
|
26
|
+
inputNode : inputNode,
|
|
27
|
+
maxResults: 100,
|
|
28
|
+
|
|
29
|
+
on: {
|
|
30
|
+
clear : onSearchClear,
|
|
31
|
+
results: onSearchResults
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
tabview = APIList.tabview = new Y.TabView({
|
|
36
|
+
srcNode : tabviewNode,
|
|
37
|
+
panelNode: '#api-tabview-panel',
|
|
38
|
+
render : true,
|
|
39
|
+
|
|
40
|
+
on: {
|
|
41
|
+
selectionChange: onTabSelectionChange
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
|
|
45
|
+
focusManager = APIList.focusManager = tabviewNode.plug(Y.Plugin.NodeFocusManager, {
|
|
46
|
+
circular : true,
|
|
47
|
+
descendants: '#api-filter, .yui3-tab-panel-selected .api-list-item a, .yui3-tab-panel-selected .result a',
|
|
48
|
+
keys : {next: 'down:40', previous: 'down:38'}
|
|
49
|
+
}).focusManager,
|
|
50
|
+
|
|
51
|
+
LIST_ITEM_TEMPLATE =
|
|
52
|
+
'<li class="api-list-item {typeSingular}">' +
|
|
53
|
+
'<a href="{rootPath}{typePlural}/{name}.html">{displayName}</a>' +
|
|
54
|
+
'</li>';
|
|
55
|
+
|
|
56
|
+
// -- Init ---------------------------------------------------------------------
|
|
57
|
+
|
|
58
|
+
// Duckpunch FocusManager's key event handling to prevent it from handling key
|
|
59
|
+
// events when a modifier is pressed.
|
|
60
|
+
Y.before(function (e, activeDescendant) {
|
|
61
|
+
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
62
|
+
return new Y.Do.Prevent();
|
|
63
|
+
}
|
|
64
|
+
}, focusManager, '_focusPrevious', focusManager);
|
|
65
|
+
|
|
66
|
+
Y.before(function (e, activeDescendant) {
|
|
67
|
+
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
68
|
+
return new Y.Do.Prevent();
|
|
69
|
+
}
|
|
70
|
+
}, focusManager, '_focusNext', focusManager);
|
|
71
|
+
|
|
72
|
+
// Create a mapping of tabs in the tabview so we can refer to them easily later.
|
|
73
|
+
tabview.each(function (tab, index) {
|
|
74
|
+
var name = tab.get('label').toLowerCase();
|
|
75
|
+
|
|
76
|
+
tabs[name] = {
|
|
77
|
+
index: index,
|
|
78
|
+
name : name,
|
|
79
|
+
tab : tab
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Switch tabs on Ctrl/Cmd-Left/Right arrows.
|
|
84
|
+
tabviewNode.on('key', onTabSwitchKey, 'down:37,39');
|
|
85
|
+
|
|
86
|
+
// Focus the filter input when the `/` key is pressed.
|
|
87
|
+
Y.one(Y.config.doc).on('key', onSearchKey, 'down:83');
|
|
88
|
+
|
|
89
|
+
// Keep the Focus Manager up to date.
|
|
90
|
+
inputNode.on('focus', function () {
|
|
91
|
+
focusManager.set('activeDescendant', inputNode);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Update all tabview links to resolved URLs.
|
|
95
|
+
tabview.get('panelNode').all('a').each(function (link) {
|
|
96
|
+
link.setAttribute('href', link.get('href'));
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// -- Private Functions --------------------------------------------------------
|
|
100
|
+
function getFilterResultNode() {
|
|
101
|
+
var queryType = filter.get('queryType');
|
|
102
|
+
return queryType === 'classes' ? classesNode
|
|
103
|
+
: queryType === 'elements' ? elementsNode : modulesNode;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// -- Event Handlers -----------------------------------------------------------
|
|
107
|
+
function onFilterResults(e) {
|
|
108
|
+
var frag = Y.one(Y.config.doc.createDocumentFragment()),
|
|
109
|
+
resultNode = getFilterResultNode(),
|
|
110
|
+
typePlural = filter.get('queryType'),
|
|
111
|
+
typeSingular = typePlural === 'classes' ? 'class' : typePlural === 'elements' ? 'element' : 'module';
|
|
112
|
+
|
|
113
|
+
if (e.results.length) {
|
|
114
|
+
YArray.each(e.results, function (result) {
|
|
115
|
+
frag.append(Lang.sub(LIST_ITEM_TEMPLATE, {
|
|
116
|
+
rootPath : APIList.rootPath,
|
|
117
|
+
displayName : filter.getDisplayName(result.highlighted),
|
|
118
|
+
name : result.text,
|
|
119
|
+
typePlural : typePlural,
|
|
120
|
+
typeSingular: typeSingular
|
|
121
|
+
}));
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
frag.append(
|
|
125
|
+
'<li class="message">' +
|
|
126
|
+
'No ' + typePlural + ' found.' +
|
|
127
|
+
'</li>'
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
resultNode.empty(true);
|
|
132
|
+
resultNode.append(frag);
|
|
133
|
+
|
|
134
|
+
focusManager.refresh();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function onSearchClear(e) {
|
|
138
|
+
|
|
139
|
+
focusManager.refresh();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function onSearchKey(e) {
|
|
143
|
+
var target = e.target;
|
|
144
|
+
|
|
145
|
+
if (target.test('input,select,textarea')
|
|
146
|
+
|| target.get('isContentEditable')) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
|
|
152
|
+
inputNode.focus();
|
|
153
|
+
focusManager.refresh();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function onSearchResults(e) {
|
|
157
|
+
var frag = Y.one(Y.config.doc.createDocumentFragment());
|
|
158
|
+
|
|
159
|
+
if (e.results.length) {
|
|
160
|
+
YArray.each(e.results, function (result) {
|
|
161
|
+
frag.append(result.display);
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
frag.append(
|
|
165
|
+
'<li class="message">' +
|
|
166
|
+
'No results found. Maybe you\'ll have better luck with a ' +
|
|
167
|
+
'different query?' +
|
|
168
|
+
'</li>'
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
focusManager.refresh();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function onTabSelectionChange(e) {
|
|
177
|
+
var tab = e.newVal,
|
|
178
|
+
name = tab.get('label').toLowerCase();
|
|
179
|
+
|
|
180
|
+
tabs.selected = {
|
|
181
|
+
index: tab.get('index'),
|
|
182
|
+
name : name,
|
|
183
|
+
tab : tab
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
switch (name) {
|
|
187
|
+
case 'elements':// fallthru
|
|
188
|
+
case 'classes': // fallthru
|
|
189
|
+
case 'modules':
|
|
190
|
+
filter.setAttrs({
|
|
191
|
+
minQueryLength: 0,
|
|
192
|
+
queryType : name
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
search.set('minQueryLength', -1);
|
|
196
|
+
|
|
197
|
+
// Only send a request if this isn't the initially-selected tab.
|
|
198
|
+
if (e.prevVal) {
|
|
199
|
+
filter.sendRequest(filter.get('value'));
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
|
|
203
|
+
case 'everything':
|
|
204
|
+
filter.set('minQueryLength', -1);
|
|
205
|
+
search.set('minQueryLength', 1);
|
|
206
|
+
|
|
207
|
+
if (search.get('value')) {
|
|
208
|
+
search.sendRequest(search.get('value'));
|
|
209
|
+
} else {
|
|
210
|
+
inputNode.focus();
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
|
|
214
|
+
default:
|
|
215
|
+
// WTF? We shouldn't be here!
|
|
216
|
+
filter.set('minQueryLength', -1);
|
|
217
|
+
search.set('minQueryLength', -1);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (focusManager) {
|
|
221
|
+
setTimeout(function () {
|
|
222
|
+
focusManager.refresh();
|
|
223
|
+
}, 1);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function onTabSwitchKey(e) {
|
|
228
|
+
var currentTabIndex = tabs.selected.index;
|
|
229
|
+
|
|
230
|
+
if (!(e.ctrlKey || e.metaKey)) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
e.preventDefault();
|
|
235
|
+
|
|
236
|
+
switch (e.keyCode) {
|
|
237
|
+
case 37: // left arrow
|
|
238
|
+
if (currentTabIndex > 0) {
|
|
239
|
+
tabview.selectChild(currentTabIndex - 1);
|
|
240
|
+
inputNode.focus();
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
|
|
244
|
+
case 39: // right arrow
|
|
245
|
+
if (currentTabIndex < (Y.Object.size(tabs) - 2)) {
|
|
246
|
+
tabview.selectChild(currentTabIndex + 1);
|
|
247
|
+
inputNode.focus();
|
|
248
|
+
}
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
}, '3.4.0', {requires: [
|
|
254
|
+
'api-filter', 'api-search', 'event-key', 'node-focusmanager', 'tabview'
|
|
255
|
+
]});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
YUI.add('api-search', function (Y) {
|
|
2
|
+
|
|
3
|
+
var Lang = Y.Lang,
|
|
4
|
+
Node = Y.Node,
|
|
5
|
+
YArray = Y.Array;
|
|
6
|
+
|
|
7
|
+
Y.APISearch = Y.Base.create('apiSearch', Y.Base, [Y.AutoCompleteBase], {
|
|
8
|
+
// -- Public Properties ----------------------------------------------------
|
|
9
|
+
RESULT_TEMPLATE:
|
|
10
|
+
'<li class="result {resultType}">' +
|
|
11
|
+
'<a href="{url}">' +
|
|
12
|
+
'<h3 class="title">{name}</h3>' +
|
|
13
|
+
'<span class="type">{resultType}</span>' +
|
|
14
|
+
'<div class="description">{description}</div>' +
|
|
15
|
+
'<span class="className">{class}</span>' +
|
|
16
|
+
'</a>' +
|
|
17
|
+
'</li>',
|
|
18
|
+
|
|
19
|
+
// -- Initializer ----------------------------------------------------------
|
|
20
|
+
initializer: function () {
|
|
21
|
+
this._bindUIACBase();
|
|
22
|
+
this._syncUIACBase();
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
// -- Protected Methods ----------------------------------------------------
|
|
26
|
+
_apiResultFilter: function (query, results) {
|
|
27
|
+
// Filter components out of the results.
|
|
28
|
+
return YArray.filter(results, function (result) {
|
|
29
|
+
return result.raw.resultType === 'component' ? false : result;
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
_apiResultFormatter: function (query, results) {
|
|
34
|
+
return YArray.map(results, function (result) {
|
|
35
|
+
var raw = Y.merge(result.raw), // create a copy
|
|
36
|
+
desc = raw.description || '';
|
|
37
|
+
|
|
38
|
+
// Convert description to text and truncate it if necessary.
|
|
39
|
+
desc = Node.create('<div>' + desc + '</div>').get('text');
|
|
40
|
+
|
|
41
|
+
if (desc.length > 65) {
|
|
42
|
+
desc = Y.Escape.html(desc.substr(0, 65)) + ' …';
|
|
43
|
+
} else {
|
|
44
|
+
desc = Y.Escape.html(desc);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
raw['class'] || (raw['class'] = '');
|
|
48
|
+
raw.description = desc;
|
|
49
|
+
|
|
50
|
+
// Use the highlighted result name.
|
|
51
|
+
raw.name = result.highlighted;
|
|
52
|
+
|
|
53
|
+
return Lang.sub(this.RESULT_TEMPLATE, raw);
|
|
54
|
+
}, this);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
_apiTextLocator: function (result) {
|
|
58
|
+
return result.displayName || result.name;
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
// -- Attributes -----------------------------------------------------------
|
|
62
|
+
ATTRS: {
|
|
63
|
+
resultFormatter: {
|
|
64
|
+
valueFn: function () {
|
|
65
|
+
return this._apiResultFormatter;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
resultFilters: {
|
|
70
|
+
valueFn: function () {
|
|
71
|
+
return this._apiResultFilter;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
resultHighlighter: {
|
|
76
|
+
value: 'phraseMatch'
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
resultListLocator: {
|
|
80
|
+
value: 'data.results'
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
resultTextLocator: {
|
|
84
|
+
valueFn: function () {
|
|
85
|
+
return this._apiTextLocator;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
source: {
|
|
90
|
+
value: '/api/v1/search?q={query}&count={maxResults}'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
}, '3.4.0', {requires: [
|
|
96
|
+
'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources',
|
|
97
|
+
'escape'
|
|
98
|
+
]});
|