@hulkapps/app-manager-vue 1.0.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/app-manager-vue.esm.js +38978 -15111
- package/dist/app-manager-vue.min.js +9 -2
- package/dist/app-manager-vue.ssr.js +37401 -14919
- package/dist/hulkapps-app-manager.css +13284 -0
- package/dist/hulkapps-app-manager.min.css +1 -0
- package/package.json +9 -4
- package/src/components/Marketing/Banners.vue +44 -44
- package/src/components/Plans/AppManagerPlan.vue +492 -0
- package/src/components/Plans/PlanBanners.vue +50 -0
- package/src/components/Plans/YearlyPlanPromotion.vue +37 -0
- package/src/components/polaris-vue/src/components/PActionList/PActionList.vue +68 -0
- package/src/components/polaris-vue/src/components/PActionList/components/PActionListItem/PActionListItem.vue +91 -0
- package/src/components/polaris-vue/src/components/PActionList/components/PActionListSection/PActionListSection.vue +68 -0
- package/src/components/polaris-vue/src/components/PActionMenu/PActionMenu.vue +54 -0
- package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuActions/PActionMenuActions.vue +197 -0
- package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuMenuAction/PActionMenuMenuAction.vue +97 -0
- package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuMenuGroup/PActionMenuMenuGroup.vue +54 -0
- package/src/components/polaris-vue/src/components/PActionMenu/components/PActionMenuRollupActions/PActionMenuRollupActions.vue +43 -0
- package/src/components/polaris-vue/src/components/PAvatar/PAvatar.vue +104 -0
- package/src/components/polaris-vue/src/components/PBadge/PBadge.vue +86 -0
- package/src/components/polaris-vue/src/components/PBanner/PBanner.vue +132 -0
- package/src/components/polaris-vue/src/components/PBreadcrumbs/PBreadcrumbs.vue +99 -0
- package/src/components/polaris-vue/src/components/PButton/PButton.vue +396 -0
- package/src/components/polaris-vue/src/components/PButton/components/PButtonsFrom/PButtonsFrom.vue +47 -0
- package/src/components/polaris-vue/src/components/PButton/components/PUnstyledButton/PUnstyledButton.vue +340 -0
- package/src/components/polaris-vue/src/components/PButtonGroup/PButtonGroup.vue +76 -0
- package/src/components/polaris-vue/src/components/PButtonGroup/components/PButtonGroupItem/PButtonGroupItem.vue +11 -0
- package/src/components/polaris-vue/src/components/PCaption/PCaption.vue +29 -0
- package/src/components/polaris-vue/src/components/PCard/PCard.vue +118 -0
- package/src/components/polaris-vue/src/components/PCard/components/PCardFooter/PCardFooter.vue +11 -0
- package/src/components/polaris-vue/src/components/PCard/components/PCardHeader/PCardHeader.vue +69 -0
- package/src/components/polaris-vue/src/components/PCard/components/PCardSection/PCardSection.vue +54 -0
- package/src/components/polaris-vue/src/components/PCard/components/PCardSubsection/PCardSubsection.vue +12 -0
- package/src/components/polaris-vue/src/components/PConnected/PConnected.vue +44 -0
- package/src/components/polaris-vue/src/components/PConnected/components/PConnectedItem/PConnectedItem.vue +41 -0
- package/src/components/polaris-vue/src/components/PDataTable/PDataTable.vue +541 -0
- package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableCell/PDataTableCell.vue +213 -0
- package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableCellNew/PDataTableCellNew.vue +162 -0
- package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableCol/PDataTableCol.vue +75 -0
- package/src/components/polaris-vue/src/components/PDataTable/components/PDataTableRow/PDataTableRow.vue +15 -0
- package/src/components/polaris-vue/src/components/PDisplayText/PDisplayText.vue +56 -0
- package/src/components/polaris-vue/src/components/PEmptyState/PEmptyState.vue +154 -0
- package/src/components/polaris-vue/src/components/PFieldError/PFieldError.vue +41 -0
- package/src/components/polaris-vue/src/components/PFilter/PFilter.vue +252 -0
- package/src/components/polaris-vue/src/components/PFilter/components/PFilterItem/PFilterItem.vue +11 -0
- package/src/components/polaris-vue/src/components/PFilter/components/PFilterItemWrapper/PFilterItemWrapper.vue +32 -0
- package/src/components/polaris-vue/src/components/PHeading/PHeading.vue +33 -0
- package/src/components/polaris-vue/src/components/PIcon/PIcon.vue +121 -0
- package/src/components/polaris-vue/src/components/PIcon/ShopifyIcons.vue +217 -0
- package/src/components/polaris-vue/src/components/PImage/PImage.vue +49 -0
- package/src/components/polaris-vue/src/components/PLayout/PLayout.vue +42 -0
- package/src/components/polaris-vue/src/components/PLayout/components/PLayoutSection/PLayoutSection.vue +55 -0
- package/src/components/polaris-vue/src/components/PLink/PLink.vue +90 -0
- package/src/components/polaris-vue/src/components/POptionalTag/POptionalTag.vue +23 -0
- package/src/components/polaris-vue/src/components/PPage/PPage.vue +136 -0
- package/src/components/polaris-vue/src/components/PPage/components/PPageHeader/PPageHeader.vue +191 -0
- package/src/components/polaris-vue/src/components/PPage/components/PPageHeaderTitle/PPageHeaderTitle.vue +63 -0
- package/src/components/polaris-vue/src/components/PPagination/PPagination.vue +119 -0
- package/src/components/polaris-vue/src/components/PPopover/PPopover.vue +298 -0
- package/src/components/polaris-vue/src/components/PPopover/components/PPopoverOverlay/PPopoverOverlay.vue +66 -0
- package/src/components/polaris-vue/src/components/PPopover/components/PPositionedOverlay/PPositionedOverlay.vue +289 -0
- package/src/components/polaris-vue/src/components/PSpinner/PSpinner.vue +60 -0
- package/src/components/polaris-vue/src/components/PStack/PStack.vue +84 -0
- package/src/components/polaris-vue/src/components/PStack/components/PStackItem/PStackItem.vue +49 -0
- package/src/components/polaris-vue/src/components/PSubheading/PSubheading.vue +36 -0
- package/src/components/polaris-vue/src/components/PTag/PTag.vue +89 -0
- package/src/components/polaris-vue/src/components/PTextContainer/PTextContainer.vue +41 -0
- package/src/components/polaris-vue/src/components/PTextField/PTextField.vue +229 -0
- package/src/components/polaris-vue/src/components/PTextField/components/PFieldResizer/PFieldResizer.vue +79 -0
- package/src/components/polaris-vue/src/components/PTextField/components/PInput/PInput.vue +473 -0
- package/src/components/polaris-vue/src/components/PTextField/components/PSpinner/PSpinner.vue +47 -0
- package/src/components/polaris-vue/src/components/PTextStyle/PTextStyle.vue +60 -0
- package/src/components/polaris-vue/src/components/PThumbnail/PThumbnail.vue +71 -0
- package/src/components/polaris-vue/src/components/PToggle/PToggle.vue +81 -0
- package/src/components/polaris-vue/src/components/PUnstyledLink/PUnstyledLink.vue +67 -0
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<PFilter v-if="$slots.hasOwnProperty('filter') || hasFilter" v-bind="$attrs" :resourceName="resource"
|
|
4
|
+
@remove-tag="onRemoveFilter" @input="onFilterInputChanged">
|
|
5
|
+
<!-- @slot Add a custom Filter content -->
|
|
6
|
+
<slot name="filter" v-if="$slots.hasOwnProperty('filter')"></slot>
|
|
7
|
+
<template slot="auxiliaryContainer">
|
|
8
|
+
<!-- @slot Add auxiliary filters -->
|
|
9
|
+
<slot name="auxiliaryContainer"/>
|
|
10
|
+
</template>
|
|
11
|
+
</PFilter>
|
|
12
|
+
<div class="Polaris-DataTable" v-if="rows.length > 0 || $slots.hasOwnProperty('body')">
|
|
13
|
+
<div class="Polaris-DataTable__ScrollContainer">
|
|
14
|
+
<table class="Polaris-DataTable__Table">
|
|
15
|
+
<thead ref="thead">
|
|
16
|
+
<!-- @slot Add a custom Header content -->
|
|
17
|
+
<slot name="head">
|
|
18
|
+
<template>
|
|
19
|
+
<tr>
|
|
20
|
+
<PDataTableCellNew
|
|
21
|
+
v-for="(heading, hIndex) in headings"
|
|
22
|
+
:key="`heading-cell-${hIndex}`"
|
|
23
|
+
header
|
|
24
|
+
:content="heading.content"
|
|
25
|
+
:value="heading.value"
|
|
26
|
+
:width="heading.width"
|
|
27
|
+
:sort="sort"
|
|
28
|
+
:sortable="heading.sortable"
|
|
29
|
+
:default-sort-direction="defaultSortDirection"
|
|
30
|
+
:content-type="heading.type ? heading.type : columnContentTypes[hIndex]"
|
|
31
|
+
:first-column="hIndex === 0"
|
|
32
|
+
:truncate="truncate"
|
|
33
|
+
:verticalAlign="verticalAlign"
|
|
34
|
+
@sort-changed="handleSortChange"
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
<!-- @deprecated Remove in version 4.0.0 - START -->
|
|
38
|
+
<PDataTableCell
|
|
39
|
+
v-if="hasActions"
|
|
40
|
+
header
|
|
41
|
+
content="Actions"
|
|
42
|
+
:sortable="false"
|
|
43
|
+
contentType="text"
|
|
44
|
+
:firstColumn="false"
|
|
45
|
+
:truncate="false"
|
|
46
|
+
:verticalAlign="verticalAlign"/>
|
|
47
|
+
<!-- @deprecated Remove in version 4.0.0 - END -->
|
|
48
|
+
|
|
49
|
+
</tr>
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
<tr v-if="!showTotalsInFooter">
|
|
53
|
+
<PDataTableCellNew
|
|
54
|
+
v-for="(total, index) in totals"
|
|
55
|
+
:key="`total-cell-${index}`"
|
|
56
|
+
total
|
|
57
|
+
:value="index === 0 ? totalsRowHeading : total"
|
|
58
|
+
:content-type="total !== '' && index > 0 ? 'numeric': columnContentTypes[index]"
|
|
59
|
+
:first-column="index === 0"
|
|
60
|
+
:truncate="truncate"
|
|
61
|
+
:vertical-align="verticalAlign"
|
|
62
|
+
:sortable="false"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<!-- @deprecated Remove in version 4.0.0 - START -->
|
|
66
|
+
<PDataTableCell
|
|
67
|
+
total
|
|
68
|
+
v-if="totals.length && hasActions"
|
|
69
|
+
:totalInFooter="showTotalsInFooter"
|
|
70
|
+
:verticalAlign="verticalAlign"/>
|
|
71
|
+
<!-- @deprecated Remove in version 4.0.0 - END -->
|
|
72
|
+
|
|
73
|
+
</tr>
|
|
74
|
+
</template>
|
|
75
|
+
</slot>
|
|
76
|
+
</thead>
|
|
77
|
+
|
|
78
|
+
<!-- @slot Overwrite tbody element.<br />**Warning:** Using this slot will not allow rows populated from package, you must have to utilize **body** slot as well.
|
|
79
|
+
-->
|
|
80
|
+
<slot name="tbody">
|
|
81
|
+
<tbody ref="tbody">
|
|
82
|
+
<template v-if="loading">
|
|
83
|
+
<tr class="Polaris-ResourceList__SpinnerContainer"
|
|
84
|
+
:style="{'padding-top': `${topPadding}px`}">
|
|
85
|
+
<PSpinner
|
|
86
|
+
:size="!$slots.hasOwnProperty('body') && rows.length < 2 ? 'small' : 'large'"/>
|
|
87
|
+
</tr>
|
|
88
|
+
<tr class="Polaris-ResourceList__LoadingOverlay"/>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<!-- @slot Add a custom Body content -->
|
|
92
|
+
<slot name="body">
|
|
93
|
+
<template v-if="!hasOldRows">
|
|
94
|
+
<template v-for="row in rows">
|
|
95
|
+
<!-- @slot Replace the default rendering of a row. This slot provides row values.
|
|
96
|
+
|
|
97
|
+
Access values with `slot-props` attribute -->
|
|
98
|
+
<slot name="item" :item="row">
|
|
99
|
+
<tr class="Polaris-DataTable__TableRow">
|
|
100
|
+
<template v-for="(heading, hIndex) in headings">
|
|
101
|
+
<PDataTableCellNew
|
|
102
|
+
:value="row[heading.value]"
|
|
103
|
+
:header-value="heading.value"
|
|
104
|
+
:first-column="hIndex === 0"
|
|
105
|
+
:content-type="headings[hIndex].type ? headings[hIndex].type : columnContentTypes[hIndex]"
|
|
106
|
+
:truncate="truncate"
|
|
107
|
+
:vertical-align="verticalAlign"
|
|
108
|
+
:sortable="false">
|
|
109
|
+
<template v-slot:[`item.${heading.value}`]="slotProps">
|
|
110
|
+
<!-- @slot Customize a specific column. This slot provides row values.
|
|
111
|
+
|
|
112
|
+
Access values with `slot-props` attribute. -->
|
|
113
|
+
<slot :name="`item.${heading.value}`" :item="row"/>
|
|
114
|
+
</template>
|
|
115
|
+
</PDataTableCellNew>
|
|
116
|
+
</template>
|
|
117
|
+
</tr>
|
|
118
|
+
</slot>
|
|
119
|
+
</template>
|
|
120
|
+
</template>
|
|
121
|
+
<!-- @deprecated Remove in version 4.0.0 - START -->
|
|
122
|
+
<template v-else>
|
|
123
|
+
<tr
|
|
124
|
+
class="Polaris-DataTable__TableRow"
|
|
125
|
+
v-for="(row, rIndex) in rows"
|
|
126
|
+
:key="`row-${rIndex}`">
|
|
127
|
+
<PDataTableCell
|
|
128
|
+
v-for="(data, cIndex) in row"
|
|
129
|
+
:key="`cell-${cIndex}-row-${rIndex}`"
|
|
130
|
+
:content="typeof data !== 'object' ? data : data.content"
|
|
131
|
+
:action="data.url || data.to || data.onAction ? data : null"
|
|
132
|
+
:toggle="typeof data.status == 'boolean' && data.onAction ? data : null"
|
|
133
|
+
:badge="typeof data === 'object' && !(data.url || data.to) && !data.onAction ? data : null"
|
|
134
|
+
:contentType="headings[cIndex].type ? headings[cIndex].type : columnContentTypes[cIndex]"
|
|
135
|
+
:firstColumn="cIndex === 0"
|
|
136
|
+
:truncate="truncate"
|
|
137
|
+
:verticalAlign="verticalAlign"
|
|
138
|
+
/>
|
|
139
|
+
<PDataTableCell
|
|
140
|
+
v-if="hasActions"
|
|
141
|
+
:actions="actions"
|
|
142
|
+
:value="ids[rIndex]"
|
|
143
|
+
:verticalAlign="verticalAlign"
|
|
144
|
+
/>
|
|
145
|
+
</tr>
|
|
146
|
+
</template>
|
|
147
|
+
<!-- @deprecated Remove in version 4.0.0 - END -->
|
|
148
|
+
|
|
149
|
+
</slot>
|
|
150
|
+
</tbody>
|
|
151
|
+
</slot>
|
|
152
|
+
<tfoot v-if="showTotalsInFooter">
|
|
153
|
+
<tr>
|
|
154
|
+
<PDataTableCellNew
|
|
155
|
+
v-for="(total, index) in totals"
|
|
156
|
+
:key="`total-cell-${index}`"
|
|
157
|
+
total
|
|
158
|
+
:total-in-footer="showTotalsInFooter"
|
|
159
|
+
:value="index === 0 ? totalsRowHeading : total"
|
|
160
|
+
:content-type="total !== '' && index > 0 ? 'numeric': columnContentTypes[index]"
|
|
161
|
+
:first-column="index === 0"
|
|
162
|
+
:truncate="truncate"
|
|
163
|
+
:vertical-align="verticalAlign"
|
|
164
|
+
:sortable="false"
|
|
165
|
+
/>
|
|
166
|
+
|
|
167
|
+
<!-- @deprecated Remove in version 4.0.0 - START -->
|
|
168
|
+
<PDataTableCell
|
|
169
|
+
total
|
|
170
|
+
v-if="totals.length && hasActions"
|
|
171
|
+
:totalInFooter="showTotalsInFooter"
|
|
172
|
+
:verticalAlign="verticalAlign"/>
|
|
173
|
+
<!-- @deprecated Remove in version 4.0.0 - END -->
|
|
174
|
+
</tr>
|
|
175
|
+
</tfoot>
|
|
176
|
+
</table>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<div v-if="footerContent || $slots.footer" class="Polaris-DataTable__Footer">
|
|
180
|
+
<!-- @slot Add a custom Footer content -->
|
|
181
|
+
<slot name="footer">
|
|
182
|
+
{{ footerContent }}
|
|
183
|
+
</slot>
|
|
184
|
+
</div>
|
|
185
|
+
<div class="Polaris-DataTable__Pagination" v-if="hasPagination">
|
|
186
|
+
<PPagination v-bind="pagination"/>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
<div v-else>
|
|
190
|
+
<!-- @slot Display when no record available -->
|
|
191
|
+
<slot name="emptyState">
|
|
192
|
+
<PEmptyState
|
|
193
|
+
:heading="emptyStateTitle"
|
|
194
|
+
:image="emptyStateImage"
|
|
195
|
+
/>
|
|
196
|
+
</slot>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
</template>
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
<script>
|
|
203
|
+
import { PDataTableCellNew } from '../../components/PDataTable/components/PDataTableCellNew';
|
|
204
|
+
import { PDataTableCell } from '../../components/PDataTable/components/PDataTableCell';
|
|
205
|
+
import { PPagination } from '../../components/PPagination';
|
|
206
|
+
import { PFilter } from '../../components/PFilter';
|
|
207
|
+
import { PSpinner } from '../../components/PSpinner';
|
|
208
|
+
import { PEmptyState } from '../../components/PEmptyState';
|
|
209
|
+
import ArrayValidator from '../../utilities/validators/ArrayValidator';
|
|
210
|
+
import StringValidator from '../../utilities/validators/StringValidator';
|
|
211
|
+
import ObjectValidator from '../../utilities/validators/ObjectValidator';
|
|
212
|
+
|
|
213
|
+
const Status = ['success', 'info', 'attention', 'warning', 'new', 'critical'];
|
|
214
|
+
const Progress = ['incomplete', 'partiallyComplete', 'complete'];
|
|
215
|
+
const Size = ['medium', 'small'];
|
|
216
|
+
|
|
217
|
+
const Headings = {
|
|
218
|
+
/** Header title */
|
|
219
|
+
content: {
|
|
220
|
+
type: String,
|
|
221
|
+
required: true,
|
|
222
|
+
},
|
|
223
|
+
/** Header value */
|
|
224
|
+
value: {
|
|
225
|
+
type: String,
|
|
226
|
+
required: true,
|
|
227
|
+
},
|
|
228
|
+
/** Value type */
|
|
229
|
+
type: {
|
|
230
|
+
type: String,
|
|
231
|
+
required: true,
|
|
232
|
+
},
|
|
233
|
+
/** Sortable values */
|
|
234
|
+
sortable: Boolean,
|
|
235
|
+
/** Header Column width */
|
|
236
|
+
width: String,
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const TotalsName = {
|
|
240
|
+
/** Singular label */
|
|
241
|
+
singular: {
|
|
242
|
+
type: String,
|
|
243
|
+
required: true,
|
|
244
|
+
},
|
|
245
|
+
/** Plural label */
|
|
246
|
+
plural: {
|
|
247
|
+
type: String,
|
|
248
|
+
required: true,
|
|
249
|
+
},
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const SortDirection = ['ascending', 'descending', 'none'];
|
|
253
|
+
const VerticalAlign = ['top', 'bottom', 'middle', 'baseline'];
|
|
254
|
+
|
|
255
|
+
const Sort = {
|
|
256
|
+
value: {
|
|
257
|
+
type: String,
|
|
258
|
+
required: true,
|
|
259
|
+
},
|
|
260
|
+
direction: {
|
|
261
|
+
type: String,
|
|
262
|
+
required: true,
|
|
263
|
+
expectedValues: SortDirection,
|
|
264
|
+
},
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* <br/>
|
|
269
|
+
* <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
|
|
270
|
+
* sans-serif;">Data tables are used to organize and display all information from a data set. While a data
|
|
271
|
+
* visualization represents part of data set, a data table lets merchants view details from the entire set. This helps
|
|
272
|
+
* merchants compare and analyze the data.</h4>
|
|
273
|
+
*/
|
|
274
|
+
export default {
|
|
275
|
+
name: 'PDataTable',
|
|
276
|
+
components: {
|
|
277
|
+
PDataTableCellNew, PPagination, PFilter, PSpinner, PEmptyState, PDataTableCell,
|
|
278
|
+
},
|
|
279
|
+
props: {
|
|
280
|
+
/**
|
|
281
|
+
* List of data types, which determines content alignment for each column. Data types are "text," which aligns left,
|
|
282
|
+
* or "numeric," which aligns right.
|
|
283
|
+
*/
|
|
284
|
+
columnContentTypes: {
|
|
285
|
+
type: Array,
|
|
286
|
+
default: () => ([]),
|
|
287
|
+
},
|
|
288
|
+
/**
|
|
289
|
+
* The direction to sort the table rows on first click or keypress
|
|
290
|
+
* of a sortable column heading.
|
|
291
|
+
*/
|
|
292
|
+
defaultSortDirection: {
|
|
293
|
+
type: String,
|
|
294
|
+
default: 'ascending',
|
|
295
|
+
...StringValidator('defaultSortDirection', SortDirection),
|
|
296
|
+
},
|
|
297
|
+
/**
|
|
298
|
+
* Content centered in the full width cell of the table footer row.
|
|
299
|
+
*/
|
|
300
|
+
footerContent: {
|
|
301
|
+
type: [String, Number, Object, Array],
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
* List of column headings.
|
|
305
|
+
*/
|
|
306
|
+
headings: {
|
|
307
|
+
type: Array,
|
|
308
|
+
default: () => ([]),
|
|
309
|
+
...ArrayValidator('headings', Headings),
|
|
310
|
+
},
|
|
311
|
+
/**
|
|
312
|
+
* Lists of data points which map to table body rows.
|
|
313
|
+
*/
|
|
314
|
+
rows: {
|
|
315
|
+
type: Array,
|
|
316
|
+
default: () => [[]],
|
|
317
|
+
},
|
|
318
|
+
/**
|
|
319
|
+
* Placement of totals row within table.
|
|
320
|
+
*/
|
|
321
|
+
showTotalsInFooter: {
|
|
322
|
+
type: Boolean,
|
|
323
|
+
default: false,
|
|
324
|
+
},
|
|
325
|
+
/**
|
|
326
|
+
* List of numeric column totals, highlighted in the table’s header below column headings. Use empty strings as
|
|
327
|
+
* placeholders for columns with no total.
|
|
328
|
+
*/
|
|
329
|
+
totals: {
|
|
330
|
+
type: Array,
|
|
331
|
+
default: () => ([]),
|
|
332
|
+
},
|
|
333
|
+
/**
|
|
334
|
+
* Custom totals row heading.
|
|
335
|
+
*/
|
|
336
|
+
totalsName: {
|
|
337
|
+
type: Object,
|
|
338
|
+
default: () => ({}),
|
|
339
|
+
...ObjectValidator('totalsName', TotalsName),
|
|
340
|
+
},
|
|
341
|
+
/**
|
|
342
|
+
* Truncate content in first column instead of wrapping.
|
|
343
|
+
*/
|
|
344
|
+
truncate: {
|
|
345
|
+
type: Boolean,
|
|
346
|
+
default: false,
|
|
347
|
+
},
|
|
348
|
+
/**
|
|
349
|
+
* Vertical alignment of content in the cells.
|
|
350
|
+
*/
|
|
351
|
+
verticalAlign: {
|
|
352
|
+
type: String,
|
|
353
|
+
default: 'top',
|
|
354
|
+
...StringValidator('verticalAlign', VerticalAlign),
|
|
355
|
+
},
|
|
356
|
+
/**
|
|
357
|
+
* Callback fired on click or keypress of a sortable column heading.
|
|
358
|
+
*/
|
|
359
|
+
sort: {
|
|
360
|
+
type: Object,
|
|
361
|
+
default: () => ({}),
|
|
362
|
+
...ObjectValidator('sort', Sort),
|
|
363
|
+
},
|
|
364
|
+
/**
|
|
365
|
+
* Display only search filter.
|
|
366
|
+
*/
|
|
367
|
+
hasFilter: {
|
|
368
|
+
type: Boolean,
|
|
369
|
+
default: false,
|
|
370
|
+
},
|
|
371
|
+
/**
|
|
372
|
+
* Data table has pagination.
|
|
373
|
+
*/
|
|
374
|
+
hasPagination: {
|
|
375
|
+
type: Boolean,
|
|
376
|
+
default: false,
|
|
377
|
+
},
|
|
378
|
+
/**
|
|
379
|
+
* Data table is loading.
|
|
380
|
+
*/
|
|
381
|
+
loading: {
|
|
382
|
+
type: Boolean,
|
|
383
|
+
default: false,
|
|
384
|
+
},
|
|
385
|
+
/**
|
|
386
|
+
* Pagination object.
|
|
387
|
+
*/
|
|
388
|
+
pagination: {
|
|
389
|
+
type: Object,
|
|
390
|
+
default: () => ({}),
|
|
391
|
+
},
|
|
392
|
+
/**
|
|
393
|
+
* Display empty state if record not found!
|
|
394
|
+
*/
|
|
395
|
+
emptyStateTitle: {
|
|
396
|
+
type: String,
|
|
397
|
+
default: 'No record found!',
|
|
398
|
+
},
|
|
399
|
+
/**
|
|
400
|
+
* Display empty state image if record not found!
|
|
401
|
+
*/
|
|
402
|
+
emptyStateImage: {
|
|
403
|
+
type: String,
|
|
404
|
+
default: 'https://cdn.shopify.com/s/files/1/0262/4071/2726/files/emptystate-files.png',
|
|
405
|
+
},
|
|
406
|
+
// ============Deprecated Props============
|
|
407
|
+
/**
|
|
408
|
+
* Handle action events for the button.
|
|
409
|
+
*
|
|
410
|
+
* **Deprecation:-** `actions` will be removed in version 4.0.0,
|
|
411
|
+
* use `headings` with extra object.
|
|
412
|
+
* @deprecated
|
|
413
|
+
*/
|
|
414
|
+
actions: {
|
|
415
|
+
type: Array,
|
|
416
|
+
default: () => ([]),
|
|
417
|
+
},
|
|
418
|
+
/**
|
|
419
|
+
* Data ids
|
|
420
|
+
*
|
|
421
|
+
* **Deprecation:-** `ids` will be removed in version 4.0.0,
|
|
422
|
+
* @deprecated
|
|
423
|
+
*/
|
|
424
|
+
ids: {
|
|
425
|
+
type: Array,
|
|
426
|
+
default: () => ([]),
|
|
427
|
+
},
|
|
428
|
+
/**
|
|
429
|
+
* Search Placeholder
|
|
430
|
+
*
|
|
431
|
+
* **Deprecation:-** `searchPlaceholder` will be removed in version 4.0.0, use `resourceName` instead.
|
|
432
|
+
* @deprecated
|
|
433
|
+
*/
|
|
434
|
+
searchPlaceholder: {
|
|
435
|
+
type: String,
|
|
436
|
+
default: null,
|
|
437
|
+
},
|
|
438
|
+
// ============Deprecated Props END============
|
|
439
|
+
},
|
|
440
|
+
data() {
|
|
441
|
+
return {
|
|
442
|
+
topPadding: 8,
|
|
443
|
+
};
|
|
444
|
+
},
|
|
445
|
+
computed: {
|
|
446
|
+
hasOldRows() {
|
|
447
|
+
return this.rows.length > 0 && this.rows[0].constructor === Array;
|
|
448
|
+
},
|
|
449
|
+
hasActions() {
|
|
450
|
+
return this.actions && this.actions.length > 0;
|
|
451
|
+
},
|
|
452
|
+
resource() {
|
|
453
|
+
if (this.searchPlaceholder != null) {
|
|
454
|
+
return {
|
|
455
|
+
singular: this.searchPlaceholder,
|
|
456
|
+
plural: this.searchPlaceholder,
|
|
457
|
+
};
|
|
458
|
+
} else {
|
|
459
|
+
return this.$attrs.resourceName;
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
totalsRowHeading() {
|
|
463
|
+
const totalsLabel = Object.keys(this.totalsName).length > 0 ? this.totalsName : {
|
|
464
|
+
singular: 'Total',
|
|
465
|
+
plural: 'Totals',
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
return this.totals.length > 0 &&
|
|
469
|
+
this.totals.filter((total) => total !== '' || typeof (total !== 'number')).length > 1 ?
|
|
470
|
+
totalsLabel.plural :
|
|
471
|
+
totalsLabel.singular;
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
methods: {
|
|
475
|
+
onRemoveFilter(tag) {
|
|
476
|
+
/**
|
|
477
|
+
* Removes filter tag
|
|
478
|
+
*/
|
|
479
|
+
this.$emit('filter-removed', tag);
|
|
480
|
+
},
|
|
481
|
+
onFilterInputChanged(value) {
|
|
482
|
+
/**
|
|
483
|
+
* Works on keypress
|
|
484
|
+
*/
|
|
485
|
+
this.$emit('input-filter-changed', value);
|
|
486
|
+
},
|
|
487
|
+
handleSortChange(value, direction) {
|
|
488
|
+
/**
|
|
489
|
+
* Handle sorting on columns
|
|
490
|
+
*/
|
|
491
|
+
this.$emit('sort-changed', value, direction);
|
|
492
|
+
},
|
|
493
|
+
handleDeprecations() {
|
|
494
|
+
if (this.searchPlaceholder != null) {
|
|
495
|
+
// tslint:disable-next-line:no-console
|
|
496
|
+
console.error('Deprecation Notice: `searchPlaceholder` will be removed in version 4.0.0, use `resourceName` instead. ' +
|
|
497
|
+
'Please check resourceName syntax here: https://polaris-vue.hulkapps.com/?path=/docs/lists-tables-filter--filter');
|
|
498
|
+
}
|
|
499
|
+
if (this.actions.length > 0) {
|
|
500
|
+
// tslint:disable-next-line:no-console
|
|
501
|
+
console.error('Deprecation Notice: `actions` will be removed in version 4.0.0, use `headings` with extra object. '
|
|
502
|
+
+ 'Please check new example of' +
|
|
503
|
+
' DataTable: https://polaris-vue.hulkapps.com/?path=/docs/lists-tables-data-table-slot--customisable-row');
|
|
504
|
+
}
|
|
505
|
+
if (this.ids.length > 0) {
|
|
506
|
+
// tslint:disable-next-line:no-console
|
|
507
|
+
console.error('Deprecation Notice: `ids` will be removed in version 4.0.0. ' +
|
|
508
|
+
'Please check new example of' +
|
|
509
|
+
' DataTable: https://polaris-vue.hulkapps.com/?path=/docs/lists-tables-data-table-slot--customisable-row');
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
mounted() {
|
|
514
|
+
let loadingPosition = 0;
|
|
515
|
+
|
|
516
|
+
if (typeof window !== 'undefined' && this.$refs.hasOwnProperty('tbody')) {
|
|
517
|
+
const overlay = (this.$refs.tbody).getBoundingClientRect();
|
|
518
|
+
const viewportHeight = Math.max(document.documentElement ?
|
|
519
|
+
document.documentElement.clientHeight : 0, window.innerHeight || 0);
|
|
520
|
+
const overflow = viewportHeight - overlay.height;
|
|
521
|
+
const spinnerHeight = this.rows.length === 1 ? 28 : 45;
|
|
522
|
+
loadingPosition = overflow > 0 ? (overlay.height - spinnerHeight) / 2 :
|
|
523
|
+
(viewportHeight - overlay.top - spinnerHeight) / 2;
|
|
524
|
+
loadingPosition = loadingPosition + (this.$refs.thead).getBoundingClientRect().height;
|
|
525
|
+
this.topPadding = loadingPosition > 0 ? loadingPosition : this.topPadding;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
this.handleDeprecations();
|
|
529
|
+
},
|
|
530
|
+
}
|
|
531
|
+
</script>
|
|
532
|
+
|
|
533
|
+
<style scoped>
|
|
534
|
+
.Polaris-DataTable__Pagination {
|
|
535
|
+
text-align: center;
|
|
536
|
+
padding: 1.6rem;
|
|
537
|
+
border-top: 0.1rem solid #e1e3e5;
|
|
538
|
+
border-bottom-left-radius: 0.4rem;
|
|
539
|
+
border-bottom-right-radius: 0.4rem;
|
|
540
|
+
}
|
|
541
|
+
</style>
|