Skip to content

Commit 92f8ee7

Browse files
committed
- BsModel: fixed bug when the toObject method was overridden and its return value did not have a field that was mentioned by the idProperty property.
- BsListTile: remove `d-flex` from its classes - BsSideDrawer: improvement when there are multiple `<BsApp>` and `<BsSideDrawer>` instances. - Update CHANGELOG.md - Fixed Typescript type-check error on Vue v3.51 or later - Fixed coding style consistency
1 parent d725ad5 commit 92f8ee7

File tree

220 files changed

+5842
-4633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+5842
-4633
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@
55

66
## v2.0.11
77

8-
Released: August XX, 2024
8+
Released: September 08, 2024
99

1010
### Features & Improvements
1111

1212
- **BsListNavItem**, **BsListTile**, **BsTab**, **BsTabItem**:
1313
- Add `path-name` and `location` properties to better accommodate the `<RouterLink>` property.
1414
- **BsListNavItem**, **BsListTile**: improve route matcher
15+
- **BsSideDrawer**: improvement when there are multiple `<BsApp>` and `<BsSideDrawer>` instances.
16+
17+
### Bug Fixes
18+
19+
- **BsModel**: fixed bug when the `toObject` method was overridden and its return
20+
value did not have a field that was mentioned by the `idProperty` property.
1521

1622

1723
## v2.0.10
@@ -26,7 +32,7 @@ Released: August 12, 2024
2632
- **BsTextField**, **BsNumericField**: add properties `prefix` and `suffix`.
2733
- **BsChip**: improve UI border-radius to comply material design spec.
2834
- **BsDateTimeField**: prevents the DatePicker from being displayed when the field is in read-only state.
29-
- **BsStore**: add `expression` property on `TFilterOption` object.
35+
- **BsStore**: add `expression` property on `TFilterOption` configuration.
3036

3137
### Bug Fixes
3238

component.d.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import type { AxiosInstance } from 'axios';
22
import type {
33
BsAlert,
4-
BsAppContainer,
4+
BsApp,
55
BsAppbar,
66
BsAppbarItems,
77
BsAppbarTitle,
8+
BsAppContainer,
89
BsAvatar,
910
BsBadge,
1011
BsButton,
@@ -33,6 +34,7 @@ import type {
3334
BsIconSvg,
3435
BsImageHolder,
3536
BsLightbox,
37+
BsListbox,
3638
BsListNav,
3739
BsListNavItem,
3840
BsListTile,
@@ -42,7 +44,6 @@ import type {
4244
BsListTileSubtitle,
4345
BsListTileTitle,
4446
BsListView,
45-
BsListbox,
4647
BsMaskLoader,
4748
BsModal,
4849
BsNotification,
@@ -67,18 +68,19 @@ import type {
6768
BsToggleField,
6869
BsToggleIcon,
6970
BsTooltip,
70-
vClickOutside,
7171
IHttpService,
7272
INotificationProvider,
73+
TVueMdb,
74+
vClickOutside,
7375
vResize,
7476
vScroll,
75-
TVueMdb,
7677
vTouch,
7778
} from './dist/vue-mdb';
7879

7980
declare module '@vue/runtime-core' {
8081
export interface GlobalComponents {
8182
BsAlert: typeof BsAlert;
83+
BsApp: typeof BsApp;
8284
BsAppContainer: typeof BsAppContainer;
8385
BsAppbar: typeof BsAppbar;
8486
BsAppbarItems: typeof BsAppbarItems;

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@
6262
"type-check": "tsc --noEmit -p tsconfig.build.json --composite false"
6363
},
6464
"dependencies": {
65-
"axios": "^1.7.4",
65+
"axios": "^1.7.7",
6666
"body-scroll-lock": "^4.0.0-beta.0",
67-
"fast-xml-parser": "^4.4.1",
67+
"fast-xml-parser": "^4.5.0",
6868
"lodash": "^4.17.21",
6969
"luxon": "^3.5.0",
7070
"resize-observer-polyfill": "^1.5.1",
71-
"vue": "^3.4.38"
71+
"vue": "^3.5.3"
7272
},
7373
"devDependencies": {
7474
"@rollup/plugin-node-resolve": "^15.2.3",
@@ -77,18 +77,18 @@
7777
"@types/body-scroll-lock": "^3.1.2",
7878
"@types/lodash": "^4.17.7",
7979
"@types/luxon": "^3.4.2",
80-
"@types/node": "^22.4.0",
80+
"@types/node": "^22.5.4",
8181
"@vue/tsconfig": "^0.5.1",
8282
"bootstrap": "5.2.3",
8383
"clean-css-cli": "^5.6.3",
8484
"compass-mixins": "^0.12.12",
8585
"npm-run-all": "^4.1.5",
8686
"rimraf": "^6.0.1",
8787
"rollup-plugin-dts": "^6.1.1",
88-
"sass": "^1.77.8",
88+
"sass": "^1.78.0",
8989
"terser": "^5.31.6",
9090
"typescript": "^5.5.4",
91-
"vite": "^5.4.1",
91+
"vite": "^5.4.3",
9292
"vue-router": "^4.4.3"
9393
},
9494
"browserslist": [

src/components/Alert/BsAlert.ts

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import type { ComponentOptionsMixin, ComputedOptions, EmitsOptions, MethodOptions } from 'vue';
21
import { computed, defineComponent, nextTick, ref, watch } from 'vue';
3-
import type { TAlertOptionProps, TBsAlert, TRecord } from '../../types';
4-
import { useAlertClassNames, useAlertColorName, useAlertIconName, useRenderAlert } from './mixins/alertApi';
2+
import {
3+
useAlertClassNames,
4+
useAlertColorName,
5+
useAlertIconName,
6+
useRenderAlert,
7+
} from './mixins/alertApi';
58
import { alertProps } from './mixins/alertProps';
9+
import type { TAlertOptionProps, TBsAlert } from './types';
610

7-
export default defineComponent<TBsAlert, TRecord, TRecord, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions>({
11+
export default defineComponent<TBsAlert>({
812
name: 'BsAlert',
913
props: alertProps,
1014
emits: [
@@ -15,26 +19,22 @@ export default defineComponent<TBsAlert, TRecord, TRecord, ComputedOptions, Meth
1519
/**
1620
* Event fired when this component's value is updated.
1721
*/
18-
'update:model-value'
22+
'update:model-value',
1923
],
20-
setup(props, {emit, slots}) {
24+
setup(props, { emit, slots }) {
2125
const thisProps = props as Readonly<TAlertOptionProps>;
2226
const dismiss = ref<boolean>(false);
23-
const colorName = computed<string | undefined>(
24-
() => useAlertColorName(thisProps)
25-
);
26-
const alertIconName = computed<string | undefined>(
27-
() => useAlertIconName(thisProps)
28-
);
29-
const classNames = computed<Record<string, boolean | undefined>>(
30-
() => useAlertClassNames(thisProps, colorName)
27+
const colorName = computed<string | undefined>(() => useAlertColorName(thisProps));
28+
const alertIconName = computed<string | undefined>(() => useAlertIconName(thisProps));
29+
const classNames = computed<Record<string, boolean | undefined>>(() =>
30+
useAlertClassNames(thisProps, colorName)
3131
);
3232
const show = computed(() => !dismiss.value && thisProps.modelValue);
3333
const dismissedAlert = () => {
3434
dismiss.value = true;
3535
emit('update:model-value', false);
36-
nextTick().then(() => emit('close'))
37-
}
36+
nextTick().then(() => emit('close'));
37+
};
3838

3939
watch(
4040
() => thisProps.modelValue,
@@ -46,6 +46,14 @@ export default defineComponent<TBsAlert, TRecord, TRecord, ComputedOptions, Meth
4646
);
4747

4848
return () =>
49-
useRenderAlert(slots, thisProps, show, classNames, colorName, alertIconName, dismissedAlert);
50-
}
49+
useRenderAlert(
50+
slots,
51+
thisProps,
52+
show,
53+
classNames,
54+
colorName,
55+
alertIconName,
56+
dismissedAlert
57+
);
58+
},
5159
});

src/components/Alert/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type {App, Plugin} from "vue";
2-
import BsAlert from "./BsAlert";
3-
import "../../../scss/_transitions.scss";
4-
import "./alert.scss";
1+
import type { App, Plugin } from 'vue';
2+
import BsAlert from './BsAlert';
3+
import '../../../scss/_transitions.scss';
4+
import './alert.scss';
55

66
const BsAlertPlugin: Plugin = {
77
install: (app: App): void => {
88
app.component(BsAlert.name as string, BsAlert);
9-
}
10-
}
9+
},
10+
};
1111

12-
export {BsAlertPlugin, BsAlert}
12+
export { BsAlertPlugin, BsAlert };

src/components/Alert/mixins/alertApi.ts

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
cssPrefix,
55
useRenderSlotDefault,
66
useRenderSlotWithWrapper,
7-
useRenderTransition
7+
useRenderTransition,
88
} from '../../../mixins/CommonApi';
99
import type { TAlertOptionProps, TBsButton, TBsIcon, TButtonMode } from '../../../types';
1010
import Helper from '../../../utils/Helper';
@@ -14,17 +14,18 @@ import { BsIcon } from '../../Icon';
1414

1515
export function useAlertClassNames(
1616
props: Readonly<TAlertOptionProps>,
17-
colorName: ComputedRef<string | undefined>,
17+
colorName: ComputedRef<string | undefined>
1818
): Record<string, boolean | undefined> {
1919
const solid = props.solidFill || props.filled;
2020
return {
2121
'alert d-flex': true,
2222
'align-items-center': true,
2323
'alert-dismissible': props.dismissible,
2424
[`alert-${colorName.value}`]: !Helper.isEmpty(colorName.value) && !props.outlined && !solid,
25-
[`${cssPrefix}alert-solid-${colorName.value}`]: !Helper.isEmpty(colorName.value) && solid && !props.outlined,
25+
[`${cssPrefix}alert-solid-${colorName.value}`]:
26+
!Helper.isEmpty(colorName.value) && solid && !props.outlined,
2627
[`${cssPrefix}alert-outline-${colorName.value}`]: props.outlined,
27-
}
28+
};
2829
}
2930

3031
export function useAlertColorName(props: Readonly<TAlertOptionProps>): string | undefined {
@@ -70,46 +71,49 @@ function doRenderAlert(
7071
classNames: ComputedRef<Record<string, boolean | undefined>>,
7172
alertColorName: ComputedRef<string | undefined>,
7273
alertIconName: ComputedRef<string | undefined>,
73-
dismissHandler: VoidFunction,
74+
dismissHandler: VoidFunction
7475
): VNode {
7576
// openBlock();
7677
// return createElementBlock('div', {
77-
return h('div', {
78-
// class: normalizeClass(classNames.value),
79-
class: classNames.value,
80-
role: 'alert'
81-
}, [
82-
useRenderSlotWithWrapper(
83-
slots, 'icon', Helper.uuid(),
84-
{class: 'd-flex alert-icon me-3'},
85-
(
78+
return h(
79+
'div',
80+
{
81+
// class: normalizeClass(classNames.value),
82+
class: classNames.value,
83+
role: 'alert',
84+
},
85+
[
86+
useRenderSlotWithWrapper(
87+
slots,
88+
'icon',
89+
Helper.uuid(),
90+
{ class: 'd-flex alert-icon me-3' },
8691
alertIconName.value
8792
? h<TBsIcon>(BsIcon, {
88-
...useCreateIconProps(props),
89-
icon: alertIconName.value as Prop<string | undefined>,
90-
size: 32 as Prop<number>,
91-
})
93+
...useCreateIconProps(props),
94+
icon: alertIconName.value as Prop<string | undefined>,
95+
size: 32 as Prop<number>,
96+
})
9297
: undefined
93-
)
94-
),
95-
useRenderSlotDefault('div', slots, 'flex-fill'),
96-
props.dismissible
97-
? h<TBsButton>(BsButton, {
98-
class: 'ms-auto',
99-
color: (
100-
!(props.filled || props.solidFill)
101-
? alertColorName.value
102-
: ['light', 'light-grey'].includes(props.color as string)
103-
? 'dark' : 'light text-white'
104-
) as Prop<string>,
105-
icon: 'close' as Prop<string>,
106-
mode: 'icon' as Prop<TButtonMode>,
107-
// @ts-ignore
108-
flat: true as Prop<boolean>,
109-
onClick: dismissHandler
110-
})
111-
: createCommentVNode(' v-if-alert-dismissible '),
112-
]);
98+
),
99+
useRenderSlotDefault('div', slots, 'flex-fill'),
100+
props.dismissible
101+
? h<TBsButton>(BsButton, {
102+
class: 'ms-auto',
103+
color: (!(props.filled || props.solidFill)
104+
? alertColorName.value
105+
: ['light', 'light-grey'].includes(props.color as string)
106+
? 'dark'
107+
: 'light text-white') as Prop<string>,
108+
icon: 'close' as Prop<string>,
109+
mode: 'icon' as Prop<TButtonMode>,
110+
// @ts-ignore
111+
flat: true as Prop<boolean>,
112+
onClick: dismissHandler,
113+
})
114+
: createCommentVNode(' v-if-alert-dismissible '),
115+
]
116+
);
113117
}
114118

115119
export function useRenderAlert(
@@ -119,14 +123,12 @@ export function useRenderAlert(
119123
classNames: ComputedRef<Record<string, boolean | undefined>>,
120124
alertColorName: ComputedRef<string | undefined>,
121125
alertIconName: ComputedRef<string | undefined>,
122-
dismissHandler: VoidFunction,
126+
dismissHandler: VoidFunction
123127
): VNode {
124128
return useRenderTransition(
125-
{name: props.transition},
126-
(
127-
showAlert.value
128-
? doRenderAlert(slots, props, classNames, alertColorName, alertIconName, dismissHandler)
129-
: createCommentVNode(' BsAlert ')
130-
),
129+
{ name: props.transition },
130+
showAlert.value
131+
? doRenderAlert(slots, props, classNames, alertColorName, alertIconName, dismissHandler)
132+
: createCommentVNode(' BsAlert ')
131133
);
132134
}
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import {booleanProp, booleanTrueProp, defaultTransitionProp, stringProp} from "../../../mixins/CommonProps";
2-
import {iconProps} from "../../Avatar/mixins/avatarProps";
3-
import {iconVariant} from "../../Icon/mixins/iconProps";
1+
import {
2+
booleanProp,
3+
booleanTrueProp,
4+
defaultTransitionProp,
5+
stringProp,
6+
} from '../../../mixins/CommonProps';
7+
import { iconProps } from '../../Avatar/mixins/avatarProps';
8+
import { iconVariant } from '../../Icon/mixins/iconProps';
49

510
export const alertProps = {
611
color: stringProp,
@@ -9,17 +14,19 @@ export const alertProps = {
914
iconType: {
1015
type: String,
1116
default: undefined,
12-
validator: (value: string): boolean => ["success", "info", "warning", "danger", "help"].includes(value)
17+
validator: (value: string): boolean =>
18+
['success', 'info', 'warning', 'danger', 'help'].includes(value),
1319
},
1420
variant: {
1521
type: String,
1622
default: undefined,
17-
validator: (value: string): boolean => ["success", "info", "warning", "danger", "help"].includes(value)
23+
validator: (value: string): boolean =>
24+
['success', 'info', 'warning', 'danger', 'help'].includes(value),
1825
},
1926
outlined: booleanProp,
2027
filled: booleanProp,
2128
solidFill: booleanProp,
2229
transition: defaultTransitionProp,
2330
modelValue: booleanTrueProp,
2431
...iconProps,
25-
}
32+
};

0 commit comments

Comments
 (0)