@veeqo/transfigure 1.2.5 → 1.2.7

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 (131) hide show
  1. package/dist/BusinessLogic/mocks.d.ts +1 -0
  2. package/dist/components/Filters/ActiveFilters/Categories/FilterField/FilterField.d.ts +3 -1
  3. package/dist/constants/constants.d.ts +1 -0
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.css +1 -1
  6. package/dist/index.js +157 -155
  7. package/dist/index10.cjs +1 -1
  8. package/dist/index10.js +37 -30
  9. package/dist/index100.cjs +1 -1
  10. package/dist/index100.js +11 -29
  11. package/dist/index101.cjs +19 -1
  12. package/dist/index101.js +24 -21
  13. package/dist/index102.cjs +1 -12
  14. package/dist/index102.js +21 -16
  15. package/dist/index103.cjs +1 -1
  16. package/dist/index103.js +1 -1
  17. package/dist/index104.cjs +1 -1
  18. package/dist/index104.js +36 -22
  19. package/dist/index105.cjs +1 -1
  20. package/dist/index105.js +29 -7
  21. package/dist/index106.cjs +1 -80
  22. package/dist/index106.js +24 -101
  23. package/dist/index107.cjs +12 -1
  24. package/dist/index107.js +16 -2
  25. package/dist/index108.cjs +80 -1
  26. package/dist/index108.js +101 -19
  27. package/dist/index109.cjs +1 -1
  28. package/dist/index109.js +2 -8
  29. package/dist/index11.cjs +1 -1
  30. package/dist/index11.js +1 -1
  31. package/dist/index110.cjs +1 -1
  32. package/dist/index110.js +17 -62
  33. package/dist/index111.cjs +1 -1
  34. package/dist/index111.js +7 -29
  35. package/dist/index112.cjs +1 -13
  36. package/dist/index112.js +63 -16
  37. package/dist/index113.cjs +1 -1
  38. package/dist/index113.js +30 -36
  39. package/dist/index114.cjs +13 -1
  40. package/dist/index114.js +15 -24
  41. package/dist/index115.cjs +1 -1
  42. package/dist/index115.js +35 -62
  43. package/dist/index116.cjs +1 -7
  44. package/dist/index116.js +26 -10
  45. package/dist/index117.cjs +1 -1
  46. package/dist/index117.js +5 -47
  47. package/dist/index118.cjs +7 -0
  48. package/dist/index118.js +12 -0
  49. package/dist/index119.cjs +1 -0
  50. package/dist/index119.js +65 -0
  51. package/dist/index120.cjs +1 -0
  52. package/dist/index120.js +49 -0
  53. package/dist/index13.cjs +1 -1
  54. package/dist/index13.js +16 -15
  55. package/dist/index17.cjs +1 -1
  56. package/dist/index17.js +1 -1
  57. package/dist/index18.cjs +1 -1
  58. package/dist/index18.js +10 -9
  59. package/dist/index19.cjs +1 -1
  60. package/dist/index19.js +33 -26
  61. package/dist/index2.cjs +1 -1
  62. package/dist/index2.js +3 -2
  63. package/dist/index20.cjs +1 -1
  64. package/dist/index20.js +21 -20
  65. package/dist/index22.cjs +1 -1
  66. package/dist/index22.js +1 -1
  67. package/dist/index30.cjs +1 -1
  68. package/dist/index30.js +40 -37
  69. package/dist/index31.cjs +1 -1
  70. package/dist/index31.js +1 -1
  71. package/dist/index34.cjs +1 -1
  72. package/dist/index34.js +1 -1
  73. package/dist/index35.cjs +1 -1
  74. package/dist/index35.js +7 -7
  75. package/dist/index36.cjs +1 -1
  76. package/dist/index36.js +39 -38
  77. package/dist/index39.cjs +1 -1
  78. package/dist/index39.js +1 -1
  79. package/dist/index40.cjs +1 -1
  80. package/dist/index40.js +1 -1
  81. package/dist/index42.cjs +1 -1
  82. package/dist/index42.js +1 -1
  83. package/dist/index44.cjs +1 -1
  84. package/dist/index44.js +1 -1
  85. package/dist/index46.cjs +1 -1
  86. package/dist/index46.js +2 -2
  87. package/dist/index49.cjs +1 -1
  88. package/dist/index49.js +6 -5
  89. package/dist/index78.cjs +1 -1
  90. package/dist/index78.js +22 -19
  91. package/dist/index79.cjs +1 -1
  92. package/dist/index79.js +7 -5
  93. package/dist/index80.cjs +1 -1
  94. package/dist/index80.js +1 -1
  95. package/dist/index84.cjs +1 -1
  96. package/dist/index84.js +1 -1
  97. package/dist/index85.cjs +1 -1
  98. package/dist/index85.js +1 -1
  99. package/dist/index88.cjs +1 -1
  100. package/dist/index88.js +2 -5
  101. package/dist/index89.cjs +1 -1
  102. package/dist/index89.js +4 -117
  103. package/dist/index90.cjs +1 -1
  104. package/dist/index90.js +117 -18
  105. package/dist/index91.cjs +1 -1
  106. package/dist/index91.js +19 -13
  107. package/dist/index92.cjs +1 -104
  108. package/dist/index92.js +7 -120
  109. package/dist/index93.cjs +1 -1
  110. package/dist/index93.js +16 -66
  111. package/dist/index94.cjs +1 -1
  112. package/dist/index94.js +13 -29
  113. package/dist/index95.cjs +104 -1
  114. package/dist/index95.js +120 -2
  115. package/dist/index96.cjs +1 -1
  116. package/dist/index96.js +65 -38
  117. package/dist/index97.cjs +1 -1
  118. package/dist/index97.js +26 -8
  119. package/dist/index98.cjs +1 -19
  120. package/dist/index98.js +2 -24
  121. package/dist/index99.cjs +1 -1
  122. package/dist/index99.js +37 -34
  123. package/dist/storybookHelpers/apiMocks/views/custom_views.d.ts +7 -0
  124. package/dist/types.d.ts +14 -0
  125. package/dist/utils/getViewTheme/getViewTheme.d.ts +21 -0
  126. package/dist/utils/getViewTheme/getViewTheme.test.d.ts +1 -0
  127. package/dist/utils/getViewTheme/index.d.ts +1 -0
  128. package/dist/utils/isTextFilterValid/index.d.ts +1 -0
  129. package/dist/utils/isTextFilterValid/isTextFilterValid.d.ts +7 -0
  130. package/dist/utils/isTextFilterValid/isTextFilterValid.test.d.ts +1 -0
  131. package/package.json +1 -1
package/dist/index99.js CHANGED
@@ -1,40 +1,43 @@
1
- import { useMemo as _ } from "react";
2
- import g from "swr";
3
- import u from "qs";
4
- import { useStores as w } from "./index61.js";
5
- import { useBusinessLogic as E } from "./index8.js";
6
- import { useViews as F } from "./index62.js";
7
- import { fetcherV2 as R } from "./index55.js";
8
- const T = () => {
9
- var n;
10
- const { Filters: { queryParams: s } } = w(), { TABLE_DATA_URL: c, PAGE_NUMBER_FILTER_ID: r, PAGE_SIZE_FILTER_ID: i } = E(), { isLoading: m } = F(), d = _(() => {
11
- const t = {
12
- ...u.parse(s),
13
- [r]: "1",
14
- [i]: "1"
15
- };
16
- return u.stringify(t, { arrayFormat: "brackets" });
17
- }, [s, r, i]), p = !m ? `${c}?${d}` : null, {
18
- data: e,
19
- error: f,
20
- isLoading: l,
21
- mutate: L
22
- } = g(
23
- [p, { includeMeta: !0 }],
24
- ([a, t]) => R(a, t),
25
- {
26
- revalidateOnFocus: !1,
27
- revalidateOnReconnect: !1,
28
- keepPreviousData: !0
1
+ import { useState as d } from "react";
2
+ import { useViews as v } from "./index62.js";
3
+ import { useStores as y } from "./index61.js";
4
+ import { useModal as C } from "./index52.js";
5
+ import { usePersistUnsavedChanges as g } from "./index60.js";
6
+ import { patchCustomView as h } from "./index5.js";
7
+ const b = ({ pinnedLeftColumnIds: a, pinnedRightColumnIds: i }) => {
8
+ const {
9
+ Filters: {
10
+ activeViewId: e
11
+ },
12
+ Notifications: {
13
+ notify: t
29
14
  }
30
- ), o = e == null ? void 0 : e.meta;
15
+ } = y(), { closeModal: u } = C(), { mutate: m } = v(), { getActiveViewInAPIFormat: c } = g(), [l, o] = d(!1);
31
16
  return {
32
- viewCounts: (n = o == null ? void 0 : o.page) == null ? void 0 : n.total_count,
33
- error: f,
34
- isLoadingViewCounts: l,
35
- mutate: L
17
+ saveColumns: async ({ visibleColumns: n }) => {
18
+ if (e)
19
+ try {
20
+ if (o(!0), n.length < 1) {
21
+ t({ type: "error", text: "You must have at least one visible column." });
22
+ return;
23
+ }
24
+ const r = [...a, ...n, ...i], { arg: f, currentView: s } = c(), p = {
25
+ ...f,
26
+ columns: {
27
+ ...s == null ? void 0 : s.columns,
28
+ columnIds: r
29
+ }
30
+ };
31
+ await h(e, { attributes: p }), await m(), u(), t({ type: "success", text: "Columns updated successfully" });
32
+ } catch {
33
+ t({ type: "error", text: "Failed to save columns" });
34
+ } finally {
35
+ o(!1);
36
+ }
37
+ },
38
+ isSavingColumns: l
36
39
  };
37
40
  };
38
41
  export {
39
- T as useViewCounts
42
+ b as usePersistColumns
40
43
  };
@@ -26,6 +26,7 @@ export declare const custom_views: {
26
26
  columns: {
27
27
  columnIds: string[];
28
28
  };
29
+ view_attributes?: undefined;
29
30
  } | {
30
31
  id: string;
31
32
  title: string;
@@ -53,6 +54,7 @@ export declare const custom_views: {
53
54
  columns: {
54
55
  columnIds: string[];
55
56
  };
57
+ view_attributes?: undefined;
56
58
  } | {
57
59
  id: string;
58
60
  title: string;
@@ -86,6 +88,7 @@ export declare const custom_views: {
86
88
  columns: {
87
89
  columnIds: string[];
88
90
  };
91
+ view_attributes?: undefined;
89
92
  } | {
90
93
  id: string;
91
94
  title: string;
@@ -115,6 +118,9 @@ export declare const custom_views: {
115
118
  created_at: string;
116
119
  updated_at: string;
117
120
  editable: boolean;
121
+ view_attributes: {
122
+ type: string;
123
+ };
118
124
  company_id: number;
119
125
  columns: {
120
126
  columnIds?: undefined;
@@ -152,5 +158,6 @@ export declare const custom_views: {
152
158
  columns: {
153
159
  columnIds?: undefined;
154
160
  };
161
+ view_attributes?: undefined;
155
162
  })[];
156
163
  };
package/dist/types.d.ts CHANGED
@@ -70,6 +70,9 @@ type ViewFilters = {
70
70
  filter?: OrderFilter | InventoryFilter;
71
71
  sort?: string;
72
72
  };
73
+ export declare enum ViewStatusTypes {
74
+ ERROR = "error"
75
+ }
73
76
  export type View = {
74
77
  id: string;
75
78
  type: ViewType;
@@ -83,6 +86,9 @@ export type View = {
83
86
  created_at: string;
84
87
  updated_at: string;
85
88
  editable: boolean;
89
+ view_attributes?: {
90
+ type: ViewStatusTypes;
91
+ };
86
92
  };
87
93
  export type FilterMaps = {
88
94
  filters: Map<string, string>;
@@ -107,6 +113,14 @@ export type TransformedView = {
107
113
  isShared: boolean;
108
114
  originalView?: TransformedView;
109
115
  columns: ViewColumns;
116
+ colourPalette: {
117
+ lightest: string;
118
+ light: string;
119
+ base: string;
120
+ dark: string;
121
+ darkest: string;
122
+ };
123
+ customTextColour?: string;
110
124
  };
111
125
  export type ViewsState = {
112
126
  fixedViews: TransformedView[];
@@ -0,0 +1,21 @@
1
+ import { ViewStatusTypes } from '../../types';
2
+ /**
3
+ * Returns a view theme configuration based on the provided view status.
4
+ *
5
+ * @param type - The current view status used to determine which theme
6
+ * colours to apply (for example, an error state).
7
+ * @returns An object describing the theme for the view, including
8
+ * {@code colourPalette}, which provides the base colour palette for
9
+ * the view, and {@code customTextColour}, an optional override for
10
+ * the default text colour.
11
+ */
12
+ export declare const getViewTheme: (type: ViewStatusTypes) => {
13
+ colourPalette: {
14
+ lightest: string;
15
+ light: string;
16
+ base: string;
17
+ dark: string;
18
+ darkest: string;
19
+ };
20
+ customTextColour: string | undefined;
21
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { getViewTheme } from './getViewTheme';
@@ -0,0 +1 @@
1
+ export { isTextFilterValid } from './isTextFilterValid';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Validates that a text filter value is either empty or has at least 3 characters.
3
+ * Empty strings are allowed to permit clearing filters.
4
+ * @param text - The text to validate
5
+ * @returns true if the text is valid for filtering, false otherwise
6
+ */
7
+ export declare const isTextFilterValid: (text: string) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veeqo/transfigure",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.cjs",