@inriver/inri 1.37.0 → 1.39.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.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@inriver/inri": minor
3
+ ---
4
+
5
+ Added support for supplying a string function to determine option label name in CSelect
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@inriver/inri": minor
3
+ ---
4
+
5
+ Add option to opt-out of the global error handler when using initInriFramework
package/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # @inriver/inri
2
2
 
3
+ ## 1.39.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add notBlank validator
8
+ - Added support for supplying a string function to determine option label name in CSelect
9
+ - Update documentation
10
+ - Add correct class to the c-btn component
11
+ - Wallop font is now included in the package
12
+ - Add back button slot
13
+ - Updating README and exporting tailwing config
14
+ - Add option to opt-out of the global error handler when using initInriFramework
15
+ - Add support for placing CDialog action buttons to the right
16
+
17
+ ### Patch Changes
18
+
19
+ - Provide global app configs
20
+ - Fix CSelect placeholder color. Modularize Sass imports. Include inri typings when bundling
21
+ - Fix Sass warnings and errors by removing usage of @apply and updating Quasar + sass dependencies
22
+ - Add support for showing tooltips when hovering over CSelect and options. Add disable support and styling. Fix required validation to work with empty arrays.
23
+ - Fix broken imports due to faulty declaration file
24
+ - Add support for hiding the sidebars in CLayoutWithSidebars. Add support for entering a custom title in CLayoutWithSidebars
25
+ - Add support for showing placeholder ()in CSelect eoutside of use-input mode
26
+ - Fix faulty import path in globalAppConfig
27
+ - Add error slot in CSelect
28
+ - Fix error when CSelect is passed object options with falsy values
29
+
30
+ ## 1.38.0
31
+
32
+ ### Minor Changes
33
+
34
+ - Add notBlank validator
35
+ - Added support for supplying a string function to determine option label name in CSelect
36
+ - Update documentation
37
+ - Add correct class to the c-btn component
38
+ - Wallop font is now included in the package
39
+ - Add back button slot
40
+ - Updating README and exporting tailwing config
41
+ - Add support for placing CDialog action buttons to the right
42
+
43
+ ### Patch Changes
44
+
45
+ - Provide global app configs
46
+ - Fix CSelect placeholder color. Modularize Sass imports. Include inri typings when bundling
47
+ - Fix Sass warnings and errors by removing usage of @apply and updating Quasar + sass dependencies
48
+ - Add support for showing tooltips when hovering over CSelect and options. Add disable support and styling. Fix required validation to work with empty arrays.
49
+ - Fix broken imports due to faulty declaration file
50
+ - Add support for hiding the sidebars in CLayoutWithSidebars. Add support for entering a custom title in CLayoutWithSidebars
51
+ - Add support for showing placeholder ()in CSelect eoutside of use-input mode
52
+ - Fix faulty import path in globalAppConfig
53
+ - Add error slot in CSelect
54
+ - Fix error when CSelect is passed object options with falsy values
55
+
3
56
  ## 1.37.0
4
57
 
5
58
  ### Minor Changes
package/README.md CHANGED
@@ -62,8 +62,10 @@ import App from './App.vue';
62
62
  import 'virtual:windi.css';
63
63
 
64
64
  import { initInriFramework } from '@inriver/inri';
65
+ const Inri = initInriFramework();
66
+
65
67
  const app = createApp(App);
66
- app.use(initInriFramework);
68
+ app.use(Inri);
67
69
 
68
70
  app.mount('#app');
69
71
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inriver/inri",
3
- "version": "1.37.0",
3
+ "version": "1.39.0",
4
4
  "main": "index.ts",
5
5
  "peerDependencies": {
6
6
  "quasar": "2.14.2",
@@ -137,7 +137,7 @@ const props = defineProps({
137
137
  useInput: Boolean,
138
138
  emitValue: Boolean,
139
139
  optionLabel: {
140
- type: String,
140
+ type: [String, Function],
141
141
  default: 'label',
142
142
  },
143
143
  optionValue: {
@@ -175,6 +175,10 @@ const selectedPlaceholder = computed(() => {
175
175
  })
176
176
 
177
177
  function getOptionLabel (opt) {
178
+ if (props.optionLabel instanceof Function) {
179
+ return props.optionLabel(opt)
180
+ }
181
+
178
182
  return typeof opt === 'object' && opt !== null && props.optionLabel in opt
179
183
  ? opt[props.optionLabel]
180
184
  : opt
@@ -6,30 +6,64 @@ import { registerAppConfigurations } from '../plugins/globalAppConfig'
6
6
  import { i18n } from '../plugins/i18n'
7
7
  import logger from '../plugins/errors/logger'
8
8
  import { VueErrorHandler } from '../plugins/errors/vueErrorHandler'
9
- import '../plugins/errors/globalErrorHandler'
9
+ import { useGlobalErrorHandler } from '../plugins/errors/globalErrorHandler'
10
10
 
11
11
  // Quasar plugins
12
12
  import iconSet from 'quasar/icon-set/mdi-v6'
13
13
  import '@quasar/extras/mdi-v6/mdi-v6.css'
14
14
  iconSet.field.error = 'mdi-alert-circle-outline'
15
15
 
16
- export const initInriFramework = (Vue: App): void => {
17
- // Register C-components
18
- registerComponents(Vue)
19
-
20
- // Register global application configurations
21
- registerAppConfigurations(Vue)
22
-
23
- Vue.use(Quasar as any, {
24
- plugins: {
25
- Notify,
26
- Dialog,
27
- Meta,
28
- },
29
- iconSet: iconSet,
30
- })
31
- Vue.use(i18n)
32
- Vue.use(VueErrorHandler)
33
-
34
- logger.init()
16
+ interface InriInitializationOptions {
17
+ useInriComponents?: boolean,
18
+ useInriAppConfigurations?: boolean,
19
+ useInriErrorHandler?: boolean,
20
+ }
21
+
22
+ const defaultInitializationOptions: InriInitializationOptions = {
23
+ useInriComponents: true,
24
+ useInriAppConfigurations: true,
25
+ useInriErrorHandler: true,
26
+ }
27
+
28
+ /**
29
+ * Returns an install function that can be used on Vue applications to install Inri
30
+ *
31
+ * Usage:
32
+ *
33
+ * const Inri = initInriFramework();
34
+ *
35
+ * app.use(Inri);
36
+ *
37
+ * @param options
38
+ * @returns
39
+ */
40
+ export function initInriFramework (options: InriInitializationOptions = defaultInitializationOptions) {
41
+ return (Vue: App) => {
42
+ if (options.useInriComponents) {
43
+ // Register C-components
44
+ registerComponents(Vue)
45
+ }
46
+
47
+ if (options.useInriAppConfigurations) {
48
+ // Register global application configurations
49
+ registerAppConfigurations(Vue)
50
+ }
51
+
52
+ if (options.useInriErrorHandler) {
53
+ useGlobalErrorHandler()
54
+ }
55
+
56
+ Vue.use(Quasar as any, {
57
+ plugins: {
58
+ Notify,
59
+ Dialog,
60
+ Meta,
61
+ },
62
+ iconSet: iconSet,
63
+ })
64
+ Vue.use(i18n)
65
+ Vue.use(VueErrorHandler)
66
+
67
+ logger.init()
68
+ }
35
69
  }
@@ -1,21 +1,23 @@
1
1
  import handleError from './handleError'
2
2
 
3
- // Handle errors outside of components
4
- window.addEventListener('error', (event) => {
5
- handleError(
6
- {
7
- err: event,
8
- caughtBy: 'window eventListener on error',
9
- },
10
- )
11
- })
3
+ export function useGlobalErrorHandler () {
4
+ // Handle errors outside of components
5
+ window.addEventListener('error', (event) => {
6
+ handleError(
7
+ {
8
+ err: event,
9
+ caughtBy: 'window eventListener on error',
10
+ },
11
+ )
12
+ })
12
13
 
13
- // Handle rejected promises outside components
14
- window.addEventListener('unhandledrejection', (event) => {
15
- handleError(
16
- {
17
- err: event,
18
- caughtBy: 'window eventListener on unhandledrejection',
19
- },
20
- )
21
- })
14
+ // Handle rejected promises outside components
15
+ window.addEventListener('unhandledrejection', (event) => {
16
+ handleError(
17
+ {
18
+ err: event,
19
+ caughtBy: 'window eventListener on unhandledrejection',
20
+ },
21
+ )
22
+ })
23
+ }