sakura-ui-plus 1.0.1 → 1.0.3
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/index.js +528 -64
- package/dist/lib/index.js +522 -58
- package/dist/style.css +337 -0
- package/dist/types/components/index.d.ts +148 -4
- package/dist/types/components/page-container/page-container.vue.d.ts +30 -0
- package/dist/types/components/page-container/props.d.ts +15 -0
- package/dist/types/components/popconfirm-switch/popconfirm-switch.vue.d.ts +42 -0
- package/dist/types/components/popconfirm-switch/props.d.ts +25 -0
- package/dist/types/components/register-components.d.ts +32 -17
- package/dist/types/components/search-input/props.d.ts +1 -1
- package/dist/types/components/search-input/search-input.vue.d.ts +2 -2
- package/dist/types/components/select/select.vue.d.ts +2 -2
- package/dist/types/components/upload/props.d.ts +30 -0
- package/dist/types/components/upload/upload.vue.d.ts +18 -0
- package/dist/types/components/upload/use-upload.d.ts +8 -0
- package/dist/types/components/upload/utils.d.ts +6 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/use-form-validate/index.d.ts +366 -0
- package/dist/types/hooks/use-visible-value/index.d.ts +8 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +2 -6
- package/dist/types/utils/rules/index.d.ts +5 -0
- package/dist/types/utils/rules/regex.d.ts +8 -0
- package/dist/types/utils/rules/type/type.d.ts +13 -0
- package/dist/types/utils/rules/type.d.ts +10 -0
- package/dist/types/utils/rules/utils.d.ts +7 -0
- package/dist/types/utils/rules/validator.d.ts +16 -0
- package/dist/types/utils/utils.d.ts +6 -0
- package/package.json +1 -1
package/dist/es/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { unref, getCurrentInstance, defineComponent, mergeModels, computed, useModel, openBlock, createBlock, withCtx, createElementVNode, mergeProps, resolveDynamicComponent, createSlots, renderSlot, createElementBlock, Fragment, renderList, inject, normalizeClass, toDisplayString, createTextVNode, provide,
|
|
2
|
-
import {
|
|
3
|
-
import { ElLoading, ElMessage, ElMessageBox, ElNotification, ElSelectV2, ElSelect, ElConfigProvider, ElOption, ElPagination, CHANGE_EVENT, ElInput, ElButton, ElTabs, ElTabPane, ElTooltip, ElDialog, ElIcon, ElScrollbar, ElDrawer } from "element-plus";
|
|
1
|
+
import { unref, getCurrentInstance, ref, nextTick, reactive, defineComponent, mergeModels, computed, useModel, openBlock, createBlock, withCtx, createElementVNode, mergeProps, resolveDynamicComponent, createSlots, renderSlot, createElementBlock, Fragment, renderList, inject, normalizeClass, toDisplayString, createTextVNode, provide, toRef, createCommentVNode, createVNode, withKeys, useTemplateRef, onMounted, onUnmounted, normalizeStyle, withModifiers, render } from "vue";
|
|
2
|
+
import { sleep, isEmpty, keysOf, isString, isArray, addUnit, extend, computedTextsSize, FILE_TYPE, isFunction, getFileType, extractSuffix, getMultipleFileDotSuffix } from "sakura-utils";
|
|
3
|
+
import { ElLoading, ElMessage, ElMessageBox, ElNotification, ElSelectV2, ElSelect, ElConfigProvider, ElOption, ElPagination, CHANGE_EVENT, ElInput, ElButton, ElTabs, ElTabPane, ElTooltip, ElDialog, ElIcon, ElScrollbar, ElDrawer, ElPopconfirm, ElSwitch } from "element-plus";
|
|
4
4
|
import { TinyColor } from "@ctrl/tinycolor";
|
|
5
|
-
import { useThrottleFn } from "@vueuse/core";
|
|
6
|
-
import { Close } from "@element-plus/icons-vue";
|
|
5
|
+
import { useDebounceFn, useThrottleFn } from "@vueuse/core";
|
|
6
|
+
import { Close, ArrowLeft, Upload } from "@element-plus/icons-vue";
|
|
7
7
|
import DOMPurify from "dompurify";
|
|
8
8
|
const defaultNamespace = "sakura";
|
|
9
9
|
const statePrefix = "is-";
|
|
@@ -222,6 +222,53 @@ const useNotification = (duration = 8e3, showClose = true, position = "top-right
|
|
|
222
222
|
};
|
|
223
223
|
return notification;
|
|
224
224
|
};
|
|
225
|
+
const useFormValidate = () => {
|
|
226
|
+
const elFormRef = ref(null);
|
|
227
|
+
const debounceFn = useDebounceFn(() => {
|
|
228
|
+
const errorEl = document.querySelector(".el-form-item.is-error");
|
|
229
|
+
if (!errorEl)
|
|
230
|
+
return;
|
|
231
|
+
const input = errorEl.getElementsByTagName("input")[0];
|
|
232
|
+
const textarea = errorEl.getElementsByTagName("textarea")[0];
|
|
233
|
+
if (input) {
|
|
234
|
+
input.focus();
|
|
235
|
+
} else if (textarea) {
|
|
236
|
+
textarea.focus();
|
|
237
|
+
}
|
|
238
|
+
}, 200);
|
|
239
|
+
const validate = () => {
|
|
240
|
+
return new Promise((resolve) => {
|
|
241
|
+
var _a;
|
|
242
|
+
(_a = elFormRef.value) == null ? void 0 : _a.validate(async (valid) => {
|
|
243
|
+
resolve(valid);
|
|
244
|
+
if (!valid) {
|
|
245
|
+
await sleep(50);
|
|
246
|
+
await nextTick();
|
|
247
|
+
debounceFn();
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
const resetFields = () => {
|
|
253
|
+
var _a;
|
|
254
|
+
(_a = elFormRef.value) == null ? void 0 : _a.resetFields();
|
|
255
|
+
};
|
|
256
|
+
const clearValidate = () => {
|
|
257
|
+
var _a;
|
|
258
|
+
(_a = elFormRef.value) == null ? void 0 : _a.clearValidate();
|
|
259
|
+
};
|
|
260
|
+
return {
|
|
261
|
+
elFormRef,
|
|
262
|
+
validate,
|
|
263
|
+
resetFields,
|
|
264
|
+
clearValidate
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
const useVisibleValue = (defaultValue = false) => {
|
|
268
|
+
const visible = ref(defaultValue);
|
|
269
|
+
const handleVisible = () => visible.value = !visible.value;
|
|
270
|
+
return { visible, handleVisible };
|
|
271
|
+
};
|
|
225
272
|
const checkElementIsExist = (id, container = "body") => {
|
|
226
273
|
if (document.querySelector(`#${id}`)) {
|
|
227
274
|
return true;
|
|
@@ -236,6 +283,64 @@ const checkElementIsExist = (id, container = "body") => {
|
|
|
236
283
|
return false;
|
|
237
284
|
}
|
|
238
285
|
};
|
|
286
|
+
const phoneRegex = /^1[3-9]\d{9}$/;
|
|
287
|
+
const idCardRegex = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
|
|
288
|
+
const isPhone = (value) => phoneRegex.test(value);
|
|
289
|
+
const isIdCard = (value) => idCardRegex.test(value);
|
|
290
|
+
const phoneValidator = (rules = ["empty", "rule"], emptyTips = "请输入手机号", ruleTips = "请输入正确的手机号") => {
|
|
291
|
+
return (_, value, callback) => {
|
|
292
|
+
if (rules.includes("empty") && isEmpty(value)) {
|
|
293
|
+
return callback(new Error(emptyTips));
|
|
294
|
+
}
|
|
295
|
+
if (rules.includes("rule") && value && !isPhone(value)) {
|
|
296
|
+
return callback(new Error(ruleTips));
|
|
297
|
+
}
|
|
298
|
+
return callback();
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
const idCardValidator = (rules = ["empty", "rule"], emptyTips = "请输入身份证号码", ruleTips = "请输入正确的身份证号码") => {
|
|
302
|
+
return (_, value, callback) => {
|
|
303
|
+
if (rules.includes("empty") && isEmpty(value)) {
|
|
304
|
+
return callback(new Error(emptyTips));
|
|
305
|
+
}
|
|
306
|
+
if (rules.includes("rule") && value && !isIdCard(value)) {
|
|
307
|
+
return callback(new Error(ruleTips));
|
|
308
|
+
}
|
|
309
|
+
return callback();
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
const getRuleItem = (value) => {
|
|
313
|
+
if (isString(value)) {
|
|
314
|
+
return {
|
|
315
|
+
required: true,
|
|
316
|
+
message: `请输入${value}`,
|
|
317
|
+
trigger: "blur"
|
|
318
|
+
};
|
|
319
|
+
} else if (isArray(value)) {
|
|
320
|
+
const [message, trigger = "blur", required = true] = value;
|
|
321
|
+
return {
|
|
322
|
+
trigger,
|
|
323
|
+
message,
|
|
324
|
+
required: required ?? true
|
|
325
|
+
};
|
|
326
|
+
} else {
|
|
327
|
+
return {
|
|
328
|
+
required: true,
|
|
329
|
+
trigger: "blur",
|
|
330
|
+
...value
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
const createRules = (state) => {
|
|
335
|
+
return reactive(keysOf(state).reduce((data, key) => {
|
|
336
|
+
const value = state[key];
|
|
337
|
+
if (!(key in data)) {
|
|
338
|
+
data[key] = [];
|
|
339
|
+
}
|
|
340
|
+
data[key].push(getRuleItem(value));
|
|
341
|
+
return data;
|
|
342
|
+
}, {}));
|
|
343
|
+
};
|
|
239
344
|
var EVENT_NAME = /* @__PURE__ */ ((EVENT_NAME2) => {
|
|
240
345
|
EVENT_NAME2["改变"] = "change";
|
|
241
346
|
EVENT_NAME2["发送"] = "send";
|
|
@@ -447,7 +552,7 @@ var zhCn = {
|
|
|
447
552
|
}
|
|
448
553
|
}
|
|
449
554
|
};
|
|
450
|
-
const _sfc_main$
|
|
555
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
451
556
|
...{
|
|
452
557
|
name: "SakuraSelect"
|
|
453
558
|
},
|
|
@@ -587,7 +692,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
587
692
|
}
|
|
588
693
|
});
|
|
589
694
|
const CellContextKey = Symbol("CellContextKey");
|
|
590
|
-
const _sfc_main$
|
|
695
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
591
696
|
...{
|
|
592
697
|
name: "SakuraCell"
|
|
593
698
|
},
|
|
@@ -628,7 +733,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
628
733
|
};
|
|
629
734
|
}
|
|
630
735
|
});
|
|
631
|
-
const _sfc_main$
|
|
736
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
632
737
|
...{
|
|
633
738
|
name: "SakuraCellGroup"
|
|
634
739
|
},
|
|
@@ -653,7 +758,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
653
758
|
};
|
|
654
759
|
}
|
|
655
760
|
});
|
|
656
|
-
const _sfc_main$
|
|
761
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
657
762
|
...{
|
|
658
763
|
name: "SakuraStatus"
|
|
659
764
|
},
|
|
@@ -701,7 +806,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
701
806
|
};
|
|
702
807
|
}
|
|
703
808
|
});
|
|
704
|
-
const _sfc_main$
|
|
809
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
705
810
|
...{
|
|
706
811
|
name: "SakuraContainer"
|
|
707
812
|
},
|
|
@@ -736,7 +841,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
736
841
|
};
|
|
737
842
|
}
|
|
738
843
|
});
|
|
739
|
-
const _sfc_main$
|
|
844
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
740
845
|
...{
|
|
741
846
|
name: "SakuraPagination"
|
|
742
847
|
},
|
|
@@ -795,7 +900,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
795
900
|
};
|
|
796
901
|
}
|
|
797
902
|
});
|
|
798
|
-
const _sfc_main$
|
|
903
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
799
904
|
...{
|
|
800
905
|
name: "SakuraSearchInput"
|
|
801
906
|
},
|
|
@@ -853,7 +958,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
853
958
|
}
|
|
854
959
|
});
|
|
855
960
|
const FilterGroupContextKey = Symbol("FilterGroupContextKey");
|
|
856
|
-
const _sfc_main$
|
|
961
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
857
962
|
...{
|
|
858
963
|
name: "SakuraFilterItem"
|
|
859
964
|
},
|
|
@@ -924,7 +1029,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
924
1029
|
};
|
|
925
1030
|
}
|
|
926
1031
|
});
|
|
927
|
-
const _sfc_main$
|
|
1032
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
928
1033
|
...{
|
|
929
1034
|
name: "SakuraFilterGroup"
|
|
930
1035
|
},
|
|
@@ -958,7 +1063,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
958
1063
|
};
|
|
959
1064
|
}
|
|
960
1065
|
});
|
|
961
|
-
const _sfc_main$
|
|
1066
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
962
1067
|
...{
|
|
963
1068
|
name: "SakuraTabs"
|
|
964
1069
|
},
|
|
@@ -1006,7 +1111,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1006
1111
|
};
|
|
1007
1112
|
}
|
|
1008
1113
|
});
|
|
1009
|
-
const _sfc_main$
|
|
1114
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
1010
1115
|
...{
|
|
1011
1116
|
name: "SakuraTooltipText"
|
|
1012
1117
|
},
|
|
@@ -1082,8 +1187,8 @@ const WordFileIcon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjkiIGhlaWdodD0i
|
|
|
1082
1187
|
const ImageFileIcon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjgiIHZpZXdCb3g9IjAgMCAyNSAyOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yLjMyMjk2IDI3Ljk5OTlDMS4zNDExMiAyNy45OTk5IDAuNTQ1MTk3IDI3LjIwNCAwLjU0NTE5NyAyNi4yMjIxVjEuNzc3NzdDMC41NDUxOTcgMC43OTU5MjUgMS4zNDExMiAwIDIuMzIyOTYgMEgxNi42MjUxTDI0LjA2OTYgNy4wNTU1M1YyNi4yMjIxQzI0LjA2OTYgMjcuMjA0IDIzLjI3MzYgMjcuOTk5OSAyMi4yOTE4IDI3Ljk5OTlIMi4zMjI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xNS4zMDU2IDE3LjQ2NTFaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K";
|
|
1085
|
-
const _hoisted_1$
|
|
1086
|
-
const _sfc_main$
|
|
1190
|
+
const _hoisted_1$2 = ["src"];
|
|
1191
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
1087
1192
|
...{
|
|
1088
1193
|
name: "SakuraFileItem"
|
|
1089
1194
|
},
|
|
@@ -1136,7 +1241,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1136
1241
|
class: normalizeClass([unref(ns).e("icon")]),
|
|
1137
1242
|
src: fileIcon.value,
|
|
1138
1243
|
alt: ""
|
|
1139
|
-
}, null, 10, _hoisted_1$
|
|
1244
|
+
}, null, 10, _hoisted_1$2),
|
|
1140
1245
|
createElementVNode("div", {
|
|
1141
1246
|
class: normalizeClass([unref(ns).e("info")])
|
|
1142
1247
|
}, [
|
|
@@ -1153,7 +1258,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1153
1258
|
};
|
|
1154
1259
|
}
|
|
1155
1260
|
});
|
|
1156
|
-
const _sfc_main$
|
|
1261
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1157
1262
|
...{
|
|
1158
1263
|
name: "SakuraFileList"
|
|
1159
1264
|
},
|
|
@@ -1194,7 +1299,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1194
1299
|
style: [fileListStyle.value]
|
|
1195
1300
|
}, _ctx.$attrs), [
|
|
1196
1301
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.fileList, (v, i) => {
|
|
1197
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1302
|
+
return openBlock(), createBlock(_sfc_main$8, {
|
|
1198
1303
|
key: v.fileId,
|
|
1199
1304
|
"file-info": v,
|
|
1200
1305
|
style: normalizeStyle(fileItemStyle.value(i + 1))
|
|
@@ -1204,7 +1309,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1204
1309
|
};
|
|
1205
1310
|
}
|
|
1206
1311
|
});
|
|
1207
|
-
const _sfc_main$
|
|
1312
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1208
1313
|
...{
|
|
1209
1314
|
name: "SakuraCountDown"
|
|
1210
1315
|
},
|
|
@@ -1280,7 +1385,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
1280
1385
|
};
|
|
1281
1386
|
}
|
|
1282
1387
|
});
|
|
1283
|
-
const _sfc_main$
|
|
1388
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1284
1389
|
...{
|
|
1285
1390
|
name: "SakuraDialog"
|
|
1286
1391
|
},
|
|
@@ -1446,7 +1551,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1446
1551
|
};
|
|
1447
1552
|
}
|
|
1448
1553
|
});
|
|
1449
|
-
const _sfc_main$
|
|
1554
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1450
1555
|
...{
|
|
1451
1556
|
name: "SakuraDrawer"
|
|
1452
1557
|
},
|
|
@@ -1627,8 +1732,8 @@ const validateHtmlString = (html) => {
|
|
|
1627
1732
|
return false;
|
|
1628
1733
|
}
|
|
1629
1734
|
};
|
|
1630
|
-
const _hoisted_1 = ["innerHTML"];
|
|
1631
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1735
|
+
const _hoisted_1$1 = ["innerHTML"];
|
|
1736
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1632
1737
|
...{
|
|
1633
1738
|
name: "SakuraShowModal"
|
|
1634
1739
|
},
|
|
@@ -1744,7 +1849,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1744
1849
|
visibleShowModal
|
|
1745
1850
|
});
|
|
1746
1851
|
return (_ctx, _cache) => {
|
|
1747
|
-
return openBlock(), createBlock(unref(_sfc_main$
|
|
1852
|
+
return openBlock(), createBlock(unref(_sfc_main$5), {
|
|
1748
1853
|
modelValue: visible.value,
|
|
1749
1854
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
|
|
1750
1855
|
class: normalizeClass([unref(ns).b()]),
|
|
@@ -1765,7 +1870,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1765
1870
|
key: 0,
|
|
1766
1871
|
class: normalizeClass([unref(ns).e("content")]),
|
|
1767
1872
|
innerHTML: htmlDomContent.value
|
|
1768
|
-
}, null, 10, _hoisted_1)) : (openBlock(), createElementBlock("div", {
|
|
1873
|
+
}, null, 10, _hoisted_1$1)) : (openBlock(), createElementBlock("div", {
|
|
1769
1874
|
key: 1,
|
|
1770
1875
|
class: normalizeClass([unref(ns).e("content")])
|
|
1771
1876
|
}, [
|
|
@@ -1779,28 +1884,375 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1779
1884
|
};
|
|
1780
1885
|
}
|
|
1781
1886
|
});
|
|
1887
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1888
|
+
...{
|
|
1889
|
+
name: "SakuraPopconfirmSwitch"
|
|
1890
|
+
},
|
|
1891
|
+
__name: "popconfirm-switch",
|
|
1892
|
+
props: /* @__PURE__ */ mergeModels({
|
|
1893
|
+
activeText: { default: "启用" },
|
|
1894
|
+
activeValue: { type: [String, Boolean, Number], default: true },
|
|
1895
|
+
activeColor: { default: "" },
|
|
1896
|
+
inactiveText: { default: "禁用" },
|
|
1897
|
+
inactiveValue: { type: [String, Boolean, Number], default: false },
|
|
1898
|
+
inactiveColor: { default: "" },
|
|
1899
|
+
size: { default: "default" },
|
|
1900
|
+
loading: { type: Boolean, default: false },
|
|
1901
|
+
disabled: { type: Boolean, default: false },
|
|
1902
|
+
width: { default: "" },
|
|
1903
|
+
locale: { default: zhCn },
|
|
1904
|
+
showText: { type: Boolean }
|
|
1905
|
+
}, {
|
|
1906
|
+
"modelValue": { type: [Boolean, Number, String] },
|
|
1907
|
+
"modelModifiers": {}
|
|
1908
|
+
}),
|
|
1909
|
+
emits: /* @__PURE__ */ mergeModels(["confirm", "cancel"], ["update:modelValue"]),
|
|
1910
|
+
setup(__props, { emit: __emit }) {
|
|
1911
|
+
const ns = useNamespace("popconfirm-switch");
|
|
1912
|
+
const props = __props;
|
|
1913
|
+
const emits = __emit;
|
|
1914
|
+
const status = useModel(__props, "modelValue");
|
|
1915
|
+
const title = computed(() => {
|
|
1916
|
+
const { activeText, inactiveText } = props;
|
|
1917
|
+
return status.value ? `确定要${inactiveText}吗?` : `确定要${activeText}吗?`;
|
|
1918
|
+
});
|
|
1919
|
+
return (_ctx, _cache) => {
|
|
1920
|
+
return openBlock(), createBlock(unref(ElConfigProvider), { locale: __props.locale }, {
|
|
1921
|
+
default: withCtx(() => [
|
|
1922
|
+
createVNode(unref(ElPopconfirm), {
|
|
1923
|
+
class: normalizeClass([unref(ns).b()]),
|
|
1924
|
+
title: title.value,
|
|
1925
|
+
onConfirm: _cache[0] || (_cache[0] = ($event) => emits("confirm", !status.value)),
|
|
1926
|
+
onCancel: _cache[1] || (_cache[1] = ($event) => emits("cancel"))
|
|
1927
|
+
}, {
|
|
1928
|
+
reference: withCtx(() => [
|
|
1929
|
+
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createBlock(unref(ElSwitch), {
|
|
1930
|
+
key: 1,
|
|
1931
|
+
size: __props.size,
|
|
1932
|
+
"model-value": status.value,
|
|
1933
|
+
"active-text": __props.showText ? __props.activeText : "",
|
|
1934
|
+
"active-value": __props.activeValue,
|
|
1935
|
+
"active-color": __props.activeColor,
|
|
1936
|
+
"inactive-text": __props.showText ? __props.inactiveText : "",
|
|
1937
|
+
"inactive-value": __props.inactiveValue,
|
|
1938
|
+
"inactive-color": __props.inactiveColor,
|
|
1939
|
+
disabled: __props.disabled,
|
|
1940
|
+
loading: __props.loading,
|
|
1941
|
+
width: __props.width,
|
|
1942
|
+
"inline-prompt": ""
|
|
1943
|
+
}, null, 8, ["size", "model-value", "active-text", "active-value", "active-color", "inactive-text", "inactive-value", "inactive-color", "disabled", "loading", "width"]))
|
|
1944
|
+
]),
|
|
1945
|
+
_: 3
|
|
1946
|
+
}, 8, ["class", "title"])
|
|
1947
|
+
]),
|
|
1948
|
+
_: 3
|
|
1949
|
+
}, 8, ["locale"]);
|
|
1950
|
+
};
|
|
1951
|
+
}
|
|
1952
|
+
});
|
|
1953
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1954
|
+
...{
|
|
1955
|
+
name: "SakuraPageContainer"
|
|
1956
|
+
},
|
|
1957
|
+
__name: "page-container",
|
|
1958
|
+
props: {
|
|
1959
|
+
title: {},
|
|
1960
|
+
back: { type: Boolean, default: true },
|
|
1961
|
+
background: { default: "#F7F7FC" },
|
|
1962
|
+
scroll: { type: Boolean, default: true },
|
|
1963
|
+
type: { default: "default" },
|
|
1964
|
+
plain: { type: Boolean, default: false }
|
|
1965
|
+
},
|
|
1966
|
+
emits: ["back"],
|
|
1967
|
+
setup(__props, { emit: __emit }) {
|
|
1968
|
+
const ns = useNamespace("page-container");
|
|
1969
|
+
const props = __props;
|
|
1970
|
+
const emits = __emit;
|
|
1971
|
+
const pageContainerStyle = computed(() => {
|
|
1972
|
+
const { background } = props;
|
|
1973
|
+
return ns.cssBlockVar("page-container", {
|
|
1974
|
+
background
|
|
1975
|
+
});
|
|
1976
|
+
});
|
|
1977
|
+
return (_ctx, _cache) => {
|
|
1978
|
+
return openBlock(), createElementBlock("div", {
|
|
1979
|
+
class: normalizeClass([
|
|
1980
|
+
unref(ns).b(),
|
|
1981
|
+
unref(ns).is("scroll", __props.scroll)
|
|
1982
|
+
]),
|
|
1983
|
+
style: normalizeStyle([pageContainerStyle.value])
|
|
1984
|
+
}, [
|
|
1985
|
+
__props.back || __props.title || _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
|
|
1986
|
+
key: 0,
|
|
1987
|
+
class: normalizeClass([unref(ns).e("header")])
|
|
1988
|
+
}, [
|
|
1989
|
+
__props.back ? (openBlock(), createBlock(unref(ElButton), {
|
|
1990
|
+
key: 0,
|
|
1991
|
+
class: normalizeClass([unref(ns).e("back")]),
|
|
1992
|
+
circle: "",
|
|
1993
|
+
icon: unref(ArrowLeft),
|
|
1994
|
+
type: __props.type,
|
|
1995
|
+
plain: __props.plain,
|
|
1996
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emits("back"))
|
|
1997
|
+
}, null, 8, ["class", "icon", "type", "plain"])) : createCommentVNode("", true),
|
|
1998
|
+
__props.title ? (openBlock(), createElementBlock("p", {
|
|
1999
|
+
key: 1,
|
|
2000
|
+
class: normalizeClass([unref(ns).e("title")])
|
|
2001
|
+
}, toDisplayString(__props.title), 3)) : createCommentVNode("", true),
|
|
2002
|
+
renderSlot(_ctx.$slots, "header")
|
|
2003
|
+
], 2)) : createCommentVNode("", true),
|
|
2004
|
+
createElementVNode("div", {
|
|
2005
|
+
class: normalizeClass([unref(ns).e("body")])
|
|
2006
|
+
}, [
|
|
2007
|
+
__props.scroll ? (openBlock(), createBlock(unref(ElScrollbar), {
|
|
2008
|
+
key: 0,
|
|
2009
|
+
height: "100%"
|
|
2010
|
+
}, {
|
|
2011
|
+
default: withCtx(() => [
|
|
2012
|
+
renderSlot(_ctx.$slots, "default")
|
|
2013
|
+
]),
|
|
2014
|
+
_: 3
|
|
2015
|
+
})) : renderSlot(_ctx.$slots, "default", { key: 1 })
|
|
2016
|
+
], 2)
|
|
2017
|
+
], 6);
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
});
|
|
2021
|
+
const UploadIcon = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjYuNTU5NiAzNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjI2LjU1OTU3MCIga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TguNDk5OSAxNi44MDk0IDE4LjM1OTlMMTMuMDU5NCAxNC4xMDk5WiIgZmlsbD0icmdiKDI1NSwyNTUsMjU1KSIgZmlsbC1ydWxlPSJub256ZXJvIiAvPgoJCTxwYXRoIGlkPSJWZWN0b3IiIGQ9Ik0xNC4yMzAyIDIyLjcxTDExLjQ0MDIgMjIuNzFDMTEuMDUwMiAyMi43MSAxMC43NDAyIDIzLjAxIDEwLjc0MDIgMjMuMzlDMTAuNzQwMiAyMy43NyAxMS4wNTAyIDI0LjA3IDExLjQ0MDIgMjQuMDdMMTQuMjMwMiAyNC4wN0MxNC42MjAyIDI0LjA3IDE0LjkzMDIgMjMuNzcgMTQuOTMwMiAyMy4zOUMxNC45MjAyIDIzLjAxIDE0LjYxMDIgMjIuNzEgMTQuMjMwMiAyMi43MVoiIGZpbGw9InJnYigyNTUsMjU1LDI1NSkiIGZpbGwtcnVsZT0ibm9uemVybyIgLz4KCTwvZz4KPC9zdmc+Cg==";
|
|
2022
|
+
const fileTransformFileInfo = (files) => {
|
|
2023
|
+
return files.map((file) => {
|
|
2024
|
+
const { name, size } = file;
|
|
2025
|
+
const fileInfo = {
|
|
2026
|
+
fileId: "",
|
|
2027
|
+
fileSize: size,
|
|
2028
|
+
fileType: getFileType(name),
|
|
2029
|
+
fileName: name,
|
|
2030
|
+
fileSuffix: extractSuffix(name),
|
|
2031
|
+
fileUrl: "",
|
|
2032
|
+
originFile: file
|
|
2033
|
+
};
|
|
2034
|
+
return fileInfo;
|
|
2035
|
+
});
|
|
2036
|
+
};
|
|
2037
|
+
const useUpload = (props) => {
|
|
2038
|
+
const uploadFileTips = computed(() => {
|
|
2039
|
+
const { tips, fileAccepts } = props;
|
|
2040
|
+
if (!isEmpty(tips)) {
|
|
2041
|
+
return tips;
|
|
2042
|
+
}
|
|
2043
|
+
return fileAccepts.map((v) => {
|
|
2044
|
+
const type = v.toLocaleLowerCase();
|
|
2045
|
+
const first = type[0].toLocaleUpperCase();
|
|
2046
|
+
return `${first}${type.slice(1)}`;
|
|
2047
|
+
}).join(", ");
|
|
2048
|
+
});
|
|
2049
|
+
const uploadFileAccepts = computed(() => getMultipleFileDotSuffix(props.fileAccepts));
|
|
2050
|
+
const fileValidate = (fileList) => {
|
|
2051
|
+
const { fileSize, fileLimit } = props;
|
|
2052
|
+
if (fileList.length > fileLimit) {
|
|
2053
|
+
return {
|
|
2054
|
+
success: false,
|
|
2055
|
+
data: `一次性上传文件数量不能超过${fileLimit}份`,
|
|
2056
|
+
message: ""
|
|
2057
|
+
};
|
|
2058
|
+
}
|
|
2059
|
+
if (!fileList.every((v) => Math.round(v.fileSize / 1024 / 1024 * 100) / 100 <= fileSize)) {
|
|
2060
|
+
return {
|
|
2061
|
+
success: false,
|
|
2062
|
+
data: `文件大小超过${fileSize}MB`,
|
|
2063
|
+
message: ""
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
if (!fileList.every((v) => uploadFileAccepts.value.includes(extractSuffix(v.fileName)))) {
|
|
2067
|
+
return {
|
|
2068
|
+
success: false,
|
|
2069
|
+
data: "文件格式错误",
|
|
2070
|
+
message: ""
|
|
2071
|
+
};
|
|
2072
|
+
}
|
|
2073
|
+
return {
|
|
2074
|
+
success: true,
|
|
2075
|
+
data: "成功",
|
|
2076
|
+
message: ""
|
|
2077
|
+
};
|
|
2078
|
+
};
|
|
2079
|
+
const getFileResult = (files) => {
|
|
2080
|
+
const { validate } = props;
|
|
2081
|
+
const fileList = fileTransformFileInfo(Array.from(files));
|
|
2082
|
+
if (isEmpty(fileList)) {
|
|
2083
|
+
return {
|
|
2084
|
+
success: false,
|
|
2085
|
+
data: [],
|
|
2086
|
+
message: ""
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
if (validate) {
|
|
2090
|
+
const validateRes = fileValidate(fileList);
|
|
2091
|
+
if (!validateRes.success) {
|
|
2092
|
+
return {
|
|
2093
|
+
success: false,
|
|
2094
|
+
data: [],
|
|
2095
|
+
message: validateRes.data
|
|
2096
|
+
};
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
return {
|
|
2100
|
+
success: true,
|
|
2101
|
+
data: fileList,
|
|
2102
|
+
message: "成功"
|
|
2103
|
+
};
|
|
2104
|
+
};
|
|
2105
|
+
return {
|
|
2106
|
+
uploadFileTips,
|
|
2107
|
+
uploadFileAccepts,
|
|
2108
|
+
fileValidate,
|
|
2109
|
+
getFileResult
|
|
2110
|
+
};
|
|
2111
|
+
};
|
|
2112
|
+
const _hoisted_1 = ["src"];
|
|
2113
|
+
const _hoisted_2 = ["accept", "multiple"];
|
|
2114
|
+
const _hoisted_3 = ["accept", "multiple"];
|
|
2115
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2116
|
+
...{
|
|
2117
|
+
name: "SakuraUpload"
|
|
2118
|
+
},
|
|
2119
|
+
__name: "upload",
|
|
2120
|
+
props: {
|
|
2121
|
+
title: { default: "点击或拖拽文件至此处上传" },
|
|
2122
|
+
buttonTitle: { default: "上传附件" },
|
|
2123
|
+
buttonIcon: { default: Upload },
|
|
2124
|
+
tips: { default: "" },
|
|
2125
|
+
uploadIcon: {},
|
|
2126
|
+
fileSize: { default: 50 },
|
|
2127
|
+
fileLimit: { default: 9 },
|
|
2128
|
+
fileAccepts: { default: () => [FILE_TYPE.IMAGE, FILE_TYPE.WORD, FILE_TYPE.PDF, FILE_TYPE.EXCEL] },
|
|
2129
|
+
disabled: { type: Boolean },
|
|
2130
|
+
validate: { type: Boolean, default: true },
|
|
2131
|
+
showMessage: { type: Boolean },
|
|
2132
|
+
type: { default: "upload" }
|
|
2133
|
+
},
|
|
2134
|
+
emits: ["change"],
|
|
2135
|
+
setup(__props, { emit: __emit }) {
|
|
2136
|
+
const ns = useNamespace("upload");
|
|
2137
|
+
const props = __props;
|
|
2138
|
+
const emits = __emit;
|
|
2139
|
+
const { uploadFileTips, uploadFileAccepts, getFileResult } = useUpload(props);
|
|
2140
|
+
const isDragging = ref(false);
|
|
2141
|
+
const onDragOver = (e) => {
|
|
2142
|
+
isDragging.value = true;
|
|
2143
|
+
e.dataTransfer.dropEffect = "copy";
|
|
2144
|
+
};
|
|
2145
|
+
const onDragLeave = () => {
|
|
2146
|
+
isDragging.value = false;
|
|
2147
|
+
};
|
|
2148
|
+
const message = useMessage();
|
|
2149
|
+
const onDrop = (e) => {
|
|
2150
|
+
var _a;
|
|
2151
|
+
const { showMessage } = props;
|
|
2152
|
+
isDragging.value = false;
|
|
2153
|
+
const files = (_a = e.dataTransfer) == null ? void 0 : _a.files;
|
|
2154
|
+
const fileResult = getFileResult(files);
|
|
2155
|
+
if (showMessage) {
|
|
2156
|
+
message.info(fileResult.message);
|
|
2157
|
+
}
|
|
2158
|
+
emits("change", fileResult);
|
|
2159
|
+
};
|
|
2160
|
+
const onFileChange = (e) => {
|
|
2161
|
+
const target = e.target;
|
|
2162
|
+
const fileResult = getFileResult(target.files);
|
|
2163
|
+
const { showMessage } = props;
|
|
2164
|
+
target.value = "";
|
|
2165
|
+
if (showMessage) {
|
|
2166
|
+
message.info(fileResult.message);
|
|
2167
|
+
}
|
|
2168
|
+
emits("change", fileResult);
|
|
2169
|
+
};
|
|
2170
|
+
return (_ctx, _cache) => {
|
|
2171
|
+
return __props.type === "upload" ? (openBlock(), createElementBlock("div", {
|
|
2172
|
+
key: 0,
|
|
2173
|
+
class: normalizeClass([
|
|
2174
|
+
unref(ns).b(),
|
|
2175
|
+
unref(ns).is("disabled", __props.disabled),
|
|
2176
|
+
unref(ns).is("active", isDragging.value),
|
|
2177
|
+
unref(ns).m(__props.type)
|
|
2178
|
+
]),
|
|
2179
|
+
onDragover: withModifiers(onDragOver, ["prevent"]),
|
|
2180
|
+
onDragleave: onDragLeave,
|
|
2181
|
+
onDrop: withModifiers(onDrop, ["prevent"])
|
|
2182
|
+
}, [
|
|
2183
|
+
createElementVNode("img", {
|
|
2184
|
+
class: normalizeClass([unref(ns).e("icon")]),
|
|
2185
|
+
src: unref(UploadIcon),
|
|
2186
|
+
alt: ""
|
|
2187
|
+
}, null, 10, _hoisted_1),
|
|
2188
|
+
createElementVNode("p", {
|
|
2189
|
+
class: normalizeClass([unref(ns).e("title")])
|
|
2190
|
+
}, toDisplayString(__props.title), 3),
|
|
2191
|
+
createElementVNode("p", {
|
|
2192
|
+
class: normalizeClass([unref(ns).e("tips")])
|
|
2193
|
+
}, " 支持格式: " + toDisplayString(unref(uploadFileTips)), 3),
|
|
2194
|
+
createElementVNode("input", {
|
|
2195
|
+
class: normalizeClass([unref(ns).e("file")]),
|
|
2196
|
+
type: "file",
|
|
2197
|
+
alt: "",
|
|
2198
|
+
accept: unref(uploadFileAccepts),
|
|
2199
|
+
multiple: __props.fileLimit > 1,
|
|
2200
|
+
onChange: onFileChange
|
|
2201
|
+
}, null, 42, _hoisted_2)
|
|
2202
|
+
], 34)) : (openBlock(), createElementBlock("div", {
|
|
2203
|
+
key: 1,
|
|
2204
|
+
class: normalizeClass([
|
|
2205
|
+
unref(ns).b(),
|
|
2206
|
+
unref(ns).m(__props.type)
|
|
2207
|
+
])
|
|
2208
|
+
}, [
|
|
2209
|
+
createVNode(unref(ElButton), {
|
|
2210
|
+
text: "",
|
|
2211
|
+
icon: __props.buttonIcon,
|
|
2212
|
+
type: "primary"
|
|
2213
|
+
}, {
|
|
2214
|
+
default: withCtx(() => [
|
|
2215
|
+
createTextVNode(toDisplayString(__props.buttonTitle), 1)
|
|
2216
|
+
]),
|
|
2217
|
+
_: 1
|
|
2218
|
+
}, 8, ["icon"]),
|
|
2219
|
+
createElementVNode("input", {
|
|
2220
|
+
class: normalizeClass([unref(ns).e("file")]),
|
|
2221
|
+
type: "file",
|
|
2222
|
+
alt: "",
|
|
2223
|
+
accept: unref(uploadFileAccepts),
|
|
2224
|
+
multiple: __props.fileLimit > 1,
|
|
2225
|
+
onChange: onFileChange
|
|
2226
|
+
}, null, 42, _hoisted_3)
|
|
2227
|
+
], 2));
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
});
|
|
1782
2231
|
const components = {
|
|
1783
|
-
Select: _sfc_main$
|
|
1784
|
-
Cell: _sfc_main$
|
|
1785
|
-
CellGroup: _sfc_main$
|
|
1786
|
-
Status: _sfc_main$
|
|
1787
|
-
Container: _sfc_main$
|
|
1788
|
-
Pagination: _sfc_main$
|
|
1789
|
-
SearchInput: _sfc_main$
|
|
1790
|
-
FilterItem: _sfc_main$
|
|
1791
|
-
FilterGroup: _sfc_main$
|
|
1792
|
-
Tabs: _sfc_main$
|
|
1793
|
-
TooltipText: _sfc_main$
|
|
1794
|
-
FileItem: _sfc_main$
|
|
1795
|
-
FileList: _sfc_main$
|
|
1796
|
-
CountDown: _sfc_main$
|
|
1797
|
-
Dialog: _sfc_main$
|
|
1798
|
-
Drawer: _sfc_main$
|
|
1799
|
-
ShowModal: _sfc_main
|
|
2232
|
+
Select: _sfc_main$j,
|
|
2233
|
+
Cell: _sfc_main$i,
|
|
2234
|
+
CellGroup: _sfc_main$h,
|
|
2235
|
+
Status: _sfc_main$g,
|
|
2236
|
+
Container: _sfc_main$f,
|
|
2237
|
+
Pagination: _sfc_main$e,
|
|
2238
|
+
SearchInput: _sfc_main$d,
|
|
2239
|
+
FilterItem: _sfc_main$c,
|
|
2240
|
+
FilterGroup: _sfc_main$b,
|
|
2241
|
+
Tabs: _sfc_main$a,
|
|
2242
|
+
TooltipText: _sfc_main$9,
|
|
2243
|
+
FileItem: _sfc_main$8,
|
|
2244
|
+
FileList: _sfc_main$7,
|
|
2245
|
+
CountDown: _sfc_main$6,
|
|
2246
|
+
Dialog: _sfc_main$5,
|
|
2247
|
+
Drawer: _sfc_main$4,
|
|
2248
|
+
ShowModal: _sfc_main$3,
|
|
2249
|
+
PopconfirmSwitch: _sfc_main$2,
|
|
2250
|
+
PageContainer: _sfc_main$1,
|
|
2251
|
+
Upload: _sfc_main
|
|
1800
2252
|
};
|
|
1801
2253
|
const ShowModalInstall = {
|
|
1802
2254
|
install(vm) {
|
|
1803
|
-
const vnode = createVNode(_sfc_main);
|
|
2255
|
+
const vnode = createVNode(_sfc_main$3);
|
|
1804
2256
|
checkElementIsExist("u-show-modal");
|
|
1805
2257
|
render(vnode, document.querySelector("#u-show-modal"));
|
|
1806
2258
|
vm.config.globalProperties.$showModal = (content, title = "提示", showCancelButton = false, params) => {
|
|
@@ -1825,32 +2277,44 @@ const SakuraUiPlus = {
|
|
|
1825
2277
|
install
|
|
1826
2278
|
};
|
|
1827
2279
|
export {
|
|
1828
|
-
_sfc_main$f as Cell,
|
|
1829
|
-
_sfc_main$e as CellGroup,
|
|
1830
|
-
_sfc_main$c as Container,
|
|
1831
|
-
_sfc_main$3 as CountDown,
|
|
1832
|
-
_sfc_main$2 as Dialog,
|
|
1833
|
-
_sfc_main$1 as Drawer,
|
|
1834
2280
|
EVENT_NAME,
|
|
1835
|
-
_sfc_main$
|
|
1836
|
-
_sfc_main$
|
|
1837
|
-
_sfc_main$
|
|
1838
|
-
_sfc_main$
|
|
1839
|
-
_sfc_main$
|
|
1840
|
-
_sfc_main$
|
|
1841
|
-
_sfc_main$
|
|
1842
|
-
_sfc_main as
|
|
1843
|
-
_sfc_main$
|
|
1844
|
-
_sfc_main$
|
|
1845
|
-
_sfc_main$
|
|
2281
|
+
_sfc_main$i as SakuraCell,
|
|
2282
|
+
_sfc_main$h as SakuraCellGroup,
|
|
2283
|
+
_sfc_main$f as SakuraContainer,
|
|
2284
|
+
_sfc_main$6 as SakuraCountDown,
|
|
2285
|
+
_sfc_main$5 as SakuraDialog,
|
|
2286
|
+
_sfc_main$4 as SakuraDrawer,
|
|
2287
|
+
_sfc_main$8 as SakuraFileItem,
|
|
2288
|
+
_sfc_main$7 as SakuraFileList,
|
|
2289
|
+
_sfc_main$b as SakuraFilterGroup,
|
|
2290
|
+
_sfc_main$c as SakuraFilterItem,
|
|
2291
|
+
_sfc_main$1 as SakuraPageContainer,
|
|
2292
|
+
_sfc_main$e as SakuraPagination,
|
|
2293
|
+
_sfc_main$2 as SakuraPopconfirmSwitch,
|
|
2294
|
+
_sfc_main$d as SakuraSearchInput,
|
|
2295
|
+
_sfc_main$j as SakuraSelect,
|
|
2296
|
+
_sfc_main$3 as SakuraShowModal,
|
|
2297
|
+
_sfc_main$g as SakuraStatus,
|
|
2298
|
+
_sfc_main$a as SakuraTabs,
|
|
2299
|
+
_sfc_main$9 as SakuraTooltipText,
|
|
2300
|
+
_sfc_main as SakuraUpload,
|
|
1846
2301
|
checkElementIsExist,
|
|
2302
|
+
createRules,
|
|
1847
2303
|
SakuraUiPlus as default,
|
|
1848
2304
|
defaultNamespace,
|
|
2305
|
+
idCardRegex,
|
|
2306
|
+
idCardValidator,
|
|
2307
|
+
isIdCard,
|
|
2308
|
+
isPhone,
|
|
2309
|
+
phoneRegex,
|
|
2310
|
+
phoneValidator,
|
|
1849
2311
|
useCallbackTrigger,
|
|
2312
|
+
useFormValidate,
|
|
1850
2313
|
useLoading,
|
|
1851
2314
|
useMessage,
|
|
1852
2315
|
useMessageBox,
|
|
1853
2316
|
useNamespace,
|
|
1854
2317
|
useNotification,
|
|
1855
|
-
useShowModal
|
|
2318
|
+
useShowModal,
|
|
2319
|
+
useVisibleValue
|
|
1856
2320
|
};
|