x4js 1.4.3 → 1.4.6

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 (67) hide show
  1. package/lib/application.d.ts +3 -2
  2. package/lib/application.js +15 -7
  3. package/lib/base64.js +5 -1
  4. package/lib/base_component.js +7 -3
  5. package/lib/button.js +24 -18
  6. package/lib/calendar.js +44 -39
  7. package/lib/canvas.js +9 -5
  8. package/lib/cardview.js +11 -7
  9. package/lib/checkbox.js +12 -8
  10. package/lib/color.js +7 -3
  11. package/lib/colorpicker.js +86 -80
  12. package/lib/combobox.js +26 -22
  13. package/lib/component.js +65 -48
  14. package/lib/datastore.js +29 -20
  15. package/lib/dialog.js +41 -36
  16. package/lib/dom_events.js +2 -1
  17. package/lib/drag_manager.js +4 -1
  18. package/lib/drawtext.js +9 -5
  19. package/lib/fileupload.js +19 -12
  20. package/lib/form.js +29 -25
  21. package/lib/formatters.js +19 -10
  22. package/lib/gridview.js +40 -35
  23. package/lib/hosts/host.js +7 -3
  24. package/lib/i18n.js +11 -5
  25. package/lib/icon.js +16 -11
  26. package/lib/image.js +7 -3
  27. package/lib/index.d.ts +55 -0
  28. package/lib/index.js +71 -56
  29. package/lib/input.js +6 -2
  30. package/lib/label.js +15 -11
  31. package/lib/layout.js +23 -13
  32. package/lib/link.js +9 -5
  33. package/lib/listview.js +34 -27
  34. package/lib/md5.js +5 -1
  35. package/lib/menu.js +27 -19
  36. package/lib/messagebox.js +22 -17
  37. package/lib/panel.js +13 -9
  38. package/lib/popup.js +25 -20
  39. package/lib/property_editor.js +20 -16
  40. package/lib/radiobtn.js +13 -9
  41. package/lib/rating.js +13 -9
  42. package/lib/request.js +16 -9
  43. package/lib/router.d.ts +1 -8
  44. package/lib/router.js +4 -0
  45. package/lib/settings.js +8 -4
  46. package/lib/sidebarview.js +12 -8
  47. package/lib/smartedit.js +16 -11
  48. package/lib/spreadsheet.js +35 -31
  49. package/lib/styles.js +15 -9
  50. package/lib/svgcomponent.js +8 -3
  51. package/lib/tabbar.js +10 -6
  52. package/lib/tabview.js +10 -6
  53. package/lib/textarea.js +10 -6
  54. package/lib/textedit.js +39 -35
  55. package/lib/texthiliter.js +8 -4
  56. package/lib/toaster.js +8 -4
  57. package/lib/tools.js +97 -51
  58. package/lib/tooltips.js +14 -9
  59. package/lib/treeview.js +30 -26
  60. package/lib/x4_events.js +21 -9
  61. package/package.json +2 -1
  62. package/src/application.ts +8 -4
  63. package/src/index.ts +55 -0
  64. package/src/router.ts +1 -1
  65. package/tsconfig.json +2 -1
  66. package/lib/list.txt +0 -56
  67. package/list.txt +0 -0
package/lib/textedit.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * ___ ___ __
3
4
  * \ \_/ / / _
@@ -22,22 +23,24 @@
22
23
  *
23
24
  * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
24
25
  **/
25
- import { Component, EvFocus } from './component';
26
- import { Input } from './input';
27
- import { Button } from './button';
28
- import { HLayout } from './layout';
29
- import { Label } from './label';
30
- import { PopupCalendar } from './calendar';
31
- import { sprintf, parseIntlDate, formatIntlDate } from './tools';
32
- import { Tooltip } from './tooltips';
33
- import { EvClick, EvChange } from './x4_events';
34
- import { _tr } from './i18n';
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.TextEdit = void 0;
28
+ const component_1 = require("./component");
29
+ const input_1 = require("./input");
30
+ const button_1 = require("./button");
31
+ const layout_1 = require("./layout");
32
+ const label_1 = require("./label");
33
+ const calendar_1 = require("./calendar");
34
+ const tools_1 = require("./tools");
35
+ const tooltips_1 = require("./tooltips");
36
+ const x4_events_1 = require("./x4_events");
37
+ const i18n_1 = require("./i18n");
35
38
  /** @ignore */
36
39
  const reEmail = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
37
40
  /**
38
41
  * TextEdit is a single line editor, it can have a label and an error descriptor.
39
42
  */
40
- export class TextEdit extends Component {
43
+ class TextEdit extends component_1.Component {
41
44
  m_cal_popup;
42
45
  m_ui_input;
43
46
  m_error_tip;
@@ -94,18 +97,18 @@ export class TextEdit extends Component {
94
97
  };
95
98
  eprops.value_hook = props.value_hook ?? def_hook;
96
99
  }
97
- this.m_ui_input = new Input(eprops);
100
+ this.m_ui_input = new input_1.Input(eprops);
98
101
  // button
99
102
  let button = undefined;
100
103
  if (props.icon) {
101
- button = new Button({
104
+ button = new button_1.Button({
102
105
  icon: props.icon,
103
106
  click: () => this._btnClick(),
104
107
  tabIndex: false
105
108
  });
106
109
  }
107
110
  else if (props.type == 'date') {
108
- button = new Button({
111
+ button = new button_1.Button({
109
112
  cls: 'gadget',
110
113
  icon: 'cls(far fa-calendar-days)',
111
114
  tabIndex: false,
@@ -140,7 +143,7 @@ export class TextEdit extends Component {
140
143
  top = true;
141
144
  flex = 1;
142
145
  }
143
- label = new Label({
146
+ label = new label_1.Label({
144
147
  ref: 'label',
145
148
  tag: 'label',
146
149
  cls: 'label1' + (props.label ? '' : ' @hidden'),
@@ -155,7 +158,7 @@ export class TextEdit extends Component {
155
158
  this.addClass('@vlayout vertical');
156
159
  this.setContent([
157
160
  label,
158
- new HLayout({ width, content: [this.m_ui_input, ...gadgets] })
161
+ new layout_1.HLayout({ width, content: [this.m_ui_input, ...gadgets] })
159
162
  ]);
160
163
  }
161
164
  else {
@@ -174,7 +177,7 @@ export class TextEdit extends Component {
174
177
  super.disable();
175
178
  }
176
179
  _btnClick() {
177
- this.emit('click', EvClick(this.value));
180
+ this.emit('click', (0, x4_events_1.EvClick)(this.value));
178
181
  }
179
182
  /**
180
183
  * select the value format for input/output on textedit of type date
@@ -191,23 +194,23 @@ export class TextEdit extends Component {
191
194
  return this.m_ui_input.getStoreValue();
192
195
  }
193
196
  _date_get_hook() {
194
- let date = parseIntlDate(this.value);
197
+ let date = (0, tools_1.parseIntlDate)(this.value);
195
198
  let props = this.m_props;
196
199
  if (props.format == 'native') {
197
200
  return date;
198
201
  }
199
202
  else {
200
- return date ? formatIntlDate(date, props.format) : null;
203
+ return date ? (0, tools_1.formatIntlDate)(date, props.format) : null;
201
204
  }
202
205
  }
203
206
  _date_set_hook(dte) {
204
207
  let props = this.m_props;
205
208
  if (props.format == 'native') {
206
- this.value = formatIntlDate(dte);
209
+ this.value = (0, tools_1.formatIntlDate)(dte);
207
210
  }
208
211
  else if (dte) {
209
- let date = parseIntlDate(dte, props.format);
210
- this.value = formatIntlDate(date);
212
+ let date = (0, tools_1.parseIntlDate)(dte, props.format);
213
+ this.value = (0, tools_1.formatIntlDate)(date);
211
214
  }
212
215
  else {
213
216
  this.value = '';
@@ -215,7 +218,7 @@ export class TextEdit extends Component {
215
218
  }
216
219
  showError(text) {
217
220
  if (!this.m_error_tip) {
218
- this.m_error_tip = new Tooltip({ cls: 'error' });
221
+ this.m_error_tip = new tooltips_1.Tooltip({ cls: 'error' });
219
222
  document.body.appendChild(this.m_error_tip._build());
220
223
  }
221
224
  let rc = this.m_ui_input.getBoundingRect();
@@ -272,14 +275,14 @@ export class TextEdit extends Component {
272
275
  */
273
276
  _change() {
274
277
  let value = this.m_ui_input.value;
275
- this.emit('change', EvChange(value));
278
+ this.emit('change', (0, x4_events_1.EvChange)(value));
276
279
  }
277
280
  /**
278
281
  * getting focus
279
282
  */
280
283
  _focus() {
281
284
  this.clearError();
282
- this.emit('focus', EvFocus(true));
285
+ this.emit('focus', (0, component_1.EvFocus)(true));
283
286
  }
284
287
  /**
285
288
  * loosing focus
@@ -287,7 +290,7 @@ export class TextEdit extends Component {
287
290
  */
288
291
  _blur() {
289
292
  this._validate(this.m_ui_input.value);
290
- this.emit('focus', EvFocus(false));
293
+ this.emit('focus', (0, component_1.EvFocus)(false));
291
294
  }
292
295
  /**
293
296
  * todo: should move into Input
@@ -300,7 +303,7 @@ export class TextEdit extends Component {
300
303
  let props = this.m_props;
301
304
  let update = false;
302
305
  if (props.required && value.length == 0) {
303
- this.showError(_tr.global.required_field);
306
+ this.showError(i18n_1._tr.global.required_field);
304
307
  return false;
305
308
  }
306
309
  if (value != '') {
@@ -308,20 +311,20 @@ export class TextEdit extends Component {
308
311
  if (pattern) {
309
312
  let re = new RegExp(pattern);
310
313
  if (re && !re.test(value)) {
311
- this.showError(_tr.global.invalid_format);
314
+ this.showError(i18n_1._tr.global.invalid_format);
312
315
  return false;
313
316
  }
314
317
  }
315
318
  if (props.type == 'email') {
316
319
  if (!reEmail.test(value.toLowerCase())) {
317
- this.showError(_tr.global.invalid_email);
320
+ this.showError(i18n_1._tr.global.invalid_email);
318
321
  return false;
319
322
  }
320
323
  }
321
324
  else if (props.type == 'number') {
322
325
  const v = parseFloat(value);
323
326
  if (isNaN(v)) {
324
- this.showError(_tr.global.invalid_number);
327
+ this.showError(i18n_1._tr.global.invalid_number);
325
328
  return false;
326
329
  }
327
330
  let min = parseFloat(this.m_ui_input.getAttribute('min'));
@@ -360,12 +363,12 @@ export class TextEdit extends Component {
360
363
  date = new Date();
361
364
  }
362
365
  else {
363
- date = parseIntlDate(value);
366
+ date = (0, tools_1.parseIntlDate)(value);
364
367
  if (!date) {
365
- throw sprintf(_tr.global.invalid_date, _tr.global.date_format);
368
+ throw (0, tools_1.sprintf)(i18n_1._tr.global.invalid_date, i18n_1._tr.global.date_format);
366
369
  }
367
370
  }
368
- return formatIntlDate(date);
371
+ return (0, tools_1.formatIntlDate)(date);
369
372
  }
370
373
  //onKeyDown( e ) {
371
374
  // if( this.readOnly ) {
@@ -387,9 +390,9 @@ export class TextEdit extends Component {
387
390
  //}
388
391
  _showDatePicker(btn) {
389
392
  if (!this.m_cal_popup) {
390
- this.m_cal_popup = new PopupCalendar({
393
+ this.m_cal_popup = new calendar_1.PopupCalendar({
391
394
  change: (ev) => {
392
- this.value = formatIntlDate(ev.value);
395
+ this.value = (0, tools_1.formatIntlDate)(ev.value);
393
396
  this.m_cal_popup.close();
394
397
  }
395
398
  });
@@ -404,3 +407,4 @@ export class TextEdit extends Component {
404
407
  return this.m_props.type;
405
408
  }
406
409
  }
410
+ exports.TextEdit = TextEdit;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * ___ ___ __
3
4
  * \ \_/ / / _
@@ -22,11 +23,13 @@
22
23
  *
23
24
  * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
24
25
  **/
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.TextHiliter = void 0;
25
28
  /**
26
29
  * idea came from https://www.cdolivet.com/editarea
27
30
  */
28
- import { Component } from './component';
29
- export class TextHiliter extends Component {
31
+ const component_1 = require("./component");
32
+ class TextHiliter extends component_1.Component {
30
33
  m_text;
31
34
  m_ed;
32
35
  m_hi;
@@ -42,11 +45,11 @@ export class TextHiliter extends Component {
42
45
  /** @ignore */
43
46
  render() {
44
47
  this.setContent([
45
- this.m_hi = new Component({
48
+ this.m_hi = new component_1.Component({
46
49
  tag: 'span',
47
50
  cls: '@fit @syntax-hiliter',
48
51
  }),
49
- this.m_ed = new Component({
52
+ this.m_ed = new component_1.Component({
50
53
  tag: 'textarea',
51
54
  cls: '@fit',
52
55
  width: '100%',
@@ -217,3 +220,4 @@ export class TextHiliter extends Component {
217
220
  return result + '\n\n\n';
218
221
  }
219
222
  }
223
+ exports.TextHiliter = TextHiliter;
package/lib/toaster.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * ___ ___ __
3
4
  * \ \_/ / / _
@@ -22,9 +23,11 @@
22
23
  *
23
24
  * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
24
25
  **/
25
- import { Label } from "./label";
26
- import { Popup } from './popup';
27
- export class Toaster extends Popup {
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.Toaster = void 0;
28
+ const label_1 = require("./label");
29
+ const popup_1 = require("./popup");
30
+ class Toaster extends popup_1.Popup {
28
31
  m_message;
29
32
  m_icon;
30
33
  constructor(props) {
@@ -38,7 +41,7 @@ export class Toaster extends Popup {
38
41
  render() {
39
42
  this.addClass('@hlayout');
40
43
  this.setContent([
41
- new Label({ icon: this.m_icon, text: this.m_message })
44
+ new label_1.Label({ icon: this.m_icon, text: this.m_message })
42
45
  ]);
43
46
  }
44
47
  show() {
@@ -56,3 +59,4 @@ export class Toaster extends Popup {
56
59
  });
57
60
  }
58
61
  }
62
+ exports.Toaster = Toaster;