@unsource/ui 1.9.11 → 1.9.12

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/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unsource-ui",
3
3
  "configKey": "unsourceUi",
4
- "version": "1.9.11",
4
+ "version": "1.9.12",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsource/ui",
3
- "version": "1.9.11",
3
+ "version": "1.9.12",
4
4
  "private": false,
5
5
  "description": "nuxt ui kit for unsource env",
6
6
  "repository": "https://github.com/alisa2142/unsource-ui",
@@ -1,20 +0,0 @@
1
- import type { Input } from "~/types/models";
2
- type __VLS_Props = {
3
- disabled?: boolean;
4
- Input?: Input;
5
- Type?: Input["type"];
6
- isError?: boolean;
7
- index?: number;
8
- };
9
- declare const Input: any;
10
- type __VLS_ModelProps = {
11
- modelValue?: any;
12
- };
13
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
14
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
- "update:modelValue": (value: any) => any;
16
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
18
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
- declare const _default: typeof __VLS_export;
20
- export default _default;
@@ -1,35 +0,0 @@
1
- <template>
2
- <div
3
- :class="{ '!border-danger': isError }"
4
- class="bg-white rounded-2xl h-12 flex gap-2 items-stretch px-2 ">
5
- <input
6
- :name="Input?.key + (index || '')"
7
- :value="Text"
8
- @input="SetText"
9
- type="text"
10
- :disabled="disabled"
11
- :minlength="Input?.min || void 0"
12
- :maxlength="Input?.max || void 0"
13
- :inputmode="Type === 'number' ? 'decimal' : Input?.keyboadType || 'text'"
14
- class="flex-grow bg-transparent outline-none"
15
- :placeholder="Input?.placeholder || ''"/>
16
- <div v-if="Input?.append"
17
- class="flex items-center justify-center text-gray-500">{{ Input.append }}
18
- </div>
19
- </div>
20
- </template>
21
-
22
- <script setup>
23
- import { s2n } from "~/composables/global";
24
- import numeral from "numeral";
25
- const { Type, Input } = defineProps({
26
- disabled: { type: Boolean, required: false },
27
- Input: { type: null, required: false },
28
- Type: { type: null, required: false },
29
- isError: { type: Boolean, required: false },
30
- index: { type: Number, required: false }
31
- });
32
- const modelValue = defineModel({ type: null });
33
- const Text = computed(() => Type === "number" ? numeral(modelValue.value).format("0,0") : ["numeric", "decimal"].includes(Input?.keyboadType) ? s2n(p2e(modelValue.value + "")) : modelValue.value);
34
- const SetText = (v) => modelValue.value = Type === "number" ? Number(s2n(p2e(v.target.value || 0))) : v.target.value || "";
35
- </script>
@@ -1,20 +0,0 @@
1
- import type { Input } from "~/types/models";
2
- type __VLS_Props = {
3
- disabled?: boolean;
4
- Input?: Input;
5
- Type?: Input["type"];
6
- isError?: boolean;
7
- index?: number;
8
- };
9
- declare const Input: any;
10
- type __VLS_ModelProps = {
11
- modelValue?: any;
12
- };
13
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
14
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
- "update:modelValue": (value: any) => any;
16
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
18
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
- declare const _default: typeof __VLS_export;
20
- export default _default;
@@ -1,14 +0,0 @@
1
- import type { Form, InputOption } from "~/types/models";
2
- type __VLS_Props = {
3
- item: Form;
4
- options: InputOption[];
5
- required?: boolean;
6
- isError?: boolean;
7
- };
8
- type __VLS_ModelProps = {
9
- modelValue?: any;
10
- };
11
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
- declare const _default: typeof __VLS_export;
14
- export default _default;
@@ -1,89 +0,0 @@
1
- <template>
2
- <div class="flex flex-col gap-1 items-stretch text-base">
3
- <TheLabel
4
- :class="{ '!children:text-danger': isError }"
5
- v-if="Input?.title && Type !== 'switch'"
6
- :header="Input.title + (required ? '*' : '')"
7
- >
8
- {{ Input?.description }}
9
- </TheLabel>
10
- <TheFormInput v-model="modelValue" v-if="(Type === 'text' || Type === 'number') && !Input?.multiSelect" :Input="Input" :Type="Type" :disabled="item.disabled" :isError="isError"/>
11
- <div v-for="(_,index) in modelValue" class="flex gap-2 items-center" v-else-if="(Type === 'text' || Type === 'number') && Input?.multiSelect">
12
- <TheFormInput :index="index" class="grow" v-model="modelValue[index]" :Input="Input" :Type="Type" :disabled="item.disabled" :isError="isError"/>
13
- <TheNuxtIcon v-if="!(index === 0 && required)" name="solar:trash-bin-minimalistic-bold-duotone" class="text-danger cursor-pointer" @click="removeItem(index)"/>
14
- </div>
15
- <textarea
16
- v-else-if="Type === 'description'"
17
- :name="Input?.key"
18
- v-model="modelValue"
19
- :disabled="item.disabled"
20
- rows="4"
21
- :class="{ '!border-danger': isError }"
22
- class="rounded-2xl bg-white p-2 outline-none text-sm text-black-1 border-none"
23
- :placeholder="Input?.placeholder || ''"/>
24
- <TheToggle
25
- :disabled="item.disabled"
26
- v-else-if="Type === 'switch'"
27
- v-model="modelValue"
28
- :label="Input?.title"/>
29
- <TheSelect
30
- v-else-if="Type === 'select' && options?.length"
31
- v-model="modelValue"
32
- :options="options"
33
- :light="true"
34
- value-key="key"
35
- label-key="title"
36
- :searchable="true"
37
- :disabled="item.disabled"
38
- :is-error
39
- :placeholder="Input.placeholder || ''"
40
- :multi="!!Input.multiSelect"/>
41
- <TheFormLocation v-else-if="Type === 'location'" v-model="modelValue" :isError/>
42
- <TheMultiUploader
43
- v-else-if="Type === 'image' && Input.multiSelect"
44
- v-model="modelValue"
45
- :max="Input?.max || 100"
46
- :selected="modelValue?.default"
47
- :disabled="item.disabled"
48
- accept="image/*"
49
- :class="{ '!border-danger': isError }"/>
50
- <TheUploadFile v-else-if="Type === 'image'"
51
- v-model="modelValue"
52
- class="!h-50"
53
- accept="image/*"
54
- :disabled="item.disabled"
55
- :class="{ '!border-danger': isError }"
56
- icon="solar:gallery-add-line-duotone"
57
- :label="Input.title"/>
58
- <TheIRDatePicker v-else-if="['date', 'datetime', 'time'].includes(Type?.toLowerCase() || '')" v-model="modelValue" locale="fa"
59
- :type="Type?.toLowerCase()" @append="modelValue = null"/>
60
- <small v-if="Type === 'number' && modelValue">
61
- {{ word }} {{ Input?.append || "" }}
62
- </small>
63
- <TheButton variant="primary" class="mt-2" v-if="Input?.multiSelect && !['select', 'image'].includes(Type)" icon="solar:add-square-line-duotone" size="md" @click="addLength"/>
64
- </div>
65
- </template>
66
-
67
- <script setup>
68
- import PN from "persian-number";
69
- const emit = defineEmits(["update:modelValue"]);
70
- const { item, options, required, isError } = defineProps({
71
- item: { type: null, required: true },
72
- options: { type: Array, required: true },
73
- required: { type: Boolean, required: false },
74
- isError: { type: Boolean, required: false }
75
- });
76
- const Input = computed(() => item.input);
77
- const Type = computed(() => Input.value?.type);
78
- const modelValue = defineModel({ type: null });
79
- Input.value?.multiSelect && Type.value !== "select" && (modelValue.value ||= required ? [""] : []);
80
- const word = computed(() => {
81
- return Type.value === "number" && modelValue.value && PN.convert(modelValue.value);
82
- });
83
- const addLength = () => {
84
- modelValue.value?.push("");
85
- };
86
- const removeItem = (i) => {
87
- modelValue.value.splice(i, 1);
88
- };
89
- </script>
@@ -1,14 +0,0 @@
1
- import type { Form, InputOption } from "~/types/models";
2
- type __VLS_Props = {
3
- item: Form;
4
- options: InputOption[];
5
- required?: boolean;
6
- isError?: boolean;
7
- };
8
- type __VLS_ModelProps = {
9
- modelValue?: any;
10
- };
11
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
- declare const _default: typeof __VLS_export;
14
- export default _default;
@@ -1,18 +0,0 @@
1
- import type { Form } from "~/types/models";
2
- type __VLS_Props = {
3
- items: Partial<Form>[];
4
- errors?: string[];
5
- };
6
- type __VLS_ModelProps = {
7
- modelValue?: any;
8
- };
9
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
11
- schema: any;
12
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
- "update:modelValue": (value: any) => any;
14
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
15
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
16
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const _default: typeof __VLS_export;
18
- export default _default;
@@ -1,41 +0,0 @@
1
- <template>
2
- <div class="flex flex-col gap-3 items-stretch">
3
- <TheFormItem :class="{ 'opacity-60': item.disabled }" v-for="item in items.filter(isActive)" :key="item.id" :item="item" v-model="form[_camelCase(item.input?.key)]"
4
- :required="inputIsRequire(item)" :options="Options(item.input?.options || [])" :is-error="errors?.includes(_camelCase(item.input?.key))"/>
5
- </div>
6
- </template>
7
-
8
- <script setup>
9
- const { items } = defineProps({
10
- items: { type: Array, required: true },
11
- errors: { type: Array, required: false }
12
- });
13
- const form = defineModel({ type: null, ...{ default: {} } });
14
- const getter = (key) => (e) => _get(e, key);
15
- const inputIsRequire = (item) => item.requiredByValues?.length && item.requiredby ? item.requiredByValues.includes(`${form.value[_camelCase(item.requiredby)]}`) : item.activatedByValues?.length && item.requiredby ? item.activatedByValues.includes(`${form.value[_camelCase(item.requiredby)]}`) : item.requiredby ? form.value[_camelCase(item.requiredby)] : item.required;
16
- const isActive = (item) => item.activatedByValues?.length && item.activatedBy ? item.activatedByValues.includes(`${form.value[_camelCase(item.activatedBy)]}`) : item.activatedBy ? form.value[_camelCase(item.activatedBy)] : true;
17
- const Options = (item) => item.filter((e) => e.filteredByKey ? form.value[_camelCase(e.filteredByKey)] === e.filterOptionKey : true);
18
- const requiredKeys = computed(() => items.filter(inputIsRequire).map(getter("input.key")).map(_camelCase));
19
- const properties = computed(() => items.reduce((p, c) => {
20
- if (c.input?.max || c.input?.min) {
21
- if (c.input.type === "number") {
22
- _set(p, c.input?.key, {
23
- max: c.input?.max || void 0,
24
- min: c.input?.min || void 0
25
- });
26
- } else {
27
- _set(p, c.input?.key, {
28
- maxLength: c.input?.max || void 0,
29
- minLength: c.input?.min || void 0
30
- });
31
- }
32
- }
33
- return p;
34
- }, {}));
35
- const schema = computed(() => ({
36
- type: "object",
37
- properties: properties.value,
38
- required: requiredKeys.value
39
- }));
40
- defineExpose({ schema });
41
- </script>
@@ -1,18 +0,0 @@
1
- import type { Form } from "~/types/models";
2
- type __VLS_Props = {
3
- items: Partial<Form>[];
4
- errors?: string[];
5
- };
6
- type __VLS_ModelProps = {
7
- modelValue?: any;
8
- };
9
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
11
- schema: any;
12
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
- "update:modelValue": (value: any) => any;
14
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
15
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
16
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const _default: typeof __VLS_export;
18
- export default _default;
@@ -1,14 +0,0 @@
1
- type __VLS_Props = {
2
- isError?: boolean;
3
- };
4
- type __VLS_ModelProps = {
5
- modelValue?: any;
6
- };
7
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
- "update:modelValue": (value: any) => any;
10
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
11
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
12
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
- declare const _default: typeof __VLS_export;
14
- export default _default;
@@ -1,29 +0,0 @@
1
- <template>
2
- <div>
3
- <div class="h-100 overflow-hidden rounded-lg <md:h-50" @click.prevent.stop="addressModal = true">
4
- <TheMap
5
- :class="{ '!border-danger': isError }"
6
- :remove="true"
7
- :readonly="true"
8
- :points="points"/>
9
- </div>
10
- <TheModalLocation v-show="addressModal" @close="addressModal = false"
11
- @input="modelValue = $event;
12
- addressModal = false"/>
13
- </div>
14
- </template>
15
-
16
- <script setup>
17
- defineProps({
18
- isError: { type: Boolean, required: false }
19
- });
20
- const modelValue = defineModel({ type: null });
21
- const addressModal = ref(false);
22
- const points = computed(() => [
23
- modelValue.value ? {
24
- image: "/images/home-marker.svg",
25
- anchor: [0.5, 0.1],
26
- coords: [modelValue.value.lng, modelValue.value?.lat]
27
- } : null
28
- ]);
29
- </script>
@@ -1,14 +0,0 @@
1
- type __VLS_Props = {
2
- isError?: boolean;
3
- };
4
- type __VLS_ModelProps = {
5
- modelValue?: any;
6
- };
7
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
- "update:modelValue": (value: any) => any;
10
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
11
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
12
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
- declare const _default: typeof __VLS_export;
14
- export default _default;
@@ -1,17 +0,0 @@
1
- type __VLS_Props = {
2
- name: string;
3
- ctx?: Record<string, any>;
4
- };
5
- type __VLS_ModelProps = {
6
- modelValue?: any;
7
- };
8
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
9
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
10
- validate: () => Promise<any>;
11
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
- "update:modelValue": (value: any) => any;
13
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
15
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
- declare const _default: typeof __VLS_export;
17
- export default _default;
@@ -1,30 +0,0 @@
1
- <template>
2
- <TheFormList ref="schema" v-if="items?.map((e) => e.value)?.length" :items="items?.map((e) => e.value)" v-model="form"
3
- :errors/>
4
- </template>
5
-
6
- <script setup>
7
- import { formattedAddress, setOptions } from "~/composables/global";
8
- import { getForms } from "~/composables/services";
9
- const { name, ctx } = defineProps({
10
- name: { type: String, required: true },
11
- ctx: { type: Object, required: false }
12
- });
13
- const form = defineModel();
14
- const schema = ref(null);
15
- const { data: items } = useAsyncData("get-form", () => getForms(name), {
16
- transform: (res) => Promise.allSettled(res?.map((e) => setOptions(e, ctx)) || [])
17
- });
18
- const { $toast } = useNuxtApp();
19
- const errors = ref([]);
20
- const validate = async () => {
21
- if (!ajv.validate(schema.value.schema, form.value)) {
22
- errors.value = _cloneDeep(ajv.errors.map((e) => e.params.missingProperty || e.instancePath.replace(/^\//, "")));
23
- return $toast.error("\u0644\u0637\u0641\u0627 \u0645\u0648\u0627\u0631\u062F \u0631\u0627 \u0628\u0647 \u062F\u0631\u0633\u062A\u06CC \u062A\u06A9\u0645\u06CC\u0644 \u0646\u0645\u0627\u06CC\u06CC\u062F.");
24
- }
25
- };
26
- watch(() => form.value.location, async (v) => {
27
- form.value.address = await formattedAddress([v?.lng, v?.lat]);
28
- });
29
- defineExpose({ validate });
30
- </script>
@@ -1,17 +0,0 @@
1
- type __VLS_Props = {
2
- name: string;
3
- ctx?: Record<string, any>;
4
- };
5
- type __VLS_ModelProps = {
6
- modelValue?: any;
7
- };
8
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
9
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
10
- validate: () => Promise<any>;
11
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
- "update:modelValue": (value: any) => any;
13
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
15
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
- declare const _default: typeof __VLS_export;
17
- export default _default;