@propeller-commerce/propeller-v2-vue-ui 0.3.35 → 0.3.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.
- package/CHANGELOG.md +56 -0
- package/dist/components/OrderList.vue.d.ts +14 -0
- package/dist/components/SearchBar.vue.d.ts +53 -1
- package/dist/composables/vue/useOrders.d.ts +5 -0
- package/dist/index.cjs +101 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +101 -48
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1549,7 +1549,7 @@ function useOrders(options) {
|
|
|
1549
1549
|
const orders = ref([]);
|
|
1550
1550
|
const loading = ref(false);
|
|
1551
1551
|
const error = ref(null);
|
|
1552
|
-
const searchForm = ref({});
|
|
1552
|
+
const searchForm = ref(options.initialSearchForm ?? {});
|
|
1553
1553
|
const currentOrder = ref(null);
|
|
1554
1554
|
const orderLoading = ref(false);
|
|
1555
1555
|
const termFields = options.termFields ?? [
|
|
@@ -2192,6 +2192,11 @@ function useProductSearch(options) {
|
|
|
2192
2192
|
try {
|
|
2193
2193
|
const service = createServices(graphqlClient).product;
|
|
2194
2194
|
const lang = languageRef.value || "NL";
|
|
2195
|
+
const searchOrderlistIds = options.orderlistIds?.value;
|
|
2196
|
+
const orderlistScope = searchOrderlistIds && searchOrderlistIds.length > 0 ? {
|
|
2197
|
+
applyOrderlists: options.applyOrderlists?.value !== false,
|
|
2198
|
+
orderlistIds: searchOrderlistIds
|
|
2199
|
+
} : { applyOrderlists: false };
|
|
2195
2200
|
const input = {
|
|
2196
2201
|
term,
|
|
2197
2202
|
language: lang,
|
|
@@ -2203,6 +2208,7 @@ function useProductSearch(options) {
|
|
|
2203
2208
|
ProductStatus.T,
|
|
2204
2209
|
ProductStatus.S
|
|
2205
2210
|
],
|
|
2211
|
+
...orderlistScope,
|
|
2206
2212
|
sortInputs: [{ field: ProductSortField.RELEVANCE, order: SortOrder.DESC }],
|
|
2207
2213
|
searchFields: [
|
|
2208
2214
|
{
|
|
@@ -3406,7 +3412,7 @@ const _hoisted_4$J = { class: "propeller-account-menu__user-label text-xs text-m
|
|
|
3406
3412
|
const _hoisted_5$I = { class: "propeller-account-menu__user-name font-medium text-foreground truncate" };
|
|
3407
3413
|
const _hoisted_6$H = { class: "propeller-account-menu__nav py-2" };
|
|
3408
3414
|
const _hoisted_7$H = { class: "propeller-account-menu__list space-y-0.5" };
|
|
3409
|
-
const _hoisted_8$D = ["onClick", "data-active"];
|
|
3415
|
+
const _hoisted_8$D = ["href", "onClick", "data-active"];
|
|
3410
3416
|
const _hoisted_9$B = { class: "propeller-account-menu__logout-wrapper px-4 py-3 border-t border-border" };
|
|
3411
3417
|
const _hoisted_10$z = ["aria-label", "data-open"];
|
|
3412
3418
|
const _hoisted_11$v = {
|
|
@@ -3429,7 +3435,7 @@ const _hoisted_15$s = { class: "propeller-account-menu__user-label text-xs text-
|
|
|
3429
3435
|
const _hoisted_16$r = { class: "propeller-account-menu__user-name font-medium text-foreground truncate" };
|
|
3430
3436
|
const _hoisted_17$q = { class: "propeller-account-menu__nav" };
|
|
3431
3437
|
const _hoisted_18$o = { class: "propeller-account-menu__list space-y-0.5" };
|
|
3432
|
-
const _hoisted_19$o = ["onClick"];
|
|
3438
|
+
const _hoisted_19$o = ["href", "onClick"];
|
|
3433
3439
|
const _hoisted_20$m = { class: "propeller-account-menu__logout-wrapper mt-3 pt-3 border-t border-border" };
|
|
3434
3440
|
const _hoisted_21$k = {
|
|
3435
3441
|
key: 1,
|
|
@@ -3564,6 +3570,13 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3564
3570
|
menuOpen.value = false;
|
|
3565
3571
|
if (props.onMenuItemClick) props.onMenuItemClick(href);
|
|
3566
3572
|
}
|
|
3573
|
+
function handleMenuLinkClick(event, href) {
|
|
3574
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
|
3575
|
+
return;
|
|
3576
|
+
}
|
|
3577
|
+
event.preventDefault();
|
|
3578
|
+
handleMenuItemClick(href);
|
|
3579
|
+
}
|
|
3567
3580
|
function handleLogoutClick() {
|
|
3568
3581
|
menuOpen.value = false;
|
|
3569
3582
|
if (props.onLogoutClick) props.onLogoutClick();
|
|
@@ -3605,9 +3618,9 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3605
3618
|
key: link.href,
|
|
3606
3619
|
class: "propeller-account-menu__item"
|
|
3607
3620
|
}, [
|
|
3608
|
-
createElementVNode("
|
|
3609
|
-
|
|
3610
|
-
onClick:
|
|
3621
|
+
createElementVNode("a", {
|
|
3622
|
+
href: link.href,
|
|
3623
|
+
onClick: (event) => handleMenuLinkClick(event, link.href),
|
|
3611
3624
|
"data-active": isActiveLink(link.href) ? "true" : "false",
|
|
3612
3625
|
class: normalizeClass(`propeller-account-menu__link flex w-full items-center gap-3 px-4 py-2.5 text-sm font-medium transition-colors ${isActiveLink(link.href) ? "bg-secondary/5 text-secondary border-l-2 border-secondary" : "text-muted-foreground hover:bg-surface-hover hover:text-foreground"}`)
|
|
3613
3626
|
}, toDisplayString(link.label), 11, _hoisted_8$D)
|
|
@@ -3661,10 +3674,10 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3661
3674
|
key: link.href,
|
|
3662
3675
|
class: "propeller-account-menu__item"
|
|
3663
3676
|
}, [
|
|
3664
|
-
createElementVNode("
|
|
3665
|
-
|
|
3677
|
+
createElementVNode("a", {
|
|
3678
|
+
href: link.href,
|
|
3666
3679
|
class: "propeller-account-menu__link flex w-full items-center gap-3 px-3 py-2 text-sm font-medium rounded-[var(--radius-control)] text-muted-foreground hover:bg-surface-hover hover:text-foreground transition-colors",
|
|
3667
|
-
onClick:
|
|
3680
|
+
onClick: (event) => handleMenuLinkClick(event, link.href)
|
|
3668
3681
|
}, toDisplayString(link.label), 9, _hoisted_19$o)
|
|
3669
3682
|
]);
|
|
3670
3683
|
}), 128))
|
|
@@ -13844,6 +13857,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13844
13857
|
columnConfig: {},
|
|
13845
13858
|
enableSearch: { type: Boolean },
|
|
13846
13859
|
searchFields: {},
|
|
13860
|
+
initialSearchForm: {},
|
|
13861
|
+
onSearchApply: { type: Function },
|
|
13847
13862
|
termFields: {},
|
|
13848
13863
|
companyId: {},
|
|
13849
13864
|
orderStatus: {},
|
|
@@ -13888,7 +13903,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13888
13903
|
configuration: infra.configuration,
|
|
13889
13904
|
channelIds: props.channelIds,
|
|
13890
13905
|
onCartCreated: props.onCartCreated,
|
|
13891
|
-
afterReorder: props.afterReorder
|
|
13906
|
+
afterReorder: props.afterReorder,
|
|
13907
|
+
initialSearchForm: props.initialSearchForm
|
|
13892
13908
|
});
|
|
13893
13909
|
const columns = ref(
|
|
13894
13910
|
props.columns || ["id", "date", "status", "total"]
|
|
@@ -14198,11 +14214,15 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
14198
14214
|
class: "propeller-order-list__clear-btn inline-flex items-center px-4 py-2 border border-input text-sm font-medium rounded-[var(--radius-control)] shadow-sm text-muted-foreground bg-card hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary",
|
|
14199
14215
|
onClick: _cache[11] || (_cache[11] = async (event) => {
|
|
14200
14216
|
unref(resetSearch)();
|
|
14217
|
+
props.onSearchApply?.({});
|
|
14201
14218
|
})
|
|
14202
14219
|
}, toDisplayString(getLabel$1("clearButton", "Clear")), 1),
|
|
14203
14220
|
createElementVNode("button", {
|
|
14204
14221
|
class: "propeller-order-list__search-btn inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-[var(--radius-control)] shadow-sm text-primary-foreground bg-primary hover:bg-primary/80 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary",
|
|
14205
|
-
onClick: _cache[12] || (_cache[12] = async (event) =>
|
|
14222
|
+
onClick: _cache[12] || (_cache[12] = async (event) => {
|
|
14223
|
+
unref(fetchOrders)(1);
|
|
14224
|
+
props.onSearchApply?.(unref(searchForm));
|
|
14225
|
+
})
|
|
14206
14226
|
}, toDisplayString(getLabel$1("searchButton", "Search")), 1)
|
|
14207
14227
|
])
|
|
14208
14228
|
])) : createCommentVNode("", true),
|
|
@@ -14225,7 +14245,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
14225
14245
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(orders), (order, index) => {
|
|
14226
14246
|
return openBlock(), createElementBlock("tr", {
|
|
14227
14247
|
key: order.id,
|
|
14228
|
-
class:
|
|
14248
|
+
class: normalizeClass(`propeller-order-list__row hover:bg-surface-hover ${rowsClickable.value ? "cursor-pointer" : ""}`),
|
|
14229
14249
|
"data-clickable": rowsClickable.value ? "true" : "false",
|
|
14230
14250
|
onClick: async (event) => rowsClickable.value && __props.onOrderClick(order.id)
|
|
14231
14251
|
}, [
|
|
@@ -14272,7 +14292,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
14272
14292
|
], 64)) : createCommentVNode("", true)
|
|
14273
14293
|
], 10, _hoisted_36$6);
|
|
14274
14294
|
}), 128))
|
|
14275
|
-
],
|
|
14295
|
+
], 10, _hoisted_35$6);
|
|
14276
14296
|
}), 128))
|
|
14277
14297
|
])
|
|
14278
14298
|
])
|
|
@@ -19911,24 +19931,24 @@ const _hoisted_5$1 = {
|
|
|
19911
19931
|
class: "propeller-search-bar__dropdown absolute top-full left-0 right-0 mt-2 bg-card rounded-[var(--radius-container)] shadow-xl border z-50 flex flex-col max-h-96"
|
|
19912
19932
|
};
|
|
19913
19933
|
const _hoisted_6$1 = { class: "propeller-search-bar__results flex-1 overflow-y-auto" };
|
|
19914
|
-
const _hoisted_7$1 =
|
|
19915
|
-
const _hoisted_8$1 = {
|
|
19934
|
+
const _hoisted_7$1 = {
|
|
19916
19935
|
key: 0,
|
|
19917
19936
|
class: "propeller-search-bar__result-media relative w-16 h-16 flex-shrink-0"
|
|
19918
19937
|
};
|
|
19919
|
-
const
|
|
19920
|
-
const
|
|
19921
|
-
const
|
|
19922
|
-
const
|
|
19938
|
+
const _hoisted_8$1 = ["src", "alt"];
|
|
19939
|
+
const _hoisted_9$1 = { class: "flex-1 min-w-0" };
|
|
19940
|
+
const _hoisted_10$1 = { class: "propeller-search-bar__result-name font-semibold truncate" };
|
|
19941
|
+
const _hoisted_11$1 = {
|
|
19923
19942
|
key: 0,
|
|
19924
19943
|
class: "propeller-search-bar__result-sku text-sm text-muted-foreground"
|
|
19925
19944
|
};
|
|
19926
|
-
const
|
|
19927
|
-
key:
|
|
19945
|
+
const _hoisted_12$1 = {
|
|
19946
|
+
key: 2,
|
|
19928
19947
|
class: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right"
|
|
19929
19948
|
};
|
|
19930
|
-
const
|
|
19931
|
-
const
|
|
19949
|
+
const _hoisted_13$1 = { class: "propeller-search-bar__result-price-value" };
|
|
19950
|
+
const _hoisted_14$1 = { class: "propeller-search-bar__result-price-label block text-xs font-normal text-muted-foreground" };
|
|
19951
|
+
const _hoisted_15$1 = ["href"];
|
|
19932
19952
|
const _hoisted_16$1 = {
|
|
19933
19953
|
key: 1,
|
|
19934
19954
|
class: "propeller-search-bar__empty p-4 text-center text-muted-foreground"
|
|
@@ -19948,6 +19968,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
19948
19968
|
onSubmit: { type: Function },
|
|
19949
19969
|
onResultClick: { type: Function },
|
|
19950
19970
|
onViewAllClick: { type: Function },
|
|
19971
|
+
getResultHref: { type: Function },
|
|
19972
|
+
getViewAllHref: { type: Function },
|
|
19973
|
+
showPrice: { type: Boolean },
|
|
19951
19974
|
formatPrice: { type: Function },
|
|
19952
19975
|
labels: {},
|
|
19953
19976
|
includeTax: { type: Boolean },
|
|
@@ -20101,6 +20124,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20101
20124
|
}
|
|
20102
20125
|
showDropdown.value = false;
|
|
20103
20126
|
}
|
|
20127
|
+
function isModifiedClick(event) {
|
|
20128
|
+
return event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
|
|
20129
|
+
}
|
|
20130
|
+
function handleResultAnchorClick(event, result) {
|
|
20131
|
+
if (props.getResultHref) {
|
|
20132
|
+
if (isModifiedClick(event)) return;
|
|
20133
|
+
event.preventDefault();
|
|
20134
|
+
}
|
|
20135
|
+
handleResultClick(result);
|
|
20136
|
+
}
|
|
20137
|
+
function handleViewAllAnchorClick(event) {
|
|
20138
|
+
if (isModifiedClick(event)) return;
|
|
20139
|
+
event.preventDefault();
|
|
20140
|
+
handleViewAllClick();
|
|
20141
|
+
}
|
|
20104
20142
|
return (_ctx, _cache) => {
|
|
20105
20143
|
return openBlock(), createElementBlock("div", {
|
|
20106
20144
|
"data-search-bar": true,
|
|
@@ -20112,7 +20150,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20112
20150
|
onSubmit: _cache[1] || (_cache[1] = async (e) => handleSubmit(e))
|
|
20113
20151
|
}, [
|
|
20114
20152
|
createElementVNode("div", _hoisted_2$1, [
|
|
20115
|
-
_cache[
|
|
20153
|
+
_cache[3] || (_cache[3] = createElementVNode("button", {
|
|
20116
20154
|
type: "submit",
|
|
20117
20155
|
class: "propeller-search-bar__submit absolute left-3 top-1/2 transform -translate-y-1/2 p-0 bg-transparent border-none cursor-pointer"
|
|
20118
20156
|
}, [
|
|
@@ -20138,7 +20176,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20138
20176
|
value: searchTerm.value,
|
|
20139
20177
|
onInput: _cache[0] || (_cache[0] = async (e) => handleInputChange(e.target.value))
|
|
20140
20178
|
}, null, 40, _hoisted_3$1),
|
|
20141
|
-
unref(isLoading) ? (openBlock(), createElementBlock("div", _hoisted_4$1, [..._cache[
|
|
20179
|
+
unref(isLoading) ? (openBlock(), createElementBlock("div", _hoisted_4$1, [..._cache[2] || (_cache[2] = [
|
|
20142
20180
|
createElementVNode("div", { class: "propeller-search-bar__spinner animate-spin rounded-full h-5 w-5 border-b-2 border-primary" }, null, -1)
|
|
20143
20181
|
])])) : createCommentVNode("", true)
|
|
20144
20182
|
])
|
|
@@ -20147,34 +20185,49 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20147
20185
|
results.value.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
20148
20186
|
createElementVNode("div", _hoisted_6$1, [
|
|
20149
20187
|
(openBlock(true), createElementBlock(Fragment, null, renderList(results.value, (result, index) => {
|
|
20150
|
-
return openBlock(),
|
|
20188
|
+
return openBlock(), createBlock(resolveDynamicComponent(props.getResultHref ? "a" : "div"), {
|
|
20151
20189
|
key: result.id + "-" + index,
|
|
20190
|
+
href: props.getResultHref ? props.getResultHref(result) : void 0,
|
|
20152
20191
|
class: "propeller-search-bar__result flex items-center gap-4 p-3 hover:bg-surface-hover cursor-pointer border-b border-border last:border-b-0",
|
|
20153
|
-
onClick:
|
|
20154
|
-
},
|
|
20155
|
-
|
|
20156
|
-
|
|
20157
|
-
|
|
20158
|
-
|
|
20159
|
-
|
|
20160
|
-
|
|
20161
|
-
|
|
20162
|
-
|
|
20163
|
-
createElementVNode("div",
|
|
20164
|
-
|
|
20192
|
+
onClick: (event) => handleResultAnchorClick(event, result)
|
|
20193
|
+
}, {
|
|
20194
|
+
default: withCtx(() => [
|
|
20195
|
+
result.imageUrl || noImageUrl.value ? (openBlock(), createElementBlock("div", _hoisted_7$1, [
|
|
20196
|
+
createElementVNode("img", {
|
|
20197
|
+
class: "propeller-search-bar__result-image w-full h-full object-contain",
|
|
20198
|
+
src: result.imageUrl || noImageUrl.value,
|
|
20199
|
+
alt: result.name
|
|
20200
|
+
}, null, 8, _hoisted_8$1)
|
|
20201
|
+
])) : createCommentVNode("", true),
|
|
20202
|
+
createElementVNode("div", _hoisted_9$1, [
|
|
20203
|
+
createElementVNode("div", _hoisted_10$1, toDisplayString(result.name), 1),
|
|
20204
|
+
result.sku ? (openBlock(), createElementBlock("div", _hoisted_11$1, "SKU: " + toDisplayString(result.sku), 1)) : createCommentVNode("", true)
|
|
20205
|
+
]),
|
|
20206
|
+
_ctx.$slots.price ? renderSlot(_ctx.$slots, "price", {
|
|
20207
|
+
key: 1,
|
|
20208
|
+
result
|
|
20209
|
+
}) : __props.showPrice !== false && result.price !== void 0 && result.price !== null ? (openBlock(), createElementBlock("div", _hoisted_12$1, [
|
|
20210
|
+
createElementVNode("span", _hoisted_13$1, toDisplayString(formatItemPrice(leadingPrice(result))), 1),
|
|
20211
|
+
createElementVNode("span", _hoisted_14$1, toDisplayString(priceTaxLabel()), 1)
|
|
20212
|
+
])) : createCommentVNode("", true)
|
|
20165
20213
|
]),
|
|
20166
|
-
|
|
20167
|
-
|
|
20168
|
-
createElementVNode("span", _hoisted_15$1, toDisplayString(priceTaxLabel()), 1)
|
|
20169
|
-
])) : createCommentVNode("", true)
|
|
20170
|
-
], 8, _hoisted_7$1);
|
|
20214
|
+
_: 2
|
|
20215
|
+
}, 1032, ["href", "onClick"]);
|
|
20171
20216
|
}), 128))
|
|
20172
20217
|
]),
|
|
20173
|
-
itemsFound.value > results.value.length ? (openBlock(), createElementBlock(
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20218
|
+
itemsFound.value > results.value.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
20219
|
+
props.getViewAllHref ? (openBlock(), createElementBlock("a", {
|
|
20220
|
+
key: 0,
|
|
20221
|
+
href: props.getViewAllHref(searchTerm.value),
|
|
20222
|
+
class: "propeller-search-bar__view-all block flex-shrink-0 p-3 text-center text-primary hover:bg-primary/5 cursor-pointer font-semibold border-t border-border bg-card rounded-b-[var(--radius-container)]",
|
|
20223
|
+
onClick: handleViewAllAnchorClick
|
|
20224
|
+
}, toDisplayString(getLabel$1("viewAll", "View all results")) + " (" + toDisplayString(itemsFound.value) + ") ", 9, _hoisted_15$1)) : (openBlock(), createElementBlock("button", {
|
|
20225
|
+
key: 1,
|
|
20226
|
+
type: "button",
|
|
20227
|
+
class: "propeller-search-bar__view-all block w-full flex-shrink-0 p-3 text-center text-primary hover:bg-primary/5 cursor-pointer font-semibold border-t border-border bg-card rounded-b-[var(--radius-container)]",
|
|
20228
|
+
onClick: handleViewAllClick
|
|
20229
|
+
}, toDisplayString(getLabel$1("viewAll", "View all results")) + " (" + toDisplayString(itemsFound.value) + ") ", 1))
|
|
20230
|
+
], 64)) : createCommentVNode("", true)
|
|
20178
20231
|
], 64)) : createCommentVNode("", true),
|
|
20179
20232
|
results.value.length === 0 && searchTerm.value.length >= minLength.value && !unref(isLoading) ? (openBlock(), createElementBlock("div", _hoisted_16$1, toDisplayString(getLabel$1("noResults", "No products found for")) + ' "' + toDisplayString(searchTerm.value) + '" ', 1)) : createCommentVNode("", true)
|
|
20180
20233
|
])) : createCommentVNode("", true)
|