@mouseless/baked 1.8.7 → 1.9.0

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.
Files changed (51) hide show
  1. package/dist/module.d.mts +5 -1
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +5 -2
  4. package/dist/runtime/assets/components.css +2 -2
  5. package/dist/runtime/components/Check.d.vue.ts +13 -0
  6. package/dist/runtime/components/Check.vue +28 -0
  7. package/dist/runtime/components/Check.vue.d.ts +13 -0
  8. package/dist/runtime/components/Date.d.vue.ts +21 -0
  9. package/dist/runtime/components/Date.vue +41 -0
  10. package/dist/runtime/components/Date.vue.d.ts +21 -0
  11. package/dist/runtime/components/InputCheckbox.d.vue.ts +25 -0
  12. package/dist/runtime/components/InputCheckbox.vue +59 -0
  13. package/dist/runtime/components/InputCheckbox.vue.d.ts +25 -0
  14. package/dist/runtime/components/InputDate.d.vue.ts +25 -0
  15. package/dist/runtime/components/InputDate.vue +94 -0
  16. package/dist/runtime/components/InputDate.vue.d.ts +25 -0
  17. package/dist/runtime/components/InputMailAddress.d.vue.ts +25 -0
  18. package/dist/runtime/components/InputMailAddress.vue +49 -0
  19. package/dist/runtime/components/InputMailAddress.vue.d.ts +25 -0
  20. package/dist/runtime/components/InputMoney.d.vue.ts +25 -0
  21. package/dist/runtime/components/InputMoney.vue +53 -0
  22. package/dist/runtime/components/InputMoney.vue.d.ts +25 -0
  23. package/dist/runtime/components/InputRate.d.vue.ts +25 -0
  24. package/dist/runtime/components/InputRate.vue +86 -0
  25. package/dist/runtime/components/InputRate.vue.d.ts +25 -0
  26. package/dist/runtime/components/InputText.vue +1 -1
  27. package/dist/runtime/components/InputUrl.d.vue.ts +25 -0
  28. package/dist/runtime/components/InputUrl.vue +59 -0
  29. package/dist/runtime/components/InputUrl.vue.d.ts +25 -0
  30. package/dist/runtime/components/MissingComponent.vue +4 -4
  31. package/dist/runtime/components/MultiSelect.d.vue.ts +33 -0
  32. package/dist/runtime/components/MultiSelect.vue +98 -0
  33. package/dist/runtime/components/MultiSelect.vue.d.ts +33 -0
  34. package/dist/runtime/components/MultiSelectButton.d.vue.ts +33 -0
  35. package/dist/runtime/components/MultiSelectButton.vue +74 -0
  36. package/dist/runtime/components/MultiSelectButton.vue.d.ts +33 -0
  37. package/dist/runtime/components/NavLink.vue +13 -12
  38. package/dist/runtime/components/Select.vue +16 -39
  39. package/dist/runtime/components/SelectButton.vue +14 -37
  40. package/dist/runtime/components/TextLink.d.vue.ts +21 -0
  41. package/dist/runtime/components/TextLink.vue +43 -0
  42. package/dist/runtime/components/TextLink.vue.d.ts +21 -0
  43. package/dist/runtime/components/Textarea.d.vue.ts +25 -0
  44. package/dist/runtime/components/Textarea.vue +36 -0
  45. package/dist/runtime/components/Textarea.vue.d.ts +25 -0
  46. package/dist/runtime/composables/useInputValidator.d.ts +20 -0
  47. package/dist/runtime/composables/useInputValidator.js +111 -0
  48. package/dist/runtime/composables/useSelection.d.ts +13 -0
  49. package/dist/runtime/composables/useSelection.js +94 -0
  50. package/dist/types.d.mts +1 -1
  51. package/package.json +16 -16
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <AwaitLoading
3
+ :skeleton="{
4
+ height: label?.mode === 'ifta' ? '3.6rem' : '2.6rem',
5
+ class: 'min-w-60'
6
+ }"
7
+ >
8
+ <Validation>
9
+ <InputGroup class="w-auto">
10
+ <Labeler
11
+ :label
12
+ :path
13
+ >
14
+ <InputNumber
15
+ ref="number"
16
+ v-model="model"
17
+ v-bind="$attrs"
18
+ class="min-w-60"
19
+ :min="0"
20
+ @input="onInput"
21
+ />
22
+ </Labeler>
23
+ <InputGroupAddon
24
+ class="
25
+ bg-slate-200 text-slate-500
26
+ dark:bg-zinc-700 dark:text-zinc-300
27
+ "
28
+ >
29
+ <i :class="`pi ${icon}`" />
30
+ </InputGroupAddon>
31
+ </InputGroup>
32
+ </Validation>
33
+ </AwaitLoading>
34
+ </template>
35
+
36
+ <script setup>
37
+ import { InputNumber, InputGroup, InputGroupAddon } from "primevue";
38
+ import { useRuntimeConfig } from "#app";
39
+ import { useContext } from "#imports";
40
+ import { AwaitLoading, Labeler, Validation } from "#components";
41
+ const context = useContext();
42
+ const runtimeConfig = useRuntimeConfig();
43
+ const { schema } = defineProps({
44
+ schema: { type: null, required: true }
45
+ });
46
+ const model = defineModel({ type: null, required: true });
47
+ const { label, icon: schemaIcon } = schema;
48
+ const icon = schemaIcon ?? runtimeConfig.public.components?.InputMoney?.icon ?? "pi-dollar";
49
+ const path = context.injectPath();
50
+ function onInput({ value }) {
51
+ model.value = value;
52
+ }
53
+ </script>
@@ -0,0 +1,25 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ schema: {
5
+ type: null;
6
+ required: true;
7
+ };
8
+ modelValue: {
9
+ type: import("vue").PropType<any>;
10
+ required: true;
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ "update:modelValue": (value: any) => any;
14
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ schema: {
16
+ type: null;
17
+ required: true;
18
+ };
19
+ modelValue: {
20
+ type: import("vue").PropType<any>;
21
+ required: true;
22
+ };
23
+ }>> & Readonly<{
24
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,25 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ schema: {
5
+ type: null;
6
+ required: true;
7
+ };
8
+ modelValue: {
9
+ type: import("vue").PropType<any>;
10
+ required: true;
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ "update:modelValue": (value: any) => any;
14
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ schema: {
16
+ type: null;
17
+ required: true;
18
+ };
19
+ modelValue: {
20
+ type: import("vue").PropType<any>;
21
+ required: true;
22
+ };
23
+ }>> & Readonly<{
24
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <AwaitLoading
3
+ :skeleton="{
4
+ height: label?.mode === 'ifta' ? '3.6rem' : '2.6rem',
5
+ class: 'min-w-60'
6
+ }"
7
+ >
8
+ <Validation>
9
+ <Labeler
10
+ :label
11
+ :path
12
+ >
13
+ <InputNumber
14
+ ref="number"
15
+ v-model="inputModel"
16
+ v-bind="$attrs"
17
+ class="min-w-60"
18
+ prefix="%"
19
+ min="0"
20
+ :max="MAX_VALUE"
21
+ :min-fraction-digits="0"
22
+ :max-fraction-digits="2"
23
+ :disabled
24
+ @input="onInput"
25
+ @keydown="onKeydown"
26
+ />
27
+ </Labeler>
28
+ </Validation>
29
+ </AwaitLoading>
30
+ </template>
31
+
32
+ <script setup>
33
+ import { ref, watch } from "vue";
34
+ import { InputNumber } from "primevue";
35
+ import { useContext } from "#imports";
36
+ import { AwaitLoading, Labeler, Validation } from "#components";
37
+ const context = useContext();
38
+ const { schema } = defineProps({
39
+ schema: { type: null, required: true }
40
+ });
41
+ const model = defineModel({ type: null, required: true });
42
+ const inputModel = ref();
43
+ const { label, disabled, max } = schema;
44
+ const MAX_VALUE = max || Number.MAX_SAFE_INTEGER;
45
+ const path = context.injectPath();
46
+ watch(
47
+ () => model.value,
48
+ (newVal) => {
49
+ if (newVal != null) {
50
+ inputModel.value = newVal * 100;
51
+ }
52
+ },
53
+ { immediate: true }
54
+ );
55
+ function onInput(event) {
56
+ if (event.value > MAX_VALUE) {
57
+ inputModel.value = MAX_VALUE;
58
+ return;
59
+ }
60
+ model.value = event.value / 100;
61
+ }
62
+ function onKeydown(event) {
63
+ const ALLOWED_KEYS = [
64
+ "Backspace",
65
+ "Delete",
66
+ "Tab",
67
+ "Escape",
68
+ "Enter",
69
+ "ArrowLeft",
70
+ "ArrowRight",
71
+ "ArrowUp",
72
+ "ArrowDown"
73
+ ];
74
+ if (event.ctrlKey || event.metaKey || ALLOWED_KEYS.includes(event.key)) {
75
+ return;
76
+ }
77
+ const isDigit = /^[0-9]$/.test(event.key);
78
+ if (!isDigit) {
79
+ return;
80
+ }
81
+ const currentValue = inputModel.value ?? 0;
82
+ if (currentValue >= MAX_VALUE) {
83
+ event.preventDefault();
84
+ }
85
+ }
86
+ </script>
@@ -0,0 +1,25 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ schema: {
5
+ type: null;
6
+ required: true;
7
+ };
8
+ modelValue: {
9
+ type: import("vue").PropType<any>;
10
+ required: true;
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ "update:modelValue": (value: any) => any;
14
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ schema: {
16
+ type: null;
17
+ required: true;
18
+ };
19
+ modelValue: {
20
+ type: import("vue").PropType<any>;
21
+ required: true;
22
+ };
23
+ }>> & Readonly<{
24
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -35,7 +35,7 @@ const { label, targetProp } = schema;
35
35
  const path = context.injectPath();
36
36
  const input = ref("");
37
37
  watch(model, (newValue) => {
38
- input.value = newValue;
38
+ input.value = (newValue && targetProp ? newValue[targetProp] : newValue) ?? "";
39
39
  }, { immediate: true });
40
40
  function onUpdate(value) {
41
41
  input.value = value;
@@ -0,0 +1,25 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ schema: {
5
+ type: null;
6
+ required: true;
7
+ };
8
+ modelValue: {
9
+ type: import("vue").PropType<any>;
10
+ required: true;
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ "update:modelValue": (value: any) => any;
14
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ schema: {
16
+ type: null;
17
+ required: true;
18
+ };
19
+ modelValue: {
20
+ type: import("vue").PropType<any>;
21
+ required: true;
22
+ };
23
+ }>> & Readonly<{
24
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <AwaitLoading
3
+ :skeleton="{
4
+ height: label.mode === 'ifta' ? '3.6rem' : '2.6rem',
5
+ class: 'min-w-60'
6
+ }"
7
+ >
8
+ <Validation>
9
+ <Labeler
10
+ :label
11
+ :path
12
+ class="w-full"
13
+ >
14
+ <InputText
15
+ :id="path"
16
+ v-model="inputModel"
17
+ type="url"
18
+ v-bind="$attrs"
19
+ class="min-w-60"
20
+ placeholder="https://"
21
+ @input="onInput"
22
+ />
23
+ </Labeler>
24
+ </Validation>
25
+ </AwaitLoading>
26
+ </template>
27
+
28
+ <script setup>
29
+ import { ref, watch } from "vue";
30
+ import { InputText } from "primevue";
31
+ import { useContext, useInputValidator } from "#imports";
32
+ import { AwaitLoading, Labeler, Validation } from "#components";
33
+ const context = useContext();
34
+ const { url: validator } = useInputValidator();
35
+ const { schema } = defineProps({
36
+ schema: { type: null, required: true }
37
+ });
38
+ const model = defineModel({ type: null, required: true });
39
+ const { label } = schema;
40
+ const path = context.injectPath();
41
+ const inputModel = ref("");
42
+ watch(model, (newModel) => {
43
+ inputModel.value = validator.validate(newModel, { silent: true }) ? newModel : inputModel.value;
44
+ }, { immediate: true });
45
+ function onInput(event) {
46
+ const normalized = normalize(event.target.value);
47
+ model.value = validator.validate(normalized) ? normalized : null;
48
+ }
49
+ function normalize(value) {
50
+ if (!value) {
51
+ return value;
52
+ }
53
+ const trimmed = value.trim();
54
+ if (/^(?:https?|ftp):\/\//i.test(trimmed)) {
55
+ return trimmed;
56
+ }
57
+ return `https://${trimmed}`;
58
+ }
59
+ </script>
@@ -0,0 +1,25 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ schema: {
5
+ type: null;
6
+ required: true;
7
+ };
8
+ modelValue: {
9
+ type: import("vue").PropType<any>;
10
+ required: true;
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ "update:modelValue": (value: any) => any;
14
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ schema: {
16
+ type: null;
17
+ required: true;
18
+ };
19
+ modelValue: {
20
+ type: import("vue").PropType<any>;
21
+ required: true;
22
+ };
23
+ }>> & Readonly<{
24
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -111,28 +111,28 @@ const highlightedData = computed(() => {
111
111
  return highlightJson(JSON.stringify(data, null, 2));
112
112
  });
113
113
  function renderTypeSample([type]) {
114
- return String.raw`builder.Conventions.AddTypeComponent${component ? `<${component}>` : ""}(
114
+ return String.raw`conventions.AddTypeComponent${component ? `<${component}>` : ""}(
115
115
  when: c => c.Type.Is<${type}>(),
116
116
  where: cc => cc.Path.EndsWith(${path.map((p) => `"${p}"`).join(", ")}),
117
117
  component: () => ${component ? "..." : "B.Text()"}
118
118
  );`;
119
119
  }
120
120
  function renderPropertySample([type, property]) {
121
- return String.raw`builder.Conventions.AddPropertyComponent${component ? `<${component}>` : ""}(
121
+ return String.raw`conventions.AddPropertyComponent${component ? `<${component}>` : ""}(
122
122
  when: c => c.Type.Is<${type}>() && c.Property.Name == nameof(${type}.${property}),
123
123
  where: cc => cc.Path.EndsWith(${path.map((p) => `"${p}"`).join(", ")}),
124
124
  component: () => ${component ? "..." : "B.Text()"}
125
125
  );`;
126
126
  }
127
127
  function renderMethodSample([type, method]) {
128
- return String.raw`builder.Conventions.AddMethodComponent${component ? `<${component}>` : ""}(
128
+ return String.raw`conventions.AddMethodComponent${component ? `<${component}>` : ""}(
129
129
  when: c => c.Type.Is<${type}>() && c.Method.Name == nameof(${type}.${method}),
130
130
  where: cc => cc.Path.EndsWith(${path.map((p) => `"${p}"`).join(", ")}),
131
131
  component: () => ${component ? "..." : "B.DataTable()"}
132
132
  );`;
133
133
  }
134
134
  function renderParameterSample([type, method, parameter]) {
135
- return String.raw`builder.Conventions.AddParameterComponent${component ? `<${component}>` : ""}(
135
+ return String.raw`conventions.AddParameterComponent${component ? `<${component}>` : ""}(
136
136
  when: c => c.Type.Is<${type}>() && c.Method.Name == nameof(${type}.${method}) && c.Parameter.Name == "${parameter}",
137
137
  where: cc => cc.Path.EndsWith(${path.map((p) => `"${p}"`).join(", ")}),
138
138
  component: () => ${component ? "..." : "B.InputText()"}
@@ -0,0 +1,33 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ schema: {
5
+ type: null;
6
+ required: true;
7
+ };
8
+ data: {
9
+ type: null;
10
+ required: true;
11
+ };
12
+ modelValue: {
13
+ type: import("vue").PropType<any>;
14
+ required: true;
15
+ };
16
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ "update:modelValue": (value: any) => any;
18
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ schema: {
20
+ type: null;
21
+ required: true;
22
+ };
23
+ data: {
24
+ type: null;
25
+ required: true;
26
+ };
27
+ modelValue: {
28
+ type: import("vue").PropType<any>;
29
+ required: true;
30
+ };
31
+ }>> & Readonly<{
32
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
33
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <AwaitLoading
3
+ :skeleton="{
4
+ height: label?.mode === 'ifta' ? '3.6rem' : '2.6rem',
5
+ class: 'min-w-40'
6
+ }"
7
+ >
8
+ <Validation>
9
+ <Labeler
10
+ :label
11
+ :path
12
+ >
13
+ <MultiSelect
14
+ v-bind="$attrs"
15
+ v-model="selected"
16
+ :input-id="path"
17
+ :options="data"
18
+ :option-label="optionLabel"
19
+ :option-value="optionValue"
20
+ :placeholder
21
+ :show-clear
22
+ :filter
23
+ :auto-filter-focus="filter"
24
+ :filter-fields="[optionLabel]"
25
+ :show-toggle-all
26
+ reset-filter-on-hide
27
+ class="w-full"
28
+ :pt="{
29
+ hiddenInput: { placeholder: null }
30
+ }"
31
+ >
32
+ <template #value="{ value }">
33
+ <template v-if="value?.length">
34
+ <template v-if="value.length <= maxSelectedLabels">
35
+ {{ getValueLabel(value) }}
36
+ </template>
37
+ <span v-else>{{ lc("{number} items selected", { number: value.length }) }}</span>
38
+ </template>
39
+ </template>
40
+ <template #option="slotProps">
41
+ <span>
42
+ {{ getOptionLabel(slotProps) }}
43
+ </span>
44
+ </template>
45
+ </MultiSelect>
46
+ </Labeler>
47
+ </Validation>
48
+ </AwaitLoading>
49
+ </template>
50
+
51
+ <script setup>
52
+ import { MultiSelect } from "primevue";
53
+ import { useContext, useLocalization, useUiStates, useSelection } from "#imports";
54
+ import { AwaitLoading, Labeler, Validation } from "#components";
55
+ const context = useContext();
56
+ const { localize: l } = useLocalization();
57
+ const { localize: lc } = useLocalization({ group: "MultiSelect" });
58
+ const { value: { selectStates } } = useUiStates();
59
+ const { schema, data } = defineProps({
60
+ schema: { type: null, required: true },
61
+ data: { type: null, required: true }
62
+ });
63
+ const model = defineModel({ type: null, required: true });
64
+ const {
65
+ maxSelectedLabels = 3,
66
+ showToggleAll = false,
67
+ filter,
68
+ label,
69
+ localizeOptionLabels,
70
+ optionLabel,
71
+ optionValue,
72
+ showClear,
73
+ stateful,
74
+ targetProp
75
+ } = schema;
76
+ const path = context.injectPath();
77
+ const { selected } = useSelection({
78
+ data,
79
+ model,
80
+ path,
81
+ stateStore: selectStates,
82
+ stateful,
83
+ targetProp,
84
+ mode: "multi"
85
+ });
86
+ const placeholder = label?.text ? l(label.text) : null;
87
+ function getOptionLabel(slotProps) {
88
+ const result = slotProps.option[optionLabel] ?? slotProps.option;
89
+ return localizeOptionLabels ? l(result) : result;
90
+ }
91
+ function getValueLabel(value) {
92
+ return value.map(findLabel).map((label2) => localizeOptionLabels ? l(label2) : label2).join(", ");
93
+ }
94
+ function findLabel(value) {
95
+ const option = optionValue ? data?.find((o) => o[optionValue] === value) : data?.find((o) => o === value);
96
+ return optionLabel ? option?.[optionLabel] : option;
97
+ }
98
+ </script>
@@ -0,0 +1,33 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ schema: {
5
+ type: null;
6
+ required: true;
7
+ };
8
+ data: {
9
+ type: null;
10
+ required: true;
11
+ };
12
+ modelValue: {
13
+ type: import("vue").PropType<any>;
14
+ required: true;
15
+ };
16
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ "update:modelValue": (value: any) => any;
18
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ schema: {
20
+ type: null;
21
+ required: true;
22
+ };
23
+ data: {
24
+ type: null;
25
+ required: true;
26
+ };
27
+ modelValue: {
28
+ type: import("vue").PropType<any>;
29
+ required: true;
30
+ };
31
+ }>> & Readonly<{
32
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
33
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,33 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ schema: {
5
+ type: null;
6
+ required: true;
7
+ };
8
+ data: {
9
+ type: null;
10
+ required: true;
11
+ };
12
+ modelValue: {
13
+ type: import("vue").PropType<any>;
14
+ required: true;
15
+ };
16
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ "update:modelValue": (value: any) => any;
18
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ schema: {
20
+ type: null;
21
+ required: true;
22
+ };
23
+ data: {
24
+ type: null;
25
+ required: true;
26
+ };
27
+ modelValue: {
28
+ type: import("vue").PropType<any>;
29
+ required: true;
30
+ };
31
+ }>> & Readonly<{
32
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
33
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <AwaitLoading
3
+ :skeleton="{
4
+ height: label.mode === 'ifta' ? '3.6rem' : '2.6rem',
5
+ class: 'min-w-60'
6
+ }"
7
+ >
8
+ <Validation>
9
+ <Labeler
10
+ :label="{
11
+ ...label,
12
+ mode: label?.mode === 'ifta' ? label.mode : null,
13
+ text: label?.mode === 'ifta' ? label.text : null
14
+ }"
15
+ :path
16
+ :dt="{
17
+ colorScheme: {
18
+ light: {
19
+ top: '-1rem',
20
+ },
21
+ dark: {
22
+ top: '-1rem'
23
+ }
24
+ }
25
+ }"
26
+ >
27
+ <SelectButton
28
+ v-if="data"
29
+ v-model="selected"
30
+ :options="data"
31
+ multiple
32
+ :allow-empty
33
+ :data-key="optionValue"
34
+ :option-label
35
+ :option-value
36
+ :pt="{ pcToggleButton: { root: { class: 'text-[length:inherit]' } } }"
37
+ >
38
+ <template #option="slotProps">
39
+ <span>{{ getOptionLabel(slotProps) }}</span>
40
+ </template>
41
+ </SelectButton>
42
+ </Labeler>
43
+ </Validation>
44
+ </AwaitLoading>
45
+ </template>
46
+
47
+ <script setup>
48
+ import { SelectButton } from "primevue";
49
+ import { useContext, useLocalization, useUiStates, useSelection } from "#imports";
50
+ import { AwaitLoading, Labeler, Validation } from "#components";
51
+ const context = useContext();
52
+ const { localize: l } = useLocalization();
53
+ const { value: { selectButtonStates } } = useUiStates();
54
+ const { schema, data } = defineProps({
55
+ schema: { type: null, required: true },
56
+ data: { type: null, required: true }
57
+ });
58
+ const model = defineModel({ type: null, required: true });
59
+ const { allowEmpty = false, label, localizeOptionLabels, optionLabel, optionValue, stateful, targetProp } = schema;
60
+ const path = context.injectPath();
61
+ const { selected } = useSelection({
62
+ data,
63
+ model,
64
+ path,
65
+ stateStore: selectButtonStates,
66
+ stateful,
67
+ targetProp,
68
+ mode: "multi"
69
+ });
70
+ function getOptionLabel(slotProps) {
71
+ const result = slotProps.option[optionLabel] ?? slotProps.option;
72
+ return localizeOptionLabels ? l(result) : result;
73
+ }
74
+ </script>
@@ -0,0 +1,33 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ schema: {
5
+ type: null;
6
+ required: true;
7
+ };
8
+ data: {
9
+ type: null;
10
+ required: true;
11
+ };
12
+ modelValue: {
13
+ type: import("vue").PropType<any>;
14
+ required: true;
15
+ };
16
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ "update:modelValue": (value: any) => any;
18
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ schema: {
20
+ type: null;
21
+ required: true;
22
+ };
23
+ data: {
24
+ type: null;
25
+ required: true;
26
+ };
27
+ modelValue: {
28
+ type: import("vue").PropType<any>;
29
+ required: true;
30
+ };
31
+ }>> & Readonly<{
32
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
33
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;