jsuites 6.4.2 → 6.4.3

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.
Files changed (78) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +119 -119
  3. package/dist/jsuites.css +3424 -3424
  4. package/dist/jsuites.d.ts +10 -10
  5. package/dist/jsuites.js +22475 -22450
  6. package/dist/jsuites.webcomponents.js +501 -501
  7. package/dist/types/animation.d.ts +23 -23
  8. package/dist/types/calendar.d.ts +87 -87
  9. package/dist/types/color.d.ts +50 -50
  10. package/dist/types/contextmenu.d.ts +43 -43
  11. package/dist/types/dropdown.d.ts +177 -177
  12. package/dist/types/editor.d.ts +96 -96
  13. package/dist/types/floating.d.ts +23 -23
  14. package/dist/types/form.d.ts +57 -57
  15. package/dist/types/index.d.ts +59 -59
  16. package/dist/types/mask.d.ts +50 -50
  17. package/dist/types/modal.d.ts +35 -35
  18. package/dist/types/notification.d.ts +27 -27
  19. package/dist/types/picker.d.ts +45 -45
  20. package/dist/types/rating.d.ts +19 -19
  21. package/dist/types/search.d.ts +23 -23
  22. package/dist/types/slider.d.ts +31 -31
  23. package/dist/types/tabs.d.ts +79 -79
  24. package/dist/types/tags.d.ts +105 -105
  25. package/dist/types/toolbar.d.ts +70 -70
  26. package/dist/types/upload.d.ts +45 -45
  27. package/dist/types/validations.d.ts +39 -39
  28. package/package.json +4 -4
  29. package/react/calendar/index.d.ts +105 -105
  30. package/react/calendar/index.js +28 -28
  31. package/react/color/index.d.ts +84 -84
  32. package/react/color/index.js +28 -28
  33. package/react/contextmenu/index.d.ts +61 -61
  34. package/react/contextmenu/index.js +24 -24
  35. package/react/dropdown/index.d.ts +184 -184
  36. package/react/dropdown/index.js +25 -25
  37. package/react/editor/index.d.ts +114 -114
  38. package/react/editor/index.js +31 -31
  39. package/react/index.js +26 -26
  40. package/react/modal/index.d.ts +53 -53
  41. package/react/modal/index.js +30 -30
  42. package/react/picker/index.d.ts +64 -64
  43. package/react/picker/index.js +28 -28
  44. package/react/rating/index.d.ts +37 -37
  45. package/react/rating/index.js +28 -28
  46. package/react/slider/index.d.ts +49 -49
  47. package/react/slider/index.js +30 -30
  48. package/react/tabs/index.d.ts +97 -97
  49. package/react/tabs/index.js +29 -29
  50. package/react/tags/index.d.ts +121 -121
  51. package/react/tags/index.js +24 -24
  52. package/react/toolbar/index.d.ts +88 -88
  53. package/react/toolbar/index.js +24 -24
  54. package/vue/calendar/index.d.ts +105 -105
  55. package/vue/calendar/index.js +36 -36
  56. package/vue/color/index.d.ts +84 -84
  57. package/vue/color/index.js +36 -36
  58. package/vue/contextmenu/index.d.ts +61 -61
  59. package/vue/contextmenu/index.js +21 -21
  60. package/vue/dropdown/index.d.ts +184 -184
  61. package/vue/dropdown/index.js +25 -25
  62. package/vue/editor/index.d.ts +114 -114
  63. package/vue/editor/index.js +40 -40
  64. package/vue/index.js +40 -40
  65. package/vue/modal/index.d.ts +53 -53
  66. package/vue/modal/index.js +41 -41
  67. package/vue/picker/index.d.ts +64 -64
  68. package/vue/picker/index.js +36 -36
  69. package/vue/rating/index.d.ts +37 -37
  70. package/vue/rating/index.js +36 -36
  71. package/vue/slider/index.d.ts +49 -49
  72. package/vue/slider/index.js +33 -33
  73. package/vue/tabs/index.d.ts +97 -97
  74. package/vue/tabs/index.js +28 -28
  75. package/vue/tags/index.d.ts +121 -121
  76. package/vue/tags/index.js +21 -21
  77. package/vue/toolbar/index.d.ts +88 -88
  78. package/vue/toolbar/index.js +21 -21
@@ -1,177 +1,177 @@
1
- interface DropdownItem {
2
- /** Value of the selected item. */
3
- id?: string | number;
4
- /** Label for the selected item. */
5
- name?: string;
6
- /** Description of the item */
7
- title?: string;
8
- /** Icon of the item */
9
- image?: string;
10
- /** Name of the group where the item belongs to */
11
- group?: string;
12
- /** Keywords to help find one item */
13
- synonym?: string[];
14
- /** Item is disabled */
15
- disabled?: boolean;
16
- /** Color for the item */
17
- color?: string;
18
- }
19
-
20
- interface Item {
21
- /** Value of the selected item. */
22
- id?: string | number;
23
- /** Description of the item */
24
- title?: string;
25
- }
26
-
27
- interface DropdownOptions {
28
- /** Endpoint to fetch data from a remote server */
29
- url?: string;
30
- /** Preloaded data items for the dropdown */
31
- data?: DropdownItem[];
32
- /** Format type of the data, typically { id: name } or { value: text } */
33
- format?: number;
34
- /** Indicates if multiple item selection is allowed */
35
- multiple?: boolean;
36
- /** Enables the autocomplete feature for user input */
37
- autocomplete?: boolean;
38
- /** Allows remote search for options */
39
- remoteSearch?: boolean;
40
- /** Enables the lazy loading feature for handling a large number of options */
41
- lazyLoading?: boolean;
42
- /** Rendering style of the dropdown: 'default', 'picker', or 'searchbar' */
43
- type?: 'default' | 'picker' | 'searchbar',
44
- /** Defines the dropdown's width */
45
- width?: number;
46
- /** Sets the maximum width of the dropdown */
47
- maxWidth?: number;
48
- /** Determines if the dropdown is opened when initialized */
49
- opened?: boolean;
50
- /** The initial value of the dropdown */
51
- value?: string;
52
- /** Placeholder text for the dropdown */
53
- placeholder?: string;
54
- /** Allows the user to add new options */
55
- newOptions?: boolean;
56
- /** Internal controller for the dropdown's position */
57
- position?: boolean;
58
- /** Event handler for value changes */
59
- onchange?: (el: HTMLElement, obj: Dropdown, oldValue: string, newValue: string) => void;
60
- /** Event handler for when the dropdown is ready */
61
- onload?: (el: HTMLElement, obj: Dropdown, data: any, val: any) => void;
62
- /** Event handler for when the dropdown opens */
63
- onopen?: (el: HTMLElement) => void;
64
- /** Event handler for when the dropdown closes */
65
- onclose?: (el: HTMLElement) => void;
66
- /** Event handler for when the dropdown receives focus */
67
- onfocus?: (el: HTMLElement) => void;
68
- /** Event handler for when the dropdown loses focus */
69
- onblur?: (el: HTMLElement) => void;
70
- /** Event handler for when a new option is added to the dropdown */
71
- oninsert?: (obj: Dropdown, item: DropdownItem, newItem: DropdownItem) => void;
72
- /** Event handler for just before a new option is added to the dropdown */
73
- onbeforeinsert?: (obj: Dropdown, item: DropdownItem) => void;
74
- /** Event handler for before a search on autocomplete is performed */
75
- onbeforesearch?: (obj: Dropdown, ajaxRequest: object) => boolean | null;
76
- /** Event handler for processing search results */
77
- onsearch?: (obj: Dropdown, result: object) => void;
78
- /** Toggles the sorting of dropdown elements */
79
- sortResults?: boolean;
80
- /** Indicates if the dropdown should automatically receive focus upon creation */
81
- autofocus?: boolean;
82
- /** Custom prompt on insert new items */
83
- prompt?: (addNewRow: (title: string, id: any) => void) => boolean;
84
- /** Allow toggle values on single dropdowns. Default: true */
85
- allowEmpty?: boolean;
86
- }
87
-
88
- interface ItemContainer {
89
- /** Data for the item */
90
- data: DropdownItem;
91
- /** HTML container for the element */
92
- element: HTMLElement;
93
- /** HTML container for the group */
94
- group: HTMLElement;
95
- }
96
-
97
- /** Toast Plugin */
98
- export type Dropdown = (el: HTMLElement, options: DropdownOptions) => {
99
- /** Add a new item to the dropdown. */
100
- add: (title: string, id: string|number) => DropdownItem;
101
- /** Append new data to the dropdown */
102
- appendData: (data: DropdownItem[]) => void
103
- /** Close the dropdown picker */
104
- closeItem: (ignoreEvents?: boolean) => void
105
- /** Current selectIndex */
106
- currentIndex: number;
107
- /** Find the items with the keyword */
108
- find: (str: string) => void;
109
- /** Select the first item */
110
- first: () => void;
111
- /** Get all data */
112
- getData: () => DropdownItem[];
113
- /** Get the index position of a item by its value */
114
- getPosition: (value: string) => number | boolean;
115
- /** Get the text from the selected options */
116
- getText: (asArray?: boolean) => string | string[];
117
- /** Get the URL source for the data if defined */
118
- getUrl: () => string;
119
- /** Get the value from the selected options */
120
- getValue: (asArray?: boolean) => string | string[];
121
- /** DOM Elements for the groups */
122
- groups: HTMLElement[];
123
- /** DOM Element for the header */
124
- header: HTMLElement;
125
- /** Items */
126
- items: ItemContainer[];
127
- /** Move index to the last element in the dropdown */
128
- last: () => void;
129
- /** Internal lazy loading method */
130
- loadDown: () => void;
131
- /** Internal lazy loading method */
132
- loadFirst: () => void;
133
- /** Internal lazy loading method */
134
- loadLast: () => void;
135
- /** Internal lazy loading method */
136
- loadUp: () => void;
137
- /** Move index to the next element in the dropdown */
138
- next: () => void;
139
- /** Open the dropdown */
140
- open: () => void;
141
- /** Dropdown configuration */
142
- options: DropdownOptions;
143
- /** Move index to the previous element in the dropdown */
144
- prev: () => void;
145
- /** Reset the value of the dropdown */
146
- reset: () => void;
147
- /** Alias for setCursor */
148
- resetCursor: (index: number, setPosition?: boolean) => void
149
- /** Set the value to null */
150
- resetSelected: () => void;
151
- /** Array of results when filtering */
152
- results: DropdownItem[];
153
- /** Search term */
154
- search: string;
155
- /** Select an index */
156
- selectIndex: (index: number, force?: boolean) => void
157
- /** Select an item */
158
- selectItem: (item: DropdownItem) => void;
159
- /** Set the cursor to a specified element index */
160
- setCursor: (index: number, setPosition?: boolean) => void
161
- /** Set new data for the dropdown */
162
- setData: (items: DropdownItem[]) => void;
163
- /** Set the id or value for one item */
164
- setId: (item: number|DropdownItem, newId: number) => void;
165
- /** Change the dropdown options */
166
- setOptions: (newOptions: DropdownOptions, reset?: boolean) => void;
167
- /** Change the dropdown data from a URL */
168
- setUrl: (newUrl: string, callback?: Function) => void;
169
- /** Set the value for a dropdown */
170
- setValue: (newValue: string | string[]) => void;
171
- /** Internal type */
172
- type: 'dropdown';
173
- /** Alias for setCursor */
174
- updateCursor: (index: number, setPosition?: boolean) => void;
175
- /** Current internal value */
176
- value: Record<number, string>;
177
- }
1
+ interface DropdownItem {
2
+ /** Value of the selected item. */
3
+ id?: string | number;
4
+ /** Label for the selected item. */
5
+ name?: string;
6
+ /** Description of the item */
7
+ title?: string;
8
+ /** Icon of the item */
9
+ image?: string;
10
+ /** Name of the group where the item belongs to */
11
+ group?: string;
12
+ /** Keywords to help find one item */
13
+ synonym?: string[];
14
+ /** Item is disabled */
15
+ disabled?: boolean;
16
+ /** Color for the item */
17
+ color?: string;
18
+ }
19
+
20
+ interface Item {
21
+ /** Value of the selected item. */
22
+ id?: string | number;
23
+ /** Description of the item */
24
+ title?: string;
25
+ }
26
+
27
+ interface DropdownOptions {
28
+ /** Endpoint to fetch data from a remote server */
29
+ url?: string;
30
+ /** Preloaded data items for the dropdown */
31
+ data?: DropdownItem[];
32
+ /** Format type of the data, typically { id: name } or { value: text } */
33
+ format?: number;
34
+ /** Indicates if multiple item selection is allowed */
35
+ multiple?: boolean;
36
+ /** Enables the autocomplete feature for user input */
37
+ autocomplete?: boolean;
38
+ /** Allows remote search for options */
39
+ remoteSearch?: boolean;
40
+ /** Enables the lazy loading feature for handling a large number of options */
41
+ lazyLoading?: boolean;
42
+ /** Rendering style of the dropdown: 'default', 'picker', or 'searchbar' */
43
+ type?: 'default' | 'picker' | 'searchbar',
44
+ /** Defines the dropdown's width */
45
+ width?: number;
46
+ /** Sets the maximum width of the dropdown */
47
+ maxWidth?: number;
48
+ /** Determines if the dropdown is opened when initialized */
49
+ opened?: boolean;
50
+ /** The initial value of the dropdown */
51
+ value?: string;
52
+ /** Placeholder text for the dropdown */
53
+ placeholder?: string;
54
+ /** Allows the user to add new options */
55
+ newOptions?: boolean;
56
+ /** Internal controller for the dropdown's position */
57
+ position?: boolean;
58
+ /** Event handler for value changes */
59
+ onchange?: (el: HTMLElement, obj: Dropdown, oldValue: string, newValue: string) => void;
60
+ /** Event handler for when the dropdown is ready */
61
+ onload?: (el: HTMLElement, obj: Dropdown, data: any, val: any) => void;
62
+ /** Event handler for when the dropdown opens */
63
+ onopen?: (el: HTMLElement) => void;
64
+ /** Event handler for when the dropdown closes */
65
+ onclose?: (el: HTMLElement) => void;
66
+ /** Event handler for when the dropdown receives focus */
67
+ onfocus?: (el: HTMLElement) => void;
68
+ /** Event handler for when the dropdown loses focus */
69
+ onblur?: (el: HTMLElement) => void;
70
+ /** Event handler for when a new option is added to the dropdown */
71
+ oninsert?: (obj: Dropdown, item: DropdownItem, newItem: DropdownItem) => void;
72
+ /** Event handler for just before a new option is added to the dropdown */
73
+ onbeforeinsert?: (obj: Dropdown, item: DropdownItem) => void;
74
+ /** Event handler for before a search on autocomplete is performed */
75
+ onbeforesearch?: (obj: Dropdown, ajaxRequest: object) => boolean | null;
76
+ /** Event handler for processing search results */
77
+ onsearch?: (obj: Dropdown, result: object) => void;
78
+ /** Toggles the sorting of dropdown elements */
79
+ sortResults?: boolean;
80
+ /** Indicates if the dropdown should automatically receive focus upon creation */
81
+ autofocus?: boolean;
82
+ /** Custom prompt on insert new items */
83
+ prompt?: (addNewRow: (title: string, id: any) => void) => boolean;
84
+ /** Allow toggle values on single dropdowns. Default: true */
85
+ allowEmpty?: boolean;
86
+ }
87
+
88
+ interface ItemContainer {
89
+ /** Data for the item */
90
+ data: DropdownItem;
91
+ /** HTML container for the element */
92
+ element: HTMLElement;
93
+ /** HTML container for the group */
94
+ group: HTMLElement;
95
+ }
96
+
97
+ /** Toast Plugin */
98
+ export type Dropdown = (el: HTMLElement, options: DropdownOptions) => {
99
+ /** Add a new item to the dropdown. */
100
+ add: (title: string, id: string|number) => DropdownItem;
101
+ /** Append new data to the dropdown */
102
+ appendData: (data: DropdownItem[]) => void
103
+ /** Close the dropdown picker */
104
+ closeItem: (ignoreEvents?: boolean) => void
105
+ /** Current selectIndex */
106
+ currentIndex: number;
107
+ /** Find the items with the keyword */
108
+ find: (str: string) => void;
109
+ /** Select the first item */
110
+ first: () => void;
111
+ /** Get all data */
112
+ getData: () => DropdownItem[];
113
+ /** Get the index position of a item by its value */
114
+ getPosition: (value: string) => number | boolean;
115
+ /** Get the text from the selected options */
116
+ getText: (asArray?: boolean) => string | string[];
117
+ /** Get the URL source for the data if defined */
118
+ getUrl: () => string;
119
+ /** Get the value from the selected options */
120
+ getValue: (asArray?: boolean) => string | string[];
121
+ /** DOM Elements for the groups */
122
+ groups: HTMLElement[];
123
+ /** DOM Element for the header */
124
+ header: HTMLElement;
125
+ /** Items */
126
+ items: ItemContainer[];
127
+ /** Move index to the last element in the dropdown */
128
+ last: () => void;
129
+ /** Internal lazy loading method */
130
+ loadDown: () => void;
131
+ /** Internal lazy loading method */
132
+ loadFirst: () => void;
133
+ /** Internal lazy loading method */
134
+ loadLast: () => void;
135
+ /** Internal lazy loading method */
136
+ loadUp: () => void;
137
+ /** Move index to the next element in the dropdown */
138
+ next: () => void;
139
+ /** Open the dropdown */
140
+ open: () => void;
141
+ /** Dropdown configuration */
142
+ options: DropdownOptions;
143
+ /** Move index to the previous element in the dropdown */
144
+ prev: () => void;
145
+ /** Reset the value of the dropdown */
146
+ reset: () => void;
147
+ /** Alias for setCursor */
148
+ resetCursor: (index: number, setPosition?: boolean) => void
149
+ /** Set the value to null */
150
+ resetSelected: () => void;
151
+ /** Array of results when filtering */
152
+ results: DropdownItem[];
153
+ /** Search term */
154
+ search: string;
155
+ /** Select an index */
156
+ selectIndex: (index: number, force?: boolean) => void
157
+ /** Select an item */
158
+ selectItem: (item: DropdownItem) => void;
159
+ /** Set the cursor to a specified element index */
160
+ setCursor: (index: number, setPosition?: boolean) => void
161
+ /** Set new data for the dropdown */
162
+ setData: (items: DropdownItem[]) => void;
163
+ /** Set the id or value for one item */
164
+ setId: (item: number|DropdownItem, newId: number) => void;
165
+ /** Change the dropdown options */
166
+ setOptions: (newOptions: DropdownOptions, reset?: boolean) => void;
167
+ /** Change the dropdown data from a URL */
168
+ setUrl: (newUrl: string, callback?: Function) => void;
169
+ /** Set the value for a dropdown */
170
+ setValue: (newValue: string | string[]) => void;
171
+ /** Internal type */
172
+ type: 'dropdown';
173
+ /** Alias for setCursor */
174
+ updateCursor: (index: number, setPosition?: boolean) => void;
175
+ /** Current internal value */
176
+ value: Record<number, string>;
177
+ }
@@ -1,96 +1,96 @@
1
- interface Snippet {
2
- /** Image URL */
3
- image: string | string[];
4
- /** Title */
5
- title: string;
6
- /** Description */
7
- description: string;
8
- /** Domain */
9
- host: string;
10
- /** Link */
11
- url: string;
12
- }
13
-
14
- interface Options {
15
- /** Load data from a remove location */
16
- url?: string;
17
- /** Initial HTML string for the editor */
18
- value?: string;
19
- /** Snippet object */
20
- snippet?: Snippet;
21
- /** Show toolbar */
22
- toolbar?: boolean;
23
- /** Show the toolbar in the top of the editor. Default: false */
24
- toolbarOnTop?: boolean;
25
- /** Website URL parser is to read websites and images from cross domain */
26
- remoteParser?: string;
27
- /** Editor place holder */
28
- placeholder?: string;
29
- /** Filter the paste. Default true. */
30
- filterPaste?: boolean;
31
- /** Accept images or files to be dropped in the editor area. Default: true */
32
- dropZone?: boolean;
33
- /** Transform dropped images as snippet. Default: false */
34
- dropAsSnippet?: boolean;
35
- /** Accept images when the dropzone when active. Default: true */
36
- acceptImages?: boolean;
37
- /** Accept files when the dropzone when active. Default: false */
38
- acceptFiles?: boolean;
39
- /** Max file size in bytes. Default: 5000000 bytes */
40
- maxFileSize?: number | null;
41
- /** Allow image resizing. Default: true */
42
- allowImageResize?: boolean;
43
- /** Max height editor */
44
- maxHeight?: number | null;
45
- /** Default editor height */
46
- height?: number | null;
47
- /** Focus in the editor when initiated. Default: false */
48
- focus?: boolean;
49
- /** Onclick in the editor */
50
- onclick?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
51
- /** When the editor is focused */
52
- onfocus?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
53
- /** When blur */
54
- onblur?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
55
- /** When the editor is ready */
56
- onload?: (el: HTMLElement, obj: Editor, editor: HTMLElement) => void;
57
- /** When key up in the editor */
58
- onkeyup?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
59
- /** When key down in the editor */
60
- onkeydown?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
61
- /** When the value of the editor changes */
62
- onchange?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
63
- /** Editor extensions */
64
- extensions?: Record<string, Function>;
65
- }
66
-
67
- export type Editor = (el: HTMLElement, options: Options) => {
68
- /** Dropped files or loaded via the input file */
69
- addFiles: (files: FileList[]) => void;
70
- /** Methods to add new images to the editor */
71
- addImage: (src: string | FileList[], asSnippet?: boolean) => void;
72
- /** Add a new PDF as a attachment */
73
- addPdf: (base64: string) => void;
74
- /** Add a snippet board in the editor */
75
- appendSnippet: (data: Snippet) => void;
76
- /** Destroy */
77
- destroy: () => void;
78
- /** Editor HTML container */
79
- el: HTMLElement;
80
- /** HTML input upload element */
81
- file: HTMLInputElement;
82
- /** Get the data from the editor */
83
- getData: (asJson?: boolean) => string | object;
84
- /** Get the files loaded to the editor */
85
- getFiles: () => string[];
86
- /** Get the innerText from the editor */
87
- getText: () => string;
88
- /** Editor configuration */
89
- options: Options;
90
- /** Reset the editor value */
91
- reset: () => void;
92
- /** Load a file from a local computer to the editor */
93
- upload: () => void;
94
- /** Internal type */
95
- type: 'editor';
96
- }
1
+ interface Snippet {
2
+ /** Image URL */
3
+ image: string | string[];
4
+ /** Title */
5
+ title: string;
6
+ /** Description */
7
+ description: string;
8
+ /** Domain */
9
+ host: string;
10
+ /** Link */
11
+ url: string;
12
+ }
13
+
14
+ interface Options {
15
+ /** Load data from a remove location */
16
+ url?: string;
17
+ /** Initial HTML string for the editor */
18
+ value?: string;
19
+ /** Snippet object */
20
+ snippet?: Snippet;
21
+ /** Show toolbar */
22
+ toolbar?: boolean;
23
+ /** Show the toolbar in the top of the editor. Default: false */
24
+ toolbarOnTop?: boolean;
25
+ /** Website URL parser is to read websites and images from cross domain */
26
+ remoteParser?: string;
27
+ /** Editor place holder */
28
+ placeholder?: string;
29
+ /** Filter the paste. Default true. */
30
+ filterPaste?: boolean;
31
+ /** Accept images or files to be dropped in the editor area. Default: true */
32
+ dropZone?: boolean;
33
+ /** Transform dropped images as snippet. Default: false */
34
+ dropAsSnippet?: boolean;
35
+ /** Accept images when the dropzone when active. Default: true */
36
+ acceptImages?: boolean;
37
+ /** Accept files when the dropzone when active. Default: false */
38
+ acceptFiles?: boolean;
39
+ /** Max file size in bytes. Default: 5000000 bytes */
40
+ maxFileSize?: number | null;
41
+ /** Allow image resizing. Default: true */
42
+ allowImageResize?: boolean;
43
+ /** Max height editor */
44
+ maxHeight?: number | null;
45
+ /** Default editor height */
46
+ height?: number | null;
47
+ /** Focus in the editor when initiated. Default: false */
48
+ focus?: boolean;
49
+ /** Onclick in the editor */
50
+ onclick?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
51
+ /** When the editor is focused */
52
+ onfocus?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
53
+ /** When blur */
54
+ onblur?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
55
+ /** When the editor is ready */
56
+ onload?: (el: HTMLElement, obj: Editor, editor: HTMLElement) => void;
57
+ /** When key up in the editor */
58
+ onkeyup?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
59
+ /** When key down in the editor */
60
+ onkeydown?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
61
+ /** When the value of the editor changes */
62
+ onchange?: (el: HTMLElement, obj: Editor, e: MouseEvent) => void;
63
+ /** Editor extensions */
64
+ extensions?: Record<string, Function>;
65
+ }
66
+
67
+ export type Editor = (el: HTMLElement, options: Options) => {
68
+ /** Dropped files or loaded via the input file */
69
+ addFiles: (files: FileList[]) => void;
70
+ /** Methods to add new images to the editor */
71
+ addImage: (src: string | FileList[], asSnippet?: boolean) => void;
72
+ /** Add a new PDF as a attachment */
73
+ addPdf: (base64: string) => void;
74
+ /** Add a snippet board in the editor */
75
+ appendSnippet: (data: Snippet) => void;
76
+ /** Destroy */
77
+ destroy: () => void;
78
+ /** Editor HTML container */
79
+ el: HTMLElement;
80
+ /** HTML input upload element */
81
+ file: HTMLInputElement;
82
+ /** Get the data from the editor */
83
+ getData: (asJson?: boolean) => string | object;
84
+ /** Get the files loaded to the editor */
85
+ getFiles: () => string[];
86
+ /** Get the innerText from the editor */
87
+ getText: () => string;
88
+ /** Editor configuration */
89
+ options: Options;
90
+ /** Reset the editor value */
91
+ reset: () => void;
92
+ /** Load a file from a local computer to the editor */
93
+ upload: () => void;
94
+ /** Internal type */
95
+ type: 'editor';
96
+ }
@@ -1,23 +1,23 @@
1
- interface Options {
2
- /** Floating type. Default: 'big' */
3
- type: string | null,
4
- /** Floating window title. Default 'Untitled' */
5
- title: string,
6
- /** Width. Default: 510 */
7
- width: number,
8
- /** Height. Default: 472 */
9
- height: number,
10
- }
11
-
12
- export type Floating = (el: HTMLElement, options: Options) => {
13
- /** Dropped files or loaded via the input file */
14
- state: object;
15
- /** Toggle the state of the floating modal */
16
- setState: () => void;
17
- /** Close the floating modal */
18
- close: () => void;
19
- /** Update its position style */
20
- updatePosition: () => void;
21
- /** Init the floating modal */
22
- init: () => void;
23
- }
1
+ interface Options {
2
+ /** Floating type. Default: 'big' */
3
+ type: string | null,
4
+ /** Floating window title. Default 'Untitled' */
5
+ title: string,
6
+ /** Width. Default: 510 */
7
+ width: number,
8
+ /** Height. Default: 472 */
9
+ height: number,
10
+ }
11
+
12
+ export type Floating = (el: HTMLElement, options: Options) => {
13
+ /** Dropped files or loaded via the input file */
14
+ state: object;
15
+ /** Toggle the state of the floating modal */
16
+ setState: () => void;
17
+ /** Close the floating modal */
18
+ close: () => void;
19
+ /** Update its position style */
20
+ updatePosition: () => void;
21
+ /** Init the floating modal */
22
+ init: () => void;
23
+ }