@hybridly/vue 0.7.2 → 0.7.3

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.cjs CHANGED
@@ -750,6 +750,7 @@ function useForm(options) {
750
750
  const url = typeof options.url === "function" ? options.url() : options.url;
751
751
  const data = typeof options.transform === "function" ? options.transform?.(fields) : fields;
752
752
  const preserveState = optionsOverrides?.preserveState ?? options.preserveState;
753
+ const hooks = { ...options?.hooks, ...optionsOverrides?.hooks };
753
754
  return core.router.navigate({
754
755
  ...options,
755
756
  url: url ?? state.context.value?.url,
@@ -764,22 +765,22 @@ function useForm(options) {
764
765
  recentlySuccessful.value = false;
765
766
  clearTimeout(timeoutIds.recentlySuccessful);
766
767
  clearTimeout(timeoutIds.recentlyFailed);
767
- return options.hooks?.before?.(navigation, context);
768
+ return hooks.before?.(navigation, context);
768
769
  },
769
770
  start: (context) => {
770
771
  processing.value = true;
771
- return options.hooks?.start?.(context);
772
+ return hooks.start?.(context);
772
773
  },
773
774
  progress: (incoming, context) => {
774
775
  progress.value = incoming;
775
- return options.hooks?.progress?.(incoming, context);
776
+ return hooks.progress?.(incoming, context);
776
777
  },
777
778
  error: (incoming, context) => {
778
779
  setErrors(incoming);
779
780
  failed.value = true;
780
781
  recentlyFailed.value = true;
781
782
  timeoutIds.recentlyFailed = setTimeout(() => recentlyFailed.value = false, options?.timeout ?? 5e3);
782
- return options.hooks?.error?.(incoming, context);
783
+ return hooks.error?.(incoming, context);
783
784
  },
784
785
  success: (payload, context) => {
785
786
  clearErrors();
@@ -792,12 +793,12 @@ function useForm(options) {
792
793
  successful.value = true;
793
794
  recentlySuccessful.value = true;
794
795
  timeoutIds.recentlySuccessful = setTimeout(() => recentlySuccessful.value = false, options?.timeout ?? 5e3);
795
- return options.hooks?.success?.(payload, context);
796
+ return hooks.success?.(payload, context);
796
797
  },
797
798
  after: (context) => {
798
799
  progress.value = void 0;
799
800
  processing.value = false;
800
- return options.hooks?.after?.(context);
801
+ return hooks.after?.(context);
801
802
  }
802
803
  }
803
804
  });
@@ -1086,6 +1087,10 @@ function useRefinements(properties, refinementsKeys, defaultOptions = {}) {
1086
1087
  */
1087
1088
  clear: (options) => clearSorts(options)
1088
1089
  }))),
1090
+ /**
1091
+ * The key for the filters.
1092
+ */
1093
+ filtersKey,
1089
1094
  /**
1090
1095
  * Gets a filter by name.
1091
1096
  */
@@ -1235,6 +1240,12 @@ function useTable(props, key, defaultOptions = {}) {
1235
1240
  }
1236
1241
  async function executeBulkAction(action, options) {
1237
1242
  const actionName = getActionName(action);
1243
+ const filterParameters = refinements.currentFilters().reduce((carry, filter) => {
1244
+ return {
1245
+ ...carry,
1246
+ [filter.name]: filter.value
1247
+ };
1248
+ }, {});
1238
1249
  return await core.router.navigate({
1239
1250
  method: "post",
1240
1251
  url: core.route(table.value.endpoint),
@@ -1245,7 +1256,8 @@ function useTable(props, key, defaultOptions = {}) {
1245
1256
  tableId: table.value.id,
1246
1257
  all: bulk.selection.value.all,
1247
1258
  only: [...bulk.selection.value.only],
1248
- except: [...bulk.selection.value.except]
1259
+ except: [...bulk.selection.value.except],
1260
+ [refinements.filtersKey.value]: filterParameters
1249
1261
  },
1250
1262
  hooks: {
1251
1263
  after: () => {
package/dist/index.d.cts CHANGED
@@ -633,6 +633,10 @@ declare function useRefinements<Properties extends object, RefinementsKey extend
633
633
  */
634
634
  hidden: boolean;
635
635
  }[];
636
+ /**
637
+ * The key for the filters.
638
+ */
639
+ filtersKey: vue.ComputedRef<string>;
636
640
  /**
637
641
  * Gets a filter by name.
638
642
  */
@@ -784,6 +788,7 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
784
788
  next: string;
785
789
  hidden: boolean;
786
790
  }[];
791
+ filtersKey: string;
787
792
  getFilter: (name: string) => FilterRefinement | undefined;
788
793
  getSort: (name: string) => SortRefinement | undefined;
789
794
  reset: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core.NavigationResponse>;
package/dist/index.d.mts CHANGED
@@ -633,6 +633,10 @@ declare function useRefinements<Properties extends object, RefinementsKey extend
633
633
  */
634
634
  hidden: boolean;
635
635
  }[];
636
+ /**
637
+ * The key for the filters.
638
+ */
639
+ filtersKey: vue.ComputedRef<string>;
636
640
  /**
637
641
  * Gets a filter by name.
638
642
  */
@@ -784,6 +788,7 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
784
788
  next: string;
785
789
  hidden: boolean;
786
790
  }[];
791
+ filtersKey: string;
787
792
  getFilter: (name: string) => FilterRefinement | undefined;
788
793
  getSort: (name: string) => SortRefinement | undefined;
789
794
  reset: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core.NavigationResponse>;
package/dist/index.d.ts CHANGED
@@ -633,6 +633,10 @@ declare function useRefinements<Properties extends object, RefinementsKey extend
633
633
  */
634
634
  hidden: boolean;
635
635
  }[];
636
+ /**
637
+ * The key for the filters.
638
+ */
639
+ filtersKey: vue.ComputedRef<string>;
636
640
  /**
637
641
  * Gets a filter by name.
638
642
  */
@@ -784,6 +788,7 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
784
788
  next: string;
785
789
  hidden: boolean;
786
790
  }[];
791
+ filtersKey: string;
787
792
  getFilter: (name: string) => FilterRefinement | undefined;
788
793
  getSort: (name: string) => SortRefinement | undefined;
789
794
  reset: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core.NavigationResponse>;
package/dist/index.mjs CHANGED
@@ -743,6 +743,7 @@ function useForm(options) {
743
743
  const url = typeof options.url === "function" ? options.url() : options.url;
744
744
  const data = typeof options.transform === "function" ? options.transform?.(fields) : fields;
745
745
  const preserveState = optionsOverrides?.preserveState ?? options.preserveState;
746
+ const hooks = { ...options?.hooks, ...optionsOverrides?.hooks };
746
747
  return router.navigate({
747
748
  ...options,
748
749
  url: url ?? state.context.value?.url,
@@ -757,22 +758,22 @@ function useForm(options) {
757
758
  recentlySuccessful.value = false;
758
759
  clearTimeout(timeoutIds.recentlySuccessful);
759
760
  clearTimeout(timeoutIds.recentlyFailed);
760
- return options.hooks?.before?.(navigation, context);
761
+ return hooks.before?.(navigation, context);
761
762
  },
762
763
  start: (context) => {
763
764
  processing.value = true;
764
- return options.hooks?.start?.(context);
765
+ return hooks.start?.(context);
765
766
  },
766
767
  progress: (incoming, context) => {
767
768
  progress.value = incoming;
768
- return options.hooks?.progress?.(incoming, context);
769
+ return hooks.progress?.(incoming, context);
769
770
  },
770
771
  error: (incoming, context) => {
771
772
  setErrors(incoming);
772
773
  failed.value = true;
773
774
  recentlyFailed.value = true;
774
775
  timeoutIds.recentlyFailed = setTimeout(() => recentlyFailed.value = false, options?.timeout ?? 5e3);
775
- return options.hooks?.error?.(incoming, context);
776
+ return hooks.error?.(incoming, context);
776
777
  },
777
778
  success: (payload, context) => {
778
779
  clearErrors();
@@ -785,12 +786,12 @@ function useForm(options) {
785
786
  successful.value = true;
786
787
  recentlySuccessful.value = true;
787
788
  timeoutIds.recentlySuccessful = setTimeout(() => recentlySuccessful.value = false, options?.timeout ?? 5e3);
788
- return options.hooks?.success?.(payload, context);
789
+ return hooks.success?.(payload, context);
789
790
  },
790
791
  after: (context) => {
791
792
  progress.value = void 0;
792
793
  processing.value = false;
793
- return options.hooks?.after?.(context);
794
+ return hooks.after?.(context);
794
795
  }
795
796
  }
796
797
  });
@@ -1079,6 +1080,10 @@ function useRefinements(properties, refinementsKeys, defaultOptions = {}) {
1079
1080
  */
1080
1081
  clear: (options) => clearSorts(options)
1081
1082
  }))),
1083
+ /**
1084
+ * The key for the filters.
1085
+ */
1086
+ filtersKey,
1082
1087
  /**
1083
1088
  * Gets a filter by name.
1084
1089
  */
@@ -1228,6 +1233,12 @@ function useTable(props, key, defaultOptions = {}) {
1228
1233
  }
1229
1234
  async function executeBulkAction(action, options) {
1230
1235
  const actionName = getActionName(action);
1236
+ const filterParameters = refinements.currentFilters().reduce((carry, filter) => {
1237
+ return {
1238
+ ...carry,
1239
+ [filter.name]: filter.value
1240
+ };
1241
+ }, {});
1231
1242
  return await router.navigate({
1232
1243
  method: "post",
1233
1244
  url: route(table.value.endpoint),
@@ -1238,7 +1249,8 @@ function useTable(props, key, defaultOptions = {}) {
1238
1249
  tableId: table.value.id,
1239
1250
  all: bulk.selection.value.all,
1240
1251
  only: [...bulk.selection.value.only],
1241
- except: [...bulk.selection.value.except]
1252
+ except: [...bulk.selection.value.except],
1253
+ [refinements.filtersKey.value]: filterParameters
1242
1254
  },
1243
1255
  hooks: {
1244
1256
  after: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hybridly/vue",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Vue adapter for Hybridly",
5
5
  "keywords": [
6
6
  "hybridly",
@@ -43,14 +43,14 @@
43
43
  "vue": "^3.2.45"
44
44
  },
45
45
  "dependencies": {
46
- "@clickbar/dot-diver": "^1.0.4",
46
+ "@clickbar/dot-diver": "^1.0.6",
47
47
  "@vue/devtools-api": "^6.6.1",
48
48
  "defu": "^6.1.4",
49
49
  "lodash.isequal": "^4.5.0",
50
50
  "nprogress": "^0.2.0",
51
51
  "qs": "^6.12.0",
52
- "@hybridly/utils": "0.7.2",
53
- "@hybridly/core": "0.7.2"
52
+ "@hybridly/core": "0.7.3",
53
+ "@hybridly/utils": "0.7.3"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/lodash": "^4.17.0",