@vc-shell/framework 1.0.163 → 1.0.165

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/core/composables/index.ts +1 -0
  3. package/core/composables/useAsync/index.ts +4 -3
  4. package/core/composables/useBreadcrumbs/index.ts +75 -0
  5. package/dist/core/composables/index.d.ts +1 -0
  6. package/dist/core/composables/index.d.ts.map +1 -1
  7. package/dist/core/composables/useAsync/index.d.ts +1 -1
  8. package/dist/core/composables/useAsync/index.d.ts.map +1 -1
  9. package/dist/core/composables/useBreadcrumbs/index.d.ts +18 -0
  10. package/dist/core/composables/useBreadcrumbs/index.d.ts.map +1 -0
  11. package/dist/framework.js +2761 -2706
  12. package/dist/index.css +1 -1
  13. package/dist/shared/components/notifications/components/notification-container/index.d.ts +5 -5
  14. package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
  15. package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
  16. package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
  17. package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
  18. package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
  19. package/dist/shared/modules/dynamic/factories/base/useListFactory.d.ts +3 -3
  20. package/dist/shared/modules/dynamic/factories/base/useListFactory.d.ts.map +1 -1
  21. package/dist/shared/modules/dynamic/factories/types/index.d.ts +9 -3
  22. package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
  23. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +9 -9
  24. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
  25. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +10 -4
  26. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
  27. package/dist/shared/modules/dynamic/types/index.d.ts +2 -1
  28. package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/dist/ui/components/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue.d.ts +20 -52
  31. package/dist/ui/components/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue.d.ts.map +1 -1
  32. package/dist/ui/components/molecules/vc-breadcrumbs/index.d.ts +3 -21
  33. package/dist/ui/components/molecules/vc-breadcrumbs/index.d.ts.map +1 -1
  34. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts +3 -14
  35. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts.map +1 -1
  36. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  37. package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts.map +1 -1
  38. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
  39. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +1 -1
  40. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +3 -6
  41. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
  42. package/dist/ui/types/index.d.ts +6 -0
  43. package/dist/ui/types/index.d.ts.map +1 -1
  44. package/package.json +5 -5
  45. package/shared/modules/dynamic/components/fields/GalleryField.ts +2 -2
  46. package/shared/modules/dynamic/components/fields/ImageField.ts +2 -2
  47. package/shared/modules/dynamic/components/fields/StatusField.ts +7 -1
  48. package/shared/modules/dynamic/components/fields/VideoField.ts +2 -2
  49. package/shared/modules/dynamic/factories/base/useListFactory.ts +6 -6
  50. package/shared/modules/dynamic/factories/types/index.ts +12 -4
  51. package/shared/modules/dynamic/pages/dynamic-blade-form.vue +8 -6
  52. package/shared/modules/dynamic/pages/dynamic-blade-list.vue +39 -12
  53. package/shared/modules/dynamic/types/index.ts +2 -6
  54. package/ui/components/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue +11 -27
  55. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +3 -3
  56. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +4 -9
  57. package/ui/components/molecules/vc-editor/vc-editor.vue +9 -2
  58. package/ui/components/molecules/vc-field/vc-field.vue +0 -1
  59. package/ui/components/molecules/vc-rating/vc-rating.vue +1 -1
  60. package/ui/components/organisms/vc-table/vc-table.vue +0 -2
  61. package/ui/types/index.ts +6 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## [1.0.165](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.164...v1.0.165) (2024-02-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **dynamic:** component fixes ([77acf38](https://github.com/VirtoCommerce/vc-shell/commit/77acf38f64a5638bbaa4aede1fd3b4d44165e08e))
7
+
8
+
9
+ ### Features
10
+
11
+ * **dynamic:** useBreadcrumbs composable and support in dynamic views, exposing more methods ([c1ccdea](https://github.com/VirtoCommerce/vc-shell/commit/c1ccdea065000345b9ee7e9334839179a0d30661))
12
+
13
+
14
+
15
+ ## [1.0.164](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.163...v1.0.164) (2024-02-09)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **framework:** Add i18n support to StatusField component and fix Quill editor issue ([7749feb](https://github.com/VirtoCommerce/vc-shell/commit/7749feba938b8011220c6139908daa7e68df5bcd))
21
+
22
+
23
+
1
24
  ## [1.0.163](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.162...v1.0.163) (2024-02-09)
2
25
 
3
26
 
@@ -11,3 +11,4 @@ export { useAssets } from "./useAssets";
11
11
  export { useMenuService } from "./useMenuService";
12
12
  export { useBeforeUnload } from "./useBeforeUnload";
13
13
  export { useLanguages } from "./useLanguages";
14
+ export { useBreadcrumbs } from "./useBreadcrumbs";
@@ -1,7 +1,8 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  import { readonly, ref } from "vue";
2
3
  import { HasLoading } from "../useLoading";
3
4
 
4
- export type AsyncAction<Payload = void, Result = void> = (payload?: Payload) => Promise<Result>;
5
+ export type AsyncAction<Payload = void, Result = void> = (payload?: Payload, ...rest: any[]) => Promise<Result>;
5
6
 
6
7
  export interface UseAsync<Payload = void, Result = void> extends HasLoading {
7
8
  action: AsyncAction<Payload, Result>;
@@ -12,10 +13,10 @@ export function useAsync<Payload = void, Result = void>(
12
13
  ): UseAsync<Payload, Result> {
13
14
  const loading = ref(false);
14
15
 
15
- async function action(payload?: Payload): Promise<Result> {
16
+ async function action(payload?: Payload, ...rest: any[]): Promise<Result> {
16
17
  loading.value = true;
17
18
  try {
18
- return await innerAction(payload ?? ({} as Payload));
19
+ return await innerAction(payload ?? ({} as Payload), ...rest);
19
20
  } catch (e) {
20
21
  console.error(e);
21
22
  throw e;
@@ -0,0 +1,75 @@
1
+ import { Breadcrumbs } from "./../../../ui/types/index";
2
+ import { ComputedRef, computed, reactive } from "vue";
3
+ import * as _ from "lodash-es";
4
+
5
+ interface HistoryRecord {
6
+ records: Breadcrumbs[];
7
+ current?: Breadcrumbs;
8
+ }
9
+
10
+ export interface IUseBreadcrumbs {
11
+ breadcrumbs: ComputedRef<Breadcrumbs[]>;
12
+ push: (breadcrumb: Breadcrumbs) => void;
13
+ remove: (ids: string[]) => void;
14
+ }
15
+
16
+ export function useBreadcrumbs() {
17
+ const history = reactive<HistoryRecord>({
18
+ current: undefined,
19
+ records: [],
20
+ });
21
+
22
+ function isBreadcrumbsEqual(x: Breadcrumbs | undefined, y: Breadcrumbs | undefined) {
23
+ return x && y && x.id === y.id && x.title === y.title;
24
+ }
25
+
26
+ function removeNext(id: string) {
27
+ const index = history.records.findIndex((record) => record.id === id);
28
+ if (index !== -1) {
29
+ history.current = history.records[index];
30
+
31
+ history.records.splice(index);
32
+ }
33
+ }
34
+
35
+ function push(breadcrumb: Breadcrumbs) {
36
+ const bread = {
37
+ ...breadcrumb,
38
+ clickHandler: (id: string) => {
39
+ if (breadcrumb.clickHandler) {
40
+ breadcrumb.clickHandler?.(id);
41
+
42
+ // remove next items in history.records
43
+ removeNext(id);
44
+ }
45
+ },
46
+ };
47
+
48
+ if (
49
+ history.current &&
50
+ !isBreadcrumbsEqual(history.current, bread) &&
51
+ !isBreadcrumbsEqual(history.current, _.last(history.records))
52
+ ) {
53
+ history.records.push(history.current);
54
+ }
55
+
56
+ if (bread) {
57
+ history.current = bread;
58
+ }
59
+ }
60
+
61
+ function remove(ids: string[]) {
62
+ // remove items with ids from history.records
63
+ history.records = history.records.filter((record) => !ids.includes(record.id));
64
+
65
+ if (history.current && ids.includes(history.current.id)) {
66
+ history.current = undefined;
67
+ }
68
+ }
69
+
70
+ return {
71
+ breadcrumbs: computed(() => history.records.concat([history.current!])),
72
+ push,
73
+ remove,
74
+ };
75
+ }
@@ -11,4 +11,5 @@ export { useAssets } from "./useAssets";
11
11
  export { useMenuService } from "./useMenuService";
12
12
  export { useBeforeUnload } from "./useBeforeUnload";
13
13
  export { useLanguages } from "./useLanguages";
14
+ export { useBreadcrumbs } from "./useBreadcrumbs";
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { HasLoading } from "../useLoading";
2
- export type AsyncAction<Payload = void, Result = void> = (payload?: Payload) => Promise<Result>;
2
+ export type AsyncAction<Payload = void, Result = void> = (payload?: Payload, ...rest: any[]) => Promise<Result>;
3
3
  export interface UseAsync<Payload = void, Result = void> extends HasLoading {
4
4
  action: AsyncAction<Payload, Result>;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useAsync/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,MAAM,WAAW,CAAC,OAAO,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEhG,MAAM,WAAW,QAAQ,CAAC,OAAO,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAE,SAAQ,UAAU;IACzE,MAAM,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,wBAAgB,QAAQ,CAAC,OAAO,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,EACpD,WAAW,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,GACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAmB3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useAsync/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,MAAM,WAAW,CAAC,OAAO,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEhH,MAAM,WAAW,QAAQ,CAAC,OAAO,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAE,SAAQ,UAAU;IACzE,MAAM,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,wBAAgB,QAAQ,CAAC,OAAO,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,EACpD,WAAW,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,GACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAmB3B"}
@@ -0,0 +1,18 @@
1
+ import { Breadcrumbs } from "./../../../ui/types/index";
2
+ import { ComputedRef } from "vue";
3
+ export interface IUseBreadcrumbs {
4
+ breadcrumbs: ComputedRef<Breadcrumbs[]>;
5
+ push: (breadcrumb: Breadcrumbs) => void;
6
+ remove: (ids: string[]) => void;
7
+ }
8
+ export declare function useBreadcrumbs(): {
9
+ breadcrumbs: ComputedRef<{
10
+ icon?: string | undefined;
11
+ title: string;
12
+ clickHandler?: ((id: string) => void | Promise<void>) | undefined;
13
+ id: string;
14
+ }[]>;
15
+ push: (breadcrumb: Breadcrumbs) => void;
16
+ remove: (ids: string[]) => void;
17
+ };
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useBreadcrumbs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAsB,MAAM,KAAK,CAAC;AAQtD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC;IACxC,IAAI,EAAE,CAAC,UAAU,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACjC;AAED,wBAAgB,cAAc;;;;;;;uBAmBF,WAAW;kBA0BhB,MAAM,EAAE;EAc9B"}