jky-component-lib 0.0.123 → 0.0.126
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/style.css +13 -2
- package/dist/es/amap/style2.css +5 -12
- package/dist/es/amap/style3.css +2 -6
- package/dist/es/components.js +3 -1
- package/dist/es/form/Form.vue.js +12 -2
- package/dist/es/form/FormItem.vue.js +71 -17
- package/dist/es/form/LinkedSelect.vue.d.ts +34 -0
- package/dist/es/form/LinkedSelect.vue.js +146 -0
- package/dist/es/form/LinkedSelect.vue3.js +5 -0
- package/dist/es/form/index.d.ts +3 -1
- package/dist/es/form/index.js +4 -0
- package/dist/es/index.js +2 -1
- package/dist/es/package.json.js +1 -1
- package/dist/es/page-table/ActionColumn.vue.d.ts +1 -1
- package/dist/es/page-table/ActionColumn.vue.js +13 -7
- package/dist/es/page-table/PageTable.vue.d.ts +7 -1
- package/dist/es/page-table/PageTable.vue.js +11 -4
- package/dist/es/page-table-v2/PageTableV2.vue.d.ts +3 -1
- package/dist/es/style.css +36 -0
- package/dist/lib/amap/style.css +13 -2
- package/dist/lib/amap/style2.css +5 -12
- package/dist/lib/amap/style3.css +2 -6
- package/dist/lib/components.js +2 -0
- package/dist/lib/form/Form.vue.js +12 -2
- package/dist/lib/form/FormItem.vue.js +68 -14
- package/dist/lib/form/LinkedSelect.vue.d.ts +34 -0
- package/dist/lib/form/LinkedSelect.vue.js +146 -0
- package/dist/lib/form/LinkedSelect.vue3.js +5 -0
- package/dist/lib/form/index.d.ts +3 -1
- package/dist/lib/form/index.js +4 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/package.json.js +1 -1
- package/dist/lib/page-table/ActionColumn.vue.d.ts +1 -1
- package/dist/lib/page-table/ActionColumn.vue.js +13 -7
- package/dist/lib/page-table/PageTable.vue.d.ts +7 -1
- package/dist/lib/page-table/PageTable.vue.js +11 -4
- package/dist/lib/page-table-v2/PageTableV2.vue.d.ts +3 -1
- package/dist/lib/style.css +36 -0
- package/package.json +1 -1
package/dist/es/amap/style.css
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/* AMap 高德地图组件样式 */
|
|
2
|
+
.jky-amap-container {
|
|
3
|
+
/* 地图容器样式 */
|
|
4
|
+
position: relative;
|
|
5
|
+
overflow: hidden;
|
|
1
6
|
|
|
2
|
-
/*
|
|
3
|
-
|
|
7
|
+
/* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
|
|
8
|
+
.amap-logo {
|
|
9
|
+
display: none !important;
|
|
10
|
+
}
|
|
11
|
+
.amap-copyright {
|
|
12
|
+
display: none !important;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/dist/es/amap/style2.css
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/* AMap 高德地图组件样式 */
|
|
2
|
-
.jky-amap-container {
|
|
3
|
-
/* 地图容器样式 */
|
|
4
|
-
position: relative;
|
|
5
|
-
overflow: hidden;
|
|
6
1
|
|
|
7
|
-
|
|
8
|
-
.amap-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
display: none !important;
|
|
13
|
-
}
|
|
2
|
+
/* JkyAMarker 组件样式 - 参考高德官方示例 */
|
|
3
|
+
.amap-icon img,
|
|
4
|
+
.amap-marker-content img {
|
|
5
|
+
width: 25px;
|
|
6
|
+
height: 34px;
|
|
14
7
|
}
|
package/dist/es/amap/style3.css
CHANGED
package/dist/es/components.js
CHANGED
|
@@ -4,7 +4,7 @@ import { JkyAMarker, JkyATrackPlayback } from "./amap/index.js";
|
|
|
4
4
|
import { JkyButton } from "./button/index.js";
|
|
5
5
|
import { JkyButtonNav } from "./button-nav/index.js";
|
|
6
6
|
import { JkyCodeMirrorEditor } from "./code-mirror-editor/index.js";
|
|
7
|
-
import { JkyForm } from "./form/index.js";
|
|
7
|
+
import { JkyForm, JkyLinkedSelect } from "./form/index.js";
|
|
8
8
|
import { JkyMenu } from "./menu/index.js";
|
|
9
9
|
import { JkyModal } from "./modal/index.js";
|
|
10
10
|
import { JkyPageHeader } from "./page-header/index.js";
|
|
@@ -22,6 +22,7 @@ const components = [
|
|
|
22
22
|
JkyPageHeader,
|
|
23
23
|
JkyMenu,
|
|
24
24
|
JkyForm,
|
|
25
|
+
JkyLinkedSelect,
|
|
25
26
|
JkyCodeMirrorEditor,
|
|
26
27
|
JkyAddInput,
|
|
27
28
|
JkyRichEditor,
|
|
@@ -42,6 +43,7 @@ export {
|
|
|
42
43
|
JkyButtonNav,
|
|
43
44
|
JkyCodeMirrorEditor,
|
|
44
45
|
JkyForm,
|
|
46
|
+
JkyLinkedSelect,
|
|
45
47
|
JkyMenu,
|
|
46
48
|
JkyModal,
|
|
47
49
|
JkyPageHeader,
|
package/dist/es/form/Form.vue.js
CHANGED
|
@@ -57,6 +57,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
57
57
|
footerClass: { default: "" },
|
|
58
58
|
submitText: { default: "提交" },
|
|
59
59
|
cancelText: { default: "取消" },
|
|
60
|
+
submitIcon: {},
|
|
61
|
+
cancelIcon: {},
|
|
60
62
|
submitDisabled: { type: Boolean, default: false },
|
|
61
63
|
cancelDisabled: { type: Boolean, default: false },
|
|
62
64
|
showCount: { default: 999 },
|
|
@@ -218,7 +220,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
218
220
|
onClick: handleCancel
|
|
219
221
|
}, {
|
|
220
222
|
default: withCtx(() => [
|
|
221
|
-
|
|
223
|
+
props.cancelIcon ? (openBlock(), createElementBlock("span", {
|
|
224
|
+
key: 0,
|
|
225
|
+
class: normalizeClass([props.cancelIcon, "mr-2"])
|
|
226
|
+
}, null, 2)) : createCommentVNode("", true),
|
|
227
|
+
createTextVNode(" " + toDisplayString(__props.cancelText), 1)
|
|
222
228
|
]),
|
|
223
229
|
_: 1
|
|
224
230
|
}, 8, ["disabled"]),
|
|
@@ -229,7 +235,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
229
235
|
onClick: handleSubmit
|
|
230
236
|
}, {
|
|
231
237
|
default: withCtx(() => [
|
|
232
|
-
|
|
238
|
+
props.submitIcon ? (openBlock(), createElementBlock("span", {
|
|
239
|
+
key: 0,
|
|
240
|
+
class: normalizeClass([props.submitIcon, "mr-2"])
|
|
241
|
+
}, null, 2)) : createCommentVNode("", true),
|
|
242
|
+
createTextVNode(" " + toDisplayString(__props.submitText), 1)
|
|
233
243
|
]),
|
|
234
244
|
_: 1
|
|
235
245
|
}, 8, ["disabled"])
|
|
@@ -49,13 +49,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
49
49
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
import { defineComponent, ref,
|
|
52
|
+
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, resolveDynamicComponent, Fragment, createTextVNode, toDisplayString, createCommentVNode, createSlots, h } from "vue";
|
|
53
53
|
import { Plus, CircleCloseFilled, CircleCheckFilled, WarningFilled, QuestionFilled } from "@element-plus/icons-vue";
|
|
54
54
|
import { ElFormItem, ElDivider, ElInput, ElUpload, ElButton, ElIcon, ElInputNumber, ElRate, ElTransfer, ElSelectV2, ElMention, ElInputTag, ElColorPickerPanel, ElColorPicker, ElTreeSelect, ElCascader, ElSlider, ElSwitch, ElCheckboxGroup, ElCheckbox, ElRadioGroup, ElRadioButton, ElRadio, ElTimeSelect, ElTimePicker, ElDatePicker, ElAutocomplete, ElSelect, ElTooltip } from "element-plus";
|
|
55
55
|
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
|
-
import _sfc_main$1 from "./
|
|
58
|
+
import _sfc_main$1 from "./LinkedSelect.vue.js";
|
|
59
|
+
/* empty css */
|
|
60
|
+
import _sfc_main$2 from "./SelectTable.vue.js";
|
|
59
61
|
/* empty css */
|
|
60
62
|
const _hoisted_1 = {
|
|
61
63
|
key: 0,
|
|
@@ -104,6 +106,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
104
106
|
const props = __props;
|
|
105
107
|
const loading = ref(false);
|
|
106
108
|
const componentProps = ref({});
|
|
109
|
+
const rules = ref(null);
|
|
107
110
|
function loadComponentProps() {
|
|
108
111
|
return __async(this, null, function* () {
|
|
109
112
|
const configProps = props.config.componentProps;
|
|
@@ -131,20 +134,49 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
131
134
|
componentProps.value = configProps;
|
|
132
135
|
});
|
|
133
136
|
}
|
|
134
|
-
|
|
135
|
-
()
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
function loadRules() {
|
|
138
|
+
return __async(this, null, function* () {
|
|
139
|
+
const configRules = props.config.rules;
|
|
140
|
+
if (!configRules) {
|
|
141
|
+
rules.value = null;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (typeof configRules === "function") {
|
|
145
|
+
loading.value = true;
|
|
146
|
+
try {
|
|
147
|
+
const result = yield configRules({
|
|
148
|
+
model: props.model,
|
|
149
|
+
field: props.field,
|
|
150
|
+
$form: props.model
|
|
151
|
+
});
|
|
152
|
+
rules.value = result || null;
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.error("Failed to load rules:", error);
|
|
155
|
+
rules.value = null;
|
|
156
|
+
} finally {
|
|
157
|
+
loading.value = false;
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
rules.value = configRules;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
141
164
|
loadComponentProps();
|
|
165
|
+
loadRules();
|
|
142
166
|
const modelValue = computed({
|
|
143
167
|
get: () => props.model[props.field],
|
|
144
168
|
set: (val) => {
|
|
145
169
|
props.model[props.field] = val;
|
|
146
170
|
}
|
|
147
171
|
});
|
|
172
|
+
watch(
|
|
173
|
+
() => props.model,
|
|
174
|
+
() => {
|
|
175
|
+
loadComponentProps();
|
|
176
|
+
loadRules();
|
|
177
|
+
},
|
|
178
|
+
{ deep: true }
|
|
179
|
+
);
|
|
148
180
|
const isHidden = computed(() => {
|
|
149
181
|
if (typeof props.config.hidden === "function") {
|
|
150
182
|
return props.config.hidden({
|
|
@@ -264,11 +296,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
264
296
|
return h(ElAutocomplete, autocompleteProps, _componentSlotsObj);
|
|
265
297
|
}
|
|
266
298
|
case "datepicker":
|
|
267
|
-
return h(ElDatePicker, __spreadValues(__spreadValues({
|
|
299
|
+
return h(ElDatePicker, __spreadValues(__spreadValues({
|
|
300
|
+
startPlaceholder: "开始日期",
|
|
301
|
+
endPlaceholder: "结束日期"
|
|
302
|
+
}, commonProps), componentProps.value), _componentSlotsObj);
|
|
268
303
|
case "datetime-picker":
|
|
269
|
-
return h(ElDatePicker, __spreadValues(__spreadValues({
|
|
304
|
+
return h(ElDatePicker, __spreadValues(__spreadValues({
|
|
305
|
+
startPlaceholder: "开始日期",
|
|
306
|
+
endPlaceholder: "结束日期"
|
|
307
|
+
}, commonProps), componentProps.value), _componentSlotsObj);
|
|
270
308
|
case "time-picker":
|
|
271
|
-
return h(ElTimePicker, __spreadValues(__spreadValues({
|
|
309
|
+
return h(ElTimePicker, __spreadValues(__spreadValues({
|
|
310
|
+
startPlaceholder: "开始时间",
|
|
311
|
+
endPlaceholder: "结束时间"
|
|
312
|
+
}, commonProps), componentProps.value), _componentSlotsObj);
|
|
272
313
|
case "time-select":
|
|
273
314
|
return h(ElTimeSelect, __spreadValues(__spreadValues({}, commonProps), componentProps.value), _componentSlotsObj);
|
|
274
315
|
case "radio-group": {
|
|
@@ -381,7 +422,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
381
422
|
}
|
|
382
423
|
// 表格选择器
|
|
383
424
|
case "select-table":
|
|
384
|
-
return h(_sfc_main$
|
|
425
|
+
return h(_sfc_main$2, __spreadProps(__spreadValues(__spreadValues({}, commonProps), componentProps.value), {
|
|
385
426
|
labelWidth: formItemProps.value.labelWidth
|
|
386
427
|
}), _componentSlotsObj);
|
|
387
428
|
case "rate":
|
|
@@ -451,6 +492,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
451
492
|
const addInputProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
|
|
452
493
|
return h(JkyAddInput, addInputProps, _componentSlotsObj);
|
|
453
494
|
}
|
|
495
|
+
// 联动下拉框
|
|
496
|
+
case "linked-select":
|
|
497
|
+
return h(_sfc_main$1, {
|
|
498
|
+
"config": props.config.config,
|
|
499
|
+
"modelValue": modelValue.value,
|
|
500
|
+
"disabled": props.disabled,
|
|
501
|
+
"componentProps": componentProps.value,
|
|
502
|
+
"onUpdate:modelValue": (val) => {
|
|
503
|
+
props.model[props.field] = val;
|
|
504
|
+
}
|
|
505
|
+
}, _componentSlotsObj);
|
|
454
506
|
case "custom":
|
|
455
507
|
return (_b = (_a = props.config).render) == null ? void 0 : _b.call(_a, commonProps);
|
|
456
508
|
default:
|
|
@@ -508,7 +560,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
508
560
|
return (_ctx, _cache) => {
|
|
509
561
|
return isHidden.value ? (openBlock(), createElementBlock("div", _hoisted_1)) : __props.config.title && !__props.config.label ? (openBlock(), createBlock(unref(ElFormItem), mergeProps({
|
|
510
562
|
key: 1,
|
|
511
|
-
prop: __props.field
|
|
563
|
+
prop: __props.field,
|
|
564
|
+
rules: rules.value
|
|
512
565
|
}, __spreadValues(__spreadValues({}, formItemProps.value), _ctx.$attrs), {
|
|
513
566
|
class: ["jky-form-item jky-form-item--no-label", [__props.config.useDefaultBorderClass ? "border-l-4 border-solid border-l-(--el-color-primary) bg-(--el-color-primary)/50 pl-1.5" : "", __props.config.class]],
|
|
514
567
|
style: [__props.config.customStyle]
|
|
@@ -524,10 +577,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
524
577
|
__props.config.help && !__props.config.help.tooltip ? (openBlock(), createBlock(resolveDynamicComponent(renderHelpText()), { key: 0 })) : createCommentVNode("", true)
|
|
525
578
|
]),
|
|
526
579
|
_: 1
|
|
527
|
-
}, 16, ["prop", "class", "style"])) : (openBlock(), createBlock(unref(ElFormItem), mergeProps({
|
|
580
|
+
}, 16, ["prop", "rules", "class", "style"])) : (openBlock(), createBlock(unref(ElFormItem), mergeProps({
|
|
528
581
|
key: 2,
|
|
529
582
|
label: __props.config.label,
|
|
530
|
-
prop: __props.field
|
|
583
|
+
prop: __props.field,
|
|
584
|
+
rules: rules.value
|
|
531
585
|
}, __spreadValues(__spreadValues({}, formItemProps.value), _ctx.$attrs), {
|
|
532
586
|
class: ["jky-form-item", [__props.config.class]]
|
|
533
587
|
}), createSlots({
|
|
@@ -551,7 +605,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
551
605
|
]),
|
|
552
606
|
key: "0"
|
|
553
607
|
} : void 0
|
|
554
|
-
]), 1040, ["label", "prop", "class"]));
|
|
608
|
+
]), 1040, ["label", "prop", "rules", "class"]));
|
|
555
609
|
};
|
|
556
610
|
}
|
|
557
611
|
}));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LinkedSelectConfig } from './types';
|
|
2
|
+
interface Props {
|
|
3
|
+
config?: LinkedSelectConfig;
|
|
4
|
+
modelValue?: any[];
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
componentProps?: Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
declare function __VLS_template(): {
|
|
9
|
+
attrs: Partial<{}>;
|
|
10
|
+
slots: {
|
|
11
|
+
prefix?(_: {}): any;
|
|
12
|
+
suffix?(_: {}): any;
|
|
13
|
+
};
|
|
14
|
+
refs: {};
|
|
15
|
+
rootEl: HTMLDivElement;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
|
+
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
19
|
+
"update:modelValue": (value: any[]) => any;
|
|
20
|
+
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
21
|
+
"onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
modelValue: any[];
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
config: LinkedSelectConfig;
|
|
26
|
+
componentProps: Record<string, any>;
|
|
27
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
28
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __async = (__this, __arguments, generator) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
var fulfilled = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var rejected = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.throw(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, renderSlot, Fragment, renderList, createBlock, unref, mergeProps, withCtx } from "vue";
|
|
41
|
+
import { ElSelect } from "element-plus";
|
|
42
|
+
const _hoisted_1 = { class: "flex gap-2" };
|
|
43
|
+
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
44
|
+
name: "JkyLinkedSelect"
|
|
45
|
+
}), {
|
|
46
|
+
__name: "LinkedSelect",
|
|
47
|
+
props: {
|
|
48
|
+
config: { default: void 0 },
|
|
49
|
+
modelValue: { default: () => [] },
|
|
50
|
+
disabled: { type: Boolean, default: false },
|
|
51
|
+
componentProps: { default: void 0 }
|
|
52
|
+
},
|
|
53
|
+
emits: ["update:modelValue"],
|
|
54
|
+
setup(__props, { emit: __emit }) {
|
|
55
|
+
const props = __props;
|
|
56
|
+
const emit = __emit;
|
|
57
|
+
const linkedSelectOptions = ref([]);
|
|
58
|
+
const linkedSelectLoading = ref([]);
|
|
59
|
+
function loadLinkedSelectOptions() {
|
|
60
|
+
return __async(this, null, function* () {
|
|
61
|
+
if (!props.config) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const level = props.config.level || 1;
|
|
65
|
+
linkedSelectLoading.value = Array.from({ length: level }, () => false);
|
|
66
|
+
if (props.config.getAllOptions) {
|
|
67
|
+
try {
|
|
68
|
+
const allOptions = yield props.config.getAllOptions(props.modelValue);
|
|
69
|
+
linkedSelectOptions.value = allOptions;
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error("Failed to load linked select options:", error);
|
|
72
|
+
linkedSelectOptions.value = Array.from({ length: level }, () => []);
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (props.config.getOptions) {
|
|
77
|
+
try {
|
|
78
|
+
const options = [];
|
|
79
|
+
for (let i = 0; i < level; i++) {
|
|
80
|
+
linkedSelectLoading.value[i] = true;
|
|
81
|
+
const levelOptions = yield props.config.getOptions(i + 1, props.modelValue || []);
|
|
82
|
+
options.push(levelOptions);
|
|
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 }, () => []);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
loadLinkedSelectOptions();
|
|
95
|
+
});
|
|
96
|
+
watch(
|
|
97
|
+
() => props.modelValue,
|
|
98
|
+
() => {
|
|
99
|
+
loadLinkedSelectOptions();
|
|
100
|
+
},
|
|
101
|
+
{ deep: true }
|
|
102
|
+
);
|
|
103
|
+
function handleValueChange(index, val) {
|
|
104
|
+
const newValue = Array.isArray(props.modelValue) ? [...props.modelValue] : [];
|
|
105
|
+
newValue[index] = val;
|
|
106
|
+
emit("update:modelValue", newValue);
|
|
107
|
+
}
|
|
108
|
+
return (_ctx, _cache) => {
|
|
109
|
+
var _a;
|
|
110
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
111
|
+
renderSlot(_ctx.$slots, "prefix"),
|
|
112
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(Array.from({ length: ((_a = __props.config) == null ? void 0 : _a.level) || 1 }), (_, index) => {
|
|
113
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
114
|
+
return openBlock(), createBlock(unref(ElSelect), mergeProps({
|
|
115
|
+
key: index,
|
|
116
|
+
"model-value": Array.isArray(__props.modelValue) ? __props.modelValue[index] : void 0,
|
|
117
|
+
placeholder: ((_b = (_a2 = __props.config) == null ? void 0 : _a2.placeholders) == null ? void 0 : _b[index]) || "请选择",
|
|
118
|
+
disabled: __props.disabled,
|
|
119
|
+
filterable: (_d = (_c = __props.config) == null ? void 0 : _c.filterable) != null ? _d : false,
|
|
120
|
+
clearable: (_f = (_e = __props.config) == null ? void 0 : _e.clearable) != null ? _f : true,
|
|
121
|
+
loading: linkedSelectLoading.value[index],
|
|
122
|
+
class: "flex-1 min-w-30"
|
|
123
|
+
}, { ref_for: true }, __props.componentProps, {
|
|
124
|
+
"onUpdate:modelValue": ($event) => handleValueChange(index, $event)
|
|
125
|
+
}), {
|
|
126
|
+
default: withCtx(() => [
|
|
127
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(linkedSelectOptions.value[index] || [], (option) => {
|
|
128
|
+
return openBlock(), createBlock(unref(ElSelect).Option, {
|
|
129
|
+
key: option.value,
|
|
130
|
+
value: option.value,
|
|
131
|
+
label: option.label,
|
|
132
|
+
disabled: option.disabled
|
|
133
|
+
}, null, 8, ["value", "label", "disabled"]);
|
|
134
|
+
}), 128))
|
|
135
|
+
]),
|
|
136
|
+
_: 2
|
|
137
|
+
}, 1040, ["model-value", "placeholder", "disabled", "filterable", "clearable", "loading", "onUpdate:modelValue"]);
|
|
138
|
+
}), 128)),
|
|
139
|
+
renderSlot(_ctx.$slots, "suffix")
|
|
140
|
+
]);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
export {
|
|
145
|
+
_sfc_main as default
|
|
146
|
+
};
|
package/dist/es/form/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { InstallWithSFC } from '../utils';
|
|
2
2
|
import { default as Form } from './Form.vue';
|
|
3
|
-
|
|
3
|
+
import { default as LinkedSelect } from './LinkedSelect.vue';
|
|
4
|
+
export type { ComponentPropsMap, ComponentPropsType, DynamicComponentProps, FormComponentType, FormItemChildConfig, FormItemConfig, FormItemOption, FormItemProps, FormItemPropsContext, FormProps, FormValidateResult, GridConfig, HelpConfig, HelpType, LinkedSelectConfig, ResponsiveBreakpoint, ResponsiveConfig, SelectTableComponentProps, SelectTableProps, StaticComponentProps, } from './types';
|
|
4
5
|
export declare const JkyForm: InstallWithSFC<typeof Form>;
|
|
6
|
+
export declare const JkyLinkedSelect: InstallWithSFC<typeof LinkedSelect>;
|
|
5
7
|
export default JkyForm;
|
package/dist/es/form/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import _sfc_main from "./Form.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
|
+
import _sfc_main$1 from "./LinkedSelect.vue.js";
|
|
4
|
+
/* empty css */
|
|
3
5
|
import { installWithSFC } from "../utils/with-install.js";
|
|
4
6
|
const JkyForm = installWithSFC(_sfc_main);
|
|
7
|
+
const JkyLinkedSelect = installWithSFC(_sfc_main$1);
|
|
5
8
|
export {
|
|
6
9
|
JkyForm,
|
|
10
|
+
JkyLinkedSelect,
|
|
7
11
|
JkyForm as default
|
|
8
12
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { JkyAddInput } from "./add-input/index.js";
|
|
|
12
12
|
import { JkyButton } from "./button/index.js";
|
|
13
13
|
import { JkyButtonNav } from "./button-nav/index.js";
|
|
14
14
|
import { JkyCodeMirrorEditor } from "./code-mirror-editor/index.js";
|
|
15
|
-
import { JkyForm } from "./form/index.js";
|
|
15
|
+
import { JkyForm, JkyLinkedSelect } from "./form/index.js";
|
|
16
16
|
import { JkyMenu } from "./menu/index.js";
|
|
17
17
|
import { JkyModal } from "./modal/index.js";
|
|
18
18
|
import { JkyPageHeader } from "./page-header/index.js";
|
|
@@ -39,6 +39,7 @@ export {
|
|
|
39
39
|
JkyCodeMirrorEditor,
|
|
40
40
|
JkyComponentLibResolver,
|
|
41
41
|
JkyForm,
|
|
42
|
+
JkyLinkedSelect,
|
|
42
43
|
JkyMenu,
|
|
43
44
|
JkyModal,
|
|
44
45
|
JkyPageHeader,
|
package/dist/es/package.json.js
CHANGED
|
@@ -5,7 +5,7 @@ declare const _default: import('vue').DefineComponent<ActionColumnProps, {}, {},
|
|
|
5
5
|
onClick?: ((button: ActionColumnButtonConfig, row: any, index: number) => any) | undefined;
|
|
6
6
|
}>, {
|
|
7
7
|
index: number;
|
|
8
|
-
row: any;
|
|
9
8
|
config: ActionColumnConfig;
|
|
9
|
+
row: any;
|
|
10
10
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
11
11
|
export default _default;
|
|
@@ -19,7 +19,7 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { defineComponent, computed, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, normalizeClass, withCtx, createTextVNode, toDisplayString, createVNode, createElementVNode, createCommentVNode } from "vue";
|
|
21
21
|
import { ElButton, ElDropdown, ElDropdownMenu, ElDropdownItem } from "element-plus";
|
|
22
|
-
const _hoisted_1 = { class: "jky-action-column flex
|
|
22
|
+
const _hoisted_1 = { class: "jky-action-column flex items-center justify-center" };
|
|
23
23
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
24
24
|
name: "JkyActionColumn"
|
|
25
25
|
}), {
|
|
@@ -70,22 +70,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
70
70
|
}
|
|
71
71
|
emit("click", button, props.row, props.index);
|
|
72
72
|
}
|
|
73
|
+
function getButtonLabel(button) {
|
|
74
|
+
if (typeof button.label === "function") {
|
|
75
|
+
return button.label(props.row, props.index);
|
|
76
|
+
}
|
|
77
|
+
return button.label;
|
|
78
|
+
}
|
|
73
79
|
return (_ctx, _cache) => {
|
|
74
80
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
75
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(displayButtons.value, (button) => {
|
|
81
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(displayButtons.value, (button, i) => {
|
|
76
82
|
return openBlock(), createBlock(unref(ElButton), {
|
|
77
|
-
key:
|
|
83
|
+
key: i,
|
|
78
84
|
type: button.type || "primary",
|
|
79
85
|
size: button.size || "small",
|
|
80
86
|
disabled: button.disabled,
|
|
81
87
|
icon: button.icon,
|
|
82
88
|
plain: button.plain,
|
|
83
|
-
class: normalizeClass(button.class),
|
|
89
|
+
class: normalizeClass(["ml-0!", button.class]),
|
|
84
90
|
text: "",
|
|
85
91
|
onClick: ($event) => handleButtonClick(button)
|
|
86
92
|
}, {
|
|
87
93
|
default: withCtx(() => [
|
|
88
|
-
createTextVNode(toDisplayString(button
|
|
94
|
+
createTextVNode(toDisplayString(getButtonLabel(button)), 1)
|
|
89
95
|
]),
|
|
90
96
|
_: 2
|
|
91
97
|
}, 1032, ["type", "size", "disabled", "icon", "plain", "class", "onClick"]);
|
|
@@ -99,12 +105,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
99
105
|
default: withCtx(() => [
|
|
100
106
|
(openBlock(true), createElementBlock(Fragment, null, renderList(collapsedButtons.value, (button) => {
|
|
101
107
|
return openBlock(), createBlock(unref(ElDropdownItem), {
|
|
102
|
-
key: button.label,
|
|
108
|
+
key: typeof button.label === "function" ? button.label(__props.row, __props.index) : button.label,
|
|
103
109
|
disabled: button.disabled,
|
|
104
110
|
onClick: ($event) => handleButtonClick(button)
|
|
105
111
|
}, {
|
|
106
112
|
default: withCtx(() => [
|
|
107
|
-
createTextVNode(toDisplayString(button
|
|
113
|
+
createTextVNode(toDisplayString(getButtonLabel(button)), 1)
|
|
108
114
|
]),
|
|
109
115
|
_: 2
|
|
110
116
|
}, 1032, ["disabled", "onClick"]);
|
|
@@ -29,6 +29,8 @@ declare function __VLS_template(): {
|
|
|
29
29
|
readonly footerClass?: string | undefined;
|
|
30
30
|
readonly submitText?: string | undefined;
|
|
31
31
|
readonly cancelText?: string | undefined;
|
|
32
|
+
readonly submitIcon?: string | undefined;
|
|
33
|
+
readonly cancelIcon?: string | undefined;
|
|
32
34
|
readonly submitDisabled?: boolean | undefined;
|
|
33
35
|
readonly cancelDisabled?: boolean | undefined;
|
|
34
36
|
readonly showCount?: number | undefined;
|
|
@@ -2810,18 +2812,20 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
|
|
|
2810
2812
|
}>, {
|
|
2811
2813
|
title: string;
|
|
2812
2814
|
loading: boolean;
|
|
2815
|
+
emptyText: string;
|
|
2813
2816
|
toolbarButtonLimit: number;
|
|
2814
2817
|
withCard: boolean;
|
|
2815
2818
|
filterItems: import('./types').FilterItemConfig[];
|
|
2816
2819
|
showSearchButton: boolean;
|
|
2817
2820
|
searchText: string;
|
|
2818
2821
|
resetText: string;
|
|
2822
|
+
searchIcon: string;
|
|
2823
|
+
resetIcon: string;
|
|
2819
2824
|
selection: boolean;
|
|
2820
2825
|
selectionColumn: import('./types').TableColumnConfig;
|
|
2821
2826
|
selectedRows: any[];
|
|
2822
2827
|
border: boolean;
|
|
2823
2828
|
stripe: boolean;
|
|
2824
|
-
emptyText: string;
|
|
2825
2829
|
formProps: Partial<import('../form').FormProps>;
|
|
2826
2830
|
tableProps: Partial<import('element-plus').TableProps>;
|
|
2827
2831
|
paginationProps: Partial<import('element-plus').PaginationProps>;
|
|
@@ -2843,6 +2847,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
|
|
|
2843
2847
|
readonly footerClass?: string | undefined;
|
|
2844
2848
|
readonly submitText?: string | undefined;
|
|
2845
2849
|
readonly cancelText?: string | undefined;
|
|
2850
|
+
readonly submitIcon?: string | undefined;
|
|
2851
|
+
readonly cancelIcon?: string | undefined;
|
|
2846
2852
|
readonly submitDisabled?: boolean | undefined;
|
|
2847
2853
|
readonly cancelDisabled?: boolean | undefined;
|
|
2848
2854
|
readonly showCount?: number | undefined;
|
|
@@ -61,6 +61,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
61
61
|
showSearchButton: { type: Boolean, default: true },
|
|
62
62
|
searchText: { default: "查询" },
|
|
63
63
|
resetText: { default: "重置" },
|
|
64
|
+
searchIcon: { default: "icon-[ant-design--search-outlined]" },
|
|
65
|
+
resetIcon: { default: "icon-[ant-design--sync-outlined]" },
|
|
64
66
|
selection: { type: Boolean, default: false },
|
|
65
67
|
selectionColumn: { default: () => ({}) },
|
|
66
68
|
selectable: {},
|
|
@@ -388,14 +390,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
388
390
|
createVNode(unref(JkyForm), mergeProps({
|
|
389
391
|
ref_key: "formRef",
|
|
390
392
|
ref: formRef
|
|
391
|
-
}, __spreadValues({
|
|
393
|
+
}, __spreadValues({
|
|
394
|
+
inline: true,
|
|
395
|
+
submitText: props.searchText,
|
|
396
|
+
cancelText: props.resetText,
|
|
397
|
+
submitIcon: props.searchIcon,
|
|
398
|
+
cancelIcon: props.resetIcon
|
|
399
|
+
}, __props.formProps), {
|
|
392
400
|
modelValue: form.value,
|
|
393
401
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => form.value = $event),
|
|
394
402
|
"show-footer": true,
|
|
395
403
|
items: __props.filterItems,
|
|
396
404
|
disabled: isLoading.value,
|
|
397
|
-
"submit-text": "搜索",
|
|
398
|
-
"cancel-text": "重置",
|
|
399
405
|
onReset: handleReset,
|
|
400
406
|
onSubmit: handleSearch
|
|
401
407
|
}), null, 16, ["modelValue", "items", "disabled"])
|
|
@@ -505,7 +511,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
505
511
|
layout: ((_b2 = pagination.value) == null ? void 0 : _b2.layout) || "total, sizes, prev, pager, next, jumper",
|
|
506
512
|
"show-size-picker": (_d = (_c2 = pagination.value) == null ? void 0 : _c2.showSizePicker) != null ? _d : true,
|
|
507
513
|
"show-total": (_f = (_e = pagination.value) == null ? void 0 : _e.showTotal) != null ? _f : true,
|
|
508
|
-
"show-jumper": (_h = (_g = pagination.value) == null ? void 0 : _g.showJumper) != null ? _h : true
|
|
514
|
+
"show-jumper": (_h = (_g = pagination.value) == null ? void 0 : _g.showJumper) != null ? _h : true,
|
|
515
|
+
class: "justify-end"
|
|
509
516
|
}, __props.paginationProps, {
|
|
510
517
|
onSizeChange: handlePageSizeChange,
|
|
511
518
|
onCurrentChange: handlePageChange
|