- Created static/js/components/listFilter.js:
* Universal list filtering component with search support
* Replaces duplicated applyFilter() functions found in 7 templates
* Features:
- Configurable match functions (default or custom)
- Debounced search input for performance
- Support for data-attribute matching
- Support for selector-based matching
- Optional empty state message
- Optional clear button
- Flexible hiding methods (display/class)
- Updated static/js/components/index.js:
* Exports ListFilter and helper functions
* Added createDataAttrMatcher() helper
* Added createSelectorMatcher() helper
Component ready for use in templates to replace inline applyFilter() implementations.
Tests: All 12 static file tests passing ✅
Next: Replace applyFilter() usage in templates with ListFilter component
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
/**
|
|
* JavaScript Components Index
|
|
*
|
|
* Этот файл служит единой точкой входа для всех JS компонентов.
|
|
* Экспортирует все компоненты для удобного импорта.
|
|
*
|
|
* Использование в шаблонах:
|
|
* <script type="module">
|
|
* import { EmployeeForm, CalendarWidget } from '{% static "js/components/index.js" %}';
|
|
* </script>
|
|
*/
|
|
|
|
// Компоненты фильтрации
|
|
export {
|
|
ListFilter,
|
|
createDataAttrMatcher,
|
|
createSelectorMatcher
|
|
} from './listFilter.js';
|
|
|
|
// Компоненты форм (будут созданы в Фазе 4)
|
|
// export { EmployeeForm } from './employeeForm.js';
|
|
|
|
// Компоненты календаря (будут созданы в Фазе 4)
|
|
// export { CalendarWidget } from './calendarWidget.js';
|
|
|
|
// Компоненты отображения (будут созданы в Фазе 4)
|
|
// export { TeamWheel } from './teamWheel.js';
|
|
|
|
// Версия компонентов
|
|
export const COMPONENTS_VERSION = '1.0.0';
|