@propeller-commerce/propeller-v2-vue-ui 0.3.35 → 0.3.36
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 +34 -0
- package/dist/components/OrderList.vue.d.ts +14 -0
- package/dist/components/SearchBar.vue.d.ts +14 -0
- package/dist/composables/vue/useOrders.d.ts +5 -0
- package/dist/index.cjs +90 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +90 -47
- 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 ?? [
|
|
@@ -3406,7 +3406,7 @@ const _hoisted_4$J = { class: "propeller-account-menu__user-label text-xs text-m
|
|
|
3406
3406
|
const _hoisted_5$I = { class: "propeller-account-menu__user-name font-medium text-foreground truncate" };
|
|
3407
3407
|
const _hoisted_6$H = { class: "propeller-account-menu__nav py-2" };
|
|
3408
3408
|
const _hoisted_7$H = { class: "propeller-account-menu__list space-y-0.5" };
|
|
3409
|
-
const _hoisted_8$D = ["onClick", "data-active"];
|
|
3409
|
+
const _hoisted_8$D = ["href", "onClick", "data-active"];
|
|
3410
3410
|
const _hoisted_9$B = { class: "propeller-account-menu__logout-wrapper px-4 py-3 border-t border-border" };
|
|
3411
3411
|
const _hoisted_10$z = ["aria-label", "data-open"];
|
|
3412
3412
|
const _hoisted_11$v = {
|
|
@@ -3429,7 +3429,7 @@ const _hoisted_15$s = { class: "propeller-account-menu__user-label text-xs text-
|
|
|
3429
3429
|
const _hoisted_16$r = { class: "propeller-account-menu__user-name font-medium text-foreground truncate" };
|
|
3430
3430
|
const _hoisted_17$q = { class: "propeller-account-menu__nav" };
|
|
3431
3431
|
const _hoisted_18$o = { class: "propeller-account-menu__list space-y-0.5" };
|
|
3432
|
-
const _hoisted_19$o = ["onClick"];
|
|
3432
|
+
const _hoisted_19$o = ["href", "onClick"];
|
|
3433
3433
|
const _hoisted_20$m = { class: "propeller-account-menu__logout-wrapper mt-3 pt-3 border-t border-border" };
|
|
3434
3434
|
const _hoisted_21$k = {
|
|
3435
3435
|
key: 1,
|
|
@@ -3564,6 +3564,13 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3564
3564
|
menuOpen.value = false;
|
|
3565
3565
|
if (props.onMenuItemClick) props.onMenuItemClick(href);
|
|
3566
3566
|
}
|
|
3567
|
+
function handleMenuLinkClick(event, href) {
|
|
3568
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
|
3569
|
+
return;
|
|
3570
|
+
}
|
|
3571
|
+
event.preventDefault();
|
|
3572
|
+
handleMenuItemClick(href);
|
|
3573
|
+
}
|
|
3567
3574
|
function handleLogoutClick() {
|
|
3568
3575
|
menuOpen.value = false;
|
|
3569
3576
|
if (props.onLogoutClick) props.onLogoutClick();
|
|
@@ -3605,9 +3612,9 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3605
3612
|
key: link.href,
|
|
3606
3613
|
class: "propeller-account-menu__item"
|
|
3607
3614
|
}, [
|
|
3608
|
-
createElementVNode("
|
|
3609
|
-
|
|
3610
|
-
onClick:
|
|
3615
|
+
createElementVNode("a", {
|
|
3616
|
+
href: link.href,
|
|
3617
|
+
onClick: (event) => handleMenuLinkClick(event, link.href),
|
|
3611
3618
|
"data-active": isActiveLink(link.href) ? "true" : "false",
|
|
3612
3619
|
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
3620
|
}, toDisplayString(link.label), 11, _hoisted_8$D)
|
|
@@ -3661,10 +3668,10 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3661
3668
|
key: link.href,
|
|
3662
3669
|
class: "propeller-account-menu__item"
|
|
3663
3670
|
}, [
|
|
3664
|
-
createElementVNode("
|
|
3665
|
-
|
|
3671
|
+
createElementVNode("a", {
|
|
3672
|
+
href: link.href,
|
|
3666
3673
|
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:
|
|
3674
|
+
onClick: (event) => handleMenuLinkClick(event, link.href)
|
|
3668
3675
|
}, toDisplayString(link.label), 9, _hoisted_19$o)
|
|
3669
3676
|
]);
|
|
3670
3677
|
}), 128))
|
|
@@ -13844,6 +13851,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13844
13851
|
columnConfig: {},
|
|
13845
13852
|
enableSearch: { type: Boolean },
|
|
13846
13853
|
searchFields: {},
|
|
13854
|
+
initialSearchForm: {},
|
|
13855
|
+
onSearchApply: { type: Function },
|
|
13847
13856
|
termFields: {},
|
|
13848
13857
|
companyId: {},
|
|
13849
13858
|
orderStatus: {},
|
|
@@ -13888,7 +13897,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13888
13897
|
configuration: infra.configuration,
|
|
13889
13898
|
channelIds: props.channelIds,
|
|
13890
13899
|
onCartCreated: props.onCartCreated,
|
|
13891
|
-
afterReorder: props.afterReorder
|
|
13900
|
+
afterReorder: props.afterReorder,
|
|
13901
|
+
initialSearchForm: props.initialSearchForm
|
|
13892
13902
|
});
|
|
13893
13903
|
const columns = ref(
|
|
13894
13904
|
props.columns || ["id", "date", "status", "total"]
|
|
@@ -14198,11 +14208,15 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
14198
14208
|
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
14209
|
onClick: _cache[11] || (_cache[11] = async (event) => {
|
|
14200
14210
|
unref(resetSearch)();
|
|
14211
|
+
props.onSearchApply?.({});
|
|
14201
14212
|
})
|
|
14202
14213
|
}, toDisplayString(getLabel$1("clearButton", "Clear")), 1),
|
|
14203
14214
|
createElementVNode("button", {
|
|
14204
14215
|
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) =>
|
|
14216
|
+
onClick: _cache[12] || (_cache[12] = async (event) => {
|
|
14217
|
+
unref(fetchOrders)(1);
|
|
14218
|
+
props.onSearchApply?.(unref(searchForm));
|
|
14219
|
+
})
|
|
14206
14220
|
}, toDisplayString(getLabel$1("searchButton", "Search")), 1)
|
|
14207
14221
|
])
|
|
14208
14222
|
])) : createCommentVNode("", true),
|
|
@@ -14225,7 +14239,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
14225
14239
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(orders), (order, index) => {
|
|
14226
14240
|
return openBlock(), createElementBlock("tr", {
|
|
14227
14241
|
key: order.id,
|
|
14228
|
-
class:
|
|
14242
|
+
class: normalizeClass(`propeller-order-list__row hover:bg-surface-hover ${rowsClickable.value ? "cursor-pointer" : ""}`),
|
|
14229
14243
|
"data-clickable": rowsClickable.value ? "true" : "false",
|
|
14230
14244
|
onClick: async (event) => rowsClickable.value && __props.onOrderClick(order.id)
|
|
14231
14245
|
}, [
|
|
@@ -14272,7 +14286,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
14272
14286
|
], 64)) : createCommentVNode("", true)
|
|
14273
14287
|
], 10, _hoisted_36$6);
|
|
14274
14288
|
}), 128))
|
|
14275
|
-
],
|
|
14289
|
+
], 10, _hoisted_35$6);
|
|
14276
14290
|
}), 128))
|
|
14277
14291
|
])
|
|
14278
14292
|
])
|
|
@@ -19911,24 +19925,24 @@ const _hoisted_5$1 = {
|
|
|
19911
19925
|
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
19926
|
};
|
|
19913
19927
|
const _hoisted_6$1 = { class: "propeller-search-bar__results flex-1 overflow-y-auto" };
|
|
19914
|
-
const _hoisted_7$1 =
|
|
19915
|
-
const _hoisted_8$1 = {
|
|
19928
|
+
const _hoisted_7$1 = {
|
|
19916
19929
|
key: 0,
|
|
19917
19930
|
class: "propeller-search-bar__result-media relative w-16 h-16 flex-shrink-0"
|
|
19918
19931
|
};
|
|
19919
|
-
const
|
|
19920
|
-
const
|
|
19921
|
-
const
|
|
19922
|
-
const
|
|
19932
|
+
const _hoisted_8$1 = ["src", "alt"];
|
|
19933
|
+
const _hoisted_9$1 = { class: "flex-1 min-w-0" };
|
|
19934
|
+
const _hoisted_10$1 = { class: "propeller-search-bar__result-name font-semibold truncate" };
|
|
19935
|
+
const _hoisted_11$1 = {
|
|
19923
19936
|
key: 0,
|
|
19924
19937
|
class: "propeller-search-bar__result-sku text-sm text-muted-foreground"
|
|
19925
19938
|
};
|
|
19926
|
-
const
|
|
19939
|
+
const _hoisted_12$1 = {
|
|
19927
19940
|
key: 1,
|
|
19928
19941
|
class: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right"
|
|
19929
19942
|
};
|
|
19930
|
-
const
|
|
19931
|
-
const
|
|
19943
|
+
const _hoisted_13$1 = { class: "propeller-search-bar__result-price-value" };
|
|
19944
|
+
const _hoisted_14$1 = { class: "propeller-search-bar__result-price-label block text-xs font-normal text-muted-foreground" };
|
|
19945
|
+
const _hoisted_15$1 = ["href"];
|
|
19932
19946
|
const _hoisted_16$1 = {
|
|
19933
19947
|
key: 1,
|
|
19934
19948
|
class: "propeller-search-bar__empty p-4 text-center text-muted-foreground"
|
|
@@ -19948,6 +19962,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
19948
19962
|
onSubmit: { type: Function },
|
|
19949
19963
|
onResultClick: { type: Function },
|
|
19950
19964
|
onViewAllClick: { type: Function },
|
|
19965
|
+
getResultHref: { type: Function },
|
|
19966
|
+
getViewAllHref: { type: Function },
|
|
19951
19967
|
formatPrice: { type: Function },
|
|
19952
19968
|
labels: {},
|
|
19953
19969
|
includeTax: { type: Boolean },
|
|
@@ -20101,6 +20117,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20101
20117
|
}
|
|
20102
20118
|
showDropdown.value = false;
|
|
20103
20119
|
}
|
|
20120
|
+
function isModifiedClick(event) {
|
|
20121
|
+
return event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
|
|
20122
|
+
}
|
|
20123
|
+
function handleResultAnchorClick(event, result) {
|
|
20124
|
+
if (props.getResultHref) {
|
|
20125
|
+
if (isModifiedClick(event)) return;
|
|
20126
|
+
event.preventDefault();
|
|
20127
|
+
}
|
|
20128
|
+
handleResultClick(result);
|
|
20129
|
+
}
|
|
20130
|
+
function handleViewAllAnchorClick(event) {
|
|
20131
|
+
if (isModifiedClick(event)) return;
|
|
20132
|
+
event.preventDefault();
|
|
20133
|
+
handleViewAllClick();
|
|
20134
|
+
}
|
|
20104
20135
|
return (_ctx, _cache) => {
|
|
20105
20136
|
return openBlock(), createElementBlock("div", {
|
|
20106
20137
|
"data-search-bar": true,
|
|
@@ -20112,7 +20143,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20112
20143
|
onSubmit: _cache[1] || (_cache[1] = async (e) => handleSubmit(e))
|
|
20113
20144
|
}, [
|
|
20114
20145
|
createElementVNode("div", _hoisted_2$1, [
|
|
20115
|
-
_cache[
|
|
20146
|
+
_cache[3] || (_cache[3] = createElementVNode("button", {
|
|
20116
20147
|
type: "submit",
|
|
20117
20148
|
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
20149
|
}, [
|
|
@@ -20138,7 +20169,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20138
20169
|
value: searchTerm.value,
|
|
20139
20170
|
onInput: _cache[0] || (_cache[0] = async (e) => handleInputChange(e.target.value))
|
|
20140
20171
|
}, null, 40, _hoisted_3$1),
|
|
20141
|
-
unref(isLoading) ? (openBlock(), createElementBlock("div", _hoisted_4$1, [..._cache[
|
|
20172
|
+
unref(isLoading) ? (openBlock(), createElementBlock("div", _hoisted_4$1, [..._cache[2] || (_cache[2] = [
|
|
20142
20173
|
createElementVNode("div", { class: "propeller-search-bar__spinner animate-spin rounded-full h-5 w-5 border-b-2 border-primary" }, null, -1)
|
|
20143
20174
|
])])) : createCommentVNode("", true)
|
|
20144
20175
|
])
|
|
@@ -20147,34 +20178,46 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20147
20178
|
results.value.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
20148
20179
|
createElementVNode("div", _hoisted_6$1, [
|
|
20149
20180
|
(openBlock(true), createElementBlock(Fragment, null, renderList(results.value, (result, index) => {
|
|
20150
|
-
return openBlock(),
|
|
20181
|
+
return openBlock(), createBlock(resolveDynamicComponent(props.getResultHref ? "a" : "div"), {
|
|
20151
20182
|
key: result.id + "-" + index,
|
|
20183
|
+
href: props.getResultHref ? props.getResultHref(result) : void 0,
|
|
20152
20184
|
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
|
-
|
|
20185
|
+
onClick: (event) => handleResultAnchorClick(event, result)
|
|
20186
|
+
}, {
|
|
20187
|
+
default: withCtx(() => [
|
|
20188
|
+
result.imageUrl || noImageUrl.value ? (openBlock(), createElementBlock("div", _hoisted_7$1, [
|
|
20189
|
+
createElementVNode("img", {
|
|
20190
|
+
class: "propeller-search-bar__result-image w-full h-full object-contain",
|
|
20191
|
+
src: result.imageUrl || noImageUrl.value,
|
|
20192
|
+
alt: result.name
|
|
20193
|
+
}, null, 8, _hoisted_8$1)
|
|
20194
|
+
])) : createCommentVNode("", true),
|
|
20195
|
+
createElementVNode("div", _hoisted_9$1, [
|
|
20196
|
+
createElementVNode("div", _hoisted_10$1, toDisplayString(result.name), 1),
|
|
20197
|
+
result.sku ? (openBlock(), createElementBlock("div", _hoisted_11$1, "SKU: " + toDisplayString(result.sku), 1)) : createCommentVNode("", true)
|
|
20198
|
+
]),
|
|
20199
|
+
result.price !== void 0 && result.price !== null ? (openBlock(), createElementBlock("div", _hoisted_12$1, [
|
|
20200
|
+
createElementVNode("span", _hoisted_13$1, toDisplayString(formatItemPrice(leadingPrice(result))), 1),
|
|
20201
|
+
createElementVNode("span", _hoisted_14$1, toDisplayString(priceTaxLabel()), 1)
|
|
20202
|
+
])) : createCommentVNode("", true)
|
|
20165
20203
|
]),
|
|
20166
|
-
|
|
20167
|
-
|
|
20168
|
-
createElementVNode("span", _hoisted_15$1, toDisplayString(priceTaxLabel()), 1)
|
|
20169
|
-
])) : createCommentVNode("", true)
|
|
20170
|
-
], 8, _hoisted_7$1);
|
|
20204
|
+
_: 2
|
|
20205
|
+
}, 1032, ["href", "onClick"]);
|
|
20171
20206
|
}), 128))
|
|
20172
20207
|
]),
|
|
20173
|
-
itemsFound.value > results.value.length ? (openBlock(), createElementBlock(
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20208
|
+
itemsFound.value > results.value.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
20209
|
+
props.getViewAllHref ? (openBlock(), createElementBlock("a", {
|
|
20210
|
+
key: 0,
|
|
20211
|
+
href: props.getViewAllHref(searchTerm.value),
|
|
20212
|
+
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)]",
|
|
20213
|
+
onClick: handleViewAllAnchorClick
|
|
20214
|
+
}, toDisplayString(getLabel$1("viewAll", "View all results")) + " (" + toDisplayString(itemsFound.value) + ") ", 9, _hoisted_15$1)) : (openBlock(), createElementBlock("button", {
|
|
20215
|
+
key: 1,
|
|
20216
|
+
type: "button",
|
|
20217
|
+
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)]",
|
|
20218
|
+
onClick: handleViewAllClick
|
|
20219
|
+
}, toDisplayString(getLabel$1("viewAll", "View all results")) + " (" + toDisplayString(itemsFound.value) + ") ", 1))
|
|
20220
|
+
], 64)) : createCommentVNode("", true)
|
|
20178
20221
|
], 64)) : createCommentVNode("", true),
|
|
20179
20222
|
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
20223
|
])) : createCommentVNode("", true)
|