x4js 1.4.7 → 1.4.10

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 (175) hide show
  1. package/README.md +4 -0
  2. package/build.sh +5 -0
  3. package/lib/application.d.ts +15 -11
  4. package/lib/application.js +15 -11
  5. package/lib/base64.d.ts +15 -11
  6. package/lib/base64.js +15 -11
  7. package/lib/base_component.d.ts +18 -1
  8. package/lib/base_component.js +18 -1
  9. package/lib/button.d.ts +15 -11
  10. package/lib/button.js +15 -11
  11. package/lib/calendar.d.ts +15 -11
  12. package/lib/calendar.js +29 -22
  13. package/lib/canvas.d.ts +15 -11
  14. package/lib/canvas.js +15 -11
  15. package/lib/cardview.d.ts +15 -11
  16. package/lib/cardview.js +15 -11
  17. package/lib/checkbox.d.ts +17 -12
  18. package/lib/checkbox.js +18 -11
  19. package/lib/color.d.ts +15 -11
  20. package/lib/color.js +15 -11
  21. package/lib/colorpicker.d.ts +18 -11
  22. package/lib/colorpicker.js +18 -11
  23. package/lib/combobox.d.ts +15 -11
  24. package/lib/combobox.js +16 -12
  25. package/lib/component.d.ts +19 -15
  26. package/lib/component.js +19 -15
  27. package/lib/datastore.d.ts +15 -11
  28. package/lib/datastore.js +16 -12
  29. package/lib/dialog.d.ts +15 -11
  30. package/lib/dialog.js +19 -14
  31. package/lib/dom_events.d.ts +17 -1
  32. package/lib/dom_events.js +17 -1
  33. package/lib/drag_manager.d.ts +28 -0
  34. package/lib/drawtext.d.ts +15 -11
  35. package/lib/drawtext.js +15 -11
  36. package/lib/fileupload.d.ts +15 -11
  37. package/lib/fileupload.js +15 -11
  38. package/lib/form.d.ts +15 -11
  39. package/lib/form.js +15 -11
  40. package/lib/formatters.d.ts +15 -11
  41. package/lib/formatters.js +15 -11
  42. package/lib/gridview.d.ts +15 -11
  43. package/lib/gridview.js +59 -29
  44. package/lib/i18n.d.ts +15 -11
  45. package/lib/i18n.js +15 -11
  46. package/lib/icon.d.ts +20 -12
  47. package/lib/icon.js +107 -25
  48. package/lib/image.d.ts +15 -11
  49. package/lib/image.js +15 -11
  50. package/lib/index.d.ts +28 -0
  51. package/lib/index.js +28 -0
  52. package/lib/input.d.ts +15 -11
  53. package/lib/input.js +15 -11
  54. package/lib/label.d.ts +15 -11
  55. package/lib/label.js +15 -11
  56. package/lib/layout.d.ts +21 -17
  57. package/lib/layout.js +21 -17
  58. package/lib/link.d.ts +15 -11
  59. package/lib/link.js +15 -11
  60. package/lib/listview.d.ts +15 -11
  61. package/lib/listview.js +15 -11
  62. package/lib/md5.d.ts +16 -11
  63. package/lib/md5.js +16 -10
  64. package/lib/menu.d.ts +15 -11
  65. package/lib/menu.js +19 -12
  66. package/lib/messagebox.d.ts +15 -11
  67. package/lib/messagebox.js +17 -13
  68. package/lib/panel.d.ts +15 -11
  69. package/lib/panel.js +15 -11
  70. package/lib/popup.d.ts +15 -11
  71. package/lib/popup.js +20 -18
  72. package/lib/property_editor.d.ts +15 -11
  73. package/lib/property_editor.js +15 -11
  74. package/lib/radiobtn.d.ts +15 -11
  75. package/lib/radiobtn.js +15 -11
  76. package/lib/rating.d.ts +15 -11
  77. package/lib/rating.js +15 -11
  78. package/lib/request.d.ts +15 -11
  79. package/lib/request.js +16 -12
  80. package/lib/router.d.ts +28 -0
  81. package/lib/router.js +28 -0
  82. package/lib/settings.d.ts +15 -11
  83. package/lib/settings.js +15 -11
  84. package/lib/sidebarview.d.ts +15 -11
  85. package/lib/sidebarview.js +15 -11
  86. package/lib/smartedit.d.ts +15 -11
  87. package/lib/smartedit.js +15 -11
  88. package/lib/spreadsheet.d.ts +15 -11
  89. package/lib/spreadsheet.js +15 -11
  90. package/lib/styles.d.ts +16 -12
  91. package/lib/styles.js +21 -14
  92. package/lib/svgcomponent.d.ts +15 -11
  93. package/lib/svgcomponent.js +15 -11
  94. package/lib/tabbar.d.ts +17 -2
  95. package/lib/tabbar.js +17 -2
  96. package/lib/tabview.d.ts +15 -11
  97. package/lib/tabview.js +15 -11
  98. package/lib/textarea.d.ts +15 -11
  99. package/lib/textarea.js +15 -11
  100. package/lib/textedit.d.ts +15 -11
  101. package/lib/textedit.js +16 -12
  102. package/lib/texthiliter.d.ts +15 -11
  103. package/lib/texthiliter.js +15 -11
  104. package/lib/toaster.d.ts +15 -11
  105. package/lib/toaster.js +15 -11
  106. package/lib/tools.d.ts +15 -11
  107. package/lib/tools.js +15 -11
  108. package/lib/tooltips.d.ts +15 -11
  109. package/lib/tooltips.js +15 -11
  110. package/lib/treeview.d.ts +15 -11
  111. package/lib/treeview.js +15 -11
  112. package/{x4.css → lib/x4.css} +236 -97
  113. package/lib/x4_events.d.ts +17 -12
  114. package/lib/x4_events.js +24 -14
  115. package/package.json +5 -1
  116. package/src/MIT-license.md +14 -0
  117. package/src/application.ts +15 -11
  118. package/src/base64.ts +15 -11
  119. package/src/base_component.ts +18 -1
  120. package/src/button.ts +15 -11
  121. package/src/calendar.ts +30 -22
  122. package/src/canvas.ts +22 -18
  123. package/src/cardview.ts +15 -11
  124. package/src/checkbox.ts +21 -12
  125. package/src/color.ts +15 -11
  126. package/src/colorpicker.ts +19 -11
  127. package/src/combobox.ts +16 -12
  128. package/src/component.ts +21 -16
  129. package/src/datastore.ts +16 -12
  130. package/src/dialog.ts +19 -14
  131. package/src/dom_events.ts +17 -1
  132. package/src/drag_manager.ts +28 -0
  133. package/src/drawtext.ts +15 -11
  134. package/src/fileupload.ts +15 -11
  135. package/src/form.ts +15 -11
  136. package/src/formatters.ts +15 -11
  137. package/src/gridview.ts +76 -30
  138. package/src/i18n.ts +15 -11
  139. package/src/icon.ts +125 -33
  140. package/src/image.ts +15 -11
  141. package/src/index.ts +29 -0
  142. package/src/input.ts +15 -11
  143. package/src/label.ts +15 -11
  144. package/src/layout.ts +21 -17
  145. package/src/link.ts +15 -11
  146. package/src/listview.ts +15 -11
  147. package/src/md5.ts +16 -10
  148. package/src/menu.ts +19 -12
  149. package/src/messagebox.ts +17 -13
  150. package/src/panel.ts +15 -11
  151. package/src/popup.ts +20 -19
  152. package/src/property_editor.ts +15 -11
  153. package/src/radiobtn.ts +15 -11
  154. package/src/rating.ts +15 -11
  155. package/src/request.ts +16 -12
  156. package/src/router.ts +28 -0
  157. package/src/settings.ts +15 -11
  158. package/src/sidebarview.ts +15 -11
  159. package/src/smartedit.ts +15 -11
  160. package/src/spreadsheet.ts +15 -11
  161. package/src/styles.ts +23 -14
  162. package/src/svgcomponent.ts +15 -11
  163. package/src/tabbar.ts +17 -2
  164. package/src/tabview.ts +15 -11
  165. package/src/textarea.ts +15 -11
  166. package/src/textedit.ts +17 -13
  167. package/src/texthiliter.ts +15 -11
  168. package/src/toaster.ts +15 -11
  169. package/src/tools.ts +15 -11
  170. package/src/tooltips.ts +15 -11
  171. package/src/treeview.ts +15 -11
  172. package/src/x4.less +253 -106
  173. package/src/x4_events.ts +27 -16
  174. package/tsconfig.json +1 -1
  175. package/src/README.md +0 -2
package/src/combobox.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file combobox.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
10
  *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
17
12
  *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
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.
22
21
  *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
24
28
  **/
25
29
 
26
30
  /**
@@ -156,7 +160,7 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
156
160
  this.m_ui_input,
157
161
  this.m_ui_button = new Button({
158
162
  cls: 'gadget',
159
- icon: 'cls(far fa-angle-down)',
163
+ icon: 'var( --x4-icon-angle-down )',
160
164
  tabIndex: false,
161
165
  click: () => this.showPopup(),
162
166
  dom_events: {
package/src/component.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file components.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
- *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
17
- *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>..
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.
24
28
  */
25
29
 
26
30
 
@@ -1558,8 +1562,9 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
1558
1562
  return result ? Component.getElement<T>(result) : null;
1559
1563
  }
1560
1564
 
1561
- public queryAll(selector: string, cb?: (el: Component) => void) {
1562
- const elements = this.m_dom.querySelectorAll(selector);
1565
+ public queryAll(selector: string, cb?: (el: Component) => void): HTMLElement[] {
1566
+ let elements:HTMLElement[] = Array.from( this.m_dom.querySelectorAll<HTMLElement>(selector) );
1567
+
1563
1568
  if( cb ) {
1564
1569
  elements.forEach((el) => {
1565
1570
  cb(flyWrap(el as HTMLElement));
package/src/datastore.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file datastore.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
10
  *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
17
12
  *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
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.
22
21
  *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
24
28
  **/
25
29
 
26
30
  import { ajaxRequest } from './request';
@@ -438,7 +442,7 @@ export class Record {
438
442
 
439
443
  let fld = fields[idx];
440
444
  if( fld.calc!==undefined ) {
441
- return fld.calc.call( this );
445
+ return fld.calc( this );
442
446
  }
443
447
 
444
448
  return this[fld.name];
package/src/dialog.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file dialog.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
10
  *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
17
12
  *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
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.
22
21
  *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
24
28
  **/
25
29
 
26
30
  import { Popup, PopupProps, PopupEventMap, EvMove } from './popup'
@@ -336,9 +340,10 @@ export class Dialog<P extends DialogProps = DialogProps, E extends DialogBoxEven
336
340
  content: [
337
341
  this.m_icon ? new Icon({ icon: this.m_icon }) : null,
338
342
  this.m_ui_title = new Label({ flex: 1, text: this.m_title }),
339
- this.m_minimizable ? new Icon({ cls: 'min-btn', icon: 'cls(far fa-window-minimize)', dom_events: { click: () => this._toggleMin() } }) : null,
340
- this.m_maximizable ? new Icon({ cls: 'max-btn', icon: 'cls(far fa-window-maximize)', dom_events: { click: () => this._toggleMax() } }) : null,
341
- this.m_closable ? new Icon({ icon: 'cls(far fa-rectangle-times)', dom_events: { click: () => this.close() } }) : null,
343
+ this.m_minimizable ? new Icon({ cls: 'min-btn', icon: 'var( --x4-icon-window-minimize )', dom_events: { click: () => this._toggleMin() } }) : null,
344
+ this.m_maximizable ? new Icon({ cls: 'max-btn', icon: 'var( --x4-icon-window-maximize )', dom_events: { click: () => this._toggleMax() } }) : null,
345
+ this.m_maximizable ? new Icon({ cls: 'res-btn', icon: 'var( --x4-icon-window-restore )', dom_events: { click: () => this._toggleMax() } }) : null,
346
+ this.m_closable ? new Icon({ cls: 'close-btn', icon: 'var( --x4-icon-rectangle-times )', dom_events: { click: () => this.close() } }) : null,
342
347
  ]
343
348
  });
344
349
 
package/src/dom_events.ts CHANGED
@@ -7,8 +7,24 @@
7
7
  *
8
8
  * @file dom_events.ts
9
9
  * @author Etienne Cochard
10
- * @copyright (c) 2022 R-libre ingenierie, all rights reserved.
11
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.
12
28
  **/
13
29
 
14
30
  export interface X4ElementEventMap extends HTMLElementEventMap {
@@ -1,3 +1,31 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file drag_manager.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
+ **/
1
29
  import { Component } from './component';
2
30
  import { Point } from './tools';
3
31
 
package/src/drawtext.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file drawtext.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
10
  *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
17
12
  *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
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.
22
21
  *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
24
28
  **/
25
29
 
26
30
  import { deferCall, Point, Rect, roundTo } from './tools'
package/src/fileupload.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file fileupload.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
10
  *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
17
12
  *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
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.
22
21
  *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
24
28
  **/
25
29
 
26
30
  import { Component, CProps } from './component'
package/src/form.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file form.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
10
  *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
17
12
  *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
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.
22
21
  *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
24
28
  **/
25
29
 
26
30
  import { Component, Container, CProps, ContainerEventMap, ComponentContent, flyWrap } from './component'
package/src/formatters.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file formatters.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
10
  *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
17
12
  *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
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.
22
21
  *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
24
28
  **/
25
29
 
26
30
  import { formatIntlDate, roundTo } from './tools'
package/src/gridview.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file gridview.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
10
  *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
17
12
  *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
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.
22
21
  *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
24
28
  **/
25
29
 
26
30
  const T_UPDATE = Symbol('update');
@@ -40,6 +44,7 @@ import { downloadData } from './tools'
40
44
  import { DataView, DataStore, Record } from './datastore'
41
45
 
42
46
  import { EvContextMenu, EvSelectionChange, BasicEvent, EventDisposer } from "./x4_events";
47
+ import { Icon } from './icon.js';
43
48
 
44
49
  export interface EvGridCheck extends BasicEvent {
45
50
  rec: Record;
@@ -70,6 +75,12 @@ export interface GridColumn {
70
75
  sortable?: boolean;
71
76
  }
72
77
 
78
+ interface GridColumnInternal extends GridColumn {
79
+ $col: ColHeader;
80
+ }
81
+
82
+
83
+
73
84
  export type CellRenderer = (rec: Record) => Component;
74
85
  export type RowClassifier = (rec: Record, Row: Component) => void;
75
86
  export type ContextMenuGridItem = (event: MouseEvent, item: Record, grid: GridView) => any;
@@ -93,6 +104,52 @@ export interface GridViewProps extends CProps<GridViewEventMap> {
93
104
  }
94
105
 
95
106
 
107
+ class ColHeader extends Component {
108
+
109
+ private m_sens: "up" | "dn";
110
+ private m_sorted: boolean;
111
+
112
+ constructor( props, title ) {
113
+ super( props );
114
+
115
+ this.m_sorted = false;
116
+ this.m_sens = 'dn';
117
+
118
+ this.setContent( [
119
+ new Component({
120
+ tag: 'span',
121
+ content: title
122
+ }),
123
+ new Icon( {
124
+ ref: 'sorter',
125
+ cls: '@hidden',
126
+ icon: 'var( --x4-icon-arrow-down )'
127
+ })
128
+ ]);
129
+ }
130
+
131
+ get sorted( ) {
132
+ return this.m_sorted;
133
+ }
134
+
135
+ set sorted( v ) {
136
+ this.m_sorted = v;
137
+ this.m_sens = 'dn';
138
+ this.itemWithRef<Icon>( 'sorter' ).show( v );
139
+ }
140
+
141
+ get sens( ) {
142
+ return this.m_sens;
143
+ }
144
+
145
+ toggleSens( ) {
146
+ this.m_sens = this.m_sens=='up' ? 'dn' : 'up';
147
+ this.itemWithRef<Icon>( 'sorter' ).icon = this.m_sens=='dn' ? 'var( --x4-icon-arrow-down )' : 'var( --x4-icon-arrow-up )';
148
+ }
149
+ }
150
+
151
+
152
+
96
153
  /**
97
154
  * gridview class
98
155
  */
@@ -222,8 +279,6 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
222
279
  */
223
280
 
224
281
  private _handleKey(event: KeyboardEvent) {
225
- //debugger;
226
-
227
282
  if (!this.m_dataview || this.m_dataview.count == 0) {
228
283
  return;
229
284
  }
@@ -373,12 +428,8 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
373
428
  cls += ' ' + col.cls;
374
429
  }
375
430
 
376
- let comp = new Component({
431
+ let comp = new ColHeader({
377
432
  cls,
378
- content: new Component({
379
- tag: 'span',
380
- content: col.title
381
- }),
382
433
  flex: col.flex,
383
434
  sizable: 'right',
384
435
  style: {
@@ -393,7 +444,7 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
393
444
  }
394
445
  }
395
446
  }
396
- });
447
+ }, col.title );
397
448
 
398
449
  const resizeCol = ( ev: EvSize ) => {
399
450
  this._on_col_resize(index, ev.size.width);
@@ -495,27 +546,22 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
495
546
 
496
547
  this.m_columns.forEach((c) => {
497
548
  if (c !== col) {
498
- (<any>c).$sorted = false;
499
- (<any>c).$col.removeClass('sort desc');
549
+ (c as GridColumnInternal).$col.sorted = false;
500
550
  }
501
551
  });
502
552
 
503
- const $col = col as any;
553
+ const $col = (col as GridColumnInternal).$col;
504
554
 
505
- if ($col.$sorted) {
506
- $col.$sens = $col.$sens ? 0 : 1;
507
- $col.$col.setClass('desc', $col.$sens);
555
+ if ($col.sorted) {
556
+ $col.toggleSens( );
508
557
  }
509
558
  else {
510
- $col.$sens = 0;
511
- $col.$sorted = true;
512
- $col.$col.addClass('sort');
513
- $col.$col.removeClass('desc');
559
+ $col.sorted = true;
514
560
  }
515
561
 
516
562
  if (this.m_dataview) {
517
563
  this.m_dataview.sort([
518
- { field: col.id, ascending: $col.$sens ? false : true }
564
+ { field: col.id, ascending: $col.sens=='dn' ? false : true }
519
565
  ]);
520
566
  }
521
567
  }
package/src/i18n.ts CHANGED
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @file i18n.ts
9
9
  * @author Etienne Cochard
10
- * @license
11
- * Copyright (c) 2019-2021 R-libre ingenierie
12
10
  *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 3 of the License, or
16
- * (at your option) any later version.
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
17
12
  *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
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.
22
21
  *
23
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
24
28
  **/
25
29
 
26
30