Skip to content

Commit ab0ca35

Browse files
committed
refactor: move utilities to external library @coreui/utils
1 parent 8df70d0 commit ab0ca35

File tree

9 files changed

+483
-510
lines changed

9 files changed

+483
-510
lines changed

package-lock.json

Lines changed: 466 additions & 467 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"dependencies": {
7070
"@coreui/icons": "^1.0.0",
7171
"@coreui/icons-vue": "^1.1.2",
72-
"@coreui/utils": "^1.0.0",
72+
"@coreui/utils": "^1.2.1",
7373
"@popperjs/core": "^2.0.0",
7474
"lodash.clonedeep": "^4.5.0",
7575
"perfect-scrollbar": "^1.4.0",

src/components/button/CButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
22
import { mergeData } from 'vue-functional-data-merge'
3-
import pickByKeys from '../../utils/pick-by-keys'
3+
import { pickByKeys } from '@coreui/utils/src'
44
import CLink, { propsFactory as linkPropsFactory } from '../link/CLink'
55
66
const btnProps = {

src/components/form/form-mixins.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
import safeIdMixin from '../../mixins/safe-id'
2-
export const safeId = safeIdMixin
1+
import { makeUid } from '@coreui/utils/src'
2+
3+
export const safeId = {
4+
computed: {
5+
safeId () {
6+
if (this.id || this.$attrs.id) {
7+
return this.id || this.$attrs.id
8+
}
9+
return makeUid()
10+
}
11+
}
12+
}
13+
314
export const wrapperComputedProps = {
415
computed: {
516
isHorizontal () {

src/components/form/tests/CInputCheckbox.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ describe(ComponentName, () => {
4747
expect(emittedValues).toEqual([true, false])
4848
})
4949
it('generates safe id when no id is passed', () => {
50-
expect(autoIdWrapper.vm.safeId.includes('_safe_id_')).toBe(true)
50+
expect(autoIdWrapper.vm.safeId.includes('uid-')).toBe(true)
5151
})
5252
})

src/components/list-group/CListGroupItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
22
import { mergeData } from 'vue-functional-data-merge'
3-
import pickByKeys from '../../utils/pick-by-keys'
3+
import { pickByKeys } from '@coreui/utils/src'
44
import CLink, { propsFactory as linkPropsFactory } from '../link/CLink'
55
66
const props = Object.assign(

src/mixins/safe-id.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/utils/pick-by-keys.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/utils/tests/pick-by-keys.spec.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)