@asdp/ferryui 0.1.22-dev.9949 → 0.1.22-dev.9969

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/dist/index.d.mts CHANGED
@@ -3073,14 +3073,19 @@ interface CardVehicleOwnerFormProps {
3073
3073
  */
3074
3074
  commodityOptions?: SelectOption[];
3075
3075
  /**
3076
- * Options for load type select inputs
3076
+ * Options for load type select inputs (raw, used as fallback)
3077
3077
  */
3078
3078
  loadTypeOptions?: (LoadType & {
3079
- commodityId: number;
3079
+ commodityId?: number;
3080
3080
  })[];
3081
3081
  loadTypes?: (LoadType & {
3082
- commodityId: number;
3082
+ commodityId?: number;
3083
3083
  })[];
3084
+ /**
3085
+ * Map of commodityId -> SelectOption[] fetched from backend per cargo commodity.
3086
+ * When provided, each cargo's cargoType dropdown will use the matching entry.
3087
+ */
3088
+ loadTypeOptionsByCommodityId?: Record<string, SelectOption[]>;
3084
3089
  /**
3085
3090
  * Options for industry select inputs
3086
3091
  */
package/dist/index.d.ts CHANGED
@@ -3073,14 +3073,19 @@ interface CardVehicleOwnerFormProps {
3073
3073
  */
3074
3074
  commodityOptions?: SelectOption[];
3075
3075
  /**
3076
- * Options for load type select inputs
3076
+ * Options for load type select inputs (raw, used as fallback)
3077
3077
  */
3078
3078
  loadTypeOptions?: (LoadType & {
3079
- commodityId: number;
3079
+ commodityId?: number;
3080
3080
  })[];
3081
3081
  loadTypes?: (LoadType & {
3082
- commodityId: number;
3082
+ commodityId?: number;
3083
3083
  })[];
3084
+ /**
3085
+ * Map of commodityId -> SelectOption[] fetched from backend per cargo commodity.
3086
+ * When provided, each cargo's cargoType dropdown will use the matching entry.
3087
+ */
3088
+ loadTypeOptionsByCommodityId?: Record<string, SelectOption[]>;
3084
3089
  /**
3085
3090
  * Options for industry select inputs
3086
3091
  */
package/dist/index.js CHANGED
@@ -12535,6 +12535,7 @@ var CardVehicleOwnerForm = ({
12535
12535
  commodityOptions = [],
12536
12536
  loadTypeOptions = [],
12537
12537
  loadTypes = [],
12538
+ loadTypeOptionsByCommodityId = {},
12538
12539
  industryOptions = [],
12539
12540
  loadCategoryOptions = [],
12540
12541
  language = "id",
@@ -13151,10 +13152,18 @@ var CardVehicleOwnerForm = ({
13151
13152
  cargoItems: updatedCargoItems
13152
13153
  });
13153
13154
  },
13154
- options: loadTypeOptions.map((lt) => ({
13155
- value: lt.id.toString(),
13156
- label: `${lt.name} (${lt.unit?.name})`
13157
- })),
13155
+ options: (() => {
13156
+ const selectedCommodityId = watch(
13157
+ `owners.${index}.cargo.${cargoIndex}.commodity`
13158
+ );
13159
+ if (selectedCommodityId && loadTypeOptionsByCommodityId[selectedCommodityId]) {
13160
+ return loadTypeOptionsByCommodityId[selectedCommodityId];
13161
+ }
13162
+ return loadTypeOptions.map((lt) => ({
13163
+ value: lt.id.toString(),
13164
+ label: `${lt.name}${lt.unit?.name ? ` (${lt.unit.name})` : ""}`
13165
+ }));
13166
+ })(),
13158
13167
  placeholder: mergedLabels.selectPlaceholder,
13159
13168
  required: true,
13160
13169
  size: "large",