knt-shared 1.2.5 → 1.2.6
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/components/Form/BasicForm.vue.d.ts +167 -0
- package/dist/components/Form/BasicForm.vue.d.ts.map +1 -0
- package/dist/components/Form/componentMap.d.ts +3 -8
- package/dist/components/Form/componentMap.d.ts.map +1 -1
- package/dist/components/Form/index.d.ts +5 -7
- package/dist/components/Form/index.d.ts.map +1 -1
- package/dist/components/Form/types.d.ts +5 -4
- package/dist/components/Form/types.d.ts.map +1 -1
- package/dist/components/Upload/BasicUpload.vue.d.ts +1 -1
- package/dist/components/Upload/types.d.ts +3 -3
- package/dist/components/Upload/types.d.ts.map +1 -1
- package/dist/index.cjs.js +101 -101
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +101 -101
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +23 -23
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -709,7 +709,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
709
709
|
emits: ["register", "update:modelValue", "change", "success", "handleSuccess", "error", "handlError", "progress", "remove", "preview", "exceed"],
|
|
710
710
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
711
711
|
useCssVars((_ctx) => ({
|
|
712
|
-
"
|
|
712
|
+
"f530bac6": cardSizeValue.value
|
|
713
713
|
}));
|
|
714
714
|
const props = __props;
|
|
715
715
|
const emit = __emit;
|
|
@@ -941,7 +941,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
941
941
|
fileListRef.value = fileList;
|
|
942
942
|
emit("change", fileList);
|
|
943
943
|
const isRemove = newLength < oldLength;
|
|
944
|
-
const fileKey = currentFile.uid
|
|
944
|
+
const fileKey = currentFile.uid || `file-${Date.now()}-${Math.random()}`;
|
|
945
945
|
const lastStatus = processedFiles.value.get(fileKey);
|
|
946
946
|
if (currentFile.status === "done" && lastStatus !== "done" && !isRemove) {
|
|
947
947
|
processedFiles.value.set(fileKey, "done");
|
|
@@ -1181,7 +1181,103 @@ const _export_sfc = (sfc, props) => {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
return target;
|
|
1183
1183
|
};
|
|
1184
|
-
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
1184
|
+
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-03d56780"]]);
|
|
1185
|
+
function useUpload(props) {
|
|
1186
|
+
const uploadRef = ref(null);
|
|
1187
|
+
const fileListRef = ref((props == null ? void 0 : props.defaultFileList) || []);
|
|
1188
|
+
const register = (uploadInstance) => {
|
|
1189
|
+
uploadRef.value = uploadInstance;
|
|
1190
|
+
if ((props == null ? void 0 : props.defaultFileList) && props.defaultFileList.length > 0) {
|
|
1191
|
+
uploadInstance.setFileList(props.defaultFileList);
|
|
1192
|
+
}
|
|
1193
|
+
if (props && Object.keys(props).length > 0) {
|
|
1194
|
+
const { defaultFileList, ...restProps } = props;
|
|
1195
|
+
if (Object.keys(restProps).length > 0) {
|
|
1196
|
+
setProps(restProps);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
const getUpload = () => {
|
|
1201
|
+
const upload2 = unref(uploadRef);
|
|
1202
|
+
if (!upload2) {
|
|
1203
|
+
throw new Error('Upload 实例未注册,请确保在组件上使用 @register="register"');
|
|
1204
|
+
}
|
|
1205
|
+
return upload2;
|
|
1206
|
+
};
|
|
1207
|
+
const submit = () => {
|
|
1208
|
+
getUpload().submit();
|
|
1209
|
+
};
|
|
1210
|
+
const abort = (fileItem) => {
|
|
1211
|
+
getUpload().abort(fileItem);
|
|
1212
|
+
};
|
|
1213
|
+
const clearFiles = () => {
|
|
1214
|
+
getUpload().clearFiles();
|
|
1215
|
+
fileListRef.value = [];
|
|
1216
|
+
};
|
|
1217
|
+
const getFileList = () => {
|
|
1218
|
+
return getUpload().getFileList();
|
|
1219
|
+
};
|
|
1220
|
+
const upload = (fileItem) => {
|
|
1221
|
+
getUpload().upload(fileItem);
|
|
1222
|
+
};
|
|
1223
|
+
const setFileList = (files) => {
|
|
1224
|
+
fileListRef.value = files;
|
|
1225
|
+
const upload2 = getUpload();
|
|
1226
|
+
if (upload2.setFileList) {
|
|
1227
|
+
upload2.setFileList(files);
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
const addFile = (file) => {
|
|
1231
|
+
fileListRef.value.push(file);
|
|
1232
|
+
const upload2 = getUpload();
|
|
1233
|
+
if (upload2.addFile) {
|
|
1234
|
+
upload2.addFile(file);
|
|
1235
|
+
}
|
|
1236
|
+
};
|
|
1237
|
+
const removeFile = (fileItem) => {
|
|
1238
|
+
const index = fileListRef.value.findIndex(
|
|
1239
|
+
(item) => item.uid === fileItem.uid
|
|
1240
|
+
);
|
|
1241
|
+
if (index !== -1) {
|
|
1242
|
+
fileListRef.value.splice(index, 1);
|
|
1243
|
+
}
|
|
1244
|
+
const upload2 = getUpload();
|
|
1245
|
+
if (upload2.removeFile) {
|
|
1246
|
+
upload2.removeFile(fileItem);
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
const updateFile = (fileItem) => {
|
|
1250
|
+
const index = fileListRef.value.findIndex(
|
|
1251
|
+
(item) => item.uid === fileItem.uid
|
|
1252
|
+
);
|
|
1253
|
+
if (index !== -1) {
|
|
1254
|
+
fileListRef.value[index] = { ...fileListRef.value[index], ...fileItem };
|
|
1255
|
+
}
|
|
1256
|
+
const upload2 = getUpload();
|
|
1257
|
+
if (upload2.updateFile) {
|
|
1258
|
+
upload2.updateFile(fileItem);
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
const setProps = (uploadProps) => {
|
|
1262
|
+
getUpload().setProps(uploadProps);
|
|
1263
|
+
};
|
|
1264
|
+
const methods = {
|
|
1265
|
+
get fileList() {
|
|
1266
|
+
return fileListRef.value;
|
|
1267
|
+
},
|
|
1268
|
+
submit,
|
|
1269
|
+
abort,
|
|
1270
|
+
upload,
|
|
1271
|
+
clearFiles,
|
|
1272
|
+
getFileList,
|
|
1273
|
+
setFileList,
|
|
1274
|
+
addFile,
|
|
1275
|
+
removeFile,
|
|
1276
|
+
updateFile,
|
|
1277
|
+
setProps
|
|
1278
|
+
};
|
|
1279
|
+
return [register, methods];
|
|
1280
|
+
}
|
|
1185
1281
|
const componentMap = {
|
|
1186
1282
|
Input,
|
|
1187
1283
|
InputNumber,
|
|
@@ -3622,7 +3718,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3622
3718
|
watch(
|
|
3623
3719
|
() => getProps.value.visible,
|
|
3624
3720
|
(val) => {
|
|
3625
|
-
visibleRef.value = val;
|
|
3721
|
+
visibleRef.value = val ?? false;
|
|
3626
3722
|
},
|
|
3627
3723
|
{ immediate: true }
|
|
3628
3724
|
);
|
|
@@ -3781,7 +3877,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3781
3877
|
};
|
|
3782
3878
|
}
|
|
3783
3879
|
});
|
|
3784
|
-
const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
3880
|
+
const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-68fed17a"]]);
|
|
3785
3881
|
function useModal(props) {
|
|
3786
3882
|
const modalRef = ref(null);
|
|
3787
3883
|
const loadedRef = ref(false);
|
|
@@ -4163,102 +4259,6 @@ function useDescription(props) {
|
|
|
4163
4259
|
}
|
|
4164
4260
|
];
|
|
4165
4261
|
}
|
|
4166
|
-
function useUpload(props) {
|
|
4167
|
-
const uploadRef = ref(null);
|
|
4168
|
-
const fileListRef = ref((props == null ? void 0 : props.defaultFileList) || []);
|
|
4169
|
-
const register = (uploadInstance) => {
|
|
4170
|
-
uploadRef.value = uploadInstance;
|
|
4171
|
-
if ((props == null ? void 0 : props.defaultFileList) && props.defaultFileList.length > 0) {
|
|
4172
|
-
uploadInstance.setFileList(props.defaultFileList);
|
|
4173
|
-
}
|
|
4174
|
-
if (props && Object.keys(props).length > 0) {
|
|
4175
|
-
const { defaultFileList, ...restProps } = props;
|
|
4176
|
-
if (Object.keys(restProps).length > 0) {
|
|
4177
|
-
setProps(restProps);
|
|
4178
|
-
}
|
|
4179
|
-
}
|
|
4180
|
-
};
|
|
4181
|
-
const getUpload = () => {
|
|
4182
|
-
const upload2 = unref(uploadRef);
|
|
4183
|
-
if (!upload2) {
|
|
4184
|
-
throw new Error('Upload 实例未注册,请确保在组件上使用 @register="register"');
|
|
4185
|
-
}
|
|
4186
|
-
return upload2;
|
|
4187
|
-
};
|
|
4188
|
-
const submit = () => {
|
|
4189
|
-
getUpload().submit();
|
|
4190
|
-
};
|
|
4191
|
-
const abort = (fileItem) => {
|
|
4192
|
-
getUpload().abort(fileItem);
|
|
4193
|
-
};
|
|
4194
|
-
const clearFiles = () => {
|
|
4195
|
-
getUpload().clearFiles();
|
|
4196
|
-
fileListRef.value = [];
|
|
4197
|
-
};
|
|
4198
|
-
const getFileList = () => {
|
|
4199
|
-
return getUpload().getFileList();
|
|
4200
|
-
};
|
|
4201
|
-
const upload = (fileItem) => {
|
|
4202
|
-
getUpload().upload(fileItem);
|
|
4203
|
-
};
|
|
4204
|
-
const setFileList = (files) => {
|
|
4205
|
-
fileListRef.value = files;
|
|
4206
|
-
const upload2 = getUpload();
|
|
4207
|
-
if (upload2.setFileList) {
|
|
4208
|
-
upload2.setFileList(files);
|
|
4209
|
-
}
|
|
4210
|
-
};
|
|
4211
|
-
const addFile = (file) => {
|
|
4212
|
-
fileListRef.value.push(file);
|
|
4213
|
-
const upload2 = getUpload();
|
|
4214
|
-
if (upload2.addFile) {
|
|
4215
|
-
upload2.addFile(file);
|
|
4216
|
-
}
|
|
4217
|
-
};
|
|
4218
|
-
const removeFile = (fileItem) => {
|
|
4219
|
-
const index = fileListRef.value.findIndex(
|
|
4220
|
-
(item) => item.uid === fileItem.uid
|
|
4221
|
-
);
|
|
4222
|
-
if (index !== -1) {
|
|
4223
|
-
fileListRef.value.splice(index, 1);
|
|
4224
|
-
}
|
|
4225
|
-
const upload2 = getUpload();
|
|
4226
|
-
if (upload2.removeFile) {
|
|
4227
|
-
upload2.removeFile(fileItem);
|
|
4228
|
-
}
|
|
4229
|
-
};
|
|
4230
|
-
const updateFile = (fileItem) => {
|
|
4231
|
-
const index = fileListRef.value.findIndex(
|
|
4232
|
-
(item) => item.uid === fileItem.uid
|
|
4233
|
-
);
|
|
4234
|
-
if (index !== -1) {
|
|
4235
|
-
fileListRef.value[index] = { ...fileListRef.value[index], ...fileItem };
|
|
4236
|
-
}
|
|
4237
|
-
const upload2 = getUpload();
|
|
4238
|
-
if (upload2.updateFile) {
|
|
4239
|
-
upload2.updateFile(fileItem);
|
|
4240
|
-
}
|
|
4241
|
-
};
|
|
4242
|
-
const setProps = (uploadProps) => {
|
|
4243
|
-
getUpload().setProps(uploadProps);
|
|
4244
|
-
};
|
|
4245
|
-
const methods = {
|
|
4246
|
-
get fileList() {
|
|
4247
|
-
return fileListRef.value;
|
|
4248
|
-
},
|
|
4249
|
-
submit,
|
|
4250
|
-
abort,
|
|
4251
|
-
upload,
|
|
4252
|
-
clearFiles,
|
|
4253
|
-
getFileList,
|
|
4254
|
-
setFileList,
|
|
4255
|
-
addFile,
|
|
4256
|
-
removeFile,
|
|
4257
|
-
updateFile,
|
|
4258
|
-
setProps
|
|
4259
|
-
};
|
|
4260
|
-
return [register, methods];
|
|
4261
|
-
}
|
|
4262
4262
|
function formatDate(date, format = "YYYY-MM-DD HH:mm:ss") {
|
|
4263
4263
|
const d = typeof date === "number" ? new Date(date) : date;
|
|
4264
4264
|
const year = d.getFullYear();
|