@hostlink/nuxt-light 1.27.1 → 1.27.3
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-app-main.vue +11 -9
- package/dist/runtime/components/l-btn.d.ts +1 -0
- package/dist/runtime/components/l-btn.js +26 -20
- package/dist/runtime/components/l-checkbox.d.ts +12 -0
- package/dist/runtime/components/l-checkbox.js +23 -0
- package/package.json +1 -1
- package/dist/runtime/components/l-checkbox.vue +0 -9
- package/dist/runtime/components/l-select.vue.bak +0 -112
package/dist/module.json
CHANGED
|
@@ -324,7 +324,7 @@ const onLogout = async () => {
|
|
|
324
324
|
</q-tooltip>
|
|
325
325
|
<q-menu>
|
|
326
326
|
<q-list>
|
|
327
|
-
<q-item v-for="
|
|
327
|
+
<q-item v-for="language in languages" :key="language.value" v-close-popup clickable
|
|
328
328
|
@click="onChangeLocale(language.value)" :active="language.value == my.language">
|
|
329
329
|
<q-item-section>
|
|
330
330
|
<q-item-label>{{ language.name }}</q-item-label>
|
|
@@ -426,14 +426,16 @@ const onLogout = async () => {
|
|
|
426
426
|
<q-page-container :class="containerClass" :style="containerStyle"> <!-- Error message -->
|
|
427
427
|
<slot name="header"></slot>
|
|
428
428
|
<div class="q-gutter-sm q-pa-sm" v-if="system.devMode && $light.errors.length > 0">
|
|
429
|
-
<q-banner dense inline-actions class="bg-grey-4" v-for="
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
429
|
+
<q-banner dense inline-actions class="bg-grey-4" v-for="error in $light.errors" rounded>
|
|
430
|
+
<q-expansion-item expand-separator :label="error.message">
|
|
431
|
+
<q-card>
|
|
432
|
+
<q-card-section style="white-space: pre-wrap; overflow: auto;">
|
|
433
|
+
{{ error.stack }}
|
|
434
|
+
</q-card-section>
|
|
435
|
+
</q-card>
|
|
436
|
+
</q-expansion-item>
|
|
437
|
+
|
|
438
|
+
<template v-slot:action>
|
|
437
439
|
<q-btn flat icon="sym_o_close" round dense @click="$light.removeError(error)" />
|
|
438
440
|
</template>
|
|
439
441
|
</q-banner>
|
|
@@ -3,6 +3,7 @@ import { useQuasar, QBtn } from "quasar";
|
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
name: "LBtn",
|
|
6
|
+
inheritAttrs:false,
|
|
6
7
|
props: {
|
|
7
8
|
...QBtn.props,
|
|
8
9
|
permission: { type: String, default: "" },
|
|
@@ -12,27 +13,32 @@ export default {
|
|
|
12
13
|
render() {
|
|
13
14
|
const $q = useQuasar();
|
|
14
15
|
|
|
16
|
+
// 從 $attrs 中提取 onClick,並過濾掉它
|
|
17
|
+
const { onClick, ...filteredAttrs } = this.$attrs;
|
|
18
|
+
|
|
19
|
+
const handleClick = (...args) => {
|
|
20
|
+
if (this.$props.confirmMessage) {
|
|
21
|
+
$q.dialog({
|
|
22
|
+
color: this.$props.color || "primary",
|
|
23
|
+
title: this.$props.confirmTitle,
|
|
24
|
+
message: this.$props.confirmMessage,
|
|
25
|
+
ok: "Yes",
|
|
26
|
+
cancel: "No",
|
|
27
|
+
}).onOk(() => {
|
|
28
|
+
onClick?.(...args); // 執行傳入的 onClick
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
onClick?.(...args); // 直接執行傳入的 onClick
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
15
35
|
const root = h(QBtn, {
|
|
16
|
-
...this.$props,
|
|
17
|
-
...this.$light.getButtonProps(this.$props),
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
},
|
|
36
|
+
...this.$props, // 傳遞 props
|
|
37
|
+
...this.$light.getButtonProps(this.$props), // 傳遞按鈕屬性
|
|
38
|
+
...filteredAttrs, // 傳遞過濾後的 attrs
|
|
39
|
+
onClick: handleClick, // 明確綁定 handleClick
|
|
34
40
|
}, this.$slots);
|
|
35
41
|
|
|
36
|
-
return this.$light.isGranted(this.permission) ? root : null;
|
|
42
|
+
return this.$light.isGranted(this.$props.permission) ? root : null;
|
|
37
43
|
},
|
|
38
|
-
}
|
|
44
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let name: string;
|
|
3
|
+
let props: any;
|
|
4
|
+
let emits: any;
|
|
5
|
+
function setup(props: any, { slots, emit }: {
|
|
6
|
+
slots: any;
|
|
7
|
+
emit: any;
|
|
8
|
+
}): () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QCheckbox } from "quasar";
|
|
2
|
+
import { h } from "vue";
|
|
3
|
+
import { useLight } from "#imports";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
name: "LCheckbox",
|
|
9
|
+
props: QCheckbox.props,
|
|
10
|
+
emits: QCheckbox.emits,
|
|
11
|
+
setup(props, { slots, emit }) {
|
|
12
|
+
return () => {
|
|
13
|
+
const $light = useLight();
|
|
14
|
+
const $t = useI18n().t;
|
|
15
|
+
return h(QCheckbox, {
|
|
16
|
+
...props,
|
|
17
|
+
color: props.color || $light.color,
|
|
18
|
+
label: props.label ? $t(props.label) : null,
|
|
19
|
+
'onUpdate:modelValue': emit.bind(this, 'update:modelValue'),
|
|
20
|
+
}, slots);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { QCheckboxProps } from "quasar"
|
|
3
|
-
defineProps<QCheckboxProps>()
|
|
4
|
-
</script>
|
|
5
|
-
<template>
|
|
6
|
-
<q-checkbox v-bind="$props" :color="color ?? $light.color" :label="label ? $t(label) : undefined">
|
|
7
|
-
<slot></slot>
|
|
8
|
-
</q-checkbox>
|
|
9
|
-
</template>
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, ref } from "vue";
|
|
3
|
-
import { type QSelectProps } from "quasar";
|
|
4
|
-
|
|
5
|
-
const emits = defineEmits(["update:modelValue"]);
|
|
6
|
-
|
|
7
|
-
interface LSelectProps extends QSelectProps {
|
|
8
|
-
required?: boolean,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const props = withDefaults(defineProps<LSelectProps>(), {
|
|
12
|
-
rules: () => {
|
|
13
|
-
return []
|
|
14
|
-
},
|
|
15
|
-
options: () => {
|
|
16
|
-
return []
|
|
17
|
-
},
|
|
18
|
-
optionLabel: "label",
|
|
19
|
-
emitValue: true,
|
|
20
|
-
mapOptions: true,
|
|
21
|
-
filled: undefined,
|
|
22
|
-
outlined: undefined,
|
|
23
|
-
standout: undefined,
|
|
24
|
-
rounded: undefined,
|
|
25
|
-
dense: undefined,
|
|
26
|
-
square: undefined,
|
|
27
|
-
stackLabel: undefined,
|
|
28
|
-
hideBottomSpace:true
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (props.required) {
|
|
34
|
-
props.rules.push((val) => {
|
|
35
|
-
if (Number.isInteger(val)) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return !!val || 'Required.'
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function normalizeOptions(options: any, i = { count: 1 }) {
|
|
44
|
-
if (Array.isArray(options)) {
|
|
45
|
-
return options.map(
|
|
46
|
-
(option): any => {
|
|
47
|
-
if (typeof option === 'string' || typeof option === 'number') {
|
|
48
|
-
return {
|
|
49
|
-
label: String(option),
|
|
50
|
-
value: String(option),
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (typeof option == 'object') {
|
|
54
|
-
if ('group' in option) {
|
|
55
|
-
option.options = normalizeOptions(option.options || [], i)
|
|
56
|
-
return option as any
|
|
57
|
-
} else if ('value' in option && typeof option.value !== 'string') {
|
|
58
|
-
Object.assign(option, {
|
|
59
|
-
value: option.value,
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return option as any
|
|
64
|
-
}
|
|
65
|
-
) as any
|
|
66
|
-
}
|
|
67
|
-
return Object.keys(options).map((value: string) => {
|
|
68
|
-
return {
|
|
69
|
-
label: options[value],
|
|
70
|
-
value,
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const select_options = ref(props.options);
|
|
77
|
-
|
|
78
|
-
const filterFn = (val, update, abort) => {
|
|
79
|
-
|
|
80
|
-
const opts = normalizeOptions(props.options);
|
|
81
|
-
|
|
82
|
-
if (val === "") {
|
|
83
|
-
update(() => {
|
|
84
|
-
select_options.value = opts
|
|
85
|
-
});
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
update(() => {
|
|
90
|
-
const needle = val.toLowerCase();
|
|
91
|
-
|
|
92
|
-
select_options.value = opts.filter(v => v[props.optionLabel].toLowerCase().indexOf(needle) > -1);
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const clearable = computed(() => {
|
|
97
|
-
return !props.required;
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const localValue = computed({
|
|
101
|
-
get: () => props.modelValue,
|
|
102
|
-
set: (value) => {
|
|
103
|
-
emits('update:modelValue', value)
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</script>
|
|
109
|
-
<template>
|
|
110
|
-
<q-select v-bind="$light.getInputProps($props)" v-model="localValue" :options="select_options" @filter="filterFn"
|
|
111
|
-
:option-label="optionLabel" :rules="rules" :clearable="clearable" />
|
|
112
|
-
</template>
|