avo 3.1.4 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fc615ce5edcbf9325987f90d37495c71f641b241fe34d5da9f9fae94018dd94
4
- data.tar.gz: 03fae5887aa0b9c0371705d30221cb07f9498ff0d3499f1dd35474fcd449c7f3
3
+ metadata.gz: f84e20dfd4cc196c02ea8cea04a9ebd370144767e4bbd153472210fca3ae8f6b
4
+ data.tar.gz: 1700407b494fee51aeb109f296b1a1e281d05c76f244cf98bdfb870b4e83a265
5
5
  SHA512:
6
- metadata.gz: 504866933b84f2a3969ab026260f8213327a5448bc2f9c50bafef4c45c7de2513373cf1c101e240700f1a3398560c174b530e47caf17621355c6329a3d322f2f
7
- data.tar.gz: be6dedf903e9439795adf0da9a278458ad2b53d4841447c00334b42d9cb6a561f62f987ccd687528d9f6fbd05ffae02f1c8a795a8140f027c18c406091c65f65
6
+ metadata.gz: 52aa5dc765f03f01c01bc7596b44ff455cc1988e6f242d3fc83257fef13ab17fd8849a4d816c66ea847682e431248b0a36f65bc0acfb329458f2c5918475521c
7
+ data.tar.gz: 16672b50bfc6d4c084b57b6218074babaaf4ed12c67d5f5f7fd31ec7852205af3be0f4af43b03f6d131dd2ab0815ff77e34d490a7d1094cdb57a1f6c27b47f19
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (3.1.4)
4
+ avo (3.1.6)
5
5
  actionview (>= 6.1)
6
6
  active_link_to
7
7
  activerecord (>= 6.1)
@@ -7029,10 +7029,6 @@ tag.tagify__tag{
7029
7029
  width:1rem
7030
7030
  }
7031
7031
 
7032
- .w-screen{
7033
- width:100vw
7034
- }
7035
-
7036
7032
  .w-auto{
7037
7033
  width:auto
7038
7034
  }
@@ -8176,6 +8172,14 @@ tag.tagify__tag{
8176
8172
  font-family:"Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"
8177
8173
  }
8178
8174
 
8175
+ .font-serif{
8176
+ font-family:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif
8177
+ }
8178
+
8179
+ .font-mono{
8180
+ font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace
8181
+ }
8182
+
8179
8183
  .text-base{
8180
8184
  font-size:1rem;
8181
8185
  line-height:1.5rem
@@ -24381,6 +24381,30 @@
24381
24381
  }
24382
24382
  });
24383
24383
 
24384
+ // app/javascript/js/local-storage-service.js
24385
+ var LocalStorageService;
24386
+ var init_local_storage_service = __esm({
24387
+ "app/javascript/js/local-storage-service.js"() {
24388
+ LocalStorageService = class {
24389
+ constructor() {
24390
+ __publicField(this, "prefix", "avo");
24391
+ }
24392
+ prefixedKey(key) {
24393
+ return `${this.prefix}.${key}`;
24394
+ }
24395
+ get(key) {
24396
+ return window.localStorage.getItem(this.prefixedKey(key));
24397
+ }
24398
+ set(key, value) {
24399
+ return window.localStorage.setItem(this.prefixedKey(key), value);
24400
+ }
24401
+ remove(key) {
24402
+ return window.localStorage.removeItem(this.prefixedKey(key));
24403
+ }
24404
+ };
24405
+ }
24406
+ });
24407
+
24384
24408
  // node_modules/chartkick/dist/chartkick.js
24385
24409
  var require_chartkick = __commonJS({
24386
24410
  "node_modules/chartkick/dist/chartkick.js"(exports2, module2) {
@@ -66872,18 +66896,18 @@
66872
66896
  return `${this.viaResourceName}_${param}`;
66873
66897
  return param;
66874
66898
  }
66875
- b64EncodeUnicode(str) {
66876
- return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match2, p1) => String.fromCharCode(`0x${p1}`)));
66899
+ decode(filters) {
66900
+ return JSON.parse(new TextDecoder().decode(Uint8Array.from(atob(decodeURIComponent(filters)), (m3) => m3.codePointAt(0))));
66877
66901
  }
66878
- b64DecodeUnicode(str) {
66879
- return decodeURIComponent(atob(str).split("").map((c3) => `%${`00${c3.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));
66902
+ encode(filtered) {
66903
+ return encodeURIComponent(btoa(String.fromCodePoint(...new TextEncoder().encode(JSON.stringify(filtered)))));
66880
66904
  }
66881
66905
  changeFilter() {
66882
66906
  const value = this.getFilterValue();
66883
66907
  const filterClass = this.getFilterClass();
66884
66908
  let filters = this.uriParams()[this.uriParam("filters")];
66885
66909
  if (filters) {
66886
- filters = JSON.parse(this.b64DecodeUnicode(filters));
66910
+ filters = this.decode(filters);
66887
66911
  } else {
66888
66912
  filters = {};
66889
66913
  }
@@ -66894,7 +66918,7 @@
66894
66918
  }, {});
66895
66919
  let encodedFilters;
66896
66920
  if (filtered && Object.keys(filtered).length > 0) {
66897
- encodedFilters = this.b64EncodeUnicode(JSON.stringify(filtered));
66921
+ encodedFilters = this.encode(filtered);
66898
66922
  }
66899
66923
  this.navigateToURLWithFilters(encodedFilters);
66900
66924
  }
@@ -118851,45 +118875,50 @@
118851
118875
  var init_tabs_controller = __esm({
118852
118876
  "app/javascript/js/controllers/tabs_controller.js"() {
118853
118877
  init_stimulus();
118854
- init_cast_boolean();
118855
118878
  tabs_controller_default = class extends Controller {
118856
- get currentTab() {
118857
- return this.tabPanelTargets.find((element) => element.dataset.tabId === this.activeTabValue);
118879
+ connect() {
118880
+ this.selectCurrentTab();
118858
118881
  }
118859
- targetTabPanel(id) {
118882
+ selectCurrentTab() {
118883
+ const params = {};
118884
+ Array.from(new URL(window.location).searchParams.entries()).forEach(([key2, value]) => {
118885
+ params[key2] = value;
118886
+ });
118887
+ const key = `resources.${this.resourceNameValue}.tabgroups.${this.groupIdValue}.selectedTab`;
118888
+ const lsValue = window.Avo.localStorage.get(key);
118889
+ let groupId = null;
118890
+ if (params[this.groupParam(this.groupIdValue)]) {
118891
+ groupId = params[this.groupParam(this.groupIdValue)];
118892
+ } else if (lsValue) {
118893
+ groupId = lsValue;
118894
+ }
118895
+ if (this.getTabByName(groupId)) {
118896
+ this.hideAllTabs();
118897
+ this.revealTabByName(groupId);
118898
+ }
118899
+ }
118900
+ getTabByName(id) {
118860
118901
  return this.tabPanelTargets.find((element) => element.dataset.tabId === id);
118861
118902
  }
118903
+ groupParam(groupId) {
118904
+ return encodeURIComponent(`tab-group_${groupId}`);
118905
+ }
118862
118906
  changeTab(e4) {
118863
118907
  return __async(this, null, function* () {
118864
118908
  e4.preventDefault();
118865
118909
  const { params } = e4;
118866
- const { id } = params;
118867
- yield this.setTheTargetPanelHeight(id);
118910
+ const { groupId, tabName, resourceName } = params;
118911
+ const key = `resources.${resourceName}.tabgroups.${groupId}.selectedTab`;
118912
+ const u3 = new URL(window.location);
118913
+ u3.searchParams.set(this.groupParam(groupId), encodeURIComponent(tabName));
118914
+ window.history.replaceState(null, "", u3.pathname + u3.search);
118915
+ window.Avo.localStorage.set(key, tabName);
118868
118916
  this.hideAllTabs();
118869
- this.revealTab(id);
118870
- this.markTabLoaded(id);
118871
- this.activeTabValue = id;
118872
- });
118873
- }
118874
- setTheTargetPanelHeight(id) {
118875
- return __async(this, null, function* () {
118876
- if (this.viewValue === "edit" || this.viewValue === "new") {
118877
- return;
118878
- }
118879
- if (castBoolean(this.targetTabPanel(id).dataset.loaded)) {
118880
- return;
118881
- }
118882
- const { height } = this.currentTab.getBoundingClientRect();
118883
- this.targetTabPanel(id).style.height = `${height}px`;
118884
- yield this.targetTabPanel(id).loaded;
118885
- this.targetTabPanel(id).style.height = "";
118917
+ this.revealTabByName(tabName);
118886
118918
  });
118887
118919
  }
118888
- markTabLoaded(id) {
118889
- this.targetTabPanel(id).dataset.loaded = true;
118890
- }
118891
- revealTab(id) {
118892
- this.targetTabPanel(id).classList.remove("hidden");
118920
+ revealTabByName(name) {
118921
+ this.getTabByName(name).classList.remove("hidden");
118893
118922
  }
118894
118923
  hideAllTabs() {
118895
118924
  this.tabPanelTargets.map((element) => element.classList.add("hidden"));
@@ -118898,7 +118927,9 @@
118898
118927
  __publicField(tabs_controller_default, "targets", ["tabPanel"]);
118899
118928
  __publicField(tabs_controller_default, "values", {
118900
118929
  view: String,
118901
- activeTab: String
118930
+ activeTab: String,
118931
+ groupId: String,
118932
+ resourceName: String
118902
118933
  });
118903
118934
  }
118904
118935
  });
@@ -125021,10 +125052,12 @@
125021
125052
  init_turbo();
125022
125053
  var import_ujs = __toESM(require_rails_ujs());
125023
125054
  init_tippy_esm();
125055
+ init_local_storage_service();
125024
125056
  init_chart_esm2();
125025
125057
  init_active_storage();
125026
125058
  init_controllers();
125027
125059
  init_custom_stream_actions();
125060
+ window.Avo.localStorage = new LocalStorageService();
125028
125061
  import_ujs.default.start();
125029
125062
  window.Turbolinks = turbo_es2017_esm_exports;
125030
125063
  var scrollTop = null;