@lighthouse/common 6.5.0 → 6.6.0-canary.1
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/dist/constants.js +7 -13
- package/dist/errors/DomainError.js +2 -4
- package/dist/errors/ValidationError.js +0 -8
- package/dist/errors/index.js +1 -5
- package/dist/helpers/build-fetch-url/index.js +0 -5
- package/dist/helpers/fetch-image/index.js +16 -32
- package/dist/helpers/fetch-image-for-pdf-generator-service/index.js +7 -40
- package/dist/helpers/fetch-image-for-web/index.js +0 -9
- package/dist/helpers/fetch-lighthouse-logo/index.js +2 -13
- package/dist/helpers/floatify/index.js +0 -1
- package/dist/helpers/get-assignees-full-names/index.js +0 -4
- package/dist/helpers/get-audit-entry-details/index.js +0 -3
- package/dist/helpers/get-audit-items-data/index.js +2 -6
- package/dist/helpers/get-geometry-geocoded-string/index.js +0 -3
- package/dist/helpers/get-issue-details/index.js +0 -7
- package/dist/helpers/get-job-details/index.js +0 -7
- package/dist/helpers/get-location-reference/index.js +18 -21
- package/dist/helpers/get-pretty-duration/index.js +0 -5
- package/dist/helpers/get-reference-details/index.js +0 -4
- package/dist/helpers/get-status-details/index.js +2 -9
- package/dist/helpers/get-task-entry-details/index.js +0 -3
- package/dist/helpers/get-timezone-abbr/index.js +0 -4
- package/dist/helpers/get-timezone-datetime/index.js +0 -5
- package/dist/helpers/get-user-full-name/index.js +0 -1
- package/dist/helpers/get-value-as-percentage/index.js +0 -1
- package/dist/helpers/image-validators/index.js +8 -9
- package/dist/helpers/index.js +16 -33
- package/dist/images/index.js +5 -9
- package/dist/index.js +4 -20
- package/dist/pdf/activity-report/index.js +41 -62
- package/dist/pdf/audit/index.js +0 -14
- package/dist/pdf/helpers/build-audit-content/index.js +4 -15
- package/dist/pdf/helpers/build-audit-follow-ups/index.js +4 -14
- package/dist/pdf/helpers/build-location-scans-content/index.js +4 -17
- package/dist/pdf/helpers/build-template-content/index.js +5 -14
- package/dist/pdf/helpers/default-footer/index.js +2 -3
- package/dist/pdf/helpers/default-header/index.js +0 -2
- package/dist/pdf/helpers/default-styles/index.js +2 -3
- package/dist/pdf/helpers/fields/index.js +21 -51
- package/dist/pdf/helpers/format-location-address/index.js +0 -3
- package/dist/pdf/helpers/generate-definition/index.js +0 -12
- package/dist/pdf/helpers/horizontal-line/index.js +0 -1
- package/dist/pdf/helpers/html-transformer/index.js +11 -23
- package/dist/pdf/helpers/index.js +40 -55
- package/dist/pdf/helpers/parse-value/index.js +2 -6
- package/dist/pdf/helpers/table/index.js +13 -31
- package/dist/pdf/helpers/text/index.js +0 -1
- package/dist/pdf/icons/index.js +3 -5
- package/dist/pdf/index.js +4 -10
- package/dist/pdf/issue/index.js +17 -16
- package/dist/pdf/job/index.js +1 -13
- package/dist/pdf/shift-report/emptyFixtures.js +4 -6
- package/dist/pdf/shift-report/index.js +2 -25
- package/dist/pdf/task/index.js +0 -13
- package/dist/scheduling/generators/index.js +0 -6
- package/dist/scheduling/generators/occurrenceIntervalsGenerator.js +1 -6
- package/dist/scheduling/generators/scheduleIntervalsGenerator.js +0 -5
- package/dist/scheduling/generators/serviceIntervalsGenerator.js +13 -27
- package/dist/scheduling/helpers/convertToTimezone.js +1 -6
- package/dist/scheduling/helpers/generateNonRepeatingSchedule.js +3 -9
- package/dist/scheduling/helpers/generateRepeatingSchedule.js +11 -18
- package/dist/scheduling/helpers/generateScheduleEnd.js +2 -8
- package/dist/scheduling/helpers/hasValidStartAndEnd.js +0 -6
- package/dist/scheduling/helpers/index.js +0 -28
- package/dist/scheduling/helpers/intervalCovers.js +0 -1
- package/dist/scheduling/helpers/intervalIntersectsEnd.js +0 -1
- package/dist/scheduling/helpers/intervalIntersectsStart.js +0 -1
- package/dist/scheduling/helpers/intervalOnlyIntersectsEnd.js +1 -3
- package/dist/scheduling/helpers/intervalOnlyIntersectsStart.js +0 -3
- package/dist/scheduling/helpers/intervalOutside.js +0 -1
- package/dist/scheduling/helpers/intervalWithin.js +0 -1
- package/dist/scheduling/helpers/mergeIntervals.js +0 -4
- package/dist/scheduling/helpers/splitIntervals.js +0 -3
- package/dist/scheduling/index.js +0 -6
- package/dist/scheduling/scheduling.types.js +10 -18
- package/dist/scheduling/strategies/getNext.js +2 -13
- package/dist/scheduling/strategies/getNextExactDateOfMonth.js +0 -12
- package/dist/scheduling/strategies/getNextLastDayOfMonth.js +0 -10
- package/dist/scheduling/strategies/getNextLastWeekdayOfMonth.js +0 -11
- package/dist/scheduling/strategies/getNextNoRepeat.js +0 -7
- package/dist/scheduling/strategies/getNextWeekday.js +0 -10
- package/dist/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +0 -12
- package/dist/scheduling/strategies/index.js +0 -14
- package/dist/schema/index.js +0 -2
- package/dist/schema/schema.js +2 -7
- package/dist/service-hours/__helpers__/calculate-hours.js +4 -13
- package/dist/service-hours/__helpers__/isOpen.js +0 -9
- package/dist/service-hours/index.js +0 -4
- package/dist/service-hours/schema.js +20 -43
- package/lib/constants.js.map +1 -1
- package/lib/errors/DomainError.js +11 -47
- package/lib/errors/DomainError.js.map +1 -1
- package/lib/errors/ValidationError.js +15 -52
- package/lib/errors/ValidationError.js.map +1 -1
- package/lib/errors/index.js.map +1 -1
- package/lib/helpers/build-fetch-url/index.js +14 -20
- package/lib/helpers/build-fetch-url/index.js.map +1 -1
- package/lib/helpers/fetch-image/index.js +20 -27
- package/lib/helpers/fetch-image/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js +187 -239
- package/lib/helpers/fetch-image-for-pdf-generator-service/index.js.map +1 -1
- package/lib/helpers/fetch-image-for-web/index.js +50 -66
- package/lib/helpers/fetch-image-for-web/index.js.map +1 -1
- package/lib/helpers/fetch-lighthouse-logo/index.js +47 -59
- package/lib/helpers/fetch-lighthouse-logo/index.js.map +1 -1
- package/lib/helpers/floatify/index.js.map +1 -1
- package/lib/helpers/get-assignees-full-names/index.js +0 -1
- package/lib/helpers/get-assignees-full-names/index.js.map +1 -1
- package/lib/helpers/get-audit-entry-details/index.js +8 -8
- package/lib/helpers/get-audit-entry-details/index.js.map +1 -1
- package/lib/helpers/get-audit-items-data/index.js +16 -19
- package/lib/helpers/get-audit-items-data/index.js.map +1 -1
- package/lib/helpers/get-geometry-geocoded-string/index.js.map +1 -1
- package/lib/helpers/get-issue-details/index.js +11 -11
- package/lib/helpers/get-issue-details/index.js.map +1 -1
- package/lib/helpers/get-job-details/index.js +12 -12
- package/lib/helpers/get-job-details/index.js.map +1 -1
- package/lib/helpers/get-location-reference/index.js +32 -36
- package/lib/helpers/get-location-reference/index.js.map +1 -1
- package/lib/helpers/get-pretty-duration/index.js +0 -4
- package/lib/helpers/get-pretty-duration/index.js.map +1 -1
- package/lib/helpers/get-reference-details/index.js +1 -3
- package/lib/helpers/get-reference-details/index.js.map +1 -1
- package/lib/helpers/get-status-details/index.js +0 -4
- package/lib/helpers/get-status-details/index.js.map +1 -1
- package/lib/helpers/get-task-entry-details/index.js +5 -5
- package/lib/helpers/get-task-entry-details/index.js.map +1 -1
- package/lib/helpers/get-timezone-abbr/index.js.map +1 -1
- package/lib/helpers/get-timezone-datetime/index.js +6 -6
- package/lib/helpers/get-timezone-datetime/index.js.map +1 -1
- package/lib/helpers/get-user-full-name/index.js.map +1 -1
- package/lib/helpers/get-value-as-percentage/index.js.map +1 -1
- package/lib/helpers/image-validators/index.js +8 -7
- package/lib/helpers/image-validators/index.js.map +1 -1
- package/lib/helpers/index.js.map +1 -1
- package/lib/images/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/pdf/activity-report/index.js +360 -416
- package/lib/pdf/activity-report/index.js.map +1 -1
- package/lib/pdf/audit/index.js +25 -36
- package/lib/pdf/audit/index.js.map +1 -1
- package/lib/pdf/fonts/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-content/index.js +3 -5
- package/lib/pdf/helpers/build-audit-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-audit-follow-ups/index.js +5 -12
- package/lib/pdf/helpers/build-audit-follow-ups/index.js.map +1 -1
- package/lib/pdf/helpers/build-location-scans-content/index.js +4 -9
- package/lib/pdf/helpers/build-location-scans-content/index.js.map +1 -1
- package/lib/pdf/helpers/build-template-content/index.js +7 -9
- package/lib/pdf/helpers/build-template-content/index.js.map +1 -1
- package/lib/pdf/helpers/default-footer/index.js +9 -8
- package/lib/pdf/helpers/default-footer/index.js.map +1 -1
- package/lib/pdf/helpers/default-header/index.js +5 -5
- package/lib/pdf/helpers/default-header/index.js.map +1 -1
- package/lib/pdf/helpers/default-styles/index.js.map +1 -1
- package/lib/pdf/helpers/fields/index.js +48 -81
- package/lib/pdf/helpers/fields/index.js.map +1 -1
- package/lib/pdf/helpers/format-location-address/index.js.map +1 -1
- package/lib/pdf/helpers/generate-definition/index.js +22 -29
- package/lib/pdf/helpers/generate-definition/index.js.map +1 -1
- package/lib/pdf/helpers/horizontal-line/index.js +1 -1
- package/lib/pdf/helpers/horizontal-line/index.js.map +1 -1
- package/lib/pdf/helpers/html-transformer/index.js +19 -30
- package/lib/pdf/helpers/html-transformer/index.js.map +1 -1
- package/lib/pdf/helpers/index.js.map +1 -1
- package/lib/pdf/helpers/parse-value/index.js +2 -4
- package/lib/pdf/helpers/parse-value/index.js.map +1 -1
- package/lib/pdf/helpers/table/index.js +78 -84
- package/lib/pdf/helpers/table/index.js.map +1 -1
- package/lib/pdf/helpers/text/index.js +2 -5
- package/lib/pdf/helpers/text/index.js.map +1 -1
- package/lib/pdf/icons/index.js.map +1 -1
- package/lib/pdf/index.js.map +1 -1
- package/lib/pdf/issue/index.js +36 -30
- package/lib/pdf/issue/index.js.map +1 -1
- package/lib/pdf/job/index.js +12 -19
- package/lib/pdf/job/index.js.map +1 -1
- package/lib/pdf/shift-report/emptyFixtures.js.map +1 -1
- package/lib/pdf/shift-report/index.js +308 -374
- package/lib/pdf/shift-report/index.js.map +1 -1
- package/lib/pdf/task/index.js +11 -19
- package/lib/pdf/task/index.js.map +1 -1
- package/lib/scheduling/generators/index.js.map +1 -1
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js +27 -38
- package/lib/scheduling/generators/occurrenceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js +19 -30
- package/lib/scheduling/generators/scheduleIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/generators/serviceIntervalsGenerator.js +139 -181
- package/lib/scheduling/generators/serviceIntervalsGenerator.js.map +1 -1
- package/lib/scheduling/helpers/convertToTimezone.js +1 -1
- package/lib/scheduling/helpers/convertToTimezone.js.map +1 -1
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js +84 -124
- package/lib/scheduling/helpers/generateNonRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateRepeatingSchedule.js +107 -175
- package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateScheduleEnd.js +6 -6
- package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
- package/lib/scheduling/helpers/hasValidStartAndEnd.js +1 -2
- package/lib/scheduling/helpers/hasValidStartAndEnd.js.map +1 -1
- package/lib/scheduling/helpers/index.js.map +1 -1
- package/lib/scheduling/helpers/intervalCovers.js.map +1 -1
- package/lib/scheduling/helpers/intervalIntersectsEnd.js.map +1 -1
- package/lib/scheduling/helpers/intervalIntersectsStart.js.map +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js +1 -0
- package/lib/scheduling/helpers/intervalOnlyIntersectsEnd.js.map +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js +1 -1
- package/lib/scheduling/helpers/intervalOnlyIntersectsStart.js.map +1 -1
- package/lib/scheduling/helpers/intervalOutside.js.map +1 -1
- package/lib/scheduling/helpers/intervalWithin.js.map +1 -1
- package/lib/scheduling/helpers/mergeIntervals.js +0 -3
- package/lib/scheduling/helpers/mergeIntervals.js.map +1 -1
- package/lib/scheduling/helpers/splitIntervals.js +1 -1
- package/lib/scheduling/helpers/splitIntervals.js.map +1 -1
- package/lib/scheduling/index.js.map +1 -1
- package/lib/scheduling/scheduling.types.js +9 -14
- package/lib/scheduling/scheduling.types.js.map +1 -1
- package/lib/scheduling/strategies/getNext.js +22 -30
- package/lib/scheduling/strategies/getNext.js.map +1 -1
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js +22 -31
- package/lib/scheduling/strategies/getNextExactDateOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js +21 -28
- package/lib/scheduling/strategies/getNextLastDayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js +21 -28
- package/lib/scheduling/strategies/getNextLastWeekdayOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/getNextNoRepeat.js +15 -23
- package/lib/scheduling/strategies/getNextNoRepeat.js.map +1 -1
- package/lib/scheduling/strategies/getNextWeekday.js +43 -78
- package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js +21 -28
- package/lib/scheduling/strategies/getNextXDayOfXWeekOfMonth.js.map +1 -1
- package/lib/scheduling/strategies/index.js.map +1 -1
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/schema.js +22 -30
- package/lib/schema/schema.js.map +1 -1
- package/lib/service-hours/__helpers__/calculate-hours.js +4 -13
- package/lib/service-hours/__helpers__/calculate-hours.js.map +1 -1
- package/lib/service-hours/__helpers__/isOpen.js +3 -7
- package/lib/service-hours/__helpers__/isOpen.js.map +1 -1
- package/lib/service-hours/index.js.map +1 -1
- package/lib/service-hours/schema.js +21 -36
- package/lib/service-hours/schema.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.defaultStyles = void 0;
|
|
7
|
-
const defaultStyles = {
|
|
7
|
+
const defaultStyles = exports.defaultStyles = {
|
|
8
8
|
horizontalLine: {
|
|
9
9
|
font: 'Gotham',
|
|
10
10
|
fontSize: 1
|
|
@@ -157,5 +157,4 @@ const defaultStyles = {
|
|
|
157
157
|
fontSize: 8,
|
|
158
158
|
margin: [10, 0, 10, 10]
|
|
159
159
|
}
|
|
160
|
-
};
|
|
161
|
-
exports.defaultStyles = defaultStyles;
|
|
160
|
+
};
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.buildFile = buildFile;
|
|
9
8
|
exports.buildSummaryField = buildSummaryField;
|
|
10
9
|
exports.buildTemplateFieldRow = buildTemplateFieldRow;
|
|
11
|
-
|
|
12
10
|
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
11
|
var _bluebird = _interopRequireDefault(require("bluebird"));
|
|
15
|
-
|
|
16
12
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
17
|
-
|
|
18
13
|
var _helpers = require("../../../helpers");
|
|
19
|
-
|
|
20
14
|
var _images = require("../../../images");
|
|
21
|
-
|
|
22
15
|
var _ = require("../");
|
|
23
|
-
|
|
24
16
|
function buildFile({
|
|
25
17
|
file,
|
|
26
18
|
settings
|
|
@@ -39,7 +31,6 @@ function buildFile({
|
|
|
39
31
|
margin: [0, 0, 0, 10]
|
|
40
32
|
});
|
|
41
33
|
}
|
|
42
|
-
|
|
43
34
|
function buildImage(options) {
|
|
44
35
|
const {
|
|
45
36
|
alignment = 'center',
|
|
@@ -56,7 +47,6 @@ function buildImage(options) {
|
|
|
56
47
|
} = settings;
|
|
57
48
|
const isVideoType = new RegExp('.mp4$').test(filepath);
|
|
58
49
|
const link = `${awsS3BaseUrl}/${filepath}`;
|
|
59
|
-
|
|
60
50
|
if (isVideoType) {
|
|
61
51
|
return {
|
|
62
52
|
alignment,
|
|
@@ -65,7 +55,6 @@ function buildImage(options) {
|
|
|
65
55
|
link
|
|
66
56
|
};
|
|
67
57
|
}
|
|
68
|
-
|
|
69
58
|
const url = (0, _helpers.buildFetchUrl)(filepath, {
|
|
70
59
|
awsS3BaseUrl,
|
|
71
60
|
cloudfrontBaseUrl,
|
|
@@ -75,8 +64,9 @@ function buildImage(options) {
|
|
|
75
64
|
width: 600,
|
|
76
65
|
quality: 50,
|
|
77
66
|
shouldUseCloudfront
|
|
78
|
-
});
|
|
67
|
+
});
|
|
79
68
|
|
|
69
|
+
// NOTE: shouldUseCloudfront, Signature, Policy and KeyPairId from settings are used in this context
|
|
80
70
|
return (0, _helpers.fetchImage)(url, settings).then(base64String => ({
|
|
81
71
|
alignment,
|
|
82
72
|
fit: [width, height],
|
|
@@ -84,7 +74,6 @@ function buildImage(options) {
|
|
|
84
74
|
link
|
|
85
75
|
}));
|
|
86
76
|
}
|
|
87
|
-
|
|
88
77
|
function buildSummaryField({
|
|
89
78
|
field,
|
|
90
79
|
settings,
|
|
@@ -108,27 +97,25 @@ function buildSummaryField({
|
|
|
108
97
|
const isSwitchField = fieldtype === 'switch';
|
|
109
98
|
const isTextField = fieldtype === 'text';
|
|
110
99
|
const is12HourTimeField = fieldtype === 'time' && options.format === 'h:mm a';
|
|
111
|
-
const is24HourTimeField = fieldtype === 'time' && options.format === 'HH:mm';
|
|
112
|
-
// logic to catch this and return empty text for completeness
|
|
100
|
+
const is24HourTimeField = fieldtype === 'time' && options.format === 'HH:mm';
|
|
113
101
|
|
|
102
|
+
// NOTE: html field is not supported for the summary fields but adding
|
|
103
|
+
// logic to catch this and return empty text for completeness
|
|
114
104
|
if (isHtmlField) {
|
|
115
105
|
return {
|
|
116
106
|
text: ''
|
|
117
107
|
};
|
|
118
108
|
}
|
|
119
|
-
|
|
120
109
|
if (isSignatureField) {
|
|
121
110
|
if (!value) return '';
|
|
122
|
-
|
|
123
111
|
if (isDataImage(value)) {
|
|
124
112
|
return {
|
|
125
113
|
alignment: 'left',
|
|
126
114
|
image: value,
|
|
127
115
|
width: 140
|
|
128
116
|
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
117
|
+
}
|
|
118
|
+
// NOTE: shouldUseCloudfront, Signature, Policy and KeyPairId from settings are used in this context
|
|
132
119
|
return (0, _helpers.fetchImage)(value, settings).then(base64String => {
|
|
133
120
|
return {
|
|
134
121
|
alignment: 'left',
|
|
@@ -137,17 +124,16 @@ function buildSummaryField({
|
|
|
137
124
|
};
|
|
138
125
|
});
|
|
139
126
|
}
|
|
140
|
-
|
|
141
127
|
if (isPhotoField) {
|
|
142
|
-
const filepath = (0, _lodash.first)(value);
|
|
143
|
-
// for this field
|
|
128
|
+
const filepath = (0, _lodash.first)(value);
|
|
144
129
|
|
|
130
|
+
// NOTE: if no filepath return empty text as user has not uploaded an image
|
|
131
|
+
// for this field
|
|
145
132
|
if (!filepath) {
|
|
146
133
|
return {
|
|
147
134
|
text: ''
|
|
148
135
|
};
|
|
149
136
|
}
|
|
150
|
-
|
|
151
137
|
const image = buildImage({
|
|
152
138
|
alignment: 'left',
|
|
153
139
|
filepath,
|
|
@@ -157,7 +143,6 @@ function buildSummaryField({
|
|
|
157
143
|
});
|
|
158
144
|
return image;
|
|
159
145
|
}
|
|
160
|
-
|
|
161
146
|
if (isFileField) {
|
|
162
147
|
const fileList = (0, _lodash.map)(value, file => buildFile({
|
|
163
148
|
file,
|
|
@@ -167,7 +152,6 @@ function buildSummaryField({
|
|
|
167
152
|
ol: fileList
|
|
168
153
|
};
|
|
169
154
|
}
|
|
170
|
-
|
|
171
155
|
if (isNumberField || isSelectField || isSwitchField || isTextField) {
|
|
172
156
|
const parsedValue = (0, _.parseValue)(value);
|
|
173
157
|
const displayValue = (0, _lodash.isArray)(parsedValue) ? {
|
|
@@ -179,7 +163,6 @@ function buildSummaryField({
|
|
|
179
163
|
};
|
|
180
164
|
return displayValue;
|
|
181
165
|
}
|
|
182
|
-
|
|
183
166
|
if (isReferenceField) {
|
|
184
167
|
const parsedValue = (0, _.parseValue)(value);
|
|
185
168
|
const displayValue = (0, _lodash.isArray)(parsedValue) ? {
|
|
@@ -191,25 +174,22 @@ function buildSummaryField({
|
|
|
191
174
|
};
|
|
192
175
|
return displayValue;
|
|
193
176
|
}
|
|
194
|
-
|
|
195
177
|
if (isStarField) {
|
|
196
178
|
if (!value) return '';
|
|
197
179
|
const displayValue = value === '1' ? `${value} star` : `${value} stars`;
|
|
198
180
|
return displayValue;
|
|
199
181
|
}
|
|
200
|
-
|
|
201
182
|
if (isDayFirstDateField || isMonthFirstDateField || is12HourTimeField || is24HourTimeField) {
|
|
202
183
|
const format = options.format;
|
|
203
184
|
const displayValue = (0, _momentTimezone.default)(value).tz(timezone).format(format);
|
|
204
185
|
return displayValue;
|
|
205
|
-
}
|
|
206
|
-
|
|
186
|
+
}
|
|
207
187
|
|
|
188
|
+
// NOTE: return empty text fallback value when no match
|
|
208
189
|
return {
|
|
209
190
|
text: ''
|
|
210
191
|
};
|
|
211
192
|
}
|
|
212
|
-
|
|
213
193
|
function buildTemplateFieldRow({
|
|
214
194
|
field,
|
|
215
195
|
settings,
|
|
@@ -239,27 +219,24 @@ function buildTemplateFieldRow({
|
|
|
239
219
|
const is12HourTimeField = fieldtype === 'time' && options.format === 'h:mm a';
|
|
240
220
|
const is24HourTimeField = fieldtype === 'time' && options.format === 'HH:mm';
|
|
241
221
|
const isDisplayImageField = fieldtype === 'image-display' && showOnRead && !((0, _lodash.isArray)(value) && value.length === 0);
|
|
242
|
-
const isReferenceField = fieldtype === 'reference';
|
|
243
|
-
|
|
222
|
+
const isReferenceField = fieldtype === 'reference';
|
|
223
|
+
// NOTE: only show field when show on read is true
|
|
244
224
|
if (!showOnRead) return null;
|
|
245
225
|
const labelText = [{
|
|
246
226
|
text: label
|
|
247
227
|
}];
|
|
248
|
-
|
|
249
228
|
if (skipped) {
|
|
250
229
|
return [labelText, [{
|
|
251
230
|
text: '-'
|
|
252
231
|
}]];
|
|
253
232
|
}
|
|
254
|
-
|
|
255
233
|
if (isHtmlField) {
|
|
256
234
|
const parsed = value.replace(/<p><\/p>/g, '');
|
|
257
235
|
return [labelText, (0, _.toPdf)(parsed)];
|
|
258
236
|
}
|
|
259
|
-
|
|
260
237
|
if (isSignatureField) {
|
|
261
|
-
if (!value) return [labelText, ''];
|
|
262
|
-
|
|
238
|
+
if (!value) return [labelText, ''];
|
|
239
|
+
// NOTE: shouldUseCloudfront, Signature, Policy and KeyPairId from settings are used in this context
|
|
263
240
|
return (0, _helpers.fetchImage)(value, settings).then(base64String => {
|
|
264
241
|
const values = {
|
|
265
242
|
alignment: 'left',
|
|
@@ -269,14 +246,12 @@ function buildTemplateFieldRow({
|
|
|
269
246
|
return [labelText, values];
|
|
270
247
|
});
|
|
271
248
|
}
|
|
272
|
-
|
|
273
249
|
if (isDisplayImageField) {
|
|
274
250
|
return _bluebird.default.map([value], filepath => buildImage({
|
|
275
251
|
filepath,
|
|
276
252
|
settings
|
|
277
253
|
})).then(fieldImages => [fieldImages, {}]);
|
|
278
254
|
}
|
|
279
|
-
|
|
280
255
|
if (isPhotoField) {
|
|
281
256
|
return _bluebird.default.map(value, filepath => buildImage({
|
|
282
257
|
filepath,
|
|
@@ -297,15 +272,15 @@ function buildTemplateFieldRow({
|
|
|
297
272
|
body: [labelText, ...tables],
|
|
298
273
|
widths: ['*']
|
|
299
274
|
}
|
|
300
|
-
};
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// NOTE: pass empty value here as otherwise
|
|
301
278
|
// we can accidentally hide content below
|
|
302
279
|
// this row. Please see the following issue:
|
|
303
280
|
// https://github.com/bpampuch/pdfmake/issues/1598
|
|
304
|
-
|
|
305
281
|
return [imagesRow, {}];
|
|
306
282
|
});
|
|
307
283
|
}
|
|
308
|
-
|
|
309
284
|
if (isFileField) {
|
|
310
285
|
const fileList = (0, _lodash.map)(value, file => buildFile({
|
|
311
286
|
file,
|
|
@@ -315,7 +290,6 @@ function buildTemplateFieldRow({
|
|
|
315
290
|
ol: fileList
|
|
316
291
|
}];
|
|
317
292
|
}
|
|
318
|
-
|
|
319
293
|
if (isNumberField || isSelectField || isSwitchField || isTextField) {
|
|
320
294
|
const parsedValue = (0, _.parseValue)(value);
|
|
321
295
|
const displayValue = (0, _lodash.isArray)(parsedValue) ? {
|
|
@@ -325,7 +299,6 @@ function buildTemplateFieldRow({
|
|
|
325
299
|
};
|
|
326
300
|
return [labelText, displayValue];
|
|
327
301
|
}
|
|
328
|
-
|
|
329
302
|
if (isReferenceField) {
|
|
330
303
|
const parsedValue = (0, _.parseValue)(value);
|
|
331
304
|
const displayValue = (0, _lodash.isArray)(parsedValue) ? {
|
|
@@ -337,23 +310,20 @@ function buildTemplateFieldRow({
|
|
|
337
310
|
};
|
|
338
311
|
return [labelText, displayValue];
|
|
339
312
|
}
|
|
340
|
-
|
|
341
313
|
if (isStarField) {
|
|
342
314
|
if (!value) return [labelText, ''];
|
|
343
315
|
const displayValue = value === '1' ? `${value} star` : `${value} stars`;
|
|
344
316
|
return [labelText, displayValue];
|
|
345
317
|
}
|
|
346
|
-
|
|
347
318
|
if (isDayFirstDateField || isMonthFirstDateField || is12HourTimeField || is24HourTimeField) {
|
|
348
319
|
const format = options.format;
|
|
349
320
|
const displayValue = value ? (0, _momentTimezone.default)(value).tz(timezone).format(format) : '';
|
|
350
321
|
return [labelText, displayValue];
|
|
351
|
-
}
|
|
352
|
-
|
|
322
|
+
}
|
|
353
323
|
|
|
324
|
+
// NOTE: if no match above null values will be stripped within calling fn
|
|
354
325
|
return null;
|
|
355
326
|
}
|
|
356
|
-
|
|
357
327
|
function isDataImage(string) {
|
|
358
328
|
return (0, _lodash.startsWith)(string, 'data:image/png;');
|
|
359
329
|
}
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getFormattedAddress = getFormattedAddress;
|
|
7
|
-
|
|
8
7
|
var _getGeometryGeocodedString = require("../../../helpers/get-geometry-geocoded-string");
|
|
9
|
-
|
|
10
8
|
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
9
|
function getFormattedAddress(reverseGeoCoded) {
|
|
13
10
|
const geometry = (0, _getGeometryGeocodedString.getGeometryGeocodedString)(reverseGeoCoded);
|
|
14
11
|
const splitGeoString = (0, _lodash.split)(geometry, ', ');
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.generateDefinition = generateDefinition;
|
|
9
|
-
|
|
10
8
|
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
9
|
var _bluebird = _interopRequireDefault(require("bluebird"));
|
|
13
|
-
|
|
14
10
|
var _constants = require("../../../constants");
|
|
15
|
-
|
|
16
11
|
var _ = require("../");
|
|
17
|
-
|
|
18
12
|
function generateDefinition(options) {
|
|
19
13
|
const {
|
|
20
14
|
content,
|
|
@@ -62,27 +56,21 @@ function generateDefinition(options) {
|
|
|
62
56
|
throw new Error(`GenerateDefinitionError: ${err.message}`);
|
|
63
57
|
});
|
|
64
58
|
}
|
|
65
|
-
|
|
66
59
|
function pdfHeader(header) {
|
|
67
60
|
if ((0, _lodash.isFunction)(header)) {
|
|
68
61
|
return _bluebird.default.resolve(header());
|
|
69
62
|
}
|
|
70
|
-
|
|
71
63
|
return _bluebird.default.resolve(header);
|
|
72
64
|
}
|
|
73
|
-
|
|
74
65
|
function pdfContent(content) {
|
|
75
66
|
if ((0, _lodash.isFunction)(content)) {
|
|
76
67
|
return _bluebird.default.resolve(content());
|
|
77
68
|
}
|
|
78
|
-
|
|
79
69
|
return _bluebird.default.resolve(content);
|
|
80
70
|
}
|
|
81
|
-
|
|
82
71
|
function pdfFooter(footer) {
|
|
83
72
|
if ((0, _lodash.isFunction)(footer)) {
|
|
84
73
|
return _bluebird.default.resolve(footer());
|
|
85
74
|
}
|
|
86
|
-
|
|
87
75
|
return _bluebird.default.resolve(footer);
|
|
88
76
|
}
|
|
@@ -7,52 +7,47 @@ exports.convertToPdfMake = convertToPdfMake;
|
|
|
7
7
|
exports.getStyleAttributes = getStyleAttributes;
|
|
8
8
|
exports.parseHtml = parseHtml;
|
|
9
9
|
exports.toPdf = toPdf;
|
|
10
|
-
|
|
11
10
|
var _lodash = require("lodash");
|
|
12
|
-
|
|
13
11
|
var _reactHtmlParser = require("react-html-parser");
|
|
14
|
-
|
|
15
12
|
const LIST_KEY_MATCHER = ['ol', 'ul'];
|
|
16
|
-
const NEW_LINE_MATCHER = /.*\n.*/;
|
|
17
|
-
|
|
13
|
+
const NEW_LINE_MATCHER = /.*\n.*/;
|
|
14
|
+
// NOTE: this will remove all whitespace except spaces
|
|
18
15
|
const WHITSPACE_MATCHER = /[\t\r\n\f]/g;
|
|
19
|
-
|
|
20
16
|
function convertToPdfMake(obj) {
|
|
21
17
|
if (!(0, _lodash.isPlainObject)(obj)) {
|
|
22
18
|
return '';
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
const {
|
|
26
21
|
children = [],
|
|
27
22
|
data = '',
|
|
28
23
|
name = '',
|
|
29
24
|
type
|
|
30
25
|
} = obj;
|
|
31
|
-
|
|
32
26
|
if (type === 'text' && data) {
|
|
33
|
-
const trimmed = data.replace(WHITSPACE_MATCHER, '');
|
|
27
|
+
const trimmed = data.replace(WHITSPACE_MATCHER, '');
|
|
28
|
+
|
|
29
|
+
// NOTE: Originally tried to achieve this by using inline styles, however PDFMake
|
|
34
30
|
// does not support adding margins or padding when applying inline styles
|
|
35
31
|
// (bold/italics/underline). The easiest way to get around this was to add
|
|
36
32
|
// an extra space after text.
|
|
37
|
-
|
|
38
33
|
return trimmed;
|
|
39
|
-
}
|
|
40
|
-
|
|
34
|
+
}
|
|
41
35
|
|
|
36
|
+
// NOTE: Reject any children that are WYSIWYG carriage returns
|
|
42
37
|
const filtered = (0, _lodash.reject)(children, ['data', NEW_LINE_MATCHER]);
|
|
43
38
|
const parsed = (0, _lodash.compact)((0, _lodash.map)(filtered, convertToPdfMake));
|
|
44
|
-
const key = (0, _lodash.includes)(LIST_KEY_MATCHER, name) ? name : 'text';
|
|
39
|
+
const key = (0, _lodash.includes)(LIST_KEY_MATCHER, name) ? name : 'text';
|
|
40
|
+
// NOTE: If the child is an array with a single text string, we just need to return
|
|
45
41
|
// the string, so that the styles can be applied
|
|
46
|
-
|
|
47
42
|
const text = (0, _lodash.isArray)(parsed) && parsed.length === 1 && (0, _lodash.isString)(parsed[0]) ? parsed[0] : parsed;
|
|
48
43
|
const link = type === 'tag' && name === 'a' ? obj.attribs.href : undefined;
|
|
49
|
-
return {
|
|
44
|
+
return {
|
|
45
|
+
...getStyleAttributes(obj),
|
|
50
46
|
[key]: text,
|
|
51
47
|
link,
|
|
52
48
|
preserveLeadingSpaces: true
|
|
53
49
|
};
|
|
54
50
|
}
|
|
55
|
-
|
|
56
51
|
function getStyleAttributes({
|
|
57
52
|
name = ''
|
|
58
53
|
}) {
|
|
@@ -60,34 +55,27 @@ function getStyleAttributes({
|
|
|
60
55
|
if (name === 'em') result.italics = true;
|
|
61
56
|
if (name === 'ins') result.decoration = 'underline';
|
|
62
57
|
if (name === 'strong') result.bold = true;
|
|
63
|
-
|
|
64
58
|
if (name === 'a') {
|
|
65
59
|
result.decoration = 'underline';
|
|
66
60
|
result.color = 'blue';
|
|
67
61
|
}
|
|
68
|
-
|
|
69
62
|
if (!result.bold && !result.decoration && !result.italics) {
|
|
70
63
|
result.style = name;
|
|
71
64
|
}
|
|
72
|
-
|
|
73
65
|
return result;
|
|
74
66
|
}
|
|
75
|
-
|
|
76
67
|
function parseHtml(html) {
|
|
77
68
|
if ((0, _lodash.isEmpty)(html) || !(0, _lodash.isString)(html)) {
|
|
78
69
|
return '';
|
|
79
70
|
}
|
|
80
|
-
|
|
81
71
|
return _reactHtmlParser.htmlparser2.parseDOM(html, {
|
|
82
72
|
decodeEntities: true
|
|
83
73
|
});
|
|
84
74
|
}
|
|
85
|
-
|
|
86
75
|
function toPdf(htmlString) {
|
|
87
76
|
if ((0, _lodash.isEmpty)(htmlString) || !(0, _lodash.isString)(htmlString)) {
|
|
88
77
|
return [];
|
|
89
78
|
}
|
|
90
|
-
|
|
91
79
|
const arr = parseHtml(htmlString);
|
|
92
80
|
return (0, _lodash.compact)((0, _lodash.map)(arr, convertToPdfMake));
|
|
93
81
|
}
|
|
@@ -15,16 +15,22 @@ Object.defineProperty(exports, "buildAuditFollowUps", {
|
|
|
15
15
|
return _buildAuditFollowUps.buildAuditFollowUps;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "buildLocationScansBoundaries", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _buildLocationScansContent.buildLocationScansBoundaries;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "buildLocationScansContent", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function () {
|
|
21
27
|
return _buildLocationScansContent.buildLocationScansContent;
|
|
22
28
|
}
|
|
23
29
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "buildSummaryField", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
27
|
-
return
|
|
33
|
+
return _fields.buildSummaryField;
|
|
28
34
|
}
|
|
29
35
|
});
|
|
30
36
|
Object.defineProperty(exports, "buildTemplateContent", {
|
|
@@ -33,6 +39,18 @@ Object.defineProperty(exports, "buildTemplateContent", {
|
|
|
33
39
|
return _buildTemplateContent.buildTemplateContent;
|
|
34
40
|
}
|
|
35
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "buildTemplateFieldRow", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _fields.buildTemplateFieldRow;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "convertToPdfMake", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _htmlTransformer.convertToPdfMake;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
36
54
|
Object.defineProperty(exports, "defaultFooter", {
|
|
37
55
|
enumerable: true,
|
|
38
56
|
get: function () {
|
|
@@ -51,16 +69,16 @@ Object.defineProperty(exports, "defaultStyles", {
|
|
|
51
69
|
return _defaultStyles.defaultStyles;
|
|
52
70
|
}
|
|
53
71
|
});
|
|
54
|
-
Object.defineProperty(exports, "
|
|
72
|
+
Object.defineProperty(exports, "fourColumnTable", {
|
|
55
73
|
enumerable: true,
|
|
56
74
|
get: function () {
|
|
57
|
-
return
|
|
75
|
+
return _table.fourColumnTable;
|
|
58
76
|
}
|
|
59
77
|
});
|
|
60
|
-
Object.defineProperty(exports, "
|
|
78
|
+
Object.defineProperty(exports, "generateDefinition", {
|
|
61
79
|
enumerable: true,
|
|
62
80
|
get: function () {
|
|
63
|
-
return
|
|
81
|
+
return _generateDefinition.generateDefinition;
|
|
64
82
|
}
|
|
65
83
|
});
|
|
66
84
|
Object.defineProperty(exports, "getFormattedAddress", {
|
|
@@ -69,10 +87,10 @@ Object.defineProperty(exports, "getFormattedAddress", {
|
|
|
69
87
|
return _formatLocationAddress.getFormattedAddress;
|
|
70
88
|
}
|
|
71
89
|
});
|
|
72
|
-
Object.defineProperty(exports, "
|
|
90
|
+
Object.defineProperty(exports, "getStyleAttributes", {
|
|
73
91
|
enumerable: true,
|
|
74
92
|
get: function () {
|
|
75
|
-
return
|
|
93
|
+
return _htmlTransformer.getStyleAttributes;
|
|
76
94
|
}
|
|
77
95
|
});
|
|
78
96
|
Object.defineProperty(exports, "horizontalLine", {
|
|
@@ -81,16 +99,10 @@ Object.defineProperty(exports, "horizontalLine", {
|
|
|
81
99
|
return _horizontalLine.horizontalLine;
|
|
82
100
|
}
|
|
83
101
|
});
|
|
84
|
-
Object.defineProperty(exports, "
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function () {
|
|
87
|
-
return _htmlTransformer.convertToPdfMake;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(exports, "getStyleAttributes", {
|
|
102
|
+
Object.defineProperty(exports, "imageTables", {
|
|
91
103
|
enumerable: true,
|
|
92
104
|
get: function () {
|
|
93
|
-
return
|
|
105
|
+
return _table.imageTables;
|
|
94
106
|
}
|
|
95
107
|
});
|
|
96
108
|
Object.defineProperty(exports, "parseHtml", {
|
|
@@ -99,30 +111,12 @@ Object.defineProperty(exports, "parseHtml", {
|
|
|
99
111
|
return _htmlTransformer.parseHtml;
|
|
100
112
|
}
|
|
101
113
|
});
|
|
102
|
-
Object.defineProperty(exports, "toPdf", {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
get: function () {
|
|
105
|
-
return _htmlTransformer.toPdf;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
114
|
Object.defineProperty(exports, "parseValue", {
|
|
109
115
|
enumerable: true,
|
|
110
116
|
get: function () {
|
|
111
117
|
return _parseValue.parseValue;
|
|
112
118
|
}
|
|
113
119
|
});
|
|
114
|
-
Object.defineProperty(exports, "fourColumnTable", {
|
|
115
|
-
enumerable: true,
|
|
116
|
-
get: function () {
|
|
117
|
-
return _table.fourColumnTable;
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(exports, "imageTables", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () {
|
|
123
|
-
return _table.imageTables;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
120
|
Object.defineProperty(exports, "sixColumnTable", {
|
|
127
121
|
enumerable: true,
|
|
128
122
|
get: function () {
|
|
@@ -153,57 +147,48 @@ Object.defineProperty(exports, "table", {
|
|
|
153
147
|
return _table.table;
|
|
154
148
|
}
|
|
155
149
|
});
|
|
150
|
+
Object.defineProperty(exports, "text", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return _text.text;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
156
|
Object.defineProperty(exports, "threeColumnTable", {
|
|
157
157
|
enumerable: true,
|
|
158
158
|
get: function () {
|
|
159
159
|
return _table.threeColumnTable;
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
-
Object.defineProperty(exports, "
|
|
162
|
+
Object.defineProperty(exports, "toPdf", {
|
|
163
163
|
enumerable: true,
|
|
164
164
|
get: function () {
|
|
165
|
-
return
|
|
165
|
+
return _htmlTransformer.toPdf;
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
|
-
Object.defineProperty(exports, "
|
|
168
|
+
Object.defineProperty(exports, "twoColumnTable", {
|
|
169
169
|
enumerable: true,
|
|
170
170
|
get: function () {
|
|
171
|
-
return _table.
|
|
171
|
+
return _table.twoColumnTable;
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
|
-
Object.defineProperty(exports, "
|
|
174
|
+
Object.defineProperty(exports, "zebraFillColor", {
|
|
175
175
|
enumerable: true,
|
|
176
176
|
get: function () {
|
|
177
|
-
return
|
|
177
|
+
return _table.zebraFillColor;
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
-
|
|
181
180
|
var _buildAuditContent = require("./build-audit-content");
|
|
182
|
-
|
|
183
181
|
var _buildAuditFollowUps = require("./build-audit-follow-ups");
|
|
184
|
-
|
|
185
182
|
var _buildLocationScansContent = require("./build-location-scans-content");
|
|
186
|
-
|
|
187
183
|
var _buildTemplateContent = require("./build-template-content");
|
|
188
|
-
|
|
189
184
|
var _defaultFooter = require("./default-footer");
|
|
190
|
-
|
|
191
185
|
var _defaultHeader = require("./default-header");
|
|
192
|
-
|
|
193
186
|
var _defaultStyles = require("./default-styles");
|
|
194
|
-
|
|
195
187
|
var _fields = require("./fields");
|
|
196
|
-
|
|
197
188
|
var _formatLocationAddress = require("./format-location-address");
|
|
198
|
-
|
|
199
189
|
var _generateDefinition = require("./generate-definition");
|
|
200
|
-
|
|
201
190
|
var _horizontalLine = require("./horizontal-line");
|
|
202
|
-
|
|
203
191
|
var _htmlTransformer = require("./html-transformer");
|
|
204
|
-
|
|
205
192
|
var _parseValue = require("./parse-value");
|
|
206
|
-
|
|
207
193
|
var _table = require("./table");
|
|
208
|
-
|
|
209
194
|
var _text = require("./text");
|
|
@@ -4,19 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.parseValue = parseValue;
|
|
7
|
-
|
|
8
7
|
var _lodash = require("lodash");
|
|
9
|
-
|
|
10
8
|
function parseValue(value) {
|
|
11
9
|
// map switches to text
|
|
12
10
|
if ((0, _lodash.isBoolean)(value)) {
|
|
13
11
|
return value ? 'Yes' : 'No';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
}
|
|
13
|
+
// handle empty arrays & objects
|
|
17
14
|
if ((0, _lodash.isObjectLike)(value) && (0, _lodash.isEmpty)(value)) {
|
|
18
15
|
return '';
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
return value || '';
|
|
22
18
|
}
|