@cundi/refine-xaf 1.0.10 → 1.0.12

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/README.md CHANGED
@@ -14,6 +14,7 @@ This is an SDK integrating XAF backend with Refine frontend, including core logi
14
14
  - `TiptapEditor`: Rich text editor with support for Images, Tables, Tasks, Math (LaTeX), YouTube, Emoji, Highlight, and Text Color.
15
15
  - `DrawioEditor`: Draw.io diagram editor with i18n language sync support.
16
16
  - `Base64Upload`: Image upload component for XAF byte[] fields.
17
+ - `GlobalSearch`: Full-text search component with type-grouped results and navigation.
17
18
  - `ApplicationUser`: Complete user management (List, Create, Edit, Role Assignment).
18
19
  - `PermissionPolicyRole`: Complete role and permission management.
19
20
  - `TriggerRule`: Webhook trigger rule management (List, Create, Edit).
@@ -322,6 +323,40 @@ import { Form } from "antd";
322
323
  // - autosave?: boolean - Enable autosave (default: true)
323
324
  ```
324
325
 
326
+ ### GlobalSearch Usage
327
+
328
+ Use the `GlobalSearch` component to provide full-text search across all business objects. The component includes debounced input, type-grouped results, and automatic navigation.
329
+
330
+ ```tsx
331
+ import { GlobalSearch } from "@cundi/refine-xaf";
332
+
333
+ // Basic usage (typically in Header or layout)
334
+ <GlobalSearch />
335
+
336
+ // With custom options
337
+ <GlobalSearch
338
+ placeholder="Search customers, orders..."
339
+ maxResults={100}
340
+ maxPerType={20}
341
+ width={320}
342
+ />
343
+
344
+ // With custom click handler (overrides default navigation)
345
+ <GlobalSearch
346
+ onResultClick={(result) => {
347
+ console.log('Selected:', result);
348
+ // result: { displayName, objectKey, typeCaption, typeFullName, matchedContent }
349
+ }}
350
+ />
351
+
352
+ // Props:
353
+ // - placeholder?: string - Search input placeholder
354
+ // - maxResults?: number - Maximum total results (default: 200)
355
+ // - maxPerType?: number - Maximum results per type (default: 50)
356
+ // - width?: number | string - Input width (default: 280)
357
+ // - onResultClick?: (result) => void - Custom click handler
358
+ ```
359
+
325
360
  ## Development and Publishing
326
361
 
327
362
  1. **Install Dependencies**: `npm install`
@@ -361,7 +396,13 @@ console.log(claims.sub, claims.exp);
361
396
 
362
397
  ## Changelog
363
398
 
364
- ### v1.0.8 (Latest)
399
+ ### v1.0.12 (Latest)
400
+ - Added `GlobalSearch` component for full-text search across all persistent types
401
+ - Added `globalSearch` service function for API calls
402
+ - GlobalSearch features: debounce input, grouped results by type, click navigation to show/edit pages
403
+ - Full i18n support for GlobalSearch (en, zh-TW)
404
+
405
+ ### v1.0.8
365
406
  - Added `TriggerRuleList`, `TriggerRuleCreate`, `TriggerRuleEdit` components
366
407
  - Added `TriggerLogList` component with detail drawer
367
408
  - Added `MirrorTypeMappingConfigList`, `MirrorTypeMappingConfigCreate`, `MirrorTypeMappingConfigEdit` components
package/dist/index.d.mts CHANGED
@@ -283,6 +283,49 @@ declare const keycloakService: {
283
283
  logout: (idToken?: string) => void;
284
284
  };
285
285
 
286
+ /**
287
+ * Individual search result item
288
+ */
289
+ interface GlobalSearchResult {
290
+ /** Display name of the matched object */
291
+ displayName?: string;
292
+ /** Key value of the matched object */
293
+ objectKey?: string;
294
+ /** Human-readable type name */
295
+ typeCaption?: string;
296
+ /** Full type name including namespace */
297
+ typeFullName?: string;
298
+ /** Summary of where the keyword was matched */
299
+ matchedContent?: string;
300
+ }
301
+ /**
302
+ * Response from the global search API
303
+ */
304
+ interface GlobalSearchResponse {
305
+ /** The search keyword that was used */
306
+ keyword?: string;
307
+ /** Total number of results returned */
308
+ totalCount: number;
309
+ /** List of search results */
310
+ results: GlobalSearchResult[];
311
+ }
312
+ /**
313
+ * Options for the global search query
314
+ */
315
+ interface GlobalSearchOptions {
316
+ /** Maximum total results (default: 200) */
317
+ maxResults?: number;
318
+ /** Maximum results per type (default: 50) */
319
+ maxPerType?: number;
320
+ }
321
+ /**
322
+ * Execute a global full-text search across all persistent types.
323
+ * @param keyword - Search keyword (required)
324
+ * @param options - Optional search parameters
325
+ * @returns Promise with search results
326
+ */
327
+ declare function globalSearch(keyword: string, options?: GlobalSearchOptions): Promise<GlobalSearchResponse>;
328
+
286
329
  declare const refineXafTranslations: {
287
330
  en: {
288
331
  pages: {
@@ -363,6 +406,12 @@ declare const refineXafTranslations: {
363
406
  drawioEditor: {
364
407
  loading: string;
365
408
  };
409
+ globalSearch: {
410
+ placeholder: string;
411
+ searching: string;
412
+ noResults: string;
413
+ resultCount: string;
414
+ };
366
415
  };
367
416
  common: {
368
417
  actions: {
@@ -624,6 +673,12 @@ declare const refineXafTranslations: {
624
673
  drawioEditor: {
625
674
  loading: string;
626
675
  };
676
+ globalSearch: {
677
+ placeholder: string;
678
+ searching: string;
679
+ noResults: string;
680
+ resultCount: string;
681
+ };
627
682
  };
628
683
  common: {
629
684
  actions: {
@@ -867,6 +922,25 @@ interface DrawioEditorProps {
867
922
  }
868
923
  declare const DrawioEditor: React.FC<DrawioEditorProps>;
869
924
 
925
+ interface GlobalSearchProps {
926
+ /** Placeholder text for search input */
927
+ placeholder?: string;
928
+ /** Maximum total results (default: 200) */
929
+ maxResults?: number;
930
+ /** Maximum results per type (default: 50) */
931
+ maxPerType?: number;
932
+ /** Custom click handler for results */
933
+ onResultClick?: (result: GlobalSearchResult) => void;
934
+ /** Width of search input (default: 280) */
935
+ width?: number | string;
936
+ /** Custom type labels for localization (e.g., { "Article": "文章", "Product": "產品" }) */
937
+ typeLabels?: Record<string, string>;
938
+ }
939
+ /**
940
+ * Global full-text search component with dropdown results
941
+ */
942
+ declare const GlobalSearch: React.FC<GlobalSearchProps>;
943
+
870
944
  declare const LoginPage: React.FC;
871
945
 
872
946
  declare const KeycloakLoginPage: React.FC;
@@ -964,4 +1038,4 @@ interface IModelType {
964
1038
  }
965
1039
  declare const useModelTypes: () => _tanstack_react_query.UseQueryResult<IModelType[], Error>;
966
1040
 
967
- export { ApplicationUserCreate, ApplicationUserEdit, ApplicationUserList, AuthCallback, BackgroundJobList, type BackgroundJobListProps, Base64Upload, ColorModeContext, ColorModeContextProvider, DrawioEditor, type DrawioEditorProps, Header, HttpError, HttpMethodType, type IApplicationUser, type IJwtClaims, type IMirrorTypeMappingConfig, type IModelType, type IPermissionPolicyRole, type IPermissionPolicyTypePermissionObject, type ITriggerLog, type ITriggerRule, type IXafEntity, KeycloakLoginPage, type KeycloakTokenResponse, LoginPage, MirrorTypeMappingConfigCreate, MirrorTypeMappingConfigEdit, MirrorTypeMappingConfigList, RelatedList, type RequestOptions, RoleCreate, RoleEdit, RoleList, SecurityPermissionPolicy, SecurityPermissionState, SmartList, TOKEN_KEY, TiptapEditor, type TiptapEditorProps, TriggerEventType, TriggerLogList, TriggerRuleCreate, TriggerRuleEdit, TriggerRuleList, authProvider, authService, dataProvider, generatePassword, getBaseUrl, httpClient, keycloakService, parseJwt, refineXafTranslations, useColorMode, useModelTypes, validatePasswordStrength };
1041
+ export { ApplicationUserCreate, ApplicationUserEdit, ApplicationUserList, AuthCallback, BackgroundJobList, type BackgroundJobListProps, Base64Upload, ColorModeContext, ColorModeContextProvider, DrawioEditor, type DrawioEditorProps, GlobalSearch, type GlobalSearchOptions, type GlobalSearchProps, type GlobalSearchResponse, type GlobalSearchResult, Header, HttpError, HttpMethodType, type IApplicationUser, type IJwtClaims, type IMirrorTypeMappingConfig, type IModelType, type IPermissionPolicyRole, type IPermissionPolicyTypePermissionObject, type ITriggerLog, type ITriggerRule, type IXafEntity, KeycloakLoginPage, type KeycloakTokenResponse, LoginPage, MirrorTypeMappingConfigCreate, MirrorTypeMappingConfigEdit, MirrorTypeMappingConfigList, RelatedList, type RequestOptions, RoleCreate, RoleEdit, RoleList, SecurityPermissionPolicy, SecurityPermissionState, SmartList, TOKEN_KEY, TiptapEditor, type TiptapEditorProps, TriggerEventType, TriggerLogList, TriggerRuleCreate, TriggerRuleEdit, TriggerRuleList, authProvider, authService, dataProvider, generatePassword, getBaseUrl, globalSearch, httpClient, keycloakService, parseJwt, refineXafTranslations, useColorMode, useModelTypes, validatePasswordStrength };
package/dist/index.d.ts CHANGED
@@ -283,6 +283,49 @@ declare const keycloakService: {
283
283
  logout: (idToken?: string) => void;
284
284
  };
285
285
 
286
+ /**
287
+ * Individual search result item
288
+ */
289
+ interface GlobalSearchResult {
290
+ /** Display name of the matched object */
291
+ displayName?: string;
292
+ /** Key value of the matched object */
293
+ objectKey?: string;
294
+ /** Human-readable type name */
295
+ typeCaption?: string;
296
+ /** Full type name including namespace */
297
+ typeFullName?: string;
298
+ /** Summary of where the keyword was matched */
299
+ matchedContent?: string;
300
+ }
301
+ /**
302
+ * Response from the global search API
303
+ */
304
+ interface GlobalSearchResponse {
305
+ /** The search keyword that was used */
306
+ keyword?: string;
307
+ /** Total number of results returned */
308
+ totalCount: number;
309
+ /** List of search results */
310
+ results: GlobalSearchResult[];
311
+ }
312
+ /**
313
+ * Options for the global search query
314
+ */
315
+ interface GlobalSearchOptions {
316
+ /** Maximum total results (default: 200) */
317
+ maxResults?: number;
318
+ /** Maximum results per type (default: 50) */
319
+ maxPerType?: number;
320
+ }
321
+ /**
322
+ * Execute a global full-text search across all persistent types.
323
+ * @param keyword - Search keyword (required)
324
+ * @param options - Optional search parameters
325
+ * @returns Promise with search results
326
+ */
327
+ declare function globalSearch(keyword: string, options?: GlobalSearchOptions): Promise<GlobalSearchResponse>;
328
+
286
329
  declare const refineXafTranslations: {
287
330
  en: {
288
331
  pages: {
@@ -363,6 +406,12 @@ declare const refineXafTranslations: {
363
406
  drawioEditor: {
364
407
  loading: string;
365
408
  };
409
+ globalSearch: {
410
+ placeholder: string;
411
+ searching: string;
412
+ noResults: string;
413
+ resultCount: string;
414
+ };
366
415
  };
367
416
  common: {
368
417
  actions: {
@@ -624,6 +673,12 @@ declare const refineXafTranslations: {
624
673
  drawioEditor: {
625
674
  loading: string;
626
675
  };
676
+ globalSearch: {
677
+ placeholder: string;
678
+ searching: string;
679
+ noResults: string;
680
+ resultCount: string;
681
+ };
627
682
  };
628
683
  common: {
629
684
  actions: {
@@ -867,6 +922,25 @@ interface DrawioEditorProps {
867
922
  }
868
923
  declare const DrawioEditor: React.FC<DrawioEditorProps>;
869
924
 
925
+ interface GlobalSearchProps {
926
+ /** Placeholder text for search input */
927
+ placeholder?: string;
928
+ /** Maximum total results (default: 200) */
929
+ maxResults?: number;
930
+ /** Maximum results per type (default: 50) */
931
+ maxPerType?: number;
932
+ /** Custom click handler for results */
933
+ onResultClick?: (result: GlobalSearchResult) => void;
934
+ /** Width of search input (default: 280) */
935
+ width?: number | string;
936
+ /** Custom type labels for localization (e.g., { "Article": "文章", "Product": "產品" }) */
937
+ typeLabels?: Record<string, string>;
938
+ }
939
+ /**
940
+ * Global full-text search component with dropdown results
941
+ */
942
+ declare const GlobalSearch: React.FC<GlobalSearchProps>;
943
+
870
944
  declare const LoginPage: React.FC;
871
945
 
872
946
  declare const KeycloakLoginPage: React.FC;
@@ -964,4 +1038,4 @@ interface IModelType {
964
1038
  }
965
1039
  declare const useModelTypes: () => _tanstack_react_query.UseQueryResult<IModelType[], Error>;
966
1040
 
967
- export { ApplicationUserCreate, ApplicationUserEdit, ApplicationUserList, AuthCallback, BackgroundJobList, type BackgroundJobListProps, Base64Upload, ColorModeContext, ColorModeContextProvider, DrawioEditor, type DrawioEditorProps, Header, HttpError, HttpMethodType, type IApplicationUser, type IJwtClaims, type IMirrorTypeMappingConfig, type IModelType, type IPermissionPolicyRole, type IPermissionPolicyTypePermissionObject, type ITriggerLog, type ITriggerRule, type IXafEntity, KeycloakLoginPage, type KeycloakTokenResponse, LoginPage, MirrorTypeMappingConfigCreate, MirrorTypeMappingConfigEdit, MirrorTypeMappingConfigList, RelatedList, type RequestOptions, RoleCreate, RoleEdit, RoleList, SecurityPermissionPolicy, SecurityPermissionState, SmartList, TOKEN_KEY, TiptapEditor, type TiptapEditorProps, TriggerEventType, TriggerLogList, TriggerRuleCreate, TriggerRuleEdit, TriggerRuleList, authProvider, authService, dataProvider, generatePassword, getBaseUrl, httpClient, keycloakService, parseJwt, refineXafTranslations, useColorMode, useModelTypes, validatePasswordStrength };
1041
+ export { ApplicationUserCreate, ApplicationUserEdit, ApplicationUserList, AuthCallback, BackgroundJobList, type BackgroundJobListProps, Base64Upload, ColorModeContext, ColorModeContextProvider, DrawioEditor, type DrawioEditorProps, GlobalSearch, type GlobalSearchOptions, type GlobalSearchProps, type GlobalSearchResponse, type GlobalSearchResult, Header, HttpError, HttpMethodType, type IApplicationUser, type IJwtClaims, type IMirrorTypeMappingConfig, type IModelType, type IPermissionPolicyRole, type IPermissionPolicyTypePermissionObject, type ITriggerLog, type ITriggerRule, type IXafEntity, KeycloakLoginPage, type KeycloakTokenResponse, LoginPage, MirrorTypeMappingConfigCreate, MirrorTypeMappingConfigEdit, MirrorTypeMappingConfigList, RelatedList, type RequestOptions, RoleCreate, RoleEdit, RoleList, SecurityPermissionPolicy, SecurityPermissionState, SmartList, TOKEN_KEY, TiptapEditor, type TiptapEditorProps, TriggerEventType, TriggerLogList, TriggerRuleCreate, TriggerRuleEdit, TriggerRuleList, authProvider, authService, dataProvider, generatePassword, getBaseUrl, globalSearch, httpClient, keycloakService, parseJwt, refineXafTranslations, useColorMode, useModelTypes, validatePasswordStrength };