@servicetitan/dte-unlayer 0.94.0 → 0.96.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.
Files changed (68) hide show
  1. package/dist/display-conditions/ConditionGroup.d.ts +12 -0
  2. package/dist/display-conditions/ConditionGroup.d.ts.map +1 -0
  3. package/dist/display-conditions/ConditionGroup.js +181 -0
  4. package/dist/display-conditions/ConditionGroup.js.map +1 -0
  5. package/dist/display-conditions/ConditionGroupsSection.d.ts +11 -0
  6. package/dist/display-conditions/ConditionGroupsSection.d.ts.map +1 -0
  7. package/dist/display-conditions/ConditionGroupsSection.js +71 -0
  8. package/dist/display-conditions/ConditionGroupsSection.js.map +1 -0
  9. package/dist/display-conditions/ConditionRow.d.ts +11 -0
  10. package/dist/display-conditions/ConditionRow.d.ts.map +1 -0
  11. package/dist/display-conditions/ConditionRow.js +206 -0
  12. package/dist/display-conditions/ConditionRow.js.map +1 -0
  13. package/dist/display-conditions/DisplayConditionModal.d.ts +5 -0
  14. package/dist/display-conditions/DisplayConditionModal.d.ts.map +1 -0
  15. package/dist/display-conditions/DisplayConditionModal.js +282 -0
  16. package/dist/display-conditions/DisplayConditionModal.js.map +1 -0
  17. package/dist/display-conditions/SeparatorWithChip.d.ts +6 -0
  18. package/dist/display-conditions/SeparatorWithChip.d.ts.map +1 -0
  19. package/dist/display-conditions/SeparatorWithChip.js +15 -0
  20. package/dist/display-conditions/SeparatorWithChip.js.map +1 -0
  21. package/dist/display-conditions/constants.d.ts +7 -0
  22. package/dist/display-conditions/constants.d.ts.map +1 -0
  23. package/dist/display-conditions/constants.js +22 -0
  24. package/dist/display-conditions/constants.js.map +1 -0
  25. package/dist/display-conditions/displayConditionController.d.ts +9 -0
  26. package/dist/display-conditions/displayConditionController.d.ts.map +1 -0
  27. package/dist/display-conditions/displayConditionController.js +29 -0
  28. package/dist/display-conditions/displayConditionController.js.map +1 -0
  29. package/dist/display-conditions/nunjucks.d.ts +8 -0
  30. package/dist/display-conditions/nunjucks.d.ts.map +1 -0
  31. package/dist/display-conditions/nunjucks.js +448 -0
  32. package/dist/display-conditions/nunjucks.js.map +1 -0
  33. package/dist/display-conditions/schemaDataPoints.d.ts +4 -0
  34. package/dist/display-conditions/schemaDataPoints.d.ts.map +1 -0
  35. package/dist/display-conditions/schemaDataPoints.js +18 -0
  36. package/dist/display-conditions/schemaDataPoints.js.map +1 -0
  37. package/dist/display-conditions/types.d.ts +130 -0
  38. package/dist/display-conditions/types.d.ts.map +1 -0
  39. package/dist/display-conditions/types.js +72 -0
  40. package/dist/display-conditions/types.js.map +1 -0
  41. package/dist/editor-core-source.d.ts +1 -1
  42. package/dist/editor-core-source.d.ts.map +1 -1
  43. package/dist/editor-core-source.js +1 -1
  44. package/dist/editor-core-source.js.map +1 -1
  45. package/dist/editor.d.ts.map +1 -1
  46. package/dist/editor.js +4 -0
  47. package/dist/editor.js.map +1 -1
  48. package/dist/shared/schema.d.ts +2 -0
  49. package/dist/shared/schema.d.ts.map +1 -1
  50. package/dist/shared/schema.js.map +1 -1
  51. package/dist/unlayer.d.ts.map +1 -1
  52. package/dist/unlayer.js +7 -0
  53. package/dist/unlayer.js.map +1 -1
  54. package/package.json +4 -2
  55. package/src/display-conditions/ConditionGroup.tsx +145 -0
  56. package/src/display-conditions/ConditionGroupsSection.tsx +64 -0
  57. package/src/display-conditions/ConditionRow.tsx +185 -0
  58. package/src/display-conditions/DisplayConditionModal.tsx +231 -0
  59. package/src/display-conditions/SeparatorWithChip.tsx +14 -0
  60. package/src/display-conditions/constants.ts +22 -0
  61. package/src/display-conditions/displayConditionController.ts +42 -0
  62. package/src/display-conditions/nunjucks.ts +503 -0
  63. package/src/display-conditions/schemaDataPoints.ts +33 -0
  64. package/src/display-conditions/types.ts +75 -0
  65. package/src/editor-core-source.ts +1 -1
  66. package/src/editor.tsx +2 -0
  67. package/src/shared/schema.ts +2 -0
  68. package/src/unlayer.tsx +9 -0
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Display condition types for the modal and Nunjucks generation.
3
+ */
4
+ export type DisplayBehavior = 'show' | 'hide';
5
+ export type LogicalOperator = 'and' | 'or';
6
+ /** Operators for string-type fields. */
7
+ export declare const STRING_OPERATORS: readonly [{
8
+ readonly label: "Contains";
9
+ readonly value: "contains";
10
+ }, {
11
+ readonly label: "Does not contain";
12
+ readonly value: "does_not_contain";
13
+ }, {
14
+ readonly label: "Is equal to";
15
+ readonly value: "is_equal_to";
16
+ }, {
17
+ readonly label: "Is not equal to";
18
+ readonly value: "is_not_equal_to";
19
+ }, {
20
+ readonly label: "Starts with";
21
+ readonly value: "starts_with";
22
+ }, {
23
+ readonly label: "Ends with";
24
+ readonly value: "ends_with";
25
+ }, {
26
+ readonly label: "Is empty";
27
+ readonly value: "is_empty";
28
+ }, {
29
+ readonly label: "Is not empty";
30
+ readonly value: "is_not_empty";
31
+ }];
32
+ /** Operators for number-type fields. */
33
+ export declare const NUMBER_OPERATORS: readonly [{
34
+ readonly label: "== (equal to)";
35
+ readonly value: "num_eq";
36
+ }, {
37
+ readonly label: "!= (not equal to)";
38
+ readonly value: "num_neq";
39
+ }, {
40
+ readonly label: "> (greater than)";
41
+ readonly value: "num_gt";
42
+ }, {
43
+ readonly label: "< (less than)";
44
+ readonly value: "num_lt";
45
+ }, {
46
+ readonly label: ">= (greater than or equal to)";
47
+ readonly value: "num_gte";
48
+ }, {
49
+ readonly label: "<= (less than or equal to)";
50
+ readonly value: "num_lte";
51
+ }];
52
+ /** All operators combined for type definitions. */
53
+ export declare const CONDITION_OPERATORS: readonly [{
54
+ readonly label: "Contains";
55
+ readonly value: "contains";
56
+ }, {
57
+ readonly label: "Does not contain";
58
+ readonly value: "does_not_contain";
59
+ }, {
60
+ readonly label: "Is equal to";
61
+ readonly value: "is_equal_to";
62
+ }, {
63
+ readonly label: "Is not equal to";
64
+ readonly value: "is_not_equal_to";
65
+ }, {
66
+ readonly label: "Starts with";
67
+ readonly value: "starts_with";
68
+ }, {
69
+ readonly label: "Ends with";
70
+ readonly value: "ends_with";
71
+ }, {
72
+ readonly label: "Is empty";
73
+ readonly value: "is_empty";
74
+ }, {
75
+ readonly label: "Is not empty";
76
+ readonly value: "is_not_empty";
77
+ }, {
78
+ readonly label: "== (equal to)";
79
+ readonly value: "num_eq";
80
+ }, {
81
+ readonly label: "!= (not equal to)";
82
+ readonly value: "num_neq";
83
+ }, {
84
+ readonly label: "> (greater than)";
85
+ readonly value: "num_gt";
86
+ }, {
87
+ readonly label: "< (less than)";
88
+ readonly value: "num_lt";
89
+ }, {
90
+ readonly label: ">= (greater than or equal to)";
91
+ readonly value: "num_gte";
92
+ }, {
93
+ readonly label: "<= (less than or equal to)";
94
+ readonly value: "num_lte";
95
+ }];
96
+ export type ConditionOperator = (typeof STRING_OPERATORS)[number]['value'] | (typeof NUMBER_OPERATORS)[number]['value'];
97
+ /** Operators that do not require a value (empty/is not empty) */
98
+ export declare const VALUE_LESS_OPERATORS: ConditionOperator[];
99
+ export interface SingleCondition {
100
+ id: string;
101
+ dataPointKey: string;
102
+ /** How this condition connects to the PREVIOUS condition. Absent on the first condition. */
103
+ logicalOperator?: LogicalOperator;
104
+ operator: ConditionOperator;
105
+ value: string;
106
+ }
107
+ export interface ConditionGroup {
108
+ id: string;
109
+ /** How this group connects to the PREVIOUS group. Absent on the first group. */
110
+ logicalOperator?: LogicalOperator;
111
+ conditions: SingleCondition[];
112
+ }
113
+ export interface DisplayConditionState {
114
+ behavior: DisplayBehavior;
115
+ groups: ConditionGroup[];
116
+ }
117
+ export interface DataPointOption {
118
+ fieldType: 'number' | 'string';
119
+ fullKey: string;
120
+ title: string;
121
+ }
122
+ /** Unlayer display condition shape passed to done() */
123
+ export interface UnlayerDisplayCondition {
124
+ type: string;
125
+ label: string;
126
+ description?: string;
127
+ before: string;
128
+ after: string;
129
+ }
130
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/display-conditions/types.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AAED,uDAAuD;AACvD,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Display condition types for the modal and Nunjucks generation.
3
+ */ /** Operators for string-type fields. */ export const STRING_OPERATORS = [
4
+ {
5
+ label: 'Contains',
6
+ value: 'contains'
7
+ },
8
+ {
9
+ label: 'Does not contain',
10
+ value: 'does_not_contain'
11
+ },
12
+ {
13
+ label: 'Is equal to',
14
+ value: 'is_equal_to'
15
+ },
16
+ {
17
+ label: 'Is not equal to',
18
+ value: 'is_not_equal_to'
19
+ },
20
+ {
21
+ label: 'Starts with',
22
+ value: 'starts_with'
23
+ },
24
+ {
25
+ label: 'Ends with',
26
+ value: 'ends_with'
27
+ },
28
+ {
29
+ label: 'Is empty',
30
+ value: 'is_empty'
31
+ },
32
+ {
33
+ label: 'Is not empty',
34
+ value: 'is_not_empty'
35
+ }
36
+ ];
37
+ /** Operators for number-type fields. */ export const NUMBER_OPERATORS = [
38
+ {
39
+ label: '== (equal to)',
40
+ value: 'num_eq'
41
+ },
42
+ {
43
+ label: '!= (not equal to)',
44
+ value: 'num_neq'
45
+ },
46
+ {
47
+ label: '> (greater than)',
48
+ value: 'num_gt'
49
+ },
50
+ {
51
+ label: '< (less than)',
52
+ value: 'num_lt'
53
+ },
54
+ {
55
+ label: '>= (greater than or equal to)',
56
+ value: 'num_gte'
57
+ },
58
+ {
59
+ label: '<= (less than or equal to)',
60
+ value: 'num_lte'
61
+ }
62
+ ];
63
+ /** All operators combined for type definitions. */ export const CONDITION_OPERATORS = [
64
+ ...STRING_OPERATORS,
65
+ ...NUMBER_OPERATORS
66
+ ];
67
+ /** Operators that do not require a value (empty/is not empty) */ export const VALUE_LESS_OPERATORS = [
68
+ 'is_empty',
69
+ 'is_not_empty'
70
+ ];
71
+
72
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/display-conditions/types.ts"],"sourcesContent":["/**\n * Display condition types for the modal and Nunjucks generation.\n */\n\nexport type DisplayBehavior = 'show' | 'hide';\n\nexport type LogicalOperator = 'and' | 'or';\n\n/** Operators for string-type fields. */\nexport const STRING_OPERATORS = [\n { label: 'Contains', value: 'contains' },\n { label: 'Does not contain', value: 'does_not_contain' },\n { label: 'Is equal to', value: 'is_equal_to' },\n { label: 'Is not equal to', value: 'is_not_equal_to' },\n { label: 'Starts with', value: 'starts_with' },\n { label: 'Ends with', value: 'ends_with' },\n { label: 'Is empty', value: 'is_empty' },\n { label: 'Is not empty', value: 'is_not_empty' },\n] as const;\n\n/** Operators for number-type fields. */\nexport const NUMBER_OPERATORS = [\n { label: '== (equal to)', value: 'num_eq' },\n { label: '!= (not equal to)', value: 'num_neq' },\n { label: '> (greater than)', value: 'num_gt' },\n { label: '< (less than)', value: 'num_lt' },\n { label: '>= (greater than or equal to)', value: 'num_gte' },\n { label: '<= (less than or equal to)', value: 'num_lte' },\n] as const;\n\n/** All operators combined for type definitions. */\nexport const CONDITION_OPERATORS = [...STRING_OPERATORS, ...NUMBER_OPERATORS] as const;\n\nexport type ConditionOperator =\n | (typeof STRING_OPERATORS)[number]['value']\n | (typeof NUMBER_OPERATORS)[number]['value'];\n\n/** Operators that do not require a value (empty/is not empty) */\nexport const VALUE_LESS_OPERATORS: ConditionOperator[] = ['is_empty', 'is_not_empty'];\n\nexport interface SingleCondition {\n id: string;\n dataPointKey: string;\n /** How this condition connects to the PREVIOUS condition. Absent on the first condition. */\n logicalOperator?: LogicalOperator;\n operator: ConditionOperator;\n value: string;\n}\n\nexport interface ConditionGroup {\n id: string;\n /** How this group connects to the PREVIOUS group. Absent on the first group. */\n logicalOperator?: LogicalOperator;\n conditions: SingleCondition[];\n}\n\nexport interface DisplayConditionState {\n behavior: DisplayBehavior;\n groups: ConditionGroup[];\n}\n\nexport interface DataPointOption {\n fieldType: 'number' | 'string';\n fullKey: string;\n title: string;\n}\n\n/** Unlayer display condition shape passed to done() */\nexport interface UnlayerDisplayCondition {\n type: string;\n label: string;\n description?: string;\n before: string;\n after: string;\n}\n"],"names":["STRING_OPERATORS","label","value","NUMBER_OPERATORS","CONDITION_OPERATORS","VALUE_LESS_OPERATORS"],"mappings":"AAAA;;CAEC,GAMD,sCAAsC,GACtC,OAAO,MAAMA,mBAAmB;IAC5B;QAAEC,OAAO;QAAYC,OAAO;IAAW;IACvC;QAAED,OAAO;QAAoBC,OAAO;IAAmB;IACvD;QAAED,OAAO;QAAeC,OAAO;IAAc;IAC7C;QAAED,OAAO;QAAmBC,OAAO;IAAkB;IACrD;QAAED,OAAO;QAAeC,OAAO;IAAc;IAC7C;QAAED,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAYC,OAAO;IAAW;IACvC;QAAED,OAAO;QAAgBC,OAAO;IAAe;CAClD,CAAU;AAEX,sCAAsC,GACtC,OAAO,MAAMC,mBAAmB;IAC5B;QAAEF,OAAO;QAAiBC,OAAO;IAAS;IAC1C;QAAED,OAAO;QAAqBC,OAAO;IAAU;IAC/C;QAAED,OAAO;QAAoBC,OAAO;IAAS;IAC7C;QAAED,OAAO;QAAiBC,OAAO;IAAS;IAC1C;QAAED,OAAO;QAAiCC,OAAO;IAAU;IAC3D;QAAED,OAAO;QAA8BC,OAAO;IAAU;CAC3D,CAAU;AAEX,iDAAiD,GACjD,OAAO,MAAME,sBAAsB;OAAIJ;OAAqBG;CAAiB,CAAU;AAMvF,+DAA+D,GAC/D,OAAO,MAAME,uBAA4C;IAAC;IAAY;CAAe,CAAC"}