jky-component-lib 0.0.126 → 0.0.127
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/es/amap/style2.css +2 -6
- package/dist/es/amap/style3.css +6 -2
- package/dist/es/form/FormItem.vue.js +0 -1
- package/dist/es/form/LinkedSelect.vue.d.ts +2 -0
- package/dist/es/form/LinkedSelect.vue.js +68 -53
- package/dist/es/form/{LinkedSelect.vue3.js → LinkedSelect.vue2.js} +0 -1
- package/dist/es/form/index.js +0 -1
- package/dist/es/package.json.js +1 -1
- package/dist/lib/amap/style2.css +2 -6
- package/dist/lib/amap/style3.css +6 -2
- package/dist/lib/form/FormItem.vue.js +0 -1
- package/dist/lib/form/LinkedSelect.vue.d.ts +2 -0
- package/dist/lib/form/LinkedSelect.vue.js +66 -51
- package/dist/lib/form/{LinkedSelect.vue3.js → LinkedSelect.vue2.js} +0 -1
- package/dist/lib/form/index.js +0 -1
- package/dist/lib/package.json.js +1 -1
- package/package.json +1 -1
package/dist/es/amap/style2.css
CHANGED
package/dist/es/amap/style3.css
CHANGED
|
@@ -56,7 +56,6 @@ import { JkyAddInput } from "../add-input/index.js";
|
|
|
56
56
|
import { JkyCodeMirrorEditor } from "../code-mirror-editor/index.js";
|
|
57
57
|
import { JkyRichEditor } from "../rich-editor/index.js";
|
|
58
58
|
import _sfc_main$1 from "./LinkedSelect.vue.js";
|
|
59
|
-
/* empty css */
|
|
60
59
|
import _sfc_main$2 from "./SelectTable.vue.js";
|
|
61
60
|
/* empty css */
|
|
62
61
|
const _hoisted_1 = {
|
|
@@ -17,8 +17,10 @@ declare function __VLS_template(): {
|
|
|
17
17
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
18
|
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
19
19
|
"update:modelValue": (value: any[]) => any;
|
|
20
|
+
change: (value: any[]) => any;
|
|
20
21
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
21
22
|
"onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
|
|
23
|
+
onChange?: ((value: any[]) => any) | undefined;
|
|
22
24
|
}>, {
|
|
23
25
|
modelValue: any[];
|
|
24
26
|
disabled: boolean;
|
|
@@ -37,8 +37,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
37
37
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
import { defineComponent, ref, onMounted,
|
|
41
|
-
import { ElSelect } from "element-plus";
|
|
40
|
+
import { defineComponent, ref, onMounted, openBlock, createElementBlock, renderSlot, Fragment, renderList, unref, createBlock, mergeProps, withCtx, watch } from "vue";
|
|
41
|
+
import { ElSelect, ElOption } from "element-plus";
|
|
42
42
|
const _hoisted_1 = { class: "flex gap-2" };
|
|
43
43
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
44
44
|
name: "JkyLinkedSelect"
|
|
@@ -50,82 +50,97 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
50
50
|
disabled: { type: Boolean, default: false },
|
|
51
51
|
componentProps: { default: void 0 }
|
|
52
52
|
},
|
|
53
|
-
emits: ["update:modelValue"],
|
|
53
|
+
emits: ["update:modelValue", "change"],
|
|
54
54
|
setup(__props, { emit: __emit }) {
|
|
55
|
+
var _a;
|
|
55
56
|
const props = __props;
|
|
56
57
|
const emit = __emit;
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
|
|
58
|
+
const level = ((_a = props.config) == null ? void 0 : _a.level) || 1;
|
|
59
|
+
const optionsList = ref(Array.from({ length: level }, () => []));
|
|
60
|
+
const loadingList = ref(Array.from({ length: level }, () => false));
|
|
61
|
+
const values = ref(
|
|
62
|
+
props.modelValue && props.modelValue.length > 0 ? props.modelValue.slice(0, level) : Array.from({ length: level }, () => void 0)
|
|
63
|
+
);
|
|
64
|
+
function loadOptions(levelIndex, value) {
|
|
60
65
|
return __async(this, null, function* () {
|
|
61
|
-
|
|
66
|
+
var _a2;
|
|
67
|
+
if (!((_a2 = props.config) == null ? void 0 : _a2.getOptions) || levelIndex >= level) {
|
|
62
68
|
return;
|
|
63
69
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
return;
|
|
70
|
+
loadingList.value[levelIndex] = true;
|
|
71
|
+
try {
|
|
72
|
+
const levelOptions = yield props.config.getOptions(levelIndex + 1, value);
|
|
73
|
+
optionsList.value[levelIndex] = levelOptions || [];
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error("Failed to load linked select options:", error);
|
|
76
|
+
optionsList.value[levelIndex] = [];
|
|
77
|
+
} finally {
|
|
78
|
+
loadingList.value[levelIndex] = false;
|
|
75
79
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
linkedSelectLoading.value[i] = false;
|
|
84
|
-
}
|
|
85
|
-
linkedSelectOptions.value = options;
|
|
86
|
-
} catch (error) {
|
|
87
|
-
console.error("Failed to load linked select options:", error);
|
|
88
|
-
linkedSelectOptions.value = Array.from({ length: level }, () => []);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function loadDisplayData() {
|
|
83
|
+
return __async(this, null, function* () {
|
|
84
|
+
for (let i = 0; i < level - 1; i++) {
|
|
85
|
+
if (values.value[i] !== void 0 && values.value[i] !== null) {
|
|
86
|
+
yield loadOptions(i + 1, values.value[i]);
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
89
|
});
|
|
92
90
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
function watchModelValue() {
|
|
92
|
+
watch(
|
|
93
|
+
() => props.modelValue,
|
|
94
|
+
(newVal) => __async(null, null, function* () {
|
|
95
|
+
if (newVal && newVal.length > 0) {
|
|
96
|
+
values.value = [...newVal];
|
|
97
|
+
yield loadDisplayData();
|
|
98
|
+
}
|
|
99
|
+
}),
|
|
100
|
+
{ deep: true }
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function handleSelectChange(index, value) {
|
|
104
|
+
for (let i = index + 1; i < level; i++) {
|
|
105
|
+
values.value[i] = void 0;
|
|
106
|
+
optionsList.value[i] = [];
|
|
107
|
+
}
|
|
108
|
+
const newValue = [...values.value];
|
|
106
109
|
emit("update:modelValue", newValue);
|
|
110
|
+
emit("change", newValue);
|
|
111
|
+
if (value !== void 0 && value !== null && index + 1 < level) {
|
|
112
|
+
loadOptions(index + 1, value);
|
|
113
|
+
}
|
|
107
114
|
}
|
|
115
|
+
onMounted(() => {
|
|
116
|
+
var _a2;
|
|
117
|
+
watchModelValue();
|
|
118
|
+
loadDisplayData();
|
|
119
|
+
if ((_a2 = props.config) == null ? void 0 : _a2.getOptions) {
|
|
120
|
+
loadOptions(0, void 0);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
108
123
|
return (_ctx, _cache) => {
|
|
109
|
-
var _a;
|
|
110
124
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
111
125
|
renderSlot(_ctx.$slots, "prefix"),
|
|
112
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(Array.from({ length: (
|
|
126
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(Array.from({ length: unref(level) }), (_, index) => {
|
|
113
127
|
var _a2, _b, _c, _d, _e, _f;
|
|
114
128
|
return openBlock(), createBlock(unref(ElSelect), mergeProps({
|
|
115
129
|
key: index,
|
|
116
|
-
|
|
130
|
+
modelValue: values.value[index],
|
|
131
|
+
"onUpdate:modelValue": ($event) => values.value[index] = $event,
|
|
117
132
|
placeholder: ((_b = (_a2 = __props.config) == null ? void 0 : _a2.placeholders) == null ? void 0 : _b[index]) || "请选择",
|
|
118
|
-
disabled: __props.disabled,
|
|
133
|
+
disabled: __props.disabled || index > 0 && values.value[index - 1] === void 0 && values.value[index - 1] !== null,
|
|
119
134
|
filterable: (_d = (_c = __props.config) == null ? void 0 : _c.filterable) != null ? _d : false,
|
|
120
135
|
clearable: (_f = (_e = __props.config) == null ? void 0 : _e.clearable) != null ? _f : true,
|
|
121
|
-
loading:
|
|
136
|
+
loading: loadingList.value[index],
|
|
122
137
|
class: "flex-1 min-w-30"
|
|
123
138
|
}, { ref_for: true }, __props.componentProps, {
|
|
124
|
-
|
|
139
|
+
onChange: ($event) => handleSelectChange(index, $event)
|
|
125
140
|
}), {
|
|
126
141
|
default: withCtx(() => [
|
|
127
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
128
|
-
return openBlock(), createBlock(unref(
|
|
142
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(optionsList.value[index] || [], (option) => {
|
|
143
|
+
return openBlock(), createBlock(unref(ElOption), {
|
|
129
144
|
key: option.value,
|
|
130
145
|
value: option.value,
|
|
131
146
|
label: option.label,
|
|
@@ -134,7 +149,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
134
149
|
}), 128))
|
|
135
150
|
]),
|
|
136
151
|
_: 2
|
|
137
|
-
}, 1040, ["
|
|
152
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "filterable", "clearable", "loading", "onChange"]);
|
|
138
153
|
}), 128)),
|
|
139
154
|
renderSlot(_ctx.$slots, "suffix")
|
|
140
155
|
]);
|
package/dist/es/form/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _sfc_main from "./Form.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _sfc_main$1 from "./LinkedSelect.vue.js";
|
|
4
|
-
/* empty css */
|
|
5
4
|
import { installWithSFC } from "../utils/with-install.js";
|
|
6
5
|
const JkyForm = installWithSFC(_sfc_main);
|
|
7
6
|
const JkyLinkedSelect = installWithSFC(_sfc_main$1);
|
package/dist/es/package.json.js
CHANGED
package/dist/lib/amap/style2.css
CHANGED
package/dist/lib/amap/style3.css
CHANGED
|
@@ -58,7 +58,6 @@ const index = require("../add-input/index.js");
|
|
|
58
58
|
const index$2 = require("../code-mirror-editor/index.js");
|
|
59
59
|
const index$1 = require("../rich-editor/index.js");
|
|
60
60
|
const LinkedSelect_vue_vue_type_script_setup_true_lang = require("./LinkedSelect.vue.js");
|
|
61
|
-
;/* empty css */
|
|
62
61
|
const SelectTable_vue_vue_type_script_setup_true_lang = require("./SelectTable.vue.js");
|
|
63
62
|
;/* empty css */
|
|
64
63
|
const _hoisted_1 = {
|
|
@@ -17,8 +17,10 @@ declare function __VLS_template(): {
|
|
|
17
17
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
18
|
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
19
19
|
"update:modelValue": (value: any[]) => any;
|
|
20
|
+
change: (value: any[]) => any;
|
|
20
21
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
21
22
|
"onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
|
|
23
|
+
onChange?: ((value: any[]) => any) | undefined;
|
|
22
24
|
}>, {
|
|
23
25
|
modelValue: any[];
|
|
24
26
|
disabled: boolean;
|
|
@@ -52,82 +52,97 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
|
|
|
52
52
|
disabled: { type: Boolean, default: false },
|
|
53
53
|
componentProps: { default: void 0 }
|
|
54
54
|
},
|
|
55
|
-
emits: ["update:modelValue"],
|
|
55
|
+
emits: ["update:modelValue", "change"],
|
|
56
56
|
setup(__props, { emit: __emit }) {
|
|
57
|
+
var _a;
|
|
57
58
|
const props = __props;
|
|
58
59
|
const emit = __emit;
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
60
|
+
const level = ((_a = props.config) == null ? void 0 : _a.level) || 1;
|
|
61
|
+
const optionsList = vue.ref(Array.from({ length: level }, () => []));
|
|
62
|
+
const loadingList = vue.ref(Array.from({ length: level }, () => false));
|
|
63
|
+
const values = vue.ref(
|
|
64
|
+
props.modelValue && props.modelValue.length > 0 ? props.modelValue.slice(0, level) : Array.from({ length: level }, () => void 0)
|
|
65
|
+
);
|
|
66
|
+
function loadOptions(levelIndex, value) {
|
|
62
67
|
return __async(this, null, function* () {
|
|
63
|
-
|
|
68
|
+
var _a2;
|
|
69
|
+
if (!((_a2 = props.config) == null ? void 0 : _a2.getOptions) || levelIndex >= level) {
|
|
64
70
|
return;
|
|
65
71
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
return;
|
|
72
|
+
loadingList.value[levelIndex] = true;
|
|
73
|
+
try {
|
|
74
|
+
const levelOptions = yield props.config.getOptions(levelIndex + 1, value);
|
|
75
|
+
optionsList.value[levelIndex] = levelOptions || [];
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error("Failed to load linked select options:", error);
|
|
78
|
+
optionsList.value[levelIndex] = [];
|
|
79
|
+
} finally {
|
|
80
|
+
loadingList.value[levelIndex] = false;
|
|
77
81
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
linkedSelectLoading.value[i] = false;
|
|
86
|
-
}
|
|
87
|
-
linkedSelectOptions.value = options;
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error("Failed to load linked select options:", error);
|
|
90
|
-
linkedSelectOptions.value = Array.from({ length: level }, () => []);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function loadDisplayData() {
|
|
85
|
+
return __async(this, null, function* () {
|
|
86
|
+
for (let i = 0; i < level - 1; i++) {
|
|
87
|
+
if (values.value[i] !== void 0 && values.value[i] !== null) {
|
|
88
|
+
yield loadOptions(i + 1, values.value[i]);
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
91
|
});
|
|
94
92
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
function watchModelValue() {
|
|
94
|
+
vue.watch(
|
|
95
|
+
() => props.modelValue,
|
|
96
|
+
(newVal) => __async(null, null, function* () {
|
|
97
|
+
if (newVal && newVal.length > 0) {
|
|
98
|
+
values.value = [...newVal];
|
|
99
|
+
yield loadDisplayData();
|
|
100
|
+
}
|
|
101
|
+
}),
|
|
102
|
+
{ deep: true }
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function handleSelectChange(index, value) {
|
|
106
|
+
for (let i = index + 1; i < level; i++) {
|
|
107
|
+
values.value[i] = void 0;
|
|
108
|
+
optionsList.value[i] = [];
|
|
109
|
+
}
|
|
110
|
+
const newValue = [...values.value];
|
|
108
111
|
emit("update:modelValue", newValue);
|
|
112
|
+
emit("change", newValue);
|
|
113
|
+
if (value !== void 0 && value !== null && index + 1 < level) {
|
|
114
|
+
loadOptions(index + 1, value);
|
|
115
|
+
}
|
|
109
116
|
}
|
|
117
|
+
vue.onMounted(() => {
|
|
118
|
+
var _a2;
|
|
119
|
+
watchModelValue();
|
|
120
|
+
loadDisplayData();
|
|
121
|
+
if ((_a2 = props.config) == null ? void 0 : _a2.getOptions) {
|
|
122
|
+
loadOptions(0, void 0);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
110
125
|
return (_ctx, _cache) => {
|
|
111
|
-
var _a;
|
|
112
126
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
113
127
|
vue.renderSlot(_ctx.$slots, "prefix"),
|
|
114
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(Array.from({ length: (
|
|
128
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(Array.from({ length: vue.unref(level) }), (_, index) => {
|
|
115
129
|
var _a2, _b, _c, _d, _e, _f;
|
|
116
130
|
return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElSelect), vue.mergeProps({
|
|
117
131
|
key: index,
|
|
118
|
-
|
|
132
|
+
modelValue: values.value[index],
|
|
133
|
+
"onUpdate:modelValue": ($event) => values.value[index] = $event,
|
|
119
134
|
placeholder: ((_b = (_a2 = __props.config) == null ? void 0 : _a2.placeholders) == null ? void 0 : _b[index]) || "请选择",
|
|
120
|
-
disabled: __props.disabled,
|
|
135
|
+
disabled: __props.disabled || index > 0 && values.value[index - 1] === void 0 && values.value[index - 1] !== null,
|
|
121
136
|
filterable: (_d = (_c = __props.config) == null ? void 0 : _c.filterable) != null ? _d : false,
|
|
122
137
|
clearable: (_f = (_e = __props.config) == null ? void 0 : _e.clearable) != null ? _f : true,
|
|
123
|
-
loading:
|
|
138
|
+
loading: loadingList.value[index],
|
|
124
139
|
class: "flex-1 min-w-30"
|
|
125
140
|
}, { ref_for: true }, __props.componentProps, {
|
|
126
|
-
|
|
141
|
+
onChange: ($event) => handleSelectChange(index, $event)
|
|
127
142
|
}), {
|
|
128
143
|
default: vue.withCtx(() => [
|
|
129
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
130
|
-
return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.
|
|
144
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(optionsList.value[index] || [], (option) => {
|
|
145
|
+
return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElOption), {
|
|
131
146
|
key: option.value,
|
|
132
147
|
value: option.value,
|
|
133
148
|
label: option.label,
|
|
@@ -136,7 +151,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
|
|
|
136
151
|
}), 128))
|
|
137
152
|
]),
|
|
138
153
|
_: 2
|
|
139
|
-
}, 1040, ["
|
|
154
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "filterable", "clearable", "loading", "onChange"]);
|
|
140
155
|
}), 128)),
|
|
141
156
|
vue.renderSlot(_ctx.$slots, "suffix")
|
|
142
157
|
]);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const LinkedSelect_vue_vue_type_script_setup_true_lang = require("./LinkedSelect.vue.js");
|
|
4
|
-
;/* empty css */
|
|
5
4
|
exports.default = LinkedSelect_vue_vue_type_script_setup_true_lang.default;
|
package/dist/lib/form/index.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const Form_vue_vue_type_script_setup_true_lang = require("./Form.vue.js");
|
|
4
4
|
;/* empty css */
|
|
5
5
|
const LinkedSelect_vue_vue_type_script_setup_true_lang = require("./LinkedSelect.vue.js");
|
|
6
|
-
;/* empty css */
|
|
7
6
|
const withInstall = require("../utils/with-install.js");
|
|
8
7
|
const JkyForm = withInstall.installWithSFC(Form_vue_vue_type_script_setup_true_lang.default);
|
|
9
8
|
const JkyLinkedSelect = withInstall.installWithSFC(LinkedSelect_vue_vue_type_script_setup_true_lang.default);
|
package/dist/lib/package.json.js
CHANGED