x4js 1.4.53 → 1.5.1

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 (187) hide show
  1. package/lib/cjs/action.d.ts +57 -0
  2. package/lib/cjs/application.d.ts +104 -0
  3. package/lib/cjs/application.js +6 -6
  4. package/lib/cjs/autocomplete.d.ts +58 -0
  5. package/lib/cjs/base_component.d.ts +88 -0
  6. package/lib/cjs/button.d.ts +151 -0
  7. package/lib/cjs/calendar.d.ts +81 -0
  8. package/lib/cjs/canvas.d.ts +92 -0
  9. package/lib/cjs/cardview.d.ts +87 -0
  10. package/lib/cjs/checkbox.d.ts +77 -0
  11. package/lib/cjs/color.d.ts +148 -0
  12. package/lib/cjs/colorpicker.d.ts +107 -0
  13. package/lib/cjs/combobox.d.ts +101 -0
  14. package/lib/cjs/component.d.ts +601 -0
  15. package/lib/cjs/datastore.d.ts +396 -0
  16. package/lib/cjs/dialog.d.ts +175 -0
  17. package/lib/cjs/dom_events.d.ts +302 -0
  18. package/lib/cjs/drag_manager.d.ts +54 -0
  19. package/lib/cjs/drawtext.d.ts +48 -0
  20. package/lib/cjs/fileupload.d.ts +64 -0
  21. package/lib/cjs/form.d.ts +126 -0
  22. package/lib/cjs/formatters.d.ts +35 -0
  23. package/lib/cjs/gridview.d.ts +175 -0
  24. package/lib/cjs/i18n.d.ts +73 -0
  25. package/lib/cjs/icon.d.ts +64 -0
  26. package/lib/cjs/icon.js +5 -0
  27. package/lib/cjs/image.d.ts +55 -0
  28. package/lib/cjs/index.d.ts +83 -0
  29. package/lib/cjs/input.d.ts +91 -0
  30. package/lib/cjs/label.d.ts +58 -0
  31. package/lib/cjs/layout.d.ts +87 -0
  32. package/lib/cjs/link.d.ts +50 -0
  33. package/lib/cjs/listview.d.ts +178 -0
  34. package/lib/cjs/md5.d.ts +61 -0
  35. package/lib/cjs/md5.js +7 -7
  36. package/lib/cjs/menu.d.ts +130 -0
  37. package/lib/cjs/messagebox.d.ts +68 -0
  38. package/lib/cjs/panel.d.ts +47 -0
  39. package/lib/cjs/popup.d.ts +75 -0
  40. package/lib/cjs/property_editor.d.ts +71 -0
  41. package/lib/cjs/radiobtn.d.ts +72 -0
  42. package/lib/cjs/rating.d.ts +53 -0
  43. package/lib/cjs/request.d.ts +52 -0
  44. package/lib/cjs/router.d.ts +42 -0
  45. package/lib/cjs/settings.d.ts +37 -0
  46. package/lib/cjs/sidebarview.d.ts +49 -0
  47. package/lib/cjs/spreadsheet.d.ts +218 -0
  48. package/lib/cjs/styles.d.ts +85 -0
  49. package/lib/cjs/svgcomponent.d.ts +191 -0
  50. package/lib/cjs/tabbar.d.ts +58 -0
  51. package/lib/cjs/tabview.d.ts +49 -0
  52. package/lib/cjs/textarea.d.ts +63 -0
  53. package/lib/cjs/textedit.d.ts +123 -0
  54. package/lib/cjs/toaster.d.ts +42 -0
  55. package/lib/cjs/tools.d.ts +394 -0
  56. package/lib/cjs/tools.js +8 -5
  57. package/lib/cjs/tooltips.d.ts +46 -0
  58. package/lib/cjs/treeview.d.ts +132 -0
  59. package/lib/cjs/version.d.ts +29 -0
  60. package/lib/cjs/x4dom.d.ts +49 -0
  61. package/lib/cjs/x4events.d.ts +269 -0
  62. package/lib/cjs/x4react.d.ts +41 -0
  63. package/lib/esm/action.d.ts +57 -0
  64. package/lib/esm/application.d.ts +104 -0
  65. package/lib/esm/autocomplete.d.ts +58 -0
  66. package/lib/esm/base_component.d.ts +88 -0
  67. package/lib/esm/button.d.ts +151 -0
  68. package/lib/esm/calendar.d.ts +81 -0
  69. package/lib/esm/canvas.d.ts +92 -0
  70. package/lib/esm/cardview.d.ts +87 -0
  71. package/lib/esm/checkbox.d.ts +77 -0
  72. package/lib/esm/color.d.ts +148 -0
  73. package/lib/esm/colorpicker.d.ts +107 -0
  74. package/lib/esm/combobox.d.ts +101 -0
  75. package/lib/esm/component.d.ts +601 -0
  76. package/lib/esm/datastore.d.ts +396 -0
  77. package/lib/esm/dialog.d.ts +175 -0
  78. package/lib/esm/dom_events.d.ts +302 -0
  79. package/lib/esm/drag_manager.d.ts +54 -0
  80. package/lib/esm/drawtext.d.ts +48 -0
  81. package/lib/esm/fileupload.d.ts +64 -0
  82. package/lib/esm/form.d.ts +126 -0
  83. package/lib/esm/formatters.d.ts +35 -0
  84. package/lib/esm/gridview.d.ts +175 -0
  85. package/lib/esm/i18n.d.ts +73 -0
  86. package/lib/esm/icon.d.ts +64 -0
  87. package/lib/esm/icon.js +5 -0
  88. package/lib/esm/image.d.ts +55 -0
  89. package/lib/esm/index.d.ts +83 -0
  90. package/lib/esm/input.d.ts +91 -0
  91. package/lib/esm/label.d.ts +58 -0
  92. package/lib/esm/layout.d.ts +87 -0
  93. package/lib/esm/link.d.ts +50 -0
  94. package/lib/esm/listview.d.ts +178 -0
  95. package/lib/esm/md5.d.ts +61 -0
  96. package/lib/esm/menu.d.ts +130 -0
  97. package/lib/esm/messagebox.d.ts +68 -0
  98. package/lib/esm/panel.d.ts +47 -0
  99. package/lib/esm/popup.d.ts +75 -0
  100. package/lib/esm/property_editor.d.ts +71 -0
  101. package/lib/esm/radiobtn.d.ts +72 -0
  102. package/lib/esm/rating.d.ts +53 -0
  103. package/lib/esm/request.d.ts +52 -0
  104. package/lib/esm/router.d.ts +42 -0
  105. package/lib/esm/settings.d.ts +37 -0
  106. package/lib/esm/sidebarview.d.ts +49 -0
  107. package/lib/esm/spreadsheet.d.ts +218 -0
  108. package/lib/esm/styles.d.ts +85 -0
  109. package/lib/esm/svgcomponent.d.ts +191 -0
  110. package/lib/esm/tabbar.d.ts +58 -0
  111. package/lib/esm/tabview.d.ts +49 -0
  112. package/lib/esm/textarea.d.ts +63 -0
  113. package/lib/esm/textedit.d.ts +123 -0
  114. package/lib/esm/toaster.d.ts +42 -0
  115. package/lib/esm/tools.d.ts +394 -0
  116. package/lib/esm/tools.js +8 -5
  117. package/lib/esm/tooltips.d.ts +46 -0
  118. package/lib/esm/treeview.d.ts +132 -0
  119. package/lib/esm/version.d.ts +29 -0
  120. package/lib/esm/x4dom.d.ts +49 -0
  121. package/lib/esm/x4events.d.ts +269 -0
  122. package/lib/esm/x4react.d.ts +41 -0
  123. package/lib/styles/x4.css +5 -3
  124. package/lib/styles/x4.less +5 -3
  125. package/lib/ts_src/MIT-license.md +14 -0
  126. package/lib/ts_src/action.ts +88 -0
  127. package/lib/ts_src/alpha.jpg +0 -0
  128. package/lib/ts_src/application.ts +251 -0
  129. package/lib/ts_src/autocomplete.ts +197 -0
  130. package/lib/ts_src/base64.ts +166 -0
  131. package/lib/ts_src/base_component.ts +152 -0
  132. package/lib/ts_src/button.ts +355 -0
  133. package/lib/ts_src/calendar.ts +322 -0
  134. package/lib/ts_src/canvas.ts +505 -0
  135. package/lib/ts_src/cardview.ts +227 -0
  136. package/lib/ts_src/checkbox.ts +187 -0
  137. package/lib/ts_src/color.ts +752 -0
  138. package/lib/ts_src/colorpicker.ts +1639 -0
  139. package/lib/ts_src/combobox.ts +362 -0
  140. package/lib/ts_src/component.ts +2329 -0
  141. package/lib/ts_src/datastore.ts +1322 -0
  142. package/lib/ts_src/dialog.ts +656 -0
  143. package/lib/ts_src/dom_events.ts +315 -0
  144. package/lib/ts_src/drag_manager.ts +199 -0
  145. package/lib/ts_src/drawtext.ts +355 -0
  146. package/lib/ts_src/fileupload.ts +213 -0
  147. package/lib/ts_src/form.ts +366 -0
  148. package/lib/ts_src/formatters.ts +105 -0
  149. package/lib/ts_src/gridview.ts +1185 -0
  150. package/lib/ts_src/i18n.ts +346 -0
  151. package/lib/ts_src/icon.ts +335 -0
  152. package/lib/ts_src/image.ts +204 -0
  153. package/lib/ts_src/index.ts +88 -0
  154. package/lib/ts_src/input.ts +249 -0
  155. package/lib/ts_src/label.ts +128 -0
  156. package/lib/ts_src/layout.ts +430 -0
  157. package/lib/ts_src/link.ts +86 -0
  158. package/lib/ts_src/listview.ts +762 -0
  159. package/lib/ts_src/md5.ts +438 -0
  160. package/lib/ts_src/menu.ts +425 -0
  161. package/lib/ts_src/messagebox.ts +203 -0
  162. package/lib/ts_src/panel.ts +86 -0
  163. package/lib/ts_src/popup.ts +494 -0
  164. package/lib/ts_src/property_editor.ts +337 -0
  165. package/lib/ts_src/radiobtn.ts +196 -0
  166. package/lib/ts_src/rating.ts +135 -0
  167. package/lib/ts_src/request.ts +300 -0
  168. package/lib/ts_src/router.ts +185 -0
  169. package/lib/ts_src/settings.ts +77 -0
  170. package/lib/ts_src/sidebarview.ts +103 -0
  171. package/lib/ts_src/spreadsheet.ts +1442 -0
  172. package/lib/ts_src/styles.ts +343 -0
  173. package/lib/ts_src/svgcomponent.ts +537 -0
  174. package/lib/ts_src/tabbar.ts +151 -0
  175. package/lib/ts_src/tabview.ts +110 -0
  176. package/lib/ts_src/textarea.ts +187 -0
  177. package/lib/ts_src/textedit.ts +544 -0
  178. package/lib/ts_src/toaster.ts +80 -0
  179. package/lib/ts_src/tools.ts +1473 -0
  180. package/lib/ts_src/tooltips.ts +191 -0
  181. package/lib/ts_src/treeview.ts +675 -0
  182. package/lib/ts_src/version.ts +30 -0
  183. package/lib/ts_src/x4.less +2238 -0
  184. package/lib/ts_src/x4dom.ts +57 -0
  185. package/lib/ts_src/x4events.ts +585 -0
  186. package/lib/ts_src/x4react.ts +90 -0
  187. package/package.json +3 -2
@@ -0,0 +1,269 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file x4events.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+ export type EventCallback<T extends BasicEvent = BasicEvent> = (event: T) => any;
30
+ export interface EventDisposer {
31
+ dispose(): void;
32
+ }
33
+ /**
34
+ * Basic event
35
+ * name like that to avoid conflict with Browsers Event class.
36
+ */
37
+ export interface BasicEvent {
38
+ readonly type?: string;
39
+ readonly source?: unknown;
40
+ readonly context?: any;
41
+ propagationStopped?: boolean;
42
+ defaultPrevented?: boolean;
43
+ stopPropagation?(): void;
44
+ preventDefault?(): void;
45
+ }
46
+ /**
47
+ * BasicEvent Builder
48
+ * this function is responsable of BasicEvent creation
49
+ * ie. is equivalent of new BasicEvent( xxx );
50
+ * @param params
51
+ * @returns BasicEvent
52
+ */
53
+ export declare function BasicEvent<T extends BasicEvent = BasicEvent>(params: any): T;
54
+ /**
55
+ * Click Event
56
+ * click event do not have any additional parameters
57
+ */
58
+ export interface EvClick extends BasicEvent {
59
+ }
60
+ export declare function EvClick(context?: any): EvClick;
61
+ /**
62
+ * Change Event
63
+ * value is the the element value
64
+ */
65
+ export interface EvChange extends BasicEvent {
66
+ readonly value: any;
67
+ }
68
+ export declare function EvChange(value: unknown, context?: any): EvChange;
69
+ /**
70
+ * Selection Event
71
+ * value is the new selection or null
72
+ */
73
+ interface X4Selection {
74
+ }
75
+ export interface EvSelectionChange extends BasicEvent {
76
+ readonly selection: X4Selection;
77
+ }
78
+ export declare function EvSelectionChange(selection: X4Selection, context?: any): EvSelectionChange;
79
+ /**
80
+ * ContextMenu Event
81
+ */
82
+ export interface EvContextMenu extends BasicEvent {
83
+ uievent: UIEvent;
84
+ }
85
+ export declare function EvContextMenu(uievent: UIEvent, context?: any): EvContextMenu;
86
+ /**
87
+ * Timer Event
88
+ * @see startTimer, stopTimer
89
+ */
90
+ export interface EvTimer extends BasicEvent {
91
+ timer: string;
92
+ time: number;
93
+ }
94
+ export declare function EvTimer(timer: string, time?: number, context?: any): EvTimer;
95
+ /**
96
+ * Simple message
97
+ */
98
+ export interface EvMessage extends BasicEvent {
99
+ readonly msg: string;
100
+ readonly params?: any;
101
+ }
102
+ export declare function EvMessage(msg: string, params?: unknown, source?: unknown): EvMessage;
103
+ /**
104
+ * Drag/Drop event
105
+ */
106
+ export interface EvDrag extends BasicEvent {
107
+ element: unknown;
108
+ data: any;
109
+ }
110
+ export declare function EvDrag(element: unknown, data: any, ctx: any): EvDrag;
111
+ /**
112
+ * Errors
113
+ */
114
+ export interface EvError extends BasicEvent {
115
+ code: number;
116
+ message: string;
117
+ }
118
+ export declare function EvError(code: number, message: string): EvError;
119
+ /**
120
+ * this Base interface is used to describe available events & their types
121
+ *
122
+ * you can implement your own event mapping:
123
+ * @example
124
+ * ```ts
125
+ * interface MyEventMap extends EventMap {
126
+ * click: EvClick,
127
+ * 'custom-message': Event,
128
+ * [key: string]: Event,
129
+ * }
130
+ * ```
131
+ */
132
+ export interface EventMap {
133
+ }
134
+ /**
135
+ * basic event types, in general the type is builded from the eventMap
136
+ * this is very usefull for editor completion
137
+ * @example
138
+ * ```ts
139
+ * type MyEventType = MapEvents<MyEventMap>;
140
+ * ```
141
+ */
142
+ export interface EventTypes {
143
+ }
144
+ /**
145
+ * convert an EventMap to a EventType
146
+ */
147
+ export type MapEvents<Type> = {
148
+ [Property in keyof Type]?: (ev: Type[Property]) => any;
149
+ };
150
+ /**
151
+ * Event emitter class
152
+ * this class allow you to emit and handle events
153
+ *
154
+ * @example:
155
+ * ```ts
156
+ *
157
+ * interface EvDoIt extends BasicEvent {
158
+ * param: unknown;
159
+ * }
160
+ *
161
+ * function EvDoIt( e: EvDoIt ) : EvDoIt {
162
+ * return BasicEvent<EvDoIt>( e );
163
+ * }
164
+ *
165
+ * interface TestEventMap extends EventMap {
166
+ * doit: EvDoIt;
167
+ * }
168
+ *
169
+ * let ee = new EventSource<TestEventMap>(null);
170
+ * ee.listen({
171
+ * doit: (e) => {
172
+ * console.log(e);
173
+ * e.preventDefault();
174
+ * },
175
+ * });
176
+ *
177
+ * ee.defaults({
178
+ * doit: (e) => {
179
+ * console.log('default handler for ', e.type, e.selection);
180
+ * },
181
+ * })
182
+ *
183
+ * ee.on('doit', (e) => {
184
+ * debugger;
185
+ * })
186
+ *
187
+ * const ev = EvDoIt({ param: 10 });
188
+ * ee.emit('change', ev);
189
+ * if (ev.defaultPrevented) {
190
+ * console.log('prevented');
191
+ * }
192
+ * ```
193
+ */
194
+ export declare class EventSource<Q extends EventMap, T extends EventTypes = MapEvents<Q>> {
195
+ private m_source;
196
+ private m_eventRegistry;
197
+ private m_defaultHandlers;
198
+ constructor(source?: unknown);
199
+ /**
200
+ * emit an event
201
+ * you can stop propagation of event or prevent default
202
+ * @param eventName - name of event to emit
203
+ * @param event - event data
204
+ */
205
+ emit<K extends keyof Q>(type: K, event?: Q[K]): void;
206
+ _emit(eventName: string, e: BasicEvent): void;
207
+ /**
208
+ * signal en event
209
+ * signaled event are notification : no way to prevent default not stop propagation
210
+ * @param eventName name of event to signal
211
+ * @param event event data
212
+ */
213
+ signal<K extends keyof Q>(type: K, event: Q[K], delay?: number): void;
214
+ _signal(eventName: string, e: BasicEvent, delay?: number): void;
215
+ /**
216
+ * handle an event one time
217
+ * @param eventName - event name to handle
218
+ * @param callback - callback to call when event is signaled
219
+ * @returns Promise if callback is null
220
+ *
221
+ * take care with that because if the event is never fired and you await it,
222
+ * the system may overflow
223
+ */
224
+ once<K extends keyof Q>(type: K, callback: (ev: Q[K]) => any): void;
225
+ _once(eventName: string, callback: EventCallback): Promise<unknown>;
226
+ /**
227
+ * set the event default handler
228
+ * @param eventName - name of the event
229
+ * @param callback - callback to call when the event is not handled (and preventDeault has not been called)
230
+ */
231
+ setDefaultHandler(eventName: string, callback: EventCallback): void;
232
+ /**
233
+ * remove the previous default handler installed for an event
234
+ * @param eventName - event name
235
+ * @param callback - callback handler to remove (must be the same as in setDefaultHandler)
236
+ */
237
+ removeDefaultHandler(eventName: string, callback: EventCallback): void;
238
+ /**
239
+ * define a set of listeners in one call
240
+ * @param events
241
+ */
242
+ listen(events: T): void;
243
+ /**
244
+ * define a set of default handlers in one call
245
+ * @param events
246
+ */
247
+ defaults(events: T): void;
248
+ /**
249
+ * listen for an event
250
+ * @param eventName - event name to listen on
251
+ * @param callback - callback to call
252
+ * @param capturing - if true, capture event before other registred event handlers
253
+ */
254
+ on<K extends keyof Q>(type: K, callback: (ev: Q[K]) => any): EventDisposer;
255
+ _on(eventName: string, callback: EventCallback, capturing?: boolean): EventDisposer;
256
+ /**
257
+ * stop listening to an event
258
+ * @param eventName - event name
259
+ * @param callback - callback to remove (must be the same as in on )
260
+ */
261
+ off<K extends keyof Q>(type: K, callback: (ev: Q[K]) => any): void;
262
+ _off(eventName: string, callback: EventCallback): void;
263
+ /**
264
+ * remove all listeners for an event
265
+ * @param eventName - event name
266
+ */
267
+ removeAllListeners(eventName: string | null): void;
268
+ }
269
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file x4react.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+ import { Component, ComponentContent, CProps, CEventMap } from './component';
30
+ export declare let React: {
31
+ createElement: (clsOrTag: any, attrs: any, ...children: any[]) => ComponentContent;
32
+ createFragment: () => ComponentContent;
33
+ Fragment: symbol;
34
+ };
35
+ /**
36
+ *
37
+ */
38
+ export declare abstract class TSXComponent<P extends CProps<CEventMap> = CProps<CEventMap>, E extends CEventMap = CEventMap> extends Component<P, E> {
39
+ render(props: P): void;
40
+ abstract renderTSX(props: P): Component | Component[];
41
+ }
package/lib/styles/x4.css CHANGED
@@ -320,6 +320,7 @@ textarea::selection {
320
320
  display: flex;
321
321
  flex-direction: row;
322
322
  align-items: center;
323
+ gap: 4px;
323
324
  outline: none;
324
325
  cursor: pointer;
325
326
  font-family: var(--x4-font);
@@ -336,8 +337,8 @@ textarea::selection {
336
337
  color: inherit;
337
338
  }
338
339
  .x-base-button .x-svg-icon {
339
- width: 100%;
340
- height: 100%;
340
+ width: 1rem;
341
+ height: 1rem;
341
342
  margin: 0;
342
343
  }
343
344
  .x-base-button:focus {
@@ -471,6 +472,7 @@ textarea::selection {
471
472
  border-bottom: 1px solid transparent;
472
473
  margin-top: 1px;
473
474
  line-height: 1.3em;
475
+ width: 24px;
474
476
  }
475
477
  .x-text-edit input::placeholder,
476
478
  .x-combo-box input::placeholder,
@@ -502,7 +504,7 @@ textarea::selection {
502
504
  color: var(--gray-900);
503
505
  border: none;
504
506
  margin: 0;
505
- padding: 0;
507
+ padding: 4px;
506
508
  height: 2em;
507
509
  margin-top: 1px;
508
510
  }
@@ -407,6 +407,7 @@ textarea {
407
407
  display: flex;
408
408
  flex-direction: row;
409
409
  align-items: center;
410
+ gap: 4px;
410
411
  outline: none;
411
412
  cursor: pointer;
412
413
  font-family: var( --x4-font );
@@ -426,8 +427,8 @@ textarea {
426
427
  }
427
428
 
428
429
  .x-svg-icon {
429
- width: 100%;
430
- height: 100%;
430
+ width: 1rem;
431
+ height: 1rem;
431
432
  margin: 0;
432
433
  }
433
434
 
@@ -585,6 +586,7 @@ textarea {
585
586
  border-bottom: 1px solid transparent;
586
587
  margin-top: 1px; // hack alignement label / edit
587
588
  line-height: 1.3em;
589
+ width: 24px; // fix min-content
588
590
 
589
591
  &::placeholder {
590
592
  color: var( --gray-800 );
@@ -613,7 +615,7 @@ textarea {
613
615
  border: none;
614
616
 
615
617
  margin: 0;
616
- padding: 0;
618
+ padding: 4px;
617
619
  height: 2em;
618
620
  margin-top: 1px;
619
621
 
@@ -0,0 +1,14 @@
1
+ # MIT LICENSE #
2
+
3
+ **Copyright (c) 2019-2022 R-libre ingenierie**
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
12
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
13
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+
@@ -0,0 +1,88 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file action.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+
30
+ import { BasicEvent, EvChange } from './x4events'
31
+ import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component'
32
+ import { IconID } from "./icon"
33
+ import { EventHandler } from './component';
34
+
35
+ //TODO: implement all
36
+
37
+
38
+ export interface EvAction extends BasicEvent {
39
+ }
40
+
41
+ export function EvAction( source: Action ) {
42
+ return BasicEvent<EvAction>({source});
43
+ }
44
+
45
+ interface ActionEventMap extends BaseComponentEventMap {
46
+ run: EvAction;
47
+ change: EvChange;
48
+ }
49
+
50
+ interface ActionProps extends BaseComponentProps<ActionEventMap> {
51
+ id?: any;
52
+ text?: string;
53
+ icon?: IconID;
54
+ disabled?: boolean;
55
+ hidden?: boolean;
56
+ checked?: boolean;
57
+
58
+ run: EventHandler<EvAction>;
59
+ change?: EventHandler<EvChange>;
60
+ }
61
+
62
+ export class Action extends BaseComponent<ActionProps,ActionEventMap> {
63
+
64
+ constructor( props: ActionProps ) {
65
+ super( props );
66
+
67
+ this.mapPropEvents( props, "run" );
68
+ }
69
+
70
+ get props( ) {
71
+ return this.m_props;
72
+ }
73
+
74
+ set text( t: string ) {
75
+ this.m_props.text = t;
76
+ this.emit( "change", EvChange(this) );
77
+ }
78
+
79
+ set icon( i: IconID ) {
80
+ this.m_props.icon = i;
81
+ this.emit( "change", EvChange(this) );
82
+ }
83
+
84
+ fire( ) {
85
+ this.emit( "run", EvAction(this) );
86
+ }
87
+ }
88
+
Binary file