x4js 1.5.14 → 1.5.15

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/cjs/form.js CHANGED
@@ -271,7 +271,8 @@ class Form extends layout_1.VLayout {
271
271
  return (0, request_1.ajaxRequest)(cfg);
272
272
  }
273
273
  /**
274
- *
274
+ * to be abble to see the dirty flag, you need to call this method
275
+ * cf. isDirty, setDirty
275
276
  */
276
277
  watchChanges() {
277
278
  if (this.dom) {
@@ -287,9 +288,15 @@ class Form extends layout_1.VLayout {
287
288
  this.m_watchChanges = true;
288
289
  }
289
290
  }
291
+ /**
292
+ * cf. watchChanges
293
+ */
290
294
  setDirty(set = true) {
291
295
  this.m_dirty = set;
292
296
  }
297
+ /**
298
+ * cf. watchChanges
299
+ */
293
300
  isDirty() {
294
301
  return this.m_dirty;
295
302
  }
@@ -99,8 +99,14 @@ class Spreadsheet extends layout_1.VLayout {
99
99
  this.m_columns[col].title = title;
100
100
  this.update(10);
101
101
  }
102
+ /**
103
+ * reset the spreadsheet
104
+ * @param columns
105
+ */
102
106
  reset(columns) {
103
- this.m_columns = columns;
107
+ if (columns) {
108
+ this.m_columns = columns;
109
+ }
104
110
  this.m_cells_data = new Map();
105
111
  this.m_rows_data = new Map();
106
112
  this.update(10);
@@ -312,9 +312,6 @@ class SVGShape extends SVGItem {
312
312
  super(tag);
313
313
  }
314
314
  }
315
- /**
316
- *
317
- */
318
315
  class SVGGradient extends SVGItem {
319
316
  constructor(x1, y1, x2, y2) {
320
317
  super('linearGradient');
@@ -379,7 +376,20 @@ class SVGGroup extends SVGItem {
379
376
  this.m_items.push(shape);
380
377
  return shape;
381
378
  }
382
- gradient(x1, y1, x2, y2) {
379
+ /**
380
+ *
381
+ * example
382
+ * ```ts
383
+ * const g = c.linear_gradient( '0%', '0%', '0%', '100%' )
384
+ * .addStop( 0, 'red' )
385
+ * .addStop( 100, 'green' );
386
+ *
387
+ * p.rect( 0, 0, 100, 100 )
388
+ * .stroke( g.id );
389
+ *
390
+ * ```
391
+ */
392
+ linear_gradient(x1, y1, x2, y2) {
383
393
  const grad = new SVGGradient(x1, y1, x2, y2);
384
394
  this.m_items.push(grad);
385
395
  return grad;
@@ -29,4 +29,4 @@
29
29
  **/
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
31
  exports.x4js_version = void 0;
32
- exports.x4js_version = "1.5.14";
32
+ exports.x4js_version = "1.5.15";
package/lib/esm/form.js CHANGED
@@ -272,7 +272,8 @@ export class Form extends VLayout {
272
272
  return ajaxRequest(cfg);
273
273
  }
274
274
  /**
275
- *
275
+ * to be abble to see the dirty flag, you need to call this method
276
+ * cf. isDirty, setDirty
276
277
  */
277
278
  watchChanges() {
278
279
  if (this.dom) {
@@ -288,9 +289,15 @@ export class Form extends VLayout {
288
289
  this.m_watchChanges = true;
289
290
  }
290
291
  }
292
+ /**
293
+ * cf. watchChanges
294
+ */
291
295
  setDirty(set = true) {
292
296
  this.m_dirty = set;
293
297
  }
298
+ /**
299
+ * cf. watchChanges
300
+ */
294
301
  isDirty() {
295
302
  return this.m_dirty;
296
303
  }
@@ -116,8 +116,14 @@ export class Spreadsheet extends VLayout {
116
116
  this.m_columns[col].title = title;
117
117
  this.update(10);
118
118
  }
119
+ /**
120
+ * reset the spreadsheet
121
+ * @param columns
122
+ */
119
123
  reset(columns) {
120
- this.m_columns = columns;
124
+ if (columns) {
125
+ this.m_columns = columns;
126
+ }
121
127
  this.m_cells_data = new Map();
122
128
  this.m_rows_data = new Map();
123
129
  this.update(10);
@@ -314,9 +314,6 @@ class SVGShape extends SVGItem {
314
314
  super(tag);
315
315
  }
316
316
  }
317
- /**
318
- *
319
- */
320
317
  class SVGGradient extends SVGItem {
321
318
  static g_id = 1;
322
319
  m_id;
@@ -384,7 +381,20 @@ class SVGGroup extends SVGItem {
384
381
  this.m_items.push(shape);
385
382
  return shape;
386
383
  }
387
- gradient(x1, y1, x2, y2) {
384
+ /**
385
+ *
386
+ * example
387
+ * ```ts
388
+ * const g = c.linear_gradient( '0%', '0%', '0%', '100%' )
389
+ * .addStop( 0, 'red' )
390
+ * .addStop( 100, 'green' );
391
+ *
392
+ * p.rect( 0, 0, 100, 100 )
393
+ * .stroke( g.id );
394
+ *
395
+ * ```
396
+ */
397
+ linear_gradient(x1, y1, x2, y2) {
388
398
  const grad = new SVGGradient(x1, y1, x2, y2);
389
399
  this.m_items.push(grad);
390
400
  return grad;
@@ -26,4 +26,4 @@
26
26
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
- export const x4js_version = "1.5.14";
29
+ export const x4js_version = "1.5.15";
package/lib/src/form.ts CHANGED
@@ -337,7 +337,8 @@ export class Form<T extends FormProps = FormProps, E extends FormEventMap = Form
337
337
  }
338
338
 
339
339
  /**
340
- *
340
+ * to be abble to see the dirty flag, you need to call this method
341
+ * cf. isDirty, setDirty
341
342
  */
342
343
 
343
344
  watchChanges() {
@@ -356,10 +357,18 @@ export class Form<T extends FormProps = FormProps, E extends FormEventMap = Form
356
357
  }
357
358
  }
358
359
 
360
+ /**
361
+ * cf. watchChanges
362
+ */
363
+
359
364
  setDirty(set = true) {
360
365
  this.m_dirty = set;
361
366
  }
362
367
 
368
+ /**
369
+ * cf. watchChanges
370
+ */
371
+
363
372
  isDirty() {
364
373
  return this.m_dirty;
365
374
  }
@@ -192,8 +192,15 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
192
192
  this.update(10);
193
193
  }
194
194
 
195
- reset(columns: ColProp[]) {
196
- this.m_columns = columns;
195
+ /**
196
+ * reset the spreadsheet
197
+ * @param columns
198
+ */
199
+ reset(columns?: ColProp[]) {
200
+ if( columns ) {
201
+ this.m_columns = columns;
202
+ }
203
+
197
204
  this.m_cells_data = new Map<number, CellData>();
198
205
  this.m_rows_data = new Map<number, string>();
199
206
  this.update(10);
@@ -383,14 +383,16 @@ class SVGShape extends SVGItem {
383
383
  *
384
384
  */
385
385
 
386
+ type number_or_perc = number | `${string}%`
387
+
386
388
  class SVGGradient extends SVGItem {
387
389
 
388
390
  private static g_id = 1;
389
391
 
390
392
  private m_id: string;
391
- private m_stops: { offset: number, color: string } [];
393
+ private m_stops: { offset: number_or_perc, color: string } [];
392
394
 
393
- constructor( x1: number, y1: number, x2: number, y2: number ) {
395
+ constructor( x1: number_or_perc, y1: number_or_perc, x2: number_or_perc, y2: number_or_perc ) {
394
396
  super( 'linearGradient')
395
397
 
396
398
  this.m_id = 'gx-'+SVGGradient.g_id;
@@ -408,7 +410,7 @@ class SVGGradient extends SVGItem {
408
410
  return 'url(#'+this.m_id+')';
409
411
  }
410
412
 
411
- addStop( offset: number, color: string ): this {
413
+ addStop( offset: number_or_perc, color: string ): this {
412
414
  this.m_stops.push( {offset,color} );
413
415
  return this;
414
416
  }
@@ -469,7 +471,21 @@ class SVGGroup extends SVGItem {
469
471
  return shape;
470
472
  }
471
473
 
472
- gradient( x1, y1, x2, y2 ) {
474
+ /**
475
+ *
476
+ * example
477
+ * ```ts
478
+ * const g = c.linear_gradient( '0%', '0%', '0%', '100%' )
479
+ * .addStop( 0, 'red' )
480
+ * .addStop( 100, 'green' );
481
+ *
482
+ * p.rect( 0, 0, 100, 100 )
483
+ * .stroke( g.id );
484
+ *
485
+ * ```
486
+ */
487
+
488
+ linear_gradient( x1: number_or_perc, y1: number_or_perc, x2: number_or_perc, y2: number_or_perc ) {
473
489
  const grad = new SVGGradient( x1, y1, x2, y2 );
474
490
  this.m_items.push( grad );
475
491
  return grad;
@@ -27,4 +27,4 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- export const x4js_version = "1.5.14";
30
+ export const x4js_version = "1.5.15";
@@ -118,9 +118,16 @@ export declare class Form<T extends FormProps = FormProps, E extends FormEventMa
118
118
  */
119
119
  submit(cfg: RequestProps, cbvalidation: Function): false | Function;
120
120
  /**
121
- *
121
+ * to be abble to see the dirty flag, you need to call this method
122
+ * cf. isDirty, setDirty
122
123
  */
123
124
  watchChanges(): void;
125
+ /**
126
+ * cf. watchChanges
127
+ */
124
128
  setDirty(set?: boolean): void;
129
+ /**
130
+ * cf. watchChanges
131
+ */
125
132
  isDirty(): boolean;
126
133
  }
@@ -95,7 +95,11 @@ export declare class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEv
95
95
  setColWidth(col: number, width: number): void;
96
96
  getColWidth(col: number): number;
97
97
  setColTitle(col: number, title: string): void;
98
- reset(columns: ColProp[]): void;
98
+ /**
99
+ * reset the spreadsheet
100
+ * @param columns
101
+ */
102
+ reset(columns?: ColProp[]): void;
99
103
  /**
100
104
  * insert a row
101
105
  * @param before row number before wich insert the new row
@@ -153,13 +153,14 @@ declare class SVGShape extends SVGItem {
153
153
  /**
154
154
  *
155
155
  */
156
+ type number_or_perc = number | `${string}%`;
156
157
  declare class SVGGradient extends SVGItem {
157
158
  private static g_id;
158
159
  private m_id;
159
160
  private m_stops;
160
- constructor(x1: number, y1: number, x2: number, y2: number);
161
+ constructor(x1: number_or_perc, y1: number_or_perc, x2: number_or_perc, y2: number_or_perc);
161
162
  get id(): string;
162
- addStop(offset: number, color: string): this;
163
+ addStop(offset: number_or_perc, color: string): this;
163
164
  renderContent(): string;
164
165
  }
165
166
  /**
@@ -172,7 +173,20 @@ declare class SVGGroup extends SVGItem {
172
173
  text(x: any, y: any, txt: any): SVGText;
173
174
  ellipse(x: any, y: any, r1: any, r2?: any): SVGShape;
174
175
  rect(x: any, y: any, w: any, h: any): SVGShape;
175
- gradient(x1: any, y1: any, x2: any, y2: any): SVGGradient;
176
+ /**
177
+ *
178
+ * example
179
+ * ```ts
180
+ * const g = c.linear_gradient( '0%', '0%', '0%', '100%' )
181
+ * .addStop( 0, 'red' )
182
+ * .addStop( 100, 'green' );
183
+ *
184
+ * p.rect( 0, 0, 100, 100 )
185
+ * .stroke( g.id );
186
+ *
187
+ * ```
188
+ */
189
+ linear_gradient(x1: number_or_perc, y1: number_or_perc, x2: number_or_perc, y2: number_or_perc): SVGGradient;
176
190
  /**
177
191
  * clear
178
192
  */
@@ -26,4 +26,4 @@
26
26
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
- export declare const x4js_version = "1.5.14";
29
+ export declare const x4js_version = "1.5.15";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.5.14",
3
+ "version": "1.5.15",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",