config.d.ts 2.6 KB

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