3h1-ui 3.0.0-next.73 → 3.0.0-next.74
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/es/index.js +684 -243
- package/es/style.css +98 -29
- package/lib/index.js +684 -243
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -8931,7 +8931,7 @@ const _hoisted_6$3 = {
|
|
|
8931
8931
|
key: 1,
|
|
8932
8932
|
class: "p-5"
|
|
8933
8933
|
};
|
|
8934
|
-
const _hoisted_7$
|
|
8934
|
+
const _hoisted_7$1 = {
|
|
8935
8935
|
key: 0,
|
|
8936
8936
|
class: "cursor-pointer px-2 py-1 flex items-center"
|
|
8937
8937
|
};
|
|
@@ -9075,7 +9075,7 @@ const _sfc_main$1t = /* @__PURE__ */ vue.defineComponent({
|
|
|
9075
9075
|
]))
|
|
9076
9076
|
]),
|
|
9077
9077
|
default: vue.withCtx(() => [
|
|
9078
|
-
isSvgMode && currentSelect.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_7$
|
|
9078
|
+
isSvgMode && currentSelect.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_7$1, [
|
|
9079
9079
|
vue.createVNode(SvgIcon, { name: currentSelect.value }, null, 8, ["name"])
|
|
9080
9080
|
])) : (vue.openBlock(), vue.createBlock(Icon2, {
|
|
9081
9081
|
key: 1,
|
|
@@ -18248,7 +18248,7 @@ const _hoisted_5$4 = {
|
|
|
18248
18248
|
class: "shy-ui-advanced-search-item-value-range"
|
|
18249
18249
|
};
|
|
18250
18250
|
const _hoisted_6$1 = /* @__PURE__ */ vue.createElementVNode("div", { style: { "flex": "0", "width": "40px", "margin-right": "8px" } }, " 至 ", -1);
|
|
18251
|
-
const _hoisted_7
|
|
18251
|
+
const _hoisted_7 = {
|
|
18252
18252
|
key: 1,
|
|
18253
18253
|
style: { "margin-left": "8px", "cursor": "pointer", "position": "relative" },
|
|
18254
18254
|
class: "shy-ui-advanced-minus-icon"
|
|
@@ -18555,7 +18555,7 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
|
|
|
18555
18555
|
]),
|
|
18556
18556
|
_: 2
|
|
18557
18557
|
}, 1024)) : vue.createCommentVNode("", true),
|
|
18558
|
-
(schemasCurrent == null ? void 0 : schemasCurrent.length) !== 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7
|
|
18558
|
+
(schemasCurrent == null ? void 0 : schemasCurrent.length) !== 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
|
|
18559
18559
|
vue.createElementVNode("div", {
|
|
18560
18560
|
style: { "position": "absolute", "width": "14px", "height": "14px", "left": "0", "right": "0", "top": "0", "bottom": "0" },
|
|
18561
18561
|
class: "shy-basic-minus-icon",
|
|
@@ -20729,7 +20729,7 @@ const Description = /* @__PURE__ */ vue.defineComponent({
|
|
|
20729
20729
|
element = slots[`${item.field}Value`] ? (_b = slots[`${item.field}Value`]) == null ? void 0 : _b.call(slots, {
|
|
20730
20730
|
model: data,
|
|
20731
20731
|
field: data[`${item.field}`]
|
|
20732
|
-
}) : utils.isNumber(+data[`${item.field}`]) && !isNaN(+data[`${item.field}`]) ? (+data[`${item.field}`]).toFixed(getProps.value.summaryPrecision).replace(/(\d)(?=(\d{3})+\.)/g, "$1,") : data[`${item.field}`];
|
|
20732
|
+
}) : getProps.value.summaryTotalFields.includes(item.field) && utils.isNumber(+data[`${item.field}`]) && !isNaN(+data[`${item.field}`]) ? (+data[`${item.field}`]).toFixed(getProps.value.summaryPrecision).replace(/(\d)(?=(\d{3})+\.)/g, "$1,") : data[`${item.field}`];
|
|
20733
20733
|
} else {
|
|
20734
20734
|
element = slots[`${item.field}Value`] ? (_c = slots[`${item.field}Value`]) == null ? void 0 : _c.call(slots, {
|
|
20735
20735
|
model: data,
|
|
@@ -33138,15 +33138,11 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
|
33138
33138
|
};
|
|
33139
33139
|
}
|
|
33140
33140
|
});
|
|
33141
|
-
const
|
|
33142
|
-
|
|
33143
|
-
|
|
33144
|
-
|
|
33145
|
-
const
|
|
33146
|
-
const _hoisted_3$2 = { class: "table-children-add-btn" };
|
|
33147
|
-
const _hoisted_4$2 = { class: "w-full h-[fit-content] py-8px flex justify-end items-center" };
|
|
33148
|
-
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
33149
|
-
__name: "Table",
|
|
33141
|
+
const formTable = "";
|
|
33142
|
+
const SHOW_ROW_COUNT = 10;
|
|
33143
|
+
const ROW_HEIGHT = 48.67;
|
|
33144
|
+
const BODY_HEIGHT = ROW_HEIGHT * SHOW_ROW_COUNT;
|
|
33145
|
+
const ShyFormTable = /* @__PURE__ */ vue.defineComponent({
|
|
33150
33146
|
props: {
|
|
33151
33147
|
rowKey: {
|
|
33152
33148
|
type: String,
|
|
@@ -33180,21 +33176,27 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
33180
33176
|
}
|
|
33181
33177
|
},
|
|
33182
33178
|
emits: ["update:value", "change", "add", "remove"],
|
|
33183
|
-
setup(
|
|
33179
|
+
setup(props2, {
|
|
33180
|
+
emit,
|
|
33181
|
+
attrs
|
|
33182
|
+
}) {
|
|
33183
|
+
const {
|
|
33184
|
+
prefixCls: prefixCls2
|
|
33185
|
+
} = use.useDesign("ant-form-table-children");
|
|
33184
33186
|
const formActionType = vue.inject("formActionType");
|
|
33185
|
-
const
|
|
33186
|
-
const props2 = __props;
|
|
33187
|
+
const tableWrapperRef = vue.ref();
|
|
33187
33188
|
const tableElRef = vue.ref();
|
|
33189
|
+
const curIndex = vue.ref(0);
|
|
33190
|
+
const sourceHeight = vue.ref(0);
|
|
33191
|
+
const dataSource = vue.ref([]);
|
|
33188
33192
|
const emitData = vue.ref([]);
|
|
33189
33193
|
const [state] = use.useRuleFormItem(props2, "value", "change", emitData);
|
|
33190
33194
|
const getColumns = vue.computed(() => {
|
|
33191
33195
|
const indexColumn = {
|
|
33192
33196
|
title: "序号",
|
|
33193
33197
|
dataIndex: "index",
|
|
33194
|
-
customRender: ({ index: index2 }) => {
|
|
33195
|
-
return `${index2 + 1}`;
|
|
33196
|
-
},
|
|
33197
33198
|
width: 50,
|
|
33199
|
+
maxWidth: 50,
|
|
33198
33200
|
align: "center"
|
|
33199
33201
|
};
|
|
33200
33202
|
const actionColumn = {
|
|
@@ -33203,14 +33205,10 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
33203
33205
|
width: 80,
|
|
33204
33206
|
align: "center"
|
|
33205
33207
|
};
|
|
33206
|
-
return [
|
|
33207
|
-
|
|
33208
|
-
|
|
33209
|
-
|
|
33210
|
-
type: item.type ? item.type : "input"
|
|
33211
|
-
})),
|
|
33212
|
-
...(props2 == null ? void 0 : props2.isShowAction) ? [actionColumn] : []
|
|
33213
|
-
];
|
|
33208
|
+
return [indexColumn, ...props2.columns.map((item) => ({
|
|
33209
|
+
...item,
|
|
33210
|
+
type: item.type ? item.type : "input"
|
|
33211
|
+
})), ...(props2 == null ? void 0 : props2.isShowAction) ? [actionColumn] : []];
|
|
33214
33212
|
});
|
|
33215
33213
|
const getScrollX = vue.computed(() => {
|
|
33216
33214
|
var _a2;
|
|
@@ -33220,9 +33218,7 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
33220
33218
|
columns.forEach((item) => {
|
|
33221
33219
|
width += Number.parseFloat(item.width) || 0;
|
|
33222
33220
|
});
|
|
33223
|
-
const unsetWidthColumns = columns.filter(
|
|
33224
|
-
(item) => !Reflect.has(item, "width")
|
|
33225
|
-
);
|
|
33221
|
+
const unsetWidthColumns = columns.filter((item) => !Reflect.has(item, "width"));
|
|
33226
33222
|
const len = unsetWidthColumns.length;
|
|
33227
33223
|
if (len !== 0) {
|
|
33228
33224
|
width += len * NORMAL_WIDTH;
|
|
@@ -33231,11 +33227,190 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
33231
33227
|
const tableWidth = ((_a2 = table2 == null ? void 0 : table2.$el) == null ? void 0 : _a2.offsetWidth) ?? 0;
|
|
33232
33228
|
return tableWidth > width ? "100%" : width;
|
|
33233
33229
|
});
|
|
33234
|
-
const
|
|
33235
|
-
|
|
33230
|
+
const handleScroll = (e) => {
|
|
33231
|
+
const {
|
|
33232
|
+
scrollTop,
|
|
33233
|
+
scrollHeight
|
|
33234
|
+
} = e.target;
|
|
33235
|
+
let lenMax = state.value.length, nIdx;
|
|
33236
|
+
if (scrollTop === 0) {
|
|
33237
|
+
dataSource.value = state.value.slice(0, SHOW_ROW_COUNT);
|
|
33238
|
+
curIndex.value = 0;
|
|
33239
|
+
} else if (scrollTop === scrollHeight - BODY_HEIGHT) {
|
|
33240
|
+
nIdx = lenMax - SHOW_ROW_COUNT;
|
|
33241
|
+
dataSource.value = state.value.slice(nIdx, nIdx + SHOW_ROW_COUNT);
|
|
33242
|
+
curIndex.value = nIdx;
|
|
33243
|
+
} else {
|
|
33244
|
+
nIdx = Math.ceil(scrollTop * lenMax / scrollHeight);
|
|
33245
|
+
if (nIdx !== curIndex.value && nIdx <= lenMax - SHOW_ROW_COUNT) {
|
|
33246
|
+
dataSource.value = state.value.slice(nIdx, nIdx + SHOW_ROW_COUNT);
|
|
33247
|
+
curIndex.value = nIdx;
|
|
33248
|
+
}
|
|
33249
|
+
}
|
|
33250
|
+
};
|
|
33251
|
+
const defaultProps = {
|
|
33252
|
+
style: {
|
|
33253
|
+
width: "100%"
|
|
33254
|
+
},
|
|
33255
|
+
allowClear: true,
|
|
33256
|
+
getPopupContainer: () => document.body
|
|
33257
|
+
};
|
|
33258
|
+
const renderTable = vue.computed(() => {
|
|
33259
|
+
return vue.createVNode("div", {
|
|
33260
|
+
"ref": tableWrapperRef,
|
|
33261
|
+
"class": prefixCls2
|
|
33262
|
+
}, [vue.createVNode(antDesignVue.Table, {
|
|
33263
|
+
"ref": tableElRef,
|
|
33264
|
+
"columns": getColumns.value,
|
|
33265
|
+
"scroll": {
|
|
33266
|
+
x: state.value.length ? getScrollX.value : void 0,
|
|
33267
|
+
y: BODY_HEIGHT
|
|
33268
|
+
},
|
|
33269
|
+
"data-source": dataSource.value,
|
|
33270
|
+
"pagination": false,
|
|
33271
|
+
"bordered": true,
|
|
33272
|
+
"size": "small",
|
|
33273
|
+
"class": `${prefixCls2}-body`,
|
|
33274
|
+
"align": "center",
|
|
33275
|
+
"rowKey": props2.rowKey,
|
|
33276
|
+
"components": {
|
|
33277
|
+
body: {
|
|
33278
|
+
cell: renderTd
|
|
33279
|
+
}
|
|
33280
|
+
}
|
|
33281
|
+
}, {
|
|
33282
|
+
headerCell: ({
|
|
33283
|
+
column: column2
|
|
33284
|
+
}) => {
|
|
33285
|
+
const renderRequired = () => {
|
|
33286
|
+
var _a2;
|
|
33287
|
+
if (column2.required || ((_a2 = column2 == null ? void 0 : column2.rules) == null ? void 0 : _a2.length)) {
|
|
33288
|
+
return vue.createVNode("span", {
|
|
33289
|
+
"class": `${prefixCls2}-body-required`
|
|
33290
|
+
}, [vue.createTextVNode("*")]);
|
|
33291
|
+
}
|
|
33292
|
+
return null;
|
|
33293
|
+
};
|
|
33294
|
+
return vue.createVNode(vue.Fragment, null, [renderRequired(), vue.createVNode("span", null, [column2.title])]);
|
|
33295
|
+
},
|
|
33296
|
+
bodyCell: ({
|
|
33297
|
+
column: column2,
|
|
33298
|
+
record,
|
|
33299
|
+
index: index2,
|
|
33300
|
+
...args
|
|
33301
|
+
}) => {
|
|
33302
|
+
const renderFormItem = () => {
|
|
33303
|
+
const componentProps = utils.isFunction(column2.componentProps) ? {
|
|
33304
|
+
...defaultProps,
|
|
33305
|
+
...column2.componentProps({
|
|
33306
|
+
record,
|
|
33307
|
+
column: column2,
|
|
33308
|
+
index: index2,
|
|
33309
|
+
...args
|
|
33310
|
+
})
|
|
33311
|
+
} : {
|
|
33312
|
+
...defaultProps,
|
|
33313
|
+
...column2.componentProps
|
|
33314
|
+
};
|
|
33315
|
+
const eventKey = `on${upperFirst$2("change")}`;
|
|
33316
|
+
const isCheck = ["Switch", "Checkbox"].includes(getType(column2.type));
|
|
33317
|
+
const on = {
|
|
33318
|
+
[eventKey]: (...args2) => {
|
|
33319
|
+
const [e] = args2;
|
|
33320
|
+
if (componentProps[eventKey] && args2.length >= 1) {
|
|
33321
|
+
componentProps[eventKey](...args2);
|
|
33322
|
+
}
|
|
33323
|
+
const target = e ? e.target : null;
|
|
33324
|
+
const value = target ? isCheck ? target.checked : target.value : e;
|
|
33325
|
+
const currValue = state.value.find((item) => item[props2.rowKey] === record[props2.rowKey]);
|
|
33326
|
+
currValue[column2.dataIndex] = value;
|
|
33327
|
+
}
|
|
33328
|
+
};
|
|
33329
|
+
const bindValue = {
|
|
33330
|
+
[isCheck ? "checked" : "value"]: record[column2.dataIndex]
|
|
33331
|
+
};
|
|
33332
|
+
const compAttr = {
|
|
33333
|
+
...componentProps,
|
|
33334
|
+
...on,
|
|
33335
|
+
...bindValue
|
|
33336
|
+
};
|
|
33337
|
+
return column2.dataIndex !== "index" && column2.type !== "text" && column2.dataIndex !== "_action" ? vue.createVNode("td", {
|
|
33338
|
+
"class": "ant-table-cell",
|
|
33339
|
+
"style": renderTdProps(column2)
|
|
33340
|
+
}, [vue.createVNode(antDesignVue.FormItem, {
|
|
33341
|
+
"required": column2.required,
|
|
33342
|
+
"rules": getRules({
|
|
33343
|
+
column: column2,
|
|
33344
|
+
record,
|
|
33345
|
+
index: index2,
|
|
33346
|
+
...args
|
|
33347
|
+
}),
|
|
33348
|
+
"name": [attrs.codeField, index2 + curIndex.value, column2.dataIndex]
|
|
33349
|
+
}, {
|
|
33350
|
+
default: () => {
|
|
33351
|
+
var _a2;
|
|
33352
|
+
return [vue.createVNode(antDesignVue.Popover, {
|
|
33353
|
+
"visible": !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a2.show) && !isScroll.value
|
|
33354
|
+
}, {
|
|
33355
|
+
content: () => {
|
|
33356
|
+
var _a3;
|
|
33357
|
+
return vue.createVNode("span", {
|
|
33358
|
+
"class": "text-red-500"
|
|
33359
|
+
}, [(_a3 = rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a3.msg]);
|
|
33360
|
+
},
|
|
33361
|
+
default: () => {
|
|
33362
|
+
const Comp = ShyComponentMap.get(getType(column2.type));
|
|
33363
|
+
return vue.createVNode(Comp, compAttr, null);
|
|
33364
|
+
}
|
|
33365
|
+
})];
|
|
33366
|
+
}
|
|
33367
|
+
})]) : null;
|
|
33368
|
+
};
|
|
33369
|
+
const renderAction = () => {
|
|
33370
|
+
return column2.dataIndex === "_action" ? vue.createVNode("td", {
|
|
33371
|
+
"class": "ant-table-cell",
|
|
33372
|
+
"style": {
|
|
33373
|
+
textAlign: "center"
|
|
33374
|
+
}
|
|
33375
|
+
}, [vue.createVNode(ShyTableAction, {
|
|
33376
|
+
"actions": getActions(record)
|
|
33377
|
+
}, null)]) : null;
|
|
33378
|
+
};
|
|
33379
|
+
const renderIndex = () => {
|
|
33380
|
+
return column2.dataIndex === "index" ? vue.createVNode("td", {
|
|
33381
|
+
"class": "ant-table-cell",
|
|
33382
|
+
"style": {
|
|
33383
|
+
textAlign: "center"
|
|
33384
|
+
}
|
|
33385
|
+
}, [index2 + curIndex.value + 1]) : null;
|
|
33386
|
+
};
|
|
33387
|
+
return renderFormItem() ?? renderAction() ?? renderIndex() ?? vue.createVNode("td", {
|
|
33388
|
+
"class": "ant-table-cell",
|
|
33389
|
+
"style": renderTdProps(column2)
|
|
33390
|
+
}, [record[column2.dataIndex]]);
|
|
33391
|
+
}
|
|
33392
|
+
}), vue.createVNode("div", {
|
|
33393
|
+
"class": `${prefixCls2}-scroll-bar-wrapper`,
|
|
33394
|
+
"style": {
|
|
33395
|
+
"--height": `${BODY_HEIGHT}px`
|
|
33396
|
+
}
|
|
33397
|
+
}, [vue.createVNode("div", {
|
|
33398
|
+
"class": `${prefixCls2}-scroll-bar-inner`,
|
|
33399
|
+
"style": {
|
|
33400
|
+
"--height": `${sourceHeight.value}px`
|
|
33401
|
+
}
|
|
33402
|
+
}, null)])]);
|
|
33403
|
+
});
|
|
33404
|
+
const create = () => {
|
|
33405
|
+
state.value = [{
|
|
33406
|
+
[props2.rowKey]: utils.buildUUID()
|
|
33407
|
+
}, ...vue.toRaw(state.value)];
|
|
33408
|
+
curIndex.value = 0;
|
|
33409
|
+
document.querySelector(`.${prefixCls2}-scroll-bar-wrapper`).scrollTop = curIndex.value * ROW_HEIGHT;
|
|
33236
33410
|
emit("add", state.value);
|
|
33237
33411
|
};
|
|
33238
|
-
const
|
|
33412
|
+
const remove = (index2) => {
|
|
33413
|
+
curIndex.value -= curIndex.value === 0 ? 0 : 1;
|
|
33239
33414
|
const tempState = state.value.filter((item) => {
|
|
33240
33415
|
return item[props2.rowKey] !== index2;
|
|
33241
33416
|
});
|
|
@@ -33243,9 +33418,13 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
33243
33418
|
state.value = [...tempState];
|
|
33244
33419
|
emit("remove", state.value, index2);
|
|
33245
33420
|
};
|
|
33246
|
-
const getPopupContainer2 = () => document.body;
|
|
33247
33421
|
const rulesRef = vue.reactive({});
|
|
33248
|
-
const getRules = ({
|
|
33422
|
+
const getRules = ({
|
|
33423
|
+
column: column2,
|
|
33424
|
+
record,
|
|
33425
|
+
index: index2,
|
|
33426
|
+
...args
|
|
33427
|
+
}) => {
|
|
33249
33428
|
var _a2, _b;
|
|
33250
33429
|
const errKey = `${column2.dataIndex}-${record[props2.rowKey]}Info`;
|
|
33251
33430
|
if (!column2.required)
|
|
@@ -33258,22 +33437,20 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
33258
33437
|
msg: ""
|
|
33259
33438
|
};
|
|
33260
33439
|
if (!column2.rules && column2.required) {
|
|
33261
|
-
rulesRef[errKey].rules = [
|
|
33262
|
-
|
|
33263
|
-
|
|
33264
|
-
|
|
33265
|
-
|
|
33266
|
-
|
|
33267
|
-
|
|
33268
|
-
|
|
33269
|
-
return Promise.resolve();
|
|
33270
|
-
}
|
|
33271
|
-
rulesRef[errKey].show = true;
|
|
33272
|
-
rulesRef[errKey].msg = errMsg;
|
|
33273
|
-
return Promise.reject(errMsg);
|
|
33440
|
+
rulesRef[errKey].rules = [{
|
|
33441
|
+
required: true,
|
|
33442
|
+
validator: (rule, value) => {
|
|
33443
|
+
const prefix = column2.type.toLocaleLowerCase().includes("input") ? "请输入" : "请选择";
|
|
33444
|
+
const errMsg = `${prefix}${column2.title}`;
|
|
33445
|
+
if (value) {
|
|
33446
|
+
rulesRef[errKey].show = false;
|
|
33447
|
+
return Promise.resolve();
|
|
33274
33448
|
}
|
|
33449
|
+
rulesRef[errKey].show = true;
|
|
33450
|
+
rulesRef[errKey].msg = errMsg;
|
|
33451
|
+
return Promise.reject(errMsg);
|
|
33275
33452
|
}
|
|
33276
|
-
];
|
|
33453
|
+
}];
|
|
33277
33454
|
return rulesRef[errKey].rules;
|
|
33278
33455
|
}
|
|
33279
33456
|
if (!isArray$3(column2.rules))
|
|
@@ -33286,12 +33463,11 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
33286
33463
|
item.validator = async (rule, value) => {
|
|
33287
33464
|
try {
|
|
33288
33465
|
rulesRef[errKey].show = false;
|
|
33289
|
-
return await validator(
|
|
33290
|
-
|
|
33291
|
-
|
|
33292
|
-
|
|
33293
|
-
|
|
33294
|
-
);
|
|
33466
|
+
return await validator(rule, value, {
|
|
33467
|
+
column: column2,
|
|
33468
|
+
record,
|
|
33469
|
+
...args
|
|
33470
|
+
}, formActionType);
|
|
33295
33471
|
} catch (error2) {
|
|
33296
33472
|
rulesRef[errKey].show = true;
|
|
33297
33473
|
rulesRef[errKey].msg = error2;
|
|
@@ -33302,192 +33478,111 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
33302
33478
|
return rulesRef[errKey].rules;
|
|
33303
33479
|
};
|
|
33304
33480
|
const getActions = (record) => {
|
|
33305
|
-
return [
|
|
33306
|
-
|
|
33307
|
-
|
|
33308
|
-
|
|
33309
|
-
|
|
33310
|
-
confirm: rowClickEvent.bind(null, record[props2.rowKey])
|
|
33311
|
-
}
|
|
33312
|
-
},
|
|
33313
|
-
...props2.tableAction(record)
|
|
33314
|
-
];
|
|
33315
|
-
};
|
|
33316
|
-
vue.watch(
|
|
33317
|
-
() => state.value,
|
|
33318
|
-
(v, old) => {
|
|
33319
|
-
if (!isEqual(vue.toRaw(v), vue.toRaw(old))) {
|
|
33320
|
-
state.value = vue.toRaw(v).map((ele) => {
|
|
33321
|
-
return {
|
|
33322
|
-
...ele,
|
|
33323
|
-
[props2.rowKey]: ele[props2.rowKey] || utils.buildUUID()
|
|
33324
|
-
};
|
|
33325
|
-
});
|
|
33481
|
+
return [{
|
|
33482
|
+
label: "删除",
|
|
33483
|
+
popConfirm: {
|
|
33484
|
+
title: "确定删除",
|
|
33485
|
+
confirm: remove.bind(null, record[props2.rowKey])
|
|
33326
33486
|
}
|
|
33327
|
-
},
|
|
33328
|
-
|
|
33329
|
-
|
|
33487
|
+
}, ...props2.tableAction(record)];
|
|
33488
|
+
};
|
|
33489
|
+
const getType = (type) => {
|
|
33490
|
+
switch (type) {
|
|
33491
|
+
case "input":
|
|
33492
|
+
return "Input";
|
|
33493
|
+
case "select":
|
|
33494
|
+
return "Select";
|
|
33495
|
+
case "datePicker":
|
|
33496
|
+
return "DatePicker";
|
|
33497
|
+
case "number":
|
|
33498
|
+
return "InputNumber";
|
|
33499
|
+
default:
|
|
33500
|
+
return type;
|
|
33330
33501
|
}
|
|
33331
|
-
|
|
33502
|
+
};
|
|
33503
|
+
vue.watch(() => state.value, (v, old) => {
|
|
33504
|
+
if (!isEqual(vue.toRaw(v), vue.toRaw(old))) {
|
|
33505
|
+
state.value = vue.toRaw(v).map((ele) => {
|
|
33506
|
+
return {
|
|
33507
|
+
...ele,
|
|
33508
|
+
[props2.rowKey]: ele[props2.rowKey] || utils.buildUUID()
|
|
33509
|
+
};
|
|
33510
|
+
});
|
|
33511
|
+
sourceHeight.value = v.length * ROW_HEIGHT;
|
|
33512
|
+
dataSource.value = v.length > SHOW_ROW_COUNT ? v.slice(curIndex.value, curIndex.value + SHOW_ROW_COUNT) : v.slice(0, SHOW_ROW_COUNT);
|
|
33513
|
+
}
|
|
33514
|
+
}, {
|
|
33515
|
+
deep: true
|
|
33516
|
+
});
|
|
33332
33517
|
const isScroll = vue.ref(false);
|
|
33333
33518
|
const timer = vue.ref();
|
|
33334
33519
|
vue.onMounted(() => {
|
|
33335
|
-
window.addEventListener(
|
|
33336
|
-
|
|
33337
|
-
(
|
|
33338
|
-
|
|
33339
|
-
|
|
33340
|
-
|
|
33341
|
-
|
|
33342
|
-
|
|
33343
|
-
|
|
33344
|
-
|
|
33345
|
-
|
|
33346
|
-
|
|
33347
|
-
|
|
33520
|
+
window.addEventListener("scroll", (e) => {
|
|
33521
|
+
clearTimeout(timer.value);
|
|
33522
|
+
timer.value = setTimeout(() => {
|
|
33523
|
+
isScroll.value = false;
|
|
33524
|
+
}, 500);
|
|
33525
|
+
if (isScroll.value)
|
|
33526
|
+
return;
|
|
33527
|
+
isScroll.value = true;
|
|
33528
|
+
}, true);
|
|
33529
|
+
tableWrapperRef.value.addEventListener("wheel", (e) => {
|
|
33530
|
+
if (state.value.length <= SHOW_ROW_COUNT) {
|
|
33531
|
+
return;
|
|
33532
|
+
}
|
|
33533
|
+
if (e.deltaY > 0 && curIndex.value + SHOW_ROW_COUNT < state.value.length) {
|
|
33534
|
+
dataSource.value = state.value.slice(++curIndex.value, curIndex.value + SHOW_ROW_COUNT);
|
|
33535
|
+
}
|
|
33536
|
+
if (e.deltaY < 0 && curIndex.value > 0) {
|
|
33537
|
+
dataSource.value = state.value.slice(--curIndex.value, curIndex.value + SHOW_ROW_COUNT);
|
|
33538
|
+
}
|
|
33539
|
+
document.querySelector(`.${prefixCls2}-scroll-bar-wrapper`).scrollTop = curIndex.value * ROW_HEIGHT;
|
|
33540
|
+
}, true);
|
|
33541
|
+
tableWrapperRef.value.addEventListener("scroll", handleScroll, true);
|
|
33348
33542
|
});
|
|
33349
33543
|
vue.onUnmounted(() => {
|
|
33350
33544
|
window.removeEventListener("scroll", () => {
|
|
33351
33545
|
});
|
|
33352
33546
|
});
|
|
33353
|
-
const
|
|
33354
|
-
|
|
33355
|
-
|
|
33356
|
-
|
|
33357
|
-
|
|
33358
|
-
|
|
33359
|
-
|
|
33360
|
-
|
|
33361
|
-
|
|
33362
|
-
|
|
33363
|
-
|
|
33364
|
-
|
|
33365
|
-
|
|
33366
|
-
|
|
33367
|
-
|
|
33368
|
-
|
|
33369
|
-
|
|
33370
|
-
|
|
33547
|
+
const renderTdProps = (column2) => {
|
|
33548
|
+
switch (column2.align) {
|
|
33549
|
+
case "center":
|
|
33550
|
+
return {
|
|
33551
|
+
textAlign: "center"
|
|
33552
|
+
};
|
|
33553
|
+
case "left":
|
|
33554
|
+
return {
|
|
33555
|
+
textAlign: "left"
|
|
33556
|
+
};
|
|
33557
|
+
case "right":
|
|
33558
|
+
return {
|
|
33559
|
+
textAlign: "right"
|
|
33560
|
+
};
|
|
33561
|
+
default:
|
|
33562
|
+
return {
|
|
33563
|
+
textAlign: "left"
|
|
33564
|
+
};
|
|
33371
33565
|
}
|
|
33372
33566
|
};
|
|
33373
|
-
|
|
33374
|
-
|
|
33375
|
-
|
|
33376
|
-
return
|
|
33377
|
-
|
|
33378
|
-
|
|
33379
|
-
|
|
33380
|
-
|
|
33381
|
-
|
|
33382
|
-
|
|
33383
|
-
|
|
33384
|
-
|
|
33385
|
-
|
|
33386
|
-
|
|
33387
|
-
|
|
33388
|
-
|
|
33389
|
-
align: "center"
|
|
33390
|
-
}, {
|
|
33391
|
-
headerCell: vue.withCtx(({ column: column2 }) => {
|
|
33392
|
-
var _a2;
|
|
33393
|
-
return [
|
|
33394
|
-
column2.required || ((_a2 = column2 == null ? void 0 : column2.rules) == null ? void 0 : _a2.length) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$6, "*")) : vue.createCommentVNode("", true),
|
|
33395
|
-
vue.createElementVNode("span", null, vue.toDisplayString(column2.title), 1)
|
|
33396
|
-
];
|
|
33397
|
-
}),
|
|
33398
|
-
bodyCell: vue.withCtx(({ column: column2, record, index: index2, ...args }) => [
|
|
33399
|
-
column2.dataIndex !== "index" && column2.type !== "text" && column2.dataIndex !== "_action" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.FormItem), {
|
|
33400
|
-
required: column2.required,
|
|
33401
|
-
rules: getRules({ column: column2, record, index: index2, ...args }),
|
|
33402
|
-
name: [_ctx.$attrs.codeField, index2, column2.dataIndex],
|
|
33403
|
-
key: record[__props.rowKey]
|
|
33404
|
-
}, {
|
|
33405
|
-
default: vue.withCtx(() => {
|
|
33406
|
-
var _a2;
|
|
33407
|
-
return [
|
|
33408
|
-
vue.createVNode(vue.unref(antDesignVue.Popover), {
|
|
33409
|
-
overlayClassName: "table-children-err-popover",
|
|
33410
|
-
visible: !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a2.show) && !isScroll.value
|
|
33411
|
-
}, {
|
|
33412
|
-
content: vue.withCtx(() => {
|
|
33413
|
-
var _a3;
|
|
33414
|
-
return [
|
|
33415
|
-
vue.createElementVNode("span", _hoisted_2$3, vue.toDisplayString((_a3 = rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a3.msg), 1)
|
|
33416
|
-
];
|
|
33417
|
-
}),
|
|
33418
|
-
default: vue.withCtx(() => [
|
|
33419
|
-
column2.type === "select" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Select), {
|
|
33420
|
-
key: 0,
|
|
33421
|
-
value: record[column2.dataIndex],
|
|
33422
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
33423
|
-
options: column2.dicData,
|
|
33424
|
-
mode: column2.mode,
|
|
33425
|
-
"max-tag-count": column2.maxTagCount,
|
|
33426
|
-
"max-tag-text-length": column2.maxTagTextLength
|
|
33427
|
-
}, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column2.type === "datePicker" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.DatePicker), {
|
|
33428
|
-
key: 1,
|
|
33429
|
-
value: record[column2.dataIndex],
|
|
33430
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
33431
|
-
valueFormat: "YYYY-MM-DD HH:mm:ss"
|
|
33432
|
-
}, null, 8, ["value", "onUpdate:value"])) : column2.type === "number" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.InputNumber), {
|
|
33433
|
-
key: 2,
|
|
33434
|
-
value: record[column2.dataIndex],
|
|
33435
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
33436
|
-
min: column2.min,
|
|
33437
|
-
max: column2.max,
|
|
33438
|
-
precision: column2.precision ?? 2
|
|
33439
|
-
}, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column2.type === "input" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), {
|
|
33440
|
-
key: 3,
|
|
33441
|
-
value: record[column2.dataIndex],
|
|
33442
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
33443
|
-
disabled: !props2.isShowAction
|
|
33444
|
-
}, null, 8, ["value", "onUpdate:value", "disabled"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(ShyComponentMap).get(column2.type)), vue.mergeProps(
|
|
33445
|
-
{
|
|
33446
|
-
key: 4,
|
|
33447
|
-
allowClear: "",
|
|
33448
|
-
getPopupContainer: getPopupContainer2,
|
|
33449
|
-
style: { width: "100%" }
|
|
33450
|
-
},
|
|
33451
|
-
vue.unref(utils.isFunction)(column2.componentProps) ? column2.componentProps({ record, column: column2, index: index2, ...args }) : column2.componentProps,
|
|
33452
|
-
{
|
|
33453
|
-
value: record[column2.dataIndex],
|
|
33454
|
-
"onUpdate:value": ($event) => record[column2.dataIndex] = $event
|
|
33455
|
-
}
|
|
33456
|
-
), null, 16, ["value", "onUpdate:value"]))
|
|
33457
|
-
]),
|
|
33458
|
-
_: 2
|
|
33459
|
-
}, 1032, ["visible"])
|
|
33460
|
-
];
|
|
33461
|
-
}),
|
|
33462
|
-
_: 2
|
|
33463
|
-
}, 1032, ["required", "rules", "name"])) : vue.createCommentVNode("", true),
|
|
33464
|
-
column2.dataIndex === "_action" ? (vue.openBlock(), vue.createBlock(vue.unref(ShyTableAction$1), {
|
|
33465
|
-
key: 1,
|
|
33466
|
-
actions: getActions(record)
|
|
33467
|
-
}, null, 8, ["actions"])) : vue.createCommentVNode("", true)
|
|
33468
|
-
]),
|
|
33469
|
-
_: 1
|
|
33470
|
-
}, 8, ["columns", "scroll", "data-source"]),
|
|
33471
|
-
vue.createElementVNode("div", _hoisted_3$2, [
|
|
33472
|
-
vue.createVNode(vue.unref(BasicButton), {
|
|
33473
|
-
onClick: plusClickEvent,
|
|
33474
|
-
type: "dashed"
|
|
33475
|
-
}, {
|
|
33476
|
-
default: vue.withCtx(() => [
|
|
33477
|
-
vue.createTextVNode(" 新增 ")
|
|
33478
|
-
]),
|
|
33479
|
-
_: 1
|
|
33480
|
-
})
|
|
33481
|
-
]),
|
|
33482
|
-
vue.createElementVNode("div", _hoisted_4$2, [
|
|
33483
|
-
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.h("span", null, __props.footerRender()))))
|
|
33484
|
-
])
|
|
33485
|
-
], 64);
|
|
33567
|
+
const renderTd = (cell, {
|
|
33568
|
+
slots
|
|
33569
|
+
}) => {
|
|
33570
|
+
return cell.colSpan === props2.columns.length + 2 ? vue.createVNode("td", cell, [slots.default()]) : slots.default();
|
|
33571
|
+
};
|
|
33572
|
+
return () => {
|
|
33573
|
+
return vue.createVNode(vue.Fragment, null, [renderTable.value, vue.createVNode("div", {
|
|
33574
|
+
"class": `${prefixCls2}-add-btn`
|
|
33575
|
+
}, [vue.createVNode(BasicButton, {
|
|
33576
|
+
"onClick": create,
|
|
33577
|
+
"type": "dashed"
|
|
33578
|
+
}, {
|
|
33579
|
+
default: () => [vue.createTextVNode("新增")]
|
|
33580
|
+
})]), vue.createVNode("div", {
|
|
33581
|
+
"class": `${prefixCls2}-footer`
|
|
33582
|
+
}, [props2.footerRender()])]);
|
|
33486
33583
|
};
|
|
33487
33584
|
}
|
|
33488
33585
|
});
|
|
33489
|
-
const Table_vue_vue_type_style_index_0_scoped_d3bdc269_lang = "";
|
|
33490
|
-
const Table = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-d3bdc269"]]);
|
|
33491
33586
|
const ShyComponentMap = /* @__PURE__ */ new Map();
|
|
33492
33587
|
ShyComponentMap.set("Input", antDesignVue.Input);
|
|
33493
33588
|
ShyComponentMap.set("InputGroup", antDesignVue.Input.Group);
|
|
@@ -33521,7 +33616,7 @@ ShyComponentMap.set("TimePicker", antDesignVue.TimePicker);
|
|
|
33521
33616
|
ShyComponentMap.set("StrengthMeter", StrengthMeter);
|
|
33522
33617
|
ShyComponentMap.set("IconPicker", _sfc_main$1t);
|
|
33523
33618
|
ShyComponentMap.set("InputCountDown", CountdownInput);
|
|
33524
|
-
ShyComponentMap.set("Table",
|
|
33619
|
+
ShyComponentMap.set("Table", ShyFormTable);
|
|
33525
33620
|
ShyComponentMap.set("Tinymce", _sfc_main$e);
|
|
33526
33621
|
ShyComponentMap.set("Divider", BasicTitle$1);
|
|
33527
33622
|
ShyComponentMap.set("ColorPicker", ColorPickerPanel);
|
|
@@ -33616,7 +33711,7 @@ function useItemLabelWidth(schemaItemRef, propsRef) {
|
|
|
33616
33711
|
function _isSlot$3(s) {
|
|
33617
33712
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
|
|
33618
33713
|
}
|
|
33619
|
-
const _sfc_main$
|
|
33714
|
+
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
33620
33715
|
name: "BasicFormItem",
|
|
33621
33716
|
inheritAttrs: false,
|
|
33622
33717
|
props: {
|
|
@@ -34049,7 +34144,7 @@ function createFormContext(context) {
|
|
|
34049
34144
|
function useFormContext() {
|
|
34050
34145
|
return use.useContext(key$1);
|
|
34051
34146
|
}
|
|
34052
|
-
const _sfc_main$
|
|
34147
|
+
const _sfc_main$c = vue.defineComponent({
|
|
34053
34148
|
name: "BasicFormAction",
|
|
34054
34149
|
components: {
|
|
34055
34150
|
FormItem: antDesignVue.Form.Item,
|
|
@@ -34186,7 +34281,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34186
34281
|
})
|
|
34187
34282
|
], 6);
|
|
34188
34283
|
}
|
|
34189
|
-
const FormAction = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
34284
|
+
const FormAction = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$3]]);
|
|
34190
34285
|
function tryDeconstructArray(key2, value, target) {
|
|
34191
34286
|
const pattern = /^\[(.+)\]$/;
|
|
34192
34287
|
if (pattern.test(key2)) {
|
|
@@ -34629,7 +34724,7 @@ const basicProps = {
|
|
|
34629
34724
|
},
|
|
34630
34725
|
size: {
|
|
34631
34726
|
type: String,
|
|
34632
|
-
default:
|
|
34727
|
+
default: void 0
|
|
34633
34728
|
},
|
|
34634
34729
|
// // 禁用表单
|
|
34635
34730
|
disabled: {
|
|
@@ -35040,7 +35135,7 @@ const ShyForm = /* @__PURE__ */ vue.defineComponent({
|
|
|
35040
35135
|
};
|
|
35041
35136
|
const renderItem = (schema) => {
|
|
35042
35137
|
var _a2, _b, _c;
|
|
35043
|
-
return vue.createVNode(_sfc_main$
|
|
35138
|
+
return vue.createVNode(_sfc_main$d, {
|
|
35044
35139
|
"tableAction": props2.tableAction,
|
|
35045
35140
|
"formActionType": formActionType,
|
|
35046
35141
|
"schema": schema,
|
|
@@ -35229,6 +35324,356 @@ function useShyForm(props2) {
|
|
|
35229
35324
|
};
|
|
35230
35325
|
return [register, methods2];
|
|
35231
35326
|
}
|
|
35327
|
+
const _hoisted_1$6 = {
|
|
35328
|
+
key: 0,
|
|
35329
|
+
class: "table-children-required"
|
|
35330
|
+
};
|
|
35331
|
+
const _hoisted_2$3 = { class: "text-red-500" };
|
|
35332
|
+
const _hoisted_3$2 = { class: "table-children-add-btn" };
|
|
35333
|
+
const _hoisted_4$2 = { class: "w-full h-[fit-content] py-8px flex justify-end items-center" };
|
|
35334
|
+
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
35335
|
+
__name: "Table",
|
|
35336
|
+
props: {
|
|
35337
|
+
rowKey: {
|
|
35338
|
+
type: String,
|
|
35339
|
+
default: () => "uuid"
|
|
35340
|
+
},
|
|
35341
|
+
columns: {
|
|
35342
|
+
type: Array,
|
|
35343
|
+
default: () => []
|
|
35344
|
+
},
|
|
35345
|
+
value: {
|
|
35346
|
+
type: Array,
|
|
35347
|
+
default: () => []
|
|
35348
|
+
},
|
|
35349
|
+
isShowFooter: {
|
|
35350
|
+
type: Boolean,
|
|
35351
|
+
default: () => false
|
|
35352
|
+
},
|
|
35353
|
+
footerRender: {
|
|
35354
|
+
type: Function,
|
|
35355
|
+
default: () => ""
|
|
35356
|
+
},
|
|
35357
|
+
isShowAction: {
|
|
35358
|
+
type: Boolean,
|
|
35359
|
+
default: () => true
|
|
35360
|
+
},
|
|
35361
|
+
tableAction: {
|
|
35362
|
+
type: Function,
|
|
35363
|
+
default: (res) => {
|
|
35364
|
+
return [];
|
|
35365
|
+
}
|
|
35366
|
+
}
|
|
35367
|
+
},
|
|
35368
|
+
emits: ["update:value", "change", "add", "remove"],
|
|
35369
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
35370
|
+
const formActionType = vue.inject("formActionType");
|
|
35371
|
+
const emit = __emit;
|
|
35372
|
+
const props2 = __props;
|
|
35373
|
+
const tableElRef = vue.ref();
|
|
35374
|
+
const emitData = vue.ref([]);
|
|
35375
|
+
const [state] = use.useRuleFormItem(props2, "value", "change", emitData);
|
|
35376
|
+
const getColumns = vue.computed(() => {
|
|
35377
|
+
const indexColumn = {
|
|
35378
|
+
title: "序号",
|
|
35379
|
+
dataIndex: "index",
|
|
35380
|
+
customRender: ({ index: index2 }) => {
|
|
35381
|
+
return `${index2 + 1}`;
|
|
35382
|
+
},
|
|
35383
|
+
width: 50,
|
|
35384
|
+
align: "center"
|
|
35385
|
+
};
|
|
35386
|
+
const actionColumn = {
|
|
35387
|
+
title: "操作",
|
|
35388
|
+
dataIndex: "_action",
|
|
35389
|
+
width: 80,
|
|
35390
|
+
align: "center"
|
|
35391
|
+
};
|
|
35392
|
+
return [
|
|
35393
|
+
indexColumn,
|
|
35394
|
+
...props2.columns.map((item) => ({
|
|
35395
|
+
...item,
|
|
35396
|
+
type: item.type ? item.type : "input"
|
|
35397
|
+
})),
|
|
35398
|
+
...(props2 == null ? void 0 : props2.isShowAction) ? [actionColumn] : []
|
|
35399
|
+
];
|
|
35400
|
+
});
|
|
35401
|
+
const getScrollX = vue.computed(() => {
|
|
35402
|
+
var _a2;
|
|
35403
|
+
let width = 0;
|
|
35404
|
+
const NORMAL_WIDTH = 150;
|
|
35405
|
+
const columns = vue.unref(props2.columns).filter((item) => !item.defaultHidden);
|
|
35406
|
+
columns.forEach((item) => {
|
|
35407
|
+
width += Number.parseFloat(item.width) || 0;
|
|
35408
|
+
});
|
|
35409
|
+
const unsetWidthColumns = columns.filter(
|
|
35410
|
+
(item) => !Reflect.has(item, "width")
|
|
35411
|
+
);
|
|
35412
|
+
const len = unsetWidthColumns.length;
|
|
35413
|
+
if (len !== 0) {
|
|
35414
|
+
width += len * NORMAL_WIDTH;
|
|
35415
|
+
}
|
|
35416
|
+
const table2 = vue.unref(tableElRef);
|
|
35417
|
+
const tableWidth = ((_a2 = table2 == null ? void 0 : table2.$el) == null ? void 0 : _a2.offsetWidth) ?? 0;
|
|
35418
|
+
return tableWidth > width ? "100%" : width;
|
|
35419
|
+
});
|
|
35420
|
+
const plusClickEvent = () => {
|
|
35421
|
+
state.value = [{ [props2.rowKey]: utils.buildUUID() }, ...vue.toRaw(state.value)];
|
|
35422
|
+
emit("add", state.value);
|
|
35423
|
+
};
|
|
35424
|
+
const rowClickEvent = (index2) => {
|
|
35425
|
+
const tempState = state.value.filter((item) => {
|
|
35426
|
+
return item[props2.rowKey] !== index2;
|
|
35427
|
+
});
|
|
35428
|
+
tempState.forEach((item) => item[props2.rowKey] = utils.buildUUID());
|
|
35429
|
+
state.value = [...tempState];
|
|
35430
|
+
emit("remove", state.value, index2);
|
|
35431
|
+
};
|
|
35432
|
+
const getPopupContainer2 = () => document.body;
|
|
35433
|
+
const rulesRef = vue.reactive({});
|
|
35434
|
+
const getRules = ({ column: column2, record, index: index2, ...args }) => {
|
|
35435
|
+
var _a2, _b;
|
|
35436
|
+
const errKey = `${column2.dataIndex}-${record[props2.rowKey]}Info`;
|
|
35437
|
+
if (!column2.required)
|
|
35438
|
+
return [];
|
|
35439
|
+
if ((_a2 = rulesRef[errKey]) == null ? void 0 : _a2.rules)
|
|
35440
|
+
return (_b = rulesRef[errKey]) == null ? void 0 : _b.rules;
|
|
35441
|
+
rulesRef[errKey] = {
|
|
35442
|
+
rules: [],
|
|
35443
|
+
show: false,
|
|
35444
|
+
msg: ""
|
|
35445
|
+
};
|
|
35446
|
+
if (!column2.rules && column2.required) {
|
|
35447
|
+
rulesRef[errKey].rules = [
|
|
35448
|
+
{
|
|
35449
|
+
required: true,
|
|
35450
|
+
validator: (rule, value) => {
|
|
35451
|
+
const prefix = column2.type.toLocaleLowerCase().includes("input") ? "请输入" : "请选择";
|
|
35452
|
+
const errMsg = `${prefix}${column2.title}`;
|
|
35453
|
+
if (value) {
|
|
35454
|
+
rulesRef[errKey].show = false;
|
|
35455
|
+
return Promise.resolve();
|
|
35456
|
+
}
|
|
35457
|
+
rulesRef[errKey].show = true;
|
|
35458
|
+
rulesRef[errKey].msg = errMsg;
|
|
35459
|
+
return Promise.reject(errMsg);
|
|
35460
|
+
}
|
|
35461
|
+
}
|
|
35462
|
+
];
|
|
35463
|
+
return rulesRef[errKey].rules;
|
|
35464
|
+
}
|
|
35465
|
+
if (!isArray$3(column2.rules))
|
|
35466
|
+
return column2.rules;
|
|
35467
|
+
rulesRef[errKey].rules = cloneDeep(column2.rules);
|
|
35468
|
+
rulesRef[errKey].rules.forEach((item) => {
|
|
35469
|
+
if (!item.validator || !utils.isFunction(item.validator))
|
|
35470
|
+
return;
|
|
35471
|
+
const validator = item.validator;
|
|
35472
|
+
item.validator = async (rule, value) => {
|
|
35473
|
+
try {
|
|
35474
|
+
rulesRef[errKey].show = false;
|
|
35475
|
+
return await validator(
|
|
35476
|
+
rule,
|
|
35477
|
+
value,
|
|
35478
|
+
{ column: column2, record, ...args },
|
|
35479
|
+
formActionType
|
|
35480
|
+
);
|
|
35481
|
+
} catch (error2) {
|
|
35482
|
+
rulesRef[errKey].show = true;
|
|
35483
|
+
rulesRef[errKey].msg = error2;
|
|
35484
|
+
return Promise.reject(error2);
|
|
35485
|
+
}
|
|
35486
|
+
};
|
|
35487
|
+
});
|
|
35488
|
+
return rulesRef[errKey].rules;
|
|
35489
|
+
};
|
|
35490
|
+
const getActions = (record) => {
|
|
35491
|
+
return [
|
|
35492
|
+
{
|
|
35493
|
+
label: "删除",
|
|
35494
|
+
popConfirm: {
|
|
35495
|
+
title: "确定删除",
|
|
35496
|
+
confirm: rowClickEvent.bind(null, record[props2.rowKey])
|
|
35497
|
+
}
|
|
35498
|
+
},
|
|
35499
|
+
...props2.tableAction(record)
|
|
35500
|
+
];
|
|
35501
|
+
};
|
|
35502
|
+
vue.watch(
|
|
35503
|
+
() => state.value,
|
|
35504
|
+
(v, old) => {
|
|
35505
|
+
if (!isEqual(vue.toRaw(v), vue.toRaw(old))) {
|
|
35506
|
+
state.value = vue.toRaw(v).map((ele) => {
|
|
35507
|
+
return {
|
|
35508
|
+
...ele,
|
|
35509
|
+
[props2.rowKey]: ele[props2.rowKey] || utils.buildUUID()
|
|
35510
|
+
};
|
|
35511
|
+
});
|
|
35512
|
+
}
|
|
35513
|
+
},
|
|
35514
|
+
{
|
|
35515
|
+
deep: true
|
|
35516
|
+
}
|
|
35517
|
+
);
|
|
35518
|
+
const isScroll = vue.ref(false);
|
|
35519
|
+
const timer = vue.ref();
|
|
35520
|
+
vue.onMounted(() => {
|
|
35521
|
+
window.addEventListener(
|
|
35522
|
+
"scroll",
|
|
35523
|
+
(e) => {
|
|
35524
|
+
clearTimeout(timer.value);
|
|
35525
|
+
timer.value = setTimeout(() => {
|
|
35526
|
+
isScroll.value = false;
|
|
35527
|
+
}, 500);
|
|
35528
|
+
if (isScroll.value)
|
|
35529
|
+
return;
|
|
35530
|
+
isScroll.value = true;
|
|
35531
|
+
},
|
|
35532
|
+
true
|
|
35533
|
+
);
|
|
35534
|
+
});
|
|
35535
|
+
vue.onUnmounted(() => {
|
|
35536
|
+
window.removeEventListener("scroll", () => {
|
|
35537
|
+
});
|
|
35538
|
+
});
|
|
35539
|
+
const loadKv = () => {
|
|
35540
|
+
const columns = props2.columns;
|
|
35541
|
+
let dicData = [];
|
|
35542
|
+
columns.forEach(async (column2) => {
|
|
35543
|
+
if (column2 == null ? void 0 : column2.api) {
|
|
35544
|
+
dicData = await column2.api();
|
|
35545
|
+
column2.dicData = dicData;
|
|
35546
|
+
}
|
|
35547
|
+
});
|
|
35548
|
+
};
|
|
35549
|
+
const listFormRefs = vue.ref([]);
|
|
35550
|
+
const validate = async () => {
|
|
35551
|
+
try {
|
|
35552
|
+
for (let formRef of listFormRefs.value) {
|
|
35553
|
+
await formRef.validate();
|
|
35554
|
+
}
|
|
35555
|
+
} catch {
|
|
35556
|
+
throw new Error("校验失败");
|
|
35557
|
+
}
|
|
35558
|
+
};
|
|
35559
|
+
loadKv();
|
|
35560
|
+
__expose({ validate });
|
|
35561
|
+
return (_ctx, _cache) => {
|
|
35562
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
35563
|
+
vue.createVNode(vue.unref(antDesignVue.Table), {
|
|
35564
|
+
ref_key: "tableElRef",
|
|
35565
|
+
ref: tableElRef,
|
|
35566
|
+
columns: getColumns.value,
|
|
35567
|
+
scroll: {
|
|
35568
|
+
x: getScrollX.value
|
|
35569
|
+
},
|
|
35570
|
+
"data-source": vue.unref(state),
|
|
35571
|
+
pagination: false,
|
|
35572
|
+
bordered: "",
|
|
35573
|
+
size: "small",
|
|
35574
|
+
class: "table-children",
|
|
35575
|
+
align: "center"
|
|
35576
|
+
}, {
|
|
35577
|
+
headerCell: vue.withCtx(({ column: column2 }) => {
|
|
35578
|
+
var _a2;
|
|
35579
|
+
return [
|
|
35580
|
+
column2.required || ((_a2 = column2 == null ? void 0 : column2.rules) == null ? void 0 : _a2.length) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$6, "*")) : vue.createCommentVNode("", true),
|
|
35581
|
+
vue.createElementVNode("span", null, vue.toDisplayString(column2.title), 1)
|
|
35582
|
+
];
|
|
35583
|
+
}),
|
|
35584
|
+
bodyCell: vue.withCtx(({ column: column2, record, index: index2, ...args }) => [
|
|
35585
|
+
column2.dataIndex !== "index" && column2.type !== "text" && column2.dataIndex !== "_action" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.FormItem), {
|
|
35586
|
+
required: column2.required,
|
|
35587
|
+
rules: getRules({ column: column2, record, index: index2, ...args }),
|
|
35588
|
+
name: [_ctx.$attrs.codeField, index2, column2.dataIndex],
|
|
35589
|
+
key: record[__props.rowKey]
|
|
35590
|
+
}, {
|
|
35591
|
+
default: vue.withCtx(() => {
|
|
35592
|
+
var _a2;
|
|
35593
|
+
return [
|
|
35594
|
+
vue.createVNode(vue.unref(antDesignVue.Popover), {
|
|
35595
|
+
overlayClassName: "table-children-err-popover",
|
|
35596
|
+
visible: !!((_a2 = rulesRef == null ? void 0 : rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a2.show) && !isScroll.value
|
|
35597
|
+
}, {
|
|
35598
|
+
content: vue.withCtx(() => {
|
|
35599
|
+
var _a3;
|
|
35600
|
+
return [
|
|
35601
|
+
vue.createElementVNode("span", _hoisted_2$3, vue.toDisplayString((_a3 = rulesRef[`${column2.dataIndex}-${record[props2.rowKey]}Info`]) == null ? void 0 : _a3.msg), 1)
|
|
35602
|
+
];
|
|
35603
|
+
}),
|
|
35604
|
+
default: vue.withCtx(() => [
|
|
35605
|
+
column2.type === "select" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Select), {
|
|
35606
|
+
key: 0,
|
|
35607
|
+
value: record[column2.dataIndex],
|
|
35608
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35609
|
+
options: column2.dicData,
|
|
35610
|
+
mode: column2.mode,
|
|
35611
|
+
"max-tag-count": column2.maxTagCount,
|
|
35612
|
+
"max-tag-text-length": column2.maxTagTextLength
|
|
35613
|
+
}, null, 8, ["value", "onUpdate:value", "options", "mode", "max-tag-count", "max-tag-text-length"])) : column2.type === "datePicker" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.DatePicker), {
|
|
35614
|
+
key: 1,
|
|
35615
|
+
value: record[column2.dataIndex],
|
|
35616
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35617
|
+
valueFormat: "YYYY-MM-DD HH:mm:ss"
|
|
35618
|
+
}, null, 8, ["value", "onUpdate:value"])) : column2.type === "number" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.InputNumber), {
|
|
35619
|
+
key: 2,
|
|
35620
|
+
value: record[column2.dataIndex],
|
|
35621
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35622
|
+
min: column2.min,
|
|
35623
|
+
max: column2.max,
|
|
35624
|
+
precision: column2.precision ?? 2
|
|
35625
|
+
}, null, 8, ["value", "onUpdate:value", "min", "max", "precision"])) : column2.type === "input" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), {
|
|
35626
|
+
key: 3,
|
|
35627
|
+
value: record[column2.dataIndex],
|
|
35628
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event,
|
|
35629
|
+
disabled: !props2.isShowAction
|
|
35630
|
+
}, null, 8, ["value", "onUpdate:value", "disabled"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(ShyComponentMap).get(column2.type)), vue.mergeProps(
|
|
35631
|
+
{
|
|
35632
|
+
key: 4,
|
|
35633
|
+
allowClear: "",
|
|
35634
|
+
getPopupContainer: getPopupContainer2,
|
|
35635
|
+
style: { width: "100%" }
|
|
35636
|
+
},
|
|
35637
|
+
vue.unref(utils.isFunction)(column2.componentProps) ? column2.componentProps({ record, column: column2, index: index2, ...args }) : column2.componentProps,
|
|
35638
|
+
{
|
|
35639
|
+
value: record[column2.dataIndex],
|
|
35640
|
+
"onUpdate:value": ($event) => record[column2.dataIndex] = $event
|
|
35641
|
+
}
|
|
35642
|
+
), null, 16, ["value", "onUpdate:value"]))
|
|
35643
|
+
]),
|
|
35644
|
+
_: 2
|
|
35645
|
+
}, 1032, ["visible"])
|
|
35646
|
+
];
|
|
35647
|
+
}),
|
|
35648
|
+
_: 2
|
|
35649
|
+
}, 1032, ["required", "rules", "name"])) : vue.createCommentVNode("", true),
|
|
35650
|
+
column2.dataIndex === "_action" ? (vue.openBlock(), vue.createBlock(vue.unref(ShyTableAction), {
|
|
35651
|
+
key: 1,
|
|
35652
|
+
actions: getActions(record)
|
|
35653
|
+
}, null, 8, ["actions"])) : vue.createCommentVNode("", true)
|
|
35654
|
+
]),
|
|
35655
|
+
_: 1
|
|
35656
|
+
}, 8, ["columns", "scroll", "data-source"]),
|
|
35657
|
+
vue.createElementVNode("div", _hoisted_3$2, [
|
|
35658
|
+
vue.createVNode(vue.unref(BasicButton), {
|
|
35659
|
+
onClick: plusClickEvent,
|
|
35660
|
+
type: "dashed"
|
|
35661
|
+
}, {
|
|
35662
|
+
default: vue.withCtx(() => [
|
|
35663
|
+
vue.createTextVNode(" 新增 ")
|
|
35664
|
+
]),
|
|
35665
|
+
_: 1
|
|
35666
|
+
})
|
|
35667
|
+
]),
|
|
35668
|
+
vue.createElementVNode("div", _hoisted_4$2, [
|
|
35669
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.h("span", null, __props.footerRender()))))
|
|
35670
|
+
])
|
|
35671
|
+
], 64);
|
|
35672
|
+
};
|
|
35673
|
+
}
|
|
35674
|
+
});
|
|
35675
|
+
const Table_vue_vue_type_style_index_0_scoped_d3bdc269_lang = "";
|
|
35676
|
+
const Table = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-d3bdc269"]]);
|
|
35232
35677
|
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
35233
35678
|
__name: "DeptTree",
|
|
35234
35679
|
props: {
|
|
@@ -39310,7 +39755,6 @@ const ShyTableAction = /* @__PURE__ */ vue.defineComponent({
|
|
|
39310
39755
|
};
|
|
39311
39756
|
}
|
|
39312
39757
|
});
|
|
39313
|
-
const ShyTableAction$1 = ShyTableAction;
|
|
39314
39758
|
function useShyTable(tableProps) {
|
|
39315
39759
|
const tableRef = vue.ref(null);
|
|
39316
39760
|
const loadedRef = vue.ref(false);
|
|
@@ -39666,8 +40110,7 @@ const _hoisted_4 = {
|
|
|
39666
40110
|
class: "process-item"
|
|
39667
40111
|
};
|
|
39668
40112
|
const _hoisted_5 = { key: 0 };
|
|
39669
|
-
const _hoisted_6 = { key:
|
|
39670
|
-
const _hoisted_7 = { key: 2 };
|
|
40113
|
+
const _hoisted_6 = { key: 2 };
|
|
39671
40114
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
39672
40115
|
__name: "Process",
|
|
39673
40116
|
props: {
|
|
@@ -39756,9 +40199,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
39756
40199
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: _cIndex }, [
|
|
39757
40200
|
item[key2] ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
|
|
39758
40201
|
label ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5, vue.toDisplayString(label) + ":", 1)) : vue.createCommentVNode("", true),
|
|
39759
|
-
customRender ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6, [
|
|
39760
|
-
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.h("span", null, customRender(item)))))
|
|
39761
|
-
])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_7, vue.toDisplayString(item[key2]), 1))
|
|
40202
|
+
customRender ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.h("span", null, customRender(item))), { key: 1 })) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_6, vue.toDisplayString(item[key2]), 1))
|
|
39762
40203
|
])) : vue.createCommentVNode("", true)
|
|
39763
40204
|
], 64);
|
|
39764
40205
|
}), 128))
|
|
@@ -39774,8 +40215,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
39774
40215
|
};
|
|
39775
40216
|
}
|
|
39776
40217
|
});
|
|
39777
|
-
const
|
|
39778
|
-
const Process = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
40218
|
+
const Process_vue_vue_type_style_index_0_scoped_95c7693b_lang = "";
|
|
40219
|
+
const Process = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-95c7693b"]]);
|
|
39779
40220
|
exports.AdvancedSearch = _sfc_main$T;
|
|
39780
40221
|
exports.ApiCascader = ApiCascader$1;
|
|
39781
40222
|
exports.ApiModalSelect = ApiModalSelect$1;
|
|
@@ -39833,11 +40274,11 @@ exports.ShyApiTreeSelect = ApiTreeSelect;
|
|
|
39833
40274
|
exports.ShyComponentMap = ShyComponentMap;
|
|
39834
40275
|
exports.ShyContainer = ShyContainer;
|
|
39835
40276
|
exports.ShyForm = ShyForm;
|
|
39836
|
-
exports.ShyFormItem = _sfc_main$
|
|
40277
|
+
exports.ShyFormItem = _sfc_main$d;
|
|
39837
40278
|
exports.ShyFormWrapper = _sfc_main$6;
|
|
39838
40279
|
exports.ShyRadioButtonGroup = RadioButtonGroup;
|
|
39839
40280
|
exports.ShyTable = ShyTable;
|
|
39840
|
-
exports.ShyTableAction = ShyTableAction
|
|
40281
|
+
exports.ShyTableAction = ShyTableAction;
|
|
39841
40282
|
exports.ShyTableChildren = Table;
|
|
39842
40283
|
exports.StrengthMeter = StrengthMeter;
|
|
39843
40284
|
exports.SvgIcon = SvgIcon;
|