@schukai/monster 3.53.0 → 3.55.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/datasource/rest.mjs +358 -309
  4. package/source/components/datatable/datatable/header.mjs +8 -0
  5. package/source/components/datatable/datatable.mjs +606 -557
  6. package/source/components/datatable/embedded-pagination.mjs +50 -62
  7. package/source/components/datatable/filter/util.mjs +122 -0
  8. package/source/components/datatable/filter.mjs +893 -708
  9. package/source/components/datatable/pagination.mjs +335 -310
  10. package/source/components/datatable/status.mjs +248 -0
  11. package/source/components/datatable/style/datatable.pcss +1 -0
  12. package/source/components/datatable/style/embedded-pagination.pcss +59 -2
  13. package/source/components/datatable/style/filter.pcss +4 -0
  14. package/source/components/datatable/style/pagination.pcss +28 -4
  15. package/source/components/datatable/style/status.pcss +42 -0
  16. package/source/components/datatable/stylesheet/column-bar.mjs +1 -1
  17. package/source/components/datatable/stylesheet/datatable.mjs +1 -1
  18. package/source/components/datatable/stylesheet/filter-button.mjs +1 -1
  19. package/source/components/datatable/stylesheet/filter.mjs +1 -1
  20. package/source/components/datatable/stylesheet/pagination.mjs +1 -1
  21. package/source/components/datatable/stylesheet/status.mjs +27 -0
  22. package/source/components/form/action-button.mjs +1 -1
  23. package/source/components/form/api-button.mjs +1 -1
  24. package/source/components/form/button-bar.mjs +1 -1
  25. package/source/components/form/button.mjs +1 -1
  26. package/source/components/form/confirm-button.mjs +1 -1
  27. package/source/components/form/context-error.mjs +275 -0
  28. package/source/components/form/context-help.mjs +5 -5
  29. package/source/components/form/form.mjs +2 -2
  30. package/source/components/form/message-state-button.mjs +2 -2
  31. package/source/components/form/popper-button.mjs +7 -4
  32. package/source/components/form/popper.mjs +317 -309
  33. package/source/components/form/reload.mjs +1 -1
  34. package/source/components/form/select.mjs +9 -3
  35. package/source/components/form/shadow-reload.mjs +1 -1
  36. package/source/components/form/state-button.mjs +2 -1
  37. package/source/components/form/style/context-error.pcss +32 -0
  38. package/source/components/form/style/context-help.pcss +22 -5
  39. package/source/components/form/stylesheet/context-error.mjs +27 -0
  40. package/source/components/form/stylesheet/context-help.mjs +1 -1
  41. package/source/components/form/stylesheet/select.mjs +1 -1
  42. package/source/components/form/stylesheet/tabs.mjs +1 -1
  43. package/source/components/form/tabs.mjs +757 -707
  44. package/source/components/form/template.mjs +1 -1
  45. package/source/components/form/tree-select.mjs +1 -1
  46. package/source/components/host/collapse.mjs +22 -5
  47. package/source/components/host/config-manager.mjs +39 -2
  48. package/source/components/host/host.mjs +14 -0
  49. package/source/components/host/stylesheet/call-button.mjs +1 -1
  50. package/source/components/host/stylesheet/overlay.mjs +1 -1
  51. package/source/components/host/stylesheet/toggle-button.mjs +1 -1
  52. package/source/components/host/util.mjs +6 -1
  53. package/source/components/notify/stylesheet/message.mjs +1 -1
  54. package/source/components/stylesheet/icons.mjs +1 -1
  55. package/source/data/transformer.mjs +39 -42
  56. package/source/dom/customelement.mjs +1 -1
  57. package/source/dom/updater.mjs +700 -688
  58. package/source/dom/util.mjs +42 -0
  59. package/source/i18n/providers/embed.mjs +3 -3
  60. package/source/monster.mjs +6 -0
  61. package/source/text/formatter.mjs +2 -2
  62. package/source/types/observer.mjs +1 -1
  63. package/source/types/version.mjs +1 -1
  64. package/source/util/sleep.mjs +18 -0
  65. package/test/cases/components/form/button.mjs +2 -1
  66. package/test/cases/components/form/select.mjs +1 -1
  67. package/test/cases/components/form/tree-select.mjs +1 -1
  68. package/test/cases/data/transformer.mjs +2 -2
  69. package/test/cases/dom/updater.mjs +67 -46
  70. package/test/cases/monster.mjs +1 -1
  71. package/test/web/test.html +2 -2
  72. package/test/web/tests.js +18 -13
@@ -4,28 +4,32 @@
4
4
  */
5
5
 
6
6
  import {
7
- assembleMethodSymbol,
8
- CustomElement,
9
- registerCustomElement,
7
+ assembleMethodSymbol,
8
+ CustomElement,
9
+ registerCustomElement,
10
10
  } from "../../dom/customelement.mjs";
11
- import { ATTRIBUTE_DATASOURCE_SELECTOR } from "./constants.mjs";
12
- import { Datasource } from "./datasource.mjs";
13
- import { Observer } from "../../types/observer.mjs";
14
- import { ATTRIBUTE_ROLE } from "../../dom/constants.mjs";
15
- import { findTargetElementFromEvent } from "../../dom/events.mjs";
16
- import { PaginationStyleSheet } from "./stylesheet/pagination.mjs";
17
- import { isString } from "../../types/is.mjs";
18
- import { Pathfinder } from "../../data/pathfinder.mjs";
19
- import { instanceSymbol } from "../../constants.mjs";
20
- import { Formatter } from "../../text/formatter.mjs";
11
+ import {ThemeStyleSheet} from "../stylesheet/theme.mjs";
12
+ import {ATTRIBUTE_DATASOURCE_SELECTOR} from "./constants.mjs";
13
+ import {Datasource} from "./datasource.mjs";
14
+ import {Observer} from "../../types/observer.mjs";
15
+ import {ATTRIBUTE_ROLE} from "../../dom/constants.mjs";
16
+ import {findTargetElementFromEvent} from "../../dom/events.mjs";
17
+ import {EmbeddedPaginationStyleSheet} from "./stylesheet/embedded-pagination.mjs";
18
+ import {PaginationStyleSheet} from "./stylesheet/pagination.mjs";
19
+ //import {SpinnerStyleSheet} from "../stylesheet/spinner.mjs";
20
+ import {DisplayStyleSheet} from "../stylesheet/display.mjs";
21
+ import {isString} from "../../types/is.mjs";
22
+ import {Pathfinder} from "../../data/pathfinder.mjs";
23
+ import {instanceSymbol} from "../../constants.mjs";
24
+ import {Formatter} from "../../text/formatter.mjs";
21
25
  import "../form/select.mjs";
22
- import { addAttributeToken } from "../../dom/attributes.mjs";
23
- import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
26
+ import {addAttributeToken} from "../../dom/attributes.mjs";
27
+ import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
24
28
 
25
29
  import "./datasource/dom.mjs";
26
30
  import "./datasource/rest.mjs";
27
31
 
28
- export { Pagination };
32
+ export {Pagination};
29
33
 
30
34
  /**
31
35
  * @private
@@ -72,123 +76,144 @@ const datasourceLinkedElementSymbol = Symbol("datasourceLinkedElement");
72
76
  * @summary A datatable
73
77
  */
74
78
  class Pagination extends CustomElement {
75
- /**
76
- */
77
- constructor() {
78
- super();
79
- this[datasourceLinkedElementSymbol] = null;
80
- }
81
-
82
- /**
83
- * This method is called by the `instanceof` operator.
84
- * @returns {symbol}
85
- */
86
- static get [instanceSymbol]() {
87
- return Symbol.for("@schukai/monster/components/pagination");
88
- }
89
-
90
- /**
91
- * To set the options via the html tag the attribute `data-monster-options` must be used.
92
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
93
- *
94
- * The individual configuration values can be found in the table.
95
- *
96
- * @property {Object} templates Template definitions
97
- * @property {string} templates.main Main template
98
- * @property {int} offset Current offset
99
- * @property {int} nextOffset Next offset
100
- * @property {int} prevOffset Previous offset
101
- * @property {int} objectsPerPage Number of objects per page
102
- * @property {int} currentPage Current page
103
- * @property {int} pages Total number of pages
104
- * @property {int} total Total number of objects
105
- */
106
- get defaults() {
107
- return Object.assign(
108
- {},
109
- super.defaults,
110
- {
111
- templates: {
112
- main: getTemplate(),
113
- },
114
-
115
- datasource: {
116
- selector: null,
117
- },
118
-
119
- labels: {
120
- page: "${page}",
121
- description: "Page ${page}",
122
- previous: "Previous",
123
- next: "Next",
124
- of: "of",
125
- },
126
-
127
- href: "page-${page}",
128
-
129
- currentPage: undefined,
130
- pages: undefined,
131
- objectsPerPage: 20,
132
-
133
- mapping: {
134
- pages: "sys.pagination.pages",
135
- objectsPerPage: "sys.pagination.objectsPerPage",
136
- currentPage: "sys.pagination.currentPage",
137
- },
138
-
139
- pagination: {
140
- items: [],
141
- },
142
- },
143
- initOptionsFromArguments.call(this),
144
- );
145
- }
146
-
147
- /**
148
- *
149
- * @return {string}
150
- */
151
- static getTag() {
152
- return "monster-pagination";
153
- }
154
-
155
- /**
156
- *
157
- * @return {Monster.Components.Form.Form}
158
- */
159
- [assembleMethodSymbol]() {
160
- super[assembleMethodSymbol]();
161
-
162
- initControlReferences.call(this);
163
- initEventHandler.call(this);
164
-
165
- const selector = this.getOption("datasource.selector");
166
-
167
- if (isString(selector)) {
168
- const elements = document.querySelectorAll(selector);
169
- if (elements.length !== 1) {
170
- throw new Error("the selector must match exactly one element");
171
- }
172
-
173
- const element = elements[0];
174
- if (!(element instanceof Datasource)) {
175
- throw new TypeError("the element must be a datasource");
176
- }
177
-
178
- this[datasourceLinkedElementSymbol] = element;
179
- element.datasource.attachObserver(
180
- new Observer(handleDataSourceChanges.bind(this)),
181
- );
182
- }
183
- }
184
-
185
- /**
186
- *
187
- * @return [CSSStyleSheet]
188
- */
189
- static getCSSStyleSheet() {
190
- return [PaginationStyleSheet];
191
- }
79
+ /**
80
+ */
81
+ constructor() {
82
+ super();
83
+ this[datasourceLinkedElementSymbol] = null;
84
+ }
85
+
86
+ /**
87
+ * This method is called by the `instanceof` operator.
88
+ * @returns {symbol}
89
+ */
90
+ static get [instanceSymbol]() {
91
+ return Symbol.for("@schukai/monster/components/pagination");
92
+ }
93
+
94
+ /**
95
+ * To set the options via the html tag the attribute `data-monster-options` must be used.
96
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
97
+ *
98
+ * The individual configuration values can be found in the table.
99
+ *
100
+ * @property {Object} templates Template definitions
101
+ * @property {string} templates.main Main template
102
+ * @property {int} offset Current offset
103
+ * @property {int} nextOffset Next offset
104
+ * @property {int} prevOffset Previous offset
105
+ * @property {int} objectsPerPage Number of objects per page
106
+ * @property {int} currentPage Current page
107
+ * @property {int} pages Total number of pages
108
+ * @property {int} total Total number of objects
109
+ */
110
+ get defaults() {
111
+ return Object.assign(
112
+ {},
113
+ super.defaults,
114
+ {
115
+ templates: {
116
+ main: getTemplate(),
117
+ },
118
+
119
+ datasource: {
120
+ selector: null,
121
+ },
122
+
123
+ labels: {
124
+ page: "${page}",
125
+ description: "Page ${page}",
126
+ previous: "Previous",
127
+ next: "Next",
128
+ of: "of",
129
+ },
130
+
131
+ href: "page-${page}",
132
+
133
+ currentPage: undefined,
134
+ pages: undefined,
135
+ objectsPerPage: 20,
136
+
137
+ mapping: {
138
+ pages: "sys.pagination.pages",
139
+ objectsPerPage: "sys.pagination.objectsPerPage",
140
+ currentPage: "sys.pagination.currentPage",
141
+ },
142
+
143
+ // classes: {
144
+ // // spinner: "monster-spinner monster-theme-primary-3",
145
+ // // spinnerContainer: "monster-theme-primary-1 ",
146
+ // // error: "monster-theme-error-2 monster-bg-color-primary-2",
147
+ // // errorContainer: "monster-theme-primary-1",
148
+ // },
149
+
150
+ // state: {
151
+ // // spinner: false,
152
+ // // error: false,
153
+ // },
154
+
155
+ pagination: {
156
+ items: [],
157
+ },
158
+ },
159
+ initOptionsFromArguments.call(this),
160
+ );
161
+ }
162
+
163
+ /**
164
+ *
165
+ * @return {string}
166
+ */
167
+ static getTag() {
168
+ return "monster-pagination";
169
+ }
170
+
171
+ /**
172
+ *
173
+ * @return {Monster.Components.Form.Form}
174
+ */
175
+ [assembleMethodSymbol]() {
176
+ super[assembleMethodSymbol]();
177
+
178
+ initControlReferences.call(this);
179
+ initEventHandler.call(this);
180
+
181
+ const selector = this.getOption("datasource.selector", "");
182
+
183
+ if (isString(selector)) {
184
+ const elements = document.querySelectorAll(selector);
185
+ if (elements.length !== 1) {
186
+ throw new Error("the selector must match exactly one element");
187
+ }
188
+
189
+ const element = elements[0];
190
+ if (!(element instanceof Datasource)) {
191
+ throw new TypeError("the element must be a datasource");
192
+ }
193
+
194
+ this[datasourceLinkedElementSymbol] = element;
195
+ element.datasource.attachObserver(
196
+ new Observer(handleDataSourceChanges.bind(this)),
197
+ );
198
+ }
199
+
200
+ }
201
+
202
+ /**
203
+ * @private
204
+ * @returns {CSSStyleSheet}
205
+ */
206
+ static getControlCSSStyleSheet() {
207
+ return PaginationStyleSheet;
208
+ }
209
+
210
+ /**
211
+ *
212
+ * @return [CSSStyleSheet]
213
+ */
214
+ static getCSSStyleSheet() {
215
+ return [this.getControlCSSStyleSheet(), DisplayStyleSheet, ThemeStyleSheet];
216
+ }
192
217
  }
193
218
 
194
219
  /**
@@ -197,73 +222,73 @@ class Pagination extends CustomElement {
197
222
  * @throws {Error} no shadow-root is defined
198
223
  */
199
224
  function initControlReferences() {
200
- if (!this.shadowRoot) {
201
- throw new Error("no shadow-root is defined");
202
- }
225
+ if (!this.shadowRoot) {
226
+ throw new Error("no shadow-root is defined");
227
+ }
203
228
 
204
- this[paginationElementSymbol] = this.shadowRoot.querySelector(
205
- "[data-monster-role=pagination]",
206
- );
229
+ this[paginationElementSymbol] = this.shadowRoot.querySelector(
230
+ "[data-monster-role=pagination]",
231
+ );
207
232
  }
208
233
 
209
234
  /**
210
235
  * @private
211
236
  */
212
237
  function initEventHandler() {
213
- const self = this;
214
-
215
- self[paginationElementSymbol].addEventListener("click", function (event) {
216
- let element = null;
217
- const datasource = self[datasourceLinkedElementSymbol];
218
- if (!datasource) {
219
- return;
220
- }
221
-
222
- element = findTargetElementFromEvent(
223
- event,
224
- ATTRIBUTE_ROLE,
225
- "pagination-item",
226
- );
227
- if (!element) {
228
- element = findTargetElementFromEvent(
229
- event,
230
- ATTRIBUTE_ROLE,
231
- "pagination-next",
232
- );
233
- if (!element) {
234
- element = findTargetElementFromEvent(
235
- event,
236
- ATTRIBUTE_ROLE,
237
- "pagination-prev",
238
- );
239
- if (!element) {
240
- return;
241
- }
242
- }
243
- }
244
-
245
- let page = null;
246
-
247
- if (!element.hasAttribute("data-page-no")) {
248
- return;
249
- }
250
-
251
- page = element.getAttribute("data-page-no");
252
- event.preventDefault();
253
-
254
- if (
255
- !page ||
256
- page === "" ||
257
- page === null ||
258
- page === undefined ||
259
- page === "undefined" ||
260
- page === "null"
261
- ) {
262
- return;
263
- }
264
-
265
- datasource.setParameters({ page }).reload();
266
- });
238
+ const self = this;
239
+
240
+ self[paginationElementSymbol].addEventListener("click", function (event) {
241
+ let element = null;
242
+ const datasource = self[datasourceLinkedElementSymbol];
243
+ if (!datasource) {
244
+ return;
245
+ }
246
+
247
+ element = findTargetElementFromEvent(
248
+ event,
249
+ ATTRIBUTE_ROLE,
250
+ "pagination-item",
251
+ );
252
+ if (!element) {
253
+ element = findTargetElementFromEvent(
254
+ event,
255
+ ATTRIBUTE_ROLE,
256
+ "pagination-next",
257
+ );
258
+ if (!element) {
259
+ element = findTargetElementFromEvent(
260
+ event,
261
+ ATTRIBUTE_ROLE,
262
+ "pagination-prev",
263
+ );
264
+ if (!element) {
265
+ return;
266
+ }
267
+ }
268
+ }
269
+
270
+ let page = null;
271
+
272
+ if (!element.hasAttribute("data-page-no")) {
273
+ return;
274
+ }
275
+
276
+ page = element.getAttribute("data-page-no");
277
+ event.preventDefault();
278
+
279
+ if (
280
+ !page ||
281
+ page === "" ||
282
+ page === null ||
283
+ page === undefined ||
284
+ page === "undefined" ||
285
+ page === "null"
286
+ ) {
287
+ return;
288
+ }
289
+
290
+ datasource.setParameters({page}).reload();
291
+ });
267
292
  }
268
293
 
269
294
  /**
@@ -279,46 +304,46 @@ function initEventHandler() {
279
304
  * @throws {Error} the datasource could not be initialized
280
305
  */
281
306
  function initOptionsFromArguments() {
282
- const options = {};
283
- const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
284
- if (selector) {
285
- options.datasource = { selector: selector };
286
- }
307
+ const options = {};
308
+ const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
309
+ if (selector) {
310
+ options.datasource = {selector: selector};
311
+ }
287
312
 
288
- return options;
313
+ return options;
289
314
  }
290
315
 
291
316
  /**
292
317
  * @private
293
318
  */
294
319
  function handleDataSourceChanges() {
295
- let pagination;
296
-
297
- if (!this[datasourceLinkedElementSymbol]) {
298
- return;
299
- }
300
-
301
- const mapping = this.getOption("mapping");
302
- for (const key in mapping) {
303
- const path = mapping[key];
304
-
305
- let value;
306
- try {
307
- value = new Pathfinder(this[datasourceLinkedElementSymbol].data).getVia(
308
- path,
309
- );
310
- this.setOption(key, value);
311
- } catch (e) {
312
- addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
313
- }
314
- }
315
-
316
- pagination = buildPagination.call(
317
- this,
318
- this.getOption("currentPage"),
319
- this.getOption("pages"),
320
- );
321
- this.setOption("pagination", pagination);
320
+ let pagination;
321
+
322
+ if (!this[datasourceLinkedElementSymbol]) {
323
+ return;
324
+ }
325
+
326
+ const mapping = this.getOption("mapping");
327
+ for (const key in mapping) {
328
+ const path = mapping[key];
329
+
330
+ let value;
331
+ try {
332
+ value = new Pathfinder(this[datasourceLinkedElementSymbol].data).getVia(
333
+ path,
334
+ );
335
+ this.setOption(key, value);
336
+ } catch (e) {
337
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
338
+ }
339
+ }
340
+
341
+ pagination = buildPagination.call(
342
+ this,
343
+ this.getOption("currentPage"),
344
+ this.getOption("pages"),
345
+ );
346
+ this.setOption("pagination", pagination);
322
347
  }
323
348
 
324
349
  /**
@@ -328,88 +353,88 @@ function handleDataSourceChanges() {
328
353
  * @returns {object}
329
354
  */
330
355
  function buildPagination(current, max) {
331
- let prev = current === 1 ? null : current - 1;
332
- let next = current === max ? null : current + 1;
333
- const itemList = [1];
334
-
335
- if (current > 4) itemList.push("…");
336
-
337
- const r = 2;
338
- const r1 = current - r;
339
- const r2 = current + r;
340
-
341
- for (let i = r1 > 2 ? r1 : 2; i <= Math.min(max, r2); i++) itemList.push(i);
342
-
343
- if (r2 + 1 < max) itemList.push("…");
344
- if (r2 < max) itemList.push(max);
345
-
346
- let prevClass = "";
347
-
348
- if (prev === null) {
349
- prevClass = " disabled";
350
- }
351
-
352
- let nextClass = "";
353
- if (next === null) {
354
- nextClass = " disabled";
355
- }
356
-
357
- const items = itemList.map((item) => {
358
- const p = `${item}`;
359
- const c = `${current}`;
360
-
361
- const obj = {
362
- pageNo: item, // as integer
363
- page: p, // as string
364
- current: p === c,
365
- class: (p === c ? "current" : "").trim(),
366
- };
367
-
368
- if (p === "…") {
369
- obj.class += " disabled".trim();
370
- }
371
-
372
- const formatter = new Formatter(obj);
373
-
374
- obj.description = formatter.format(this.getOption("labels.description"));
375
- obj.label = formatter.format(this.getOption("labels.page"));
376
- obj.href =
377
- p === "…"
378
- ? "#"
379
- : p === c
380
- ? "#"
381
- : p === "1"
382
- ? "#"
383
- : `#${formatter.format(this.getOption("href"))}`;
384
- return obj;
385
- });
386
-
387
- const nextNo = next;
388
- next = `${next}`;
389
-
390
- const nextHref =
391
- next === "null"
392
- ? "#"
393
- : `#${new Formatter({ page: next }).format(this.getOption("href"))}`;
394
- const prevNo = prev;
395
- prev = `${prev}`;
396
- const prevHref =
397
- prev === "null"
398
- ? "#"
399
- : `#${new Formatter({ page: prev }).format(this.getOption("href"))}`;
400
-
401
- return {
402
- current,
403
- nextNo,
404
- next,
405
- nextClass,
406
- nextHref,
407
- prevNo,
408
- prev,
409
- prevClass,
410
- prevHref,
411
- items,
412
- };
356
+ let prev = current === 1 ? null : current - 1;
357
+ let next = current === max ? null : current + 1;
358
+ const itemList = [1];
359
+
360
+ if (current > 4) itemList.push("…");
361
+
362
+ const r = 2;
363
+ const r1 = current - r;
364
+ const r2 = current + r;
365
+
366
+ for (let i = r1 > 2 ? r1 : 2; i <= Math.min(max, r2); i++) itemList.push(i);
367
+
368
+ if (r2 + 1 < max) itemList.push("…");
369
+ if (r2 < max) itemList.push(max);
370
+
371
+ let prevClass = "";
372
+
373
+ if (prev === null) {
374
+ prevClass = " disabled";
375
+ }
376
+
377
+ let nextClass = "";
378
+ if (next === null) {
379
+ nextClass = " disabled";
380
+ }
381
+
382
+ const items = itemList.map((item) => {
383
+ const p = `${item}`;
384
+ const c = `${current}`;
385
+
386
+ const obj = {
387
+ pageNo: item, // as integer
388
+ page: p, // as string
389
+ current: p === c,
390
+ class: (p === c ? "current" : "").trim(),
391
+ };
392
+
393
+ if (p === "…") {
394
+ obj.class += " disabled".trim();
395
+ }
396
+
397
+ const formatter = new Formatter(obj);
398
+
399
+ obj.description = formatter.format(this.getOption("labels.description"));
400
+ obj.label = formatter.format(this.getOption("labels.page"));
401
+ obj.href =
402
+ p === "…"
403
+ ? "#"
404
+ : p === c
405
+ ? "#"
406
+ : p === "1"
407
+ ? "#"
408
+ : `#${formatter.format(this.getOption("href"))}`;
409
+ return obj;
410
+ });
411
+
412
+ const nextNo = next;
413
+ next = `${next}`;
414
+
415
+ const nextHref =
416
+ next === "null"
417
+ ? "#"
418
+ : `#${new Formatter({page: next}).format(this.getOption("href"))}`;
419
+ const prevNo = prev;
420
+ prev = `${prev}`;
421
+ const prevHref =
422
+ prev === "null"
423
+ ? "#"
424
+ : `#${new Formatter({page: prev}).format(this.getOption("href"))}`;
425
+
426
+ return {
427
+ current,
428
+ nextNo,
429
+ next,
430
+ nextClass,
431
+ nextHref,
432
+ prevNo,
433
+ prev,
434
+ prevClass,
435
+ prevHref,
436
+ items,
437
+ };
413
438
  }
414
439
 
415
440
  /**
@@ -417,8 +442,8 @@ function buildPagination(current, max) {
417
442
  * @return {string}
418
443
  */
419
444
  function getTemplate() {
420
- // language=HTML
421
- return `
445
+ // language=HTML
446
+ return `
422
447
  <template id="items">
423
448
  <li><a data-monster-attributes="class path:items.class,
424
449
  href path:items.href,