@lowdefy/docs 4.0.0-alpha.7 → 4.0.0-alpha.8
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/operators/client/filter_default_value.js +55 -0
- package/{public/modules/connectDocsearch.js → dist/operatorsClient.js} +1 -19
- package/{templates/blocks/schemaTransformer.js → dist/types.js} +5 -10
- package/package.json +19 -3
- package/404.yaml +0 -26
- package/CHANGELOG.md +0 -697
- package/actions/CallMethod.yaml +0 -57
- package/actions/JsAction.yaml +0 -281
- package/actions/Link.yaml +0 -120
- package/actions/Login.yaml +0 -123
- package/actions/Logout.yaml +0 -44
- package/actions/Message.yaml +0 -68
- package/actions/Notification.yaml +0 -84
- package/actions/Request.yaml +0 -70
- package/actions/Reset.yaml +0 -42
- package/actions/ResetValidation.yaml +0 -102
- package/actions/ScrollTo.yaml +0 -100
- package/actions/SetGlobal.yaml +0 -78
- package/actions/SetState.yaml +0 -85
- package/actions/Throw.yaml +0 -89
- package/actions/Validate.yaml +0 -104
- package/actions/Wait.yaml +0 -40
- package/blocks/all_icons.yaml +0 -803
- package/blocks/container/Affix.yaml +0 -26
- package/blocks/container/Alert.yaml +0 -27
- package/blocks/container/Badge.yaml +0 -27
- package/blocks/container/Box.yaml +0 -27
- package/blocks/container/Card.yaml +0 -29
- package/blocks/container/Collapse.yaml +0 -38
- package/blocks/container/Comment.yaml +0 -43
- package/blocks/container/ConfirmModal.yaml +0 -36
- package/blocks/container/Descriptions.yaml +0 -51
- package/blocks/container/Drawer.yaml +0 -46
- package/blocks/container/Label.yaml +0 -28
- package/blocks/container/Modal.yaml +0 -46
- package/blocks/container/PageHCF.yaml +0 -28
- package/blocks/container/PageHCSF.yaml +0 -29
- package/blocks/container/PageHSCF.yaml +0 -29
- package/blocks/container/PageHeaderMenu.yaml +0 -52
- package/blocks/container/PageSHCF.yaml +0 -29
- package/blocks/container/PageSiderMenu.yaml +0 -53
- package/blocks/container/Result.yaml +0 -34
- package/blocks/container/Span.yaml +0 -27
- package/blocks/container/Spin.yaml +0 -27
- package/blocks/container/Tabs.yaml +0 -41
- package/blocks/container/Tooltip.yaml +0 -38
- package/blocks/display/Anchor.yaml +0 -25
- package/blocks/display/Avatar.yaml +0 -23
- package/blocks/display/Breadcrumb.yaml +0 -28
- package/blocks/display/Button.yaml +0 -43
- package/blocks/display/DangerousHtml.yaml +0 -62
- package/blocks/display/DangerousMarkdown.yaml +0 -46
- package/blocks/display/Divider.yaml +0 -23
- package/blocks/display/EChart.yaml +0 -53
- package/blocks/display/Html.yaml +0 -50
- package/blocks/display/Icon.yaml +0 -23
- package/blocks/display/Img.yaml +0 -40
- package/blocks/display/Markdown.yaml +0 -31
- package/blocks/display/MarkdownWithCode.yaml +0 -46
- package/blocks/display/Menu.yaml +0 -48
- package/blocks/display/Message.yaml +0 -34
- package/blocks/display/MobileMenu.yaml +0 -47
- package/blocks/display/Notification.yaml +0 -34
- package/blocks/display/Paragraph.yaml +0 -30
- package/blocks/display/Progress.yaml +0 -52
- package/blocks/display/Skeleton.yaml +0 -27
- package/blocks/display/Statistic.yaml +0 -35
- package/blocks/display/Title.yaml +0 -32
- package/blocks/input/AutoComplete.yaml +0 -30
- package/blocks/input/ButtonSelector.yaml +0 -36
- package/blocks/input/CheckboxSelector.yaml +0 -36
- package/blocks/input/CheckboxSwitch.yaml +0 -56
- package/blocks/input/ChromeColorSelector.yaml +0 -24
- package/blocks/input/CircleColorSelector.yaml +0 -24
- package/blocks/input/ColorSelector.yaml +0 -24
- package/blocks/input/CompactColorSelector.yaml +0 -24
- package/blocks/input/DateRangeSelector.yaml +0 -26
- package/blocks/input/DateSelector.yaml +0 -26
- package/blocks/input/DateTimeSelector.yaml +0 -28
- package/blocks/input/GithubColorSelector.yaml +0 -24
- package/blocks/input/MonthSelector.yaml +0 -26
- package/blocks/input/MultipleSelector.yaml +0 -117
- package/blocks/input/NumberInput.yaml +0 -24
- package/blocks/input/Pagination.yaml +0 -33
- package/blocks/input/ParagraphInput.yaml +0 -32
- package/blocks/input/PasswordInput.yaml +0 -48
- package/blocks/input/RadioSelector.yaml +0 -36
- package/blocks/input/RatingSlider.yaml +0 -24
- package/blocks/input/S3UploadButton.yaml +0 -28
- package/blocks/input/Selector.yaml +0 -98
- package/blocks/input/SliderColorSelector.yaml +0 -24
- package/blocks/input/SwatchesColorSelector.yaml +0 -24
- package/blocks/input/Switch.yaml +0 -24
- package/blocks/input/TextArea.yaml +0 -27
- package/blocks/input/TextInput.yaml +0 -59
- package/blocks/input/TitleInput.yaml +0 -32
- package/blocks/input/TwitterColorSelector.yaml +0 -24
- package/blocks/input/WeekSelector.yaml +0 -26
- package/blocks/list/ControlledList.yaml +0 -191
- package/blocks/list/List.yaml +0 -157
- package/blocks/list/TimelineList.yaml +0 -136
- package/body.html +0 -1
- package/concepts/blocks.yaml +0 -249
- package/concepts/cli.yaml +0 -173
- package/concepts/connections-and-requests.yaml +0 -114
- package/concepts/context-and-state.yaml +0 -82
- package/concepts/custom-blocks.yaml +0 -190
- package/concepts/custom-code.yaml +0 -197
- package/concepts/events-and-actions.yaml +0 -224
- package/concepts/hosting-files.yaml +0 -50
- package/concepts/layout.yaml +0 -1464
- package/concepts/lists.yaml +0 -162
- package/concepts/lowdefy-schema.yaml +0 -245
- package/concepts/operators.yaml +0 -66
- package/concepts/overview.yaml +0 -48
- package/concepts/secrets.yaml +0 -56
- package/connections/AWSS3.yaml +0 -228
- package/connections/AmazonRedshift.yaml +0 -75
- package/connections/AxiosHttp.yaml +0 -194
- package/connections/Elasticsearch.yaml +0 -378
- package/connections/GoogleSheet.yaml +0 -332
- package/connections/Knex.yaml +0 -181
- package/connections/KnexRequests.md +0 -121
- package/connections/MSSQL.yaml +0 -90
- package/connections/MariaDB.yaml +0 -77
- package/connections/MongoDB.yaml +0 -581
- package/connections/MySQL.yaml +0 -92
- package/connections/OracleDB.yaml +0 -73
- package/connections/PostgreSQL.yaml +0 -99
- package/connections/Redis.yaml +0 -147
- package/connections/SQLite.yaml +0 -94
- package/connections/SendGridMail.yaml +0 -113
- package/connections/Stripe.yaml +0 -139
- package/deployment/aws-lambda.yaml +0 -128
- package/deployment/docker.yaml +0 -118
- package/deployment/netlify.yaml +0 -69
- package/deployment/node-server.yaml +0 -111
- package/head.html +0 -7
- package/howto/generate-csv.yaml.njk +0 -252
- package/howto/generate-pdf.yaml.njk +0 -651
- package/howto/generateCsv/lowdefy.yaml +0 -64
- package/howto/generateCsv/public/csvMake.js +0 -27
- package/howto/generatePdf/inv_template.yaml +0 -200
- package/howto/generatePdf/lowdefy.yaml +0 -117
- package/howto/generatePdf/my_header.html +0 -1
- package/howto/generatePdf/public/logo_example.png +0 -0
- package/howto/generatePdf/public/modules/importUmd.js +0 -7
- package/howto/generatePdf/public/modules/pdfMake.js +0 -7
- package/howto/generatePdf/public/modules/vfs_fonts.js +0 -12
- package/howto/use-refrences.md +0 -5
- package/introduction.yaml +0 -100
- package/lowdefy.yaml +0 -66
- package/menus.yaml +0 -832
- package/operators/_actions.yaml +0 -123
- package/operators/_and.yaml +0 -90
- package/operators/_args.yaml +0 -79
- package/operators/_array.yaml +0 -326
- package/operators/_base64.yaml +0 -56
- package/operators/_change_case.yaml +0 -347
- package/operators/_date.yaml +0 -71
- package/operators/_diff.yaml +0 -75
- package/operators/_divide.yaml +0 -46
- package/operators/_eq.yaml +0 -67
- package/operators/_event.yaml +0 -103
- package/operators/_format.yaml +0 -209
- package/operators/_function.yaml +0 -66
- package/operators/_get.yaml +0 -108
- package/operators/_global.yaml +0 -107
- package/operators/_gt.yaml +0 -65
- package/operators/_gte.yaml +0 -65
- package/operators/_hash.yaml +0 -109
- package/operators/_if.yaml +0 -44
- package/operators/_if_none.yaml +0 -61
- package/operators/_index.yaml +0 -65
- package/operators/_input.yaml +0 -114
- package/operators/_js.yaml +0 -189
- package/operators/_json.yaml +0 -128
- package/operators/_list_contexts.yaml +0 -37
- package/operators/_location.yaml +0 -59
- package/operators/_log.yaml +0 -36
- package/operators/_lt.yaml +0 -65
- package/operators/_lte.yaml +0 -65
- package/operators/_math.yaml +0 -374
- package/operators/_media.yaml +0 -86
- package/operators/_menu.yaml +0 -81
- package/operators/_mql.yaml +0 -101
- package/operators/_ne.yaml +0 -77
- package/operators/_not.yaml +0 -47
- package/operators/_number.yaml +0 -157
- package/operators/_nunjucks.yaml +0 -73
- package/operators/_object.yaml +0 -193
- package/operators/_operator.yaml +0 -47
- package/operators/_or.yaml +0 -81
- package/operators/_product.yaml +0 -59
- package/operators/_random.yaml +0 -104
- package/operators/_ref.yaml +0 -266
- package/operators/_regex.yaml +0 -83
- package/operators/_request.yaml +0 -50
- package/operators/_secret.yaml +0 -74
- package/operators/_state.yaml +0 -114
- package/operators/_string.yaml +0 -283
- package/operators/_subtract.yaml +0 -38
- package/operators/_sum.yaml +0 -59
- package/operators/_switch.yaml +0 -51
- package/operators/_type.yaml +0 -92
- package/operators/_uri.yaml +0 -56
- package/operators/_url_query.yaml +0 -120
- package/operators/_user.yaml +0 -107
- package/operators/_uuid.yaml +0 -114
- package/operators/_var.yaml +0 -105
- package/operators/_yaml.yaml +0 -107
- package/pages.yaml +0 -227
- package/public/images/authors/gervwyk.jpeg +0 -0
- package/public/images/authors/sandile.jpeg +0 -0
- package/public/images/howto/header_generate_csv.jpg +0 -0
- package/public/images/howto/header_generate_pdf.jpg +0 -0
- package/public/logo_example.png +0 -0
- package/public/lowdefy_app_schema.png +0 -0
- package/public/modules/csvMake.js +0 -27
- package/public/modules/filterDefaultValue.js +0 -48
- package/public/modules/importUmd.js +0 -7
- package/public/modules/index.js +0 -5
- package/public/modules/pdfMake.js +0 -7
- package/public/modules/test/filterDefaultValue.test.js +0 -91
- package/public/modules/vfs_fonts.js +0 -12
- package/public/sitemap.xml +0 -1024
- package/templates/actions.yaml.njk +0 -68
- package/templates/blocks/defaultValueTransformer.js +0 -53
- package/templates/blocks/exampleTransformer.js +0 -81
- package/templates/blocks/layout.yaml +0 -114
- package/templates/blocks/propertiesFormTransformer.js +0 -419
- package/templates/blocks/propertiesGetterTransformer.js +0 -132
- package/templates/blocks/schema.yaml.njk +0 -42
- package/templates/blocks/style.yaml +0 -26
- package/templates/blocks/template.yaml.njk +0 -495
- package/templates/blog.yaml.njk +0 -221
- package/templates/cli_command.yaml.njk +0 -37
- package/templates/footer.yaml.njk +0 -604
- package/templates/general.yaml.njk +0 -124
- package/templates/generateSitemap.js +0 -41
- package/templates/header.yaml +0 -138
- package/templates/navigation_buttons.yaml +0 -68
- package/templates/operators.yaml.njk +0 -82
- package/templates/operatorsMethodTransformer.js +0 -119
- package/templates/test/array.test.js +0 -1335
- package/templates/test/boolean.test.js +0 -98
- package/templates/test/button.test.js +0 -166
- package/templates/test/color.test.js +0 -126
- package/templates/test/enum.test.js +0 -105
- package/templates/test/icon.test.js +0 -109
- package/templates/test/integer.test.js +0 -99
- package/templates/test/manual.test.js +0 -238
- package/templates/test/number.test.js +0 -99
- package/templates/test/object.test.js +0 -434
- package/templates/test/oneOf.test.js +0 -794
- package/templates/test/string.test.js +0 -98
- package/templates/test/yaml.test.js +0 -605
- package/tutorial/next-steps.yaml +0 -83
- package/tutorial/tutorial-actions-operators-config.yaml +0 -142
- package/tutorial/tutorial-actions-operators.yaml +0 -436
- package/tutorial/tutorial-add-blocks-config.yaml +0 -109
- package/tutorial/tutorial-add-blocks.yaml +0 -195
- package/tutorial/tutorial-create-page-config.yaml +0 -77
- package/tutorial/tutorial-create-page.yaml +0 -196
- package/tutorial/tutorial-deploy.yaml +0 -146
- package/tutorial/tutorial-requests-config.yaml +0 -186
- package/tutorial/tutorial-requests.yaml +0 -338
- package/tutorial/tutorial-start.yaml +0 -282
- package/users/login-and-logout.yaml +0 -164
- package/users/openid-connect.yaml +0 -84
- package/users/protected-pages.yaml +0 -67
- package/users/roles.yaml +0 -70
- package/users/user-object.yaml +0 -73
- package/users/users-introduction.yaml +0 -80
- package/version.yaml +0 -1
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
lowdefy: 3.23.2
|
|
2
|
-
name: Generate PDF from data with Lowdefy
|
|
3
|
-
|
|
4
|
-
app:
|
|
5
|
-
html:
|
|
6
|
-
appendHead: |
|
|
7
|
-
<script type="module" src="/public/csvMake.js"></script>
|
|
8
|
-
|
|
9
|
-
pages:
|
|
10
|
-
- id: example
|
|
11
|
-
type: PageHeaderMenu
|
|
12
|
-
properties:
|
|
13
|
-
title: Example
|
|
14
|
-
areas:
|
|
15
|
-
content:
|
|
16
|
-
justify: center
|
|
17
|
-
blocks:
|
|
18
|
-
- id: generate_csv
|
|
19
|
-
type: Button
|
|
20
|
-
properties:
|
|
21
|
-
size: large
|
|
22
|
-
title: Generate a CSV
|
|
23
|
-
color: '#1890ff'
|
|
24
|
-
events:
|
|
25
|
-
onClick:
|
|
26
|
-
[]
|
|
27
|
-
# - id: generate_csv
|
|
28
|
-
# type: JsAction # TODO:
|
|
29
|
-
# params:
|
|
30
|
-
# name: csvMake
|
|
31
|
-
# args:
|
|
32
|
-
# - profiles.csv # csv filename
|
|
33
|
-
# - - Username: booker12 # an array of data, usually a reference
|
|
34
|
-
# Identifier: 9012
|
|
35
|
-
# FirstName: Rachel
|
|
36
|
-
# LastName: Booker
|
|
37
|
-
# - Username: grey07
|
|
38
|
-
# Identifier: 2070
|
|
39
|
-
# FirstName: Laura
|
|
40
|
-
# LastName: Grey
|
|
41
|
-
# - Username: johnson81
|
|
42
|
-
# Identifier: 4081
|
|
43
|
-
# FirstName: Craig
|
|
44
|
-
# LastName: Johnson
|
|
45
|
-
# - Username: jenkins46
|
|
46
|
-
# Identifier: 9346
|
|
47
|
-
# FirstName: Mary
|
|
48
|
-
# LastName: Jenkins
|
|
49
|
-
# - Username: smith79
|
|
50
|
-
# Identifier: 5079
|
|
51
|
-
# FirstName: Jamie
|
|
52
|
-
# LastName: Smith
|
|
53
|
-
# - - Username # an array of field definitions
|
|
54
|
-
# - Identifier
|
|
55
|
-
# - FirstName
|
|
56
|
-
# - LastName
|
|
57
|
-
footer:
|
|
58
|
-
blocks:
|
|
59
|
-
- id: footer
|
|
60
|
-
type: Paragraph
|
|
61
|
-
properties:
|
|
62
|
-
type: secondary
|
|
63
|
-
content: |
|
|
64
|
-
Made by a Lowdefy 🤖
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const csvMakeFn = async (context, filename, data, fields) => {
|
|
2
|
-
if (!Array.isArray(data) || typeof data[0] !== 'object') {
|
|
3
|
-
throw new Error('csvMake data takes an array of objects');
|
|
4
|
-
}
|
|
5
|
-
if (!fields) {
|
|
6
|
-
fields = Object.keys(data[0]);
|
|
7
|
-
}
|
|
8
|
-
const arrays = [fields];
|
|
9
|
-
data.forEach((obj) => arrays.push(fields.map((field) => obj[field])));
|
|
10
|
-
const csv = arrays
|
|
11
|
-
.map((row) =>
|
|
12
|
-
row
|
|
13
|
-
.map((cell) => (typeof cell === 'undefined' || cell === null ? '' : cell))
|
|
14
|
-
.map(String)
|
|
15
|
-
.map((v) => v.replaceAll('"', '""'))
|
|
16
|
-
.map((v) => `"${v}"`)
|
|
17
|
-
.join(',')
|
|
18
|
-
)
|
|
19
|
-
.join('\r\n');
|
|
20
|
-
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
|
|
21
|
-
const url = URL.createObjectURL(blob);
|
|
22
|
-
const el = document.createElement('a');
|
|
23
|
-
el.href = url;
|
|
24
|
-
el.setAttribute('download', filename);
|
|
25
|
-
el.click();
|
|
26
|
-
};
|
|
27
|
-
window.lowdefy.registerJsAction('csvMake', csvMakeFn);
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
- _nunjucks:
|
|
2
|
-
on:
|
|
3
|
-
_state: invoice
|
|
4
|
-
template: 'INV-{{ id }}-{{ inv_date | date("DD-MM-YYYY") }}.pdf'
|
|
5
|
-
- pageMargins: [50, 25, 50, 70]
|
|
6
|
-
defaultStyle:
|
|
7
|
-
fontSize: 10
|
|
8
|
-
images:
|
|
9
|
-
logo:
|
|
10
|
-
_string.concat:
|
|
11
|
-
- _location: origin
|
|
12
|
-
- /public/logo_example.png
|
|
13
|
-
footer:
|
|
14
|
-
_function:
|
|
15
|
-
- columns:
|
|
16
|
-
- qr:
|
|
17
|
-
_string.concat:
|
|
18
|
-
- _location: origin
|
|
19
|
-
- /invoice?id="
|
|
20
|
-
- _state: invoice.id
|
|
21
|
-
- '"'
|
|
22
|
-
margin: [50, 0, 0, 0]
|
|
23
|
-
fit: '64'
|
|
24
|
-
- alignment: 'right'
|
|
25
|
-
fontSize: 7
|
|
26
|
-
margin: [0, 0, 50, 0]
|
|
27
|
-
text:
|
|
28
|
-
__nunjucks:
|
|
29
|
-
template: 'Page {{ page }} of {{ total }}'
|
|
30
|
-
on:
|
|
31
|
-
page:
|
|
32
|
-
__args: 0
|
|
33
|
-
total:
|
|
34
|
-
__args: 1
|
|
35
|
-
content:
|
|
36
|
-
- columns:
|
|
37
|
-
- width: 'auto'
|
|
38
|
-
margin: [0, 20, 0, 0]
|
|
39
|
-
stack:
|
|
40
|
-
- fontSize: 9
|
|
41
|
-
text: |
|
|
42
|
-
|
|
43
|
-
- fontSize: 7
|
|
44
|
-
text: |
|
|
45
|
-
Example Services Ltd.
|
|
46
|
-
112 Street Name
|
|
47
|
-
City, State 12345
|
|
48
|
-
Country
|
|
49
|
-
001-AB
|
|
50
|
-
|
|
51
|
-
+00-1234-5566
|
|
52
|
-
info@example.com
|
|
53
|
-
|
|
54
|
-
Vat Number: 444 5555 0000
|
|
55
|
-
|
|
56
|
-
- width: '*'
|
|
57
|
-
text: ' '
|
|
58
|
-
- width: 110
|
|
59
|
-
stack:
|
|
60
|
-
- width: 110
|
|
61
|
-
image: logo
|
|
62
|
-
- margin: [0, 5, 0, 0]
|
|
63
|
-
alignment: right
|
|
64
|
-
fontSize: 7
|
|
65
|
-
text: |
|
|
66
|
-
Example Services Ltd.
|
|
67
|
-
Reg Number: 2001/22224/09
|
|
68
|
-
|
|
69
|
-
- margin: [0, 20, 0, 20]
|
|
70
|
-
text: Customer Invoice
|
|
71
|
-
bold: true
|
|
72
|
-
alignment: center
|
|
73
|
-
fontSize: 14
|
|
74
|
-
- columns:
|
|
75
|
-
- width: 150
|
|
76
|
-
bold: true
|
|
77
|
-
text: |
|
|
78
|
-
INVOICE NUMBER:
|
|
79
|
-
DATE ISSUED:
|
|
80
|
-
ACCOUNT NUMBER:
|
|
81
|
-
- width: '*'
|
|
82
|
-
text:
|
|
83
|
-
_nunjucks:
|
|
84
|
-
template: |
|
|
85
|
-
{{ id }}
|
|
86
|
-
{{ inv_date | date("YYYY/MM/DD") }}
|
|
87
|
-
{{ account_id }}
|
|
88
|
-
on:
|
|
89
|
-
_state: invoice
|
|
90
|
-
- width: 150
|
|
91
|
-
bold: true
|
|
92
|
-
text: |
|
|
93
|
-
CUSTOMER:
|
|
94
|
-
ADDRESS:
|
|
95
|
-
- width: '*'
|
|
96
|
-
text:
|
|
97
|
-
_nunjucks:
|
|
98
|
-
template: |
|
|
99
|
-
{{ customer.name }}
|
|
100
|
-
{{ customer.address }}
|
|
101
|
-
on:
|
|
102
|
-
_state: invoice
|
|
103
|
-
|
|
104
|
-
- layout: 'lightHorizontalLines'
|
|
105
|
-
margin: [0, 10, 0, 0]
|
|
106
|
-
table:
|
|
107
|
-
widths: [70, '*', 70, 70, 70]
|
|
108
|
-
headerRows: 1
|
|
109
|
-
body:
|
|
110
|
-
_json.parse:
|
|
111
|
-
_nunjucks:
|
|
112
|
-
on:
|
|
113
|
-
services:
|
|
114
|
-
_state: invoice.services
|
|
115
|
-
template: |
|
|
116
|
-
[
|
|
117
|
-
[
|
|
118
|
-
{ "text": "ITEM CODE", "bold": true },
|
|
119
|
-
{ "text": "SERVICE", "bold": true },
|
|
120
|
-
{ "text": "UNIT PRICE", "bold": true, "alignment": "right" },
|
|
121
|
-
{ "text": "QTY", "bold": true, "alignment": "right" },
|
|
122
|
-
{ "text": "COST", "bold": true, "alignment": "right" }
|
|
123
|
-
],
|
|
124
|
-
{% for item in services %}
|
|
125
|
-
[
|
|
126
|
-
"{{ loop.index }}: {{ item.code }}",
|
|
127
|
-
"{{ item.name | safe }}",
|
|
128
|
-
{ "text": "{{ ( item.price / item.qty ).toFixed(2) }}", "alignment": "right"},
|
|
129
|
-
{ "text": "{{ item.qty }}", "alignment": "right"},
|
|
130
|
-
{ "text": "{{ item.price.toFixed(2) }}", "alignment": "right"}
|
|
131
|
-
{% if loop.last %} ] {% else %} ], {% endif %}
|
|
132
|
-
{% endfor %}
|
|
133
|
-
]
|
|
134
|
-
- layout: 'headerLineOnly'
|
|
135
|
-
margin: [0, -5, 0, 0]
|
|
136
|
-
table:
|
|
137
|
-
widths: ['*', 70, 70, 70]
|
|
138
|
-
headerRows: 1
|
|
139
|
-
body:
|
|
140
|
-
- - ''
|
|
141
|
-
- ''
|
|
142
|
-
- ''
|
|
143
|
-
- ''
|
|
144
|
-
- - ''
|
|
145
|
-
- alignment: right
|
|
146
|
-
text: 'Subtotal:'
|
|
147
|
-
- ''
|
|
148
|
-
- alignment: right
|
|
149
|
-
text:
|
|
150
|
-
_number.toFixed:
|
|
151
|
-
- _state: invoice.subtotal
|
|
152
|
-
- 2
|
|
153
|
-
- - ''
|
|
154
|
-
- alignment: right
|
|
155
|
-
text: 'Discount (5%):'
|
|
156
|
-
- ''
|
|
157
|
-
- alignment: right
|
|
158
|
-
text:
|
|
159
|
-
_number.toFixed:
|
|
160
|
-
- _state: invoice.discount
|
|
161
|
-
- 2
|
|
162
|
-
- - ''
|
|
163
|
-
- alignment: right
|
|
164
|
-
text: 'VAT (15%):'
|
|
165
|
-
- ''
|
|
166
|
-
- alignment: right
|
|
167
|
-
text:
|
|
168
|
-
_number.toFixed:
|
|
169
|
-
- _state: invoice.vat
|
|
170
|
-
- 2
|
|
171
|
-
- - ''
|
|
172
|
-
- alignment: right
|
|
173
|
-
text: 'Total:'
|
|
174
|
-
- ''
|
|
175
|
-
- alignment: right
|
|
176
|
-
text:
|
|
177
|
-
_number.toFixed:
|
|
178
|
-
- _state: invoice.total
|
|
179
|
-
- 2
|
|
180
|
-
- layout: 'headerLineOnly'
|
|
181
|
-
margin: [0, -5, 0, 0]
|
|
182
|
-
table:
|
|
183
|
-
widths: ['*', 70, 70, 70]
|
|
184
|
-
headerRows: 1
|
|
185
|
-
body:
|
|
186
|
-
- - ''
|
|
187
|
-
- ''
|
|
188
|
-
- ''
|
|
189
|
-
- ''
|
|
190
|
-
- - ''
|
|
191
|
-
- alignment: right
|
|
192
|
-
bold: true
|
|
193
|
-
text: 'BALANCE DUE:'
|
|
194
|
-
- ''
|
|
195
|
-
- alignment: right
|
|
196
|
-
bold: true
|
|
197
|
-
text:
|
|
198
|
-
_number.toFixed:
|
|
199
|
-
- _state: invoice.balance
|
|
200
|
-
- 2
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
lowdefy: 3.23.2
|
|
2
|
-
name: Generate PDF from data with Lowdefy
|
|
3
|
-
|
|
4
|
-
app:
|
|
5
|
-
html:
|
|
6
|
-
appendHead:
|
|
7
|
-
_ref: my_header.html
|
|
8
|
-
|
|
9
|
-
pages:
|
|
10
|
-
- id: example
|
|
11
|
-
type: PageHeaderMenu
|
|
12
|
-
properties:
|
|
13
|
-
title: Example
|
|
14
|
-
events:
|
|
15
|
-
onEnter:
|
|
16
|
-
- id: init_data
|
|
17
|
-
type: SetState
|
|
18
|
-
params:
|
|
19
|
-
invoice:
|
|
20
|
-
id: '0030135'
|
|
21
|
-
account_id: 'A-11344'
|
|
22
|
-
inv_date:
|
|
23
|
-
_date: now
|
|
24
|
-
subtotal: 397.034
|
|
25
|
-
discount: -19.8517
|
|
26
|
-
vat: 59.5551
|
|
27
|
-
total: 436.7374
|
|
28
|
-
balance: 413.2330
|
|
29
|
-
customer:
|
|
30
|
-
name: Service Center
|
|
31
|
-
phone: +123-456-7890
|
|
32
|
-
vat_nmr: 12-333-4567
|
|
33
|
-
address: |
|
|
34
|
-
123 Main St.
|
|
35
|
-
Anytown
|
|
36
|
-
CA
|
|
37
|
-
US
|
|
38
|
-
9999
|
|
39
|
-
services:
|
|
40
|
-
- name: Hosting and Maintannce
|
|
41
|
-
qty: 1
|
|
42
|
-
price: 235.90
|
|
43
|
-
code: X12-33C
|
|
44
|
-
- name: Developer Hours
|
|
45
|
-
qty: 16
|
|
46
|
-
price: 60.345
|
|
47
|
-
code: X12-39A
|
|
48
|
-
- name: Designer Hours
|
|
49
|
-
qty: 4
|
|
50
|
-
price: 40.122
|
|
51
|
-
code: X12-21A
|
|
52
|
-
- name: Project Management
|
|
53
|
-
qty: 2
|
|
54
|
-
price: 60.667
|
|
55
|
-
code: X12-49A
|
|
56
|
-
areas:
|
|
57
|
-
content:
|
|
58
|
-
justify: center
|
|
59
|
-
blocks:
|
|
60
|
-
- id: content_card
|
|
61
|
-
type: Card
|
|
62
|
-
style:
|
|
63
|
-
maxWidth: 800
|
|
64
|
-
blocks:
|
|
65
|
-
- id: content
|
|
66
|
-
type: Result
|
|
67
|
-
properties:
|
|
68
|
-
title: Generate PDF from data with Lowdefy
|
|
69
|
-
subTitle: <a href="https://docs.lowdefy.com/generate-pdf-document-from-data">Read the full how to guide</a>
|
|
70
|
-
icon:
|
|
71
|
-
name: AiTwoTonePrinter
|
|
72
|
-
color: '#ff0000'
|
|
73
|
-
areas:
|
|
74
|
-
extra:
|
|
75
|
-
gutter: 16
|
|
76
|
-
blocks:
|
|
77
|
-
- id: customer_description
|
|
78
|
-
type: Descriptions
|
|
79
|
-
properties:
|
|
80
|
-
bordered: true
|
|
81
|
-
size: small
|
|
82
|
-
title:
|
|
83
|
-
_string.concat:
|
|
84
|
-
- 'Customer Details: '
|
|
85
|
-
- _state: invoice.account_id
|
|
86
|
-
column: 2
|
|
87
|
-
items:
|
|
88
|
-
_change_case.capitalCase:
|
|
89
|
-
options:
|
|
90
|
-
convertKeys: true
|
|
91
|
-
on:
|
|
92
|
-
_state: invoice.customer
|
|
93
|
-
|
|
94
|
-
- id: generate_pdf_button
|
|
95
|
-
type: Button
|
|
96
|
-
properties:
|
|
97
|
-
size: large
|
|
98
|
-
title: Generate Invoice
|
|
99
|
-
color: '#1890ff'
|
|
100
|
-
events:
|
|
101
|
-
onClick:
|
|
102
|
-
[]
|
|
103
|
-
# - id: make_pdf
|
|
104
|
-
# type: JsAction # TODO:
|
|
105
|
-
# params:
|
|
106
|
-
# name: pdfMake
|
|
107
|
-
# args:
|
|
108
|
-
# _ref:
|
|
109
|
-
# path: inv_template.yaml
|
|
110
|
-
footer:
|
|
111
|
-
blocks:
|
|
112
|
-
- id: footer
|
|
113
|
-
type: Paragraph
|
|
114
|
-
properties:
|
|
115
|
-
type: secondary
|
|
116
|
-
content: |
|
|
117
|
-
Made by a Lowdefy 🤖
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<script defer type="module" src="/public/modules/pdfMake.js"></script>
|
|
Binary file
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import importUmd from './importUmd.js';
|
|
2
|
-
import vfs from './vfs_fonts.js';
|
|
3
|
-
const pdfMake = await importUmd(`https://cdn.jsdelivr.net/npm/pdfmake@0.2.2/build/pdfmake.min.js`);
|
|
4
|
-
const pdfMakeFn = async (context, filename, docDefinition, tableLayouts, fonts) => {
|
|
5
|
-
await pdfMake.createPdf(docDefinition, tableLayouts, fonts, vfs).download(filename);
|
|
6
|
-
};
|
|
7
|
-
window.lowdefy.registerJsAction('pdfMake', pdfMakeFn);
|