jsbarcode.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. declare namespace JsBarcode {
  2. interface BaseOptions {
  3. width?: number;
  4. height?: number;
  5. format?: string;
  6. displayValue?: boolean;
  7. fontOptions?: string;
  8. font?: string;
  9. text?: string;
  10. textAlign?: string;
  11. textPosition?: string;
  12. textMargin?: number;
  13. fontSize?: number;
  14. background?: string;
  15. lineColor?: string;
  16. margin?: number;
  17. marginTop?: number;
  18. marginBottom?: number;
  19. marginLeft?: number;
  20. marginRight?: number;
  21. valid?: (valid: boolean) => void;
  22. }
  23. interface NodeOptions extends BaseOptions {
  24. xmlDocument?: XMLDocument;
  25. }
  26. interface Code128Options extends BaseOptions {
  27. ean128?: boolean;
  28. }
  29. interface Ean8Options extends BaseOptions {
  30. flat?: boolean;
  31. }
  32. interface Ean13Options extends BaseOptions {
  33. flat?: boolean;
  34. lastChar?: string;
  35. }
  36. type Options = BaseOptions | Code128Options | Ean13Options | NodeOptions;
  37. interface api {
  38. options(options: Options): api;
  39. blank(size: number): api;
  40. init(options?: Options): void;
  41. render(): void;
  42. CODE39(value: string, options?: BaseOptions): api;
  43. CODE128(value: string, options?: Code128Options): api;
  44. CODE128A(value: string, options?: Code128Options): api;
  45. CODE128B(value: string, options?: Code128Options): api;
  46. CODE128C(value: string, options?: Code128Options): api;
  47. EAN13(value: string, options?: Ean13Options): api;
  48. EAN8(value: string, options?: Ean8Options): api;
  49. EAN5(value: string, options?: BaseOptions): api;
  50. EAN2(value: string, options?: BaseOptions): api;
  51. UPC(value: string, options?: BaseOptions): api;
  52. ITF14(value: string, options?: BaseOptions): api;
  53. ITF(value: string, options?: BaseOptions): api;
  54. MSI(value: string, options?: BaseOptions): api;
  55. MSI10(value: string, options?: BaseOptions): api;
  56. MSI11(value: string, options?: BaseOptions): api;
  57. MSI1010(value: string, options?: BaseOptions): api;
  58. MSI1110(value: string, options?: BaseOptions): api;
  59. pharmacode(value: string, options?: BaseOptions): api;
  60. codabar(value: string, options?: BaseOptions): api;
  61. }
  62. }
  63. declare function JsBarcode(element: any): JsBarcode.api;
  64. declare function JsBarcode(element: any, data: string, options?: JsBarcode.Options): void;
  65. export = JsBarcode;
  66. export as namespace JsBarcode;