@hostlink/nuxt-light 1.26.13 → 1.27.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/dist/module.json +1 -1
- package/dist/runtime/components/l-btn.d.ts +6 -0
- package/dist/runtime/components/l-btn.js +38 -0
- package/dist/runtime/components/l-select.d.ts +13 -0
- package/dist/runtime/components/l-select.js +88 -0
- package/dist/runtime/formkit/Select.vue +2 -0
- package/dist/runtime/pages/User/add.vue +1 -0
- package/package.json +1 -1
- /package/dist/runtime/components/{l-btn.vue → l-btn.vue.bak} +0 -0
- /package/dist/runtime/components/{l-select.vue → l-select.vue.bak} +0 -0
package/dist/module.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
import { useQuasar, QBtn } from "quasar";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: "LBtn",
|
|
6
|
+
props: {
|
|
7
|
+
...QBtn.props,
|
|
8
|
+
permission: { type: String, default: "" },
|
|
9
|
+
confirmTitle: { type: String, default: "Confirm" },
|
|
10
|
+
confirmMessage: { type: String, default: undefined },
|
|
11
|
+
},
|
|
12
|
+
render() {
|
|
13
|
+
const $q = useQuasar();
|
|
14
|
+
|
|
15
|
+
const root = h(QBtn, {
|
|
16
|
+
...this.$props,
|
|
17
|
+
...this.$light.getButtonProps(this.$props),
|
|
18
|
+
onClick: () => {
|
|
19
|
+
const args = arguments;
|
|
20
|
+
if (this.$props.confirmMessage) {
|
|
21
|
+
$q.dialog({
|
|
22
|
+
color: this.$light.color,
|
|
23
|
+
title: this.$props.confirmTitle,
|
|
24
|
+
message: this.$props.confirmMessage,
|
|
25
|
+
ok: "Yes",
|
|
26
|
+
cancel: "No",
|
|
27
|
+
}).onOk(() => {
|
|
28
|
+
this.$props.onClick?.apply(null, args);
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
this.$props.onClick?.apply(null, args);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
}, this.$slots);
|
|
35
|
+
|
|
36
|
+
return this.$light.isGranted(this.permission) ? root : null;
|
|
37
|
+
},
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let name: string;
|
|
3
|
+
let props: any;
|
|
4
|
+
function data(): {
|
|
5
|
+
normalizedOptions: any[];
|
|
6
|
+
filteredOptions: any[];
|
|
7
|
+
};
|
|
8
|
+
namespace methods {
|
|
9
|
+
function filterOptions(inputValue: any, update: any, abort: any): void;
|
|
10
|
+
}
|
|
11
|
+
function render(): any;
|
|
12
|
+
}
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { h } from 'vue';
|
|
2
|
+
import { QSelect } from 'quasar';
|
|
3
|
+
|
|
4
|
+
const normalizeOptions = (options, i = { count: 1 }) => {
|
|
5
|
+
if (Array.isArray(options)) {
|
|
6
|
+
return options.map((option) => {
|
|
7
|
+
if (typeof option === 'string' || typeof option === 'number') {
|
|
8
|
+
return {
|
|
9
|
+
label: String(option),
|
|
10
|
+
value: String(option),
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (typeof option == 'object') {
|
|
14
|
+
if ('group' in option) {
|
|
15
|
+
option.options = normalizeOptions(option.options || [], i)
|
|
16
|
+
return option
|
|
17
|
+
} else if ('value' in option && typeof option.value !== 'string') {
|
|
18
|
+
Object.assign(option, {
|
|
19
|
+
value: option.value,
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return option
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
return Object.keys(options).map((value) => {
|
|
28
|
+
return {
|
|
29
|
+
label: options[value],
|
|
30
|
+
value,
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: 'LSelect',
|
|
37
|
+
props: {
|
|
38
|
+
...QSelect.props,
|
|
39
|
+
emitValue: { type: Boolean, default: true },
|
|
40
|
+
mapOptions: { type: Boolean, default: true },
|
|
41
|
+
hideBottomSpace: { type: Boolean, default: true },
|
|
42
|
+
required: { type: Boolean, default: false },
|
|
43
|
+
filled: { type: Boolean, default: undefined },
|
|
44
|
+
outlined: { type: Boolean, default: undefined },
|
|
45
|
+
standout: { type: Boolean, default: undefined },
|
|
46
|
+
rounded: { type: Boolean, default: undefined },
|
|
47
|
+
dense: { type: Boolean, default: undefined },
|
|
48
|
+
square: { type: Boolean, default: undefined },
|
|
49
|
+
stackLabel: { type: Boolean, default: undefined },
|
|
50
|
+
optionLabel: { type: [String, Function], default: 'label' },
|
|
51
|
+
optionValue: { type: String, default: 'value' },
|
|
52
|
+
inputDebounce: { type: [Number, String], default: 0 },
|
|
53
|
+
|
|
54
|
+
},
|
|
55
|
+
data() {
|
|
56
|
+
const normalizedOptions = normalizeOptions(this.options); // 將選項標準化
|
|
57
|
+
return {
|
|
58
|
+
normalizedOptions: normalizedOptions, // 用於存儲標準化的選項
|
|
59
|
+
filteredOptions: normalizedOptions // 用於存儲過濾後的選項
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
filterOptions(inputValue, update, abort) {
|
|
64
|
+
if (this.onFilter) {
|
|
65
|
+
this.onFilter(inputValue, update, abort);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
update(() => {
|
|
70
|
+
this.filteredOptions = this.normalizedOptions.filter(option => {
|
|
71
|
+
|
|
72
|
+
const label = typeof this.optionLabel === 'function' ? this.optionLabel(option) : option[this.optionLabel];
|
|
73
|
+
return label && label.toLowerCase().includes(inputValue.toLowerCase());
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
render() {
|
|
79
|
+
return h(QSelect, {
|
|
80
|
+
...this.$light.getInputProps(this.$props), // 使用主題樣式的輸入屬性
|
|
81
|
+
'onUpdate:modelValue': this.$emit.bind(this, 'update:modelValue'),
|
|
82
|
+
onFilter: this.$props.useInput ? this.filterOptions : undefined, // 僅在 filterable 為 true 時使用 filterOptions
|
|
83
|
+
options: this.$props.useInput ? this.filteredOptions : this.$props.options,
|
|
84
|
+
}, {
|
|
85
|
+
...this.$slots,
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -22,8 +22,10 @@ if (props.context.state.required) { //no clearable
|
|
|
22
22
|
clearable = true;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
|
|
25
26
|
</script>
|
|
26
27
|
<template>
|
|
28
|
+
|
|
27
29
|
<l-select v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage"
|
|
28
30
|
:clearable="clearable" :required="context.state.required" :disable="context.disabled">
|
|
29
31
|
<template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|