@cundi/refine-xaf 1.0.11 → 1.0.14

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,16 +283,92 @@ 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: {
289
332
  login: {
290
333
  title: string;
334
+ chooseAuthMethod: string;
335
+ divider: {
336
+ or: string;
337
+ };
291
338
  buttons: {
292
339
  submit: string;
340
+ signInWithKeycloak: string;
341
+ loginWithLocal: string;
342
+ rememberMe: string;
343
+ forgotPassword: string;
344
+ };
345
+ fields: {
346
+ username: string;
347
+ password: string;
348
+ };
349
+ errors: {
350
+ requiredUsername: string;
351
+ requiredPassword: string;
293
352
  };
294
353
  };
295
354
  };
355
+ notifications: {
356
+ success: string;
357
+ error: string;
358
+ photoUpdated: string;
359
+ photoUpdateFailed: string;
360
+ passwordChanged: string;
361
+ passwordChangeFailed: string;
362
+ networkError: string;
363
+ rolesUpdated: string;
364
+ rolesUpdateFailed: string;
365
+ rolesUpdateError: string;
366
+ loadDetailsFailed: string;
367
+ forgotPassword: string;
368
+ createSuccess: string;
369
+ editSuccess: string;
370
+ deleteSuccess: string;
371
+ };
296
372
  buttons: {
297
373
  create: string;
298
374
  edit: string;
@@ -363,6 +439,22 @@ declare const refineXafTranslations: {
363
439
  drawioEditor: {
364
440
  loading: string;
365
441
  };
442
+ globalSearch: {
443
+ placeholder: string;
444
+ searching: string;
445
+ noResults: string;
446
+ resultCount: string;
447
+ };
448
+ loadDetailsFailed: string;
449
+ forgotPassword: string;
450
+ };
451
+ auth: {
452
+ loginFailed: string;
453
+ invalidCredentials: string;
454
+ networkError: string;
455
+ redirecting: string;
456
+ userIdNotFound: string;
457
+ sessionExpired: string;
366
458
  };
367
459
  common: {
368
460
  actions: {
@@ -549,11 +641,44 @@ declare const refineXafTranslations: {
549
641
  pages: {
550
642
  login: {
551
643
  title: string;
644
+ chooseAuthMethod: string;
645
+ divider: {
646
+ or: string;
647
+ };
552
648
  buttons: {
553
649
  submit: string;
650
+ signInWithKeycloak: string;
651
+ loginWithLocal: string;
652
+ rememberMe: string;
653
+ forgotPassword: string;
654
+ };
655
+ fields: {
656
+ username: string;
657
+ password: string;
658
+ };
659
+ errors: {
660
+ requiredUsername: string;
661
+ requiredPassword: string;
554
662
  };
555
663
  };
556
664
  };
665
+ notifications: {
666
+ success: string;
667
+ error: string;
668
+ photoUpdated: string;
669
+ photoUpdateFailed: string;
670
+ passwordChanged: string;
671
+ passwordChangeFailed: string;
672
+ networkError: string;
673
+ rolesUpdated: string;
674
+ rolesUpdateFailed: string;
675
+ rolesUpdateError: string;
676
+ loadDetailsFailed: string;
677
+ forgotPassword: string;
678
+ createSuccess: string;
679
+ editSuccess: string;
680
+ deleteSuccess: string;
681
+ };
557
682
  buttons: {
558
683
  create: string;
559
684
  edit: string;
@@ -624,6 +749,22 @@ declare const refineXafTranslations: {
624
749
  drawioEditor: {
625
750
  loading: string;
626
751
  };
752
+ globalSearch: {
753
+ placeholder: string;
754
+ searching: string;
755
+ noResults: string;
756
+ resultCount: string;
757
+ };
758
+ loadDetailsFailed: string;
759
+ forgotPassword: string;
760
+ };
761
+ auth: {
762
+ loginFailed: string;
763
+ invalidCredentials: string;
764
+ networkError: string;
765
+ redirecting: string;
766
+ userIdNotFound: string;
767
+ sessionExpired: string;
627
768
  };
628
769
  common: {
629
770
  actions: {
@@ -867,6 +1008,25 @@ interface DrawioEditorProps {
867
1008
  }
868
1009
  declare const DrawioEditor: React.FC<DrawioEditorProps>;
869
1010
 
1011
+ interface GlobalSearchProps {
1012
+ /** Placeholder text for search input */
1013
+ placeholder?: string;
1014
+ /** Maximum total results (default: 200) */
1015
+ maxResults?: number;
1016
+ /** Maximum results per type (default: 50) */
1017
+ maxPerType?: number;
1018
+ /** Custom click handler for results */
1019
+ onResultClick?: (result: GlobalSearchResult) => void;
1020
+ /** Width of search input (default: 280) */
1021
+ width?: number | string;
1022
+ /** Custom type labels for localization (e.g., { "Article": "文章", "Product": "產品" }) */
1023
+ typeLabels?: Record<string, string>;
1024
+ }
1025
+ /**
1026
+ * Global full-text search component with dropdown results
1027
+ */
1028
+ declare const GlobalSearch: React.FC<GlobalSearchProps>;
1029
+
870
1030
  declare const LoginPage: React.FC;
871
1031
 
872
1032
  declare const KeycloakLoginPage: React.FC;
@@ -964,4 +1124,4 @@ interface IModelType {
964
1124
  }
965
1125
  declare const useModelTypes: () => _tanstack_react_query.UseQueryResult<IModelType[], Error>;
966
1126
 
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 };
1127
+ 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,16 +283,92 @@ 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: {
289
332
  login: {
290
333
  title: string;
334
+ chooseAuthMethod: string;
335
+ divider: {
336
+ or: string;
337
+ };
291
338
  buttons: {
292
339
  submit: string;
340
+ signInWithKeycloak: string;
341
+ loginWithLocal: string;
342
+ rememberMe: string;
343
+ forgotPassword: string;
344
+ };
345
+ fields: {
346
+ username: string;
347
+ password: string;
348
+ };
349
+ errors: {
350
+ requiredUsername: string;
351
+ requiredPassword: string;
293
352
  };
294
353
  };
295
354
  };
355
+ notifications: {
356
+ success: string;
357
+ error: string;
358
+ photoUpdated: string;
359
+ photoUpdateFailed: string;
360
+ passwordChanged: string;
361
+ passwordChangeFailed: string;
362
+ networkError: string;
363
+ rolesUpdated: string;
364
+ rolesUpdateFailed: string;
365
+ rolesUpdateError: string;
366
+ loadDetailsFailed: string;
367
+ forgotPassword: string;
368
+ createSuccess: string;
369
+ editSuccess: string;
370
+ deleteSuccess: string;
371
+ };
296
372
  buttons: {
297
373
  create: string;
298
374
  edit: string;
@@ -363,6 +439,22 @@ declare const refineXafTranslations: {
363
439
  drawioEditor: {
364
440
  loading: string;
365
441
  };
442
+ globalSearch: {
443
+ placeholder: string;
444
+ searching: string;
445
+ noResults: string;
446
+ resultCount: string;
447
+ };
448
+ loadDetailsFailed: string;
449
+ forgotPassword: string;
450
+ };
451
+ auth: {
452
+ loginFailed: string;
453
+ invalidCredentials: string;
454
+ networkError: string;
455
+ redirecting: string;
456
+ userIdNotFound: string;
457
+ sessionExpired: string;
366
458
  };
367
459
  common: {
368
460
  actions: {
@@ -549,11 +641,44 @@ declare const refineXafTranslations: {
549
641
  pages: {
550
642
  login: {
551
643
  title: string;
644
+ chooseAuthMethod: string;
645
+ divider: {
646
+ or: string;
647
+ };
552
648
  buttons: {
553
649
  submit: string;
650
+ signInWithKeycloak: string;
651
+ loginWithLocal: string;
652
+ rememberMe: string;
653
+ forgotPassword: string;
654
+ };
655
+ fields: {
656
+ username: string;
657
+ password: string;
658
+ };
659
+ errors: {
660
+ requiredUsername: string;
661
+ requiredPassword: string;
554
662
  };
555
663
  };
556
664
  };
665
+ notifications: {
666
+ success: string;
667
+ error: string;
668
+ photoUpdated: string;
669
+ photoUpdateFailed: string;
670
+ passwordChanged: string;
671
+ passwordChangeFailed: string;
672
+ networkError: string;
673
+ rolesUpdated: string;
674
+ rolesUpdateFailed: string;
675
+ rolesUpdateError: string;
676
+ loadDetailsFailed: string;
677
+ forgotPassword: string;
678
+ createSuccess: string;
679
+ editSuccess: string;
680
+ deleteSuccess: string;
681
+ };
557
682
  buttons: {
558
683
  create: string;
559
684
  edit: string;
@@ -624,6 +749,22 @@ declare const refineXafTranslations: {
624
749
  drawioEditor: {
625
750
  loading: string;
626
751
  };
752
+ globalSearch: {
753
+ placeholder: string;
754
+ searching: string;
755
+ noResults: string;
756
+ resultCount: string;
757
+ };
758
+ loadDetailsFailed: string;
759
+ forgotPassword: string;
760
+ };
761
+ auth: {
762
+ loginFailed: string;
763
+ invalidCredentials: string;
764
+ networkError: string;
765
+ redirecting: string;
766
+ userIdNotFound: string;
767
+ sessionExpired: string;
627
768
  };
628
769
  common: {
629
770
  actions: {
@@ -867,6 +1008,25 @@ interface DrawioEditorProps {
867
1008
  }
868
1009
  declare const DrawioEditor: React.FC<DrawioEditorProps>;
869
1010
 
1011
+ interface GlobalSearchProps {
1012
+ /** Placeholder text for search input */
1013
+ placeholder?: string;
1014
+ /** Maximum total results (default: 200) */
1015
+ maxResults?: number;
1016
+ /** Maximum results per type (default: 50) */
1017
+ maxPerType?: number;
1018
+ /** Custom click handler for results */
1019
+ onResultClick?: (result: GlobalSearchResult) => void;
1020
+ /** Width of search input (default: 280) */
1021
+ width?: number | string;
1022
+ /** Custom type labels for localization (e.g., { "Article": "文章", "Product": "產品" }) */
1023
+ typeLabels?: Record<string, string>;
1024
+ }
1025
+ /**
1026
+ * Global full-text search component with dropdown results
1027
+ */
1028
+ declare const GlobalSearch: React.FC<GlobalSearchProps>;
1029
+
870
1030
  declare const LoginPage: React.FC;
871
1031
 
872
1032
  declare const KeycloakLoginPage: React.FC;
@@ -964,4 +1124,4 @@ interface IModelType {
964
1124
  }
965
1125
  declare const useModelTypes: () => _tanstack_react_query.UseQueryResult<IModelType[], Error>;
966
1126
 
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 };
1127
+ 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 };