@paperless/core 0.1.0-alpha.2 → 0.1.0-alpha.20

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 (147) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/README.md +18 -1
  3. package/dist/assets/images/avatar/company-default.svg +12 -0
  4. package/dist/assets/images/avatar/user-default.svg +12 -0
  5. package/dist/assets/images/helper/helper-hover.svg +15 -0
  6. package/dist/assets/images/helper/helper.svg +15 -0
  7. package/dist/build/{p-1d13a9d2.entry.js → p-14ceb308.entry.js} +1 -1
  8. package/dist/build/p-17c11169.entry.js +1 -0
  9. package/dist/build/p-42dab9d4.entry.js +1 -0
  10. package/dist/build/p-47b52f92.entry.js +1 -0
  11. package/dist/build/p-5ec6ea71.entry.js +1 -0
  12. package/dist/build/p-76464e0b.js +2 -0
  13. package/dist/build/{p-feec8ec1.entry.js → p-8501ba07.entry.js} +1 -1
  14. package/dist/build/p-aae3d4f0.entry.js +1 -0
  15. package/dist/build/p-adcb0b93.entry.js +1 -0
  16. package/dist/build/p-bbec0e86.entry.js +1 -0
  17. package/dist/build/p-d23e4d57.entry.js +1 -0
  18. package/dist/build/p-f65d7bbf.entry.js +1 -0
  19. package/dist/build/paperless.esm.js +1 -1
  20. package/dist/cjs/{index-5b30cb95.js → index-a46a39a5.js} +494 -9
  21. package/dist/cjs/loader.cjs.js +2 -2
  22. package/dist/cjs/{p-loader.cjs.entry.js → p-avatar.cjs.entry.js} +13 -38
  23. package/dist/cjs/{p-icon.cjs.entry.js → p-button_3.cjs.entry.js} +108 -5
  24. package/dist/cjs/p-counter.cjs.entry.js +19 -0
  25. package/dist/cjs/p-divider.cjs.entry.js +19 -0
  26. package/dist/cjs/{p-button.cjs.entry.js → p-helper.cjs.entry.js} +6 -10
  27. package/dist/cjs/p-illustration.cjs.entry.js +9 -12
  28. package/dist/cjs/p-info-panel.cjs.entry.js +31 -0
  29. package/dist/cjs/p-navigation-item.cjs.entry.js +23 -0
  30. package/dist/cjs/p-pagination-item.cjs.entry.js +23 -0
  31. package/dist/cjs/p-pagination.cjs.entry.js +167 -0
  32. package/dist/cjs/p-tooltip.cjs.entry.js +62 -20
  33. package/dist/cjs/paperless.cjs.js +2 -2
  34. package/dist/collection/assets/images/avatar/company-default.svg +12 -0
  35. package/dist/collection/assets/images/avatar/user-default.svg +12 -0
  36. package/dist/collection/assets/images/helper/helper-hover.svg +15 -0
  37. package/dist/collection/assets/images/helper/helper.svg +15 -0
  38. package/dist/collection/collection-manifest.json +9 -1
  39. package/dist/collection/components/atoms/avatar/avatar.component.css +31 -0
  40. package/dist/collection/components/atoms/avatar/avatar.component.js +105 -0
  41. package/dist/collection/components/atoms/button/button.component.css +68 -3
  42. package/dist/collection/components/atoms/button/button.component.js +241 -7
  43. package/dist/collection/components/atoms/counter/counter.component.css +5 -0
  44. package/dist/collection/components/atoms/counter/counter.component.js +15 -0
  45. package/dist/collection/components/atoms/divider/divider.component.css +3 -0
  46. package/dist/collection/components/atoms/divider/divider.component.js +14 -0
  47. package/dist/collection/components/atoms/helper/helper.component.css +7 -0
  48. package/dist/collection/components/atoms/helper/helper.component.js +18 -0
  49. package/dist/collection/components/atoms/icon/icon.component.js +2 -7
  50. package/dist/collection/components/atoms/illustration/illustration.component.js +2 -9
  51. package/dist/collection/components/atoms/info-panel/info-panel.component.css +28 -0
  52. package/dist/collection/components/atoms/info-panel/info-panel.component.js +106 -0
  53. package/dist/collection/components/atoms/loader/loader.component.js +1 -1
  54. package/dist/collection/components/atoms/pagination-item/pagination-item.component.css +16 -0
  55. package/dist/collection/components/atoms/pagination-item/pagination-item.component.js +41 -0
  56. package/dist/collection/components/atoms/tooltip/tooltip.component.css +15 -12
  57. package/dist/collection/components/atoms/tooltip/tooltip.component.js +122 -32
  58. package/dist/collection/components/molecules/navigation-item/navigation-item.component.css +28 -0
  59. package/dist/collection/components/molecules/navigation-item/navigation-item.component.js +118 -0
  60. package/dist/collection/components/molecules/pagination/pagination.component.css +3 -0
  61. package/dist/collection/components/molecules/pagination/pagination.component.js +238 -0
  62. package/dist/collection/components/molecules/pagination/pagination.value-accessor.js +6 -0
  63. package/dist/collection/tailwind/border-radius.js +1 -0
  64. package/dist/collection/tailwind/grid.js +24 -4
  65. package/dist/collection/tailwind.config.js +1 -1
  66. package/dist/collection/value-accessors.config.js +5 -0
  67. package/dist/components/counter.component.js +30 -0
  68. package/dist/{esm/p-icon.entry.js → components/icon.component.js} +26 -11
  69. package/dist/components/index.d.ts +8 -0
  70. package/dist/components/index.js +8 -0
  71. package/dist/{esm/p-loader.entry.js → components/loader.component.js} +30 -9
  72. package/dist/components/p-avatar.d.ts +11 -0
  73. package/dist/components/p-avatar.js +52 -0
  74. package/dist/components/p-button.js +67 -8
  75. package/dist/components/p-counter.d.ts +11 -0
  76. package/dist/components/p-counter.js +6 -0
  77. package/dist/components/p-divider.d.ts +11 -0
  78. package/dist/components/p-divider.js +33 -0
  79. package/dist/components/p-helper.d.ts +11 -0
  80. package/dist/components/p-helper.js +39 -0
  81. package/dist/components/p-icon.js +1 -815
  82. package/dist/components/p-illustration.js +0 -4
  83. package/dist/components/p-info-panel.d.ts +11 -0
  84. package/dist/components/p-info-panel.js +56 -0
  85. package/dist/components/p-loader.js +1 -72
  86. package/dist/components/p-navigation-item.d.ts +11 -0
  87. package/dist/components/p-navigation-item.js +55 -0
  88. package/dist/components/p-pagination-item.d.ts +11 -0
  89. package/dist/components/p-pagination-item.js +6 -0
  90. package/dist/components/p-pagination.d.ts +11 -0
  91. package/dist/components/p-pagination.js +196 -0
  92. package/dist/components/p-tooltip.js +1 -1886
  93. package/dist/components/pagination-item.component.js +36 -0
  94. package/dist/components/tooltip.component.js +1932 -0
  95. package/dist/esm/{index-111a6307.js → index-a68e547b.js} +494 -10
  96. package/dist/esm/loader.js +2 -2
  97. package/dist/esm/p-avatar.entry.js +28 -0
  98. package/dist/esm/p-button_3.entry.js +899 -0
  99. package/dist/esm/p-counter.entry.js +15 -0
  100. package/dist/esm/p-divider.entry.js +15 -0
  101. package/dist/esm/{p-button.entry.js → p-helper.entry.js} +6 -10
  102. package/dist/esm/p-illustration.entry.js +9 -12
  103. package/dist/esm/p-info-panel.entry.js +27 -0
  104. package/dist/esm/p-navigation-item.entry.js +19 -0
  105. package/dist/esm/p-pagination-item.entry.js +19 -0
  106. package/dist/esm/p-pagination.entry.js +163 -0
  107. package/dist/esm/p-tooltip.entry.js +62 -20
  108. package/dist/esm/paperless.js +2 -2
  109. package/dist/index.html +1 -1
  110. package/dist/paperless/{p-1d13a9d2.entry.js → p-14ceb308.entry.js} +1 -1
  111. package/dist/paperless/p-17c11169.entry.js +1 -0
  112. package/dist/paperless/p-42dab9d4.entry.js +1 -0
  113. package/dist/paperless/p-47b52f92.entry.js +1 -0
  114. package/dist/paperless/p-5ec6ea71.entry.js +1 -0
  115. package/dist/paperless/p-76464e0b.js +2 -0
  116. package/dist/paperless/{p-feec8ec1.entry.js → p-8501ba07.entry.js} +1 -1
  117. package/dist/paperless/p-aae3d4f0.entry.js +1 -0
  118. package/dist/paperless/p-adcb0b93.entry.js +1 -0
  119. package/dist/paperless/p-bbec0e86.entry.js +1 -0
  120. package/dist/paperless/p-d23e4d57.entry.js +1 -0
  121. package/dist/paperless/p-f65d7bbf.entry.js +1 -0
  122. package/dist/paperless/paperless.css +96 -0
  123. package/dist/paperless/paperless.esm.js +1 -1
  124. package/dist/sw.js +248 -51
  125. package/dist/tailwind.config.js +1 -1
  126. package/dist/types/components/atoms/avatar/avatar.component.d.ts +21 -0
  127. package/dist/types/components/atoms/button/button.component.d.ts +45 -1
  128. package/dist/types/components/atoms/counter/counter.component.d.ts +3 -0
  129. package/dist/types/components/atoms/divider/divider.component.d.ts +3 -0
  130. package/dist/types/components/atoms/helper/helper.component.d.ts +3 -0
  131. package/dist/types/components/atoms/info-panel/info-panel.component.d.ts +24 -0
  132. package/dist/types/components/atoms/pagination-item/pagination-item.component.d.ts +7 -0
  133. package/dist/types/components/atoms/tooltip/tooltip.component.d.ts +20 -8
  134. package/dist/types/components/molecules/navigation-item/navigation-item.component.d.ts +24 -0
  135. package/dist/types/components/molecules/pagination/pagination.component.d.ts +28 -0
  136. package/dist/types/components/molecules/pagination/pagination.value-accessor.d.ts +2 -0
  137. package/dist/types/components.d.ts +358 -16
  138. package/dist/types/value-accessors.config.d.ts +2 -0
  139. package/package.json +1 -1
  140. package/dist/build/p-208c1f28.entry.js +0 -1
  141. package/dist/build/p-98d07776.js +0 -2
  142. package/dist/build/p-bbd1d3df.entry.js +0 -1
  143. package/dist/build/p-cd525dcc.entry.js +0 -1
  144. package/dist/paperless/p-208c1f28.entry.js +0 -1
  145. package/dist/paperless/p-98d07776.js +0 -2
  146. package/dist/paperless/p-bbd1d3df.entry.js +0 -1
  147. package/dist/paperless/p-cd525dcc.entry.js +0 -1
@@ -3,60 +3,102 @@ import { Component, Element, h, Host, Listen, Prop } from '@stencil/core';
3
3
  export class Tooltip {
4
4
  constructor() {
5
5
  /**
6
- * The content of the tooltip
6
+ * The variant of the popover
7
7
  */
8
- this.content = null;
8
+ this.variant = 'hover';
9
9
  /**
10
- * The content of the tooltip
10
+ * The content of the popover
11
+ */
12
+ this.popover = null;
13
+ /**
14
+ * The content of the popover
11
15
  */
12
16
  this.placement = 'top';
13
17
  /**
14
- * Wether to force show the tooltip
18
+ * Wether to show the popover
19
+ */
20
+ this.show = false;
21
+ /**
22
+ * Wether to someone can manually close the popover
15
23
  */
16
- this.forceShow = false;
24
+ this.canManuallyClose = true;
17
25
  this._loaded = false;
18
26
  }
19
27
  componentShouldUpdate() {
20
28
  this._setOptions();
21
- if (this.forceShow) {
29
+ if (this._loaded && this.show) {
22
30
  this._show();
23
31
  }
24
32
  }
25
33
  render() {
26
- return (h(Host, { class: "p-tooltip" },
27
- h("slot", null),
28
- h("div", { class: "tooltip", role: "tooltip", ref: el => this._load(el) },
29
- this.content,
34
+ return (h(Host, { class: "p-popover" },
35
+ h("slot", { name: "content" }),
36
+ h("div", { class: `popover variant-${this.variant}`, role: "popover", ref: el => this._load(el) },
37
+ this.popover ? this.popover : h("slot", { name: "popover" }),
30
38
  h("div", { class: "arrow", "data-popper-arrow": true }))));
31
39
  }
40
+ clickHandler() {
41
+ if (this.variant === 'hover') {
42
+ return;
43
+ }
44
+ if (this._popover.hasAttribute('data-show')) {
45
+ return;
46
+ }
47
+ if (!this._popover.hasAttribute('data-show')) {
48
+ this._show();
49
+ }
50
+ }
51
+ documentClickHandler() {
52
+ if (this.variant === 'hover' || !this.canManuallyClose) {
53
+ return;
54
+ }
55
+ if (!this._popover.hasAttribute('data-show')) {
56
+ return;
57
+ }
58
+ if (this._popover.hasAttribute('data-show')) {
59
+ this._hide();
60
+ }
61
+ }
62
+ mouseEnterHandler() {
63
+ if (this.variant === 'click') {
64
+ return;
65
+ }
66
+ this._show();
67
+ }
68
+ mouseLeaveHandler() {
69
+ if (this.show || this.variant === 'click') {
70
+ return;
71
+ }
72
+ this._hide();
73
+ }
32
74
  _show() {
33
75
  if (!this._loaded) {
34
76
  return;
35
77
  }
36
- // Make the tooltip visible
37
- this._tooltip.setAttribute('data-show', '');
78
+ // Make the popover visible
79
+ this._popover.setAttribute('data-show', '');
38
80
  // Enable the event listeners
39
81
  this._popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
40
82
  // Update its position
41
83
  this._popper.update();
42
84
  }
43
85
  _hide() {
44
- if (!this._loaded && !this.forceShow) {
86
+ if (!this._loaded) {
45
87
  return;
46
88
  }
47
- // Hide the tooltip
48
- this._tooltip.removeAttribute('data-show');
89
+ // Hide the popover
90
+ this._popover.removeAttribute('data-show');
49
91
  // Disable the event listeners
50
92
  this._popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
51
93
  }
52
- _load(tooltip) {
53
- this._tooltip = tooltip;
54
- if (tooltip) {
55
- this._popper = createPopper(this._el, tooltip);
94
+ _load(popover) {
95
+ this._popover = popover;
96
+ if (popover) {
97
+ this._popper = createPopper(this._el, popover);
56
98
  this._setOptions();
57
99
  this._loaded = true;
58
- if (this.forceShow) {
59
- this._show();
100
+ if (this.show) {
101
+ setTimeout(() => this._show(), 100);
60
102
  }
61
103
  }
62
104
  }
@@ -85,7 +127,25 @@ export class Tooltip {
85
127
  "$": ["tooltip.component.css"]
86
128
  }; }
87
129
  static get properties() { return {
88
- "content": {
130
+ "variant": {
131
+ "type": "string",
132
+ "mutable": false,
133
+ "complexType": {
134
+ "original": "'hover' | 'click'",
135
+ "resolved": "\"click\" | \"hover\"",
136
+ "references": {}
137
+ },
138
+ "required": false,
139
+ "optional": false,
140
+ "docs": {
141
+ "tags": [],
142
+ "text": "The variant of the popover"
143
+ },
144
+ "attribute": "variant",
145
+ "reflect": false,
146
+ "defaultValue": "'hover'"
147
+ },
148
+ "popover": {
89
149
  "type": "any",
90
150
  "mutable": false,
91
151
  "complexType": {
@@ -97,9 +157,9 @@ export class Tooltip {
97
157
  "optional": false,
98
158
  "docs": {
99
159
  "tags": [],
100
- "text": "The content of the tooltip"
160
+ "text": "The content of the popover"
101
161
  },
102
- "attribute": "content",
162
+ "attribute": "popover",
103
163
  "reflect": false,
104
164
  "defaultValue": "null"
105
165
  },
@@ -120,13 +180,13 @@ export class Tooltip {
120
180
  "optional": false,
121
181
  "docs": {
122
182
  "tags": [],
123
- "text": "The content of the tooltip"
183
+ "text": "The content of the popover"
124
184
  },
125
185
  "attribute": "placement",
126
186
  "reflect": false,
127
187
  "defaultValue": "'top'"
128
188
  },
129
- "forceShow": {
189
+ "show": {
130
190
  "type": "boolean",
131
191
  "mutable": false,
132
192
  "complexType": {
@@ -138,35 +198,65 @@ export class Tooltip {
138
198
  "optional": false,
139
199
  "docs": {
140
200
  "tags": [],
141
- "text": "Wether to force show the tooltip"
201
+ "text": "Wether to show the popover"
142
202
  },
143
- "attribute": "force-show",
203
+ "attribute": "show",
144
204
  "reflect": false,
145
205
  "defaultValue": "false"
206
+ },
207
+ "canManuallyClose": {
208
+ "type": "boolean",
209
+ "mutable": false,
210
+ "complexType": {
211
+ "original": "boolean",
212
+ "resolved": "boolean",
213
+ "references": {}
214
+ },
215
+ "required": false,
216
+ "optional": false,
217
+ "docs": {
218
+ "tags": [],
219
+ "text": "Wether to someone can manually close the popover"
220
+ },
221
+ "attribute": "can-manually-close",
222
+ "reflect": false,
223
+ "defaultValue": "true"
146
224
  }
147
225
  }; }
148
226
  static get elementRef() { return "_el"; }
149
227
  static get listeners() { return [{
228
+ "name": "click",
229
+ "method": "clickHandler",
230
+ "target": undefined,
231
+ "capture": true,
232
+ "passive": false
233
+ }, {
234
+ "name": "click",
235
+ "method": "documentClickHandler",
236
+ "target": "document",
237
+ "capture": true,
238
+ "passive": false
239
+ }, {
150
240
  "name": "mouseenter",
151
- "method": "_show",
241
+ "method": "mouseEnterHandler",
152
242
  "target": undefined,
153
243
  "capture": false,
154
244
  "passive": true
155
245
  }, {
156
246
  "name": "focus",
157
- "method": "_show",
247
+ "method": "mouseEnterHandler",
158
248
  "target": undefined,
159
249
  "capture": false,
160
250
  "passive": false
161
251
  }, {
162
252
  "name": "mouseleave",
163
- "method": "_hide",
253
+ "method": "mouseLeaveHandler",
164
254
  "target": undefined,
165
255
  "capture": false,
166
256
  "passive": true
167
257
  }, {
168
258
  "name": "blur",
169
- "method": "_hide",
259
+ "method": "mouseLeaveHandler",
170
260
  "target": undefined,
171
261
  "capture": false,
172
262
  "passive": false
@@ -0,0 +1,28 @@
1
+ :host {
2
+ @apply w-full inline-block mb-1;
3
+ }
4
+ :host > a {
5
+ @apply w-full h-8 px-2 cursor-pointer rounded-large;
6
+ @apply flex items-center;
7
+ @apply text-storm-medium font-medium;
8
+ @apply hover:bg-indigo-light hover:text-storm-dark;
9
+ }
10
+ :host > a > p-icon {
11
+ @apply text-mystic-dark mr-3;
12
+ }
13
+ :host > a > p-counter {
14
+ @apply ml-auto;
15
+ }
16
+ :host > a > span.has-counter {
17
+ @apply mr-3;
18
+ }
19
+ :host > a:hover > p-icon {
20
+ @apply text-storm-vague;
21
+ }
22
+
23
+ :host(.active) > a {
24
+ @apply text-indigo bg-indigo-light;
25
+ }
26
+ :host(.active) > a > p-icon {
27
+ @apply text-indigo;
28
+ }
@@ -0,0 +1,118 @@
1
+ import { Component, h, Host, Prop } from '@stencil/core';
2
+ export class NavigationItem {
3
+ constructor() {
4
+ /**
5
+ * Wether the navigation item is active
6
+ */
7
+ this.active = false;
8
+ }
9
+ render() {
10
+ return (h(Host, { class: `p-navigation-item ${this.active && 'active'}` },
11
+ h("a", { href: this.href, target: this.target },
12
+ this.icon && h("p-icon", { variant: this.icon }),
13
+ h("span", { class: this.counter && 'has-counter' },
14
+ h("slot", null)),
15
+ this.counter && h("p-counter", null, this.counter))));
16
+ }
17
+ static get is() { return "p-navigation-item"; }
18
+ static get encapsulation() { return "shadow"; }
19
+ static get originalStyleUrls() { return {
20
+ "$": ["navigation-item.component.scss"]
21
+ }; }
22
+ static get styleUrls() { return {
23
+ "$": ["navigation-item.component.css"]
24
+ }; }
25
+ static get properties() { return {
26
+ "active": {
27
+ "type": "boolean",
28
+ "mutable": false,
29
+ "complexType": {
30
+ "original": "boolean",
31
+ "resolved": "boolean",
32
+ "references": {}
33
+ },
34
+ "required": false,
35
+ "optional": false,
36
+ "docs": {
37
+ "tags": [],
38
+ "text": "Wether the navigation item is active"
39
+ },
40
+ "attribute": "active",
41
+ "reflect": false,
42
+ "defaultValue": "false"
43
+ },
44
+ "icon": {
45
+ "type": "string",
46
+ "mutable": false,
47
+ "complexType": {
48
+ "original": "IconVariant",
49
+ "resolved": "\"arrow\" | \"attachment\" | \"bread\" | \"calendar\" | \"car\" | \"checkmark\" | \"chevron\" | \"clock\" | \"cogs\" | \"comment\" | \"document\" | \"download\" | \"envelope\" | \"explanation\" | \"eye\" | \"filter\" | \"grid\" | \"headset\" | \"list\" | \"location\" | \"megaphone\" | \"minus\" | \"negative\" | \"pagination\" | \"payment\" | \"pencil\" | \"person\" | \"plus\" | \"question\" | \"receipt\" | \"report\" | \"search\" | \"settings\" | \"sick\" | \"tachometer\" | \"tool\" | \"trash\" | \"turn\" | \"upload\" | \"warning\"",
50
+ "references": {
51
+ "IconVariant": {
52
+ "location": "import",
53
+ "path": "../../atoms/icon/icon.component"
54
+ }
55
+ }
56
+ },
57
+ "required": false,
58
+ "optional": false,
59
+ "docs": {
60
+ "tags": [],
61
+ "text": "Icon of the navigation item"
62
+ },
63
+ "attribute": "icon",
64
+ "reflect": false
65
+ },
66
+ "counter": {
67
+ "type": "any",
68
+ "mutable": false,
69
+ "complexType": {
70
+ "original": "number | string",
71
+ "resolved": "number | string",
72
+ "references": {}
73
+ },
74
+ "required": false,
75
+ "optional": false,
76
+ "docs": {
77
+ "tags": [],
78
+ "text": "Icon of the navigation item"
79
+ },
80
+ "attribute": "counter",
81
+ "reflect": false
82
+ },
83
+ "href": {
84
+ "type": "string",
85
+ "mutable": false,
86
+ "complexType": {
87
+ "original": "string",
88
+ "resolved": "string",
89
+ "references": {}
90
+ },
91
+ "required": false,
92
+ "optional": false,
93
+ "docs": {
94
+ "tags": [],
95
+ "text": "The href of the navigation item"
96
+ },
97
+ "attribute": "href",
98
+ "reflect": false
99
+ },
100
+ "target": {
101
+ "type": "string",
102
+ "mutable": false,
103
+ "complexType": {
104
+ "original": "string",
105
+ "resolved": "string",
106
+ "references": {}
107
+ },
108
+ "required": false,
109
+ "optional": false,
110
+ "docs": {
111
+ "tags": [],
112
+ "text": "The target of the navigation item"
113
+ },
114
+ "attribute": "target",
115
+ "reflect": false
116
+ }
117
+ }; }
118
+ }
@@ -0,0 +1,3 @@
1
+ p-pagination {
2
+ @apply flex;
3
+ }
@@ -0,0 +1,238 @@
1
+ import { Component, Event, h, Host, Prop, Watch, } from '@stencil/core';
2
+ export class Pagination {
3
+ constructor() {
4
+ /**
5
+ * The current page
6
+ */
7
+ this.value = 1;
8
+ /**
9
+ * The amount of items per page
10
+ */
11
+ this.pageSize = 12;
12
+ this._pages = [];
13
+ this._set = [];
14
+ this._nextClick = () => {
15
+ const nextPage = this.value + 1;
16
+ if (nextPage > this._pages[this._pages.length - 1]) {
17
+ return;
18
+ }
19
+ this._changePage(nextPage);
20
+ };
21
+ this._pageClick = (p) => this._changePage(p);
22
+ this._generateSet = (range = 1, enableBoundaries = true) => {
23
+ const totalPages = this._pages.length;
24
+ if (!totalPages) {
25
+ return [];
26
+ }
27
+ let start = this.value - range;
28
+ let end = this.value + range;
29
+ if (end > totalPages) {
30
+ end = totalPages;
31
+ start = totalPages - range * 2;
32
+ start = start < 1 ? 1 : start;
33
+ }
34
+ if (start <= 1) {
35
+ start = 1;
36
+ end = Math.min(range * 2 + 1, totalPages);
37
+ }
38
+ const set = [];
39
+ const previous = {
40
+ type: 'previous',
41
+ value: h("p-icon", { variant: "chevron", rotate: 90 }),
42
+ };
43
+ const next = {
44
+ type: 'next',
45
+ value: h("p-icon", { variant: "chevron", rotate: -90 }),
46
+ };
47
+ // Disable page range, display all the pages
48
+ if (range === null) {
49
+ const p = this._pages.map((p) => ({
50
+ type: 'page',
51
+ value: p,
52
+ }));
53
+ return enableBoundaries ? [previous, ...p, next] : p;
54
+ }
55
+ if (enableBoundaries) {
56
+ set.push(previous);
57
+ }
58
+ if (start <= 3) {
59
+ for (let i = 1; i < start; i++) {
60
+ set.push({
61
+ type: 'page',
62
+ value: this._pages[i - 1],
63
+ });
64
+ }
65
+ }
66
+ else {
67
+ set.push({
68
+ type: 'page',
69
+ value: 1,
70
+ });
71
+ set.push({
72
+ type: 'ellipsis',
73
+ value: 'ellipsis',
74
+ });
75
+ }
76
+ for (let i = start; i <= end; i++) {
77
+ set.push({
78
+ type: 'page',
79
+ value: this._pages[i - 1],
80
+ });
81
+ }
82
+ if (end >= totalPages - 2) {
83
+ for (let i = end + 1; i <= totalPages; i++) {
84
+ set.push({
85
+ type: 'page',
86
+ value: this._pages[i - 1],
87
+ });
88
+ }
89
+ }
90
+ else {
91
+ set.push({
92
+ type: 'ellipsis',
93
+ });
94
+ set.push({
95
+ type: 'page',
96
+ value: this._pages[this._pages.length - 1],
97
+ });
98
+ }
99
+ if (enableBoundaries) {
100
+ set.push(next);
101
+ }
102
+ return set;
103
+ };
104
+ }
105
+ componentWillRender() {
106
+ this._generate();
107
+ }
108
+ render() {
109
+ var _a;
110
+ return (h(Host, { class: "p-pagination" }, (_a = this._set) === null || _a === void 0 ? void 0 : _a.map((p) => {
111
+ if (p.type === 'previous' || p.type === 'next') {
112
+ return (h("p-pagination-item", { onClick: () => p.type === 'previous'
113
+ ? this._previousClick()
114
+ : this._nextClick() }, p.value));
115
+ }
116
+ if (p.type === 'ellipsis') {
117
+ return h("p-pagination-item", null, "...");
118
+ }
119
+ return (h("p-pagination-item", { active: p.value === this.value, onClick: () => this._pageClick(p.value) }, p.value));
120
+ })));
121
+ }
122
+ pageChangeHandler() {
123
+ this._generate();
124
+ }
125
+ _generate() {
126
+ this._pages = this._generatePages();
127
+ this._set = this._generateSet();
128
+ }
129
+ _changePage(p) {
130
+ if (!p) {
131
+ return;
132
+ }
133
+ this.value = p;
134
+ this.valueChange.emit(this.value);
135
+ }
136
+ _previousClick() {
137
+ const previousPage = this.value - 1;
138
+ if (previousPage < this._pages[0]) {
139
+ return;
140
+ }
141
+ this._changePage(previousPage);
142
+ }
143
+ _generatePages() {
144
+ if (!this.total || !this.pageSize) {
145
+ return [];
146
+ }
147
+ const pages = Math.ceil(this.total / this.pageSize);
148
+ return new Array(pages).fill(undefined).map((_, i) => i + 1);
149
+ }
150
+ static get is() { return "p-pagination"; }
151
+ static get originalStyleUrls() { return {
152
+ "$": ["pagination.component.scss"]
153
+ }; }
154
+ static get styleUrls() { return {
155
+ "$": ["pagination.component.css"]
156
+ }; }
157
+ static get properties() { return {
158
+ "value": {
159
+ "type": "number",
160
+ "mutable": true,
161
+ "complexType": {
162
+ "original": "number",
163
+ "resolved": "number",
164
+ "references": {}
165
+ },
166
+ "required": false,
167
+ "optional": false,
168
+ "docs": {
169
+ "tags": [],
170
+ "text": "The current page"
171
+ },
172
+ "attribute": "value",
173
+ "reflect": true,
174
+ "defaultValue": "1"
175
+ },
176
+ "pageSize": {
177
+ "type": "number",
178
+ "mutable": false,
179
+ "complexType": {
180
+ "original": "number",
181
+ "resolved": "number",
182
+ "references": {}
183
+ },
184
+ "required": false,
185
+ "optional": false,
186
+ "docs": {
187
+ "tags": [],
188
+ "text": "The amount of items per page"
189
+ },
190
+ "attribute": "page-size",
191
+ "reflect": false,
192
+ "defaultValue": "12"
193
+ },
194
+ "total": {
195
+ "type": "number",
196
+ "mutable": false,
197
+ "complexType": {
198
+ "original": "number",
199
+ "resolved": "number",
200
+ "references": {}
201
+ },
202
+ "required": true,
203
+ "optional": false,
204
+ "docs": {
205
+ "tags": [],
206
+ "text": "The total amount of items"
207
+ },
208
+ "attribute": "total",
209
+ "reflect": false
210
+ }
211
+ }; }
212
+ static get events() { return [{
213
+ "method": "valueChange",
214
+ "name": "valueChange",
215
+ "bubbles": true,
216
+ "cancelable": true,
217
+ "composed": true,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": ""
221
+ },
222
+ "complexType": {
223
+ "original": "number",
224
+ "resolved": "number",
225
+ "references": {}
226
+ }
227
+ }]; }
228
+ static get watchers() { return [{
229
+ "propName": "value",
230
+ "methodName": "pageChangeHandler"
231
+ }, {
232
+ "propName": "pageSize",
233
+ "methodName": "pageChangeHandler"
234
+ }, {
235
+ "propName": "total",
236
+ "methodName": "pageChangeHandler"
237
+ }]; }
238
+ }
@@ -0,0 +1,6 @@
1
+ export const paginationValueAccessor = {
2
+ elementSelectors: ['p-pagination'],
3
+ event: 'valueChange',
4
+ targetAttr: 'value',
5
+ type: 'number',
6
+ };
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ xlarge: '0.5625rem',
2
3
  large: '0.375rem',
3
4
  DEFAULT: '0.25rem',
4
5
  medium: '0.25rem',
@@ -1,6 +1,26 @@
1
1
  module.exports = {
2
- 13: 'repeat(13, minmax(0, 1fr))',
3
- 14: 'repeat(14, minmax(0, 1fr))',
4
- 15: 'repeat(15, minmax(0, 1fr))',
5
- 16: 'repeat(16, minmax(0, 1fr))',
2
+ gridTemplateColumns: {
3
+ '13': 'repeat(13, minmax(0, 1fr))',
4
+ '14': 'repeat(14, minmax(0, 1fr))',
5
+ '15': 'repeat(15, minmax(0, 1fr))',
6
+ '16': 'repeat(16, minmax(0, 1fr))',
7
+ },
8
+ gridColumn: {
9
+ 'span-13': 'span 13 / span 13',
10
+ 'span-14': 'span 14 / span 14',
11
+ 'span-15': 'span 15 / span 15',
12
+ 'span-16': 'span 16 / span 16',
13
+ },
14
+ gridColumnStart: {
15
+ '13': '13',
16
+ '14': '14',
17
+ '15': '15',
18
+ '16': '16',
19
+ },
20
+ gridColumnEnd: {
21
+ '13': '13',
22
+ '14': '14',
23
+ '15': '15',
24
+ '16': '16',
25
+ },
6
26
  };
@@ -13,7 +13,7 @@ module.exports = {
13
13
  dropShadow: shadows,
14
14
  borderRadius,
15
15
  extend: {
16
- grid,
16
+ ...grid,
17
17
  scale,
18
18
  rotate,
19
19
  },