@hybridly/vue 0.7.2 → 0.7.4

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
@@ -182,7 +182,11 @@ const state = {
182
182
  },
183
183
  setContext(context) {
184
184
  utils.debug.adapter("vue:state:context", "Storing context:", context);
185
- state.context.value = vue.unref(context);
185
+ if (vue.unref(context) === state.context.value) {
186
+ vue.triggerRef(state.context);
187
+ } else {
188
+ state.context.value = vue.unref(context);
189
+ }
186
190
  },
187
191
  setViewKey(key) {
188
192
  utils.debug.adapter("vue:state:key", "Storing view key:", key);
@@ -366,7 +370,6 @@ function setupDevtools(app) {
366
370
  });
367
371
  if (event === "after") {
368
372
  setTimeout(() => {
369
- vue.triggerRef(state.context);
370
373
  api.notifyComponentUpdate();
371
374
  }, 100);
372
375
  }
@@ -691,24 +694,27 @@ function toReactive(objectRef) {
691
694
  }
692
695
 
693
696
  function useProperties() {
694
- return vue.readonly(toReactive(vue.computed(() => state.context.value?.view.properties)));
697
+ return vue.readonly(toReactive(vue.computed(() => state.properties.value)));
695
698
  }
696
699
  function useProperty(path) {
697
- return vue.computed(() => dotDiver.getByPath(state.context.value?.view.properties, path));
700
+ return vue.computed(() => dotDiver.getByPath(state.properties.value, path));
698
701
  }
699
702
  function setProperty(path, value) {
700
- if (!state.context.value?.view.properties) {
703
+ if (!state.properties.value) {
701
704
  return;
702
705
  }
703
- dotDiver.setByPath(state.context.value.view.properties, path, vue.toValue(value));
706
+ dotDiver.setByPath(state.properties.value, path, vue.toValue(value));
707
+ if (state.context.value?.view.properties) {
708
+ dotDiver.setByPath(state.context.value.view.properties, path, vue.toValue(value));
709
+ }
704
710
  }
705
711
 
706
712
  function safeClone(obj) {
707
713
  return utils.clone(vue.toRaw(obj));
708
714
  }
709
715
  function useForm(options) {
710
- const shouldRemember = !!options?.key;
711
- const historyKey = options?.key ?? "form:default";
716
+ const shouldRemember = !!options.key;
717
+ const historyKey = options.key ?? "form:default";
712
718
  const historyData = shouldRemember ? core.router.history.get(historyKey) : void 0;
713
719
  const timeoutIds = {
714
720
  recentlyFailed: void 0,
@@ -730,7 +736,21 @@ function useForm(options) {
730
736
  Reflect.set(initial, key, safeClone(value));
731
737
  });
732
738
  }
733
- function reset(...keys) {
739
+ function resetSubmissionState() {
740
+ successful.value = false;
741
+ failed.value = false;
742
+ recentlyFailed.value = false;
743
+ recentlySuccessful.value = false;
744
+ clearTimeout(timeoutIds.recentlySuccessful);
745
+ clearTimeout(timeoutIds.recentlyFailed);
746
+ progress.value = void 0;
747
+ }
748
+ function reset() {
749
+ resetSubmissionState();
750
+ clearErrors();
751
+ resetFields();
752
+ }
753
+ function resetFields(...keys) {
734
754
  if (keys.length === 0) {
735
755
  keys = Object.keys(fields);
736
756
  }
@@ -747,57 +767,55 @@ function useForm(options) {
747
767
  });
748
768
  }
749
769
  function submit(optionsOverrides) {
750
- const url = typeof options.url === "function" ? options.url() : options.url;
751
- const data = typeof options.transform === "function" ? options.transform?.(fields) : fields;
752
- const preserveState = optionsOverrides?.preserveState ?? options.preserveState;
770
+ const { fields: _f, key: _k, ...optionsWithoutFields } = options;
771
+ const optionsWithOverrides = optionsOverrides ? utils.merge(optionsWithoutFields, optionsOverrides, { mergePlainObjects: true }) : optionsWithoutFields;
772
+ const url = typeof optionsWithOverrides.url === "function" ? optionsWithOverrides.url() : optionsWithOverrides.url;
773
+ const data = typeof optionsWithOverrides.transform === "function" ? optionsWithOverrides.transform(fields) : fields;
774
+ const preserveState = optionsWithOverrides.preserveState ?? optionsWithOverrides.method !== "GET";
775
+ const hooks = optionsWithOverrides.hooks ?? {};
753
776
  return core.router.navigate({
754
- ...options,
777
+ ...optionsWithOverrides,
755
778
  url: url ?? state.context.value?.url,
756
- method: options.method ?? "POST",
757
- ...optionsOverrides,
779
+ method: optionsWithOverrides.method ?? "POST",
758
780
  data: safeClone(data),
759
- preserveState: preserveState === void 0 && options.method !== "GET" ? true : preserveState,
781
+ preserveState,
760
782
  hooks: {
761
783
  before: (navigation, context) => {
762
- failed.value = false;
763
- successful.value = false;
764
- recentlySuccessful.value = false;
765
- clearTimeout(timeoutIds.recentlySuccessful);
766
- clearTimeout(timeoutIds.recentlyFailed);
767
- return options.hooks?.before?.(navigation, context);
784
+ resetSubmissionState();
785
+ return hooks.before?.(navigation, context);
768
786
  },
769
787
  start: (context) => {
770
788
  processing.value = true;
771
- return options.hooks?.start?.(context);
789
+ return hooks.start?.(context);
772
790
  },
773
791
  progress: (incoming, context) => {
774
792
  progress.value = incoming;
775
- return options.hooks?.progress?.(incoming, context);
793
+ return hooks.progress?.(incoming, context);
776
794
  },
777
795
  error: (incoming, context) => {
778
796
  setErrors(incoming);
779
797
  failed.value = true;
780
798
  recentlyFailed.value = true;
781
- timeoutIds.recentlyFailed = setTimeout(() => recentlyFailed.value = false, options?.timeout ?? 5e3);
782
- return options.hooks?.error?.(incoming, context);
799
+ timeoutIds.recentlyFailed = setTimeout(() => recentlyFailed.value = false, optionsWithOverrides.timeout ?? 5e3);
800
+ return hooks.error?.(incoming, context);
783
801
  },
784
802
  success: (payload, context) => {
785
803
  clearErrors();
786
- if (options?.updateInitials) {
804
+ if (optionsWithOverrides.updateInitials) {
787
805
  setInitial(fields);
788
806
  }
789
- if (options?.reset !== false) {
790
- reset();
807
+ if (optionsWithOverrides.reset !== false) {
808
+ resetFields();
791
809
  }
792
810
  successful.value = true;
793
811
  recentlySuccessful.value = true;
794
- timeoutIds.recentlySuccessful = setTimeout(() => recentlySuccessful.value = false, options?.timeout ?? 5e3);
795
- return options.hooks?.success?.(payload, context);
812
+ timeoutIds.recentlySuccessful = setTimeout(() => recentlySuccessful.value = false, optionsWithOverrides.timeout ?? 5e3);
813
+ return hooks.success?.(payload, context);
796
814
  },
797
815
  after: (context) => {
798
816
  progress.value = void 0;
799
817
  processing.value = false;
800
- return options.hooks?.after?.(context);
818
+ return hooks.after?.(context);
801
819
  }
802
820
  }
803
821
  });
@@ -838,7 +856,9 @@ function useForm(options) {
838
856
  }
839
857
  }, { deep: true, immediate: true });
840
858
  return vue.reactive({
859
+ resetFields,
841
860
  reset,
861
+ resetSubmissionState,
842
862
  clear,
843
863
  fields,
844
864
  abort,
@@ -1086,6 +1106,10 @@ function useRefinements(properties, refinementsKeys, defaultOptions = {}) {
1086
1106
  */
1087
1107
  clear: (options) => clearSorts(options)
1088
1108
  }))),
1109
+ /**
1110
+ * The key for the filters.
1111
+ */
1112
+ filtersKey,
1089
1113
  /**
1090
1114
  * Gets a filter by name.
1091
1115
  */
@@ -1235,6 +1259,12 @@ function useTable(props, key, defaultOptions = {}) {
1235
1259
  }
1236
1260
  async function executeBulkAction(action, options) {
1237
1261
  const actionName = getActionName(action);
1262
+ const filterParameters = refinements.currentFilters().reduce((carry, filter) => {
1263
+ return {
1264
+ ...carry,
1265
+ [filter.name]: filter.value
1266
+ };
1267
+ }, {});
1238
1268
  return await core.router.navigate({
1239
1269
  method: "post",
1240
1270
  url: core.route(table.value.endpoint),
@@ -1245,7 +1275,8 @@ function useTable(props, key, defaultOptions = {}) {
1245
1275
  tableId: table.value.id,
1246
1276
  all: bulk.selection.value.all,
1247
1277
  only: [...bulk.selection.value.only],
1248
- except: [...bulk.selection.value.except]
1278
+ except: [...bulk.selection.value.except],
1279
+ [refinements.filtersKey.value]: filterParameters
1249
1280
  },
1250
1281
  hooks: {
1251
1282
  after: () => {
package/dist/index.d.cts CHANGED
@@ -243,7 +243,9 @@ interface FormOptions<T extends SearchableObject> extends Omit<HybridRequestOpti
243
243
  transform?: (fields: T) => any;
244
244
  }
245
245
  declare function useForm<T extends SearchableObject, P extends Path<T> & string = Path<T> & string>(options: FormOptions<T>): {
246
- reset: (...keys: P[]) => void;
246
+ resetFields: (...keys: P[]) => void;
247
+ reset: () => void;
248
+ resetSubmissionState: () => void;
247
249
  clear: (...keys: P[]) => void;
248
250
  fields: vue.UnwrapRef<T>;
249
251
  abort: () => void;
@@ -252,8 +254,8 @@ declare function useForm<T extends SearchableObject, P extends Path<T> & string
252
254
  clearError: (key: P) => void;
253
255
  setInitial: (newInitial: Partial<T>) => void;
254
256
  hasDirty: (...keys: P[]) => boolean;
255
- submitWith: (optionsOverrides?: Omit<HybridRequestOptions, 'data'>) => Promise<_hybridly_core.NavigationResponse>;
256
- submitWithOptions: (optionsOverrides?: Omit<HybridRequestOptions, 'data'>) => Promise<_hybridly_core.NavigationResponse>;
257
+ submitWith: (optionsOverrides?: Omit<FormOptions<T>, 'fields' | 'key'>) => Promise<_hybridly_core.NavigationResponse>;
258
+ submitWithOptions: (optionsOverrides?: Omit<FormOptions<T>, 'fields' | 'key'>) => Promise<_hybridly_core.NavigationResponse>;
257
259
  submit: () => Promise<_hybridly_core.NavigationResponse>;
258
260
  hasErrors: boolean;
259
261
  initial: vue.UnwrapRef<DeepReadonly<T>>;
@@ -633,6 +635,10 @@ declare function useRefinements<Properties extends object, RefinementsKey extend
633
635
  */
634
636
  hidden: boolean;
635
637
  }[];
638
+ /**
639
+ * The key for the filters.
640
+ */
641
+ filtersKey: vue.ComputedRef<string>;
636
642
  /**
637
643
  * Gets a filter by name.
638
644
  */
@@ -784,6 +790,7 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
784
790
  next: string;
785
791
  hidden: boolean;
786
792
  }[];
793
+ filtersKey: string;
787
794
  getFilter: (name: string) => FilterRefinement | undefined;
788
795
  getSort: (name: string) => SortRefinement | undefined;
789
796
  reset: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core.NavigationResponse>;
package/dist/index.d.mts CHANGED
@@ -243,7 +243,9 @@ interface FormOptions<T extends SearchableObject> extends Omit<HybridRequestOpti
243
243
  transform?: (fields: T) => any;
244
244
  }
245
245
  declare function useForm<T extends SearchableObject, P extends Path<T> & string = Path<T> & string>(options: FormOptions<T>): {
246
- reset: (...keys: P[]) => void;
246
+ resetFields: (...keys: P[]) => void;
247
+ reset: () => void;
248
+ resetSubmissionState: () => void;
247
249
  clear: (...keys: P[]) => void;
248
250
  fields: vue.UnwrapRef<T>;
249
251
  abort: () => void;
@@ -252,8 +254,8 @@ declare function useForm<T extends SearchableObject, P extends Path<T> & string
252
254
  clearError: (key: P) => void;
253
255
  setInitial: (newInitial: Partial<T>) => void;
254
256
  hasDirty: (...keys: P[]) => boolean;
255
- submitWith: (optionsOverrides?: Omit<HybridRequestOptions, 'data'>) => Promise<_hybridly_core.NavigationResponse>;
256
- submitWithOptions: (optionsOverrides?: Omit<HybridRequestOptions, 'data'>) => Promise<_hybridly_core.NavigationResponse>;
257
+ submitWith: (optionsOverrides?: Omit<FormOptions<T>, 'fields' | 'key'>) => Promise<_hybridly_core.NavigationResponse>;
258
+ submitWithOptions: (optionsOverrides?: Omit<FormOptions<T>, 'fields' | 'key'>) => Promise<_hybridly_core.NavigationResponse>;
257
259
  submit: () => Promise<_hybridly_core.NavigationResponse>;
258
260
  hasErrors: boolean;
259
261
  initial: vue.UnwrapRef<DeepReadonly<T>>;
@@ -633,6 +635,10 @@ declare function useRefinements<Properties extends object, RefinementsKey extend
633
635
  */
634
636
  hidden: boolean;
635
637
  }[];
638
+ /**
639
+ * The key for the filters.
640
+ */
641
+ filtersKey: vue.ComputedRef<string>;
636
642
  /**
637
643
  * Gets a filter by name.
638
644
  */
@@ -784,6 +790,7 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
784
790
  next: string;
785
791
  hidden: boolean;
786
792
  }[];
793
+ filtersKey: string;
787
794
  getFilter: (name: string) => FilterRefinement | undefined;
788
795
  getSort: (name: string) => SortRefinement | undefined;
789
796
  reset: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core.NavigationResponse>;
package/dist/index.d.ts CHANGED
@@ -243,7 +243,9 @@ interface FormOptions<T extends SearchableObject> extends Omit<HybridRequestOpti
243
243
  transform?: (fields: T) => any;
244
244
  }
245
245
  declare function useForm<T extends SearchableObject, P extends Path<T> & string = Path<T> & string>(options: FormOptions<T>): {
246
- reset: (...keys: P[]) => void;
246
+ resetFields: (...keys: P[]) => void;
247
+ reset: () => void;
248
+ resetSubmissionState: () => void;
247
249
  clear: (...keys: P[]) => void;
248
250
  fields: vue.UnwrapRef<T>;
249
251
  abort: () => void;
@@ -252,8 +254,8 @@ declare function useForm<T extends SearchableObject, P extends Path<T> & string
252
254
  clearError: (key: P) => void;
253
255
  setInitial: (newInitial: Partial<T>) => void;
254
256
  hasDirty: (...keys: P[]) => boolean;
255
- submitWith: (optionsOverrides?: Omit<HybridRequestOptions, 'data'>) => Promise<_hybridly_core.NavigationResponse>;
256
- submitWithOptions: (optionsOverrides?: Omit<HybridRequestOptions, 'data'>) => Promise<_hybridly_core.NavigationResponse>;
257
+ submitWith: (optionsOverrides?: Omit<FormOptions<T>, 'fields' | 'key'>) => Promise<_hybridly_core.NavigationResponse>;
258
+ submitWithOptions: (optionsOverrides?: Omit<FormOptions<T>, 'fields' | 'key'>) => Promise<_hybridly_core.NavigationResponse>;
257
259
  submit: () => Promise<_hybridly_core.NavigationResponse>;
258
260
  hasErrors: boolean;
259
261
  initial: vue.UnwrapRef<DeepReadonly<T>>;
@@ -633,6 +635,10 @@ declare function useRefinements<Properties extends object, RefinementsKey extend
633
635
  */
634
636
  hidden: boolean;
635
637
  }[];
638
+ /**
639
+ * The key for the filters.
640
+ */
641
+ filtersKey: vue.ComputedRef<string>;
636
642
  /**
637
643
  * Gets a filter by name.
638
644
  */
@@ -784,6 +790,7 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
784
790
  next: string;
785
791
  hidden: boolean;
786
792
  }[];
793
+ filtersKey: string;
787
794
  getFilter: (name: string) => FilterRefinement | undefined;
788
795
  getSort: (name: string) => SortRefinement | undefined;
789
796
  reset: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core.NavigationResponse>;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { shallowRef, ref, unref, defineComponent, toRaw, h, nextTick, triggerRef, createApp, isRef, reactive, readonly, computed, toValue, watch, getCurrentInstance, onUnmounted } from 'vue';
1
+ import { shallowRef, ref, unref, triggerRef, defineComponent, toRaw, h, nextTick, createApp, isRef, reactive, readonly, computed, toValue, watch, getCurrentInstance, onUnmounted } from 'vue';
2
2
  import { definePlugin, registerHook as registerHook$1, createRouter, makeUrl, router, route } from '@hybridly/core';
3
3
  export { can, route, router } from '@hybridly/core';
4
4
  import { debug, random, showViewComponentErrorModal, merge, clone, unsetPropertyAtPath, setValueAtPath } from '@hybridly/utils';
@@ -175,7 +175,11 @@ const state = {
175
175
  },
176
176
  setContext(context) {
177
177
  debug.adapter("vue:state:context", "Storing context:", context);
178
- state.context.value = unref(context);
178
+ if (unref(context) === state.context.value) {
179
+ triggerRef(state.context);
180
+ } else {
181
+ state.context.value = unref(context);
182
+ }
179
183
  },
180
184
  setViewKey(key) {
181
185
  debug.adapter("vue:state:key", "Storing view key:", key);
@@ -359,7 +363,6 @@ function setupDevtools(app) {
359
363
  });
360
364
  if (event === "after") {
361
365
  setTimeout(() => {
362
- triggerRef(state.context);
363
366
  api.notifyComponentUpdate();
364
367
  }, 100);
365
368
  }
@@ -684,24 +687,27 @@ function toReactive(objectRef) {
684
687
  }
685
688
 
686
689
  function useProperties() {
687
- return readonly(toReactive(computed(() => state.context.value?.view.properties)));
690
+ return readonly(toReactive(computed(() => state.properties.value)));
688
691
  }
689
692
  function useProperty(path) {
690
- return computed(() => getByPath(state.context.value?.view.properties, path));
693
+ return computed(() => getByPath(state.properties.value, path));
691
694
  }
692
695
  function setProperty(path, value) {
693
- if (!state.context.value?.view.properties) {
696
+ if (!state.properties.value) {
694
697
  return;
695
698
  }
696
- setByPath(state.context.value.view.properties, path, toValue(value));
699
+ setByPath(state.properties.value, path, toValue(value));
700
+ if (state.context.value?.view.properties) {
701
+ setByPath(state.context.value.view.properties, path, toValue(value));
702
+ }
697
703
  }
698
704
 
699
705
  function safeClone(obj) {
700
706
  return clone(toRaw(obj));
701
707
  }
702
708
  function useForm(options) {
703
- const shouldRemember = !!options?.key;
704
- const historyKey = options?.key ?? "form:default";
709
+ const shouldRemember = !!options.key;
710
+ const historyKey = options.key ?? "form:default";
705
711
  const historyData = shouldRemember ? router.history.get(historyKey) : void 0;
706
712
  const timeoutIds = {
707
713
  recentlyFailed: void 0,
@@ -723,7 +729,21 @@ function useForm(options) {
723
729
  Reflect.set(initial, key, safeClone(value));
724
730
  });
725
731
  }
726
- function reset(...keys) {
732
+ function resetSubmissionState() {
733
+ successful.value = false;
734
+ failed.value = false;
735
+ recentlyFailed.value = false;
736
+ recentlySuccessful.value = false;
737
+ clearTimeout(timeoutIds.recentlySuccessful);
738
+ clearTimeout(timeoutIds.recentlyFailed);
739
+ progress.value = void 0;
740
+ }
741
+ function reset() {
742
+ resetSubmissionState();
743
+ clearErrors();
744
+ resetFields();
745
+ }
746
+ function resetFields(...keys) {
727
747
  if (keys.length === 0) {
728
748
  keys = Object.keys(fields);
729
749
  }
@@ -740,57 +760,55 @@ function useForm(options) {
740
760
  });
741
761
  }
742
762
  function submit(optionsOverrides) {
743
- const url = typeof options.url === "function" ? options.url() : options.url;
744
- const data = typeof options.transform === "function" ? options.transform?.(fields) : fields;
745
- const preserveState = optionsOverrides?.preserveState ?? options.preserveState;
763
+ const { fields: _f, key: _k, ...optionsWithoutFields } = options;
764
+ const optionsWithOverrides = optionsOverrides ? merge(optionsWithoutFields, optionsOverrides, { mergePlainObjects: true }) : optionsWithoutFields;
765
+ const url = typeof optionsWithOverrides.url === "function" ? optionsWithOverrides.url() : optionsWithOverrides.url;
766
+ const data = typeof optionsWithOverrides.transform === "function" ? optionsWithOverrides.transform(fields) : fields;
767
+ const preserveState = optionsWithOverrides.preserveState ?? optionsWithOverrides.method !== "GET";
768
+ const hooks = optionsWithOverrides.hooks ?? {};
746
769
  return router.navigate({
747
- ...options,
770
+ ...optionsWithOverrides,
748
771
  url: url ?? state.context.value?.url,
749
- method: options.method ?? "POST",
750
- ...optionsOverrides,
772
+ method: optionsWithOverrides.method ?? "POST",
751
773
  data: safeClone(data),
752
- preserveState: preserveState === void 0 && options.method !== "GET" ? true : preserveState,
774
+ preserveState,
753
775
  hooks: {
754
776
  before: (navigation, context) => {
755
- failed.value = false;
756
- successful.value = false;
757
- recentlySuccessful.value = false;
758
- clearTimeout(timeoutIds.recentlySuccessful);
759
- clearTimeout(timeoutIds.recentlyFailed);
760
- return options.hooks?.before?.(navigation, context);
777
+ resetSubmissionState();
778
+ return hooks.before?.(navigation, context);
761
779
  },
762
780
  start: (context) => {
763
781
  processing.value = true;
764
- return options.hooks?.start?.(context);
782
+ return hooks.start?.(context);
765
783
  },
766
784
  progress: (incoming, context) => {
767
785
  progress.value = incoming;
768
- return options.hooks?.progress?.(incoming, context);
786
+ return hooks.progress?.(incoming, context);
769
787
  },
770
788
  error: (incoming, context) => {
771
789
  setErrors(incoming);
772
790
  failed.value = true;
773
791
  recentlyFailed.value = true;
774
- timeoutIds.recentlyFailed = setTimeout(() => recentlyFailed.value = false, options?.timeout ?? 5e3);
775
- return options.hooks?.error?.(incoming, context);
792
+ timeoutIds.recentlyFailed = setTimeout(() => recentlyFailed.value = false, optionsWithOverrides.timeout ?? 5e3);
793
+ return hooks.error?.(incoming, context);
776
794
  },
777
795
  success: (payload, context) => {
778
796
  clearErrors();
779
- if (options?.updateInitials) {
797
+ if (optionsWithOverrides.updateInitials) {
780
798
  setInitial(fields);
781
799
  }
782
- if (options?.reset !== false) {
783
- reset();
800
+ if (optionsWithOverrides.reset !== false) {
801
+ resetFields();
784
802
  }
785
803
  successful.value = true;
786
804
  recentlySuccessful.value = true;
787
- timeoutIds.recentlySuccessful = setTimeout(() => recentlySuccessful.value = false, options?.timeout ?? 5e3);
788
- return options.hooks?.success?.(payload, context);
805
+ timeoutIds.recentlySuccessful = setTimeout(() => recentlySuccessful.value = false, optionsWithOverrides.timeout ?? 5e3);
806
+ return hooks.success?.(payload, context);
789
807
  },
790
808
  after: (context) => {
791
809
  progress.value = void 0;
792
810
  processing.value = false;
793
- return options.hooks?.after?.(context);
811
+ return hooks.after?.(context);
794
812
  }
795
813
  }
796
814
  });
@@ -831,7 +849,9 @@ function useForm(options) {
831
849
  }
832
850
  }, { deep: true, immediate: true });
833
851
  return reactive({
852
+ resetFields,
834
853
  reset,
854
+ resetSubmissionState,
835
855
  clear,
836
856
  fields,
837
857
  abort,
@@ -1079,6 +1099,10 @@ function useRefinements(properties, refinementsKeys, defaultOptions = {}) {
1079
1099
  */
1080
1100
  clear: (options) => clearSorts(options)
1081
1101
  }))),
1102
+ /**
1103
+ * The key for the filters.
1104
+ */
1105
+ filtersKey,
1082
1106
  /**
1083
1107
  * Gets a filter by name.
1084
1108
  */
@@ -1228,6 +1252,12 @@ function useTable(props, key, defaultOptions = {}) {
1228
1252
  }
1229
1253
  async function executeBulkAction(action, options) {
1230
1254
  const actionName = getActionName(action);
1255
+ const filterParameters = refinements.currentFilters().reduce((carry, filter) => {
1256
+ return {
1257
+ ...carry,
1258
+ [filter.name]: filter.value
1259
+ };
1260
+ }, {});
1231
1261
  return await router.navigate({
1232
1262
  method: "post",
1233
1263
  url: route(table.value.endpoint),
@@ -1238,7 +1268,8 @@ function useTable(props, key, defaultOptions = {}) {
1238
1268
  tableId: table.value.id,
1239
1269
  all: bulk.selection.value.all,
1240
1270
  only: [...bulk.selection.value.only],
1241
- except: [...bulk.selection.value.except]
1271
+ except: [...bulk.selection.value.except],
1272
+ [refinements.filtersKey.value]: filterParameters
1242
1273
  },
1243
1274
  hooks: {
1244
1275
  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.4",
4
4
  "description": "Vue adapter for Hybridly",
5
5
  "keywords": [
6
6
  "hybridly",
@@ -43,20 +43,21 @@
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
- "qs": "^6.12.0",
52
- "@hybridly/utils": "0.7.2",
53
- "@hybridly/core": "0.7.2"
51
+ "qs": "^6.12.1",
52
+ "@hybridly/core": "0.7.4",
53
+ "@hybridly/utils": "0.7.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/lodash": "^4.17.0",
57
57
  "@types/lodash.isequal": "^4.5.8",
58
58
  "@types/nprogress": "^0.2.3",
59
- "vue": "^3.4.21"
59
+ "@vue/test-utils": "^2.4.5",
60
+ "vue": "^3.4.23"
60
61
  },
61
62
  "scripts": {
62
63
  "build": "unbuild",