Fix code quality violations and enhance ROUTE-EXISTS-01 rule
Implement JQHTML function cache ID system and fix bundle compilation Implement underscore prefix for system tables Fix JS syntax linter to support decorators and grant exception to Task system SPA: Update planning docs and wishlists with remaining features SPA: Document Navigation API abandonment and future enhancements Implement SPA browser integration with History API (Phase 1) Convert contacts view page to SPA action Convert clients pages to SPA actions and document conversion procedure SPA: Merge GET parameters and update documentation Implement SPA route URL generation in JavaScript and PHP Implement SPA bootstrap controller architecture Add SPA routing manual page (rsx:man spa) Add SPA routing documentation to CLAUDE.md Phase 4 Complete: Client-side SPA routing implementation Update get_routes() consumers for unified route structure Complete SPA Phase 3: PHP-side route type detection and is_spa flag Restore unified routes structure and Manifest_Query class Refactor route indexing and add SPA infrastructure Phase 3 Complete: SPA route registration in manifest Implement SPA Phase 2: Extract router code and test decorators Rename Jqhtml_Component to Component and complete SPA foundation setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* JQHTML Integration - Automatic component registration and binding
|
||||
*
|
||||
* This module automatically:
|
||||
* 1. Registers component classes that extend Jqhtml_Component
|
||||
* 1. Registers component classes that extend Component
|
||||
* 2. Binds templates to component classes when names match
|
||||
* 3. Enables $(selector).component("Component_Name") syntax
|
||||
*/
|
||||
@@ -13,13 +13,54 @@ class Jqhtml_Integration {
|
||||
* of framework init.
|
||||
*/
|
||||
static _on_framework_modules_define() {
|
||||
let jqhtml_components = Manifest.get_extending('Jqhtml_Component');
|
||||
let jqhtml_components = Manifest.get_extending('Component');
|
||||
|
||||
console_debug('JQHTML_INIT', 'Registering ' + jqhtml_components.length + ' Jqhtml Components');
|
||||
console_debug('JQHTML_INIT', 'Registering ' + jqhtml_components.length + ' Components');
|
||||
|
||||
for (let component of jqhtml_components) {
|
||||
jqhtml.register_component(component.class_name, component.class_object);
|
||||
}
|
||||
|
||||
// Assign unique cache IDs to all static methods for component caching
|
||||
// This enables JQHTML to generate deterministic cache keys when functions
|
||||
// are passed as component arguments (e.g., DataGrid data_source functions)
|
||||
const all_classes = Manifest.get_all_classes();
|
||||
let methods_tagged = 0;
|
||||
|
||||
for (const class_info of all_classes) {
|
||||
const class_object = class_info.class_object;
|
||||
const class_name = class_info.class_name;
|
||||
|
||||
// Get all property names from the class object (static methods/properties)
|
||||
const property_names = Object.getOwnPropertyNames(class_object);
|
||||
|
||||
for (const property_name of property_names) {
|
||||
// Skip built-in properties and non-functions
|
||||
if (property_name === 'length' ||
|
||||
property_name === 'name' ||
|
||||
property_name === 'prototype') {
|
||||
continue;
|
||||
}
|
||||
|
||||
const property_value = class_object[property_name];
|
||||
|
||||
// Only tag functions (static methods)
|
||||
if (typeof property_value === 'function') {
|
||||
// Assign unique cache ID: "ClassName.methodName"
|
||||
property_value._jqhtml_cache_id = `${class_name}.${property_name}`;
|
||||
methods_tagged++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console_debug('JQHTML_INIT', `Tagged ${methods_tagged} static methods with _jqhtml_cache_id`);
|
||||
|
||||
// Set the cache key for jqhtml to the application key to enable component caching in local storage.
|
||||
// Modifying the application or the user logging out modifies the scope_key and will invalidate jqhtml cache.
|
||||
jqhtml.set_cache_key(Rsx.scope_key());
|
||||
|
||||
// set this to true if we desire jqhtml verbose output (probably not necessary for end developers)
|
||||
window.jqhtml.debug.verbose = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +72,7 @@ class Jqhtml_Integration {
|
||||
static _on_framework_modules_init($scope) {
|
||||
const is_top_level = !$scope;
|
||||
const promises = [];
|
||||
const components_needing_init = ($scope || $('body')).find('.Jqhtml_Component_Init');
|
||||
const components_needing_init = ($scope || $('body')).find('.Component_Init');
|
||||
if (components_needing_init.length > 0) {
|
||||
console_debug('JQHTML_INIT', `Initializing ${components_needing_init.length} DOM components`);
|
||||
}
|
||||
@@ -45,10 +86,10 @@ class Jqhtml_Integration {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if any parent has Jqhtml_Component_Init class - skip nested components
|
||||
// Check if any parent has Component_Init class - skip nested components
|
||||
let parent = $element[0].parentElement;
|
||||
while (parent) {
|
||||
if (parent.classList.contains('Jqhtml_Component_Init')) {
|
||||
if (parent.classList.contains('Component_Init')) {
|
||||
return; // Skip this element, it's nested
|
||||
}
|
||||
parent = parent.parentElement;
|
||||
@@ -97,14 +138,14 @@ class Jqhtml_Integration {
|
||||
$element.empty();
|
||||
|
||||
// Remove the init class before instantiation to prevent re-initialization
|
||||
$element.removeClass('Jqhtml_Component_Init');
|
||||
$element.removeClass('Component_Init');
|
||||
|
||||
// Create promise for this component's initialization
|
||||
const component_promise = new Promise((resolve) => {
|
||||
// Use jQuery component plugin to create the component
|
||||
// Plugin handles element internally, just pass args
|
||||
// Get the updated $element from
|
||||
let component = $element.component(component_name, component_args_filtered);
|
||||
let component = $element.component(component_name, component_args_filtered).component();
|
||||
|
||||
component.on('render', function () {
|
||||
// Recursively collect promises from nested components
|
||||
|
||||
Reference in New Issue
Block a user