@castlabs/ui 8.1.0 → 8.2.0

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.
@@ -1,4 +1,4 @@
1
- /* @castlabs/ui v8.1.0 */
1
+ /* @castlabs/ui v8.2.0 */
2
2
 
3
3
  /*!
4
4
  * Bootstrap v5.3.8 (https://getbootstrap.com/)
@@ -1802,3 +1802,34 @@ export function clThemeSetDark (dark) {
1802
1802
  settings.theme = dark ? 'dark' : 'light'
1803
1803
  setDomainCookieJson('cl_ui_settings', settings)
1804
1804
  }
1805
+
1806
+ // ------------------------------------------------------------------------
1807
+
1808
+ function clGetUISettings () {
1809
+ try {
1810
+ return JSON.parse(localStorage.getItem('cl_ui_settings') ?? '{}')
1811
+ } catch (e) {
1812
+ e.ignore?.()
1813
+ } // catch & storage or parsing issues
1814
+ return {}
1815
+ }
1816
+
1817
+ function clSetUISettings (settings) {
1818
+ try {
1819
+ localStorage.setItem('cl_ui_settings', JSON.stringify(settings))
1820
+ } catch (e) {
1821
+ e.ignore?.()
1822
+ } // catch & storage or parsing issues
1823
+ }
1824
+
1825
+ export function clGetSettingsTable (id) {
1826
+ const settings = clGetUISettings()
1827
+ return settings?.tables?.[id] ? settings?.tables?.[id] : {}
1828
+ }
1829
+
1830
+ export function clSetSettingsTable (id, table) {
1831
+ const settings = clGetUISettings()
1832
+ if (!settings.tables) settings.tables = {}
1833
+ settings.tables[id] = table
1834
+ clSetUISettings(settings)
1835
+ }