inertia-bootstrap-forms 3.0.2 → 4.0.1
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.
- package/README.fa.md +86 -6
- package/README.md +95 -8
- package/dist/chunks/UppyInput-Dt8CPfgC.js +210 -0
- package/dist/chunks/UppyInput-ldc834tZ.cjs +1 -0
- package/dist/chunks/_plugin-vue_export-helper-13TPlHFF.js +81 -0
- package/dist/chunks/_plugin-vue_export-helper-BHyUve4F.cjs +1 -0
- package/dist/chunks/http-CDPNmbjF.cjs +1 -0
- package/dist/chunks/http-DV3dRBe5.js +158 -0
- package/dist/country-codes.cjs +1 -0
- package/dist/country-codes.js +245 -0
- package/dist/dropzone.cjs +1 -0
- package/dist/dropzone.js +81 -0
- package/dist/editor.cjs +1 -0
- package/dist/editor.js +52 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +3230 -0
- package/dist/location.cjs +1 -0
- package/dist/location.js +84 -0
- package/dist/persian-date.cjs +1 -0
- package/dist/persian-date.js +73 -0
- package/dist/style.css +1 -0
- package/dist/tel.cjs +1 -0
- package/dist/tel.js +85 -0
- package/dist/uppy-dashboard.cjs +1 -0
- package/dist/uppy-dashboard.js +31 -0
- package/dist/uppy.cjs +1 -0
- package/dist/uppy.js +4 -0
- package/index.d.ts +50 -30
- package/package.json +101 -17
- package/src/CheckboxToggle.vue +1 -1
- package/src/ComboboxInput.vue +495 -496
- package/src/PasswordInput.vue +124 -123
- package/src/StarRatingInput.vue +1 -1
- package/src/UppyDashboardInput.vue +45 -0
- package/src/UppyInput.vue +36 -3
- package/src/VoiceRecorderInput.vue +660 -0
- package/src/VoiceRecorderResultArea.vue +109 -0
- package/src/composables/useVoiceChannel.js +31 -0
- package/src/entries/country-codes.js +1 -0
- package/src/entries/dropzone.js +1 -0
- package/src/entries/editor.js +1 -0
- package/src/entries/location.js +1 -0
- package/src/entries/persian-date.js +1 -0
- package/src/entries/tel.js +1 -0
- package/src/entries/uppy-dashboard.js +1 -0
- package/src/entries/uppy.js +1 -0
- package/src/index.js +6 -19
- package/types/country-codes.d.ts +1 -0
- package/types/dropzone.d.ts +2 -0
- package/types/editor.d.ts +2 -0
- package/types/location.d.ts +2 -0
- package/types/persian-date.d.ts +2 -0
- package/types/tel.d.ts +2 -0
- package/types/uppy-dashboard.d.ts +12 -0
- package/types/uppy.d.ts +10 -0
- package/dist/inertia-bootstrap-forms.cjs.js +0 -1
- package/dist/inertia-bootstrap-forms.es.js +0 -3536
- package/src/RangeSliderInput.vue +0 -103
- package/src/Select2Input.vue +0 -251
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import {computed, defineComponent, onBeforeUnmount, onMounted, ref} from 'vue';
|
|
3
|
+
import {formatTime, retainVoiceArea, voiceChannels} from './composables/useVoiceChannel.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shows the recordings (Bootstrap list-group with players) and/or the errors of a <VoiceRecorderInput>
|
|
7
|
+
* anywhere on the page:
|
|
8
|
+
*
|
|
9
|
+
* <VoiceRecorderInput name="voice" />
|
|
10
|
+
* ...
|
|
11
|
+
* <VoiceRecorderResultArea for="voice" />
|
|
12
|
+
*
|
|
13
|
+
* `for` is the `channel` (or, when it is not set, the `name`) of the recorder. As soon as an area is attached
|
|
14
|
+
* the recorder stops showing its own results (see its `inline-results` prop).
|
|
15
|
+
*/
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: 'VoiceRecorderResultArea',
|
|
18
|
+
props: {
|
|
19
|
+
/** channel / name of the recorder to display. */
|
|
20
|
+
for: {type: String, required: true},
|
|
21
|
+
showList: {type: Boolean, default: true},
|
|
22
|
+
showProblem: {type: Boolean, default: true},
|
|
23
|
+
/** Extra classes of the list-group. */
|
|
24
|
+
listClass: {type: [String, Array, Object], default: null},
|
|
25
|
+
/** Classes of the error alert. */
|
|
26
|
+
alertClass: {type: [String, Array, Object], default: 'alert theme-danger mb-2'},
|
|
27
|
+
/** Used by the recorder itself for its built-in output; does not count as an external area. */
|
|
28
|
+
internal: {type: Boolean, default: false},
|
|
29
|
+
},
|
|
30
|
+
setup(props) {
|
|
31
|
+
const root = ref(null);
|
|
32
|
+
const channel = computed(() => voiceChannels[props.for] ?? null);
|
|
33
|
+
let release = null;
|
|
34
|
+
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
if (!props.internal) release = retainVoiceArea(props.for);
|
|
37
|
+
});
|
|
38
|
+
onBeforeUnmount(() => release?.());
|
|
39
|
+
|
|
40
|
+
const t = (key) => channel.value?.t?.(key) ?? key;
|
|
41
|
+
|
|
42
|
+
// only one player at a time
|
|
43
|
+
function onPlay(event) {
|
|
44
|
+
root.value?.querySelectorAll('audio').forEach((audio) => {
|
|
45
|
+
if (audio !== event.target) audio.pause();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {root, channel, t, onPlay, formatTime};
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<div
|
|
56
|
+
v-if="channel && ((showProblem && channel.problem) || (showList && channel.items.length))"
|
|
57
|
+
ref="root"
|
|
58
|
+
class="voice-recorder-results"
|
|
59
|
+
>
|
|
60
|
+
<div v-if="showProblem && channel.problem" :class="alertClass" role="alert" :data-code="channel.problem.code">
|
|
61
|
+
{{ channel.problem.message }}
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<ul v-if="showList && channel.items.length" class="list-group" :class="listClass">
|
|
65
|
+
<li v-for="item in channel.items" :key="item.id" class="list-group-item">
|
|
66
|
+
<slot
|
|
67
|
+
name="item"
|
|
68
|
+
:item="item"
|
|
69
|
+
:time="item.seconds !== null ? formatTime(item.seconds) : null"
|
|
70
|
+
:locked="channel.locked"
|
|
71
|
+
:remove="() => channel.remove(item)"
|
|
72
|
+
:retry="() => channel.retry(item)"
|
|
73
|
+
>
|
|
74
|
+
<div class="row gx-3 align-items-center">
|
|
75
|
+
<div class="col-12 sm:col-4">
|
|
76
|
+
<audio class="flex-grow-1 w-100" controls preload="metadata" :src="item.src" @play="onPlay"></audio>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="col-auto" v-if="item.seconds !== null">
|
|
79
|
+
<span class="fg-secondary fanum" dir="ltr">{{ formatTime(item.seconds) }}</span>
|
|
80
|
+
</div>
|
|
81
|
+
<div class="col">
|
|
82
|
+
<div v-if="item.status === 'uploading'" class="progress" role="progressbar" :aria-valuenow="item.percent" aria-valuemin="0" aria-valuemax="100">
|
|
83
|
+
<div class="progress-bar" :style="{ width: item.percent + '%' }"></div>
|
|
84
|
+
</div>
|
|
85
|
+
<div v-if="item.status === 'error'" class="fg-danger" role="alert">{{ item.error }}</div>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="col-auto" v-if="item.status === 'error'">
|
|
88
|
+
<button type="button" class="btn-text theme-secondary btn-icon" :aria-label="t('retry')" @click="channel.retry(item)">
|
|
89
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
|
|
90
|
+
aria-hidden="true">
|
|
91
|
+
<path d="M13.5 3v3.5H10"/>
|
|
92
|
+
<path d="M3.2 6.5A5.5 5.5 0 0 1 13 6.5M12.8 9.5A5.5 5.5 0 0 1 3 9.5M2.5 13V9.5H6"/>
|
|
93
|
+
</svg>
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="col-auto">
|
|
97
|
+
<button v-if="!channel.locked" type="button" class="btn-text theme-danger btn-icon" :aria-label="t('remove')" @click="channel.remove(item)">
|
|
98
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
|
|
99
|
+
aria-hidden="true">
|
|
100
|
+
<path d="M2.5 4.5h11M6 4.5V3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.5M4 4.5l.6 8.1a1 1 0 0 0 1 .9h4.8a1 1 0 0 0 1-.9l.6-8.1"/>
|
|
101
|
+
</svg>
|
|
102
|
+
</button>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</slot>
|
|
106
|
+
</li>
|
|
107
|
+
</ul>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { reactive } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared state between <VoiceRecorderInput> and any number of <VoiceRecorderResultArea> components.
|
|
5
|
+
* A recorder publishes its list of recordings and its current problem under a "channel" key
|
|
6
|
+
* (its `channel` prop, or its `name`); a result area with `for="<key>"` displays them anywhere on the page.
|
|
7
|
+
*
|
|
8
|
+
* The recorder registers itself in onMounted and removes itself on unmount, so nothing is shared between
|
|
9
|
+
* server-side requests and nothing is leaked between pages.
|
|
10
|
+
*/
|
|
11
|
+
export const voiceChannels = reactive({});
|
|
12
|
+
export const voiceAreaCounts = reactive({});
|
|
13
|
+
|
|
14
|
+
export function registerVoiceChannel(key, entry) {
|
|
15
|
+
voiceChannels[key] = entry;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function unregisterVoiceChannel(key, owner) {
|
|
19
|
+
if (voiceChannels[key]?.owner === owner) delete voiceChannels[key];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Counts the (non-internal) result areas attached to a channel; returns the release function. */
|
|
23
|
+
export function retainVoiceArea(key) {
|
|
24
|
+
voiceAreaCounts[key] = (voiceAreaCounts[key] || 0) + 1;
|
|
25
|
+
return () => {
|
|
26
|
+
voiceAreaCounts[key] = Math.max(0, (voiceAreaCounts[key] || 1) - 1);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const pad = (n) => String(Math.floor(n)).padStart(2, '0');
|
|
31
|
+
export const formatTime = (s) => `${pad(s / 60)}:${pad(s % 60)}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as countryCodes } from '../countryCodes.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DropzoneInput } from '../DropzoneInput.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as EditorInput } from '../EditorInput.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LocationInput } from '../LocationInput.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PersianDatePickerInput } from '../PersianDatePickerInput.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TelInput } from '../TelInput.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as UppyDashboardInput } from '../UppyDashboardInput.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as UppyInput } from '../UppyInput.vue';
|
package/src/index.js
CHANGED
|
@@ -5,8 +5,6 @@ import CheckboxInput from './CheckboxInput.vue';
|
|
|
5
5
|
import CheckboxToggle from './CheckboxToggle.vue';
|
|
6
6
|
import ChipsInput from './ChipsInput.vue';
|
|
7
7
|
import ComboboxInput from './ComboboxInput.vue';
|
|
8
|
-
import DropzoneInput from './DropzoneInput.vue';
|
|
9
|
-
import EditorInput from './EditorInput.vue';
|
|
10
8
|
import EmailInput from './EmailInput.vue';
|
|
11
9
|
import FileInput from './FileInput.vue';
|
|
12
10
|
import FormAdornInput from './FormAdornInput.vue';
|
|
@@ -14,22 +12,20 @@ import FormContainer from './FormContainer.vue';
|
|
|
14
12
|
import FormField from './FormField.vue';
|
|
15
13
|
import FormLabel from './FormLabel.vue';
|
|
16
14
|
import GroupControl from './GroupControl.vue';
|
|
17
|
-
import LocationInput from './LocationInput.vue';
|
|
18
15
|
import MobileInput from './MobileInput.vue';
|
|
19
16
|
import MultiQuantityInput from './MultiQuantityInput.vue';
|
|
20
17
|
import OTPInput from './OTPInput.vue';
|
|
21
18
|
import PasswordInput from './PasswordInput.vue';
|
|
22
|
-
import PersianDatePickerInput from './PersianDatePickerInput.vue';
|
|
23
19
|
import QuantityInput from './QuantityInput.vue';
|
|
24
20
|
import RangeInput from './RangeInput.vue';
|
|
25
21
|
import SimpleUploader from './SimpleUploader.vue';
|
|
26
22
|
import StarRatingInput from './StarRatingInput.vue';
|
|
27
23
|
import SubmitButton from './SubmitButton.vue';
|
|
28
24
|
import SwitchInput from './SwitchInput.vue';
|
|
29
|
-
import TelInput from './TelInput.vue';
|
|
30
25
|
import TextAreaInput from './TextAreaInput.vue';
|
|
31
26
|
import TextInput from './TextInput.vue';
|
|
32
|
-
import
|
|
27
|
+
import VoiceRecorderInput from './VoiceRecorderInput.vue'; // کنار بقیه importها
|
|
28
|
+
import VoiceRecorderResultArea from './VoiceRecorderResultArea.vue'; // کنار importها
|
|
33
29
|
|
|
34
30
|
import { configureBootstrap } from './utils/bootstrap.js';
|
|
35
31
|
import { configureI18n } from './i18n.js';
|
|
@@ -42,13 +38,13 @@ const FormAdorn = FormAdornInput;
|
|
|
42
38
|
const components = {
|
|
43
39
|
AmountInput,
|
|
44
40
|
CaptchaInput,
|
|
41
|
+
VoiceRecorderInput,
|
|
42
|
+
VoiceRecorderResultArea,
|
|
45
43
|
CheckboxButtonInput,
|
|
46
44
|
CheckboxInput,
|
|
47
45
|
CheckboxToggle,
|
|
48
46
|
ChipsInput,
|
|
49
47
|
ComboboxInput,
|
|
50
|
-
DropzoneInput,
|
|
51
|
-
EditorInput,
|
|
52
48
|
EmailInput,
|
|
53
49
|
FileInput,
|
|
54
50
|
FormAdornInput,
|
|
@@ -56,22 +52,18 @@ const components = {
|
|
|
56
52
|
FormField,
|
|
57
53
|
FormLabel,
|
|
58
54
|
GroupControl,
|
|
59
|
-
LocationInput,
|
|
60
55
|
MobileInput,
|
|
61
56
|
MultiQuantityInput,
|
|
62
57
|
OTPInput,
|
|
63
58
|
PasswordInput,
|
|
64
|
-
PersianDatePickerInput,
|
|
65
59
|
QuantityInput,
|
|
66
60
|
RangeInput,
|
|
67
61
|
SimpleUploader,
|
|
68
62
|
StarRatingInput,
|
|
69
63
|
SubmitButton,
|
|
70
64
|
SwitchInput,
|
|
71
|
-
TelInput,
|
|
72
65
|
TextAreaInput,
|
|
73
66
|
TextInput,
|
|
74
|
-
UppyInput,
|
|
75
67
|
// aliases
|
|
76
68
|
Select2Input,
|
|
77
69
|
RangeSliderInput,
|
|
@@ -96,13 +88,13 @@ export default plugin;
|
|
|
96
88
|
export {
|
|
97
89
|
AmountInput,
|
|
98
90
|
CaptchaInput,
|
|
91
|
+
VoiceRecorderInput,
|
|
92
|
+
VoiceRecorderResultArea,
|
|
99
93
|
CheckboxButtonInput,
|
|
100
94
|
CheckboxInput,
|
|
101
95
|
CheckboxToggle,
|
|
102
96
|
ChipsInput,
|
|
103
97
|
ComboboxInput,
|
|
104
|
-
DropzoneInput,
|
|
105
|
-
EditorInput,
|
|
106
98
|
EmailInput,
|
|
107
99
|
FileInput,
|
|
108
100
|
FormAdornInput,
|
|
@@ -110,22 +102,18 @@ export {
|
|
|
110
102
|
FormField,
|
|
111
103
|
FormLabel,
|
|
112
104
|
GroupControl,
|
|
113
|
-
LocationInput,
|
|
114
105
|
MobileInput,
|
|
115
106
|
MultiQuantityInput,
|
|
116
107
|
OTPInput,
|
|
117
108
|
PasswordInput,
|
|
118
|
-
PersianDatePickerInput,
|
|
119
109
|
QuantityInput,
|
|
120
110
|
RangeInput,
|
|
121
111
|
SimpleUploader,
|
|
122
112
|
StarRatingInput,
|
|
123
113
|
SubmitButton,
|
|
124
114
|
SwitchInput,
|
|
125
|
-
TelInput,
|
|
126
115
|
TextAreaInput,
|
|
127
116
|
TextInput,
|
|
128
|
-
UppyInput,
|
|
129
117
|
// aliases
|
|
130
118
|
Select2Input,
|
|
131
119
|
RangeSliderInput,
|
|
@@ -139,4 +127,3 @@ export { useFormApi } from './composables/useFormApi.js';
|
|
|
139
127
|
export { useDisposables } from './composables/useDisposables.js';
|
|
140
128
|
export { useBsInstance } from './composables/useBsInstance.js';
|
|
141
129
|
export { toEnglishDigits } from './utils/digits.js';
|
|
142
|
-
export { default as countryCodes } from './countryCodes.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const countryCodes: Array<{ country: string; code: string; iso: string }>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { FieldComponent, Locale } from '../index.js';
|
|
2
|
+
export declare const PersianDatePickerInput: FieldComponent<{ calendar?: string; view?: string; min?: string | null; max?: string | null; range?: boolean; locale?: string; format?: string; inputFormat?: string | null; placeholder?: string | null; inputClass?: string; pickerOptions?: object }>;
|
package/types/tel.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { FieldComponent, Locale } from '../index.js';
|
|
2
|
+
export declare const TelInput: FieldComponent<{ placeholder?: string; defaultCountry?: string; preferredCountries?: string[]; mode?: string; validCharactersOnly?: boolean; validate?: boolean; dropdownOptions?: object; inputOptions?: object }>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FieldComponent, Locale } from '../index.js';
|
|
2
|
+
import type { DefineComponent } from 'vue';
|
|
3
|
+
import type { FieldProps } from '../index.js';
|
|
4
|
+
import type { UppyInput } from './uppy.js';
|
|
5
|
+
export declare const UppyDashboardInput: DefineComponent<
|
|
6
|
+
FieldProps & {
|
|
7
|
+
webcam?: boolean | Record<string, any>;
|
|
8
|
+
audio?: boolean | Record<string, any>;
|
|
9
|
+
dashboardProps?: object;
|
|
10
|
+
multiple?: boolean; url?: string; config?: object; XHRConfig?: object; locale?: Locale | null;
|
|
11
|
+
}
|
|
12
|
+
>;
|
package/types/uppy.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FieldComponent, Locale } from '../index.js';
|
|
2
|
+
export declare const UppyInput: FieldComponent<{
|
|
3
|
+
multiple?: boolean; useXHR?: boolean; XHRConfig?: object; url?: string; config?: object;
|
|
4
|
+
errorHandler?: ((m: any) => void) | null; showRestrictionCaption?: boolean; locale?: Locale | null;
|
|
5
|
+
/** Extra Uppy plugins: [{ plugin, options: { id }, dashboard?: boolean }] */
|
|
6
|
+
plugins?: Array<{ plugin: any; options?: Record<string, any>; id?: string; dashboard?: boolean }>;
|
|
7
|
+
/** Default export of '@uppy/vue/dashboard' — switches the UI to the Dashboard */
|
|
8
|
+
dashboardComponent?: object | null;
|
|
9
|
+
dashboardProps?: object;
|
|
10
|
+
}>;
|