@myparcel-dev/pdk-admin 1.14.0 → 1.14.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/CHANGELOG.md +10 -0
- package/dist/composables/useDigitalStampRanges.d.ts +4 -1
- package/dist/forms/shipmentOptions/createShipmentOptionsForm.d.ts +1 -1
- package/dist/forms/shipmentOptions/fields/createDigitalStampRangeField.d.ts +2 -1
- package/package.json +1 -1
- package/src/composables/useDigitalStampRanges.ts +9 -5
- package/src/forms/shipmentOptions/createShipmentOptionsForm.ts +2 -2
- package/src/forms/shipmentOptions/fields/createDigitalStampRangeField.ts +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- MONOWEAVE:BELOW -->
|
|
4
4
|
|
|
5
|
+
## [1.14.1](https://github.com/myparcelnl/js-pdk/compare/@myparcel-dev/pdk-admin@1.14.0...@myparcel-dev/pdk-admin@1.14.1) "@myparcel-dev/pdk-admin" (2026-02-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **admin:** handle bulk order ids in digital stamp range field ([#301](https://github.com/myparcelnl/js-pdk/issues/301)) ([3794ab7](https://github.com/myparcelnl/js-pdk/commit/3794ab7d65ee6ab70ac26376fc9ddc094d0002ce))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
5
15
|
## [1.14.0](https://github.com/myparcelnl/js-pdk/compare/@myparcel-dev/pdk-admin@1.13.1...@myparcel-dev/pdk-admin@1.14.0) "@myparcel-dev/pdk-admin" (2026-02-06)
|
|
6
16
|
|
|
7
17
|
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { type ComputedRef } from 'vue';
|
|
2
2
|
import { type MaybeRef } from '@vueuse/core';
|
|
3
|
+
import { type Plugin } from '@myparcel-dev/pdk-common';
|
|
3
4
|
import { type SelectOptionWithPlainLabel } from '../types';
|
|
4
5
|
interface UseDigitalStampRanges {
|
|
5
6
|
ranges: ComputedRef<SelectOptionWithPlainLabel<number, string>[]>;
|
|
6
7
|
currentRange: ComputedRef<SelectOptionWithPlainLabel<number, string>>;
|
|
7
8
|
}
|
|
8
|
-
export declare const useDigitalStampRanges: (weight: MaybeRef<number
|
|
9
|
+
export declare const useDigitalStampRanges: (weight: MaybeRef<number>, order?: MaybeRef<null | {
|
|
10
|
+
digitalStampRanges?: Plugin.DigitalStampRange[];
|
|
11
|
+
}>) => UseDigitalStampRanges;
|
|
9
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Plugin } from '@myparcel-dev/pdk-common';
|
|
2
1
|
import { type FormInstance } from '@myparcel-dev/vue-form-builder';
|
|
3
2
|
import { type OneOrMore } from '@myparcel-dev/ts-utils';
|
|
3
|
+
import { type Plugin } from '@myparcel-dev/pdk-common';
|
|
4
4
|
export declare const createShipmentOptionsForm: (orders?: OneOrMore<Plugin.ModelPdkOrder>) => FormInstance;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type InteractiveElementConfiguration } from '@myparcel-dev/vue-form-builder';
|
|
2
|
+
import { type Plugin } from '@myparcel-dev/pdk-common';
|
|
2
3
|
import { type ShipmentOptionsRefs } from '../types';
|
|
3
|
-
export declare const createDigitalStampRangeField: (refs: ShipmentOptionsRefs) => InteractiveElementConfiguration;
|
|
4
|
+
export declare const createDigitalStampRangeField: (refs: ShipmentOptionsRefs, order?: Plugin.ModelContextOrderDataContext) => InteractiveElementConfiguration;
|
package/package.json
CHANGED
|
@@ -10,11 +10,15 @@ interface UseDigitalStampRanges {
|
|
|
10
10
|
currentRange: ComputedRef<SelectOptionWithPlainLabel<number, string>>;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export const useDigitalStampRanges = (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
13
|
+
export const useDigitalStampRanges = (
|
|
14
|
+
weight: MaybeRef<number>,
|
|
15
|
+
order?: MaybeRef<null | {digitalStampRanges?: Plugin.DigitalStampRange[]}>,
|
|
16
|
+
): UseDigitalStampRanges => {
|
|
17
|
+
const fallbackOrder = order ? null : useOrderData().order;
|
|
18
|
+
|
|
19
|
+
const allRanges = computed<Plugin.DigitalStampRange[]>(() => {
|
|
20
|
+
return toValue(order ?? fallbackOrder)?.digitalStampRanges ?? [];
|
|
21
|
+
});
|
|
18
22
|
|
|
19
23
|
const ranges = computed<SelectOptionWithPlainLabel<number, string>[]>(() => {
|
|
20
24
|
return allRanges.value.map((range) => ({
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
import {toRaw} from 'vue';
|
|
5
5
|
import {get} from 'lodash-unified';
|
|
6
|
-
import {type Plugin} from '@myparcel-dev/pdk-common';
|
|
7
6
|
import {defineForm, type FormInstance} from '@myparcel-dev/vue-form-builder';
|
|
8
7
|
import {type OneOrMore, toArray} from '@myparcel-dev/ts-utils';
|
|
8
|
+
import {type Plugin} from '@myparcel-dev/pdk-common';
|
|
9
9
|
import {addBulkEditNotification} from '../helpers';
|
|
10
10
|
import {createShipmentFormName} from '../../utils';
|
|
11
11
|
import {useModalStore} from '../../stores';
|
|
@@ -67,7 +67,7 @@ export const createShipmentOptionsForm = (orders?: OneOrMore<Plugin.ModelPdkOrde
|
|
|
67
67
|
|
|
68
68
|
createLabelAmountField(refs),
|
|
69
69
|
|
|
70
|
-
createDigitalStampRangeField(refs),
|
|
70
|
+
createDigitalStampRangeField(refs, order),
|
|
71
71
|
|
|
72
72
|
// Actual shipment options
|
|
73
73
|
createAgeCheckField(refs),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ref, toValue} from 'vue';
|
|
2
2
|
import {get} from 'lodash-unified';
|
|
3
|
-
import {TriState} from '@myparcel-dev/pdk-common';
|
|
4
3
|
import {type InteractiveElementConfiguration} from '@myparcel-dev/vue-form-builder';
|
|
4
|
+
import {type Plugin, TriState} from '@myparcel-dev/pdk-common';
|
|
5
5
|
import {PackageTypeName} from '@myparcel-dev/constants';
|
|
6
6
|
import {type ShipmentOptionsRefs} from '../types';
|
|
7
7
|
import {FIELD_MANUAL_WEIGHT, FIELD_PACKAGE_TYPE} from '../field';
|
|
@@ -10,17 +10,19 @@ import {type GlobalFieldProps, type OptionsProp} from '../../../types';
|
|
|
10
10
|
import {AdminComponent} from '../../../data';
|
|
11
11
|
import {useDigitalStampRanges, useOrderData, usePluginSettings} from '../../../composables';
|
|
12
12
|
|
|
13
|
-
export const createDigitalStampRangeField = (
|
|
13
|
+
export const createDigitalStampRangeField = (
|
|
14
|
+
refs: ShipmentOptionsRefs,
|
|
15
|
+
order?: Plugin.ModelContextOrderDataContext,
|
|
16
|
+
): InteractiveElementConfiguration => {
|
|
14
17
|
const pluginSettings = usePluginSettings();
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const orderData = toValue(order);
|
|
18
|
+
const fallbackOrderData = order ? undefined : toValue(useOrderData().order);
|
|
19
|
+
const orderData = order ?? fallbackOrderData;
|
|
18
20
|
|
|
19
21
|
const {initialWeight, manualWeight} = orderData?.physicalProperties ?? {};
|
|
20
22
|
|
|
21
23
|
const totalWeight = Number(initialWeight) + Number(pluginSettings.order.emptyDigitalStampWeight ?? 0);
|
|
22
24
|
|
|
23
|
-
const {ranges, currentRange} = useDigitalStampRanges(orderData);
|
|
25
|
+
const {ranges, currentRange} = useDigitalStampRanges(totalWeight, orderData);
|
|
24
26
|
|
|
25
27
|
const selectedValue =
|
|
26
28
|
TriState.Inherit === manualWeight
|