@zeedhi/common 1.48.1 → 1.49.0

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.
@@ -1794,16 +1794,17 @@ class Input extends ComponentRender {
1794
1794
  set displayValue(value) {
1795
1795
  if (this.internalDisplayValue !== value) {
1796
1796
  this.internalValue = this.parser(value);
1797
+ this.value = this.internalValue; // forces value accessor to be called if necessary
1797
1798
  let { mask } = this;
1798
1799
  if (mask) {
1799
1800
  if (typeof mask === 'function') {
1800
1801
  mask = mask(this.internalValue);
1801
1802
  }
1802
- this.internalDisplayValue = Mask.convertAll(mask, value);
1803
+ this.internalDisplayValue = Mask.convertAll(mask, this.internalValue);
1803
1804
  this.internalValue = this.parser(this.internalDisplayValue);
1804
1805
  }
1805
1806
  else {
1806
- this.internalDisplayValue = value;
1807
+ this.internalDisplayValue = this.internalValue;
1807
1808
  }
1808
1809
  }
1809
1810
  }
@@ -3428,6 +3429,7 @@ class Date$1 extends TextInput {
3428
3429
  this.dateError = false;
3429
3430
  this.internalDisplayValue = newValue;
3430
3431
  this.internalValue = this.parser(newValue);
3432
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3431
3433
  }
3432
3434
  /**
3433
3435
  * Assign the updated mask to mask property
@@ -3467,6 +3469,7 @@ class Date$1 extends TextInput {
3467
3469
  }
3468
3470
  this.dateError = !!displayValue;
3469
3471
  }
3472
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3470
3473
  }
3471
3474
  isValidDate(value, format, strict = true) {
3472
3475
  return dayjs(value, format, strict).isValid();
@@ -3773,6 +3776,7 @@ class DateRange extends TextInput {
3773
3776
  this.internalValue = this.parser(newValue);
3774
3777
  else
3775
3778
  this.internalValue = [];
3779
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3776
3780
  }
3777
3781
  /**
3778
3782
  * Assign the updated mask to mask property
@@ -3813,6 +3817,7 @@ class DateRange extends TextInput {
3813
3817
  }
3814
3818
  this.dateError = !!displayValue;
3815
3819
  }
3820
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3816
3821
  }
3817
3822
  isValidDateArray(format, values) {
3818
3823
  if (!values || values.length === 0)
@@ -4412,14 +4417,17 @@ class Frame extends ComponentRender {
4412
4417
  this.local = false;
4413
4418
  this.metadata = {};
4414
4419
  this.override = {};
4420
+ this.params = {};
4415
4421
  this.overrideNamedProps = {};
4422
+ this.path = '';
4416
4423
  this.cache = false;
4417
4424
  this.cacheDuration = 2 * 60 * 60 * 1000;
4418
4425
  this.height = 'auto';
4419
4426
  this.maxHeight = 'none';
4420
4427
  this.minHeight = 'none';
4428
+ this.type = 'get';
4421
4429
  this.headerName = 'sw-fetched-on';
4422
- this.path = props.path;
4430
+ this.path = this.getInitValue('path', props.path, this.path);
4423
4431
  this.local = props.local === true;
4424
4432
  this.override = props.override || this.override;
4425
4433
  this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
@@ -4428,6 +4436,8 @@ class Frame extends ComponentRender {
4428
4436
  this.height = this.getInitValue('height', props.height, this.height);
4429
4437
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
4430
4438
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
4439
+ this.type = this.getInitValue('type', props.type, this.type);
4440
+ this.params = this.getInitValue('params', props.params, this.params);
4431
4441
  this.createAccessors();
4432
4442
  this.getMetadata();
4433
4443
  }
@@ -4468,6 +4478,9 @@ class Frame extends ComponentRender {
4468
4478
  requestPage() {
4469
4479
  return __awaiter(this, void 0, void 0, function* () {
4470
4480
  if (!this.cache) {
4481
+ if (this.type === 'post') {
4482
+ return Metadata.post(this.path, this.params);
4483
+ }
4471
4484
  return Metadata.get(this.path, this.local);
4472
4485
  }
4473
4486
  const url = Metadata.getMetadataUrl(this.path, this.local);
@@ -10768,8 +10781,11 @@ class Tree extends ComponentRender {
10768
10781
  return this.searchPath(this.nodes, path);
10769
10782
  }
10770
10783
  getParentNode(node) {
10771
- var _a;
10772
- return this.tree.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
10784
+ const hasParent = Array.isArray(node.path) && node.path.length > 1;
10785
+ if (node.path && hasParent) {
10786
+ return this.tree.getNode(node.path.slice(0, -1));
10787
+ }
10788
+ return undefined;
10773
10789
  }
10774
10790
  searchPath(nodes, path) {
10775
10791
  const currentNode = (path[0] > -1 && path[0] < nodes.length) ? nodes[path[0]] : undefined;
@@ -1801,16 +1801,17 @@
1801
1801
  set displayValue(value) {
1802
1802
  if (this.internalDisplayValue !== value) {
1803
1803
  this.internalValue = this.parser(value);
1804
+ this.value = this.internalValue; // forces value accessor to be called if necessary
1804
1805
  let { mask } = this;
1805
1806
  if (mask) {
1806
1807
  if (typeof mask === 'function') {
1807
1808
  mask = mask(this.internalValue);
1808
1809
  }
1809
- this.internalDisplayValue = core.Mask.convertAll(mask, value);
1810
+ this.internalDisplayValue = core.Mask.convertAll(mask, this.internalValue);
1810
1811
  this.internalValue = this.parser(this.internalDisplayValue);
1811
1812
  }
1812
1813
  else {
1813
- this.internalDisplayValue = value;
1814
+ this.internalDisplayValue = this.internalValue;
1814
1815
  }
1815
1816
  }
1816
1817
  }
@@ -3435,6 +3436,7 @@
3435
3436
  this.dateError = false;
3436
3437
  this.internalDisplayValue = newValue;
3437
3438
  this.internalValue = this.parser(newValue);
3439
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3438
3440
  }
3439
3441
  /**
3440
3442
  * Assign the updated mask to mask property
@@ -3474,6 +3476,7 @@
3474
3476
  }
3475
3477
  this.dateError = !!displayValue;
3476
3478
  }
3479
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3477
3480
  }
3478
3481
  isValidDate(value, format, strict = true) {
3479
3482
  return core.dayjs(value, format, strict).isValid();
@@ -3780,6 +3783,7 @@
3780
3783
  this.internalValue = this.parser(newValue);
3781
3784
  else
3782
3785
  this.internalValue = [];
3786
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3783
3787
  }
3784
3788
  /**
3785
3789
  * Assign the updated mask to mask property
@@ -3820,6 +3824,7 @@
3820
3824
  }
3821
3825
  this.dateError = !!displayValue;
3822
3826
  }
3827
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3823
3828
  }
3824
3829
  isValidDateArray(format, values) {
3825
3830
  if (!values || values.length === 0)
@@ -4419,14 +4424,17 @@
4419
4424
  this.local = false;
4420
4425
  this.metadata = {};
4421
4426
  this.override = {};
4427
+ this.params = {};
4422
4428
  this.overrideNamedProps = {};
4429
+ this.path = '';
4423
4430
  this.cache = false;
4424
4431
  this.cacheDuration = 2 * 60 * 60 * 1000;
4425
4432
  this.height = 'auto';
4426
4433
  this.maxHeight = 'none';
4427
4434
  this.minHeight = 'none';
4435
+ this.type = 'get';
4428
4436
  this.headerName = 'sw-fetched-on';
4429
- this.path = props.path;
4437
+ this.path = this.getInitValue('path', props.path, this.path);
4430
4438
  this.local = props.local === true;
4431
4439
  this.override = props.override || this.override;
4432
4440
  this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
@@ -4435,6 +4443,8 @@
4435
4443
  this.height = this.getInitValue('height', props.height, this.height);
4436
4444
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
4437
4445
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
4446
+ this.type = this.getInitValue('type', props.type, this.type);
4447
+ this.params = this.getInitValue('params', props.params, this.params);
4438
4448
  this.createAccessors();
4439
4449
  this.getMetadata();
4440
4450
  }
@@ -4475,6 +4485,9 @@
4475
4485
  requestPage() {
4476
4486
  return __awaiter(this, void 0, void 0, function* () {
4477
4487
  if (!this.cache) {
4488
+ if (this.type === 'post') {
4489
+ return core.Metadata.post(this.path, this.params);
4490
+ }
4478
4491
  return core.Metadata.get(this.path, this.local);
4479
4492
  }
4480
4493
  const url = core.Metadata.getMetadataUrl(this.path, this.local);
@@ -10775,8 +10788,11 @@
10775
10788
  return this.searchPath(this.nodes, path);
10776
10789
  }
10777
10790
  getParentNode(node) {
10778
- var _a;
10779
- return this.tree.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
10791
+ const hasParent = Array.isArray(node.path) && node.path.length > 1;
10792
+ if (node.path && hasParent) {
10793
+ return this.tree.getNode(node.path.slice(0, -1));
10794
+ }
10795
+ return undefined;
10780
10796
  }
10781
10797
  searchPath(nodes, path) {
10782
10798
  const currentNode = (path[0] > -1 && path[0] < nodes.length) ? nodes[path[0]] : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.48.1",
3
+ "version": "1.49.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -37,5 +37,5 @@
37
37
  "lodash.times": "^4.3.2",
38
38
  "mockdate": "^3.0.2"
39
39
  },
40
- "gitHead": "8ac65de099ea963d8d4142294dfed80025f5755d"
40
+ "gitHead": "c470a0a057bc8e1c5b97197258b551b9b158b744"
41
41
  }
@@ -8,6 +8,7 @@ export declare class Frame extends ComponentRender implements IFrame {
8
8
  local: boolean;
9
9
  metadata: Object;
10
10
  override: Object;
11
+ params: any;
11
12
  overrideNamedProps: any;
12
13
  path: string;
13
14
  cache: boolean;
@@ -16,6 +17,7 @@ export declare class Frame extends ComponentRender implements IFrame {
16
17
  height: number | string;
17
18
  maxHeight: number | string;
18
19
  minHeight: number | string;
20
+ type: string;
19
21
  private readonly headerName;
20
22
  private static readonly cacheName;
21
23
  /**
@@ -6,13 +6,15 @@ export interface IFrameEvents<T = IFrameEvent> extends IComponentEvents<T> {
6
6
  onAfterLoad?: IEvent<T> | string;
7
7
  }
8
8
  export interface IFrame extends IComponentRender {
9
- path: string;
9
+ path?: string;
10
10
  local?: boolean;
11
11
  override?: Object;
12
+ params?: any;
12
13
  overrideNamedProps?: any;
13
14
  cache?: boolean;
14
15
  cacheDuration?: number;
15
16
  height?: number | string;
16
17
  maxHeight?: number | string;
17
18
  minHeight?: number | string;
19
+ type?: string;
18
20
  }