Skip to content

Commit af0fc10

Browse files
Fix and improve typescript support
1 parent b677678 commit af0fc10

29 files changed

+298
-116
lines changed

.eslintrc.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ module.exports = {
4040
'vue',
4141
],
4242
root: true,
43-
settings: {
44-
'import/resolver': {
45-
'babel-module': {},
46-
},
47-
},
4843
rules: {
4944
'@typescript-eslint/ban-ts-comment': 0,
5045
'@typescript-eslint/ban-types': [

src/documentation/sections/UsageSection.vue

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,30 @@
1212
Usage
1313
</h2>
1414

15+
<v-row>
16+
<v-col cols="12">
17+
<CodeBlock
18+
:code="usageGlobalPlugin"
19+
:highlightjs="codeBlockSettings.plugin === 'highlightjs'"
20+
lang="javascript"
21+
:prismjs="codeBlockSettings.plugin === 'prismjs'"
22+
:theme="codeBlockSettings.theme"
23+
>
24+
<template #label>
25+
Global Plugin Registration
26+
<br>
27+
<i>Global options have a higher precedence and will override local props</i>
28+
</template>
29+
</CodeBlock>
30+
</v-col>
31+
</v-row>
32+
1533
<v-row>
1634
<v-col cols="12">
1735
<CodeBlock
1836
:code="usageAll"
1937
:highlightjs="codeBlockSettings.plugin === 'highlightjs'"
20-
label="Load all components"
38+
label="Global Component Registration"
2139
lang="javascript"
2240
:prismjs="codeBlockSettings.plugin === 'prismjs'"
2341
:theme="codeBlockSettings.theme"
@@ -29,7 +47,19 @@
2947
<CodeBlock
3048
:code="usageIndividual"
3149
:highlightjs="codeBlockSettings.plugin === 'highlightjs'"
32-
label="Load individual components"
50+
label="Global Individual Component Registration"
51+
lang="javascript"
52+
:prismjs="codeBlockSettings.plugin === 'prismjs'"
53+
:theme="codeBlockSettings.theme"
54+
>
55+
</CodeBlock>
56+
</v-col>
57+
58+
<v-col cols="12">
59+
<CodeBlock
60+
:code="usageLocal"
61+
:highlightjs="codeBlockSettings.plugin === 'highlightjs'"
62+
label="Local Registration"
3363
lang="javascript"
3464
:prismjs="codeBlockSettings.plugin === 'prismjs'"
3565
:theme="codeBlockSettings.theme"
@@ -55,6 +85,20 @@ const props = defineProps({
5585
const codeBlockSettings = computed(() => props.codeBlockOptions);
5686
const classes = inject('classes');
5787
88+
const usageGlobalPlugin = `import { createApp } from 'vue';
89+
import App from './App.vue';
90+
import { createVInlineFields } from '@wdns/vuetify-inline-fields';
91+
92+
const VInlineFields = createVInlineFields({
93+
// See Shared Props section for available options
94+
});
95+
96+
const app = createApp(App);
97+
98+
app.plugin(VInlineFields);
99+
100+
app.mount('#app');`;
101+
58102
const usageAll = `import { createApp } from 'vue';
59103
import App from './App.vue';
60104
import * as VInlineFields from '@wdns/vuetify-inline-fields';
@@ -86,4 +130,13 @@ app.component('VInlineTextField', VInlineTextField);
86130
app.component('VInlineTextarea', VInlineTextarea);
87131
88132
app.mount('#app');`;
133+
134+
const usageLocal = `import {
135+
VInlineCheckbox,
136+
VInlineSelect,
137+
VInlineSwitch,
138+
VInlineTextField,
139+
VInlineTextarea,
140+
} from '@wdns/vuetify-inline-fields';
141+
`;
89142
</script>

src/index.ts

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

src/main.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,18 @@ import { createApp } from 'vue';
55
import { createPinia } from 'pinia';
66
import { registerPlugins } from './plugins';
77
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
8-
import * as VInlineFields from './index';
98
import { makeServer } from './server';
9+
import { createVInlineFields } from './plugin/index';
1010

1111
makeServer({ environment: 'demo' });
1212

1313
const app = createApp(App);
1414
app.component('CodeBlock', CodeBlock);
15+
app.use(createVInlineFields());
1516
app.use(createPinia());
1617
app.component('font-awesome-icon', FontAwesomeIcon);
1718
app.component('FaIcon', FontAwesomeIcon);
1819

19-
for (const prop in VInlineFields) {
20-
app.component(prop, VInlineFields[prop]);
21-
}
22-
2320
registerPlugins(app);
2421

2522
app.mount('#app');

src/playground/configs/playground.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,32 @@ import { createPinia } from 'pinia';
55
import { registerPlugins } from '../../plugins';
66
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
77
import { makeServer } from '../../server';
8-
import * as VInlineFields from '../../index';
8+
import { createVInlineFields } from '../../plugin/index';
9+
// import {
10+
// VInlineCheckbox,
11+
// VInlineCustomField,
12+
// VInlineSelect,
13+
// VInlineSwitch,
14+
// VInlineTextField,
15+
// VInlineTextarea,
16+
// } from '../../plugin/index';
917

1018
makeServer({ environment: 'playground' });
1119

1220
const app = createApp(PlaygroundApp);
21+
app.use(createVInlineFields({
22+
// cell: true,
23+
}));
1324
app.use(createPinia());
1425
app.component('font-awesome-icon', FontAwesomeIcon);
1526
app.component('FaIcon', FontAwesomeIcon);
1627

17-
for (const prop in VInlineFields) {
18-
app.component(prop, VInlineFields[prop]);
19-
}
28+
// app.component('VInlineCheckbox', VInlineCheckbox);
29+
// app.component('VInlineCustomField', VInlineCustomField);
30+
// app.component('VInlineSelect', VInlineSelect);
31+
// app.component('VInlineSwitch', VInlineSwitch);
32+
// app.component('VInlineTextField', VInlineTextField);
33+
// app.component('VInlineTextarea', VInlineTextarea);
2034

2135
registerPlugins(app);
2236

0 commit comments

Comments
 (0)