@saltcorn/data 0.9.6-beta.8 → 0.9.6-beta.9

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.
@@ -520,6 +520,18 @@ export namespace int {
520
520
  export function run_23(nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}): any;
521
521
  export { run_23 as run };
522
522
  }
523
+ export { to_locale_string };
524
+ export namespace role_select {
525
+ const isEdit_24: boolean;
526
+ export { isEdit_24 as isEdit };
527
+ const blockDisplay_12: boolean;
528
+ export { blockDisplay_12 as blockDisplay };
529
+ const description_23: string;
530
+ export { description_23 as description };
531
+ export function fill_options(field: any): Promise<void>;
532
+ export function run_24(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
533
+ export { run_24 as run };
534
+ }
523
535
  }
524
536
  export { fieldviews_1 as fieldviews };
525
537
  const attributes_1: object[];
@@ -542,35 +554,35 @@ export namespace bool {
542
554
  export { contract_2 as contract };
543
555
  export namespace fieldviews_2 {
544
556
  export namespace show_1 {
545
- const isEdit_24: boolean;
546
- export { isEdit_24 as isEdit };
547
- const description_23: string;
548
- export { description_23 as description };
549
- export function run_24(v: any, req: any): any;
550
- export { run_24 as run };
551
- }
552
- export { show_1 as show };
553
- export namespace checkboxes {
554
557
  const isEdit_25: boolean;
555
558
  export { isEdit_25 as isEdit };
556
559
  const description_24: string;
557
560
  export { description_24 as description };
558
- export function run_25(v: any): any;
561
+ export function run_25(v: any, req: any): any;
559
562
  export { run_25 as run };
560
563
  }
561
- export namespace TrueFalse {
564
+ export { show_1 as show };
565
+ export namespace checkboxes {
562
566
  const isEdit_26: boolean;
563
567
  export { isEdit_26 as isEdit };
564
568
  const description_25: string;
565
569
  export { description_25 as description };
566
- export function run_26(v: any): "" | "True" | "False";
570
+ export function run_26(v: any): any;
567
571
  export { run_26 as run };
568
572
  }
569
- export namespace edit_2 {
573
+ export namespace TrueFalse {
570
574
  const isEdit_27: boolean;
571
575
  export { isEdit_27 as isEdit };
572
576
  const description_26: string;
573
577
  export { description_26 as description };
578
+ export function run_27(v: any): "" | "True" | "False";
579
+ export { run_27 as run };
580
+ }
581
+ export namespace edit_2 {
582
+ const isEdit_28: boolean;
583
+ export { isEdit_28 as isEdit };
584
+ const description_27: string;
585
+ export { description_27 as description };
574
586
  const configFields_17: ({
575
587
  name: string;
576
588
  label: string;
@@ -585,33 +597,33 @@ export namespace bool {
585
597
  attributes?: undefined;
586
598
  })[];
587
599
  export { configFields_17 as configFields };
588
- export function run_27(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
589
- export { run_27 as run };
590
- }
591
- export { edit_2 as edit };
592
- export namespace _switch {
593
- const isEdit_28: boolean;
594
- export { isEdit_28 as isEdit };
595
- const description_27: string;
596
- export { description_27 as description };
597
600
  export function run_28(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
598
601
  export { run_28 as run };
599
602
  }
600
- export { _switch as switch };
601
- export { show_with_html };
602
- export namespace tristate {
603
+ export { edit_2 as edit };
604
+ export namespace _switch {
603
605
  const isEdit_29: boolean;
604
606
  export { isEdit_29 as isEdit };
605
607
  const description_28: string;
606
608
  export { description_28 as description };
609
+ export function run_29(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
610
+ export { run_29 as run };
611
+ }
612
+ export { _switch as switch };
613
+ export { show_with_html };
614
+ export namespace tristate {
615
+ const isEdit_30: boolean;
616
+ export { isEdit_30 as isEdit };
617
+ const description_29: string;
618
+ export { description_29 as description };
607
619
  const configFields_18: {
608
620
  name: string;
609
621
  label: string;
610
622
  type: string;
611
623
  }[];
612
624
  export { configFields_18 as configFields };
613
- export function run_29(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
614
- export { run_29 as run };
625
+ export function run_30(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
626
+ export { run_30 as run };
615
627
  }
616
628
  }
617
629
  export { fieldviews_2 as fieldviews };
@@ -638,27 +650,27 @@ export namespace date {
638
650
  export { attributes_3 as attributes };
639
651
  export namespace fieldviews_3 {
640
652
  export namespace show_2 {
641
- const isEdit_30: boolean;
642
- export { isEdit_30 as isEdit };
643
- const description_29: string;
644
- export { description_29 as description };
645
- export function run_30(d: any, req: any, attrs?: {}): any;
646
- export { run_30 as run };
647
- }
648
- export { show_2 as show };
649
- export namespace showDay {
650
653
  const isEdit_31: boolean;
651
654
  export { isEdit_31 as isEdit };
652
655
  const description_30: string;
653
656
  export { description_30 as description };
654
- export function run_31(d: any, req: any): any;
657
+ export function run_31(d: any, req: any, attrs?: {}): any;
655
658
  export { run_31 as run };
656
659
  }
657
- export namespace format {
660
+ export { show_2 as show };
661
+ export namespace showDay {
658
662
  const isEdit_32: boolean;
659
663
  export { isEdit_32 as isEdit };
660
664
  const description_31: string;
661
665
  export { description_31 as description };
666
+ export function run_32(d: any, req: any): any;
667
+ export { run_32 as run };
668
+ }
669
+ export namespace format {
670
+ const isEdit_33: boolean;
671
+ export { isEdit_33 as isEdit };
672
+ const description_32: string;
673
+ export { description_32 as description };
662
674
  const configFields_19: {
663
675
  name: string;
664
676
  label: string;
@@ -666,18 +678,10 @@ export namespace date {
666
678
  sublabel: string;
667
679
  }[];
668
680
  export { configFields_19 as configFields };
669
- export function run_32(d: any, req: any, options: any): any;
670
- export { run_32 as run };
671
- }
672
- export namespace relative {
673
- const isEdit_33: boolean;
674
- export { isEdit_33 as isEdit };
675
- const description_32: string;
676
- export { description_32 as description };
677
- export function run_33(d: any, req: any): string;
681
+ export function run_33(d: any, req: any, options: any): any;
678
682
  export { run_33 as run };
679
683
  }
680
- export namespace yearsAgo {
684
+ export namespace relative {
681
685
  const isEdit_34: boolean;
682
686
  export { isEdit_34 as isEdit };
683
687
  const description_33: string;
@@ -685,19 +689,16 @@ export namespace date {
685
689
  export function run_34(d: any, req: any): string;
686
690
  export { run_34 as run };
687
691
  }
688
- export { show_with_html };
689
- export namespace edit_3 {
692
+ export namespace yearsAgo {
690
693
  const isEdit_35: boolean;
691
694
  export { isEdit_35 as isEdit };
692
- const blockDisplay_12: boolean;
693
- export { blockDisplay_12 as blockDisplay };
694
695
  const description_34: string;
695
696
  export { description_34 as description };
696
- export function run_35(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
697
+ export function run_35(d: any, req: any): string;
697
698
  export { run_35 as run };
698
699
  }
699
- export { edit_3 as edit };
700
- export namespace editDay {
700
+ export { show_with_html };
701
+ export namespace edit_3 {
701
702
  const isEdit_36: boolean;
702
703
  export { isEdit_36 as isEdit };
703
704
  const blockDisplay_13: boolean;
@@ -707,6 +708,17 @@ export namespace date {
707
708
  export function run_36(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
708
709
  export { run_36 as run };
709
710
  }
711
+ export { edit_3 as edit };
712
+ export namespace editDay {
713
+ const isEdit_37: boolean;
714
+ export { isEdit_37 as isEdit };
715
+ const blockDisplay_14: boolean;
716
+ export { blockDisplay_14 as blockDisplay };
717
+ const description_36: string;
718
+ export { description_36 as description };
719
+ export function run_37(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
720
+ export { run_37 as run };
721
+ }
710
722
  }
711
723
  export { fieldviews_3 as fieldviews };
712
724
  export namespace presets_1 {
@@ -741,29 +753,29 @@ export namespace float {
741
753
  export { distance_operators_1 as distance_operators };
742
754
  export namespace fieldviews_4 {
743
755
  export namespace show_3 {
744
- const isEdit_37: boolean;
745
- export { isEdit_37 as isEdit };
746
- const description_36: string;
747
- export { description_36 as description };
748
- export function run_37(s: any): string;
749
- export { run_37 as run };
750
- }
751
- export { show_3 as show };
752
- export namespace edit_4 {
753
756
  const isEdit_38: boolean;
754
757
  export { isEdit_38 as isEdit };
755
- const blockDisplay_14: boolean;
756
- export { blockDisplay_14 as blockDisplay };
757
758
  const description_37: string;
758
759
  export { description_37 as description };
760
+ export function run_38(s: any): string;
761
+ export { run_38 as run };
762
+ }
763
+ export { show_3 as show };
764
+ export namespace edit_4 {
765
+ const isEdit_39: boolean;
766
+ export { isEdit_39 as isEdit };
767
+ const blockDisplay_15: boolean;
768
+ export { blockDisplay_15 as blockDisplay };
769
+ const description_38: string;
770
+ export { description_38 as description };
759
771
  const configFields_20: {
760
772
  name: string;
761
773
  label: string;
762
774
  type: string;
763
775
  }[];
764
776
  export { configFields_20 as configFields };
765
- export function run_38(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
766
- export { run_38 as run };
777
+ export function run_39(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
778
+ export { run_39 as run };
767
779
  }
768
780
  export { edit_4 as edit };
769
781
  export namespace number_slider_1 { }
@@ -775,18 +787,19 @@ export namespace float {
775
787
  export namespace heat_cell_1 { }
776
788
  export { heat_cell_1 as heat_cell };
777
789
  export namespace above_input_1 {
778
- const isEdit_39: boolean;
779
- export { isEdit_39 as isEdit };
790
+ const isEdit_40: boolean;
791
+ export { isEdit_40 as isEdit };
780
792
  const isFilter_3: boolean;
781
793
  export { isFilter_3 as isFilter };
782
- const blockDisplay_15: boolean;
783
- export { blockDisplay_15 as blockDisplay };
784
- export function run_39(nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}): any;
785
- export { run_39 as run };
794
+ const blockDisplay_16: boolean;
795
+ export { blockDisplay_16 as blockDisplay };
796
+ export function run_40(nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}): any;
797
+ export { run_40 as run };
786
798
  }
787
799
  export { above_input_1 as above_input };
788
800
  export namespace below_input_1 { }
789
801
  export { below_input_1 as below_input };
802
+ export { to_locale_string };
790
803
  export { show_with_html };
791
804
  }
792
805
  export { fieldviews_4 as fieldviews };
@@ -808,25 +821,25 @@ export namespace color {
808
821
  export { contract_5 as contract };
809
822
  export namespace fieldviews_5 {
810
823
  export namespace show_4 {
811
- const isEdit_40: boolean;
812
- export { isEdit_40 as isEdit };
813
- const description_38: string;
814
- export { description_38 as description };
815
- export function run_40(s: any): any;
816
- export { run_40 as run };
817
- }
818
- export { show_4 as show };
819
- export { show_with_html };
820
- export namespace edit_5 {
821
824
  const isEdit_41: boolean;
822
825
  export { isEdit_41 as isEdit };
823
- const blockDisplay_16: boolean;
824
- export { blockDisplay_16 as blockDisplay };
825
826
  const description_39: string;
826
827
  export { description_39 as description };
827
- export function run_41(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
828
+ export function run_41(s: any): any;
828
829
  export { run_41 as run };
829
830
  }
831
+ export { show_4 as show };
832
+ export { show_with_html };
833
+ export namespace edit_5 {
834
+ const isEdit_42: boolean;
835
+ export { isEdit_42 as isEdit };
836
+ const blockDisplay_17: boolean;
837
+ export { blockDisplay_17 as blockDisplay };
838
+ const description_40: string;
839
+ export { description_40 as description };
840
+ export function run_42(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
841
+ export { run_42 as run };
842
+ }
830
843
  export { edit_5 as edit };
831
844
  }
832
845
  export { fieldviews_5 as fieldviews };
@@ -849,12 +862,62 @@ declare namespace show_with_html {
849
862
  };
850
863
  }[];
851
864
  export { configFields_21 as configFields };
852
- const isEdit_42: boolean;
853
- export { isEdit_42 as isEdit };
854
- const description_40: string;
855
- export { description_40 as description };
856
- export function run_42(v: any, req: any, attrs?: {}): any;
857
- export { run_42 as run };
865
+ const isEdit_43: boolean;
866
+ export { isEdit_43 as isEdit };
867
+ const description_41: string;
868
+ export { description_41 as description };
869
+ export function run_43(v: any, req: any, attrs?: {}): any;
870
+ export { run_43 as run };
871
+ }
872
+ declare namespace to_locale_string {
873
+ const description_42: string;
874
+ export { description_42 as description };
875
+ export function configFields_22(field: any): ({
876
+ type: string;
877
+ name: string;
878
+ label: string;
879
+ sublabel: string;
880
+ required?: undefined;
881
+ attributes?: undefined;
882
+ showIf?: undefined;
883
+ } | {
884
+ type: string;
885
+ name: string;
886
+ label: string;
887
+ required: boolean;
888
+ attributes: {
889
+ options: string[];
890
+ };
891
+ sublabel?: undefined;
892
+ showIf?: undefined;
893
+ } | {
894
+ type: string;
895
+ name: string;
896
+ label: string;
897
+ sublabel: string;
898
+ required: boolean;
899
+ showIf: {
900
+ style: string;
901
+ };
902
+ attributes?: undefined;
903
+ } | {
904
+ type: string;
905
+ name: string;
906
+ label: string;
907
+ required: boolean;
908
+ showIf: {
909
+ style: string;
910
+ };
911
+ attributes: {
912
+ options: string[];
913
+ };
914
+ sublabel?: undefined;
915
+ })[];
916
+ export { configFields_22 as configFields };
917
+ const isEdit_44: boolean;
918
+ export { isEdit_44 as isEdit };
919
+ export function run_44(v: any, req: any, attrs?: {}): string;
920
+ export { run_44 as run };
858
921
  }
859
922
  export {};
860
923
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../base-plugin/types.js"],"names":[],"mappings":";gBAugBa,MAAM;oBAEN,MAAM;;IAQL,+CA6EX;IAMS;;gBAK+D;;;;;YAehE,6BAAyB;;;;;;;YAKzB,mCACiE;;;;;;;;YAKjE,mCAA+C;;;;;;;;;;;;;;YAc/C,4DAIJ;;;;;;;;;;;;;;;YAkBI,yDAGG;;;;;;;;YAUH,yDAAmE;;;;;;;;YAWnE,mCAA6B;;;;;;;;;;YAapB;;;;;;;;;;;;;;;;;;;;;iBAwCb;;YACI,6FAsFG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiDH,6FAyCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyCE,6FAqBF;;;;;;;;;;;;;;;;YA4BE,8FAkBF;;;;;;;;;;;;;;;;;;;;YA2BE,8FAkBF;;;;;;;;;;;;;;YAiBE,8FAcyB;;;;;;;;;;;;;;;YAczB,8FAYoB;;;;;;;;;;YAWpB,8FAWD;;;;IAOF,0CAQL;;QAYK;;mBAAmB;QAMZ;;mBAAyD;;IAOpE,+FAYC;IAMkB,iFAEwB;;;kBAuBlC,MAAM;;sBAEN,MAAM;;;;IAUP;;;gBAAoD;;;;;;;;;;;;;;;;;;YAkBrD,uCAAc;;;;;;;;;;;;;;;;YAwBd,8FAwBJ;;;;;YA9vCS;;;;gBAOb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,MAAM;;sBAEN,MAAM;;;;IAOP,uCAAY;;;;;;;;YAeb,oCAMG;;;;;;;;;;;;YAYH,8FAWD;;;;;;wBAGG,MAAM,EAAE;;IAMb,0CAOL;;IAIS,sCAET;;;;;;;;;;;;;;;;;;;IA/2CI,0DAGJ;;;;;;IAuOa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAoGb;;;;IAEI,6DAYJ"}
@@ -15,6 +15,7 @@ const { getState } = require("../db/state");
15
15
  const { localeDate, localeDateTime } = require("@saltcorn/markup");
16
16
  const { freeVariables, eval_expression } = require("../models/expression");
17
17
  const Table = require("../models/table");
18
+ const User = require("../models/user");
18
19
  const _ = require("underscore");
19
20
  const { interpolate } = require("../utils");
20
21
  const { sqlFun, sqlBinOp } = require("@saltcorn/db-common/internal");
@@ -394,6 +395,126 @@ const join_fields_in_formula = (fml) => {
394
395
  return [];
395
396
  return [...freeVariables(fml)];
396
397
  };
398
+ const to_locale_string = {
399
+ description: "Show as in locale-sensitive representation",
400
+ configFields: (field) => [
401
+ {
402
+ type: "String",
403
+ name: "locale",
404
+ label: "Locale",
405
+ sublabel: "Blank for default user locale",
406
+ },
407
+ {
408
+ type: "String",
409
+ name: "style",
410
+ label: "Style",
411
+ required: true,
412
+ attributes: {
413
+ options: ["decimal", "currency", "percent", "unit"],
414
+ },
415
+ },
416
+ {
417
+ type: "String",
418
+ name: "currency",
419
+ label: "Currency",
420
+ sublabel: "ISO 4217. Example: USD or EUR",
421
+ required: true,
422
+ showIf: { style: "currency" },
423
+ },
424
+ {
425
+ type: "String",
426
+ name: "currencyDisplay",
427
+ label: "Currency display",
428
+ required: true,
429
+ showIf: { style: "currency" },
430
+ attributes: {
431
+ options: ["symbol", "code", "narrrowSymbol", "name"],
432
+ },
433
+ },
434
+ {
435
+ type: "String",
436
+ name: "unit",
437
+ label: "Unit",
438
+ required: true,
439
+ showIf: { style: "unit" },
440
+ attributes: {
441
+ options: [
442
+ "acre",
443
+ "bit",
444
+ "byte",
445
+ "celsius",
446
+ "centimeter",
447
+ "day",
448
+ "degree",
449
+ "fahrenheit",
450
+ "fluid-ounce",
451
+ "foot",
452
+ "gallon",
453
+ "gigabit",
454
+ "gigabyte",
455
+ "gram",
456
+ "hectare",
457
+ "hour",
458
+ "inch",
459
+ "kilobit",
460
+ "kilobyte",
461
+ "kilogram",
462
+ "kilometer",
463
+ "liter",
464
+ "megabit",
465
+ "megabyte",
466
+ "meter",
467
+ "microsecond",
468
+ "mile",
469
+ "mile-scandinavian",
470
+ "milliliter",
471
+ "millimeter",
472
+ "millisecond",
473
+ "minute",
474
+ "month",
475
+ "nanosecond",
476
+ "ounce",
477
+ "percent",
478
+ "petabyte",
479
+ "pound",
480
+ "second",
481
+ "stone",
482
+ "terabit",
483
+ "terabyte",
484
+ "week",
485
+ "yard",
486
+ "year",
487
+ ],
488
+ },
489
+ },
490
+ {
491
+ type: "String",
492
+ name: "unitDisplay",
493
+ label: "Unit display",
494
+ required: true,
495
+ showIf: { style: "unit" },
496
+ attributes: {
497
+ options: ["short", "narrow", "long"],
498
+ },
499
+ },
500
+ ],
501
+ isEdit: false,
502
+ run: (v, req, attrs = {}) => {
503
+ const v1 = typeof v === "string" ? +v : v;
504
+ if (typeof v1 === "number") {
505
+ const locale_ = attrs.locale || locale(req);
506
+ return v1.toLocaleString(locale_, {
507
+ style: attrs.style,
508
+ currency: attrs.currency,
509
+ currencyDisplay: attrs.currencyDisplay,
510
+ unit: attrs.unit,
511
+ unitDisplay: attrs.unitDisplay,
512
+ });
513
+ }
514
+ else
515
+ return "";
516
+ },
517
+ };
397
518
  /**
398
519
  * string type
399
520
  * @namespace
@@ -1184,6 +1305,34 @@ const int = {
1184
1305
  label({ for: `input${text_attr(nm)}-${starVal}` }, i({ class: "fas fa-star" }))));
1185
1306
  },
1186
1307
  },
1308
+ to_locale_string,
1309
+ role_select: {
1310
+ isEdit: true,
1311
+ blockDisplay: true,
1312
+ description: "Select a user role",
1313
+ fill_options: async (field) => {
1314
+ const roles = await User.get_roles();
1315
+ field.options = roles;
1316
+ },
1317
+ run: (nm, v, attrs, cls, required, field) => {
1318
+ return select({
1319
+ class: [
1320
+ "form-control",
1321
+ "form-select",
1322
+ cls,
1323
+ attrs.selectizable ? "selectizable" : false,
1324
+ ],
1325
+ name: text_attr(nm),
1326
+ "data-fieldname": text_attr(field.name),
1327
+ id: `input${text_attr(nm)}`,
1328
+ disabled: attrs.disabled,
1329
+ onChange: attrs.onChange,
1330
+ onBlur: attrs.onChange,
1331
+ autocomplete: "off",
1332
+ required: true,
1333
+ }, field.options.map(({ id, role }) => option({ value: id, selected: v == id }, role)));
1334
+ },
1335
+ },
1187
1336
  },
1188
1337
  /** @type {object[]} */
1189
1338
  attributes: [
@@ -1382,6 +1531,7 @@ const float = {
1382
1531
  heat_cell: heat_cell("Float"),
1383
1532
  above_input: float_number_limit("gte"),
1384
1533
  below_input: float_number_limit("lte"),
1534
+ to_locale_string,
1385
1535
  show_with_html,
1386
1536
  },
1387
1537
  /** @type {object[]} */