config.d.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { ConfigProcess } from "../types";
  2. import { ApiFunction } from "./ajax";
  3. export declare type ServerInvokeUrlTransformFunction = (jsUrl: string, option?: any) => string | undefined;
  4. export declare type SqlUrlTransformFunction = (jsUrl: string, option?: any) => string | undefined;
  5. export interface ApiConvert {
  6. /**
  7. * 从表格 dataSource 属性,转换为 ExtJS.storeOption 属性
  8. */
  9. gridInvokeBuild: (scope: any, grid: any, config: any, dataSource: any, params: any, reloadParams: any) => object;
  10. }
  11. /**
  12. * YvanUI 全局扩展配置
  13. */
  14. export interface ConfigOption {
  15. /**
  16. * 是否在设计器模式
  17. */
  18. /**
  19. * 扩展自定义的 ajax 方法
  20. */
  21. ajax: ApiFunction;
  22. /**
  23. * 扩展自定义的后端请求方法
  24. */
  25. apiConvert: ApiConvert;
  26. /**
  27. * serverJS Url转换为Ajax请求
  28. */
  29. serverInvokeUrlTransform: ServerInvokeUrlTransformFunction;
  30. /**
  31. * Sql Url转换为Ajax请求
  32. */
  33. sqlUrlTransform: SqlUrlTransformFunction;
  34. /**
  35. * 获取拼音首字母的函数
  36. */
  37. pinyinFunction: (py: string) => string;
  38. /**
  39. * Scope onload 时扩展方法
  40. */
  41. scopeOnLoad: (scope: any) => void;
  42. }
  43. /**
  44. * 全局 ajax 方法
  45. */
  46. export declare const ajax: {
  47. func?: ApiFunction;
  48. };
  49. export declare let scopeOnLoad: (scope: any) => void;
  50. export declare let apiConvert: ApiConvert;
  51. export declare const baseConfigProcessList: ConfigProcess[];
  52. /**
  53. * 在基类添加 Config 的处理方法
  54. */
  55. export declare function baseConfigProcess(option?: any): (target: any, propertyKey: any) => void;
  56. /**
  57. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  58. */
  59. export declare function serverInvokeUrlTransform(url: string, option?: any): string;
  60. /**
  61. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  62. */
  63. export declare function sqlUrlTransform(url: string): string;
  64. /**
  65. * YvanUI 全局扩展配置
  66. */
  67. export declare function extend(option: Partial<ConfigOption>): void;
  68. export declare function getApiConvert(): ApiConvert;
  69. export declare function getPinyin(v: string): any;
  70. /**
  71. * 适用于 Select / Tree 等,作筛选的通用方法.
  72. * 1.首字母模糊匹配(不区分大小写)
  73. * 2.标识的模糊匹配(不区分大小写)
  74. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  75. */
  76. export declare function keywordFilter(keyword: string, label: string, value?: string): boolean;