pict-section-recordset 1.0.40 → 1.0.41

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-recordset",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "Pict dynamic record set management views",
5
5
  "main": "source/Pict-Section-RecordSet.js",
6
6
  "directories": {
@@ -481,130 +481,12 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
481
481
  }
482
482
  this.initializeEntitySchema(() =>
483
483
  {
484
- const tmpSchema = this._Schema;
485
- if (!tmpSchema || !tmpSchema.properties)
484
+ if (pError)
486
485
  {
487
486
  return fCallback(pError);
488
487
  }
489
- const tmpProperties = tmpSchema?.properties;
490
- // loop through the schema and add the columns to the tableCells
491
- let tmpOrdinal = 0;
492
- for (const tmpSchemaField in tmpProperties)
493
- {
494
- if (this.ignoreFilterFields.includes(tmpSchemaField))
495
- {
496
- continue;
497
- }
498
- ++tmpOrdinal;
499
- const tmpColumn = tmpProperties[tmpSchemaField];
500
- let tmpFieldFilterSchema = this._FilterSchema[tmpSchemaField];
501
- if (!tmpFieldFilterSchema)
502
- {
503
- this._FilterSchema[tmpSchemaField] = tmpFieldFilterSchema = { };
504
- }
505
- if (!tmpFieldFilterSchema.FilterKey)
506
- {
507
- tmpFieldFilterSchema.FilterKey = tmpSchemaField;
508
- }
509
- if (!tmpFieldFilterSchema.RecordSet)
510
- {
511
- tmpFieldFilterSchema.RecordSet = this.options.RecordSet;
512
- }
513
- if (!tmpFieldFilterSchema.DisplayName)
514
- {
515
- tmpFieldFilterSchema.DisplayName = this._getHumanReadableFieldName(tmpSchemaField);
516
- }
517
- if (!tmpFieldFilterSchema.Description)
518
- {
519
- tmpFieldFilterSchema.Description = `Filter by ${tmpFieldFilterSchema.DisplayName}`;
520
- }
521
- if (!tmpFieldFilterSchema.HelpText)
522
- {
523
- tmpFieldFilterSchema.HelpText = `Filter by ${tmpFieldFilterSchema.DisplayName} for the ${this._getHumanReadbleEntityName(this.options.Entity)} entity.`;
524
- }
525
- if (tmpFieldFilterSchema.Ordinal == null)
526
- {
527
- tmpFieldFilterSchema.Ordinal = tmpOrdinal;
528
- }
529
- if (!Array.isArray(tmpFieldFilterSchema.AvailableClauses))
530
- {
531
- tmpFieldFilterSchema.AvailableClauses = [];
532
- }
533
- const tmpFieldFilterClauses = this.getFieldFilterClauses(tmpSchemaField, tmpColumn);
534
- if (Array.isArray(tmpFieldFilterClauses) && tmpFieldFilterClauses.length > 0)
535
- {
536
- for (const tmpFilterClause of tmpFieldFilterClauses)
537
- {
538
- //TODO: allow customization of filter order
539
- tmpFilterClause.Ordinal = tmpFieldFilterSchema.AvailableClauses.length + 1;
540
- tmpFieldFilterSchema.AvailableClauses.push(tmpFilterClause);
541
- }
542
- }
543
- }
544
- if (typeof this.pict.providers.FilterManager.filters === 'object')
545
- {
546
- for (const tmpFilterKey of Object.keys(this.pict.providers.FilterManager.filters))
547
- {
548
- const tmpFilterClause = this.pict.providers.FilterManager.filters[tmpFilterKey];
549
- if (tmpFilterClause.CoreConnectionColumn === `ID${this.options.Entity}`)
550
- {
551
- //FIXME: I don't think using filter key is right here
552
- let tmpFieldFilterSchema = this._FilterSchema[tmpFilterKey];
553
- if (!tmpFieldFilterSchema)
554
- {
555
- this._FilterSchema[tmpFilterKey] = tmpFieldFilterSchema = { };
556
- }
557
- if (!tmpFieldFilterSchema.FilterKey)
558
- {
559
- tmpFieldFilterSchema.FilterKey = tmpFilterKey;
560
- }
561
- if (!tmpFieldFilterSchema.RecordSet)
562
- {
563
- tmpFieldFilterSchema.RecordSet = this.options.RecordSet;
564
- }
565
- const tmpFieldHumanName = this._getHumanReadableFieldName(tmpFilterKey);
566
- if (tmpFilterClause.DisplayName)
567
- {
568
- tmpFieldFilterSchema.DisplayName = tmpFilterClause.DisplayName;
569
- }
570
- if (!tmpFieldFilterSchema.DisplayName)
571
- {
572
- tmpFieldFilterSchema.DisplayName = tmpFieldHumanName;
573
- }
574
- if (!tmpFieldFilterSchema.Description)
575
- {
576
- tmpFieldFilterSchema.Description = tmpFilterClause.Description || `Filter by ${tmpFieldFilterSchema.DisplayName}`;
577
- }
578
- if (!tmpFieldFilterSchema.HelpText)
579
- {
580
- tmpFieldFilterSchema.HelpText = tmpFilterClause.HelpText || `Filter by ${tmpFieldFilterSchema.DisplayName} for the ${this._getHumanReadbleEntityName(this.options.Entity)} entity.`;
581
- }
582
- if (tmpFieldFilterSchema.Ordinal == null)
583
- {
584
- tmpFieldFilterSchema.Ordinal = tmpOrdinal;
585
- }
586
- if (!Array.isArray(tmpFieldFilterSchema.AvailableClauses))
587
- {
588
- tmpFieldFilterSchema.AvailableClauses = [];
589
- }
590
- tmpFieldFilterSchema.AvailableClauses.push(tmpFilterClause);
591
- if (!tmpFilterClause.FilterKey)
592
- {
593
- tmpFilterClause.FilterKey = tmpFilterKey;
594
- }
595
- if (!tmpFilterClause.ClauseKey)
596
- {
597
- tmpFilterClause.ClauseKey = tmpFilterKey;
598
- }
599
- if (!tmpFilterClause.DisplayName)
600
- {
601
- tmpFilterClause.DisplayName = tmpFieldHumanName;
602
- }
603
- tmpFilterClause.Ordinal = tmpFieldFilterSchema.AvailableClauses.length + 1;
604
- }
605
- }
606
- }
607
- return fCallback(pError);
488
+ this.initializeFilterSchema();
489
+ return fCallback();
608
490
  });
609
491
  });
610
492
  }
@@ -687,6 +569,133 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
687
569
  });
688
570
  }
689
571
 
572
+ initializeFilterSchema()
573
+ {
574
+ const tmpSchema = this._Schema;
575
+ if (!tmpSchema || !tmpSchema.properties)
576
+ {
577
+ return;
578
+ }
579
+ const tmpProperties = tmpSchema?.properties;
580
+ // loop through the schema and add the columns to the tableCells
581
+ let tmpOrdinal = 0;
582
+ for (const tmpSchemaField in tmpProperties)
583
+ {
584
+ if (this.ignoreFilterFields.includes(tmpSchemaField))
585
+ {
586
+ continue;
587
+ }
588
+ ++tmpOrdinal;
589
+ const tmpColumn = tmpProperties[tmpSchemaField];
590
+ let tmpFieldFilterSchema = this._FilterSchema[tmpSchemaField];
591
+ if (!tmpFieldFilterSchema)
592
+ {
593
+ this._FilterSchema[tmpSchemaField] = tmpFieldFilterSchema = { };
594
+ }
595
+ if (!tmpFieldFilterSchema.FilterKey)
596
+ {
597
+ tmpFieldFilterSchema.FilterKey = tmpSchemaField;
598
+ }
599
+ if (!tmpFieldFilterSchema.RecordSet)
600
+ {
601
+ tmpFieldFilterSchema.RecordSet = this.options.RecordSet;
602
+ }
603
+ if (!tmpFieldFilterSchema.DisplayName)
604
+ {
605
+ tmpFieldFilterSchema.DisplayName = this._getHumanReadableFieldName(tmpSchemaField);
606
+ }
607
+ if (!tmpFieldFilterSchema.Description)
608
+ {
609
+ tmpFieldFilterSchema.Description = `Filter by ${tmpFieldFilterSchema.DisplayName}`;
610
+ }
611
+ if (!tmpFieldFilterSchema.HelpText)
612
+ {
613
+ tmpFieldFilterSchema.HelpText = `Filter by ${tmpFieldFilterSchema.DisplayName} for the ${this._getHumanReadbleEntityName(this.options.Entity)} entity.`;
614
+ }
615
+ if (tmpFieldFilterSchema.Ordinal == null)
616
+ {
617
+ tmpFieldFilterSchema.Ordinal = tmpOrdinal;
618
+ }
619
+ if (!Array.isArray(tmpFieldFilterSchema.AvailableClauses))
620
+ {
621
+ tmpFieldFilterSchema.AvailableClauses = [];
622
+ }
623
+ const tmpFieldFilterClauses = this.getFieldFilterClauses(tmpSchemaField, tmpColumn);
624
+ if (Array.isArray(tmpFieldFilterClauses) && tmpFieldFilterClauses.length > 0)
625
+ {
626
+ for (const tmpFilterClause of tmpFieldFilterClauses)
627
+ {
628
+ //TODO: allow customization of filter order
629
+ tmpFilterClause.Ordinal = tmpFieldFilterSchema.AvailableClauses.length + 1;
630
+ tmpFieldFilterSchema.AvailableClauses.push(tmpFilterClause);
631
+ }
632
+ }
633
+ }
634
+ if (typeof this.pict.providers.FilterManager.filters === 'object')
635
+ {
636
+ for (const tmpFilterKey of Object.keys(this.pict.providers.FilterManager.filters))
637
+ {
638
+ const tmpFilterClause = this.pict.providers.FilterManager.filters[tmpFilterKey];
639
+ if (tmpFilterClause.CoreConnectionColumn === `ID${this.options.Entity}`)
640
+ {
641
+ //FIXME: I don't think using filter key is right here
642
+ let tmpFieldFilterSchema = this._FilterSchema[tmpFilterKey];
643
+ if (!tmpFieldFilterSchema)
644
+ {
645
+ this._FilterSchema[tmpFilterKey] = tmpFieldFilterSchema = { };
646
+ }
647
+ if (!tmpFieldFilterSchema.FilterKey)
648
+ {
649
+ tmpFieldFilterSchema.FilterKey = tmpFilterKey;
650
+ }
651
+ if (!tmpFieldFilterSchema.RecordSet)
652
+ {
653
+ tmpFieldFilterSchema.RecordSet = this.options.RecordSet;
654
+ }
655
+ const tmpFieldHumanName = this._getHumanReadableFieldName(tmpFilterKey);
656
+ if (tmpFilterClause.DisplayName)
657
+ {
658
+ tmpFieldFilterSchema.DisplayName = tmpFilterClause.DisplayName;
659
+ }
660
+ if (!tmpFieldFilterSchema.DisplayName)
661
+ {
662
+ tmpFieldFilterSchema.DisplayName = tmpFieldHumanName;
663
+ }
664
+ if (!tmpFieldFilterSchema.Description)
665
+ {
666
+ tmpFieldFilterSchema.Description = tmpFilterClause.Description || `Filter by ${tmpFieldFilterSchema.DisplayName}`;
667
+ }
668
+ if (!tmpFieldFilterSchema.HelpText)
669
+ {
670
+ tmpFieldFilterSchema.HelpText = tmpFilterClause.HelpText || `Filter by ${tmpFieldFilterSchema.DisplayName} for the ${this._getHumanReadbleEntityName(this.options.Entity)} entity.`;
671
+ }
672
+ if (tmpFieldFilterSchema.Ordinal == null)
673
+ {
674
+ tmpFieldFilterSchema.Ordinal = tmpOrdinal;
675
+ }
676
+ if (!Array.isArray(tmpFieldFilterSchema.AvailableClauses))
677
+ {
678
+ tmpFieldFilterSchema.AvailableClauses = [];
679
+ }
680
+ tmpFieldFilterSchema.AvailableClauses.push(tmpFilterClause);
681
+ if (!tmpFilterClause.FilterKey)
682
+ {
683
+ tmpFilterClause.FilterKey = tmpFilterKey;
684
+ }
685
+ if (!tmpFilterClause.ClauseKey)
686
+ {
687
+ tmpFilterClause.ClauseKey = tmpFilterKey;
688
+ }
689
+ if (!tmpFilterClause.DisplayName)
690
+ {
691
+ tmpFilterClause.DisplayName = tmpFieldHumanName;
692
+ }
693
+ tmpFilterClause.Ordinal = tmpFieldFilterSchema.AvailableClauses.length + 1;
694
+ }
695
+ }
696
+ }
697
+ }
698
+
690
699
  /**
691
700
  * @return {Promise<Record<string, any>>} The schema of the record.
692
701
  */
@@ -700,6 +709,7 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
700
709
  {
701
710
  return reject(pError);
702
711
  }
712
+ this.initializeFilterSchema();
703
713
  resolve();
704
714
  }));
705
715
  }
@@ -146,6 +146,7 @@ declare class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
146
146
  * @param {(error?: Error) => void} fCallback - The callback function.
147
147
  */
148
148
  initializeEntitySchema(fCallback: (error?: Error) => void): void;
149
+ initializeFilterSchema(): void;
149
150
  }
150
151
  declare namespace MeadowEndpointsRecordSetProvider {
151
152
  export { RecordSetFilter, RecordSetResult };
@@ -1 +1 @@
1
- {"version":3,"file":"RecordSet-RecordProvider-MeadowEndpoints.d.ts","sourceRoot":"","sources":["../../source/providers/RecordSet-RecordProvider-MeadowEndpoints.js"],"names":[],"mappings":";AAGA;;;GAGG;AAEH;;;GAGG;AACH;IAcE;;;;;;;;;aASS;IACT,MAVW,OAAO,MAAM,CAAC,GAAG;QACpB,GAAG,EAAE,GAAG,CAAC;QACT,QAAQ,EACf;YACI,oBAAoB,EAAE,YAAY,CAAC;;;;;;aAAsC,CAAC,CAAC;YAC/E,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;SACnB,CAAC;QACE,6CAA6C,EAAE,CAAC,IAAI,QAAQ,KAAK,GAAG,CAAC;QACrE,oB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AGG;IACH,oCAHW,MAAM,WACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,OAiC7B;IAED;;OAEG;IACH,6BAFW,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,QA+MjC;IAED;;;OAGG;IACH,oCAHW,MAAM,GACL,MAAM,CAKjB;IAED;;;OAGG;IACH,yCAHW,MAAM,GACL,MAAM,CAiCjB;IAED;;OAEG;IACH,kCAFW,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,QA6BjC;CAyDD;;;;;uBApuBY,OAAO,oCAAoC,EAAE,eAAe;uBAC5D,OAAO,oCAAoC,EAAE,eAAe"}
1
+ {"version":3,"file":"RecordSet-RecordProvider-MeadowEndpoints.d.ts","sourceRoot":"","sources":["../../source/providers/RecordSet-RecordProvider-MeadowEndpoints.js"],"names":[],"mappings":";AAGA;;;GAGG;AAEH;;;GAGG;AACH;IAcE;;;;;;;;;aASS;IACT,MAVW,OAAO,MAAM,CAAC,GAAG;QACpB,GAAG,EAAE,GAAG,CAAC;QACT,QAAQ,EACf;YACI,oBAAoB,EAAE,YAAY,CAAC;;;;;;aAAsC,CAAC,CAAC;YAC/E,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;SACnB,CAAC;QACE,6CAA6C,EAAE,CAAC,IAAI,QAAQ,KAAK,GAAG,CAAC;QACrE,oBAAoB,EAAE,YAAY,CAAC;;;;;;SAAsC,CAAC,CAAA;KAC7E,CACI;IACT;aAVa,GAAG;kBAEf;YACI,oBAAoB,EAAE,YAAY,CAAC;;;;;;aAAsC,CAAC,CAAC;YAC/E,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;SACnB;uDACkD,CAAC,IAAI,QAAQ,KAAK,GAAG;8BAC9C,YAAY,CAAC;;;;;;SAAsC,CAAC;MAG5D;IAMtB,kCAAkC;IAClC,SADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAClB;IACZ,kDAAkD;IAClD,cADW,MAAM,CAAC,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