x4js 1.5.15 → 1.5.17

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 (75) hide show
  1. package/lib/cjs/app_sockets.js +74 -0
  2. package/lib/cjs/index.js +1 -0
  3. package/lib/cjs/treeview.js +19 -0
  4. package/lib/cjs/version.js +1 -1
  5. package/lib/esm/app_sockets.js +70 -0
  6. package/lib/esm/index.mjs +1 -0
  7. package/lib/esm/treeview.js +19 -0
  8. package/lib/esm/version.js +1 -1
  9. package/lib/{src/version.ts → types/app_sockets.d.ts} +29 -30
  10. package/lib/types/index.d.ts +1 -0
  11. package/lib/types/treeview.d.ts +8 -0
  12. package/lib/types/version.d.ts +1 -1
  13. package/package.json +1 -1
  14. package/lib/src/MIT-license.md +0 -14
  15. package/lib/src/action.ts +0 -88
  16. package/lib/src/alpha.jpg +0 -0
  17. package/lib/src/application.ts +0 -251
  18. package/lib/src/autocomplete.ts +0 -197
  19. package/lib/src/base64.ts +0 -166
  20. package/lib/src/base_component.ts +0 -152
  21. package/lib/src/button.ts +0 -355
  22. package/lib/src/calendar.ts +0 -328
  23. package/lib/src/canvas.ts +0 -505
  24. package/lib/src/cardview.ts +0 -227
  25. package/lib/src/checkbox.ts +0 -188
  26. package/lib/src/color.ts +0 -752
  27. package/lib/src/colorpicker.ts +0 -1639
  28. package/lib/src/combobox.ts +0 -465
  29. package/lib/src/component.ts +0 -2329
  30. package/lib/src/datastore.ts +0 -1322
  31. package/lib/src/dialog.ts +0 -656
  32. package/lib/src/dom_events.ts +0 -315
  33. package/lib/src/drag_manager.ts +0 -199
  34. package/lib/src/drawtext.ts +0 -355
  35. package/lib/src/fileupload.ts +0 -213
  36. package/lib/src/form.ts +0 -375
  37. package/lib/src/formatters.ts +0 -105
  38. package/lib/src/gridview.ts +0 -1185
  39. package/lib/src/i18n.ts +0 -346
  40. package/lib/src/icon.ts +0 -335
  41. package/lib/src/image.ts +0 -204
  42. package/lib/src/index.ts +0 -88
  43. package/lib/src/input.ts +0 -249
  44. package/lib/src/label.ts +0 -128
  45. package/lib/src/layout.ts +0 -430
  46. package/lib/src/link.ts +0 -86
  47. package/lib/src/listview.ts +0 -765
  48. package/lib/src/md5.ts +0 -438
  49. package/lib/src/menu.ts +0 -425
  50. package/lib/src/messagebox.ts +0 -224
  51. package/lib/src/panel.ts +0 -86
  52. package/lib/src/popup.ts +0 -494
  53. package/lib/src/property_editor.ts +0 -337
  54. package/lib/src/radiobtn.ts +0 -197
  55. package/lib/src/rating.ts +0 -135
  56. package/lib/src/request.ts +0 -300
  57. package/lib/src/router.ts +0 -185
  58. package/lib/src/settings.ts +0 -77
  59. package/lib/src/sidebarview.ts +0 -103
  60. package/lib/src/spreadsheet.ts +0 -1449
  61. package/lib/src/styles.ts +0 -343
  62. package/lib/src/svgcomponent.ts +0 -577
  63. package/lib/src/tabbar.ts +0 -151
  64. package/lib/src/tabview.ts +0 -110
  65. package/lib/src/textarea.ts +0 -235
  66. package/lib/src/textedit.ts +0 -544
  67. package/lib/src/toaster.ts +0 -80
  68. package/lib/src/tools.ts +0 -1473
  69. package/lib/src/tooltips.ts +0 -191
  70. package/lib/src/treeview.ts +0 -693
  71. package/lib/src/x4.less +0 -2243
  72. package/lib/src/x4dom.ts +0 -57
  73. package/lib/src/x4events.ts +0 -585
  74. package/lib/src/x4react.ts +0 -90
  75. package/lib/x4.css +0 -1780
@@ -1,188 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file checkbox.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 { CEventMap, Component, CProps } from './component'
31
- import { EvChange, EventCallback } from './x4events'
32
- import { HtmlString } from './tools'
33
-
34
- import { Input } from './input'
35
- import { Label } from './label'
36
-
37
- // ============================================================================
38
- // [CHECKBOX]
39
- // ============================================================================
40
-
41
- interface CheckBoxEventMap extends CEventMap {
42
- change?: EvChange;
43
- }
44
-
45
- interface CheckBoxProps extends CProps<CheckBoxEventMap> {
46
- name?: string;
47
-
48
- text?: string | HtmlString;
49
-
50
- checked?: boolean;
51
- value?: string;
52
- slider?: boolean;
53
-
54
- labelWidth?: number; // <0 mean flex value
55
- labelAlign?: 'left' | 'right';
56
- align?: 'left' | 'right';
57
-
58
- change?: EventCallback<EvChange>;
59
- }
60
-
61
- /**
62
- * Standard CheckBox
63
- */
64
-
65
- export class CheckBox extends Component<CheckBoxProps, CheckBoxEventMap> {
66
-
67
- constructor(props: CheckBoxProps) {
68
-
69
- super(props);
70
-
71
- this.setDomEvent('focus', () => this._setFocus());
72
- this.mapPropEvents( props, 'change' );
73
-
74
- if( props.slider ) {
75
- this.addClass( 'slider' );
76
- }
77
- }
78
-
79
- /** @ignore */
80
- render(props: CheckBoxProps) {
81
-
82
- // checkbox
83
-
84
- let labelWidth = props.labelWidth ?? -1;
85
- let uid = '__cb_' + this.uid;
86
-
87
- this.setTag( 'label');
88
- this.addClass('@hlayout');
89
- this.addClass(props.align ?? 'left');
90
-
91
- this.setContent([
92
- new Input({
93
- ref: 'input',
94
- type: 'checkbox',
95
- name: props.name,
96
- id: uid,
97
- tabIndex: props.tabIndex,
98
- value: props.value ?? 'on',
99
- attrs: {
100
- checked: props.checked ? '' : undefined
101
- },
102
- dom_events: {
103
- change: this._change.bind(this),
104
- }
105
- }),
106
- props.slider ? new Component( { cls: '@slide-el' } ) : null,
107
- new Label({
108
- text: props.text ?? '',
109
- width: labelWidth < 0 ? undefined : labelWidth,
110
- flex: labelWidth < 0 ? -labelWidth : undefined,
111
- align: props.labelAlign ?? 'left',
112
- style: {
113
- order: props.align == 'right' ? -1 : 1,
114
- },
115
- attrs: {
116
- "for": uid
117
- }
118
- }),
119
- ]);
120
- }
121
-
122
- /**
123
- * check state changed
124
- */
125
-
126
- private _change() {
127
- this.emit('change', EvChange(this.check));
128
- }
129
-
130
- /**
131
- * focus gained/loosed
132
- */
133
-
134
- private _setFocus() {
135
- let input = this.itemWithRef<Input>('input');
136
- input.focus();
137
- }
138
-
139
- /**
140
- * @return the checked value
141
- */
142
-
143
- public get check() {
144
- if (this.dom) {
145
- let input = this.itemWithRef<Input>('input');
146
- let dom = input.dom as HTMLInputElement;
147
- return dom.checked;
148
- }
149
-
150
- return this.m_props.checked;
151
- }
152
-
153
- /**
154
- * change the checked value
155
- * @param {boolean} ck new checked value
156
- */
157
-
158
- public set check(ck: boolean) {
159
-
160
- if (this.dom) {
161
- let input = this.itemWithRef<Input>('input');
162
- const dom = input.dom as HTMLInputElement;
163
- if (dom) {
164
- dom.checked = ck;
165
- }
166
- }
167
-
168
- this.m_props.checked = ck;
169
- //this._change(); // todo: is it needed when changed by code ? -> no
170
- }
171
-
172
- get text() {
173
- return this.itemWithRef<Label>('label').text;
174
- }
175
-
176
- set text(text) {
177
- this.itemWithRef<Label>('label').text = text;
178
- }
179
-
180
- /**
181
- * toggle the checkbox
182
- */
183
-
184
- public toggle() {
185
- this.check = !this.check;
186
- }
187
- }
188
-