x4js 1.4.44 → 1.4.45

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.
package/lib/button.js CHANGED
@@ -63,6 +63,9 @@ class BaseButton extends component_1.Component {
63
63
  const ui_icon = icon ? new icon_1.Icon({ icon, cls: 'left', ref: 'l_icon' }) : null;
64
64
  const ui_label = new label_1.Label({ flex: 1, text: text ?? '', align: props.align, ref: 'label' });
65
65
  const ui_ricon = props.rightIcon ? new icon_1.Icon({ icon: props.rightIcon, cls: 'right', ref: 'r_icon' }) : null;
66
+ if (text === undefined) {
67
+ ui_label.addClass("@hidden");
68
+ }
66
69
  this.setContent([ui_icon, ui_label, ui_ricon]);
67
70
  this._setTabIndex(props.tabIndex);
68
71
  }
@@ -147,6 +150,7 @@ class BaseButton extends component_1.Component {
147
150
  let label = this.itemWithRef('label');
148
151
  if (label) {
149
152
  label.text = text;
153
+ label.removeClass("@hidden");
150
154
  }
151
155
  }
152
156
  get text() {
package/lib/form.d.ts CHANGED
@@ -45,13 +45,13 @@ export interface FormProps extends CProps<FormEventMap> {
45
45
  /**
46
46
  *
47
47
  */
48
- export declare class Form extends VLayout<FormProps, FormEventMap> {
48
+ export declare class Form<T extends FormProps = FormProps, E extends FormEventMap = FormEventMap> extends VLayout<T, E> {
49
49
  protected m_height: string | number;
50
50
  protected m_container: Container;
51
51
  protected m_buttons: HLayout;
52
52
  protected m_dirty: boolean;
53
53
  protected m_watchChanges: boolean;
54
- constructor(props: FormProps);
54
+ constructor(props: T);
55
55
  /**
56
56
  * returns the container object
57
57
  */
package/lib/index.d.ts CHANGED
@@ -78,3 +78,4 @@ export * from "./tools";
78
78
  export * from "./tooltips";
79
79
  export * from "./treeview";
80
80
  export * from "./x4events";
81
+ export * from "./version";
package/lib/index.js CHANGED
@@ -97,3 +97,4 @@ __exportStar(require("./tools"), exports);
97
97
  __exportStar(require("./tooltips"), exports);
98
98
  __exportStar(require("./treeview"), exports);
99
99
  __exportStar(require("./x4events"), exports);
100
+ __exportStar(require("./version"), exports);
@@ -33,11 +33,12 @@ export interface SideBarItem extends ICardViewItem {
33
33
  }
34
34
  export interface SideBarProps extends CardViewProps {
35
35
  bar_sizable?: boolean;
36
+ bar_width?: number;
36
37
  }
37
38
  /**
38
39
  *
39
40
  */
40
- export declare class SideBarView extends CardView {
41
+ export declare class SideBarView extends CardView<SideBarProps> {
41
42
  m_sidebar: VLayout;
42
43
  m_content: Component;
43
44
  constructor(props: SideBarProps);
@@ -29,6 +29,7 @@
29
29
  **/
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
31
  exports.SideBarView = void 0;
32
+ const component_1 = require("./component");
32
33
  const layout_1 = require("./layout");
33
34
  const button_1 = require("./button");
34
35
  const cardview_1 = require("./cardview");
@@ -43,7 +44,7 @@ class SideBarView extends cardview_1.CardView {
43
44
  this.addClass('@hlayout');
44
45
  this.m_sidebar = new layout_1.VLayout({
45
46
  cls: '@side-bar',
46
- sizable: props.bar_sizable ? 'right' : undefined,
47
+ width: props.bar_width ?? undefined,
47
48
  });
48
49
  this.m_content = new layout_1.HLayout({ flex: 1, cls: '@tab-container' });
49
50
  }
@@ -60,6 +61,7 @@ class SideBarView extends cardview_1.CardView {
60
61
  }));
61
62
  this.setContent([
62
63
  this.m_sidebar,
64
+ this.m_props.bar_sizable ? new component_1.Separator({ orientation: "horizontal", sizing: "before" }) : undefined,
63
65
  this.m_content
64
66
  ]);
65
67
  }
@@ -76,7 +76,14 @@ declare abstract class SVGItem {
76
76
  *
77
77
  */
78
78
  renderStyle(): string;
79
+ /**
80
+ *
81
+ */
79
82
  renderContent(): string;
83
+ /**
84
+ *
85
+ */
86
+ clip(id: string): this;
80
87
  }
81
88
  /**
82
89
  *
@@ -148,9 +155,9 @@ declare class SVGGradient extends SVGItem {
148
155
  /**
149
156
  *
150
157
  */
151
- export declare class SVGPathBuilder {
152
- private m_items;
153
- constructor();
158
+ declare class SVGGroup extends SVGItem {
159
+ protected m_items: SVGItem[];
160
+ constructor(tag?: string);
154
161
  path(): SVGPath;
155
162
  text(x: any, y: any, txt: any): SVGText;
156
163
  ellipse(x: any, y: any, r1: any, r2?: any): SVGShape;
@@ -160,6 +167,15 @@ export declare class SVGPathBuilder {
160
167
  * clear
161
168
  */
162
169
  clear(): void;
170
+ renderContent(): string;
171
+ }
172
+ /**
173
+ *
174
+ */
175
+ export declare class SVGPathBuilder extends SVGGroup {
176
+ private static g_clip_id;
177
+ constructor();
178
+ addClip(x: number, y: number, w: number, h: number): string;
163
179
  render(): string;
164
180
  }
165
181
  /**
@@ -159,9 +159,19 @@ class SVGItem {
159
159
  });
160
160
  return result + '"';
161
161
  }
162
+ /**
163
+ *
164
+ */
162
165
  renderContent() {
163
166
  return '';
164
167
  }
168
+ /**
169
+ *
170
+ */
171
+ clip(id) {
172
+ this.attr("clip-path", `url(#${id})`);
173
+ return this;
174
+ }
165
175
  }
166
176
  /**
167
177
  *
@@ -325,9 +335,10 @@ class SVGGradient extends SVGItem {
325
335
  /**
326
336
  *
327
337
  */
328
- class SVGPathBuilder {
338
+ class SVGGroup extends SVGItem {
329
339
  m_items;
330
- constructor() {
340
+ constructor(tag = "g") {
341
+ super(tag);
331
342
  this.m_items = [];
332
343
  }
333
344
  path() {
@@ -369,6 +380,30 @@ class SVGPathBuilder {
369
380
  clear() {
370
381
  this.m_items = [];
371
382
  }
383
+ renderContent() {
384
+ let result = [];
385
+ this.m_items.forEach(i => {
386
+ result.push(i.render());
387
+ });
388
+ return result.join('\n');
389
+ }
390
+ }
391
+ /**
392
+ *
393
+ */
394
+ class SVGPathBuilder extends SVGGroup {
395
+ static g_clip_id = 1;
396
+ constructor() {
397
+ super('');
398
+ }
399
+ addClip(x, y, w, h) {
400
+ const id = 'c-' + SVGPathBuilder.g_clip_id++;
401
+ const clip = new SVGGroup('clipPath');
402
+ clip.attr('id', id);
403
+ clip.rect(x, y, w, h);
404
+ this.m_items.push(clip);
405
+ return id;
406
+ }
372
407
  render() {
373
408
  let result = [];
374
409
  this.m_items.forEach(i => {
package/lib/textedit.d.ts CHANGED
@@ -55,11 +55,11 @@ export interface TextEditProps extends InputProps<TextEditEventMap> {
55
55
  /**
56
56
  * TextEdit is a single line editor, it can have a label and an error descriptor.
57
57
  */
58
- export declare class TextEdit<T extends TextEditProps = TextEditProps> extends Component<TextEditProps, TextEditEventMap> {
58
+ export declare class TextEdit<T extends TextEditProps = TextEditProps, E extends TextEditEventMap = TextEditEventMap> extends Component<T, E> {
59
59
  private m_cal_popup;
60
60
  protected m_ui_input: Input;
61
61
  private m_error_tip;
62
- constructor(props: TextEditProps);
62
+ constructor(props: T);
63
63
  componentCreated(): void;
64
64
  componentDisposed(): void;
65
65
  focus(): void;
@@ -113,7 +113,7 @@ export declare class TextEdit<T extends TextEditProps = TextEditProps> extends C
113
113
  * @returns
114
114
  */
115
115
  validate(): boolean;
116
- private _validate;
116
+ protected _validate(value: string): boolean;
117
117
  _date_validator(value: string): string;
118
118
  private _showDatePicker;
119
119
  get input(): Input;
package/lib/tools.js CHANGED
@@ -407,7 +407,7 @@ exports.date_clone = date_clone;
407
407
  function date_calc_weeknum(date) {
408
408
  const firstDayOfYear = new Date(date.getFullYear(), 0, 1);
409
409
  const pastDaysOfYear = (date.valueOf() - firstDayOfYear.valueOf()) / 86400000;
410
- return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);
410
+ return Math.floor((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);
411
411
  }
412
412
  exports.date_calc_weeknum = date_calc_weeknum;
413
413
  /**
package/lib/treeview.js CHANGED
@@ -196,10 +196,12 @@ class TreeView extends layout_1.VLayout {
196
196
  let icon = node.icon;
197
197
  if (icon === undefined) {
198
198
  if (node.children) {
199
- icon = 'cls(far fa-chevron-down)';
200
- }
201
- else {
202
- icon = 'cls(far fa-file-archive)';
199
+ if (node.open === true) {
200
+ icon = 'var(--x4-icon-folder-opened)';
201
+ }
202
+ else {
203
+ icon = 'var(--x4-icon-folder-closed)';
204
+ }
203
205
  }
204
206
  }
205
207
  if (level >= 0) {
@@ -0,0 +1 @@
1
+ export declare const x4js_version = "1.4";
package/lib/version.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.x4js_version = void 0;
4
+ exports.x4js_version = "1.4";
package/lib/x4.css CHANGED
@@ -49,7 +49,6 @@
49
49
  --x4-default-border-color: rgba(0, 0, 0, 0.1);
50
50
  --x4-icon-font-family: "fonteawesome";
51
51
  --x4-icon-circle-exclamation: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM232 152C232 138.8 242.8 128 256 128s24 10.75 24 24v128c0 13.25-10.75 24-24 24S232 293.3 232 280V152zM256 400c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 385.9 273.4 400 256 400z"/></svg>';
52
- --x4-icon-chevron-right: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z"/></svg>';
53
52
  --x4-icon-arrow-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M9.375 329.4c12.51-12.51 32.76-12.49 45.25 0L128 402.8V32c0-17.69 14.31-32 32-32s32 14.31 32 32v370.8l73.38-73.38c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-128 128c-12.5 12.5-32.75 12.5-45.25 0l-128-128C-3.125 362.1-3.125 341.9 9.375 329.4z"/></svg>';
54
53
  --x4-icon-arrow-up: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M310.6 182.6c-12.51 12.51-32.76 12.49-45.25 0L192 109.3V480c0 17.69-14.31 32-32 32s-32-14.31-32-32V109.3L54.63 182.6c-12.5 12.5-32.75 12.5-45.25 0s-12.5-32.75 0-45.25l128-128c12.5-12.5 32.75-12.5 45.25 0l128 128C323.1 149.9 323.1 170.1 310.6 182.6z"/></svg>';
55
54
  --x4-icon-exclamation: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512" fill="currentColor"><path d="M64 352c17.69 0 32-14.32 32-31.1V64.01c0-17.67-14.31-32.01-32-32.01S32 46.34 32 64.01v255.1C32 337.7 46.31 352 64 352zM64 400c-22.09 0-40 17.91-40 40s17.91 39.1 40 39.1s40-17.9 40-39.1S86.09 400 64 400z"/></svg>';
@@ -62,6 +61,12 @@
62
61
  --x4-icon-calendar-days: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z"/></svg>';
63
62
  --x4-icon-tip: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM296 336h-16V248C280 234.8 269.3 224 256 224H224C210.8 224 200 234.8 200 248S210.8 272 224 272h8v64h-16C202.8 336 192 346.8 192 360S202.8 384 216 384h80c13.25 0 24-10.75 24-24S309.3 336 296 336zM256 192c17.67 0 32-14.33 32-32c0-17.67-14.33-32-32-32S224 142.3 224 160C224 177.7 238.3 192 256 192z"/></svg>';
64
63
  --x4-icon-check: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M440.1 103C450.3 112.4 450.3 127.6 440.1 136.1L176.1 400.1C167.6 410.3 152.4 410.3 143 400.1L7.029 264.1C-2.343 255.6-2.343 240.4 7.029 231C16.4 221.7 31.6 221.7 40.97 231L160 350.1L407 103C416.4 93.66 431.6 93.66 440.1 103V103z"/></svg>';
64
+ --x4-icon-folder-closed: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M448 96h-172.1L226.7 50.75C214.7 38.74 198.5 32 181.5 32H64C28.65 32 0 60.66 0 96v320c0 35.34 28.65 64 64 64h384c35.35 0 64-28.66 64-64V160C512 124.7 483.3 96 448 96zM64 80h117.5c4.273 0 8.293 1.664 11.31 4.688L256 144h192c8.822 0 16 7.176 16 16v32h-416V96C48 87.18 55.18 80 64 80zM448 432H64c-8.822 0-16-7.176-16-16V240h416V416C464 424.8 456.8 432 448 432z"/></svg>';
65
+ --x4-icon-folder-opened: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><!--! Font Awesome Pro 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M572.6 270.3l-96 192C471.2 473.2 460.1 480 447.1 480H64c-35.35 0-64-28.66-64-64V96c0-35.34 28.65-64 64-64h117.5c16.97 0 33.25 6.742 45.26 18.75L275.9 96H416c35.35 0 64 28.66 64 64v32h-48V160c0-8.824-7.178-16-16-16H256L192.8 84.69C189.8 81.66 185.8 80 181.5 80H64C55.18 80 48 87.18 48 96v288l71.16-142.3C124.6 230.8 135.7 224 147.8 224h396.2C567.7 224 583.2 249 572.6 270.3z"/></svg>';
66
+ --x4-icon-chevron-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><!--! Font Awesome Pro 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M432.6 209.3l-191.1 183.1C235.1 397.8 229.1 400 224 400s-11.97-2.219-16.59-6.688L15.41 209.3C5.814 200.2 5.502 184.1 14.69 175.4c9.125-9.625 24.38-9.938 33.91-.7187L224 342.8l175.4-168c9.5-9.219 24.78-8.906 33.91 .7187C442.5 184.1 442.2 200.2 432.6 209.3z"/></svg>';
67
+ --x4-icon-chevron-right: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z"/></svg>';
68
+ --x4-icon-chevron-left: 'data:image/svg+xml;<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M206.7 464.6l-183.1-191.1C18.22 267.1 16 261.1 16 256s2.219-11.97 6.688-16.59l183.1-191.1c9.152-9.594 24.34-9.906 33.9-.7187c9.625 9.125 9.938 24.37 .7187 33.91L73.24 256l168 175.4c9.219 9.5 8.906 24.78-.7187 33.91C231 474.5 215.8 474.2 206.7 464.6z"/></svg>';
69
+ --x4-icon-chevron-up: 'data:image/svg+xml;<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M15.41 302.7l191.1-183.1C212 114.2 218 111.1 224 111.1s11.97 2.219 16.59 6.688l191.1 183.1c9.594 9.152 9.906 24.34 .7187 33.9c-9.125 9.625-24.38 9.938-33.91 .7187L224 169.2l-175.4 168c-9.5 9.219-24.78 8.906-33.91-.7187C5.502 327 5.814 311.8 15.41 302.7z"/></svg>';
65
70
  }
66
71
  /* source: https://tailwindcss.com/docs/customizing-colors/#default-color-palette */
67
72
  :root {
@@ -416,7 +421,7 @@ textarea::selection {
416
421
  .x-combo-box {
417
422
  display: flex;
418
423
  align-items: center;
419
- width: min-content;
424
+ min-width: min-content;
420
425
  min-height: 32px;
421
426
  padding: 0;
422
427
  margin: 0;
@@ -1619,15 +1624,22 @@ textarea::selection {
1619
1624
  }
1620
1625
  .x-tree-view .x-tree-item .tree-icon {
1621
1626
  width: 2em;
1627
+ color: #999;
1628
+ height: 0.8em;
1629
+ }
1630
+ .x-tree-view .x-tree-item.selected {
1631
+ background-color: var(--x4-selection-color);
1632
+ color: var(--x4-selection-text);
1622
1633
  }
1623
- .x-tree-view .x-tree-item.collapsed .tree-icon {
1624
- transform: rotate(-90deg);
1634
+ .x-tree-view .x-tree-item.selected .tree-icon {
1635
+ color: var(--x4-selection-text);
1625
1636
  }
1626
1637
  .x-tree-view .x-tree-item:hover {
1627
- background-color: rgba(255, 255, 255, 0.1);
1638
+ background-color: var(--x4-hover-color);
1639
+ color: var(--x4-hover-text);
1628
1640
  }
1629
- .x-tree-view .x-tree-item.selected {
1630
- background-color: rgba(255, 255, 255, 0.3);
1641
+ .x-tree-view .x-tree-item:hover .tree-icon {
1642
+ color: var(--x4-hover-text);
1631
1643
  }
1632
1644
  .x-tree-view .x-tree-item .indent {
1633
1645
  position: absolute;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.4.44",
3
+ "version": "1.4.45",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/button.ts CHANGED
@@ -104,6 +104,10 @@ export class BaseButton<P extends ButtonProps = ButtonProps, E extends ButtonEve
104
104
  const ui_label = new Label({ flex: 1, text: text ?? '', align: props.align, ref: 'label' });
105
105
  const ui_ricon = props.rightIcon ? new Icon({ icon: props.rightIcon, cls: 'right', ref: 'r_icon' }) : null;
106
106
 
107
+ if( text===undefined ) {
108
+ ui_label.addClass( "@hidden" );
109
+ }
110
+
107
111
  this.setContent([ui_icon, ui_label, ui_ricon]);
108
112
  this._setTabIndex(props.tabIndex);
109
113
  }
@@ -203,7 +207,7 @@ export class BaseButton<P extends ButtonProps = ButtonProps, E extends ButtonEve
203
207
  this.m_props.text = text;
204
208
 
205
209
  let label = this.itemWithRef<Label>('label');
206
- if (label) { label.text = text; }
210
+ if (label) { label.text = text; label.removeClass("@hidden") }
207
211
  }
208
212
 
209
213
  public get text(): string | HtmlString {
package/src/form.ts CHANGED
@@ -59,7 +59,7 @@ export interface FormProps extends CProps<FormEventMap> {
59
59
  *
60
60
  */
61
61
 
62
- export class Form extends VLayout<FormProps, FormEventMap>
62
+ export class Form<T extends FormProps = FormProps, E extends FormEventMap = FormEventMap> extends VLayout<T, E>
63
63
  {
64
64
  protected m_height: string | number;
65
65
  protected m_container: Container;
@@ -67,7 +67,7 @@ export class Form extends VLayout<FormProps, FormEventMap>
67
67
  protected m_dirty: boolean;
68
68
  protected m_watchChanges: boolean;
69
69
 
70
- constructor(props: FormProps) {
70
+ constructor(props: T) {
71
71
 
72
72
  let content = props.content;
73
73
  props.content = null;
package/src/index.ts CHANGED
@@ -82,3 +82,5 @@ export * from "./tools"
82
82
  export * from "./tooltips"
83
83
  export * from "./treeview"
84
84
  export * from "./x4events"
85
+
86
+ export * from "./version"
@@ -27,7 +27,7 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- import { Component, CProps, Flex } from './component'
30
+ import { Component, CProps, Flex, Separator } from './component'
31
31
  import { HLayout, VLayout } from './layout'
32
32
  import { Button } from './button'
33
33
  import { CardView, CardViewProps, ICardViewItem } from './cardview'
@@ -37,13 +37,14 @@ export interface SideBarItem extends ICardViewItem {
37
37
 
38
38
  export interface SideBarProps extends CardViewProps {
39
39
  bar_sizable?: boolean;
40
+ bar_width?: number;
40
41
  }
41
42
 
42
43
  /**
43
44
  *
44
45
  */
45
46
 
46
- export class SideBarView extends CardView {
47
+ export class SideBarView extends CardView<SideBarProps> {
47
48
  m_sidebar: VLayout;
48
49
  m_content: Component;
49
50
 
@@ -55,7 +56,7 @@ export class SideBarView extends CardView {
55
56
 
56
57
  this.m_sidebar = new VLayout( {
57
58
  cls: '@side-bar',
58
- sizable: props.bar_sizable ? 'right' : undefined,
59
+ width: props.bar_width ?? undefined,
59
60
  });
60
61
 
61
62
  this.m_content = new HLayout( { flex: 1, cls: '@tab-container' } );
@@ -78,6 +79,7 @@ export class SideBarView extends CardView {
78
79
 
79
80
  this.setContent( [
80
81
  this.m_sidebar,
82
+ this.m_props.bar_sizable ? new Separator( { orientation: "horizontal", sizing: "before" }) : undefined,
81
83
  this.m_content
82
84
  ] );
83
85
  }
@@ -192,9 +192,22 @@ abstract class SVGItem {
192
192
  return result+'"';
193
193
  }
194
194
 
195
+ /**
196
+ *
197
+ */
198
+
195
199
  renderContent( ): string {
196
200
  return '';
197
201
  }
202
+
203
+ /**
204
+ *
205
+ */
206
+
207
+ clip( id: string ) {
208
+ this.attr( "clip-path", `url(#${id})` );
209
+ return this;
210
+ }
198
211
  }
199
212
 
200
213
  /**
@@ -391,12 +404,13 @@ class SVGGradient extends SVGItem {
391
404
  *
392
405
  */
393
406
 
394
- export class SVGPathBuilder
395
- {
396
- private m_items: SVGItem[];
407
+ class SVGGroup extends SVGItem {
408
+ protected m_items: SVGItem[];
397
409
 
398
- constructor( ) {
399
- this.m_items = [];
410
+ constructor( tag = "g" ) {
411
+ super( tag )
412
+
413
+ this.m_items = [];
400
414
  }
401
415
 
402
416
  path( ) {
@@ -445,7 +459,7 @@ export class SVGPathBuilder
445
459
  this.m_items = [];
446
460
  }
447
461
 
448
- render( ) {
462
+ renderContent( ) {
449
463
  let result: string[] = [];
450
464
  this.m_items.forEach( i => {
451
465
  result.push( i.render() );
@@ -455,6 +469,41 @@ export class SVGPathBuilder
455
469
  }
456
470
  }
457
471
 
472
+
473
+ /**
474
+ *
475
+ */
476
+
477
+ export class SVGPathBuilder extends SVGGroup
478
+ {
479
+ private static g_clip_id = 1;
480
+
481
+ constructor( ) {
482
+ super( '' );
483
+ }
484
+
485
+ addClip( x: number, y: number, w: number, h: number ) {
486
+
487
+ const id = 'c-'+SVGPathBuilder.g_clip_id++;
488
+ const clip = new SVGGroup( 'clipPath' );
489
+ clip.attr('id', id );
490
+ clip.rect( x, y, w, h );
491
+
492
+ this.m_items.push(clip);
493
+ return id;
494
+ }
495
+
496
+ render() {
497
+
498
+ let result = [];
499
+ this.m_items.forEach(i => {
500
+ result.push(i.render());
501
+ });
502
+
503
+ return result.join('\n');
504
+ }
505
+ }
506
+
458
507
  /**
459
508
  *
460
509
  */
package/src/textedit.ts CHANGED
@@ -87,13 +87,13 @@ export interface TextEditProps extends InputProps<TextEditEventMap> {
87
87
  * TextEdit is a single line editor, it can have a label and an error descriptor.
88
88
  */
89
89
 
90
- export class TextEdit<T extends TextEditProps = TextEditProps> extends Component<TextEditProps, TextEditEventMap> {
90
+ export class TextEdit<T extends TextEditProps = TextEditProps, E extends TextEditEventMap = TextEditEventMap > extends Component<T, E> {
91
91
 
92
92
  private m_cal_popup: PopupCalendar;
93
93
  protected m_ui_input: Input;
94
94
  private m_error_tip: Tooltip;
95
95
 
96
- constructor(props: TextEditProps) {
96
+ constructor(props: T) {
97
97
  super(props);
98
98
  this.addClass( '@hlayout' );
99
99
  this.mapPropEvents( props, 'change', 'click', 'focus' );
@@ -410,7 +410,7 @@ export class TextEdit<T extends TextEditProps = TextEditProps> extends Component
410
410
  return this._validate(this.value);
411
411
  }
412
412
 
413
- private _validate(value: string): boolean {
413
+ protected _validate(value: string): boolean {
414
414
  let props = this.m_props;
415
415
  let update = false;
416
416
 
package/src/tools.ts CHANGED
@@ -496,7 +496,7 @@ export function date_clone(date: Date): Date {
496
496
  export function date_calc_weeknum(date: Date): number {
497
497
  const firstDayOfYear = new Date(date.getFullYear(), 0, 1);
498
498
  const pastDaysOfYear = (date.valueOf() - firstDayOfYear.valueOf()) / 86400000;
499
- return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);
499
+ return Math.floor((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);
500
500
  }
501
501
 
502
502
 
package/src/treeview.ts CHANGED
@@ -289,12 +289,14 @@ export class TreeView extends VLayout<TreeViewProps, TreeViewEventMap> {
289
289
  }
290
290
 
291
291
  let icon: IconID = node.icon;
292
- if (icon === undefined) {
292
+ if (icon === undefined ) {
293
293
  if (node.children) {
294
- icon = 'cls(far fa-chevron-down)';
295
- }
296
- else {
297
- icon = 'cls(far fa-file-archive)';
294
+ if( node.open===true ) {
295
+ icon = 'var(--x4-icon-folder-opened)';
296
+ }
297
+ else {
298
+ icon = 'var(--x4-icon-folder-closed)';
299
+ }
298
300
  }
299
301
  }
300
302
 
package/src/version.ts ADDED
@@ -0,0 +1 @@
1
+ export const x4js_version = "1.4";
package/src/x4.less CHANGED
@@ -61,8 +61,8 @@
61
61
  // todo: svg
62
62
  --x4-icon-font-family: "fonteawesome";
63
63
 
64
+ // icons are from Font Awesome by @fontawesome - https://fontawesome.com
64
65
  --x4-icon-circle-exclamation: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM232 152C232 138.8 242.8 128 256 128s24 10.75 24 24v128c0 13.25-10.75 24-24 24S232 293.3 232 280V152zM256 400c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 385.9 273.4 400 256 400z"/></svg>';
65
- --x4-icon-chevron-right: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z"/></svg>';
66
66
  --x4-icon-window-restore: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M432 64H208C199.2 64 192 71.16 192 80V96H128V80C128 35.82 163.8 0 208 0H432C476.2 0 512 35.82 512 80V304C512 348.2 476.2 384 432 384H416V320H432C440.8 320 448 312.8 448 304V80C448 71.16 440.8 64 432 64zM0 192C0 156.7 28.65 128 64 128H320C355.3 128 384 156.7 384 192V448C384 483.3 355.3 512 320 512H64C28.65 512 0 483.3 0 448V192zM96 256H288C305.7 256 320 241.7 320 224C320 206.3 305.7 192 288 192H96C78.33 192 64 206.3 64 224C64 241.7 78.33 256 96 256z"/></svg>';
67
67
  --x4-icon-arrow-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M9.375 329.4c12.51-12.51 32.76-12.49 45.25 0L128 402.8V32c0-17.69 14.31-32 32-32s32 14.31 32 32v370.8l73.38-73.38c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-128 128c-12.5 12.5-32.75 12.5-45.25 0l-128-128C-3.125 362.1-3.125 341.9 9.375 329.4z"/></svg>';
68
68
  --x4-icon-arrow-up: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M310.6 182.6c-12.51 12.51-32.76 12.49-45.25 0L192 109.3V480c0 17.69-14.31 32-32 32s-32-14.31-32-32V109.3L54.63 182.6c-12.5 12.5-32.75 12.5-45.25 0s-12.5-32.75 0-45.25l128-128c12.5-12.5 32.75-12.5 45.25 0l128 128C323.1 149.9 323.1 170.1 310.6 182.6z"/></svg>';
@@ -76,6 +76,12 @@
76
76
  --x4-icon-calendar-days: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z"/></svg>';
77
77
  --x4-icon-tip: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM296 336h-16V248C280 234.8 269.3 224 256 224H224C210.8 224 200 234.8 200 248S210.8 272 224 272h8v64h-16C202.8 336 192 346.8 192 360S202.8 384 216 384h80c13.25 0 24-10.75 24-24S309.3 336 296 336zM256 192c17.67 0 32-14.33 32-32c0-17.67-14.33-32-32-32S224 142.3 224 160C224 177.7 238.3 192 256 192z"/></svg>';
78
78
  --x4-icon-check: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M440.1 103C450.3 112.4 450.3 127.6 440.1 136.1L176.1 400.1C167.6 410.3 152.4 410.3 143 400.1L7.029 264.1C-2.343 255.6-2.343 240.4 7.029 231C16.4 221.7 31.6 221.7 40.97 231L160 350.1L407 103C416.4 93.66 431.6 93.66 440.1 103V103z"/></svg>';
79
+ --x4-icon-folder-closed: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M448 96h-172.1L226.7 50.75C214.7 38.74 198.5 32 181.5 32H64C28.65 32 0 60.66 0 96v320c0 35.34 28.65 64 64 64h384c35.35 0 64-28.66 64-64V160C512 124.7 483.3 96 448 96zM64 80h117.5c4.273 0 8.293 1.664 11.31 4.688L256 144h192c8.822 0 16 7.176 16 16v32h-416V96C48 87.18 55.18 80 64 80zM448 432H64c-8.822 0-16-7.176-16-16V240h416V416C464 424.8 456.8 432 448 432z"/></svg>';
80
+ --x4-icon-folder-opened: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><!--! Font Awesome Pro 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M572.6 270.3l-96 192C471.2 473.2 460.1 480 447.1 480H64c-35.35 0-64-28.66-64-64V96c0-35.34 28.65-64 64-64h117.5c16.97 0 33.25 6.742 45.26 18.75L275.9 96H416c35.35 0 64 28.66 64 64v32h-48V160c0-8.824-7.178-16-16-16H256L192.8 84.69C189.8 81.66 185.8 80 181.5 80H64C55.18 80 48 87.18 48 96v288l71.16-142.3C124.6 230.8 135.7 224 147.8 224h396.2C567.7 224 583.2 249 572.6 270.3z"/></svg>';
81
+ --x4-icon-chevron-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><!--! Font Awesome Pro 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M432.6 209.3l-191.1 183.1C235.1 397.8 229.1 400 224 400s-11.97-2.219-16.59-6.688L15.41 209.3C5.814 200.2 5.502 184.1 14.69 175.4c9.125-9.625 24.38-9.938 33.91-.7187L224 342.8l175.4-168c9.5-9.219 24.78-8.906 33.91 .7187C442.5 184.1 442.2 200.2 432.6 209.3z"/></svg>';
82
+ --x4-icon-chevron-right: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z"/></svg>';
83
+ --x4-icon-chevron-left: 'data:image/svg+xml;<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M206.7 464.6l-183.1-191.1C18.22 267.1 16 261.1 16 256s2.219-11.97 6.688-16.59l183.1-191.1c9.152-9.594 24.34-9.906 33.9-.7187c9.625 9.125 9.938 24.37 .7187 33.91L73.24 256l168 175.4c9.219 9.5 8.906 24.78-.7187 33.91C231 474.5 215.8 474.2 206.7 464.6z"/></svg>';
84
+ --x4-icon-chevron-up: 'data:image/svg+xml;<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M15.41 302.7l191.1-183.1C212 114.2 218 111.1 224 111.1s11.97 2.219 16.59 6.688l191.1 183.1c9.594 9.152 9.906 24.34 .7187 33.9c-9.125 9.625-24.38 9.938-33.91 .7187L224 169.2l-175.4 168c-9.5 9.219-24.78 8.906-33.91-.7187C5.502 327 5.814 311.8 15.41 302.7z"/></svg>';
79
85
  }
80
86
 
81
87
  @BLACK10: rgba(0,0,0,0.1);
@@ -526,7 +532,7 @@ textarea {
526
532
  display: flex;
527
533
  align-items: center;
528
534
  //width: 100%;
529
- width: min-content;
535
+ min-width: min-content;
530
536
  min-height: 32px;
531
537
  padding: 0;
532
538
 
@@ -2031,29 +2037,28 @@ textarea {
2031
2037
  padding: 0 4px;
2032
2038
  }
2033
2039
 
2034
- //&::before {
2035
- // content: attr( icon );
2036
- // font-family: var( --x4-icon-font-family );
2037
- // display: inline-block;
2038
- // width: 1em;
2039
- // color: @BLACK40;
2040
- // pointer-events: none;
2041
- //}
2042
-
2043
2040
  .tree-icon {
2044
2041
  width: 2em;
2042
+ color:#999;
2043
+ height: 0.8em;
2045
2044
  }
2046
2045
 
2047
- &.collapsed .tree-icon {
2048
- transform: rotate(-90deg);
2046
+ &.selected {
2047
+ background-color: var( --x4-selection-color );
2048
+ color: var( --x4-selection-text );
2049
+
2050
+ .tree-icon {
2051
+ color: var( --x4-selection-text );
2052
+ }
2049
2053
  }
2050
2054
 
2051
2055
  &:hover {
2052
- background-color: rgba(255,255,255,0.1);
2053
- }
2056
+ background-color: var( --x4-hover-color );
2057
+ color: var( --x4-hover-text );
2054
2058
 
2055
- &.selected {
2056
- background-color: rgba(255,255,255,0.3);
2059
+ .tree-icon {
2060
+ color: var( --x4-hover-text );
2061
+ }
2057
2062
  }
2058
2063
 
2059
2064
  .indent {