@things-factory/pdf 7.0.33 → 7.0.37

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 (107) hide show
  1. package/client/bootstrap.js +6 -0
  2. package/client/pages/pdf-release/pdf-release-importer.ts +90 -0
  3. package/client/pages/pdf-release/pdf-release-list-page.ts +398 -0
  4. package/client/pages/pdf-template/pdf-template-importer.ts +86 -0
  5. package/client/pages/pdf-template/pdf-template-list-page.ts +491 -0
  6. package/client/route.ts +11 -0
  7. package/client/tsconfig.json +13 -0
  8. package/dist-client/bootstrap.d.ts +1 -0
  9. package/dist-client/bootstrap.js +6 -0
  10. package/dist-client/bootstrap.js.map +1 -0
  11. package/dist-client/pages/pdf-release/pdf-release-importer.d.ts +23 -0
  12. package/dist-client/pages/pdf-release/pdf-release-importer.js +93 -0
  13. package/dist-client/pages/pdf-release/pdf-release-importer.js.map +1 -0
  14. package/dist-client/pages/pdf-release/pdf-release-list-page.d.ts +66 -0
  15. package/dist-client/pages/pdf-release/pdf-release-list-page.js +370 -0
  16. package/dist-client/pages/pdf-release/pdf-release-list-page.js.map +1 -0
  17. package/dist-client/pages/pdf-template/pdf-template-importer.d.ts +23 -0
  18. package/dist-client/pages/pdf-template/pdf-template-importer.js +93 -0
  19. package/dist-client/pages/pdf-template/pdf-template-importer.js.map +1 -0
  20. package/dist-client/pages/pdf-template/pdf-template-list-page.d.ts +66 -0
  21. package/dist-client/pages/pdf-template/pdf-template-list-page.js +464 -0
  22. package/dist-client/pages/pdf-template/pdf-template-list-page.js.map +1 -0
  23. package/dist-client/route.d.ts +1 -0
  24. package/dist-client/route.js +11 -0
  25. package/dist-client/route.js.map +1 -0
  26. package/dist-client/tsconfig.tsbuildinfo +1 -0
  27. package/dist-server/controller/pdf-service.d.ts +4 -0
  28. package/dist-server/controller/pdf-service.js +34 -0
  29. package/dist-server/controller/pdf-service.js.map +1 -0
  30. package/dist-server/index.d.ts +1 -0
  31. package/dist-server/index.js +2 -0
  32. package/dist-server/index.js.map +1 -1
  33. package/dist-server/routers/pdf-private-router.d.ts +1 -0
  34. package/dist-server/routers/pdf-private-router.js +72 -0
  35. package/dist-server/routers/pdf-private-router.js.map +1 -0
  36. package/dist-server/routers/pdf-public-router.d.ts +1 -0
  37. package/dist-server/routers/{pdf-router.js → pdf-public-router.js} +6 -6
  38. package/dist-server/routers/pdf-public-router.js.map +1 -0
  39. package/dist-server/routes.js +13 -2
  40. package/dist-server/routes.js.map +1 -1
  41. package/dist-server/service/index.d.ts +7 -0
  42. package/dist-server/service/index.js +31 -0
  43. package/dist-server/service/index.js.map +1 -0
  44. package/dist-server/service/pdf-generate/pdf-generate-resolver.d.ts +6 -0
  45. package/dist-server/service/pdf-generate/pdf-generate-resolver.js +88 -0
  46. package/dist-server/service/pdf-generate/pdf-generate-resolver.js.map +1 -0
  47. package/dist-server/service/pdf-release/index.d.ts +6 -0
  48. package/dist-server/service/pdf-release/index.js +10 -0
  49. package/dist-server/service/pdf-release/index.js.map +1 -0
  50. package/dist-server/service/pdf-release/pdf-release-mutation.d.ts +10 -0
  51. package/dist-server/service/pdf-release/pdf-release-mutation.js +127 -0
  52. package/dist-server/service/pdf-release/pdf-release-mutation.js.map +1 -0
  53. package/dist-server/service/pdf-release/pdf-release-query.d.ts +11 -0
  54. package/dist-server/service/pdf-release/pdf-release-query.js +79 -0
  55. package/dist-server/service/pdf-release/pdf-release-query.js.map +1 -0
  56. package/dist-server/service/pdf-release/pdf-release-type.d.ts +20 -0
  57. package/dist-server/service/pdf-release/pdf-release-type.js +77 -0
  58. package/dist-server/service/pdf-release/pdf-release-type.js.map +1 -0
  59. package/dist-server/service/pdf-release/pdf-release.d.ts +27 -0
  60. package/dist-server/service/pdf-release/pdf-release.js +117 -0
  61. package/dist-server/service/pdf-release/pdf-release.js.map +1 -0
  62. package/dist-server/service/pdf-template/index.d.ts +6 -0
  63. package/dist-server/service/pdf-template/index.js +10 -0
  64. package/dist-server/service/pdf-template/index.js.map +1 -0
  65. package/dist-server/service/pdf-template/pdf-template-mutation.d.ts +10 -0
  66. package/dist-server/service/pdf-template/pdf-template-mutation.js +127 -0
  67. package/dist-server/service/pdf-template/pdf-template-mutation.js.map +1 -0
  68. package/dist-server/service/pdf-template/pdf-template-query.d.ts +11 -0
  69. package/dist-server/service/pdf-template/pdf-template-query.js +79 -0
  70. package/dist-server/service/pdf-template/pdf-template-query.js.map +1 -0
  71. package/dist-server/service/pdf-template/pdf-template-type.d.ts +32 -0
  72. package/dist-server/service/pdf-template/pdf-template-type.js +125 -0
  73. package/dist-server/service/pdf-template/pdf-template-type.js.map +1 -0
  74. package/dist-server/service/pdf-template/pdf-template.d.ts +28 -0
  75. package/dist-server/service/pdf-template/pdf-template.js +125 -0
  76. package/dist-server/service/pdf-template/pdf-template.js.map +1 -0
  77. package/dist-server/tsconfig.tsbuildinfo +1 -1
  78. package/helps/pdf/pdf-release.md +160 -0
  79. package/helps/pdf/pdf-template.md +160 -0
  80. package/package.json +15 -8
  81. package/server/controller/pdf-service.ts +35 -0
  82. package/server/index.ts +2 -0
  83. package/server/routers/pdf-private-router.ts +85 -0
  84. package/server/routers/{pdf-router.ts → pdf-public-router.ts} +4 -4
  85. package/server/routes.ts +14 -2
  86. package/server/service/index.ts +38 -0
  87. package/server/service/pdf-generate/pdf-generate-resolver.ts +81 -0
  88. package/server/service/pdf-release/index.ts +7 -0
  89. package/server/service/pdf-release/pdf-release-mutation.ts +138 -0
  90. package/server/service/pdf-release/pdf-release-query.ts +51 -0
  91. package/server/service/pdf-release/pdf-release-type.ts +55 -0
  92. package/server/service/pdf-release/pdf-release.ts +103 -0
  93. package/server/service/pdf-template/index.ts +7 -0
  94. package/server/service/pdf-template/pdf-template-mutation.ts +138 -0
  95. package/server/service/pdf-template/pdf-template-query.ts +51 -0
  96. package/server/service/pdf-template/pdf-template-type.ts +87 -0
  97. package/server/service/pdf-template/pdf-template.ts +108 -0
  98. package/server/tsconfig.json +10 -0
  99. package/things-factory.config.js +8 -1
  100. package/translations/en.json +11 -0
  101. package/translations/ja.json +9 -0
  102. package/translations/ko.json +11 -0
  103. package/translations/ms.json +9 -0
  104. package/translations/zh.json +9 -0
  105. package/dist-server/routers/pdf-router.d.ts +0 -1
  106. package/dist-server/routers/pdf-router.js.map +0 -1
  107. package/tsconfig.json +0 -9
@@ -0,0 +1,464 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import '@material/web/button/elevated-button.js';
4
+ import '@operato/data-grist/ox-grist.js';
5
+ import '@operato/data-grist/ox-filters-form.js';
6
+ import '@operato/data-grist/ox-record-creator.js';
7
+ import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
8
+ import { PageView, store } from '@operato/shell';
9
+ import { css, html } from 'lit';
10
+ import { customElement, property, query } from 'lit/decorators.js';
11
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
12
+ import { DataGrist } from '@operato/data-grist';
13
+ import { client } from '@operato/graphql';
14
+ import { i18next, localize } from '@operato/i18n';
15
+ import { notify, openPopup } from '@operato/layout';
16
+ import { OxPrompt } from '@operato/popup';
17
+ import { isMobileDevice } from '@operato/utils';
18
+ import { connect } from 'pwa-helpers/connect-mixin';
19
+ import gql from 'graphql-tag';
20
+ import { PDFTemplateImporter } from './pdf-template-importer';
21
+ let PDFTemplateListPage = class PDFTemplateListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.mode = isMobileDevice() ? 'CARD' : 'GRID';
25
+ }
26
+ static get scopedElements() {
27
+ return {
28
+ 'pdf-template-importer': PDFTemplateImporter
29
+ };
30
+ }
31
+ get context() {
32
+ return {
33
+ title: i18next.t('title.pdf-template list'),
34
+ search: {
35
+ handler: (search) => {
36
+ this.grist.searchText = search;
37
+ },
38
+ value: this.grist.searchText
39
+ },
40
+ filter: {
41
+ handler: () => {
42
+ this.grist.toggleHeadroom();
43
+ }
44
+ },
45
+ help: 'pdf/pdf-template',
46
+ actions: [
47
+ Object.assign({ title: i18next.t('button.save'), action: this._updatePDFTemplate.bind(this) }, CommonButtonStyles.save),
48
+ Object.assign({ title: i18next.t('button.delete'), action: this._deletePDFTemplate.bind(this) }, CommonButtonStyles.delete)
49
+ ],
50
+ exportable: {
51
+ name: i18next.t('title.pdf-template list'),
52
+ data: this.exportHandler.bind(this)
53
+ },
54
+ importable: {
55
+ handler: this.importHandler.bind(this)
56
+ }
57
+ };
58
+ }
59
+ render() {
60
+ const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
61
+ return html `
62
+ <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
63
+ <div slot="headroom" class="header">
64
+ <div class="filters">
65
+ <ox-filters-form autofocus without-search></ox-filters-form>
66
+
67
+ <div id="modes">
68
+ <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
69
+ <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
70
+ <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
71
+ </div>
72
+
73
+ <ox-record-creator id="add" .callback=${this.creationCallback.bind(this)}>
74
+ <button>
75
+ <md-icon>add</md-icon>
76
+ </button>
77
+ </ox-record-creator>
78
+ </div>
79
+ </div>
80
+ </ox-grist>
81
+ `;
82
+ }
83
+ async pageInitialized(lifecycle) {
84
+ this.gristConfig = {
85
+ list: {
86
+ fields: ['name', 'description'],
87
+ details: ['active', 'updatedAt']
88
+ },
89
+ columns: [
90
+ { type: 'gutter', gutterName: 'sequence' },
91
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
92
+ {
93
+ type: 'string',
94
+ name: 'name',
95
+ header: i18next.t('field.name'),
96
+ record: {
97
+ editable: true
98
+ },
99
+ filter: 'search',
100
+ sortable: true,
101
+ width: 150
102
+ },
103
+ {
104
+ type: 'string',
105
+ name: 'description',
106
+ header: i18next.t('field.description'),
107
+ record: {
108
+ editable: true
109
+ },
110
+ filter: 'search',
111
+ width: 200
112
+ },
113
+ {
114
+ type: 'checkbox',
115
+ name: 'active',
116
+ label: true,
117
+ header: i18next.t('field.active'),
118
+ record: {
119
+ editable: true
120
+ },
121
+ filter: true,
122
+ sortable: true,
123
+ width: 60
124
+ },
125
+ {
126
+ type: 'string',
127
+ name: 'state',
128
+ label: true,
129
+ header: i18next.t('field.state'),
130
+ record: {
131
+ editable: true
132
+ },
133
+ width: 120
134
+ },
135
+ {
136
+ type: 'template',
137
+ name: 'content_template',
138
+ label: true,
139
+ header: i18next.t('field.content_template'),
140
+ record: {
141
+ editable: true,
142
+ options: {
143
+ language: 'html'
144
+ }
145
+ },
146
+ width: 120
147
+ },
148
+ {
149
+ type: 'template',
150
+ name: 'header_template',
151
+ label: true,
152
+ header: i18next.t('field.header_template'),
153
+ record: {
154
+ editable: true,
155
+ options: {
156
+ language: 'html'
157
+ }
158
+ },
159
+ width: 120
160
+ },
161
+ {
162
+ type: 'template',
163
+ name: 'footer_template',
164
+ label: true,
165
+ header: i18next.t('field.footer_template'),
166
+ record: {
167
+ editable: true,
168
+ options: {
169
+ language: 'html'
170
+ }
171
+ },
172
+ width: 120
173
+ },
174
+ {
175
+ type: 'template',
176
+ name: 'cover_template',
177
+ label: true,
178
+ header: i18next.t('field.cover_template'),
179
+ record: {
180
+ editable: true,
181
+ options: {
182
+ language: 'html'
183
+ }
184
+ },
185
+ width: 120
186
+ },
187
+ {
188
+ type: 'template',
189
+ name: 'last_template',
190
+ label: true,
191
+ header: i18next.t('field.last_template'),
192
+ record: {
193
+ editable: true,
194
+ options: {
195
+ language: 'html'
196
+ }
197
+ },
198
+ width: 120
199
+ },
200
+ {
201
+ type: 'select',
202
+ name: 'page_size',
203
+ label: true,
204
+ header: i18next.t('field.page_size'),
205
+ record: {
206
+ editable: true,
207
+ options: ['', 'A4', 'B4']
208
+ },
209
+ width: 120
210
+ },
211
+ {
212
+ type: 'string',
213
+ name: 'watermark',
214
+ label: true,
215
+ header: i18next.t('field.watermark'),
216
+ record: {
217
+ editable: true
218
+ },
219
+ width: 120
220
+ },
221
+ {
222
+ type: 'resource-object',
223
+ name: 'updater',
224
+ header: i18next.t('field.updater'),
225
+ record: {
226
+ editable: false
227
+ },
228
+ sortable: true,
229
+ width: 120
230
+ },
231
+ {
232
+ type: 'datetime',
233
+ name: 'updatedAt',
234
+ header: i18next.t('field.updated_at'),
235
+ record: {
236
+ editable: false
237
+ },
238
+ sortable: true,
239
+ width: 180
240
+ }
241
+ ],
242
+ rows: {
243
+ appendable: false,
244
+ selectable: {
245
+ multiple: true
246
+ }
247
+ },
248
+ sorters: [
249
+ {
250
+ name: 'name'
251
+ }
252
+ ]
253
+ };
254
+ }
255
+ async pageUpdated(changes, lifecycle) {
256
+ if (this.active) {
257
+ // do something here when this page just became as active
258
+ }
259
+ }
260
+ async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
261
+ const response = await client.query({
262
+ query: gql `
263
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
264
+ responses: PDFTemplates(filters: $filters, pagination: $pagination, sortings: $sortings) {
265
+ items {
266
+ id
267
+ name
268
+ description
269
+ active
270
+ state
271
+ content_template
272
+ header_template
273
+ footer_template
274
+ cover_template
275
+ last_template
276
+ page_size
277
+ watermark
278
+ updater {
279
+ id
280
+ name
281
+ }
282
+ updatedAt
283
+ }
284
+ total
285
+ }
286
+ }
287
+ `,
288
+ variables: {
289
+ filters,
290
+ pagination: { page, limit },
291
+ sortings
292
+ }
293
+ });
294
+ return {
295
+ total: response.data.responses.total || 0,
296
+ records: response.data.responses.items || []
297
+ };
298
+ }
299
+ async _deletePDFTemplate() {
300
+ if (await OxPrompt.open({
301
+ title: i18next.t('text.are_you_sure'),
302
+ text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
303
+ confirmButton: { text: i18next.t('button.confirm') },
304
+ cancelButton: { text: i18next.t('button.cancel') }
305
+ })) {
306
+ const ids = this.grist.selected.map(record => record.id);
307
+ if (ids && ids.length > 0) {
308
+ const response = await client.mutate({
309
+ mutation: gql `
310
+ mutation ($ids: [String!]!) {
311
+ deletePDFTemplates(ids: $ids)
312
+ }
313
+ `,
314
+ variables: {
315
+ ids
316
+ }
317
+ });
318
+ if (!response.errors) {
319
+ this.grist.fetch();
320
+ notify({
321
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
322
+ });
323
+ }
324
+ }
325
+ }
326
+ }
327
+ async _updatePDFTemplate() {
328
+ let patches = this.grist.dirtyRecords;
329
+ if (patches && patches.length) {
330
+ patches = patches.map(patch => {
331
+ let patchField = patch.id ? { id: patch.id } : {};
332
+ const dirtyFields = patch.__dirtyfields__;
333
+ for (let key in dirtyFields) {
334
+ patchField[key] = dirtyFields[key].after;
335
+ }
336
+ patchField.cuFlag = patch.__dirty__;
337
+ return patchField;
338
+ });
339
+ const response = await client.mutate({
340
+ mutation: gql `
341
+ mutation ($patches: [PDFTemplatePatch!]!) {
342
+ updateMultiplePDFTemplate(patches: $patches) {
343
+ name
344
+ }
345
+ }
346
+ `,
347
+ variables: {
348
+ patches
349
+ }
350
+ });
351
+ if (!response.errors) {
352
+ this.grist.fetch();
353
+ }
354
+ }
355
+ }
356
+ async creationCallback(pdfTemplate) {
357
+ try {
358
+ const response = await client.query({
359
+ query: gql `
360
+ mutation ($pdfTemplate: NewPDFTemplate!) {
361
+ createPDFTemplate(pdfTemplate: $pdfTemplate) {
362
+ id
363
+ }
364
+ }
365
+ `,
366
+ variables: {
367
+ pdfTemplate
368
+ },
369
+ context: {
370
+ hasUpload: true
371
+ }
372
+ });
373
+ if (!response.errors) {
374
+ this.grist.fetch();
375
+ document.dispatchEvent(new CustomEvent('notify', {
376
+ detail: {
377
+ message: i18next.t('text.data_created_successfully')
378
+ }
379
+ }));
380
+ }
381
+ return true;
382
+ }
383
+ catch (ex) {
384
+ console.error(ex);
385
+ document.dispatchEvent(new CustomEvent('notify', {
386
+ detail: {
387
+ type: 'error',
388
+ message: i18next.t('text.error')
389
+ }
390
+ }));
391
+ return false;
392
+ }
393
+ }
394
+ async exportHandler() {
395
+ const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records;
396
+ const targetFieldSet = new Set(['id', 'name', 'description', 'active']);
397
+ return exportTargets.map(pdfTemplate => {
398
+ let tempObj = {};
399
+ for (const field of targetFieldSet) {
400
+ tempObj[field] = pdfTemplate[field];
401
+ }
402
+ return tempObj;
403
+ });
404
+ }
405
+ async importHandler(records) {
406
+ const popup = openPopup(html `
407
+ <pdf-template-importer
408
+ .pdfTemplates=${records}
409
+ @imported=${() => {
410
+ history.back();
411
+ this.grist.fetch();
412
+ }}
413
+ ></pdf-template-importer>
414
+ `, {
415
+ backdrop: true,
416
+ size: 'large',
417
+ title: i18next.t('title.import pdf-template')
418
+ });
419
+ popup.onclosed = () => {
420
+ this.grist.fetch();
421
+ };
422
+ }
423
+ };
424
+ PDFTemplateListPage.styles = [
425
+ ScrollbarStyles,
426
+ CommonGristStyles,
427
+ CommonHeaderStyles,
428
+ css `
429
+ :host {
430
+ display: flex;
431
+
432
+ width: 100%;
433
+
434
+ --grid-record-emphasized-background-color: #8b0000;
435
+ --grid-record-emphasized-color: #ff6b6b;
436
+ }
437
+
438
+ ox-grist {
439
+ overflow-y: auto;
440
+ flex: 1;
441
+ }
442
+
443
+ ox-filters-form {
444
+ flex: 1;
445
+ }
446
+ `
447
+ ];
448
+ __decorate([
449
+ property({ type: Object }),
450
+ __metadata("design:type", Object)
451
+ ], PDFTemplateListPage.prototype, "gristConfig", void 0);
452
+ __decorate([
453
+ property({ type: String }),
454
+ __metadata("design:type", String)
455
+ ], PDFTemplateListPage.prototype, "mode", void 0);
456
+ __decorate([
457
+ query('ox-grist'),
458
+ __metadata("design:type", DataGrist)
459
+ ], PDFTemplateListPage.prototype, "grist", void 0);
460
+ PDFTemplateListPage = __decorate([
461
+ customElement('pdf-template-list-page')
462
+ ], PDFTemplateListPage);
463
+ export { PDFTemplateListPage };
464
+ //# sourceMappingURL=pdf-template-list-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-template-list-page.js","sourceRoot":"","sources":["../../../client/pages/pdf-template/pdf-template-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,0CAA0C,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAgB,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAW,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAGtD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,OAAO,CAAC,KAAK,C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,CAAC,aAAa,CAAC,OAAO;QACzB,MAAM,KAAK,GAAG,SAAS,CACrB,IAAI,CAAA;;0BAEgB,OAAO;sBACX,GAAG,EAAE;YACf,OAAO,CAAC,IAAI,EAAE,CAAA;YACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;;OAEJ,EACD;YACE,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAC;SAC9C,CACF,CAAA;QAED,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC,CAAA;IACH,CAAC;;AAhdM,0BAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;CACF,AAvBY,CAuBZ;AAQ2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;kDAAA;AAnCjC,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CAkd/B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-record-creator.js'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup, OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { PDFTemplateImporter } from './pdf-template-importer'\n\n@customElement('pdf-template-list-page')\nexport class PDFTemplateListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'pdf-template-importer': PDFTemplateImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.pdf-template list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'pdf/pdf-template',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updatePDFTemplate.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deletePDFTemplate.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.pdf-template list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n\n <ox-record-creator id=\"add\" .callback=${this.creationCallback.bind(this)}>\n <button>\n <md-icon>add</md-icon>\n </button>\n </ox-record-creator>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n {\n type: 'string',\n name: 'state',\n label: true,\n header: i18next.t('field.state'),\n record: {\n editable: true\n },\n width: 120\n },\n {\n type: 'template',\n name: 'content_template',\n label: true,\n header: i18next.t('field.content_template'),\n record: {\n editable: true,\n options: {\n language: 'html'\n }\n },\n width: 120\n },\n {\n type: 'template',\n name: 'header_template',\n label: true,\n header: i18next.t('field.header_template'),\n record: {\n editable: true,\n options: {\n language: 'html'\n }\n },\n width: 120\n },\n {\n type: 'template',\n name: 'footer_template',\n label: true,\n header: i18next.t('field.footer_template'),\n record: {\n editable: true,\n options: {\n language: 'html'\n }\n },\n width: 120\n },\n {\n type: 'template',\n name: 'cover_template',\n label: true,\n header: i18next.t('field.cover_template'),\n record: {\n editable: true,\n options: {\n language: 'html'\n }\n },\n width: 120\n },\n {\n type: 'template',\n name: 'last_template',\n label: true,\n header: i18next.t('field.last_template'),\n record: {\n editable: true,\n options: {\n language: 'html'\n }\n },\n width: 120\n },\n {\n type: 'select',\n name: 'page_size',\n label: true,\n header: i18next.t('field.page_size'),\n record: {\n editable: true,\n options: ['', 'A4', 'B4']\n },\n width: 120\n },\n {\n type: 'string',\n name: 'watermark',\n label: true,\n header: i18next.t('field.watermark'),\n record: {\n editable: true\n },\n width: 120\n },\n\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n appendable: false,\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: PDFTemplates(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n active\n state\n content_template\n header_template\n footer_template\n cover_template\n last_template\n page_size\n watermark\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deletePDFTemplate() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deletePDFTemplates(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updatePDFTemplate() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [PDFTemplatePatch!]!) {\n updateMultiplePDFTemplate(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async creationCallback(pdfTemplate) {\n try {\n const response = await client.query({\n query: gql`\n mutation ($pdfTemplate: NewPDFTemplate!) {\n createPDFTemplate(pdfTemplate: $pdfTemplate) {\n id\n }\n }\n `,\n variables: {\n pdfTemplate\n },\n context: {\n hasUpload: true\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.data_created_successfully')\n }\n })\n )\n }\n\n return true\n } catch (ex) {\n console.error(ex)\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n type: 'error',\n message: i18next.t('text.error')\n }\n })\n )\n return false\n }\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(pdfTemplate => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = pdfTemplate[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <pdf-template-importer\n .pdfTemplates=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></pdf-template-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import pdf-template')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export default function route(page: string): "pdf-template-list-page" | "pdf-release-list" | undefined;
@@ -0,0 +1,11 @@
1
+ export default function route(page) {
2
+ switch (page) {
3
+ case 'pdf-template-list-page':
4
+ import('./pages/pdf-template/pdf-template-list-page');
5
+ return page;
6
+ case 'pdf-release-list':
7
+ import('./pages/pdf-release/pdf-release-list-page');
8
+ return page;
9
+ }
10
+ }
11
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../client/route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAY;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,wBAAwB;YAC3B,MAAM,CAAC,6CAA6C,CAAC,CAAA;YACrD,OAAO,IAAI,CAAA;QAEX,KAAK,kBAAkB;YACrB,MAAM,CAAC,2CAA2C,CAAC,CAAA;YACnD,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC","sourcesContent":["export default function route(page: string) {\n switch (page) {\n case 'pdf-template-list-page':\n import('./pages/pdf-template/pdf-template-list-page')\n return page\n \n case 'pdf-release-list':\n import('./pages/pdf-release/pdf-release-list-page')\n return page\n }\n }\n"]}