@dt-frames/ui 1.0.16 → 1.0.20
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/components/curd/src/components/dialog.d.ts +1 -0
- package/es/components/table/src/components/editable/EditTableCell.d.ts +3 -0
- package/es/components/table/src/components/editable/index.d.ts +1 -1
- package/es/components/table/src/index.d.ts +3 -0
- package/es/components/table/src/types/table.type.d.ts +2 -0
- package/es/components/upload/src/upload.d.ts +3 -0
- package/es/index.js +49 -22
- package/es/style/components/table/index.less +4 -0
- package/package.json +1 -1
- package/es/components/upload/src/index.d.ts +0 -2811
|
@@ -90,6 +90,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
90
90
|
registerForm: (formInstance: import("../../../forms").FormActionType) => void;
|
|
91
91
|
getFormValues: () => Recordable<any>;
|
|
92
92
|
setFormValues: (values: Recordable<any>) => Promise<void>;
|
|
93
|
+
validate: (nameList?: (string | number)[]) => Promise<any>;
|
|
93
94
|
handleSave: () => void;
|
|
94
95
|
DtForm: import("vue").DefineComponent<{
|
|
95
96
|
mode: {
|
|
@@ -24,6 +24,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
24
24
|
default: () => BasicColumn;
|
|
25
25
|
};
|
|
26
26
|
index: NumberConstructor;
|
|
27
|
+
dataSource: PropType<Recordable<any>[]>;
|
|
27
28
|
}, {
|
|
28
29
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
29
30
|
value: {
|
|
@@ -48,6 +49,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
48
49
|
default: () => BasicColumn;
|
|
49
50
|
};
|
|
50
51
|
index: NumberConstructor;
|
|
52
|
+
dataSource: PropType<Recordable<any>[]>;
|
|
51
53
|
}>> & {
|
|
52
54
|
[x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any);
|
|
53
55
|
}>>;
|
|
@@ -81,6 +83,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
81
83
|
default: () => BasicColumn;
|
|
82
84
|
};
|
|
83
85
|
index: NumberConstructor;
|
|
86
|
+
dataSource: PropType<Recordable<any>[]>;
|
|
84
87
|
}>>, {
|
|
85
88
|
value: string;
|
|
86
89
|
column: BasicColumn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BasicColumn } from "../../types/table.type";
|
|
2
|
-
declare function renderEditCell(column: BasicColumn): ({ text: value, record, index }: {
|
|
2
|
+
declare function renderEditCell(column: BasicColumn, dataSource: any): ({ text: value, record, index }: {
|
|
3
3
|
text: any;
|
|
4
4
|
record: any;
|
|
5
5
|
index: any;
|
|
@@ -268,6 +268,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
268
268
|
rowKey: string;
|
|
269
269
|
columns: import("./types/table.type").BasicColumn[];
|
|
270
270
|
tableLayout: string;
|
|
271
|
+
class: (string | {
|
|
272
|
+
'dt-table-no-pagation': boolean;
|
|
273
|
+
})[];
|
|
271
274
|
customRow: (record: Recordable<any>, index: number) => {
|
|
272
275
|
onClick: (e: any) => void;
|
|
273
276
|
onDblclick: (event: Event) => void;
|
|
@@ -1284,6 +1284,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
1284
1284
|
rowKey: string;
|
|
1285
1285
|
columns: import("../../table/src/types/table.type").BasicColumn[];
|
|
1286
1286
|
tableLayout: string;
|
|
1287
|
+
class: (string | {
|
|
1288
|
+
'dt-table-no-pagation': boolean;
|
|
1289
|
+
})[];
|
|
1287
1290
|
customRow: (record: import("@dt-frames/core").Recordable<any>, index: number) => {
|
|
1288
1291
|
onClick: (e: any) => void;
|
|
1289
1292
|
onDblclick: (event: Event) => void;
|
package/es/index.js
CHANGED
|
@@ -3044,11 +3044,7 @@ var _sfc_main$P = defineComponent({
|
|
|
3044
3044
|
props: cProps = {}
|
|
3045
3045
|
} = schema2;
|
|
3046
3046
|
if (isFunction(cProps)) {
|
|
3047
|
-
cProps = (_a = cProps({
|
|
3048
|
-
schema: schema2,
|
|
3049
|
-
formModel,
|
|
3050
|
-
formActionType
|
|
3051
|
-
})) != null ? _a : {};
|
|
3047
|
+
cProps = (_a = cProps(formModel)) != null ? _a : {};
|
|
3052
3048
|
}
|
|
3053
3049
|
if (schema2.component === "Divider") {
|
|
3054
3050
|
cProps = Object.assign({
|
|
@@ -3312,7 +3308,7 @@ var _sfc_main$P = defineComponent({
|
|
|
3312
3308
|
error("\u8BF7\u914D\u7F6Erender\u51FD\u6570");
|
|
3313
3309
|
return;
|
|
3314
3310
|
}
|
|
3315
|
-
return createVNode(Col, {
|
|
3311
|
+
return unref(getShow) && createVNode(Col, {
|
|
3316
3312
|
"span": 24
|
|
3317
3313
|
}, _isSlot(_slot2 = render2(values)) ? _slot2 : {
|
|
3318
3314
|
default: () => [_slot2]
|
|
@@ -3777,7 +3773,7 @@ function useFormValues({
|
|
|
3777
3773
|
const obj = {};
|
|
3778
3774
|
schema.forEach((item) => {
|
|
3779
3775
|
const { props = {}, name, component } = item;
|
|
3780
|
-
let { defaultValue: defaultValue2, mode, format, treeCheckable } = isFunction(props) ? props() : props;
|
|
3776
|
+
let { defaultValue: defaultValue2, mode, format, treeCheckable } = isFunction(props) ? props({ formModel }) : props;
|
|
3781
3777
|
const names = isString(name) ? [name] : name;
|
|
3782
3778
|
if (defaultValue2 !== null && defaultValue2 !== void 0) {
|
|
3783
3779
|
if (datePickerType.includes(component)) {
|
|
@@ -5223,7 +5219,11 @@ var _sfc_main$J = defineComponent({
|
|
|
5223
5219
|
}
|
|
5224
5220
|
if (isFunction(render2)) {
|
|
5225
5221
|
let afterRenderData = render2(record, index, text);
|
|
5226
|
-
|
|
5222
|
+
if (afterRenderData.__v_isRef) {
|
|
5223
|
+
renderText = afterRenderData;
|
|
5224
|
+
} else {
|
|
5225
|
+
renderText.value = isVnode(afterRenderData) ? createVNode(Fragment, null, [afterRenderData]) : afterRenderData;
|
|
5226
|
+
}
|
|
5227
5227
|
}
|
|
5228
5228
|
}
|
|
5229
5229
|
renderCell();
|
|
@@ -5284,7 +5284,8 @@ var _sfc_main$I = defineComponent({
|
|
|
5284
5284
|
type: Object,
|
|
5285
5285
|
default: () => ({})
|
|
5286
5286
|
},
|
|
5287
|
-
index: Number
|
|
5287
|
+
index: Number,
|
|
5288
|
+
dataSource: Array
|
|
5288
5289
|
},
|
|
5289
5290
|
setup(props) {
|
|
5290
5291
|
const table = getTableInstance();
|
|
@@ -5317,6 +5318,9 @@ var _sfc_main$I = defineComponent({
|
|
|
5317
5318
|
}
|
|
5318
5319
|
return "\u8BF7\u9009\u62E9";
|
|
5319
5320
|
};
|
|
5321
|
+
const setTableValue = () => {
|
|
5322
|
+
props.dataSource[props.index][props.column.dataIndex] = unref(currentValueRef);
|
|
5323
|
+
};
|
|
5320
5324
|
const getComponentProps = computed(() => {
|
|
5321
5325
|
var _a, _b, _c;
|
|
5322
5326
|
const isCheckValue = unref(getIsCheckComp);
|
|
@@ -5342,7 +5346,8 @@ var _sfc_main$I = defineComponent({
|
|
|
5342
5346
|
getPopupContainer: () => document.body,
|
|
5343
5347
|
placeholder: createPlaceholderMessage(unref(getComponent)),
|
|
5344
5348
|
...omit(compProps, "onChange"),
|
|
5345
|
-
[valueField]: value
|
|
5349
|
+
[valueField]: value,
|
|
5350
|
+
onBlur: setTableValue
|
|
5346
5351
|
};
|
|
5347
5352
|
});
|
|
5348
5353
|
async function handleChange(e) {
|
|
@@ -5362,10 +5367,14 @@ var _sfc_main$I = defineComponent({
|
|
|
5362
5367
|
const onChange = (_a = unref(getComponentProps)) == null ? void 0 : _a.onChange;
|
|
5363
5368
|
if (onChange && isFunction$1(onChange))
|
|
5364
5369
|
onChange(...arguments);
|
|
5370
|
+
if (!["Input", "InputNumber"].includes(props.column.editComponent)) {
|
|
5371
|
+
setTableValue();
|
|
5372
|
+
}
|
|
5365
5373
|
(_b = table.emit) == null ? void 0 : _b.call(table, "edit-change", {
|
|
5366
5374
|
column: props.column,
|
|
5367
5375
|
value: unref(currentValueRef),
|
|
5368
|
-
record: toRaw(props.record)
|
|
5376
|
+
record: toRaw(props.record),
|
|
5377
|
+
index: props.index
|
|
5369
5378
|
});
|
|
5370
5379
|
handleSubmitRule();
|
|
5371
5380
|
}
|
|
@@ -5429,7 +5438,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
5429
5438
|
]);
|
|
5430
5439
|
}
|
|
5431
5440
|
var EditableCell = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$3]]);
|
|
5432
|
-
function renderEditCell(column) {
|
|
5441
|
+
function renderEditCell(column, dataSource) {
|
|
5433
5442
|
return ({ text: value, record, index }) => {
|
|
5434
5443
|
record.onValid = async () => {
|
|
5435
5444
|
if (isArray$1(record == null ? void 0 : record.validCbs)) {
|
|
@@ -5463,7 +5472,8 @@ function renderEditCell(column) {
|
|
|
5463
5472
|
value,
|
|
5464
5473
|
record,
|
|
5465
5474
|
column,
|
|
5466
|
-
index
|
|
5475
|
+
index,
|
|
5476
|
+
dataSource
|
|
5467
5477
|
});
|
|
5468
5478
|
};
|
|
5469
5479
|
}
|
|
@@ -5731,7 +5741,7 @@ function useColumns(propsRef, getPaginationRef) {
|
|
|
5731
5741
|
const columns = cloneDeep(viewColumns);
|
|
5732
5742
|
return columns.filter((column) => isIfShow(column)).map((column) => {
|
|
5733
5743
|
if (column.edit) {
|
|
5734
|
-
column.customRender = renderEditCell(column);
|
|
5744
|
+
column.customRender = renderEditCell(column, unref(propsRef).dataSource);
|
|
5735
5745
|
}
|
|
5736
5746
|
return column;
|
|
5737
5747
|
});
|
|
@@ -6725,6 +6735,12 @@ const _sfc_main$A = defineComponent({
|
|
|
6725
6735
|
const getProps = computed(() => {
|
|
6726
6736
|
return { ...props, ...unref(innerPropsRef) };
|
|
6727
6737
|
});
|
|
6738
|
+
const tableClass = computed(() => {
|
|
6739
|
+
return [
|
|
6740
|
+
"dt-table",
|
|
6741
|
+
{ "dt-table-no-pagation": !unref(getProps).pagination }
|
|
6742
|
+
];
|
|
6743
|
+
});
|
|
6728
6744
|
const { getLoading, setLoading } = useLoading(getProps);
|
|
6729
6745
|
const { getPaginationInfo, setPagination, getPagination, getShowPagination, setShowPagination } = usePagination(getProps);
|
|
6730
6746
|
const {
|
|
@@ -6791,6 +6807,7 @@ const _sfc_main$A = defineComponent({
|
|
|
6791
6807
|
rowKey: unref(getProps).rowKey,
|
|
6792
6808
|
columns: unref(getViewColumns),
|
|
6793
6809
|
tableLayout: "fixed",
|
|
6810
|
+
class: unref(tableClass),
|
|
6794
6811
|
customRow
|
|
6795
6812
|
};
|
|
6796
6813
|
});
|
|
@@ -6820,10 +6837,7 @@ const _sfc_main$A = defineComponent({
|
|
|
6820
6837
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6821
6838
|
const _component_TableRender = resolveComponent("TableRender");
|
|
6822
6839
|
const _component_Table = resolveComponent("Table");
|
|
6823
|
-
return openBlock(), createBlock(_component_Table, mergeProps({
|
|
6824
|
-
ref: "tableElRef",
|
|
6825
|
-
class: "dt-table"
|
|
6826
|
-
}, _ctx.getBind, {
|
|
6840
|
+
return openBlock(), createBlock(_component_Table, mergeProps({ ref: "tableElRef" }, _ctx.getBind, {
|
|
6827
6841
|
rowClassName: _ctx.getRowClassName,
|
|
6828
6842
|
onChange: _ctx.handleTableChange,
|
|
6829
6843
|
onResizeColumn: _ctx.handleResizeColumn
|
|
@@ -6970,6 +6984,8 @@ function useSource(opt) {
|
|
|
6970
6984
|
search();
|
|
6971
6985
|
}
|
|
6972
6986
|
function search() {
|
|
6987
|
+
if (!queryPage)
|
|
6988
|
+
return;
|
|
6973
6989
|
const { fetch } = useFetch(queryPage, baseUrl);
|
|
6974
6990
|
loading.onQuerypage.value = true;
|
|
6975
6991
|
fetch(toRaw(baseData)).then((rsp) => {
|
|
@@ -6992,6 +7008,8 @@ function useSource(opt) {
|
|
|
6992
7008
|
});
|
|
6993
7009
|
}
|
|
6994
7010
|
function onAdd(model) {
|
|
7011
|
+
if (!add)
|
|
7012
|
+
return;
|
|
6995
7013
|
const { fetch } = useFetch(add, baseUrl);
|
|
6996
7014
|
return fetch(model, false).then((rsp) => {
|
|
6997
7015
|
if ((rsp == null ? void 0 : rsp.code) === 0)
|
|
@@ -7000,10 +7018,14 @@ function useSource(opt) {
|
|
|
7000
7018
|
});
|
|
7001
7019
|
}
|
|
7002
7020
|
async function onQueryById(id) {
|
|
7021
|
+
if (!queryById)
|
|
7022
|
+
return;
|
|
7003
7023
|
const { fetch } = useFetch(queryById, baseUrl);
|
|
7004
7024
|
return await fetch({ id });
|
|
7005
7025
|
}
|
|
7006
7026
|
function onUpdate(model) {
|
|
7027
|
+
if (!update)
|
|
7028
|
+
return;
|
|
7007
7029
|
const { fetch } = useFetch(update, baseUrl);
|
|
7008
7030
|
return fetch(model, false).then((rsp) => {
|
|
7009
7031
|
if ((rsp == null ? void 0 : rsp.code) === 0)
|
|
@@ -7012,6 +7034,8 @@ function useSource(opt) {
|
|
|
7012
7034
|
});
|
|
7013
7035
|
}
|
|
7014
7036
|
function onDeletes(ids) {
|
|
7037
|
+
if (!deletes)
|
|
7038
|
+
return;
|
|
7015
7039
|
const { fetch } = useFetch(deletes, baseUrl);
|
|
7016
7040
|
fetch(toRaw(ids), false).then((rsp) => {
|
|
7017
7041
|
if ((rsp == null ? void 0 : rsp.code) === 0)
|
|
@@ -7112,7 +7136,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
7112
7136
|
]),
|
|
7113
7137
|
destroyOnClose: true
|
|
7114
7138
|
});
|
|
7115
|
-
const [registerForm, { getFormValues, setFormValues }] = useForm({
|
|
7139
|
+
const [registerForm, { getFormValues, setFormValues, validate }] = useForm({
|
|
7116
7140
|
...props.formProps || {},
|
|
7117
7141
|
schemas: props.schemas,
|
|
7118
7142
|
mode: "dialog"
|
|
@@ -7126,8 +7150,11 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
7126
7150
|
var _a;
|
|
7127
7151
|
if (props.curd && isFunction((_a = props.curd) == null ? void 0 : _a.onAdd)) {
|
|
7128
7152
|
let obj = Object.assign({}, props.formsVal.value || {}, getFormValues());
|
|
7129
|
-
|
|
7130
|
-
|
|
7153
|
+
validate().then((rsp) => {
|
|
7154
|
+
let pro = obj.id ? props.curd.onUpdate(obj) : props.curd.onAdd(obj);
|
|
7155
|
+
pro == null ? void 0 : pro.then((rsp2) => closeModal());
|
|
7156
|
+
}).catch((err) => {
|
|
7157
|
+
});
|
|
7131
7158
|
}
|
|
7132
7159
|
}
|
|
7133
7160
|
return (_ctx, _cache) => {
|
|
@@ -8785,7 +8812,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
8785
8812
|
},
|
|
8786
8813
|
setup(__props) {
|
|
8787
8814
|
const props = __props;
|
|
8788
|
-
const title = "\u9686\u57FA\
|
|
8815
|
+
const title = "\u9686\u57FA\u96C6\u56E2\u6D77\u5916\u7A0E\u52A1\u7CFB\u7EDF";
|
|
8789
8816
|
const { getCollapsedShowTitle } = useMenu();
|
|
8790
8817
|
const getLogoClass = computed(() => {
|
|
8791
8818
|
return [
|