djm-ui 0.67.4 → 0.73.0
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/CHANGELOG.md +116 -0
- package/README.md +38 -2
- package/dist/djm-ui.cjs +1625 -803
- package/dist/djm-ui.cjs.map +4 -4
- package/dist/djm-ui.css +1043 -41
- package/dist/djm-ui.esm.js +1581 -761
- package/dist/djm-ui.esm.js.map +4 -4
- package/dist/djm-ui.esm.min.js +439 -247
- package/dist/djm-ui.min.cjs +439 -247
- package/dist/djm-ui.min.css +2 -2
- package/dist/djm-ui.umd.js +1104 -285
- package/dist/djm-ui.umd.min.js +439 -247
- package/dist/mcp/manifest.json +12300 -0
- package/dist/mcp/server.js +90 -0
- package/package.json +12 -4
- package/src/components/drawer/index.js +4 -2
- package/src/components/icon/index.js +13 -1
- package/src/components/modal/index.js +4 -2
- package/src/components/progress/index.js +72 -3
- package/src/components/rich-editor/index.js +724 -61
- package/src/components/spin/index.js +69 -22
- package/src/index.js +2 -1
- package/src/locale/en-US.js +33 -1
- package/src/locale/zh-CN.js +33 -1
- package/src/styles/base.css +2 -3
- package/src/styles/components/button.css +2 -1
- package/src/styles/components/console.css +5 -0
- package/src/styles/components/content.css +517 -0
- package/src/styles/components/feedback.css +46 -0
- package/src/styles/components/form.css +5 -0
- package/src/styles/components/glass.css +58 -0
- package/src/styles/components/layout.css +326 -0
- package/src/styles/components/media-picker.css +3 -3
- package/src/styles/components/menu.css +2 -1
- package/src/styles/components/org-picker.css +1 -1
- package/src/styles/components/responsive.css +86 -0
- package/src/styles/components/rich-editor.css +206 -7
- package/src/styles/components/skin.css +54 -0
- package/src/styles/components/spin.css +156 -4
- package/src/styles/components/template.css +5 -0
- package/src/styles/index.css +2 -0
- package/src/styles/theme-dark.css +5 -0
- package/src/styles/tokens.css +13 -0
- package/src/theme/index.js +62 -0
- package/src/utils/sanitize-html.js +44 -6
- package/types/index.d.ts +17 -0
package/dist/djm-ui.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DJM UI v0.
|
|
1
|
+
/*! DJM UI v0.73.0 · MIT · 2026-10-26 */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __esm = (fn, res, err) => function __init() {
|
|
@@ -969,7 +969,19 @@ var PATHS = {
|
|
|
969
969
|
activity: "M22 12h-4l-3 9L9 3l-3 9H2",
|
|
970
970
|
database: "M12 8c4.42 0 8-1.34 8-3s-3.58-3-8-3-8 1.34-8 3 3.58 3 8 3zM4 5v14c0 1.66 3.58 3 8 3s8-1.34 8-3V5M4 12c0 1.66 3.58 3 8 3s8-1.34 8-3",
|
|
971
971
|
sun: "M12 17a5 5 0 1 0 0-10 5 5 0 0 0 0 10zM12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42",
|
|
972
|
-
moon: "M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"
|
|
972
|
+
moon: "M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z",
|
|
973
|
+
undo: "M3 10h11a5 5 0 1 1 0 10H8M3 10l4-4M3 10l4 4",
|
|
974
|
+
redo: "M21 10H10a5 5 0 1 0 0 10h6M21 10l-4-4M21 10l-4 4",
|
|
975
|
+
"align-left": "M4 6h16M4 12h10M4 18h13",
|
|
976
|
+
"align-center": "M4 6h16M7 12h10M6 18h12",
|
|
977
|
+
"align-right": "M4 6h16M10 12h10M7 18h13",
|
|
978
|
+
"align-justify": "M4 6h16M4 12h16M4 18h16",
|
|
979
|
+
list: "M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01",
|
|
980
|
+
"list-ordered": "M10 6h10M10 12h10M10 18h10M4 6h1v4M4 12h2M4 16h2v2H4",
|
|
981
|
+
outdent: "M4 6h16M10 12h10M10 18h10M8 9l-3 3 3 3",
|
|
982
|
+
indent: "M4 6h16M10 12h10M10 18h10M5 9l3 3-3 3",
|
|
983
|
+
unlink: "M10 13a5 5 0 0 0 7.5.5M14 11a5 5 0 0 0-7.5-.5M2 2l20 20",
|
|
984
|
+
images: "M8 3h12v12M4 7h12v12H4zM7 15l3-3 3 3"
|
|
973
985
|
};
|
|
974
986
|
var icon_default = {
|
|
975
987
|
name: "DjmIcon",
|
|
@@ -1296,7 +1308,6 @@ var zh_CN_default = {
|
|
|
1296
1308
|
"richEditor.italic": "\u659C\u4F53",
|
|
1297
1309
|
"richEditor.underline": "\u4E0B\u5212\u7EBF",
|
|
1298
1310
|
"richEditor.strike": "\u5220\u9664\u7EBF",
|
|
1299
|
-
"richEditor.heading": "\u4E8C\u7EA7\u6807\u9898",
|
|
1300
1311
|
"richEditor.paragraph": "\u6B63\u6587",
|
|
1301
1312
|
"richEditor.bulletList": "\u65E0\u5E8F\u5217\u8868",
|
|
1302
1313
|
"richEditor.numberList": "\u6709\u5E8F\u5217\u8868",
|
|
@@ -1307,6 +1318,39 @@ var zh_CN_default = {
|
|
|
1307
1318
|
"richEditor.redo": "\u91CD\u505A",
|
|
1308
1319
|
"richEditor.source": "\u6E90\u7801",
|
|
1309
1320
|
"richEditor.visual": "\u53EF\u89C6\u5316",
|
|
1321
|
+
"richEditor.toolbar": "\u7F16\u8F91\u5DE5\u5177\u680F",
|
|
1322
|
+
"richEditor.block": "\u6BB5\u843D\u683C\u5F0F",
|
|
1323
|
+
"richEditor.heading1": "\u6807\u9898 1",
|
|
1324
|
+
"richEditor.heading2": "\u6807\u9898 2",
|
|
1325
|
+
"richEditor.heading3": "\u6807\u9898 3",
|
|
1326
|
+
"richEditor.quote": "\u5F15\u7528",
|
|
1327
|
+
"richEditor.codeBlock": "\u4EE3\u7801\u5757",
|
|
1328
|
+
"richEditor.fontSize": "\u5B57\u53F7",
|
|
1329
|
+
"richEditor.defaultSize": "\u9ED8\u8BA4",
|
|
1330
|
+
"richEditor.inlineCode": "\u884C\u5185\u4EE3\u7801",
|
|
1331
|
+
"richEditor.textColor": "\u6587\u5B57\u989C\u8272",
|
|
1332
|
+
"richEditor.bgColor": "\u80CC\u666F\u8272",
|
|
1333
|
+
"richEditor.alignLeft": "\u5DE6\u5BF9\u9F50",
|
|
1334
|
+
"richEditor.alignCenter": "\u5C45\u4E2D",
|
|
1335
|
+
"richEditor.alignRight": "\u53F3\u5BF9\u9F50",
|
|
1336
|
+
"richEditor.alignJustify": "\u4E24\u7AEF\u5BF9\u9F50",
|
|
1337
|
+
"richEditor.outdent": "\u51CF\u5C11\u7F29\u8FDB",
|
|
1338
|
+
"richEditor.indent": "\u589E\u52A0\u7F29\u8FDB",
|
|
1339
|
+
"richEditor.unlink": "\u53D6\u6D88\u94FE\u63A5",
|
|
1340
|
+
"richEditor.image": "\u63D2\u5165\u56FE\u7247",
|
|
1341
|
+
"richEditor.singleImage": "\u63D2\u5165\u5355\u56FE",
|
|
1342
|
+
"richEditor.multiImage": "\u63D2\u5165\u591A\u56FE",
|
|
1343
|
+
"richEditor.mediaLibrary": "\u4ECE\u7D20\u6750\u5E93\u9009\u62E9",
|
|
1344
|
+
"richEditor.hr": "\u5206\u5272\u7EBF",
|
|
1345
|
+
"richEditor.fullscreen": "\u5168\u5C4F",
|
|
1346
|
+
"richEditor.exitFullscreen": "\u9000\u51FA\u5168\u5C4F",
|
|
1347
|
+
"richEditor.wordCount": "\u5171 {count} \u5B57",
|
|
1348
|
+
"richEditor.uploading": "\u6B63\u5728\u4E0A\u4F20 {count} \u5F20\u56FE\u7247\u2026",
|
|
1349
|
+
"richEditor.uploadFailed": "\u56FE\u7247\u4E0A\u4F20\u5931\u8D25",
|
|
1350
|
+
"richEditor.imageTypeError": "\u53EA\u80FD\u4E0A\u4F20\u56FE\u7247\u6587\u4EF6",
|
|
1351
|
+
"richEditor.imageSizeError": "\u56FE\u7247\u4E0D\u80FD\u8D85\u8FC7 {size}MB",
|
|
1352
|
+
"richEditor.imageUrlInvalid": "\u56FE\u7247\u5730\u5740\u4E0D\u5408\u6CD5\uFF0C\u5DF2\u62D2\u7EDD\u63D2\u5165",
|
|
1353
|
+
"richEditor.linkInvalid": "\u94FE\u63A5\u53EA\u652F\u6301 http(s)\u3001mailto\u3001tel \u6216\u7AD9\u5185\u76F8\u5BF9\u5730\u5740",
|
|
1310
1354
|
"approval.start": "\u53D1\u8D77",
|
|
1311
1355
|
"approval.cc": "\u6284\u9001",
|
|
1312
1356
|
"approval.approved": "\u5DF2\u901A\u8FC7",
|
|
@@ -1515,7 +1559,6 @@ var en_US_default = {
|
|
|
1515
1559
|
"richEditor.italic": "Italic",
|
|
1516
1560
|
"richEditor.underline": "Underline",
|
|
1517
1561
|
"richEditor.strike": "Strikethrough",
|
|
1518
|
-
"richEditor.heading": "Heading 2",
|
|
1519
1562
|
"richEditor.paragraph": "Paragraph",
|
|
1520
1563
|
"richEditor.bulletList": "Bullet list",
|
|
1521
1564
|
"richEditor.numberList": "Numbered list",
|
|
@@ -1526,6 +1569,39 @@ var en_US_default = {
|
|
|
1526
1569
|
"richEditor.redo": "Redo",
|
|
1527
1570
|
"richEditor.source": "Source",
|
|
1528
1571
|
"richEditor.visual": "Visual",
|
|
1572
|
+
"richEditor.toolbar": "Formatting toolbar",
|
|
1573
|
+
"richEditor.block": "Paragraph style",
|
|
1574
|
+
"richEditor.heading1": "Heading 1",
|
|
1575
|
+
"richEditor.heading2": "Heading 2",
|
|
1576
|
+
"richEditor.heading3": "Heading 3",
|
|
1577
|
+
"richEditor.quote": "Quote",
|
|
1578
|
+
"richEditor.codeBlock": "Code block",
|
|
1579
|
+
"richEditor.fontSize": "Font size",
|
|
1580
|
+
"richEditor.defaultSize": "Default",
|
|
1581
|
+
"richEditor.inlineCode": "Inline code",
|
|
1582
|
+
"richEditor.textColor": "Text color",
|
|
1583
|
+
"richEditor.bgColor": "Background color",
|
|
1584
|
+
"richEditor.alignLeft": "Align left",
|
|
1585
|
+
"richEditor.alignCenter": "Align center",
|
|
1586
|
+
"richEditor.alignRight": "Align right",
|
|
1587
|
+
"richEditor.alignJustify": "Justify",
|
|
1588
|
+
"richEditor.outdent": "Decrease indent",
|
|
1589
|
+
"richEditor.indent": "Increase indent",
|
|
1590
|
+
"richEditor.unlink": "Remove link",
|
|
1591
|
+
"richEditor.image": "Insert image",
|
|
1592
|
+
"richEditor.singleImage": "Insert single image",
|
|
1593
|
+
"richEditor.multiImage": "Insert multiple images",
|
|
1594
|
+
"richEditor.mediaLibrary": "Choose from media library",
|
|
1595
|
+
"richEditor.hr": "Divider",
|
|
1596
|
+
"richEditor.fullscreen": "Fullscreen",
|
|
1597
|
+
"richEditor.exitFullscreen": "Exit fullscreen",
|
|
1598
|
+
"richEditor.wordCount": "{count} characters",
|
|
1599
|
+
"richEditor.uploading": "Uploading {count} image(s)\u2026",
|
|
1600
|
+
"richEditor.uploadFailed": "Image upload failed",
|
|
1601
|
+
"richEditor.imageTypeError": "Only image files are allowed",
|
|
1602
|
+
"richEditor.imageSizeError": "Image must be smaller than {size}MB",
|
|
1603
|
+
"richEditor.imageUrlInvalid": "Invalid image URL, insertion rejected",
|
|
1604
|
+
"richEditor.linkInvalid": "Only http(s), mailto, tel or relative URLs are allowed",
|
|
1529
1605
|
"approval.start": "Started",
|
|
1530
1606
|
"approval.cc": "CC",
|
|
1531
1607
|
"approval.approved": "Approved",
|
|
@@ -1646,7 +1722,7 @@ function t(key, params) {
|
|
|
1646
1722
|
// src/utils/panel.js
|
|
1647
1723
|
var PANEL_HIDDEN_STYLE = { position: "fixed", left: "0px", top: "0px", visibility: "hidden" };
|
|
1648
1724
|
function bindPanelListeners({ root, panel, onClose, onReposition, esc = true }) {
|
|
1649
|
-
const el = (
|
|
1725
|
+
const el = (ref51) => typeof ref51 === "function" ? ref51() : ref51;
|
|
1650
1726
|
function onDocumentMousedown(event) {
|
|
1651
1727
|
const rootEl = el(root);
|
|
1652
1728
|
const panelEl = el(panel);
|
|
@@ -4019,12 +4095,18 @@ var progress_default = {
|
|
|
4019
4095
|
name: "DjmProgress",
|
|
4020
4096
|
props: {
|
|
4021
4097
|
percent: { type: Number, default: 0 },
|
|
4098
|
+
// line 横向 / circle 环形
|
|
4099
|
+
type: { type: String, default: "line" },
|
|
4022
4100
|
// '' / success / error / warning
|
|
4023
4101
|
status: { type: String, default: "" },
|
|
4024
4102
|
showText: { type: Boolean, default: true },
|
|
4025
4103
|
strokeWidth: { type: Number, default: 6 },
|
|
4026
4104
|
// 自定义进度色,不传由状态决定
|
|
4027
|
-
color: { type: String, default: "" }
|
|
4105
|
+
color: { type: String, default: "" },
|
|
4106
|
+
// 环形直径(px)
|
|
4107
|
+
size: { type: Number, default: 96 },
|
|
4108
|
+
// 无障碍名称,默认「进度」
|
|
4109
|
+
label: { type: String, default: "" }
|
|
4028
4110
|
},
|
|
4029
4111
|
computed: {
|
|
4030
4112
|
safePercent() {
|
|
@@ -4037,10 +4119,72 @@ var progress_default = {
|
|
|
4037
4119
|
},
|
|
4038
4120
|
trackStyle() {
|
|
4039
4121
|
return { height: this.strokeWidth + "px" };
|
|
4122
|
+
},
|
|
4123
|
+
circleSize() {
|
|
4124
|
+
return Math.max(48, Number(this.size) || 96);
|
|
4125
|
+
},
|
|
4126
|
+
circleRadius() {
|
|
4127
|
+
return (this.circleSize - this.strokeWidth) / 2;
|
|
4128
|
+
},
|
|
4129
|
+
circleLength() {
|
|
4130
|
+
return 2 * Math.PI * this.circleRadius;
|
|
4131
|
+
},
|
|
4132
|
+
circleOffset() {
|
|
4133
|
+
return this.circleLength * (1 - this.safePercent / 100);
|
|
4134
|
+
},
|
|
4135
|
+
circleStyle() {
|
|
4136
|
+
return { width: this.circleSize + "px", height: this.circleSize + "px" };
|
|
4137
|
+
},
|
|
4138
|
+
circleLabelStyle() {
|
|
4139
|
+
return { fontSize: Math.max(12, Math.round(this.circleSize / 5)) + "px" };
|
|
4040
4140
|
}
|
|
4041
4141
|
},
|
|
4042
4142
|
template: `
|
|
4043
|
-
<div
|
|
4143
|
+
<div
|
|
4144
|
+
v-if="type === 'circle'"
|
|
4145
|
+
class="djm-progress-circle"
|
|
4146
|
+
:class="status ? 'djm-is-' + status : ''"
|
|
4147
|
+
:style="circleStyle"
|
|
4148
|
+
role="progressbar"
|
|
4149
|
+
:aria-label="label || '\u8FDB\u5EA6'"
|
|
4150
|
+
:aria-valuenow="safePercent"
|
|
4151
|
+
aria-valuemin="0"
|
|
4152
|
+
aria-valuemax="100"
|
|
4153
|
+
>
|
|
4154
|
+
<svg :viewBox="'0 0 ' + circleSize + ' ' + circleSize" aria-hidden="true">
|
|
4155
|
+
<circle
|
|
4156
|
+
class="djm-progress-circle-track"
|
|
4157
|
+
:cx="circleSize / 2"
|
|
4158
|
+
:cy="circleSize / 2"
|
|
4159
|
+
:r="circleRadius"
|
|
4160
|
+
:stroke-width="strokeWidth"
|
|
4161
|
+
fill="none"
|
|
4162
|
+
/>
|
|
4163
|
+
<circle
|
|
4164
|
+
class="djm-progress-circle-bar"
|
|
4165
|
+
:cx="circleSize / 2"
|
|
4166
|
+
:cy="circleSize / 2"
|
|
4167
|
+
:r="circleRadius"
|
|
4168
|
+
:stroke-width="strokeWidth"
|
|
4169
|
+
fill="none"
|
|
4170
|
+
stroke-linecap="round"
|
|
4171
|
+
:stroke-dasharray="circleLength"
|
|
4172
|
+
:stroke-dashoffset="circleOffset"
|
|
4173
|
+
:style="color ? { stroke: color } : null"
|
|
4174
|
+
/>
|
|
4175
|
+
</svg>
|
|
4176
|
+
<span v-if="showText" class="djm-progress-circle-label" :style="circleLabelStyle">{{ safePercent }}%</span>
|
|
4177
|
+
</div>
|
|
4178
|
+
<div
|
|
4179
|
+
v-else
|
|
4180
|
+
class="djm-progress-line"
|
|
4181
|
+
:class="status ? 'djm-is-' + status : ''"
|
|
4182
|
+
role="progressbar"
|
|
4183
|
+
:aria-label="label || '\u8FDB\u5EA6'"
|
|
4184
|
+
:aria-valuenow="safePercent"
|
|
4185
|
+
aria-valuemin="0"
|
|
4186
|
+
aria-valuemax="100"
|
|
4187
|
+
>
|
|
4044
4188
|
<div class="djm-progress" :style="trackStyle">
|
|
4045
4189
|
<div class="djm-progress-bar" :style="barStyle"></div>
|
|
4046
4190
|
</div>
|
|
@@ -5242,48 +5386,91 @@ var alert_default = {
|
|
|
5242
5386
|
};
|
|
5243
5387
|
|
|
5244
5388
|
// src/components/spin/index.js
|
|
5389
|
+
import { onBeforeUnmount as onBeforeUnmount4, ref as ref3, watch as watch3 } from "vue";
|
|
5245
5390
|
var spin_default = {
|
|
5246
5391
|
name: "DjmSpin",
|
|
5247
5392
|
props: {
|
|
5248
5393
|
spinning: { type: Boolean, default: true },
|
|
5249
|
-
size: { type: String, default: "md" },
|
|
5250
5394
|
// sm | md | lg
|
|
5251
|
-
|
|
5395
|
+
size: { type: String, default: "md" },
|
|
5396
|
+
// ring 环形 / dots 点状 / bars 柱状 / pulse 脉冲
|
|
5397
|
+
type: { type: String, default: "ring" },
|
|
5398
|
+
tip: { type: String, default: "" },
|
|
5399
|
+
// 延迟多少毫秒后显示,0 表示立即
|
|
5400
|
+
delay: { type: Number, default: 0 },
|
|
5401
|
+
// 全屏加载:遮罩铺满视口
|
|
5402
|
+
fullscreen: { type: Boolean, default: false },
|
|
5403
|
+
// 自定义指示器颜色,默认跟随品牌色
|
|
5404
|
+
color: { type: String, default: "" }
|
|
5405
|
+
},
|
|
5406
|
+
setup(props) {
|
|
5407
|
+
const visible = ref3(false);
|
|
5408
|
+
let timer = null;
|
|
5409
|
+
function sync() {
|
|
5410
|
+
window.clearTimeout(timer);
|
|
5411
|
+
timer = null;
|
|
5412
|
+
if (!props.spinning) {
|
|
5413
|
+
visible.value = false;
|
|
5414
|
+
return;
|
|
5415
|
+
}
|
|
5416
|
+
if (props.delay > 0) {
|
|
5417
|
+
timer = window.setTimeout(() => {
|
|
5418
|
+
visible.value = true;
|
|
5419
|
+
}, props.delay);
|
|
5420
|
+
} else {
|
|
5421
|
+
visible.value = true;
|
|
5422
|
+
}
|
|
5423
|
+
}
|
|
5424
|
+
watch3(() => [props.spinning, props.delay], sync, { immediate: true });
|
|
5425
|
+
onBeforeUnmount4(() => window.clearTimeout(timer));
|
|
5426
|
+
return { visible };
|
|
5252
5427
|
},
|
|
5253
5428
|
computed: {
|
|
5254
|
-
// 有默认插槽即为包裹模式
|
|
5255
5429
|
wrapped() {
|
|
5256
5430
|
return !!this.$slots.default;
|
|
5431
|
+
},
|
|
5432
|
+
rootClass() {
|
|
5433
|
+
return [
|
|
5434
|
+
"djm-spin",
|
|
5435
|
+
"djm-spin-" + this.size,
|
|
5436
|
+
{
|
|
5437
|
+
"djm-spin-wrap": this.wrapped && !this.fullscreen,
|
|
5438
|
+
"djm-spin-inline": !this.wrapped && !this.fullscreen,
|
|
5439
|
+
"djm-spin-fullscreen": this.fullscreen
|
|
5440
|
+
}
|
|
5441
|
+
];
|
|
5257
5442
|
}
|
|
5258
5443
|
},
|
|
5259
5444
|
template: `
|
|
5260
5445
|
<div
|
|
5261
|
-
v-if="wrapped"
|
|
5262
|
-
class="
|
|
5263
|
-
:
|
|
5264
|
-
:
|
|
5446
|
+
v-if="fullscreen || wrapped || visible"
|
|
5447
|
+
:class="rootClass"
|
|
5448
|
+
:aria-busy="String(visible)"
|
|
5449
|
+
:role="visible ? 'status' : undefined"
|
|
5450
|
+
:aria-label="!wrapped && !fullscreen && !tip && visible ? '\u52A0\u8F7D\u4E2D' : undefined"
|
|
5265
5451
|
>
|
|
5266
|
-
<slot />
|
|
5267
|
-
<div v-if="
|
|
5268
|
-
<span class="djm-
|
|
5452
|
+
<slot v-if="wrapped && !fullscreen" />
|
|
5453
|
+
<div v-if="visible" class="djm-spin-mask">
|
|
5454
|
+
<span class="djm-spin-indicator" :class="'djm-spin-' + type" :style="color ? { color } : null">
|
|
5455
|
+
<slot name="indicator">
|
|
5456
|
+
<i v-if="type === 'ring'" class="djm-spinner"></i>
|
|
5457
|
+
<template v-else-if="type === 'dots'">
|
|
5458
|
+
<i></i><i></i><i></i>
|
|
5459
|
+
</template>
|
|
5460
|
+
<template v-else-if="type === 'bars'">
|
|
5461
|
+
<i></i><i></i><i></i><i></i>
|
|
5462
|
+
</template>
|
|
5463
|
+
<i v-else class="djm-spin-core"></i>
|
|
5464
|
+
</slot>
|
|
5465
|
+
</span>
|
|
5269
5466
|
<span v-if="tip" class="djm-spin-tip">{{ tip }}</span>
|
|
5270
5467
|
</div>
|
|
5271
5468
|
</div>
|
|
5272
|
-
<span
|
|
5273
|
-
v-else
|
|
5274
|
-
class="djm-spin-inline"
|
|
5275
|
-
:class="'djm-spin-' + size"
|
|
5276
|
-
role="status"
|
|
5277
|
-
:aria-label="tip ? undefined : '\u52A0\u8F7D\u4E2D'"
|
|
5278
|
-
>
|
|
5279
|
-
<span class="djm-spinner"></span>
|
|
5280
|
-
<span v-if="tip" class="djm-spin-tip">{{ tip }}</span>
|
|
5281
|
-
</span>
|
|
5282
5469
|
`
|
|
5283
5470
|
};
|
|
5284
5471
|
|
|
5285
5472
|
// src/components/popconfirm/index.js
|
|
5286
|
-
import { nextTick as nextTick3, onBeforeUnmount as
|
|
5473
|
+
import { nextTick as nextTick3, onBeforeUnmount as onBeforeUnmount5, onMounted as onMounted3, ref as ref4, watch as watch4 } from "vue";
|
|
5287
5474
|
var popconfirm_default = {
|
|
5288
5475
|
name: "DjmPopconfirm",
|
|
5289
5476
|
components: { DjmIcon: icon_default },
|
|
@@ -5299,10 +5486,10 @@ var popconfirm_default = {
|
|
|
5299
5486
|
},
|
|
5300
5487
|
emits: ["confirm", "cancel", "visible-change"],
|
|
5301
5488
|
setup(props, { emit }) {
|
|
5302
|
-
const open =
|
|
5303
|
-
const root =
|
|
5304
|
-
const panelEl =
|
|
5305
|
-
const panelStyle =
|
|
5489
|
+
const open = ref4(false);
|
|
5490
|
+
const root = ref4(null);
|
|
5491
|
+
const panelEl = ref4(null);
|
|
5492
|
+
const panelStyle = ref4({});
|
|
5306
5493
|
const PANEL_WIDTH = 244;
|
|
5307
5494
|
let detachPanel = null;
|
|
5308
5495
|
function syncTriggerA11y() {
|
|
@@ -5318,7 +5505,7 @@ var popconfirm_default = {
|
|
|
5318
5505
|
target.setAttribute("aria-expanded", String(open.value));
|
|
5319
5506
|
}
|
|
5320
5507
|
onMounted3(() => nextTick3(syncTriggerA11y));
|
|
5321
|
-
|
|
5508
|
+
watch4(open, () => nextTick3(syncTriggerA11y));
|
|
5322
5509
|
function updatePosition() {
|
|
5323
5510
|
if (!open.value || !root.value) return;
|
|
5324
5511
|
const rect = root.value.getBoundingClientRect();
|
|
@@ -5377,7 +5564,7 @@ var popconfirm_default = {
|
|
|
5377
5564
|
emit("cancel");
|
|
5378
5565
|
close2();
|
|
5379
5566
|
}
|
|
5380
|
-
|
|
5567
|
+
onBeforeUnmount5(close2);
|
|
5381
5568
|
return { open, root, panelEl, panelStyle, toggle, close: close2, confirm, cancel };
|
|
5382
5569
|
},
|
|
5383
5570
|
template: `
|
|
@@ -5421,7 +5608,7 @@ var popconfirm_default = {
|
|
|
5421
5608
|
};
|
|
5422
5609
|
|
|
5423
5610
|
// src/components/anchor/index.js
|
|
5424
|
-
import { onBeforeUnmount as
|
|
5611
|
+
import { onBeforeUnmount as onBeforeUnmount6, onMounted as onMounted4, ref as ref5, watch as watch5 } from "vue";
|
|
5425
5612
|
var anchor_default = {
|
|
5426
5613
|
name: "DjmAnchor",
|
|
5427
5614
|
props: {
|
|
@@ -5434,8 +5621,8 @@ var anchor_default = {
|
|
|
5434
5621
|
},
|
|
5435
5622
|
emits: ["change"],
|
|
5436
5623
|
setup(props, { emit }) {
|
|
5437
|
-
const root =
|
|
5438
|
-
const activeKey =
|
|
5624
|
+
const root = ref5(null);
|
|
5625
|
+
const activeKey = ref5("");
|
|
5439
5626
|
let scrollEl = null;
|
|
5440
5627
|
let target = null;
|
|
5441
5628
|
function resolveContainer() {
|
|
@@ -5490,8 +5677,8 @@ var anchor_default = {
|
|
|
5490
5677
|
emit("change", item.href);
|
|
5491
5678
|
}
|
|
5492
5679
|
onMounted4(bind);
|
|
5493
|
-
|
|
5494
|
-
|
|
5680
|
+
watch5(() => props.container, bind);
|
|
5681
|
+
onBeforeUnmount6(unbind);
|
|
5495
5682
|
return { root, activeKey, go };
|
|
5496
5683
|
},
|
|
5497
5684
|
template: `
|
|
@@ -5513,7 +5700,7 @@ var anchor_default = {
|
|
|
5513
5700
|
};
|
|
5514
5701
|
|
|
5515
5702
|
// src/components/backtop/index.js
|
|
5516
|
-
import { onBeforeUnmount as
|
|
5703
|
+
import { onBeforeUnmount as onBeforeUnmount7, onMounted as onMounted5, ref as ref6 } from "vue";
|
|
5517
5704
|
var backtop_default = {
|
|
5518
5705
|
name: "DjmBacktop",
|
|
5519
5706
|
components: { DjmIcon: icon_default },
|
|
@@ -5526,8 +5713,8 @@ var backtop_default = {
|
|
|
5526
5713
|
},
|
|
5527
5714
|
emits: ["click"],
|
|
5528
5715
|
setup(props, { emit }) {
|
|
5529
|
-
const visible =
|
|
5530
|
-
const root =
|
|
5716
|
+
const visible = ref6(false);
|
|
5717
|
+
const root = ref6(null);
|
|
5531
5718
|
let target = null;
|
|
5532
5719
|
let scrollEl = null;
|
|
5533
5720
|
function resolveContainer() {
|
|
@@ -5561,7 +5748,7 @@ var backtop_default = {
|
|
|
5561
5748
|
emit("click");
|
|
5562
5749
|
}
|
|
5563
5750
|
onMounted5(bind);
|
|
5564
|
-
|
|
5751
|
+
onBeforeUnmount7(unbind);
|
|
5565
5752
|
return { visible, root, toTop };
|
|
5566
5753
|
},
|
|
5567
5754
|
template: `
|
|
@@ -5638,7 +5825,7 @@ var space_default = {
|
|
|
5638
5825
|
};
|
|
5639
5826
|
|
|
5640
5827
|
// src/components/affix/index.js
|
|
5641
|
-
import { onBeforeUnmount as
|
|
5828
|
+
import { onBeforeUnmount as onBeforeUnmount8, onMounted as onMounted6, ref as ref7 } from "vue";
|
|
5642
5829
|
var affix_default = {
|
|
5643
5830
|
name: "DjmAffix",
|
|
5644
5831
|
props: {
|
|
@@ -5649,10 +5836,10 @@ var affix_default = {
|
|
|
5649
5836
|
zIndex: { type: Number, default: 900 }
|
|
5650
5837
|
},
|
|
5651
5838
|
setup(props) {
|
|
5652
|
-
const root =
|
|
5653
|
-
const fixed =
|
|
5654
|
-
const affixStyle =
|
|
5655
|
-
const holderStyle =
|
|
5839
|
+
const root = ref7(null);
|
|
5840
|
+
const fixed = ref7(false);
|
|
5841
|
+
const affixStyle = ref7({});
|
|
5842
|
+
const holderStyle = ref7({});
|
|
5656
5843
|
let target = null;
|
|
5657
5844
|
let scrollEl = null;
|
|
5658
5845
|
function resolveContainer() {
|
|
@@ -5708,7 +5895,7 @@ var affix_default = {
|
|
|
5708
5895
|
target = null;
|
|
5709
5896
|
}
|
|
5710
5897
|
onMounted6(bind);
|
|
5711
|
-
|
|
5898
|
+
onBeforeUnmount8(unbind);
|
|
5712
5899
|
return { root, fixed, affixStyle, holderStyle };
|
|
5713
5900
|
},
|
|
5714
5901
|
template: `
|
|
@@ -5759,7 +5946,7 @@ var segmented_default = {
|
|
|
5759
5946
|
};
|
|
5760
5947
|
|
|
5761
5948
|
// src/components/image/index.js
|
|
5762
|
-
import { nextTick as nextTick4, onBeforeUnmount as
|
|
5949
|
+
import { nextTick as nextTick4, onBeforeUnmount as onBeforeUnmount9, ref as ref8, watch as watch6 } from "vue";
|
|
5763
5950
|
|
|
5764
5951
|
// src/utils/scroll-lock.js
|
|
5765
5952
|
var count = 0;
|
|
@@ -5806,11 +5993,11 @@ var image_default = {
|
|
|
5806
5993
|
preview: { type: Boolean, default: true }
|
|
5807
5994
|
},
|
|
5808
5995
|
setup(props) {
|
|
5809
|
-
const failed =
|
|
5810
|
-
const open =
|
|
5811
|
-
const zoomRef =
|
|
5812
|
-
const closeRef =
|
|
5813
|
-
|
|
5996
|
+
const failed = ref8(false);
|
|
5997
|
+
const open = ref8(false);
|
|
5998
|
+
const zoomRef = ref8(null);
|
|
5999
|
+
const closeRef = ref8(null);
|
|
6000
|
+
watch6(() => props.src, () => {
|
|
5814
6001
|
failed.value = false;
|
|
5815
6002
|
});
|
|
5816
6003
|
function toSize(value) {
|
|
@@ -5834,7 +6021,7 @@ var image_default = {
|
|
|
5834
6021
|
document.removeEventListener("keydown", onKeydown);
|
|
5835
6022
|
if (zoomRef.value) zoomRef.value.focus();
|
|
5836
6023
|
}
|
|
5837
|
-
|
|
6024
|
+
onBeforeUnmount9(closePreview);
|
|
5838
6025
|
return { failed, open, zoomRef, closeRef, toSize, openPreview, closePreview, t };
|
|
5839
6026
|
},
|
|
5840
6027
|
template: `
|
|
@@ -5889,13 +6076,15 @@ var image_default = {
|
|
|
5889
6076
|
};
|
|
5890
6077
|
|
|
5891
6078
|
// src/components/watermark/index.js
|
|
5892
|
-
import { computed as computed4, onBeforeUnmount as
|
|
6079
|
+
import { computed as computed4, onBeforeUnmount as onBeforeUnmount10, onMounted as onMounted7, ref as ref10, watch as watch7 } from "vue";
|
|
5893
6080
|
|
|
5894
6081
|
// src/theme/index.js
|
|
5895
|
-
import { ref as
|
|
6082
|
+
import { ref as ref9 } from "vue";
|
|
5896
6083
|
var KEY = "djm-theme";
|
|
5897
6084
|
var COLOR_KEY = "djm-primary";
|
|
5898
|
-
var
|
|
6085
|
+
var GLASS_KEY = "djm-glass";
|
|
6086
|
+
var theme = ref9("light");
|
|
6087
|
+
var glass = ref9(false);
|
|
5899
6088
|
var PRESET_COLORS = [
|
|
5900
6089
|
{ name: "\u9ED8\u8BA4\u84DD", value: "#1a6fc4" },
|
|
5901
6090
|
{ name: "\u79D1\u6280\u84DD", value: "#2563eb" },
|
|
@@ -5906,7 +6095,7 @@ var PRESET_COLORS = [
|
|
|
5906
6095
|
{ name: "\u6731\u7802\u7EA2", value: "#c0392b" },
|
|
5907
6096
|
{ name: "\u77F3\u58A8\u7070", value: "#4b5b6b" }
|
|
5908
6097
|
];
|
|
5909
|
-
var primaryColor =
|
|
6098
|
+
var primaryColor = ref9("");
|
|
5910
6099
|
var BRAND_VARS = [
|
|
5911
6100
|
"--djm-brand-50",
|
|
5912
6101
|
"--djm-brand-100",
|
|
@@ -6028,6 +6217,15 @@ function setTheme(name) {
|
|
|
6028
6217
|
function toggleTheme() {
|
|
6029
6218
|
setTheme(theme.value === "dark" ? "light" : "dark");
|
|
6030
6219
|
}
|
|
6220
|
+
function setGlass(enabled) {
|
|
6221
|
+
glass.value = !!enabled;
|
|
6222
|
+
document.documentElement.dataset.djmGlass = glass.value ? "on" : "";
|
|
6223
|
+
try {
|
|
6224
|
+
if (glass.value) localStorage.setItem(GLASS_KEY, "1");
|
|
6225
|
+
else localStorage.removeItem(GLASS_KEY);
|
|
6226
|
+
} catch (error) {
|
|
6227
|
+
}
|
|
6228
|
+
}
|
|
6031
6229
|
function initTheme() {
|
|
6032
6230
|
let saved = "";
|
|
6033
6231
|
try {
|
|
@@ -6047,9 +6245,16 @@ function initTheme() {
|
|
|
6047
6245
|
} catch (error) {
|
|
6048
6246
|
color = "";
|
|
6049
6247
|
}
|
|
6248
|
+
let glassSaved = false;
|
|
6249
|
+
try {
|
|
6250
|
+
glassSaved = localStorage.getItem(GLASS_KEY) === "1";
|
|
6251
|
+
} catch (error) {
|
|
6252
|
+
glassSaved = false;
|
|
6253
|
+
}
|
|
6050
6254
|
if (color) primaryColor.value = color;
|
|
6051
6255
|
const next = param === "dark" || param === "light" ? param : saved || "light";
|
|
6052
6256
|
setTheme(next);
|
|
6257
|
+
setGlass(glassSaved);
|
|
6053
6258
|
}
|
|
6054
6259
|
|
|
6055
6260
|
// src/components/watermark/index.js
|
|
@@ -6065,7 +6270,7 @@ var watermark_default = {
|
|
|
6065
6270
|
zIndex: { type: Number, default: 10 }
|
|
6066
6271
|
},
|
|
6067
6272
|
setup(props) {
|
|
6068
|
-
const dataUrl =
|
|
6273
|
+
const dataUrl = ref10("");
|
|
6069
6274
|
let canvasEl = null;
|
|
6070
6275
|
function build() {
|
|
6071
6276
|
const lines = (Array.isArray(props.content) ? props.content : [props.content]).filter(Boolean);
|
|
@@ -6107,8 +6312,8 @@ var watermark_default = {
|
|
|
6107
6312
|
zIndex: props.zIndex
|
|
6108
6313
|
}));
|
|
6109
6314
|
onMounted7(build);
|
|
6110
|
-
|
|
6111
|
-
|
|
6315
|
+
watch7(() => [props.content, props.gap, props.fontSize, props.color, props.rotate, theme.value], build, { deep: true });
|
|
6316
|
+
onBeforeUnmount10(() => {
|
|
6112
6317
|
canvasEl = null;
|
|
6113
6318
|
});
|
|
6114
6319
|
return { layerStyle };
|
|
@@ -6298,7 +6503,7 @@ var autocomplete_default = {
|
|
|
6298
6503
|
};
|
|
6299
6504
|
|
|
6300
6505
|
// src/components/splitter/index.js
|
|
6301
|
-
import { computed as computed5, onBeforeUnmount as
|
|
6506
|
+
import { computed as computed5, onBeforeUnmount as onBeforeUnmount11, ref as ref11 } from "vue";
|
|
6302
6507
|
var splitter_default = {
|
|
6303
6508
|
name: "DjmSplitter",
|
|
6304
6509
|
props: {
|
|
@@ -6311,8 +6516,8 @@ var splitter_default = {
|
|
|
6311
6516
|
},
|
|
6312
6517
|
emits: ["update:modelValue", "change"],
|
|
6313
6518
|
setup(props, { emit }) {
|
|
6314
|
-
const root =
|
|
6315
|
-
const dragging =
|
|
6519
|
+
const root = ref11(null);
|
|
6520
|
+
const dragging = ref11(false);
|
|
6316
6521
|
const ratio = computed5(() => {
|
|
6317
6522
|
const value = Number(props.modelValue);
|
|
6318
6523
|
const safe = Number.isFinite(value) ? value : 50;
|
|
@@ -6357,7 +6562,7 @@ var splitter_default = {
|
|
|
6357
6562
|
commit(ratio.value + step);
|
|
6358
6563
|
}
|
|
6359
6564
|
}
|
|
6360
|
-
|
|
6565
|
+
onBeforeUnmount11(stopDrag);
|
|
6361
6566
|
return { root, dragging, ratio, startDrag, onKeydown };
|
|
6362
6567
|
},
|
|
6363
6568
|
template: `
|
|
@@ -6394,7 +6599,7 @@ var splitter_default = {
|
|
|
6394
6599
|
};
|
|
6395
6600
|
|
|
6396
6601
|
// src/components/carousel/index.js
|
|
6397
|
-
import { onBeforeUnmount as
|
|
6602
|
+
import { onBeforeUnmount as onBeforeUnmount12, onMounted as onMounted8, ref as ref12, watch as watch8 } from "vue";
|
|
6398
6603
|
var carousel_default = {
|
|
6399
6604
|
name: "DjmCarousel",
|
|
6400
6605
|
components: { DjmIcon: icon_default },
|
|
@@ -6408,7 +6613,7 @@ var carousel_default = {
|
|
|
6408
6613
|
},
|
|
6409
6614
|
emits: ["change"],
|
|
6410
6615
|
setup(props, { emit }) {
|
|
6411
|
-
const index =
|
|
6616
|
+
const index = ref12(0);
|
|
6412
6617
|
let timer = null;
|
|
6413
6618
|
const boxStyle = () => ({
|
|
6414
6619
|
height: typeof props.height === "number" ? props.height + "px" : props.height
|
|
@@ -6446,14 +6651,14 @@ var carousel_default = {
|
|
|
6446
6651
|
}
|
|
6447
6652
|
}
|
|
6448
6653
|
onMounted8(start);
|
|
6449
|
-
|
|
6654
|
+
watch8(() => [props.autoplay, props.interval, props.items.length], start);
|
|
6450
6655
|
function pause() {
|
|
6451
6656
|
if (props.autoplay) stop();
|
|
6452
6657
|
}
|
|
6453
6658
|
function resume() {
|
|
6454
6659
|
if (props.autoplay) start();
|
|
6455
6660
|
}
|
|
6456
|
-
|
|
6661
|
+
onBeforeUnmount12(stop);
|
|
6457
6662
|
return { index, boxStyle, go, next, prev, onKeydown, pause, resume };
|
|
6458
6663
|
},
|
|
6459
6664
|
template: `
|
|
@@ -6513,7 +6718,7 @@ var carousel_default = {
|
|
|
6513
6718
|
};
|
|
6514
6719
|
|
|
6515
6720
|
// src/components/tour/index.js
|
|
6516
|
-
import { computed as computed6, nextTick as nextTick5, onBeforeUnmount as
|
|
6721
|
+
import { computed as computed6, nextTick as nextTick5, onBeforeUnmount as onBeforeUnmount13, onMounted as onMounted9, ref as ref13, watch as watch9 } from "vue";
|
|
6517
6722
|
var tour_default = {
|
|
6518
6723
|
name: "DjmTour",
|
|
6519
6724
|
components: { DjmIcon: icon_default },
|
|
@@ -6525,10 +6730,10 @@ var tour_default = {
|
|
|
6525
6730
|
},
|
|
6526
6731
|
emits: ["update:modelValue", "change", "finish"],
|
|
6527
6732
|
setup(props, { emit }) {
|
|
6528
|
-
const current =
|
|
6529
|
-
const highlight =
|
|
6530
|
-
const cardStyle =
|
|
6531
|
-
const card =
|
|
6733
|
+
const current = ref13(0);
|
|
6734
|
+
const highlight = ref13({ top: "0px", left: "0px", width: "0px", height: "0px" });
|
|
6735
|
+
const cardStyle = ref13({ position: "fixed", left: "0px", top: "0px", visibility: "hidden" });
|
|
6736
|
+
const card = ref13(null);
|
|
6532
6737
|
const step = computed6(() => props.steps[current.value] || null);
|
|
6533
6738
|
function update() {
|
|
6534
6739
|
const scene = step.value;
|
|
@@ -6589,14 +6794,14 @@ var tour_default = {
|
|
|
6589
6794
|
emit("change", current.value);
|
|
6590
6795
|
nextTick5(update);
|
|
6591
6796
|
}
|
|
6592
|
-
|
|
6797
|
+
watch9(() => props.modelValue, (value) => {
|
|
6593
6798
|
if (value) startScene();
|
|
6594
6799
|
else stopScene();
|
|
6595
6800
|
});
|
|
6596
6801
|
onMounted9(() => {
|
|
6597
6802
|
if (props.modelValue) startScene();
|
|
6598
6803
|
});
|
|
6599
|
-
|
|
6804
|
+
onBeforeUnmount13(stopScene);
|
|
6600
6805
|
return { current, step, highlight, cardStyle, card, close: close2, next, prev, t };
|
|
6601
6806
|
},
|
|
6602
6807
|
template: `
|
|
@@ -6634,7 +6839,7 @@ var tour_default = {
|
|
|
6634
6839
|
};
|
|
6635
6840
|
|
|
6636
6841
|
// src/components/calendar/index.js
|
|
6637
|
-
import { computed as computed7, ref as
|
|
6842
|
+
import { computed as computed7, ref as ref14, watch as watch10 } from "vue";
|
|
6638
6843
|
function pad2(num) {
|
|
6639
6844
|
return String(num).padStart(2, "0");
|
|
6640
6845
|
}
|
|
@@ -6664,8 +6869,8 @@ var calendar_default = {
|
|
|
6664
6869
|
const today = /* @__PURE__ */ new Date();
|
|
6665
6870
|
const todayKey = toKey(today.getFullYear(), today.getMonth(), today.getDate());
|
|
6666
6871
|
const initial = parse(props.modelValue);
|
|
6667
|
-
const viewYear =
|
|
6668
|
-
const viewMonth =
|
|
6872
|
+
const viewYear = ref14(initial ? initial.year : today.getFullYear());
|
|
6873
|
+
const viewMonth = ref14(initial ? initial.month : today.getMonth());
|
|
6669
6874
|
const weekNames = computed7(() => {
|
|
6670
6875
|
const base = ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
|
|
6671
6876
|
return base.slice(props.firstDay).concat(base.slice(0, props.firstDay));
|
|
@@ -6731,7 +6936,7 @@ var calendar_default = {
|
|
|
6731
6936
|
event.preventDefault();
|
|
6732
6937
|
list[next].focus();
|
|
6733
6938
|
}
|
|
6734
|
-
|
|
6939
|
+
watch10(() => props.modelValue, (value) => {
|
|
6735
6940
|
const parts = parse(value);
|
|
6736
6941
|
if (parts && (parts.year !== viewYear.value || parts.month !== viewMonth.value)) {
|
|
6737
6942
|
viewYear.value = parts.year;
|
|
@@ -6785,7 +6990,7 @@ var calendar_default = {
|
|
|
6785
6990
|
};
|
|
6786
6991
|
|
|
6787
6992
|
// src/components/float-button/index.js
|
|
6788
|
-
import { onBeforeUnmount as
|
|
6993
|
+
import { onBeforeUnmount as onBeforeUnmount14, ref as ref15 } from "vue";
|
|
6789
6994
|
var float_button_default = {
|
|
6790
6995
|
name: "DjmFloatButton",
|
|
6791
6996
|
components: { DjmIcon: icon_default },
|
|
@@ -6801,7 +7006,7 @@ var float_button_default = {
|
|
|
6801
7006
|
},
|
|
6802
7007
|
emits: ["click", "select"],
|
|
6803
7008
|
setup(props, { emit }) {
|
|
6804
|
-
const open =
|
|
7009
|
+
const open = ref15(false);
|
|
6805
7010
|
function onKeydown(event) {
|
|
6806
7011
|
if (event.key === "Escape") close2();
|
|
6807
7012
|
}
|
|
@@ -6836,7 +7041,7 @@ var float_button_default = {
|
|
|
6836
7041
|
emit("select", item);
|
|
6837
7042
|
if (typeof item.onClick === "function") item.onClick(item);
|
|
6838
7043
|
}
|
|
6839
|
-
|
|
7044
|
+
onBeforeUnmount14(close2);
|
|
6840
7045
|
return { open, onMainClick, choose };
|
|
6841
7046
|
},
|
|
6842
7047
|
template: `
|
|
@@ -6871,7 +7076,7 @@ var float_button_default = {
|
|
|
6871
7076
|
};
|
|
6872
7077
|
|
|
6873
7078
|
// src/components/mentions/index.js
|
|
6874
|
-
import { computed as computed8, nextTick as nextTick6, onBeforeUnmount as
|
|
7079
|
+
import { computed as computed8, nextTick as nextTick6, onBeforeUnmount as onBeforeUnmount15, ref as ref16, watch as watch11 } from "vue";
|
|
6875
7080
|
var uidSeed3 = 0;
|
|
6876
7081
|
var mentions_default = {
|
|
6877
7082
|
name: "DjmMentions",
|
|
@@ -6886,17 +7091,17 @@ var mentions_default = {
|
|
|
6886
7091
|
},
|
|
6887
7092
|
emits: ["update:modelValue", "input", "select"],
|
|
6888
7093
|
setup(props, { emit }) {
|
|
6889
|
-
const root =
|
|
6890
|
-
const input =
|
|
6891
|
-
const text =
|
|
6892
|
-
const open =
|
|
6893
|
-
const keyword =
|
|
6894
|
-
const activeIndex =
|
|
7094
|
+
const root = ref16(null);
|
|
7095
|
+
const input = ref16(null);
|
|
7096
|
+
const text = ref16(props.modelValue);
|
|
7097
|
+
const open = ref16(false);
|
|
7098
|
+
const keyword = ref16("");
|
|
7099
|
+
const activeIndex = ref16(-1);
|
|
6895
7100
|
const listId = "djm-mentions-" + ++uidSeed3;
|
|
6896
|
-
const panelStyle =
|
|
7101
|
+
const panelStyle = ref16({ ...PANEL_HIDDEN_STYLE });
|
|
6897
7102
|
let triggerIndex = -1;
|
|
6898
7103
|
let detachPanel = null;
|
|
6899
|
-
|
|
7104
|
+
watch11(() => props.modelValue, (value) => {
|
|
6900
7105
|
text.value = value;
|
|
6901
7106
|
});
|
|
6902
7107
|
const normalized = computed8(() => props.options.map((item) => typeof item === "string" ? { value: item, label: item } : item));
|
|
@@ -6989,7 +7194,7 @@ var mentions_default = {
|
|
|
6989
7194
|
input.value.setSelectionRange(pos, pos);
|
|
6990
7195
|
});
|
|
6991
7196
|
}
|
|
6992
|
-
|
|
7197
|
+
onBeforeUnmount15(closePanel);
|
|
6993
7198
|
return {
|
|
6994
7199
|
root,
|
|
6995
7200
|
input,
|
|
@@ -7263,7 +7468,7 @@ var input_tag_default = {
|
|
|
7263
7468
|
};
|
|
7264
7469
|
|
|
7265
7470
|
// src/components/password/index.js
|
|
7266
|
-
import { computed as computed9, ref as
|
|
7471
|
+
import { computed as computed9, ref as ref17 } from "vue";
|
|
7267
7472
|
var password_default = {
|
|
7268
7473
|
name: "DjmPassword",
|
|
7269
7474
|
components: { DjmIcon: icon_default },
|
|
@@ -7277,7 +7482,7 @@ var password_default = {
|
|
|
7277
7482
|
},
|
|
7278
7483
|
emits: ["update:modelValue", "input", "change", "enter", "focus", "blur"],
|
|
7279
7484
|
setup(props, { emit }) {
|
|
7280
|
-
const visible =
|
|
7485
|
+
const visible = ref17(false);
|
|
7281
7486
|
const score = computed9(() => {
|
|
7282
7487
|
const value = props.modelValue || "";
|
|
7283
7488
|
if (!value) return 0;
|
|
@@ -7343,7 +7548,7 @@ var password_default = {
|
|
|
7343
7548
|
};
|
|
7344
7549
|
|
|
7345
7550
|
// src/components/command-palette/index.js
|
|
7346
|
-
import { computed as computed10, nextTick as nextTick7, onBeforeUnmount as
|
|
7551
|
+
import { computed as computed10, nextTick as nextTick7, onBeforeUnmount as onBeforeUnmount16, onMounted as onMounted10, ref as ref18, watch as watch12 } from "vue";
|
|
7347
7552
|
|
|
7348
7553
|
// src/utils/focus-trap.js
|
|
7349
7554
|
var FOCUSABLE = [
|
|
@@ -7396,11 +7601,11 @@ var command_palette_default = {
|
|
|
7396
7601
|
},
|
|
7397
7602
|
emits: ["update:modelValue", "run"],
|
|
7398
7603
|
setup(props, { emit }) {
|
|
7399
|
-
const open =
|
|
7400
|
-
const keyword =
|
|
7401
|
-
const activeIndex =
|
|
7402
|
-
const searchInput =
|
|
7403
|
-
const panelEl =
|
|
7604
|
+
const open = ref18(false);
|
|
7605
|
+
const keyword = ref18("");
|
|
7606
|
+
const activeIndex = ref18(-1);
|
|
7607
|
+
const searchInput = ref18(null);
|
|
7608
|
+
const panelEl = ref18(null);
|
|
7404
7609
|
const listId = "djm-command-list-" + ++uidSeed4;
|
|
7405
7610
|
let releaseTrap = null;
|
|
7406
7611
|
const filtered = computed10(() => {
|
|
@@ -7483,12 +7688,12 @@ var command_palette_default = {
|
|
|
7483
7688
|
if (typeof item.run === "function") item.run(item);
|
|
7484
7689
|
hide();
|
|
7485
7690
|
}
|
|
7486
|
-
|
|
7691
|
+
watch12(() => props.modelValue, (value) => {
|
|
7487
7692
|
if (value) show();
|
|
7488
7693
|
else hide();
|
|
7489
7694
|
});
|
|
7490
7695
|
onMounted10(() => window.addEventListener("keydown", onGlobalKeydown));
|
|
7491
|
-
|
|
7696
|
+
onBeforeUnmount16(() => {
|
|
7492
7697
|
window.removeEventListener("keydown", onGlobalKeydown);
|
|
7493
7698
|
hide();
|
|
7494
7699
|
});
|
|
@@ -7540,7 +7745,7 @@ var command_palette_default = {
|
|
|
7540
7745
|
};
|
|
7541
7746
|
|
|
7542
7747
|
// src/components/qrcode/index.js
|
|
7543
|
-
import { onMounted as onMounted11, ref as
|
|
7748
|
+
import { onMounted as onMounted11, ref as ref19, watch as watch13 } from "vue";
|
|
7544
7749
|
var qrcode_default = {
|
|
7545
7750
|
name: "DjmQRCode",
|
|
7546
7751
|
props: {
|
|
@@ -7555,8 +7760,8 @@ var qrcode_default = {
|
|
|
7555
7760
|
alt: { type: String, default: "\u4E8C\u7EF4\u7801" }
|
|
7556
7761
|
},
|
|
7557
7762
|
setup(props) {
|
|
7558
|
-
const src =
|
|
7559
|
-
const error =
|
|
7763
|
+
const src = ref19("");
|
|
7764
|
+
const error = ref19("");
|
|
7560
7765
|
let lib = null;
|
|
7561
7766
|
let seq2 = 0;
|
|
7562
7767
|
async function ensureLib() {
|
|
@@ -7593,7 +7798,7 @@ var qrcode_default = {
|
|
|
7593
7798
|
}
|
|
7594
7799
|
}
|
|
7595
7800
|
onMounted11(render);
|
|
7596
|
-
|
|
7801
|
+
watch13(() => [props.value, props.size, props.level, props.margin, props.dark, props.light], render);
|
|
7597
7802
|
return { src, error };
|
|
7598
7803
|
},
|
|
7599
7804
|
template: `
|
|
@@ -7632,7 +7837,7 @@ var status_default = {
|
|
|
7632
7837
|
};
|
|
7633
7838
|
|
|
7634
7839
|
// src/components/tooltip/index.js
|
|
7635
|
-
import { ref as
|
|
7840
|
+
import { ref as ref20, nextTick as nextTick8, onBeforeUnmount as onBeforeUnmount17 } from "vue";
|
|
7636
7841
|
var uid2 = 0;
|
|
7637
7842
|
var tooltip_default = {
|
|
7638
7843
|
name: "DjmTooltip",
|
|
@@ -7643,11 +7848,11 @@ var tooltip_default = {
|
|
|
7643
7848
|
delay: { type: Number, default: 80 }
|
|
7644
7849
|
},
|
|
7645
7850
|
setup(props) {
|
|
7646
|
-
const visible =
|
|
7647
|
-
const rootRef =
|
|
7648
|
-
const contentRef =
|
|
7649
|
-
const actualPlacement =
|
|
7650
|
-
const panelStyle =
|
|
7851
|
+
const visible = ref20(false);
|
|
7852
|
+
const rootRef = ref20(null);
|
|
7853
|
+
const contentRef = ref20(null);
|
|
7854
|
+
const actualPlacement = ref20(props.placement);
|
|
7855
|
+
const panelStyle = ref20({});
|
|
7651
7856
|
const tipId = "djm-tooltip-" + ++uid2;
|
|
7652
7857
|
let timer = null;
|
|
7653
7858
|
function triggerEl() {
|
|
@@ -7718,7 +7923,7 @@ var tooltip_default = {
|
|
|
7718
7923
|
bindTrigger(false);
|
|
7719
7924
|
bindReposition(false);
|
|
7720
7925
|
}
|
|
7721
|
-
|
|
7926
|
+
onBeforeUnmount17(() => {
|
|
7722
7927
|
window.clearTimeout(timer);
|
|
7723
7928
|
bindReposition(false);
|
|
7724
7929
|
});
|
|
@@ -7743,7 +7948,7 @@ var tooltip_default = {
|
|
|
7743
7948
|
};
|
|
7744
7949
|
|
|
7745
7950
|
// src/components/dropdown/index.js
|
|
7746
|
-
import { nextTick as nextTick9, onBeforeUnmount as
|
|
7951
|
+
import { nextTick as nextTick9, onBeforeUnmount as onBeforeUnmount18, onMounted as onMounted12, ref as ref21, watch as watch14 } from "vue";
|
|
7747
7952
|
var dropdown_default = {
|
|
7748
7953
|
name: "DjmDropdown",
|
|
7749
7954
|
components: { DjmIcon: icon_default },
|
|
@@ -7760,10 +7965,10 @@ var dropdown_default = {
|
|
|
7760
7965
|
},
|
|
7761
7966
|
emits: ["select", "visible-change"],
|
|
7762
7967
|
setup(props, { emit }) {
|
|
7763
|
-
const open =
|
|
7764
|
-
const root =
|
|
7765
|
-
const menuEl =
|
|
7766
|
-
const panelStyle =
|
|
7968
|
+
const open = ref21(false);
|
|
7969
|
+
const root = ref21(null);
|
|
7970
|
+
const menuEl = ref21(null);
|
|
7971
|
+
const panelStyle = ref21({});
|
|
7767
7972
|
let detachPanel = null;
|
|
7768
7973
|
function syncTriggerA11y() {
|
|
7769
7974
|
const wrapper = root.value && root.value.querySelector(".djm-dropdown-trigger");
|
|
@@ -7777,7 +7982,7 @@ var dropdown_default = {
|
|
|
7777
7982
|
else target.removeAttribute("aria-disabled");
|
|
7778
7983
|
}
|
|
7779
7984
|
onMounted12(() => nextTick9(syncTriggerA11y));
|
|
7780
|
-
|
|
7985
|
+
watch14(open, () => nextTick9(syncTriggerA11y));
|
|
7781
7986
|
function updatePosition() {
|
|
7782
7987
|
if (!open.value || !root.value) return;
|
|
7783
7988
|
const rect = root.value.getBoundingClientRect();
|
|
@@ -7880,7 +8085,7 @@ var dropdown_default = {
|
|
|
7880
8085
|
emit("select", item);
|
|
7881
8086
|
if (props.closeOnSelect) close2();
|
|
7882
8087
|
}
|
|
7883
|
-
|
|
8088
|
+
onBeforeUnmount18(() => {
|
|
7884
8089
|
window.clearTimeout(hoverTimer);
|
|
7885
8090
|
close2();
|
|
7886
8091
|
});
|
|
@@ -7945,7 +8150,7 @@ var dropdown_default = {
|
|
|
7945
8150
|
};
|
|
7946
8151
|
|
|
7947
8152
|
// src/components/drawer/index.js
|
|
7948
|
-
import { ref as
|
|
8153
|
+
import { ref as ref22, nextTick as nextTick10, watch as watch15, onMounted as onMounted13, onBeforeUnmount as onBeforeUnmount19 } from "vue";
|
|
7949
8154
|
var uid3 = 0;
|
|
7950
8155
|
var drawer_default = {
|
|
7951
8156
|
name: "DjmDrawer",
|
|
@@ -7958,11 +8163,13 @@ var drawer_default = {
|
|
|
7958
8163
|
// 点击遮罩关闭
|
|
7959
8164
|
maskClosable: { type: Boolean, default: true },
|
|
7960
8165
|
showClose: { type: Boolean, default: true },
|
|
7961
|
-
closeOnEsc: { type: Boolean, default: true }
|
|
8166
|
+
closeOnEsc: { type: Boolean, default: true },
|
|
8167
|
+
// 毛玻璃底
|
|
8168
|
+
glass: { type: Boolean, default: false }
|
|
7962
8169
|
},
|
|
7963
8170
|
emits: ["update:modelValue", "open", "close"],
|
|
7964
8171
|
setup(props, { emit }) {
|
|
7965
|
-
const panelRef =
|
|
8172
|
+
const panelRef = ref22(null);
|
|
7966
8173
|
const titleId = `djm-drawer-title-${++uid3}`;
|
|
7967
8174
|
let locked = false;
|
|
7968
8175
|
let releaseTrap = null;
|
|
@@ -7995,14 +8202,14 @@ var drawer_default = {
|
|
|
7995
8202
|
}
|
|
7996
8203
|
emit("close");
|
|
7997
8204
|
}
|
|
7998
|
-
|
|
8205
|
+
watch15(() => props.modelValue, (open) => {
|
|
7999
8206
|
if (open) activate();
|
|
8000
8207
|
else deactivate();
|
|
8001
8208
|
});
|
|
8002
8209
|
onMounted13(() => {
|
|
8003
8210
|
if (props.modelValue) activate();
|
|
8004
8211
|
});
|
|
8005
|
-
|
|
8212
|
+
onBeforeUnmount19(() => {
|
|
8006
8213
|
document.removeEventListener("keydown", onKeydown);
|
|
8007
8214
|
release();
|
|
8008
8215
|
if (locked) unlockScroll();
|
|
@@ -8021,7 +8228,7 @@ var drawer_default = {
|
|
|
8021
8228
|
<aside
|
|
8022
8229
|
ref="panelRef"
|
|
8023
8230
|
class="djm-drawer"
|
|
8024
|
-
:class="'djm-drawer-' + placement"
|
|
8231
|
+
:class="['djm-drawer-' + placement, { 'djm-is-glass': glass }]"
|
|
8025
8232
|
:style="panelStyle"
|
|
8026
8233
|
role="dialog"
|
|
8027
8234
|
aria-modal="true"
|
|
@@ -8056,7 +8263,7 @@ var drawer_default = {
|
|
|
8056
8263
|
};
|
|
8057
8264
|
|
|
8058
8265
|
// src/components/modal/index.js
|
|
8059
|
-
import { ref as
|
|
8266
|
+
import { ref as ref23, nextTick as nextTick11, watch as watch16, computed as computed11, onMounted as onMounted14, onBeforeUnmount as onBeforeUnmount20 } from "vue";
|
|
8060
8267
|
var uid4 = 0;
|
|
8061
8268
|
var modal_default = {
|
|
8062
8269
|
name: "DjmModal",
|
|
@@ -8071,11 +8278,13 @@ var modal_default = {
|
|
|
8071
8278
|
// 是否允许 Esc 关闭
|
|
8072
8279
|
closeOnEsc: { type: Boolean, default: true },
|
|
8073
8280
|
// 全屏铺满,适合配置类大表单
|
|
8074
|
-
fullscreen: { type: Boolean, default: false }
|
|
8281
|
+
fullscreen: { type: Boolean, default: false },
|
|
8282
|
+
// 毛玻璃底:需要显示背后页面时使用
|
|
8283
|
+
glass: { type: Boolean, default: false }
|
|
8075
8284
|
},
|
|
8076
8285
|
emits: ["update:modelValue", "open", "close"],
|
|
8077
8286
|
setup(props, { emit }) {
|
|
8078
|
-
const dialogRef =
|
|
8287
|
+
const dialogRef = ref23(null);
|
|
8079
8288
|
const titleId = `djm-modal-title-${++uid4}`;
|
|
8080
8289
|
let locked = false;
|
|
8081
8290
|
let releaseTrap = null;
|
|
@@ -8108,14 +8317,14 @@ var modal_default = {
|
|
|
8108
8317
|
}
|
|
8109
8318
|
emit("close");
|
|
8110
8319
|
}
|
|
8111
|
-
|
|
8320
|
+
watch16(() => props.modelValue, (open) => {
|
|
8112
8321
|
if (open) activate();
|
|
8113
8322
|
else deactivate();
|
|
8114
8323
|
});
|
|
8115
8324
|
onMounted14(() => {
|
|
8116
8325
|
if (props.modelValue) activate();
|
|
8117
8326
|
});
|
|
8118
|
-
|
|
8327
|
+
onBeforeUnmount20(() => {
|
|
8119
8328
|
document.removeEventListener("keydown", onKey);
|
|
8120
8329
|
release();
|
|
8121
8330
|
if (locked) unlockScroll();
|
|
@@ -8137,7 +8346,7 @@ var modal_default = {
|
|
|
8137
8346
|
<div
|
|
8138
8347
|
ref="dialogRef"
|
|
8139
8348
|
class="djm-modal"
|
|
8140
|
-
:class="{ 'djm-is-fullscreen': fullscreen }"
|
|
8349
|
+
:class="{ 'djm-is-fullscreen': fullscreen, 'djm-is-glass': glass }"
|
|
8141
8350
|
:style="dialogStyle"
|
|
8142
8351
|
role="dialog"
|
|
8143
8352
|
aria-modal="true"
|
|
@@ -8235,7 +8444,7 @@ var confirm_dialog_default = {
|
|
|
8235
8444
|
};
|
|
8236
8445
|
|
|
8237
8446
|
// src/components/pagination/index.js
|
|
8238
|
-
import { computed as computed12, ref as
|
|
8447
|
+
import { computed as computed12, ref as ref24 } from "vue";
|
|
8239
8448
|
var pagination_default = {
|
|
8240
8449
|
name: "DjmPagination",
|
|
8241
8450
|
components: { Icon: icon_default },
|
|
@@ -8247,7 +8456,7 @@ var pagination_default = {
|
|
|
8247
8456
|
},
|
|
8248
8457
|
emits: ["update:page", "update:pageSize", "change"],
|
|
8249
8458
|
setup(props, { emit }) {
|
|
8250
|
-
const jumpText =
|
|
8459
|
+
const jumpText = ref24("");
|
|
8251
8460
|
const pageCount = computed12(() => Math.max(1, Math.ceil(props.total / Math.max(1, props.pageSize))));
|
|
8252
8461
|
const current = computed12(() => Math.min(Math.max(1, props.page), pageCount.value));
|
|
8253
8462
|
const pages = computed12(() => {
|
|
@@ -8467,7 +8676,7 @@ var tabs_default = {
|
|
|
8467
8676
|
};
|
|
8468
8677
|
|
|
8469
8678
|
// src/components/context-menu/index.js
|
|
8470
|
-
import { ref as
|
|
8679
|
+
import { ref as ref25, watch as watch17, nextTick as nextTick12, onBeforeUnmount as onBeforeUnmount21 } from "vue";
|
|
8471
8680
|
var context_menu_default = {
|
|
8472
8681
|
name: "DjmContextMenu",
|
|
8473
8682
|
components: { Icon: icon_default },
|
|
@@ -8479,8 +8688,8 @@ var context_menu_default = {
|
|
|
8479
8688
|
},
|
|
8480
8689
|
emits: ["update:modelValue", "select"],
|
|
8481
8690
|
setup(props, { emit }) {
|
|
8482
|
-
const menuRef =
|
|
8483
|
-
const pos =
|
|
8691
|
+
const menuRef = ref25(null);
|
|
8692
|
+
const pos = ref25({ left: 0, top: 0 });
|
|
8484
8693
|
const margin = 8;
|
|
8485
8694
|
function close2() {
|
|
8486
8695
|
emit("update:modelValue", false);
|
|
@@ -8542,7 +8751,7 @@ var context_menu_default = {
|
|
|
8542
8751
|
detach = null;
|
|
8543
8752
|
}
|
|
8544
8753
|
}
|
|
8545
|
-
|
|
8754
|
+
watch17(
|
|
8546
8755
|
() => props.modelValue,
|
|
8547
8756
|
(open) => {
|
|
8548
8757
|
if (open) {
|
|
@@ -8553,10 +8762,10 @@ var context_menu_default = {
|
|
|
8553
8762
|
}
|
|
8554
8763
|
}
|
|
8555
8764
|
);
|
|
8556
|
-
|
|
8765
|
+
watch17([() => props.x, () => props.y], () => {
|
|
8557
8766
|
if (props.modelValue) openAtCursor();
|
|
8558
8767
|
});
|
|
8559
|
-
|
|
8768
|
+
onBeforeUnmount21(unbind);
|
|
8560
8769
|
return { menuRef, pos, close: close2, onSelect, onKeydown, t };
|
|
8561
8770
|
},
|
|
8562
8771
|
template: `
|
|
@@ -8595,7 +8804,7 @@ var context_menu_default = {
|
|
|
8595
8804
|
};
|
|
8596
8805
|
|
|
8597
8806
|
// src/components/date-picker/index.js
|
|
8598
|
-
import { ref as
|
|
8807
|
+
import { ref as ref26, computed as computed14, onBeforeUnmount as onBeforeUnmount22, watch as watch18 } from "vue";
|
|
8599
8808
|
var uidSeed5 = 0;
|
|
8600
8809
|
function pad3(value) {
|
|
8601
8810
|
return String(value).padStart(2, "0");
|
|
@@ -8630,12 +8839,12 @@ var date_picker_default = {
|
|
|
8630
8839
|
},
|
|
8631
8840
|
emits: ["update:modelValue", "change", "visible-change"],
|
|
8632
8841
|
setup(props, { emit }) {
|
|
8633
|
-
const open =
|
|
8634
|
-
|
|
8635
|
-
const root =
|
|
8636
|
-
const panel =
|
|
8842
|
+
const open = ref26(false);
|
|
8843
|
+
watch18(open, (value) => emit("visible-change", value));
|
|
8844
|
+
const root = ref26(null);
|
|
8845
|
+
const panel = ref26(null);
|
|
8637
8846
|
const panelId = "djm-date-panel-" + ++uidSeed5;
|
|
8638
|
-
const panelStyle =
|
|
8847
|
+
const panelStyle = ref26({ ...PANEL_HIDDEN_STYLE });
|
|
8639
8848
|
let detachPanel = null;
|
|
8640
8849
|
const today = /* @__PURE__ */ new Date();
|
|
8641
8850
|
const todayKey = toKey2(today.getFullYear(), today.getMonth(), today.getDate());
|
|
@@ -8650,16 +8859,16 @@ var date_picker_default = {
|
|
|
8650
8859
|
return end ? `${start} ~ ${end}` : `${start} ~ ${t("datePicker.rangeEnd")}`;
|
|
8651
8860
|
});
|
|
8652
8861
|
const initial = parse2(values.value[0]);
|
|
8653
|
-
const viewYear =
|
|
8654
|
-
const viewMonth =
|
|
8655
|
-
const pendingStart =
|
|
8656
|
-
const pendingEnd =
|
|
8862
|
+
const viewYear = ref26(initial ? initial.year : today.getFullYear());
|
|
8863
|
+
const viewMonth = ref26(initial ? initial.month : today.getMonth());
|
|
8864
|
+
const pendingStart = ref26(values.value[0] || "");
|
|
8865
|
+
const pendingEnd = ref26(values.value[1] || "");
|
|
8657
8866
|
const placeholderText = computed14(() => {
|
|
8658
8867
|
if (props.placeholder) return props.placeholder;
|
|
8659
8868
|
return t(props.range ? "datePicker.rangePlaceholder" : "datePicker.placeholder");
|
|
8660
8869
|
});
|
|
8661
8870
|
const weeks = computed14(() => t("datePicker.weeks").split(","));
|
|
8662
|
-
const narrow =
|
|
8871
|
+
const narrow = ref26(false);
|
|
8663
8872
|
let media = null;
|
|
8664
8873
|
const onMediaChange = (event) => {
|
|
8665
8874
|
narrow.value = event.matches;
|
|
@@ -8670,13 +8879,13 @@ var date_picker_default = {
|
|
|
8670
8879
|
if (media.addEventListener) media.addEventListener("change", onMediaChange);
|
|
8671
8880
|
else media.addListener(onMediaChange);
|
|
8672
8881
|
}
|
|
8673
|
-
|
|
8882
|
+
onBeforeUnmount22(() => {
|
|
8674
8883
|
if (!media) return;
|
|
8675
8884
|
if (media.removeEventListener) media.removeEventListener("change", onMediaChange);
|
|
8676
8885
|
else media.removeListener(onMediaChange);
|
|
8677
8886
|
});
|
|
8678
8887
|
const panelCount = computed14(() => props.range ? Math.min(narrow.value ? 1 : 2, Math.max(1, props.panels)) : 1);
|
|
8679
|
-
const hoverKey =
|
|
8888
|
+
const hoverKey = ref26("");
|
|
8680
8889
|
const hoverRange = computed14(() => {
|
|
8681
8890
|
if (!props.range || !pendingStart.value || pendingEnd.value || !hoverKey.value) return null;
|
|
8682
8891
|
const a = pendingStart.value;
|
|
@@ -8856,7 +9065,7 @@ var date_picker_default = {
|
|
|
8856
9065
|
pendingEnd.value = "";
|
|
8857
9066
|
closePanel();
|
|
8858
9067
|
}
|
|
8859
|
-
|
|
9068
|
+
onBeforeUnmount22(() => {
|
|
8860
9069
|
if (detachPanel) {
|
|
8861
9070
|
detachPanel();
|
|
8862
9071
|
detachPanel = null;
|
|
@@ -8985,7 +9194,7 @@ var date_picker_default = {
|
|
|
8985
9194
|
};
|
|
8986
9195
|
|
|
8987
9196
|
// src/components/tree-select/index.js
|
|
8988
|
-
import { ref as
|
|
9197
|
+
import { ref as ref27, computed as computed15, nextTick as nextTick13, onBeforeUnmount as onBeforeUnmount23, watch as watch19 } from "vue";
|
|
8989
9198
|
function collectLeaves(node, keyOf2, out = []) {
|
|
8990
9199
|
if (node.children && node.children.length) {
|
|
8991
9200
|
node.children.forEach((child) => collectLeaves(child, keyOf2, out));
|
|
@@ -9021,13 +9230,13 @@ var tree_select_default = {
|
|
|
9021
9230
|
},
|
|
9022
9231
|
emits: ["update:modelValue", "change", "visible-change"],
|
|
9023
9232
|
setup(props, { emit }) {
|
|
9024
|
-
const open =
|
|
9025
|
-
const root =
|
|
9026
|
-
const panel =
|
|
9027
|
-
const searchInput =
|
|
9028
|
-
const search =
|
|
9029
|
-
const temp =
|
|
9030
|
-
const panelStyle =
|
|
9233
|
+
const open = ref27(false);
|
|
9234
|
+
const root = ref27(null);
|
|
9235
|
+
const panel = ref27(null);
|
|
9236
|
+
const searchInput = ref27(null);
|
|
9237
|
+
const search = ref27("");
|
|
9238
|
+
const temp = ref27([]);
|
|
9239
|
+
const panelStyle = ref27({ ...PANEL_HIDDEN_STYLE });
|
|
9031
9240
|
let detachPanel = null;
|
|
9032
9241
|
function keyOf2(node) {
|
|
9033
9242
|
return node ? node[props.nodeKey] : void 0;
|
|
@@ -9036,7 +9245,7 @@ var tree_select_default = {
|
|
|
9036
9245
|
const value = node ? node[props.labelKey] : "";
|
|
9037
9246
|
return value === null || value === void 0 ? "" : String(value);
|
|
9038
9247
|
}
|
|
9039
|
-
const expandedIds =
|
|
9248
|
+
const expandedIds = ref27(
|
|
9040
9249
|
new Set(
|
|
9041
9250
|
collectNodes(props.options).filter((node) => node.children && node.children.length).map((node) => keyOf2(node))
|
|
9042
9251
|
)
|
|
@@ -9046,7 +9255,7 @@ var tree_select_default = {
|
|
|
9046
9255
|
collectNodes(props.options).forEach((node) => map.set(keyOf2(node), node));
|
|
9047
9256
|
return map;
|
|
9048
9257
|
});
|
|
9049
|
-
|
|
9258
|
+
watch19(() => props.options, (options) => {
|
|
9050
9259
|
if (!options || !options.length || expandedIds.value.size) return;
|
|
9051
9260
|
expandedIds.value = new Set(
|
|
9052
9261
|
collectNodes(options).filter((node) => node.children && node.children.length).map((node) => keyOf2(node))
|
|
@@ -9205,7 +9414,7 @@ var tree_select_default = {
|
|
|
9205
9414
|
emit("change", []);
|
|
9206
9415
|
temp.value = [];
|
|
9207
9416
|
}
|
|
9208
|
-
|
|
9417
|
+
onBeforeUnmount23(() => {
|
|
9209
9418
|
if (detachPanel) {
|
|
9210
9419
|
detachPanel();
|
|
9211
9420
|
detachPanel = null;
|
|
@@ -9344,174 +9553,797 @@ var tree_select_default = {
|
|
|
9344
9553
|
};
|
|
9345
9554
|
|
|
9346
9555
|
// src/components/rich-editor/index.js
|
|
9347
|
-
import { ref as
|
|
9348
|
-
|
|
9349
|
-
// src/utils/sanitize-html.js
|
|
9350
|
-
var TAGS = /* @__PURE__ */ new Set([
|
|
9351
|
-
"p",
|
|
9352
|
-
"br",
|
|
9353
|
-
"div",
|
|
9354
|
-
"span",
|
|
9355
|
-
"strong",
|
|
9356
|
-
"b",
|
|
9357
|
-
"em",
|
|
9358
|
-
"i",
|
|
9359
|
-
"u",
|
|
9360
|
-
"s",
|
|
9361
|
-
"del",
|
|
9362
|
-
"sub",
|
|
9363
|
-
"sup",
|
|
9364
|
-
"h1",
|
|
9365
|
-
"h2",
|
|
9366
|
-
"h3",
|
|
9367
|
-
"h4",
|
|
9368
|
-
"h5",
|
|
9369
|
-
"h6",
|
|
9370
|
-
"ul",
|
|
9371
|
-
"ol",
|
|
9372
|
-
"li",
|
|
9373
|
-
"blockquote",
|
|
9374
|
-
"pre",
|
|
9375
|
-
"code",
|
|
9376
|
-
"hr",
|
|
9377
|
-
"a",
|
|
9378
|
-
"img",
|
|
9379
|
-
"table",
|
|
9380
|
-
"thead",
|
|
9381
|
-
"tbody",
|
|
9382
|
-
"tfoot",
|
|
9383
|
-
"tr",
|
|
9384
|
-
"th",
|
|
9385
|
-
"td"
|
|
9386
|
-
]);
|
|
9387
|
-
var GLOBAL_ATTRS = /* @__PURE__ */ new Set(["class", "title"]);
|
|
9388
|
-
var TAG_ATTRS = {
|
|
9389
|
-
a: /* @__PURE__ */ new Set(["href", "target", "rel"]),
|
|
9390
|
-
img: /* @__PURE__ */ new Set(["src", "alt", "width", "height"]),
|
|
9391
|
-
ol: /* @__PURE__ */ new Set(["start"]),
|
|
9392
|
-
th: /* @__PURE__ */ new Set(["colspan", "rowspan", "scope"]),
|
|
9393
|
-
td: /* @__PURE__ */ new Set(["colspan", "rowspan"])
|
|
9394
|
-
};
|
|
9395
|
-
function safeUrl(value, tag) {
|
|
9396
|
-
const url = String(value || "").replace(/[\u0000-\u0020]+/g, "").toLowerCase();
|
|
9397
|
-
if (url.startsWith("javascript:") || url.startsWith("vbscript:")) return false;
|
|
9398
|
-
if (url.startsWith("data:")) return tag === "img" && url.startsWith("data:image/");
|
|
9399
|
-
return true;
|
|
9400
|
-
}
|
|
9401
|
-
function cleanNode(node) {
|
|
9402
|
-
const children = [...node.childNodes];
|
|
9403
|
-
children.forEach((child) => {
|
|
9404
|
-
if (child.nodeType === 8) {
|
|
9405
|
-
child.remove();
|
|
9406
|
-
return;
|
|
9407
|
-
}
|
|
9408
|
-
if (child.nodeType !== 1) return;
|
|
9409
|
-
const tag = child.tagName.toLowerCase();
|
|
9410
|
-
if (!TAGS.has(tag)) {
|
|
9411
|
-
child.remove();
|
|
9412
|
-
return;
|
|
9413
|
-
}
|
|
9414
|
-
const allowed = TAG_ATTRS[tag];
|
|
9415
|
-
[...child.attributes].forEach((attr) => {
|
|
9416
|
-
const name = attr.name.toLowerCase();
|
|
9417
|
-
const keep = GLOBAL_ATTRS.has(name) || allowed && allowed.has(name);
|
|
9418
|
-
if (!keep) {
|
|
9419
|
-
child.removeAttribute(attr.name);
|
|
9420
|
-
return;
|
|
9421
|
-
}
|
|
9422
|
-
if ((name === "href" || name === "src") && !safeUrl(attr.value, tag)) {
|
|
9423
|
-
child.removeAttribute(attr.name);
|
|
9424
|
-
}
|
|
9425
|
-
});
|
|
9426
|
-
if (tag === "a" && child.getAttribute("target") === "_blank") {
|
|
9427
|
-
child.setAttribute("rel", "noopener noreferrer");
|
|
9428
|
-
}
|
|
9429
|
-
cleanNode(child);
|
|
9430
|
-
});
|
|
9431
|
-
}
|
|
9432
|
-
function sanitizeHtml(html) {
|
|
9433
|
-
if (!html) return "";
|
|
9434
|
-
const doc = new DOMParser().parseFromString('<div id="djm-sanitize-root">' + html + "</div>", "text/html");
|
|
9435
|
-
const root = doc.getElementById("djm-sanitize-root");
|
|
9436
|
-
if (!root) return "";
|
|
9437
|
-
cleanNode(root);
|
|
9438
|
-
return root.innerHTML;
|
|
9439
|
-
}
|
|
9556
|
+
import { ref as ref29, computed as computed17, watch as watch21, onMounted as onMounted15, onBeforeUnmount as onBeforeUnmount24 } from "vue";
|
|
9440
9557
|
|
|
9441
|
-
// src/components/
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9558
|
+
// src/components/media-picker/index.js
|
|
9559
|
+
import { computed as computed16, ref as ref28, watch as watch20 } from "vue";
|
|
9560
|
+
var media_picker_default = {
|
|
9561
|
+
name: "DjmMediaPicker",
|
|
9562
|
+
components: { DjmModal: modal_default, DjmPagination: pagination_default, DjmIcon: icon_default },
|
|
9445
9563
|
props: {
|
|
9446
|
-
modelValue: { type: String, default: "" },
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
//
|
|
9450
|
-
|
|
9564
|
+
modelValue: { type: [Array, String, Number], default: "" },
|
|
9565
|
+
items: { type: Array, default: () => [] },
|
|
9566
|
+
multiple: { type: Boolean, default: false },
|
|
9567
|
+
// 最多选几个,0 表示不限
|
|
9568
|
+
limit: { type: Number, default: 0 },
|
|
9569
|
+
// image 只显示图片,file 只显示非图片,空串不过滤
|
|
9570
|
+
accept: { type: String, default: "" },
|
|
9571
|
+
title: { type: String, default: "" },
|
|
9572
|
+
triggerText: { type: String, default: "" },
|
|
9573
|
+
pageSize: { type: Number, default: 12 },
|
|
9451
9574
|
disabled: { type: Boolean, default: false }
|
|
9452
9575
|
},
|
|
9453
|
-
emits: ["update:modelValue"],
|
|
9576
|
+
emits: ["update:modelValue", "change"],
|
|
9454
9577
|
setup(props, { emit }) {
|
|
9455
|
-
const
|
|
9456
|
-
const
|
|
9457
|
-
const
|
|
9458
|
-
const
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
const data = event.clipboardData;
|
|
9468
|
-
const html = data && data.getData("text/html");
|
|
9469
|
-
if (!html) return;
|
|
9470
|
-
event.preventDefault();
|
|
9471
|
-
document.execCommand("insertHTML", false, sanitizeHtml(html));
|
|
9472
|
-
syncFromDom();
|
|
9473
|
-
}
|
|
9474
|
-
function exec(command, value = null) {
|
|
9475
|
-
if (props.disabled || sourceMode.value) return;
|
|
9476
|
-
document.execCommand(command, false, value);
|
|
9477
|
-
if (editor.value) editor.value.focus();
|
|
9478
|
-
syncFromDom();
|
|
9479
|
-
syncFormats();
|
|
9578
|
+
const open = ref28(false);
|
|
9579
|
+
const keyword = ref28("");
|
|
9580
|
+
const page = ref28(1);
|
|
9581
|
+
const temp = ref28([]);
|
|
9582
|
+
const selectedIds = computed16(() => {
|
|
9583
|
+
if (props.multiple) return Array.isArray(props.modelValue) ? props.modelValue : [];
|
|
9584
|
+
if (props.modelValue === "" || props.modelValue === null || props.modelValue === void 0) return [];
|
|
9585
|
+
return [props.modelValue];
|
|
9586
|
+
});
|
|
9587
|
+
function isImage(item) {
|
|
9588
|
+
if (item.type) return item.type === "image";
|
|
9589
|
+
return /\.(png|jpe?g|gif|webp|svg|avif)$/i.test(item.url || "");
|
|
9480
9590
|
}
|
|
9481
|
-
|
|
9482
|
-
|
|
9591
|
+
const filtered = computed16(() => {
|
|
9592
|
+
const key = keyword.value.trim().toLowerCase();
|
|
9593
|
+
return props.items.filter((item) => {
|
|
9594
|
+
if (props.accept === "image" && !isImage(item)) return false;
|
|
9595
|
+
if (props.accept === "file" && isImage(item)) return false;
|
|
9596
|
+
if (key && !String(item.name || "").toLowerCase().includes(key)) return false;
|
|
9597
|
+
return true;
|
|
9598
|
+
});
|
|
9599
|
+
});
|
|
9600
|
+
const paged = computed16(() => {
|
|
9601
|
+
const start = (page.value - 1) * props.pageSize;
|
|
9602
|
+
return filtered.value.slice(start, start + props.pageSize);
|
|
9603
|
+
});
|
|
9604
|
+
watch20(keyword, () => {
|
|
9605
|
+
page.value = 1;
|
|
9606
|
+
});
|
|
9607
|
+
watch20(
|
|
9608
|
+
() => filtered.value.length,
|
|
9609
|
+
() => {
|
|
9610
|
+
const max = Math.max(1, Math.ceil(filtered.value.length / props.pageSize));
|
|
9611
|
+
if (page.value > max) page.value = max;
|
|
9612
|
+
}
|
|
9613
|
+
);
|
|
9614
|
+
function isChecked(id) {
|
|
9615
|
+
return temp.value.includes(id);
|
|
9483
9616
|
}
|
|
9484
|
-
function
|
|
9485
|
-
|
|
9486
|
-
if (url) exec("createLink", url);
|
|
9617
|
+
function atLimit() {
|
|
9618
|
+
return props.limit > 0 && temp.value.length >= props.limit;
|
|
9487
9619
|
}
|
|
9488
|
-
function
|
|
9489
|
-
if (props.
|
|
9490
|
-
|
|
9491
|
-
|
|
9620
|
+
function toggle(item) {
|
|
9621
|
+
if (props.multiple) {
|
|
9622
|
+
if (isChecked(item.id)) {
|
|
9623
|
+
temp.value = temp.value.filter((id) => id !== item.id);
|
|
9624
|
+
return;
|
|
9625
|
+
}
|
|
9626
|
+
if (atLimit()) return;
|
|
9627
|
+
temp.value = [...temp.value, item.id];
|
|
9628
|
+
return;
|
|
9629
|
+
}
|
|
9630
|
+
temp.value = [item.id];
|
|
9631
|
+
}
|
|
9632
|
+
function openPanel() {
|
|
9633
|
+
if (props.disabled) return;
|
|
9634
|
+
temp.value = [...selectedIds.value];
|
|
9635
|
+
keyword.value = "";
|
|
9636
|
+
page.value = 1;
|
|
9637
|
+
open.value = true;
|
|
9638
|
+
}
|
|
9639
|
+
function commit() {
|
|
9640
|
+
const next = props.multiple ? [...temp.value] : temp.value[0] !== void 0 ? temp.value[0] : "";
|
|
9641
|
+
emit("update:modelValue", next);
|
|
9642
|
+
emit("change", next);
|
|
9643
|
+
open.value = false;
|
|
9644
|
+
}
|
|
9645
|
+
function cancel() {
|
|
9646
|
+
temp.value = [...selectedIds.value];
|
|
9647
|
+
open.value = false;
|
|
9648
|
+
}
|
|
9649
|
+
return {
|
|
9650
|
+
open,
|
|
9651
|
+
keyword,
|
|
9652
|
+
page,
|
|
9653
|
+
temp,
|
|
9654
|
+
selectedIds,
|
|
9655
|
+
filtered,
|
|
9656
|
+
paged,
|
|
9657
|
+
isImage,
|
|
9658
|
+
isChecked,
|
|
9659
|
+
atLimit,
|
|
9660
|
+
toggle,
|
|
9661
|
+
openPanel,
|
|
9662
|
+
commit,
|
|
9663
|
+
cancel,
|
|
9664
|
+
t
|
|
9665
|
+
};
|
|
9666
|
+
},
|
|
9667
|
+
template: `
|
|
9668
|
+
<span class="djm-media-picker">
|
|
9669
|
+
<slot name="trigger" :open="openPanel" :count="selectedIds.length">
|
|
9670
|
+
<button
|
|
9671
|
+
class="djm-btn"
|
|
9672
|
+
type="button"
|
|
9673
|
+
:disabled="disabled"
|
|
9674
|
+
@click="openPanel"
|
|
9675
|
+
>{{ triggerText || t('mediaPicker.select') }}<span v-if="selectedIds.length" class="djm-media-picker-count">{{ selectedIds.length }}</span></button>
|
|
9676
|
+
</slot>
|
|
9677
|
+
|
|
9678
|
+
<DjmModal
|
|
9679
|
+
:model-value="open"
|
|
9680
|
+
:title="title || t('mediaPicker.title')"
|
|
9681
|
+
width="760px"
|
|
9682
|
+
@update:model-value="cancel"
|
|
9683
|
+
>
|
|
9684
|
+
<div class="djm-media-toolbar">
|
|
9685
|
+
<label class="djm-media-search">
|
|
9686
|
+
<DjmIcon name="search" :size="13" />
|
|
9687
|
+
<input
|
|
9688
|
+
v-model="keyword"
|
|
9689
|
+
class="djm-media-search-input"
|
|
9690
|
+
type="text"
|
|
9691
|
+
:placeholder="t('mediaPicker.search')"
|
|
9692
|
+
:aria-label="t('mediaPicker.search')"
|
|
9693
|
+
/>
|
|
9694
|
+
</label>
|
|
9695
|
+
<span class="djm-media-toolbar-slot">
|
|
9696
|
+
<slot name="toolbar"></slot>
|
|
9697
|
+
</span>
|
|
9698
|
+
</div>
|
|
9699
|
+
|
|
9700
|
+
<div class="djm-media-grid" role="listbox" :aria-multiselectable="multiple ? 'true' : 'false'">
|
|
9701
|
+
<div
|
|
9702
|
+
v-for="item in paged"
|
|
9703
|
+
:key="item.id"
|
|
9704
|
+
class="djm-media-item"
|
|
9705
|
+
:class="{
|
|
9706
|
+
'djm-is-checked': isChecked(item.id),
|
|
9707
|
+
'djm-is-disabled': multiple && atLimit() && !isChecked(item.id)
|
|
9708
|
+
}"
|
|
9709
|
+
role="option"
|
|
9710
|
+
tabindex="0"
|
|
9711
|
+
:aria-selected="String(isChecked(item.id))"
|
|
9712
|
+
@click="toggle(item)"
|
|
9713
|
+
@keydown.enter.prevent="toggle(item)"
|
|
9714
|
+
@keydown.space.prevent="toggle(item)"
|
|
9715
|
+
>
|
|
9716
|
+
<div class="djm-media-thumb">
|
|
9717
|
+
<img v-if="isImage(item)" :src="item.url" :alt="item.name" loading="lazy" />
|
|
9718
|
+
<DjmIcon v-else name="folder" :size="26" />
|
|
9719
|
+
<span v-if="isChecked(item.id)" class="djm-media-check">
|
|
9720
|
+
<DjmIcon name="check" :size="11" />
|
|
9721
|
+
</span>
|
|
9722
|
+
</div>
|
|
9723
|
+
<div class="djm-media-name" :title="item.name">{{ item.name }}</div>
|
|
9724
|
+
</div>
|
|
9725
|
+
<div v-if="!paged.length" class="djm-media-empty">{{ t('mediaPicker.empty') }}</div>
|
|
9726
|
+
</div>
|
|
9727
|
+
|
|
9728
|
+
<div class="djm-media-foot">
|
|
9729
|
+
<span class="djm-media-total">
|
|
9730
|
+
{{ t('mediaPicker.total', { total: filtered.length }) }}
|
|
9731
|
+
<em v-if="multiple && limit > 0">{{ t('mediaPicker.limit', { limit }) }}</em>
|
|
9732
|
+
</span>
|
|
9733
|
+
<DjmPagination
|
|
9734
|
+
v-if="filtered.length > pageSize"
|
|
9735
|
+
v-model:page="page"
|
|
9736
|
+
:page-size="pageSize"
|
|
9737
|
+
:total="filtered.length"
|
|
9738
|
+
/>
|
|
9739
|
+
</div>
|
|
9740
|
+
|
|
9741
|
+
<template #footer>
|
|
9742
|
+
<button class="djm-btn" type="button" @click="cancel">{{ t('common.cancel') }}</button>
|
|
9743
|
+
<button class="djm-btn djm-btn-primary" type="button" @click="commit">{{ t('common.confirm') }}</button>
|
|
9744
|
+
</template>
|
|
9745
|
+
</DjmModal>
|
|
9746
|
+
</span>
|
|
9747
|
+
`
|
|
9748
|
+
};
|
|
9749
|
+
|
|
9750
|
+
// src/utils/sanitize-html.js
|
|
9751
|
+
var TAGS = /* @__PURE__ */ new Set([
|
|
9752
|
+
"p",
|
|
9753
|
+
"br",
|
|
9754
|
+
"div",
|
|
9755
|
+
"span",
|
|
9756
|
+
"strong",
|
|
9757
|
+
"b",
|
|
9758
|
+
"em",
|
|
9759
|
+
"i",
|
|
9760
|
+
"u",
|
|
9761
|
+
"s",
|
|
9762
|
+
"del",
|
|
9763
|
+
"sub",
|
|
9764
|
+
"sup",
|
|
9765
|
+
"h1",
|
|
9766
|
+
"h2",
|
|
9767
|
+
"h3",
|
|
9768
|
+
"h4",
|
|
9769
|
+
"h5",
|
|
9770
|
+
"h6",
|
|
9771
|
+
"ul",
|
|
9772
|
+
"ol",
|
|
9773
|
+
"li",
|
|
9774
|
+
"blockquote",
|
|
9775
|
+
"pre",
|
|
9776
|
+
"code",
|
|
9777
|
+
"hr",
|
|
9778
|
+
"a",
|
|
9779
|
+
"img",
|
|
9780
|
+
"table",
|
|
9781
|
+
"thead",
|
|
9782
|
+
"tbody",
|
|
9783
|
+
"tfoot",
|
|
9784
|
+
"tr",
|
|
9785
|
+
"th",
|
|
9786
|
+
"td"
|
|
9787
|
+
]);
|
|
9788
|
+
var GLOBAL_ATTRS = /* @__PURE__ */ new Set(["class", "title", "style"]);
|
|
9789
|
+
var STYLE_PROPS = /* @__PURE__ */ new Set([
|
|
9790
|
+
"color",
|
|
9791
|
+
"background-color",
|
|
9792
|
+
"font-size",
|
|
9793
|
+
"font-weight",
|
|
9794
|
+
"font-style",
|
|
9795
|
+
"text-decoration",
|
|
9796
|
+
"text-align",
|
|
9797
|
+
"text-indent",
|
|
9798
|
+
"line-height"
|
|
9799
|
+
]);
|
|
9800
|
+
var TAG_ATTRS = {
|
|
9801
|
+
a: /* @__PURE__ */ new Set(["href", "target", "rel"]),
|
|
9802
|
+
img: /* @__PURE__ */ new Set(["src", "alt", "width", "height"]),
|
|
9803
|
+
ol: /* @__PURE__ */ new Set(["start"]),
|
|
9804
|
+
th: /* @__PURE__ */ new Set(["colspan", "rowspan", "scope"]),
|
|
9805
|
+
td: /* @__PURE__ */ new Set(["colspan", "rowspan"])
|
|
9806
|
+
};
|
|
9807
|
+
function cleanStyle(value) {
|
|
9808
|
+
return String(value || "").split(";").map((item) => {
|
|
9809
|
+
const index = item.indexOf(":");
|
|
9810
|
+
if (index === -1) return "";
|
|
9811
|
+
const name = item.slice(0, index).trim().toLowerCase();
|
|
9812
|
+
const val = item.slice(index + 1).trim();
|
|
9813
|
+
if (!STYLE_PROPS.has(name)) return "";
|
|
9814
|
+
if (/url\s*\(|expression\s*\(|javascript:/i.test(val)) return "";
|
|
9815
|
+
return name + ": " + val;
|
|
9816
|
+
}).filter(Boolean).join("; ");
|
|
9817
|
+
}
|
|
9818
|
+
var SAFE_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto", "tel"]);
|
|
9819
|
+
function safeUrl(value, tag) {
|
|
9820
|
+
const url = String(value || "").replace(/[\u0000-\u0020]+/g, "");
|
|
9821
|
+
const scheme = url.match(/^([a-z][a-z0-9+.-]*):/i);
|
|
9822
|
+
if (!scheme) return true;
|
|
9823
|
+
const name = scheme[1].toLowerCase();
|
|
9824
|
+
if (SAFE_SCHEMES.has(name)) return true;
|
|
9825
|
+
if (tag === "img") {
|
|
9826
|
+
if (name === "blob") return true;
|
|
9827
|
+
if (name === "data" && /^data:image\//i.test(url)) return true;
|
|
9828
|
+
}
|
|
9829
|
+
return false;
|
|
9830
|
+
}
|
|
9831
|
+
function cleanNode(node) {
|
|
9832
|
+
const children = [...node.childNodes];
|
|
9833
|
+
children.forEach((child) => {
|
|
9834
|
+
if (child.nodeType === 8) {
|
|
9835
|
+
child.remove();
|
|
9836
|
+
return;
|
|
9837
|
+
}
|
|
9838
|
+
if (child.nodeType !== 1) return;
|
|
9839
|
+
const tag = child.tagName.toLowerCase();
|
|
9840
|
+
if (!TAGS.has(tag)) {
|
|
9841
|
+
child.remove();
|
|
9842
|
+
return;
|
|
9843
|
+
}
|
|
9844
|
+
const allowed = TAG_ATTRS[tag];
|
|
9845
|
+
[...child.attributes].forEach((attr) => {
|
|
9846
|
+
const name = attr.name.toLowerCase();
|
|
9847
|
+
const keep = GLOBAL_ATTRS.has(name) || allowed && allowed.has(name);
|
|
9848
|
+
if (!keep) {
|
|
9849
|
+
child.removeAttribute(attr.name);
|
|
9850
|
+
return;
|
|
9851
|
+
}
|
|
9852
|
+
if (name === "style") {
|
|
9853
|
+
const style = cleanStyle(attr.value);
|
|
9854
|
+
if (style) child.setAttribute("style", style);
|
|
9855
|
+
else child.removeAttribute("style");
|
|
9856
|
+
return;
|
|
9857
|
+
}
|
|
9858
|
+
if ((name === "href" || name === "src") && !safeUrl(attr.value, tag)) {
|
|
9859
|
+
child.removeAttribute(attr.name);
|
|
9860
|
+
}
|
|
9861
|
+
});
|
|
9862
|
+
if (tag === "a" && child.getAttribute("target") === "_blank") {
|
|
9863
|
+
child.setAttribute("rel", "noopener noreferrer");
|
|
9864
|
+
}
|
|
9865
|
+
cleanNode(child);
|
|
9866
|
+
});
|
|
9867
|
+
}
|
|
9868
|
+
function sanitizeHtml(html) {
|
|
9869
|
+
if (!html) return "";
|
|
9870
|
+
const doc = new DOMParser().parseFromString('<div id="djm-sanitize-root">' + html + "</div>", "text/html");
|
|
9871
|
+
const root = doc.getElementById("djm-sanitize-root");
|
|
9872
|
+
if (!root) return "";
|
|
9873
|
+
cleanNode(root);
|
|
9874
|
+
return root.innerHTML;
|
|
9875
|
+
}
|
|
9876
|
+
|
|
9877
|
+
// src/components/rich-editor/index.js
|
|
9878
|
+
var BLOCKS = [
|
|
9879
|
+
{ value: "p", label: "paragraph" },
|
|
9880
|
+
{ value: "h1", label: "heading1" },
|
|
9881
|
+
{ value: "h2", label: "heading2" },
|
|
9882
|
+
{ value: "h3", label: "heading3" },
|
|
9883
|
+
{ value: "blockquote", label: "quote" },
|
|
9884
|
+
{ value: "pre", label: "codeBlock" }
|
|
9885
|
+
];
|
|
9886
|
+
var SIZES = [
|
|
9887
|
+
{ value: "", label: "defaultSize" },
|
|
9888
|
+
{ value: "12px", label: "12px" },
|
|
9889
|
+
{ value: "14px", label: "14px" },
|
|
9890
|
+
{ value: "16px", label: "16px" },
|
|
9891
|
+
{ value: "18px", label: "18px" },
|
|
9892
|
+
{ value: "24px", label: "24px" }
|
|
9893
|
+
];
|
|
9894
|
+
var COLORS = ["#1f2d3d", "#5a6b7d", "#2b86d9", "#2fa36b", "#d97706", "#dc2626", "#7c3aed", "#ffffff"];
|
|
9895
|
+
var TOOLBAR_PRESETS = {
|
|
9896
|
+
simple: ["history", "inline", "list", "insert"],
|
|
9897
|
+
basic: ["history", "format", "inline", "align", "list", "insert", "view"],
|
|
9898
|
+
full: ["history", "format", "inline", "color", "align", "list", "insert", "view"]
|
|
9899
|
+
};
|
|
9900
|
+
function isSafeImageUrl(url) {
|
|
9901
|
+
const value = String(url || "").replace(/[\u0000-\u0020]+/g, "");
|
|
9902
|
+
if (!value) return false;
|
|
9903
|
+
const scheme = value.match(/^([a-z][a-z0-9+.-]*):/i);
|
|
9904
|
+
if (!scheme) return true;
|
|
9905
|
+
const name = scheme[1].toLowerCase();
|
|
9906
|
+
if (name === "http" || name === "https" || name === "blob") return true;
|
|
9907
|
+
return name === "data" && /^data:image\//i.test(value);
|
|
9908
|
+
}
|
|
9909
|
+
function isSafeLink(url) {
|
|
9910
|
+
const value = String(url || "").trim();
|
|
9911
|
+
if (!value) return false;
|
|
9912
|
+
const scheme = value.replace(/[\u0000-\u0020]+/g, "").match(/^([a-z][a-z0-9+.-]*):/i);
|
|
9913
|
+
if (!scheme) return true;
|
|
9914
|
+
return ["http", "https", "mailto", "tel"].indexOf(scheme[1].toLowerCase()) > -1;
|
|
9915
|
+
}
|
|
9916
|
+
var rich_editor_default = {
|
|
9917
|
+
name: "DjmRichEditor",
|
|
9918
|
+
components: { Icon: icon_default, MediaPicker: media_picker_default },
|
|
9919
|
+
props: {
|
|
9920
|
+
modelValue: { type: String, default: "" },
|
|
9921
|
+
placeholder: { type: String, default: "" },
|
|
9922
|
+
minHeight: { type: Number, default: 200 },
|
|
9923
|
+
// 默认开启:对外输出的 HTML 走白名单清洗,内容里不会带出脚本
|
|
9924
|
+
sanitize: { type: Boolean, default: true },
|
|
9925
|
+
disabled: { type: Boolean, default: false },
|
|
9926
|
+
// 工具条:simple / basic / full,或传分组数组(history / format / inline / color / align / list / insert / view)
|
|
9927
|
+
toolbar: { type: [String, Array], default: "full" },
|
|
9928
|
+
// 自定义上传:接收 File,返回图片地址(或 { url }),不传则转成 dataURL 本地预览
|
|
9929
|
+
uploadImage: { type: Function, default: null },
|
|
9930
|
+
// 已上传图片,提供后工具栏出现「从素材库选择」:字符串或 { url, name }
|
|
9931
|
+
media: { type: Array, default: () => [] },
|
|
9932
|
+
accept: { type: String, default: "image/*" },
|
|
9933
|
+
// 单张图片大小上限(MB)
|
|
9934
|
+
maxImageSize: { type: Number, default: 5 },
|
|
9935
|
+
// 是否允许一次选多张
|
|
9936
|
+
multiple: { type: Boolean, default: true },
|
|
9937
|
+
showCount: { type: Boolean, default: true }
|
|
9938
|
+
},
|
|
9939
|
+
emits: ["update:modelValue", "upload-error"],
|
|
9940
|
+
setup(props, { emit }) {
|
|
9941
|
+
const editor = ref29(null);
|
|
9942
|
+
const fileInput = ref29(null);
|
|
9943
|
+
const sourceMode = ref29(false);
|
|
9944
|
+
const source = ref29(props.modelValue);
|
|
9945
|
+
const fullscreen = ref29(false);
|
|
9946
|
+
const panel = ref29("");
|
|
9947
|
+
const uploadCount = ref29(0);
|
|
9948
|
+
const textColor = ref29(COLORS[0]);
|
|
9949
|
+
const bgColor = ref29("#fdf3c4");
|
|
9950
|
+
const fontSize = ref29("");
|
|
9951
|
+
const count2 = ref29(0);
|
|
9952
|
+
const formats = ref29({
|
|
9953
|
+
bold: false,
|
|
9954
|
+
italic: false,
|
|
9955
|
+
underline: false,
|
|
9956
|
+
strike: false,
|
|
9957
|
+
code: false,
|
|
9958
|
+
block: "p",
|
|
9959
|
+
align: "",
|
|
9960
|
+
list: ""
|
|
9961
|
+
});
|
|
9962
|
+
let savedRange = null;
|
|
9963
|
+
const ready = computed17(() => !props.disabled && !sourceMode.value);
|
|
9964
|
+
const toolbarGroups = computed17(() => {
|
|
9965
|
+
const list = Array.isArray(props.toolbar) ? props.toolbar : TOOLBAR_PRESETS[props.toolbar] || TOOLBAR_PRESETS.full;
|
|
9966
|
+
return new Set(list);
|
|
9967
|
+
});
|
|
9968
|
+
function has(group) {
|
|
9969
|
+
return toolbarGroups.value.has(group);
|
|
9970
|
+
}
|
|
9971
|
+
const mediaLibrary = computed17(
|
|
9972
|
+
() => (props.media || []).map((item, index) => {
|
|
9973
|
+
if (typeof item === "string") {
|
|
9974
|
+
return { id: "media-" + index, url: item, name: "", type: "image" };
|
|
9975
|
+
}
|
|
9976
|
+
return {
|
|
9977
|
+
id: item && item.id !== void 0 ? String(item.id) : "media-" + index,
|
|
9978
|
+
url: item && (item.url || item.src) || "",
|
|
9979
|
+
name: item && (item.name || item.alt) || "",
|
|
9980
|
+
type: "image"
|
|
9981
|
+
};
|
|
9982
|
+
}).filter((item) => !!item.url)
|
|
9983
|
+
);
|
|
9984
|
+
function clean(html) {
|
|
9985
|
+
return props.sanitize ? sanitizeHtml(html) : html;
|
|
9986
|
+
}
|
|
9987
|
+
function plainText(html) {
|
|
9988
|
+
return String(html || "").replace(/<[^>]*>/g, "").replace(/ /g, " ").replace(/&[a-z]+;/gi, " ");
|
|
9989
|
+
}
|
|
9990
|
+
function syncFromDom() {
|
|
9991
|
+
if (!editor.value) return;
|
|
9992
|
+
const html = clean(editor.value.innerHTML);
|
|
9993
|
+
count2.value = plainText(html).trim().length;
|
|
9994
|
+
emit("update:modelValue", html);
|
|
9995
|
+
}
|
|
9996
|
+
function currentRange() {
|
|
9997
|
+
const selection = window.getSelection();
|
|
9998
|
+
if (!selection || !selection.rangeCount || !editor.value) return null;
|
|
9999
|
+
const range = selection.getRangeAt(0);
|
|
10000
|
+
return editor.value.contains(range.commonAncestorContainer) ? range : null;
|
|
10001
|
+
}
|
|
10002
|
+
function rememberRange() {
|
|
10003
|
+
const range = currentRange();
|
|
10004
|
+
savedRange = range ? range.cloneRange() : null;
|
|
10005
|
+
}
|
|
10006
|
+
function focusAt(range) {
|
|
10007
|
+
if (!editor.value) return;
|
|
10008
|
+
editor.value.focus();
|
|
10009
|
+
const selection = window.getSelection();
|
|
10010
|
+
selection.removeAllRanges();
|
|
10011
|
+
if (range) {
|
|
10012
|
+
selection.addRange(range);
|
|
10013
|
+
return;
|
|
10014
|
+
}
|
|
10015
|
+
const end = document.createRange();
|
|
10016
|
+
end.selectNodeContents(editor.value);
|
|
10017
|
+
end.collapse(false);
|
|
10018
|
+
selection.addRange(end);
|
|
10019
|
+
}
|
|
10020
|
+
function insertNodeAt(range, node) {
|
|
10021
|
+
if (!editor.value) return;
|
|
10022
|
+
focusAt(range);
|
|
10023
|
+
const selection = window.getSelection();
|
|
10024
|
+
if (selection.rangeCount) selection.getRangeAt(0).insertNode(node);
|
|
10025
|
+
else editor.value.appendChild(node);
|
|
10026
|
+
syncFromDom();
|
|
10027
|
+
syncFormats();
|
|
10028
|
+
}
|
|
10029
|
+
function ensureRange() {
|
|
10030
|
+
const range = currentRange();
|
|
10031
|
+
if (range) return range;
|
|
10032
|
+
if (!savedRange) return null;
|
|
10033
|
+
focusAt(savedRange);
|
|
10034
|
+
return currentRange();
|
|
10035
|
+
}
|
|
10036
|
+
function exec(command, value = null) {
|
|
10037
|
+
if (!ready.value) return;
|
|
10038
|
+
if (typeof document.execCommand !== "function") return;
|
|
10039
|
+
ensureRange();
|
|
10040
|
+
document.execCommand("styleWithCSS", false, true);
|
|
10041
|
+
document.execCommand(command, false, value);
|
|
10042
|
+
if (editor.value) editor.value.focus();
|
|
10043
|
+
syncFromDom();
|
|
10044
|
+
syncFormats();
|
|
10045
|
+
}
|
|
10046
|
+
function setBlock(value) {
|
|
10047
|
+
panel.value = "";
|
|
10048
|
+
exec("formatBlock", "<" + value + ">");
|
|
10049
|
+
}
|
|
10050
|
+
function setFontSize(size) {
|
|
10051
|
+
panel.value = "";
|
|
10052
|
+
if (!ready.value || !editor.value) return;
|
|
10053
|
+
fontSize.value = size;
|
|
10054
|
+
const range = ensureRange();
|
|
10055
|
+
if (!range || range.collapsed) return;
|
|
10056
|
+
if (!size) {
|
|
10057
|
+
const walker = document.createTreeWalker(editor.value, NodeFilter.SHOW_ELEMENT);
|
|
10058
|
+
const targets = [];
|
|
10059
|
+
while (walker.nextNode()) {
|
|
10060
|
+
const el = walker.currentNode;
|
|
10061
|
+
if (el.style && el.style.fontSize && range.intersectsNode(el)) targets.push(el);
|
|
10062
|
+
}
|
|
10063
|
+
targets.forEach((el) => {
|
|
10064
|
+
el.style.fontSize = "";
|
|
10065
|
+
});
|
|
10066
|
+
syncFromDom();
|
|
10067
|
+
return;
|
|
10068
|
+
}
|
|
10069
|
+
const span = document.createElement("span");
|
|
10070
|
+
span.style.fontSize = size;
|
|
10071
|
+
span.appendChild(range.extractContents());
|
|
10072
|
+
range.insertNode(span);
|
|
10073
|
+
const selection = window.getSelection();
|
|
10074
|
+
const after = document.createRange();
|
|
10075
|
+
after.setStartAfter(span);
|
|
10076
|
+
after.collapse(true);
|
|
10077
|
+
selection.removeAllRanges();
|
|
10078
|
+
selection.addRange(after);
|
|
10079
|
+
syncFromDom();
|
|
10080
|
+
syncFormats();
|
|
10081
|
+
}
|
|
10082
|
+
function applyColor(kind, color) {
|
|
10083
|
+
panel.value = "";
|
|
10084
|
+
if (kind === "text") textColor.value = color;
|
|
10085
|
+
else bgColor.value = color;
|
|
10086
|
+
if (!ready.value) return;
|
|
10087
|
+
if (typeof document.execCommand !== "function") return;
|
|
10088
|
+
document.execCommand("styleWithCSS", false, true);
|
|
10089
|
+
const command = kind === "text" ? "foreColor" : "hiliteColor";
|
|
10090
|
+
if (!document.execCommand(command, false, color) && kind === "bg") {
|
|
10091
|
+
document.execCommand("backColor", false, color);
|
|
10092
|
+
}
|
|
10093
|
+
if (editor.value) editor.value.focus();
|
|
10094
|
+
syncFromDom();
|
|
10095
|
+
syncFormats();
|
|
10096
|
+
}
|
|
10097
|
+
function togglePanel(name) {
|
|
10098
|
+
if (!ready.value) return;
|
|
10099
|
+
panel.value = panel.value === name ? "" : name;
|
|
10100
|
+
}
|
|
10101
|
+
function toggleInlineCode() {
|
|
10102
|
+
if (!ready.value || !editor.value) return;
|
|
10103
|
+
const range = currentRange();
|
|
10104
|
+
if (!range) return;
|
|
10105
|
+
const anchor = range.commonAncestorContainer;
|
|
10106
|
+
const node = anchor.nodeType === 1 ? anchor : anchor.parentElement;
|
|
10107
|
+
const code = node && node.closest ? node.closest("code") : null;
|
|
10108
|
+
if (code && editor.value.contains(code)) {
|
|
10109
|
+
const parent = code.parentNode;
|
|
10110
|
+
while (code.firstChild) parent.insertBefore(code.firstChild, code);
|
|
10111
|
+
parent.removeChild(code);
|
|
10112
|
+
syncFromDom();
|
|
10113
|
+
return;
|
|
10114
|
+
}
|
|
10115
|
+
if (range.collapsed) return;
|
|
10116
|
+
const wrapper = document.createElement("code");
|
|
10117
|
+
wrapper.appendChild(range.extractContents());
|
|
10118
|
+
range.insertNode(wrapper);
|
|
10119
|
+
const selection = window.getSelection();
|
|
10120
|
+
const after = document.createRange();
|
|
10121
|
+
after.setStartAfter(wrapper);
|
|
10122
|
+
after.collapse(true);
|
|
10123
|
+
selection.removeAllRanges();
|
|
10124
|
+
selection.addRange(after);
|
|
10125
|
+
syncFromDom();
|
|
10126
|
+
syncFormats();
|
|
10127
|
+
}
|
|
10128
|
+
function addLink() {
|
|
10129
|
+
if (!ready.value) return;
|
|
10130
|
+
const url = window.prompt(t("richEditor.linkPrompt"), "https://");
|
|
10131
|
+
if (!url) return;
|
|
10132
|
+
if (!isSafeLink(url)) {
|
|
10133
|
+
window.alert(t("richEditor.linkInvalid"));
|
|
10134
|
+
return;
|
|
10135
|
+
}
|
|
10136
|
+
const range = currentRange();
|
|
10137
|
+
if (range && range.collapsed) {
|
|
10138
|
+
const link = document.createElement("a");
|
|
10139
|
+
link.href = url;
|
|
10140
|
+
link.target = "_blank";
|
|
10141
|
+
link.rel = "noopener noreferrer";
|
|
10142
|
+
link.textContent = url;
|
|
10143
|
+
insertNodeAt(range, link);
|
|
10144
|
+
return;
|
|
10145
|
+
}
|
|
10146
|
+
exec("createLink", url);
|
|
10147
|
+
if (editor.value) {
|
|
10148
|
+
editor.value.querySelectorAll("a[href]").forEach((link) => {
|
|
10149
|
+
if (!link.getAttribute("target")) link.setAttribute("target", "_blank");
|
|
10150
|
+
link.setAttribute("rel", "noopener noreferrer");
|
|
10151
|
+
});
|
|
10152
|
+
}
|
|
10153
|
+
syncFromDom();
|
|
10154
|
+
}
|
|
10155
|
+
function readAsDataUrl(file) {
|
|
10156
|
+
return new Promise((resolve, reject) => {
|
|
10157
|
+
const reader = new FileReader();
|
|
10158
|
+
reader.onload = () => resolve(reader.result);
|
|
10159
|
+
reader.onerror = () => reject(reader.error || new Error("read failed"));
|
|
10160
|
+
reader.readAsDataURL(file);
|
|
10161
|
+
});
|
|
10162
|
+
}
|
|
10163
|
+
async function uploadOne(file) {
|
|
10164
|
+
if (props.uploadImage) {
|
|
10165
|
+
const result = await props.uploadImage(file);
|
|
10166
|
+
const url = typeof result === "string" ? result : result && result.url;
|
|
10167
|
+
if (!url) throw new Error(t("richEditor.imageUrlInvalid"));
|
|
10168
|
+
if (!isSafeImageUrl(url)) throw new Error(t("richEditor.imageUrlInvalid"));
|
|
10169
|
+
return String(url).trim();
|
|
10170
|
+
}
|
|
10171
|
+
return readAsDataUrl(file);
|
|
10172
|
+
}
|
|
10173
|
+
function isImage(file) {
|
|
10174
|
+
return file && /^image\//.test(file.type);
|
|
10175
|
+
}
|
|
10176
|
+
function pickImage(allowMultiple) {
|
|
10177
|
+
if (!ready.value || !fileInput.value) return;
|
|
10178
|
+
rememberRange();
|
|
10179
|
+
fileInput.value.multiple = !!allowMultiple && props.multiple;
|
|
10180
|
+
fileInput.value.click();
|
|
10181
|
+
}
|
|
10182
|
+
function insertMedia(ids) {
|
|
10183
|
+
if (!ready.value) return;
|
|
10184
|
+
const picked = (Array.isArray(ids) ? ids : [ids]).map((id) => mediaLibrary.value.find((item) => item.id === String(id))).filter(Boolean);
|
|
10185
|
+
const safe = picked.filter((item) => {
|
|
10186
|
+
if (isSafeImageUrl(item.url)) return true;
|
|
10187
|
+
emit("upload-error", { file: null, message: t("richEditor.imageUrlInvalid") });
|
|
10188
|
+
return false;
|
|
10189
|
+
});
|
|
10190
|
+
if (!safe.length) return;
|
|
10191
|
+
focusAt(savedRange);
|
|
10192
|
+
const fragment = document.createDocumentFragment();
|
|
10193
|
+
safe.forEach((item) => {
|
|
10194
|
+
const img = document.createElement("img");
|
|
10195
|
+
img.src = item.url;
|
|
10196
|
+
img.alt = item.name || "image";
|
|
10197
|
+
img.className = "djm-rich-editor-img";
|
|
10198
|
+
fragment.appendChild(img);
|
|
10199
|
+
});
|
|
10200
|
+
const selection = window.getSelection();
|
|
10201
|
+
if (selection.rangeCount) selection.getRangeAt(0).insertNode(fragment);
|
|
10202
|
+
else editor.value.appendChild(fragment);
|
|
10203
|
+
syncFromDom();
|
|
10204
|
+
syncFormats();
|
|
10205
|
+
}
|
|
10206
|
+
function insertImages(files) {
|
|
10207
|
+
if (!files.length || !editor.value) return;
|
|
10208
|
+
uploadCount.value = files.length;
|
|
10209
|
+
const holder = document.createElement("span");
|
|
10210
|
+
holder.className = "djm-rich-editor-uploading";
|
|
10211
|
+
holder.textContent = t("richEditor.uploading", { count: files.length });
|
|
10212
|
+
const anchor = savedRange && editor.value.contains(savedRange.commonAncestorContainer) ? savedRange : null;
|
|
10213
|
+
focusAt(anchor);
|
|
10214
|
+
const selection = window.getSelection();
|
|
10215
|
+
if (selection.rangeCount) selection.getRangeAt(0).insertNode(holder);
|
|
10216
|
+
else editor.value.appendChild(holder);
|
|
10217
|
+
Promise.all(files.map(async (file) => {
|
|
10218
|
+
if (!isImage(file)) return { file, error: t("richEditor.imageTypeError") };
|
|
10219
|
+
if (props.maxImageSize > 0 && file.size > props.maxImageSize * 1024 * 1024) {
|
|
10220
|
+
return { file, error: t("richEditor.imageSizeError", { size: props.maxImageSize }) };
|
|
10221
|
+
}
|
|
10222
|
+
try {
|
|
10223
|
+
return { file, url: await uploadOne(file) };
|
|
10224
|
+
} catch (error) {
|
|
10225
|
+
return { file, error: error && error.message || t("richEditor.uploadFailed") };
|
|
10226
|
+
}
|
|
10227
|
+
})).then((results) => {
|
|
10228
|
+
uploadCount.value = 0;
|
|
10229
|
+
const done = results.filter((item) => item.url);
|
|
10230
|
+
const failed = results.filter((item) => item.error);
|
|
10231
|
+
const alive = editor.value && editor.value.contains(holder);
|
|
10232
|
+
if (done.length && editor.value) {
|
|
10233
|
+
done.forEach((item) => {
|
|
10234
|
+
const img = document.createElement("img");
|
|
10235
|
+
img.src = item.url;
|
|
10236
|
+
img.alt = item.file.name || "image";
|
|
10237
|
+
img.className = "djm-rich-editor-img";
|
|
10238
|
+
if (alive) holder.parentNode.insertBefore(img, holder);
|
|
10239
|
+
else editor.value.appendChild(img);
|
|
10240
|
+
});
|
|
10241
|
+
}
|
|
10242
|
+
if (alive) holder.remove();
|
|
10243
|
+
failed.forEach((item) => emit("upload-error", { file: item.file, message: item.error }));
|
|
10244
|
+
syncFromDom();
|
|
10245
|
+
});
|
|
10246
|
+
}
|
|
10247
|
+
function onFilesChange(event) {
|
|
10248
|
+
const files = Array.from(event.target.files || []);
|
|
10249
|
+
event.target.value = "";
|
|
10250
|
+
insertImages(files);
|
|
10251
|
+
}
|
|
10252
|
+
function onPaste(event) {
|
|
10253
|
+
const data = event.clipboardData;
|
|
10254
|
+
if (!data) return;
|
|
10255
|
+
const images = Array.from(data.files || []).filter(isImage);
|
|
10256
|
+
if (images.length) {
|
|
10257
|
+
event.preventDefault();
|
|
10258
|
+
insertImages(images);
|
|
10259
|
+
return;
|
|
10260
|
+
}
|
|
10261
|
+
const html = data.getData("text/html");
|
|
10262
|
+
if (!html) return;
|
|
10263
|
+
event.preventDefault();
|
|
10264
|
+
document.execCommand("insertHTML", false, sanitizeHtml(html));
|
|
10265
|
+
syncFromDom();
|
|
10266
|
+
}
|
|
10267
|
+
function onDragOver(event) {
|
|
10268
|
+
if (!ready.value) return;
|
|
10269
|
+
if (event.dataTransfer && Array.from(event.dataTransfer.types || []).includes("Files")) {
|
|
10270
|
+
event.preventDefault();
|
|
10271
|
+
}
|
|
10272
|
+
}
|
|
10273
|
+
function onDrop(event) {
|
|
10274
|
+
if (!ready.value) return;
|
|
10275
|
+
const files = Array.from(event.dataTransfer && event.dataTransfer.files || []).filter(isImage);
|
|
10276
|
+
if (!files.length) return;
|
|
10277
|
+
event.preventDefault();
|
|
10278
|
+
rememberRange();
|
|
10279
|
+
insertImages(files);
|
|
10280
|
+
}
|
|
10281
|
+
function closestTag(node, tag) {
|
|
10282
|
+
const el = node && (node.nodeType === 1 ? node : node.parentElement);
|
|
10283
|
+
return el && el.closest ? el.closest(tag) : null;
|
|
10284
|
+
}
|
|
10285
|
+
function detectBlock() {
|
|
10286
|
+
const selection = window.getSelection();
|
|
10287
|
+
if (!selection || !selection.anchorNode) return "p";
|
|
10288
|
+
let node = selection.anchorNode;
|
|
10289
|
+
if (node.nodeType !== 1) node = node.parentElement;
|
|
10290
|
+
while (node && node !== editor.value) {
|
|
10291
|
+
const tag = node.tagName.toLowerCase();
|
|
10292
|
+
if (["p", "h1", "h2", "h3", "blockquote", "pre"].includes(tag)) return tag;
|
|
10293
|
+
node = node.parentElement;
|
|
10294
|
+
}
|
|
10295
|
+
return "p";
|
|
10296
|
+
}
|
|
10297
|
+
function syncFormats() {
|
|
10298
|
+
if (props.disabled || sourceMode.value || !editor.value) return;
|
|
10299
|
+
if (!editor.value.contains(document.activeElement)) return;
|
|
10300
|
+
const selection = window.getSelection();
|
|
10301
|
+
formats.value = {
|
|
9492
10302
|
bold: document.queryCommandState("bold"),
|
|
9493
10303
|
italic: document.queryCommandState("italic"),
|
|
9494
10304
|
underline: document.queryCommandState("underline"),
|
|
9495
|
-
strike: document.queryCommandState("strikeThrough")
|
|
10305
|
+
strike: document.queryCommandState("strikeThrough"),
|
|
10306
|
+
code: !!closestTag(selection.anchorNode, "code"),
|
|
10307
|
+
block: detectBlock(),
|
|
10308
|
+
align: document.queryCommandState("justifyCenter") ? "center" : document.queryCommandState("justifyRight") ? "right" : document.queryCommandState("justifyFull") ? "justify" : "left",
|
|
10309
|
+
list: document.queryCommandState("insertOrderedList") ? "ol" : document.queryCommandState("insertUnorderedList") ? "ul" : ""
|
|
9496
10310
|
};
|
|
9497
10311
|
}
|
|
9498
10312
|
function onSourceInput() {
|
|
10313
|
+
count2.value = plainText(source.value).trim().length;
|
|
9499
10314
|
emit("update:modelValue", clean(source.value));
|
|
9500
10315
|
}
|
|
9501
10316
|
function toggleSource() {
|
|
9502
10317
|
if (props.disabled) return;
|
|
10318
|
+
panel.value = "";
|
|
9503
10319
|
if (sourceMode.value) {
|
|
9504
10320
|
emit("update:modelValue", clean(source.value));
|
|
9505
10321
|
sourceMode.value = false;
|
|
9506
10322
|
requestAnimationFrame(() => {
|
|
9507
10323
|
if (editor.value) editor.value.innerHTML = clean(source.value);
|
|
10324
|
+
syncFromDom();
|
|
9508
10325
|
});
|
|
9509
10326
|
} else {
|
|
9510
10327
|
source.value = editor.value ? editor.value.innerHTML : props.modelValue;
|
|
9511
10328
|
sourceMode.value = true;
|
|
9512
10329
|
}
|
|
9513
10330
|
}
|
|
9514
|
-
|
|
10331
|
+
function toggleFullscreen() {
|
|
10332
|
+
if (props.disabled) return;
|
|
10333
|
+
fullscreen.value = !fullscreen.value;
|
|
10334
|
+
panel.value = "";
|
|
10335
|
+
}
|
|
10336
|
+
function onDocumentClick(event) {
|
|
10337
|
+
if (!panel.value) return;
|
|
10338
|
+
if (!(event.target.closest && event.target.closest(".djm-rich-editor-color"))) panel.value = "";
|
|
10339
|
+
}
|
|
10340
|
+
function onKeydown(event) {
|
|
10341
|
+
if (event.key === "Escape" && fullscreen.value) {
|
|
10342
|
+
fullscreen.value = false;
|
|
10343
|
+
panel.value = "";
|
|
10344
|
+
}
|
|
10345
|
+
}
|
|
10346
|
+
watch21(
|
|
9515
10347
|
() => props.modelValue,
|
|
9516
10348
|
(value) => {
|
|
9517
10349
|
if (sourceMode.value) {
|
|
@@ -9520,40 +10352,117 @@ var rich_editor_default = {
|
|
|
9520
10352
|
}
|
|
9521
10353
|
const next = clean(value);
|
|
9522
10354
|
if (editor.value && editor.value.innerHTML !== next) editor.value.innerHTML = next;
|
|
10355
|
+
count2.value = plainText(next).trim().length;
|
|
9523
10356
|
}
|
|
9524
10357
|
);
|
|
9525
10358
|
onMounted15(() => {
|
|
9526
10359
|
if (editor.value) editor.value.innerHTML = clean(props.modelValue);
|
|
10360
|
+
count2.value = plainText(props.modelValue).trim().length;
|
|
9527
10361
|
document.addEventListener("selectionchange", syncFormats);
|
|
10362
|
+
document.addEventListener("click", onDocumentClick);
|
|
10363
|
+
document.addEventListener("keydown", onKeydown);
|
|
10364
|
+
});
|
|
10365
|
+
onBeforeUnmount24(() => {
|
|
10366
|
+
document.removeEventListener("selectionchange", syncFormats);
|
|
10367
|
+
document.removeEventListener("click", onDocumentClick);
|
|
10368
|
+
document.removeEventListener("keydown", onKeydown);
|
|
9528
10369
|
});
|
|
9529
|
-
onBeforeUnmount23(() => document.removeEventListener("selectionchange", syncFormats));
|
|
9530
10370
|
return {
|
|
9531
10371
|
editor,
|
|
10372
|
+
fileInput,
|
|
9532
10373
|
sourceMode,
|
|
9533
10374
|
source,
|
|
10375
|
+
fullscreen,
|
|
10376
|
+
panel,
|
|
10377
|
+
uploadCount,
|
|
10378
|
+
textColor,
|
|
10379
|
+
bgColor,
|
|
10380
|
+
fontSize,
|
|
10381
|
+
count: count2,
|
|
9534
10382
|
formats,
|
|
10383
|
+
blocks: BLOCKS,
|
|
10384
|
+
sizes: SIZES,
|
|
10385
|
+
colors: COLORS,
|
|
10386
|
+
mediaLibrary,
|
|
10387
|
+
has,
|
|
9535
10388
|
exec,
|
|
9536
|
-
|
|
10389
|
+
setBlock,
|
|
10390
|
+
setFontSize,
|
|
10391
|
+
applyColor,
|
|
10392
|
+
togglePanel,
|
|
10393
|
+
toggleInlineCode,
|
|
9537
10394
|
addLink,
|
|
9538
|
-
|
|
10395
|
+
pickImage,
|
|
10396
|
+
insertMedia,
|
|
10397
|
+
onFilesChange,
|
|
9539
10398
|
onPaste,
|
|
10399
|
+
onDragOver,
|
|
10400
|
+
onDrop,
|
|
10401
|
+
rememberRange,
|
|
10402
|
+
onSourceInput,
|
|
9540
10403
|
toggleSource,
|
|
10404
|
+
toggleFullscreen,
|
|
9541
10405
|
syncFromDom,
|
|
9542
10406
|
syncFormats,
|
|
9543
10407
|
t
|
|
9544
10408
|
};
|
|
9545
10409
|
},
|
|
9546
10410
|
template: `
|
|
9547
|
-
<div
|
|
9548
|
-
|
|
9549
|
-
|
|
10411
|
+
<div
|
|
10412
|
+
class="djm-rich-editor"
|
|
10413
|
+
:class="{ 'djm-is-disabled': disabled, 'djm-is-fullscreen': fullscreen }"
|
|
10414
|
+
>
|
|
10415
|
+
<div class="djm-rich-editor-toolbar" role="toolbar" :aria-label="t('richEditor.toolbar')" @mousedown="rememberRange">
|
|
10416
|
+
<div class="djm-rich-editor-group" v-if="has('history')">
|
|
10417
|
+
<button
|
|
10418
|
+
class="djm-rich-editor-btn"
|
|
10419
|
+
type="button"
|
|
10420
|
+
:title="t('richEditor.undo')"
|
|
10421
|
+
:aria-label="t('richEditor.undo')"
|
|
10422
|
+
:disabled="disabled || sourceMode"
|
|
10423
|
+
@mousedown.prevent
|
|
10424
|
+
@click="exec('undo')"
|
|
10425
|
+
><Icon name="undo" :size="13" /></button>
|
|
10426
|
+
<button
|
|
10427
|
+
class="djm-rich-editor-btn"
|
|
10428
|
+
type="button"
|
|
10429
|
+
:title="t('richEditor.redo')"
|
|
10430
|
+
:aria-label="t('richEditor.redo')"
|
|
10431
|
+
:disabled="disabled || sourceMode"
|
|
10432
|
+
@mousedown.prevent
|
|
10433
|
+
@click="exec('redo')"
|
|
10434
|
+
><Icon name="redo" :size="13" /></button>
|
|
10435
|
+
</div>
|
|
10436
|
+
|
|
10437
|
+
<div class="djm-rich-editor-group" v-if="has('format')">
|
|
10438
|
+
<select
|
|
10439
|
+
class="djm-rich-editor-select"
|
|
10440
|
+
:value="formats.block"
|
|
10441
|
+
:aria-label="t('richEditor.block')"
|
|
10442
|
+
:disabled="disabled || sourceMode"
|
|
10443
|
+
@change="setBlock($event.target.value)"
|
|
10444
|
+
>
|
|
10445
|
+
<option v-for="item in blocks" :key="item.value" :value="item.value">{{ t('richEditor.' + item.label) }}</option>
|
|
10446
|
+
</select>
|
|
10447
|
+
<select
|
|
10448
|
+
class="djm-rich-editor-select djm-rich-editor-select-size"
|
|
10449
|
+
:value="fontSize"
|
|
10450
|
+
:aria-label="t('richEditor.fontSize')"
|
|
10451
|
+
:disabled="disabled || sourceMode"
|
|
10452
|
+
@change="setFontSize($event.target.value)"
|
|
10453
|
+
>
|
|
10454
|
+
<option v-for="item in sizes" :key="item.value" :value="item.value">{{ t('richEditor.' + item.label) }}</option>
|
|
10455
|
+
</select>
|
|
10456
|
+
</div>
|
|
10457
|
+
|
|
10458
|
+
<div class="djm-rich-editor-group" v-if="has('inline')">
|
|
9550
10459
|
<button
|
|
9551
10460
|
class="djm-rich-editor-btn djm-rich-editor-btn-bold"
|
|
9552
10461
|
type="button"
|
|
9553
10462
|
:title="t('richEditor.bold')"
|
|
9554
10463
|
:aria-label="t('richEditor.bold')"
|
|
9555
10464
|
:aria-pressed="String(formats.bold)"
|
|
9556
|
-
:disabled="disabled"
|
|
10465
|
+
:disabled="disabled || sourceMode"
|
|
9557
10466
|
@mousedown.prevent
|
|
9558
10467
|
@click="exec('bold')"
|
|
9559
10468
|
>B</button>
|
|
@@ -9563,7 +10472,7 @@ var rich_editor_default = {
|
|
|
9563
10472
|
:title="t('richEditor.italic')"
|
|
9564
10473
|
:aria-label="t('richEditor.italic')"
|
|
9565
10474
|
:aria-pressed="String(formats.italic)"
|
|
9566
|
-
:disabled="disabled"
|
|
10475
|
+
:disabled="disabled || sourceMode"
|
|
9567
10476
|
@mousedown.prevent
|
|
9568
10477
|
@click="exec('italic')"
|
|
9569
10478
|
>I</button>
|
|
@@ -9573,56 +10482,140 @@ var rich_editor_default = {
|
|
|
9573
10482
|
:title="t('richEditor.underline')"
|
|
9574
10483
|
:aria-label="t('richEditor.underline')"
|
|
9575
10484
|
:aria-pressed="String(formats.underline)"
|
|
9576
|
-
:disabled="disabled"
|
|
10485
|
+
:disabled="disabled || sourceMode"
|
|
9577
10486
|
@mousedown.prevent
|
|
9578
10487
|
@click="exec('underline')"
|
|
9579
10488
|
>U</button>
|
|
9580
10489
|
<button
|
|
9581
|
-
class="djm-rich-editor-btn djm-rich-editor-btn-strike"
|
|
10490
|
+
class="djm-rich-editor-btn djm-rich-editor-btn-strike"
|
|
10491
|
+
type="button"
|
|
10492
|
+
:title="t('richEditor.strike')"
|
|
10493
|
+
:aria-label="t('richEditor.strike')"
|
|
10494
|
+
:aria-pressed="String(formats.strike)"
|
|
10495
|
+
:disabled="disabled || sourceMode"
|
|
10496
|
+
@mousedown.prevent
|
|
10497
|
+
@click="exec('strikeThrough')"
|
|
10498
|
+
>S</button>
|
|
10499
|
+
<button
|
|
10500
|
+
class="djm-rich-editor-btn"
|
|
10501
|
+
type="button"
|
|
10502
|
+
:title="t('richEditor.inlineCode')"
|
|
10503
|
+
:aria-label="t('richEditor.inlineCode')"
|
|
10504
|
+
:aria-pressed="String(formats.code)"
|
|
10505
|
+
:disabled="disabled || sourceMode"
|
|
10506
|
+
@mousedown.prevent
|
|
10507
|
+
@click="toggleInlineCode"
|
|
10508
|
+
><Icon name="code" :size="13" /></button>
|
|
10509
|
+
</div>
|
|
10510
|
+
|
|
10511
|
+
<div class="djm-rich-editor-group djm-rich-editor-color" v-if="has('color')">
|
|
10512
|
+
<button
|
|
10513
|
+
class="djm-rich-editor-btn"
|
|
10514
|
+
type="button"
|
|
10515
|
+
:title="t('richEditor.textColor')"
|
|
10516
|
+
:aria-label="t('richEditor.textColor')"
|
|
10517
|
+
:aria-expanded="String(panel === 'text')"
|
|
10518
|
+
:disabled="disabled || sourceMode"
|
|
10519
|
+
@mousedown.prevent
|
|
10520
|
+
@click.stop="togglePanel('text')"
|
|
10521
|
+
>
|
|
10522
|
+
<span class="djm-rich-editor-letter" :style="{ borderBottomColor: textColor }">A</span>
|
|
10523
|
+
</button>
|
|
10524
|
+
<button
|
|
10525
|
+
class="djm-rich-editor-btn"
|
|
9582
10526
|
type="button"
|
|
9583
|
-
:title="t('richEditor.
|
|
9584
|
-
:aria-label="t('richEditor.
|
|
9585
|
-
:aria-
|
|
9586
|
-
:disabled="disabled"
|
|
10527
|
+
:title="t('richEditor.bgColor')"
|
|
10528
|
+
:aria-label="t('richEditor.bgColor')"
|
|
10529
|
+
:aria-expanded="String(panel === 'bg')"
|
|
10530
|
+
:disabled="disabled || sourceMode"
|
|
9587
10531
|
@mousedown.prevent
|
|
9588
|
-
@click="
|
|
9589
|
-
>
|
|
10532
|
+
@click.stop="togglePanel('bg')"
|
|
10533
|
+
>
|
|
10534
|
+
<span class="djm-rich-editor-letter djm-rich-editor-letter-bg" :style="{ background: bgColor }">A</span>
|
|
10535
|
+
</button>
|
|
10536
|
+
<div v-if="panel === 'text' || panel === 'bg'" class="djm-rich-editor-panel" role="group" :aria-label="t('richEditor.textColor')">
|
|
10537
|
+
<button
|
|
10538
|
+
v-for="color in colors"
|
|
10539
|
+
:key="color"
|
|
10540
|
+
class="djm-rich-editor-swatch"
|
|
10541
|
+
type="button"
|
|
10542
|
+
:title="color"
|
|
10543
|
+
:aria-label="color"
|
|
10544
|
+
:style="{ background: color }"
|
|
10545
|
+
@mousedown.prevent
|
|
10546
|
+
@click="applyColor(panel, color)"
|
|
10547
|
+
></button>
|
|
10548
|
+
</div>
|
|
9590
10549
|
</div>
|
|
9591
10550
|
|
|
9592
|
-
<div class="djm-rich-editor-group">
|
|
9593
|
-
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.
|
|
9594
|
-
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.
|
|
10551
|
+
<div class="djm-rich-editor-group" v-if="has('align')">
|
|
10552
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.alignLeft')" :aria-label="t('richEditor.alignLeft')" :aria-pressed="String(formats.align === 'left')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('justifyLeft')"><Icon name="align-left" :size="13" /></button>
|
|
10553
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.alignCenter')" :aria-label="t('richEditor.alignCenter')" :aria-pressed="String(formats.align === 'center')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('justifyCenter')"><Icon name="align-center" :size="13" /></button>
|
|
10554
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.alignRight')" :aria-label="t('richEditor.alignRight')" :aria-pressed="String(formats.align === 'right')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('justifyRight')"><Icon name="align-right" :size="13" /></button>
|
|
10555
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.alignJustify')" :aria-label="t('richEditor.alignJustify')" :aria-pressed="String(formats.align === 'justify')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('justifyFull')"><Icon name="align-justify" :size="13" /></button>
|
|
9595
10556
|
</div>
|
|
9596
10557
|
|
|
9597
|
-
<div class="djm-rich-editor-group">
|
|
9598
|
-
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.bulletList')" :disabled="disabled" @mousedown.prevent @click="exec('insertUnorderedList')">
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.
|
|
9602
|
-
<span class="djm-rich-editor-glyph">1. \u2261</span>
|
|
9603
|
-
</button>
|
|
9604
|
-
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.link')" :aria-label="t('richEditor.link')" :disabled="disabled" @mousedown.prevent @click="addLink">
|
|
9605
|
-
<Icon name="link" :size="13" />
|
|
9606
|
-
</button>
|
|
10558
|
+
<div class="djm-rich-editor-group" v-if="has('list')">
|
|
10559
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.bulletList')" :aria-label="t('richEditor.bulletList')" :aria-pressed="String(formats.list === 'ul')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('insertUnorderedList')"><Icon name="list" :size="13" /></button>
|
|
10560
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.numberList')" :aria-label="t('richEditor.numberList')" :aria-pressed="String(formats.list === 'ol')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('insertOrderedList')"><Icon name="list-ordered" :size="13" /></button>
|
|
10561
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.outdent')" :aria-label="t('richEditor.outdent')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('outdent')"><Icon name="outdent" :size="13" /></button>
|
|
10562
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.indent')" :aria-label="t('richEditor.indent')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('indent')"><Icon name="indent" :size="13" /></button>
|
|
9607
10563
|
</div>
|
|
9608
10564
|
|
|
9609
|
-
<div class="djm-rich-editor-group">
|
|
9610
|
-
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.
|
|
9611
|
-
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.
|
|
9612
|
-
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.
|
|
10565
|
+
<div class="djm-rich-editor-group" v-if="has('insert')">
|
|
10566
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.link')" :aria-label="t('richEditor.link')" :disabled="disabled || sourceMode" @mousedown.prevent @click="addLink"><Icon name="link" :size="13" /></button>
|
|
10567
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.unlink')" :aria-label="t('richEditor.unlink')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('unlink')"><Icon name="unlink" :size="13" /></button>
|
|
10568
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.singleImage')" :aria-label="t('richEditor.singleImage')" :disabled="disabled || sourceMode" @mousedown.prevent @click="pickImage(false)"><Icon name="image" :size="13" /></button>
|
|
10569
|
+
<button v-if="multiple" class="djm-rich-editor-btn" type="button" :title="t('richEditor.multiImage')" :aria-label="t('richEditor.multiImage')" :disabled="disabled || sourceMode" @mousedown.prevent @click="pickImage(true)"><Icon name="images" :size="13" /></button>
|
|
10570
|
+
<MediaPicker
|
|
10571
|
+
v-if="mediaLibrary.length"
|
|
10572
|
+
class="djm-rich-editor-picker"
|
|
10573
|
+
multiple
|
|
10574
|
+
accept="image"
|
|
10575
|
+
:items="mediaLibrary"
|
|
10576
|
+
:title="t('richEditor.mediaLibrary')"
|
|
10577
|
+
:disabled="disabled || sourceMode"
|
|
10578
|
+
@change="insertMedia"
|
|
10579
|
+
>
|
|
10580
|
+
<template #trigger="{ open }">
|
|
10581
|
+
<button
|
|
10582
|
+
class="djm-rich-editor-btn"
|
|
10583
|
+
type="button"
|
|
10584
|
+
:title="t('richEditor.mediaLibrary')"
|
|
10585
|
+
:aria-label="t('richEditor.mediaLibrary')"
|
|
10586
|
+
:disabled="disabled || sourceMode"
|
|
10587
|
+
@mousedown.prevent="rememberRange"
|
|
10588
|
+
@click="open"
|
|
10589
|
+
><Icon name="grid" :size="13" /></button>
|
|
10590
|
+
</template>
|
|
10591
|
+
</MediaPicker>
|
|
10592
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.hr')" :aria-label="t('richEditor.hr')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('insertHorizontalRule')">\u2014</button>
|
|
10593
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.clearFormat')" :aria-label="t('richEditor.clearFormat')" :disabled="disabled || sourceMode" @mousedown.prevent @click="exec('removeFormat')"><span class="djm-rich-editor-glyph">T\xD7</span></button>
|
|
9613
10594
|
</div>
|
|
9614
10595
|
|
|
9615
|
-
<div class="djm-rich-editor-spacer"></div>
|
|
9616
|
-
<
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
10596
|
+
<div class="djm-rich-editor-spacer" v-if="has('view')"></div>
|
|
10597
|
+
<div class="djm-rich-editor-group djm-rich-editor-group-end" v-if="has('view')">
|
|
10598
|
+
<button
|
|
10599
|
+
class="djm-rich-editor-btn"
|
|
10600
|
+
:class="{ 'djm-is-active': sourceMode }"
|
|
10601
|
+
type="button"
|
|
10602
|
+
:title="sourceMode ? t('richEditor.visual') : t('richEditor.source')"
|
|
10603
|
+
:aria-label="sourceMode ? t('richEditor.visual') : t('richEditor.source')"
|
|
10604
|
+
:aria-pressed="String(sourceMode)"
|
|
10605
|
+
:disabled="disabled"
|
|
10606
|
+
@click="toggleSource"
|
|
10607
|
+
><Icon name="code" :size="13" /></button>
|
|
10608
|
+
<button
|
|
10609
|
+
class="djm-rich-editor-btn"
|
|
10610
|
+
:class="{ 'djm-is-active': fullscreen }"
|
|
10611
|
+
type="button"
|
|
10612
|
+
:title="fullscreen ? t('richEditor.exitFullscreen') : t('richEditor.fullscreen')"
|
|
10613
|
+
:aria-label="fullscreen ? t('richEditor.exitFullscreen') : t('richEditor.fullscreen')"
|
|
10614
|
+
:aria-pressed="String(fullscreen)"
|
|
10615
|
+
:disabled="disabled"
|
|
10616
|
+
@click="toggleFullscreen"
|
|
10617
|
+
><Icon :name="fullscreen ? 'minimize' : 'maximize'" :size="13" /></button>
|
|
10618
|
+
</div>
|
|
9626
10619
|
</div>
|
|
9627
10620
|
|
|
9628
10621
|
<div
|
|
@@ -9638,6 +10631,8 @@ var rich_editor_default = {
|
|
|
9638
10631
|
:style="{ minHeight: minHeight + 'px' }"
|
|
9639
10632
|
@input="syncFromDom"
|
|
9640
10633
|
@paste="onPaste"
|
|
10634
|
+
@dragover="onDragOver"
|
|
10635
|
+
@drop="onDrop"
|
|
9641
10636
|
></div>
|
|
9642
10637
|
|
|
9643
10638
|
<textarea
|
|
@@ -9650,12 +10645,27 @@ var rich_editor_default = {
|
|
|
9650
10645
|
spellcheck="false"
|
|
9651
10646
|
@input="onSourceInput"
|
|
9652
10647
|
></textarea>
|
|
10648
|
+
|
|
10649
|
+
<div v-if="showCount" class="djm-rich-editor-foot">
|
|
10650
|
+
<span v-if="uploadCount" class="djm-rich-editor-foot-item">{{ t('richEditor.uploading', { count: uploadCount }) }}</span>
|
|
10651
|
+
<span class="djm-rich-editor-foot-item">{{ t('richEditor.wordCount', { count }) }}</span>
|
|
10652
|
+
</div>
|
|
10653
|
+
|
|
10654
|
+
<input
|
|
10655
|
+
ref="fileInput"
|
|
10656
|
+
class="djm-rich-editor-file"
|
|
10657
|
+
type="file"
|
|
10658
|
+
:accept="accept"
|
|
10659
|
+
tabindex="-1"
|
|
10660
|
+
aria-hidden="true"
|
|
10661
|
+
@change="onFilesChange"
|
|
10662
|
+
/>
|
|
9653
10663
|
</div>
|
|
9654
10664
|
`
|
|
9655
10665
|
};
|
|
9656
10666
|
|
|
9657
10667
|
// src/components/floating-window/index.js
|
|
9658
|
-
import { ref as
|
|
10668
|
+
import { ref as ref30, onBeforeUnmount as onBeforeUnmount25 } from "vue";
|
|
9659
10669
|
function clamp(value, min, max) {
|
|
9660
10670
|
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
9661
10671
|
}
|
|
@@ -9673,12 +10683,12 @@ var floating_window_default = {
|
|
|
9673
10683
|
},
|
|
9674
10684
|
emits: ["close", "focus"],
|
|
9675
10685
|
setup(props, { emit }) {
|
|
9676
|
-
const root =
|
|
9677
|
-
const pos =
|
|
9678
|
-
const size =
|
|
9679
|
-
const minimized =
|
|
9680
|
-
const maximized =
|
|
9681
|
-
const saved =
|
|
10686
|
+
const root = ref30(null);
|
|
10687
|
+
const pos = ref30({ x: props.initialX, y: props.initialY });
|
|
10688
|
+
const size = ref30({ w: props.width, h: props.height });
|
|
10689
|
+
const minimized = ref30(false);
|
|
10690
|
+
const maximized = ref30(false);
|
|
10691
|
+
const saved = ref30(null);
|
|
9682
10692
|
let drag = null;
|
|
9683
10693
|
let resize = null;
|
|
9684
10694
|
function stage() {
|
|
@@ -9766,7 +10776,7 @@ var floating_window_default = {
|
|
|
9766
10776
|
}
|
|
9767
10777
|
emit("focus");
|
|
9768
10778
|
}
|
|
9769
|
-
|
|
10779
|
+
onBeforeUnmount25(() => {
|
|
9770
10780
|
window.removeEventListener("pointermove", onDrag);
|
|
9771
10781
|
window.removeEventListener("pointerup", endDrag);
|
|
9772
10782
|
window.removeEventListener("pointermove", onResize);
|
|
@@ -9814,7 +10824,7 @@ var floating_window_default = {
|
|
|
9814
10824
|
};
|
|
9815
10825
|
|
|
9816
10826
|
// src/components/upload/index.js
|
|
9817
|
-
import { reactive as reactive4, ref as
|
|
10827
|
+
import { reactive as reactive4, ref as ref31, watch as watch22, onBeforeUnmount as onBeforeUnmount26 } from "vue";
|
|
9818
10828
|
var uidSeed6 = 0;
|
|
9819
10829
|
function extension(name) {
|
|
9820
10830
|
const index = name.lastIndexOf(".");
|
|
@@ -9864,11 +10874,11 @@ var upload_default = {
|
|
|
9864
10874
|
},
|
|
9865
10875
|
emits: ["update:modelValue", "change", "success", "error", "remove", "exceed"],
|
|
9866
10876
|
setup(props, { emit }) {
|
|
9867
|
-
const files =
|
|
9868
|
-
const dragActive =
|
|
9869
|
-
const inputRef =
|
|
10877
|
+
const files = ref31([]);
|
|
10878
|
+
const dragActive = ref31(false);
|
|
10879
|
+
const inputRef = ref31(null);
|
|
9870
10880
|
const tasks = /* @__PURE__ */ new Map();
|
|
9871
|
-
|
|
10881
|
+
watch22(
|
|
9872
10882
|
() => props.modelValue,
|
|
9873
10883
|
(list) => {
|
|
9874
10884
|
const next = list || [];
|
|
@@ -10022,7 +11032,7 @@ var upload_default = {
|
|
|
10022
11032
|
files.value = [];
|
|
10023
11033
|
emitList();
|
|
10024
11034
|
}
|
|
10025
|
-
|
|
11035
|
+
onBeforeUnmount26(() => {
|
|
10026
11036
|
files.value.forEach((item) => {
|
|
10027
11037
|
if (item.url) URL.revokeObjectURL(item.url);
|
|
10028
11038
|
});
|
|
@@ -10170,7 +11180,7 @@ var upload_default = {
|
|
|
10170
11180
|
};
|
|
10171
11181
|
|
|
10172
11182
|
// src/components/tree/index.js
|
|
10173
|
-
import { computed as
|
|
11183
|
+
import { computed as computed18, ref as ref32, watch as watch23 } from "vue";
|
|
10174
11184
|
var tree_default = {
|
|
10175
11185
|
name: "DjmTree",
|
|
10176
11186
|
components: { Icon: icon_default },
|
|
@@ -10202,17 +11212,17 @@ var tree_default = {
|
|
|
10202
11212
|
},
|
|
10203
11213
|
emits: ["update:checked", "update:expanded", "node-click", "check", "node-drop", "load-error"],
|
|
10204
11214
|
setup(props, { emit }) {
|
|
10205
|
-
const lazyChildren =
|
|
10206
|
-
const loadingKeys =
|
|
10207
|
-
const innerExpanded =
|
|
10208
|
-
const innerChecked =
|
|
10209
|
-
|
|
11215
|
+
const lazyChildren = ref32({});
|
|
11216
|
+
const loadingKeys = ref32([]);
|
|
11217
|
+
const innerExpanded = ref32([...props.expanded]);
|
|
11218
|
+
const innerChecked = ref32([...props.checked]);
|
|
11219
|
+
watch23(
|
|
10210
11220
|
() => props.expanded,
|
|
10211
11221
|
(value) => {
|
|
10212
11222
|
if (Array.isArray(value)) innerExpanded.value = value;
|
|
10213
11223
|
}
|
|
10214
11224
|
);
|
|
10215
|
-
|
|
11225
|
+
watch23(
|
|
10216
11226
|
() => props.checked,
|
|
10217
11227
|
(value) => {
|
|
10218
11228
|
if (Array.isArray(value)) innerChecked.value = value;
|
|
@@ -10250,7 +11260,7 @@ var tree_default = {
|
|
|
10250
11260
|
});
|
|
10251
11261
|
return out;
|
|
10252
11262
|
}
|
|
10253
|
-
|
|
11263
|
+
watch23(
|
|
10254
11264
|
() => props.data,
|
|
10255
11265
|
() => {
|
|
10256
11266
|
if (props.defaultExpandAll) innerExpanded.value = collectExpandable(props.data);
|
|
@@ -10267,7 +11277,7 @@ var tree_default = {
|
|
|
10267
11277
|
const children = childrenOf(node);
|
|
10268
11278
|
return Boolean(children && children.some((child) => matchSubtree(child)));
|
|
10269
11279
|
}
|
|
10270
|
-
const rows =
|
|
11280
|
+
const rows = computed18(() => {
|
|
10271
11281
|
const result = [];
|
|
10272
11282
|
const walk = (nodes, level) => {
|
|
10273
11283
|
nodes.forEach((node) => {
|
|
@@ -10338,8 +11348,8 @@ var tree_default = {
|
|
|
10338
11348
|
function isActive(node) {
|
|
10339
11349
|
return props.activeKey !== "" && node[props.nodeKey] === props.activeKey;
|
|
10340
11350
|
}
|
|
10341
|
-
const rootEl =
|
|
10342
|
-
const focusIndex =
|
|
11351
|
+
const rootEl = ref32(null);
|
|
11352
|
+
const focusIndex = ref32(-1);
|
|
10343
11353
|
function tabIndexOf(index) {
|
|
10344
11354
|
return (focusIndex.value === -1 ? 0 : focusIndex.value) === index ? 0 : -1;
|
|
10345
11355
|
}
|
|
@@ -10396,9 +11406,9 @@ var tree_default = {
|
|
|
10396
11406
|
function rowClassOf(node, level) {
|
|
10397
11407
|
return typeof props.rowClass === "function" ? props.rowClass(node, level) : props.rowClass;
|
|
10398
11408
|
}
|
|
10399
|
-
const dragKey =
|
|
10400
|
-
const dropKey =
|
|
10401
|
-
const dropPosition =
|
|
11409
|
+
const dragKey = ref32("");
|
|
11410
|
+
const dropKey = ref32("");
|
|
11411
|
+
const dropPosition = ref32("");
|
|
10402
11412
|
function findNodeByKey(key, nodes = props.data) {
|
|
10403
11413
|
for (const node of nodes) {
|
|
10404
11414
|
if (node[props.nodeKey] === key) return node;
|
|
@@ -10510,7 +11520,7 @@ var tree_default = {
|
|
|
10510
11520
|
onDrop,
|
|
10511
11521
|
onDragEnd,
|
|
10512
11522
|
labelOf,
|
|
10513
|
-
emptyLabel:
|
|
11523
|
+
emptyLabel: computed18(() => props.emptyText || t("tree.empty")),
|
|
10514
11524
|
t
|
|
10515
11525
|
};
|
|
10516
11526
|
},
|
|
@@ -10579,7 +11589,7 @@ var tree_default = {
|
|
|
10579
11589
|
};
|
|
10580
11590
|
|
|
10581
11591
|
// src/components/editable-table/index.js
|
|
10582
|
-
import { computed as
|
|
11592
|
+
import { computed as computed19, nextTick as nextTick14, reactive as reactive5, ref as ref33, useSlots, watch as watch24 } from "vue";
|
|
10583
11593
|
var ACTIONS_KEY = "__editable_actions";
|
|
10584
11594
|
function isEmpty(value) {
|
|
10585
11595
|
if (value === "" || value === null || value === void 0) return true;
|
|
@@ -10603,12 +11613,12 @@ var editable_table_default = {
|
|
|
10603
11613
|
emits: ["edit", "save", "cancel"],
|
|
10604
11614
|
setup(props, { emit }) {
|
|
10605
11615
|
const slots = useSlots();
|
|
10606
|
-
const editingKey =
|
|
11616
|
+
const editingKey = ref33("");
|
|
10607
11617
|
const draft = reactive5({});
|
|
10608
11618
|
const errors = reactive5({});
|
|
10609
|
-
const tableRef =
|
|
10610
|
-
const editableColumns =
|
|
10611
|
-
const renderColumns =
|
|
11619
|
+
const tableRef = ref33(null);
|
|
11620
|
+
const editableColumns = computed19(() => props.columns.filter((column) => column.editor));
|
|
11621
|
+
const renderColumns = computed19(() => {
|
|
10612
11622
|
if (!props.showActions) return props.columns;
|
|
10613
11623
|
return props.columns.concat({
|
|
10614
11624
|
key: ACTIONS_KEY,
|
|
@@ -10620,7 +11630,7 @@ var editable_table_default = {
|
|
|
10620
11630
|
exportable: false
|
|
10621
11631
|
});
|
|
10622
11632
|
});
|
|
10623
|
-
const forwardedSlotNames =
|
|
11633
|
+
const forwardedSlotNames = computed19(() => {
|
|
10624
11634
|
const taken = new Set(editableColumns.value.map((column) => "cell-" + column.key));
|
|
10625
11635
|
taken.add("cell-" + ACTIONS_KEY);
|
|
10626
11636
|
return Object.keys(slots).filter((name) => !taken.has(name));
|
|
@@ -10715,7 +11725,7 @@ var editable_table_default = {
|
|
|
10715
11725
|
clearErrors();
|
|
10716
11726
|
return true;
|
|
10717
11727
|
}
|
|
10718
|
-
|
|
11728
|
+
watch24(
|
|
10719
11729
|
() => props.rows,
|
|
10720
11730
|
() => {
|
|
10721
11731
|
if (editingKey.value && !findRow(editingKey.value)) {
|
|
@@ -10897,7 +11907,7 @@ var message_default = {
|
|
|
10897
11907
|
};
|
|
10898
11908
|
|
|
10899
11909
|
// src/components/org-picker/index.js
|
|
10900
|
-
import { computed as
|
|
11910
|
+
import { computed as computed20, onBeforeUnmount as onBeforeUnmount27, ref as ref34, watch as watch25 } from "vue";
|
|
10901
11911
|
var org_picker_default = {
|
|
10902
11912
|
name: "DjmOrgPicker",
|
|
10903
11913
|
components: { DjmIcon: icon_default },
|
|
@@ -10916,13 +11926,13 @@ var org_picker_default = {
|
|
|
10916
11926
|
},
|
|
10917
11927
|
emits: ["update:modelValue", "change", "visible-change"],
|
|
10918
11928
|
setup(props, { emit }) {
|
|
10919
|
-
const open =
|
|
10920
|
-
const root =
|
|
10921
|
-
const searchRef =
|
|
10922
|
-
const keyword =
|
|
10923
|
-
const activeDept =
|
|
10924
|
-
const temp =
|
|
10925
|
-
const expandedIds =
|
|
11929
|
+
const open = ref34(false);
|
|
11930
|
+
const root = ref34(null);
|
|
11931
|
+
const searchRef = ref34(null);
|
|
11932
|
+
const keyword = ref34("");
|
|
11933
|
+
const activeDept = ref34("");
|
|
11934
|
+
const temp = ref34([]);
|
|
11935
|
+
const expandedIds = ref34(/* @__PURE__ */ new Set());
|
|
10926
11936
|
let detachPanel = null;
|
|
10927
11937
|
function collectDeptIds(nodes, out = []) {
|
|
10928
11938
|
nodes.forEach((node) => {
|
|
@@ -10952,22 +11962,22 @@ var org_picker_default = {
|
|
|
10952
11962
|
walk([root2]);
|
|
10953
11963
|
return ids;
|
|
10954
11964
|
}
|
|
10955
|
-
const staffMap =
|
|
11965
|
+
const staffMap = computed20(() => {
|
|
10956
11966
|
const map = /* @__PURE__ */ new Map();
|
|
10957
11967
|
props.staff.forEach((item) => map.set(item.id, item));
|
|
10958
11968
|
return map;
|
|
10959
11969
|
});
|
|
10960
|
-
const appliedStaff =
|
|
11970
|
+
const appliedStaff = computed20(
|
|
10961
11971
|
() => props.modelValue.map((id) => staffMap.value.get(id)).filter(Boolean)
|
|
10962
11972
|
);
|
|
10963
|
-
const visibleTags =
|
|
11973
|
+
const visibleTags = computed20(() => {
|
|
10964
11974
|
if (props.maxTagCount <= 0) return appliedStaff.value;
|
|
10965
11975
|
return appliedStaff.value.slice(0, props.maxTagCount);
|
|
10966
11976
|
});
|
|
10967
|
-
const restTagCount =
|
|
11977
|
+
const restTagCount = computed20(
|
|
10968
11978
|
() => Math.max(0, appliedStaff.value.length - visibleTags.value.length)
|
|
10969
11979
|
);
|
|
10970
|
-
const visibleStaff =
|
|
11980
|
+
const visibleStaff = computed20(() => {
|
|
10971
11981
|
const key = keyword.value.trim().toLowerCase();
|
|
10972
11982
|
if (key) {
|
|
10973
11983
|
return props.staff.filter(
|
|
@@ -10978,7 +11988,7 @@ var org_picker_default = {
|
|
|
10978
11988
|
const scope = deptScope(activeDept.value);
|
|
10979
11989
|
return props.staff.filter((item) => scope.has(item.deptId));
|
|
10980
11990
|
});
|
|
10981
|
-
const deptRows =
|
|
11991
|
+
const deptRows = computed20(() => {
|
|
10982
11992
|
const rows = [];
|
|
10983
11993
|
const walk = (nodes, depth) => {
|
|
10984
11994
|
nodes.forEach((node) => {
|
|
@@ -10990,11 +12000,11 @@ var org_picker_default = {
|
|
|
10990
12000
|
walk(props.departments, 0);
|
|
10991
12001
|
return rows;
|
|
10992
12002
|
});
|
|
10993
|
-
const selectedCount =
|
|
10994
|
-
const placeholderText =
|
|
10995
|
-
const emptyLabel =
|
|
10996
|
-
const panel =
|
|
10997
|
-
const panelStyle =
|
|
12003
|
+
const selectedCount = computed20(() => temp.value.length);
|
|
12004
|
+
const placeholderText = computed20(() => props.placeholder || t("orgPicker.placeholder"));
|
|
12005
|
+
const emptyLabel = computed20(() => props.emptyText || t("orgPicker.empty"));
|
|
12006
|
+
const panel = ref34(null);
|
|
12007
|
+
const panelStyle = ref34({ ...PANEL_HIDDEN_STYLE });
|
|
10998
12008
|
const PANEL_HEIGHT = 342;
|
|
10999
12009
|
function updatePosition() {
|
|
11000
12010
|
if (!open.value || !root.value) return;
|
|
@@ -11011,7 +12021,7 @@ var org_picker_default = {
|
|
|
11011
12021
|
expandedIds.value = new Set(collectDeptIds(props.departments));
|
|
11012
12022
|
}
|
|
11013
12023
|
expandAll();
|
|
11014
|
-
|
|
12024
|
+
watch25(() => props.departments, () => {
|
|
11015
12025
|
expandedIds.value = /* @__PURE__ */ new Set([...expandedIds.value, ...collectDeptIds(props.departments)]);
|
|
11016
12026
|
});
|
|
11017
12027
|
function initialOf(item) {
|
|
@@ -11100,7 +12110,7 @@ var org_picker_default = {
|
|
|
11100
12110
|
function clearTemp() {
|
|
11101
12111
|
temp.value = [];
|
|
11102
12112
|
}
|
|
11103
|
-
|
|
12113
|
+
onBeforeUnmount27(() => {
|
|
11104
12114
|
if (detachPanel) {
|
|
11105
12115
|
detachPanel();
|
|
11106
12116
|
detachPanel = null;
|
|
@@ -11286,7 +12296,7 @@ var org_picker_default = {
|
|
|
11286
12296
|
};
|
|
11287
12297
|
|
|
11288
12298
|
// src/components/schema-form/index.js
|
|
11289
|
-
import { computed as
|
|
12299
|
+
import { computed as computed21, reactive as reactive7, ref as ref35, watch as watch26 } from "vue";
|
|
11290
12300
|
var CONTROL_MAP = {
|
|
11291
12301
|
input: input_default,
|
|
11292
12302
|
number: input_number_default,
|
|
@@ -11322,26 +12332,26 @@ var schema_form_default = {
|
|
|
11322
12332
|
},
|
|
11323
12333
|
emits: ["update:modelValue", "change"],
|
|
11324
12334
|
setup(props, { emit }) {
|
|
11325
|
-
const innerForm =
|
|
12335
|
+
const innerForm = ref35(null);
|
|
11326
12336
|
const model = reactive7({ ...props.modelValue });
|
|
11327
|
-
|
|
12337
|
+
watch26(() => props.fields, (fields) => {
|
|
11328
12338
|
fields.forEach((field) => {
|
|
11329
12339
|
if (model[field.key] === void 0 && field.default !== void 0) {
|
|
11330
12340
|
model[field.key] = typeof field.default === "function" ? field.default() : field.default;
|
|
11331
12341
|
}
|
|
11332
12342
|
});
|
|
11333
12343
|
}, { immediate: true, deep: true });
|
|
11334
|
-
|
|
12344
|
+
watch26(() => props.modelValue, (value) => {
|
|
11335
12345
|
if (!value) return;
|
|
11336
12346
|
Object.keys(value).forEach((key) => {
|
|
11337
12347
|
if (model[key] !== value[key]) model[key] = value[key];
|
|
11338
12348
|
});
|
|
11339
12349
|
}, { deep: true });
|
|
11340
|
-
|
|
12350
|
+
watch26(model, () => {
|
|
11341
12351
|
emit("update:modelValue", { ...model });
|
|
11342
12352
|
emit("change", { ...model });
|
|
11343
12353
|
}, { deep: true });
|
|
11344
|
-
const formRules =
|
|
12354
|
+
const formRules = computed21(() => {
|
|
11345
12355
|
const merged = { ...props.rules };
|
|
11346
12356
|
props.fields.forEach((field) => {
|
|
11347
12357
|
if (!field.required && !field.rules) return;
|
|
@@ -11354,7 +12364,7 @@ var schema_form_default = {
|
|
|
11354
12364
|
});
|
|
11355
12365
|
return merged;
|
|
11356
12366
|
});
|
|
11357
|
-
const visibleFields =
|
|
12367
|
+
const visibleFields = computed21(
|
|
11358
12368
|
() => props.fields.filter((field) => {
|
|
11359
12369
|
if (typeof field.visibleWhen !== "function") return true;
|
|
11360
12370
|
return Boolean(field.visibleWhen(model));
|
|
@@ -11548,7 +12558,7 @@ var approval_flow_default = {
|
|
|
11548
12558
|
};
|
|
11549
12559
|
|
|
11550
12560
|
// src/components/query-filter/index.js
|
|
11551
|
-
import { computed as
|
|
12561
|
+
import { computed as computed22, reactive as reactive8, ref as ref36, watch as watch27 } from "vue";
|
|
11552
12562
|
var CONTROL_MAP2 = {
|
|
11553
12563
|
input: input_default,
|
|
11554
12564
|
number: input_number_default,
|
|
@@ -11573,26 +12583,26 @@ var query_filter_default = {
|
|
|
11573
12583
|
},
|
|
11574
12584
|
emits: ["update:modelValue", "search", "reset"],
|
|
11575
12585
|
setup(props, { emit }) {
|
|
11576
|
-
const expanded =
|
|
12586
|
+
const expanded = ref36(false);
|
|
11577
12587
|
const model = reactive8({ ...props.modelValue });
|
|
11578
|
-
|
|
12588
|
+
watch27(() => props.fields, (fields) => {
|
|
11579
12589
|
fields.forEach((field) => {
|
|
11580
12590
|
if (model[field.key] === void 0 && field.default !== void 0) {
|
|
11581
12591
|
model[field.key] = typeof field.default === "function" ? field.default() : field.default;
|
|
11582
12592
|
}
|
|
11583
12593
|
});
|
|
11584
12594
|
}, { immediate: true, deep: true });
|
|
11585
|
-
|
|
12595
|
+
watch27(() => props.modelValue, (value) => {
|
|
11586
12596
|
if (!value) return;
|
|
11587
12597
|
Object.keys(value).forEach((key) => {
|
|
11588
12598
|
if (model[key] !== value[key]) model[key] = value[key];
|
|
11589
12599
|
});
|
|
11590
12600
|
}, { deep: true });
|
|
11591
|
-
|
|
12601
|
+
watch27(model, () => {
|
|
11592
12602
|
emit("update:modelValue", { ...model });
|
|
11593
12603
|
}, { deep: true });
|
|
11594
|
-
const collapsible =
|
|
11595
|
-
const visibleFields =
|
|
12604
|
+
const collapsible = computed22(() => props.fields.length > props.visibleCount);
|
|
12605
|
+
const visibleFields = computed22(() => {
|
|
11596
12606
|
if (!collapsible.value || expanded.value) return props.fields;
|
|
11597
12607
|
return props.fields.slice(0, props.visibleCount);
|
|
11598
12608
|
});
|
|
@@ -11721,200 +12731,8 @@ var filter_tags_default = {
|
|
|
11721
12731
|
`
|
|
11722
12732
|
};
|
|
11723
12733
|
|
|
11724
|
-
// src/components/media-picker/index.js
|
|
11725
|
-
import { computed as computed21, ref as ref35, watch as watch26 } from "vue";
|
|
11726
|
-
var media_picker_default = {
|
|
11727
|
-
name: "DjmMediaPicker",
|
|
11728
|
-
components: { DjmModal: modal_default, DjmPagination: pagination_default, DjmIcon: icon_default },
|
|
11729
|
-
props: {
|
|
11730
|
-
modelValue: { type: [Array, String, Number], default: "" },
|
|
11731
|
-
items: { type: Array, default: () => [] },
|
|
11732
|
-
multiple: { type: Boolean, default: false },
|
|
11733
|
-
// 最多选几个,0 表示不限
|
|
11734
|
-
limit: { type: Number, default: 0 },
|
|
11735
|
-
// image 只显示图片,file 只显示非图片,空串不过滤
|
|
11736
|
-
accept: { type: String, default: "" },
|
|
11737
|
-
title: { type: String, default: "" },
|
|
11738
|
-
triggerText: { type: String, default: "" },
|
|
11739
|
-
pageSize: { type: Number, default: 12 },
|
|
11740
|
-
disabled: { type: Boolean, default: false }
|
|
11741
|
-
},
|
|
11742
|
-
emits: ["update:modelValue", "change"],
|
|
11743
|
-
setup(props, { emit }) {
|
|
11744
|
-
const open = ref35(false);
|
|
11745
|
-
const keyword = ref35("");
|
|
11746
|
-
const page = ref35(1);
|
|
11747
|
-
const temp = ref35([]);
|
|
11748
|
-
const selectedIds = computed21(() => {
|
|
11749
|
-
if (props.multiple) return Array.isArray(props.modelValue) ? props.modelValue : [];
|
|
11750
|
-
if (props.modelValue === "" || props.modelValue === null || props.modelValue === void 0) return [];
|
|
11751
|
-
return [props.modelValue];
|
|
11752
|
-
});
|
|
11753
|
-
function isImage(item) {
|
|
11754
|
-
if (item.type) return item.type === "image";
|
|
11755
|
-
return /\.(png|jpe?g|gif|webp|svg|avif)$/i.test(item.url || "");
|
|
11756
|
-
}
|
|
11757
|
-
const filtered = computed21(() => {
|
|
11758
|
-
const key = keyword.value.trim().toLowerCase();
|
|
11759
|
-
return props.items.filter((item) => {
|
|
11760
|
-
if (props.accept === "image" && !isImage(item)) return false;
|
|
11761
|
-
if (props.accept === "file" && isImage(item)) return false;
|
|
11762
|
-
if (key && !String(item.name || "").toLowerCase().includes(key)) return false;
|
|
11763
|
-
return true;
|
|
11764
|
-
});
|
|
11765
|
-
});
|
|
11766
|
-
const paged = computed21(() => {
|
|
11767
|
-
const start = (page.value - 1) * props.pageSize;
|
|
11768
|
-
return filtered.value.slice(start, start + props.pageSize);
|
|
11769
|
-
});
|
|
11770
|
-
watch26(keyword, () => {
|
|
11771
|
-
page.value = 1;
|
|
11772
|
-
});
|
|
11773
|
-
watch26(
|
|
11774
|
-
() => filtered.value.length,
|
|
11775
|
-
() => {
|
|
11776
|
-
const max = Math.max(1, Math.ceil(filtered.value.length / props.pageSize));
|
|
11777
|
-
if (page.value > max) page.value = max;
|
|
11778
|
-
}
|
|
11779
|
-
);
|
|
11780
|
-
function isChecked(id) {
|
|
11781
|
-
return temp.value.includes(id);
|
|
11782
|
-
}
|
|
11783
|
-
function atLimit() {
|
|
11784
|
-
return props.limit > 0 && temp.value.length >= props.limit;
|
|
11785
|
-
}
|
|
11786
|
-
function toggle(item) {
|
|
11787
|
-
if (props.multiple) {
|
|
11788
|
-
if (isChecked(item.id)) {
|
|
11789
|
-
temp.value = temp.value.filter((id) => id !== item.id);
|
|
11790
|
-
return;
|
|
11791
|
-
}
|
|
11792
|
-
if (atLimit()) return;
|
|
11793
|
-
temp.value = [...temp.value, item.id];
|
|
11794
|
-
return;
|
|
11795
|
-
}
|
|
11796
|
-
temp.value = [item.id];
|
|
11797
|
-
}
|
|
11798
|
-
function openPanel() {
|
|
11799
|
-
if (props.disabled) return;
|
|
11800
|
-
temp.value = [...selectedIds.value];
|
|
11801
|
-
keyword.value = "";
|
|
11802
|
-
page.value = 1;
|
|
11803
|
-
open.value = true;
|
|
11804
|
-
}
|
|
11805
|
-
function commit() {
|
|
11806
|
-
const next = props.multiple ? [...temp.value] : temp.value[0] !== void 0 ? temp.value[0] : "";
|
|
11807
|
-
emit("update:modelValue", next);
|
|
11808
|
-
emit("change", next);
|
|
11809
|
-
open.value = false;
|
|
11810
|
-
}
|
|
11811
|
-
function cancel() {
|
|
11812
|
-
temp.value = [...selectedIds.value];
|
|
11813
|
-
open.value = false;
|
|
11814
|
-
}
|
|
11815
|
-
return {
|
|
11816
|
-
open,
|
|
11817
|
-
keyword,
|
|
11818
|
-
page,
|
|
11819
|
-
temp,
|
|
11820
|
-
selectedIds,
|
|
11821
|
-
filtered,
|
|
11822
|
-
paged,
|
|
11823
|
-
isImage,
|
|
11824
|
-
isChecked,
|
|
11825
|
-
atLimit,
|
|
11826
|
-
toggle,
|
|
11827
|
-
openPanel,
|
|
11828
|
-
commit,
|
|
11829
|
-
cancel,
|
|
11830
|
-
t
|
|
11831
|
-
};
|
|
11832
|
-
},
|
|
11833
|
-
template: `
|
|
11834
|
-
<span class="djm-media-picker">
|
|
11835
|
-
<slot name="trigger" :open="openPanel" :count="selectedIds.length">
|
|
11836
|
-
<button
|
|
11837
|
-
class="djm-btn"
|
|
11838
|
-
type="button"
|
|
11839
|
-
:disabled="disabled"
|
|
11840
|
-
@click="openPanel"
|
|
11841
|
-
>{{ triggerText || t('mediaPicker.select') }}<span v-if="selectedIds.length" class="djm-media-picker-count">{{ selectedIds.length }}</span></button>
|
|
11842
|
-
</slot>
|
|
11843
|
-
|
|
11844
|
-
<DjmModal
|
|
11845
|
-
:model-value="open"
|
|
11846
|
-
:title="title || t('mediaPicker.title')"
|
|
11847
|
-
width="760px"
|
|
11848
|
-
@update:model-value="cancel"
|
|
11849
|
-
>
|
|
11850
|
-
<div class="djm-media-toolbar">
|
|
11851
|
-
<label class="djm-media-search">
|
|
11852
|
-
<DjmIcon name="search" :size="13" />
|
|
11853
|
-
<input
|
|
11854
|
-
v-model="keyword"
|
|
11855
|
-
class="djm-media-search-input"
|
|
11856
|
-
type="text"
|
|
11857
|
-
:placeholder="t('mediaPicker.search')"
|
|
11858
|
-
:aria-label="t('mediaPicker.search')"
|
|
11859
|
-
/>
|
|
11860
|
-
</label>
|
|
11861
|
-
<span class="djm-media-toolbar-slot">
|
|
11862
|
-
<slot name="toolbar"></slot>
|
|
11863
|
-
</span>
|
|
11864
|
-
</div>
|
|
11865
|
-
|
|
11866
|
-
<div class="djm-media-grid" role="listbox" :aria-multiselectable="multiple ? 'true' : 'false'">
|
|
11867
|
-
<div
|
|
11868
|
-
v-for="item in paged"
|
|
11869
|
-
:key="item.id"
|
|
11870
|
-
class="djm-media-item"
|
|
11871
|
-
:class="{
|
|
11872
|
-
'djm-is-checked': isChecked(item.id),
|
|
11873
|
-
'djm-is-disabled': multiple && atLimit() && !isChecked(item.id)
|
|
11874
|
-
}"
|
|
11875
|
-
role="option"
|
|
11876
|
-
tabindex="0"
|
|
11877
|
-
:aria-selected="String(isChecked(item.id))"
|
|
11878
|
-
@click="toggle(item)"
|
|
11879
|
-
@keydown.enter.prevent="toggle(item)"
|
|
11880
|
-
@keydown.space.prevent="toggle(item)"
|
|
11881
|
-
>
|
|
11882
|
-
<div class="djm-media-thumb">
|
|
11883
|
-
<img v-if="isImage(item)" :src="item.url" :alt="item.name" loading="lazy" />
|
|
11884
|
-
<DjmIcon v-else name="folder" :size="26" />
|
|
11885
|
-
<span v-if="isChecked(item.id)" class="djm-media-check">
|
|
11886
|
-
<DjmIcon name="check" :size="11" />
|
|
11887
|
-
</span>
|
|
11888
|
-
</div>
|
|
11889
|
-
<div class="djm-media-name" :title="item.name">{{ item.name }}</div>
|
|
11890
|
-
</div>
|
|
11891
|
-
<div v-if="!paged.length" class="djm-media-empty">{{ t('mediaPicker.empty') }}</div>
|
|
11892
|
-
</div>
|
|
11893
|
-
|
|
11894
|
-
<div class="djm-media-foot">
|
|
11895
|
-
<span class="djm-media-total">
|
|
11896
|
-
{{ t('mediaPicker.total', { total: filtered.length }) }}
|
|
11897
|
-
<em v-if="multiple && limit > 0">{{ t('mediaPicker.limit', { limit }) }}</em>
|
|
11898
|
-
</span>
|
|
11899
|
-
<DjmPagination
|
|
11900
|
-
v-if="filtered.length > pageSize"
|
|
11901
|
-
v-model:page="page"
|
|
11902
|
-
:page-size="pageSize"
|
|
11903
|
-
:total="filtered.length"
|
|
11904
|
-
/>
|
|
11905
|
-
</div>
|
|
11906
|
-
|
|
11907
|
-
<template #footer>
|
|
11908
|
-
<button class="djm-btn" type="button" @click="cancel">{{ t('common.cancel') }}</button>
|
|
11909
|
-
<button class="djm-btn djm-btn-primary" type="button" @click="commit">{{ t('common.confirm') }}</button>
|
|
11910
|
-
</template>
|
|
11911
|
-
</DjmModal>
|
|
11912
|
-
</span>
|
|
11913
|
-
`
|
|
11914
|
-
};
|
|
11915
|
-
|
|
11916
12734
|
// src/components/kanban/index.js
|
|
11917
|
-
import { ref as
|
|
12735
|
+
import { ref as ref37, watch as watch28 } from "vue";
|
|
11918
12736
|
function cloneColumns(list) {
|
|
11919
12737
|
return (list || []).map((col) => ({ ...col, cards: (col.cards || []).slice() }));
|
|
11920
12738
|
}
|
|
@@ -11931,15 +12749,15 @@ var kanban_default = {
|
|
|
11931
12749
|
},
|
|
11932
12750
|
emits: ["update:columns", "change", "card-move", "card-click", "card-add"],
|
|
11933
12751
|
setup(props, { emit }) {
|
|
11934
|
-
const inner =
|
|
11935
|
-
|
|
12752
|
+
const inner = ref37(cloneColumns(props.columns));
|
|
12753
|
+
watch28(
|
|
11936
12754
|
() => props.columns,
|
|
11937
12755
|
(list) => {
|
|
11938
12756
|
inner.value = cloneColumns(list);
|
|
11939
12757
|
}
|
|
11940
12758
|
);
|
|
11941
|
-
const dragCard =
|
|
11942
|
-
const dropTarget =
|
|
12759
|
+
const dragCard = ref37(null);
|
|
12760
|
+
const dropTarget = ref37(null);
|
|
11943
12761
|
function columnOf(key) {
|
|
11944
12762
|
return inner.value.find((col) => col.key === key);
|
|
11945
12763
|
}
|
|
@@ -12102,7 +12920,7 @@ var kanban_default = {
|
|
|
12102
12920
|
};
|
|
12103
12921
|
|
|
12104
12922
|
// src/components/attachment-list/index.js
|
|
12105
|
-
import { computed as
|
|
12923
|
+
import { computed as computed23 } from "vue";
|
|
12106
12924
|
var IMAGE_EXTS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"];
|
|
12107
12925
|
function extOf(file) {
|
|
12108
12926
|
if (file.ext) return String(file.ext).toLowerCase();
|
|
@@ -12126,14 +12944,14 @@ var attachment_list_default = {
|
|
|
12126
12944
|
},
|
|
12127
12945
|
emits: ["preview", "download", "remove"],
|
|
12128
12946
|
setup(props, { emit }) {
|
|
12129
|
-
const list =
|
|
12947
|
+
const list = computed23(
|
|
12130
12948
|
() => props.files.map((file, index) => {
|
|
12131
12949
|
const ext = extOf(file);
|
|
12132
12950
|
const isImage = file.type === "image" || IMAGE_EXTS.includes(ext);
|
|
12133
12951
|
return { ...file, _key: file.uid !== void 0 ? file.uid : index, _ext: ext, _isImage: isImage };
|
|
12134
12952
|
})
|
|
12135
12953
|
);
|
|
12136
|
-
const emptyLabel =
|
|
12954
|
+
const emptyLabel = computed23(() => props.emptyText || t("attachment.empty"));
|
|
12137
12955
|
function onPreview(file) {
|
|
12138
12956
|
emit("preview", file);
|
|
12139
12957
|
}
|
|
@@ -12239,7 +13057,7 @@ var attachment_list_default = {
|
|
|
12239
13057
|
};
|
|
12240
13058
|
|
|
12241
13059
|
// src/components/notification/index.js
|
|
12242
|
-
import { computed as
|
|
13060
|
+
import { computed as computed24, onBeforeUnmount as onBeforeUnmount28, ref as ref38 } from "vue";
|
|
12243
13061
|
var TYPE_MAP = {
|
|
12244
13062
|
info: { icon: "info", cls: "djm-is-info" },
|
|
12245
13063
|
success: { icon: "check", cls: "djm-is-success" },
|
|
@@ -12259,8 +13077,8 @@ var notification_default = {
|
|
|
12259
13077
|
},
|
|
12260
13078
|
emits: ["click", "read", "read-all", "remove", "clear"],
|
|
12261
13079
|
setup(props, { emit }) {
|
|
12262
|
-
const unreadCount =
|
|
12263
|
-
const emptyLabel =
|
|
13080
|
+
const unreadCount = computed24(() => props.items.filter((item) => !item.read).length);
|
|
13081
|
+
const emptyLabel = computed24(() => props.emptyText || t("notification.empty"));
|
|
12264
13082
|
function typeOf(item) {
|
|
12265
13083
|
return TYPE_MAP[item.type] || TYPE_MAP.info;
|
|
12266
13084
|
}
|
|
@@ -12271,7 +13089,7 @@ var notification_default = {
|
|
|
12271
13089
|
function onReadAll() {
|
|
12272
13090
|
emit("read-all");
|
|
12273
13091
|
}
|
|
12274
|
-
const clearing =
|
|
13092
|
+
const clearing = ref38(false);
|
|
12275
13093
|
let clearTimer = null;
|
|
12276
13094
|
function onClear() {
|
|
12277
13095
|
if (!clearing.value) {
|
|
@@ -12285,7 +13103,7 @@ var notification_default = {
|
|
|
12285
13103
|
clearing.value = false;
|
|
12286
13104
|
emit("clear");
|
|
12287
13105
|
}
|
|
12288
|
-
|
|
13106
|
+
onBeforeUnmount28(() => window.clearTimeout(clearTimer));
|
|
12289
13107
|
function onRemove(item) {
|
|
12290
13108
|
emit("remove", item);
|
|
12291
13109
|
}
|
|
@@ -12360,7 +13178,7 @@ var notification_default = {
|
|
|
12360
13178
|
};
|
|
12361
13179
|
|
|
12362
13180
|
// src/components/config-provider/index.js
|
|
12363
|
-
import { watch as
|
|
13181
|
+
import { watch as watch29 } from "vue";
|
|
12364
13182
|
var SIZE_HEIGHT = { xs: "24px", sm: "28px", md: "30px", lg: "34px" };
|
|
12365
13183
|
var config_provider_default = {
|
|
12366
13184
|
name: "DjmConfigProvider",
|
|
@@ -12370,7 +13188,7 @@ var config_provider_default = {
|
|
|
12370
13188
|
},
|
|
12371
13189
|
setup(props) {
|
|
12372
13190
|
if (props.locale) setLocale(props.locale);
|
|
12373
|
-
|
|
13191
|
+
watch29(
|
|
12374
13192
|
() => props.locale,
|
|
12375
13193
|
(code) => {
|
|
12376
13194
|
if (code) setLocale(code);
|
|
@@ -12392,7 +13210,7 @@ var config_provider_default = {
|
|
|
12392
13210
|
};
|
|
12393
13211
|
|
|
12394
13212
|
// src/components/date-time-picker/index.js
|
|
12395
|
-
import { ref as
|
|
13213
|
+
import { ref as ref39, computed as computed25, watch as watch30, onBeforeUnmount as onBeforeUnmount29 } from "vue";
|
|
12396
13214
|
var uidSeed7 = 0;
|
|
12397
13215
|
var pad4 = (value) => String(value).padStart(2, "0");
|
|
12398
13216
|
function toDateKey(year, month, day) {
|
|
@@ -12425,31 +13243,31 @@ var date_time_picker_default = {
|
|
|
12425
13243
|
},
|
|
12426
13244
|
emits: ["update:modelValue", "change", "visible-change"],
|
|
12427
13245
|
setup(props, { emit }) {
|
|
12428
|
-
const open =
|
|
12429
|
-
|
|
12430
|
-
const root =
|
|
12431
|
-
const panel =
|
|
13246
|
+
const open = ref39(false);
|
|
13247
|
+
watch30(open, (value) => emit("visible-change", value));
|
|
13248
|
+
const root = ref39(null);
|
|
13249
|
+
const panel = ref39(null);
|
|
12432
13250
|
const panelId = "djm-datetime-panel-" + ++uidSeed7;
|
|
12433
|
-
const panelStyle =
|
|
13251
|
+
const panelStyle = ref39({ ...PANEL_HIDDEN_STYLE });
|
|
12434
13252
|
let detachPanel = null;
|
|
12435
13253
|
const today = /* @__PURE__ */ new Date();
|
|
12436
13254
|
const todayKey = toDateKey(today.getFullYear(), today.getMonth(), today.getDate());
|
|
12437
|
-
const hasSeconds =
|
|
12438
|
-
const draft =
|
|
13255
|
+
const hasSeconds = computed25(() => props.format.indexOf("ss") > -1);
|
|
13256
|
+
const draft = ref39({ date: "", h: "00", m: "00", s: "00" });
|
|
12439
13257
|
const initial = parseDate(parseValue(props.modelValue).date);
|
|
12440
|
-
const viewYear =
|
|
12441
|
-
const viewMonth =
|
|
12442
|
-
const displayText =
|
|
12443
|
-
const placeholderText =
|
|
12444
|
-
const weeks =
|
|
12445
|
-
const hours =
|
|
12446
|
-
const minutes =
|
|
13258
|
+
const viewYear = ref39(initial ? initial.year : today.getFullYear());
|
|
13259
|
+
const viewMonth = ref39(initial ? initial.month : today.getMonth());
|
|
13260
|
+
const displayText = computed25(() => props.modelValue || "");
|
|
13261
|
+
const placeholderText = computed25(() => props.placeholder || t("dateTimePicker.placeholder"));
|
|
13262
|
+
const weeks = computed25(() => t("datePicker.weeks").split(","));
|
|
13263
|
+
const hours = computed25(() => Array.from({ length: 24 }, (_, index) => pad4(index)));
|
|
13264
|
+
const minutes = computed25(() => {
|
|
12447
13265
|
const list = [];
|
|
12448
13266
|
for (let value = 0; value < 60; value += Math.max(1, props.minuteStep)) list.push(pad4(value));
|
|
12449
13267
|
return list;
|
|
12450
13268
|
});
|
|
12451
|
-
const seconds =
|
|
12452
|
-
const timeCols =
|
|
13269
|
+
const seconds = computed25(() => Array.from({ length: 60 }, (_, index) => pad4(index)));
|
|
13270
|
+
const timeCols = computed25(() => {
|
|
12453
13271
|
const cols = [
|
|
12454
13272
|
{ key: "h", list: hours.value },
|
|
12455
13273
|
{ key: "m", list: minutes.value }
|
|
@@ -12457,8 +13275,8 @@ var date_time_picker_default = {
|
|
|
12457
13275
|
if (hasSeconds.value) cols.push({ key: "s", list: seconds.value });
|
|
12458
13276
|
return cols;
|
|
12459
13277
|
});
|
|
12460
|
-
const monthLabel =
|
|
12461
|
-
const cells =
|
|
13278
|
+
const monthLabel = computed25(() => t("datePicker.title", { year: viewYear.value, month: viewMonth.value + 1 }));
|
|
13279
|
+
const cells = computed25(() => {
|
|
12462
13280
|
const first = new Date(viewYear.value, viewMonth.value, 1);
|
|
12463
13281
|
const offset = (first.getDay() + 6) % 7;
|
|
12464
13282
|
const start = new Date(viewYear.value, viewMonth.value, 1 - offset);
|
|
@@ -12594,7 +13412,7 @@ var date_time_picker_default = {
|
|
|
12594
13412
|
emit("change", "");
|
|
12595
13413
|
closePanel();
|
|
12596
13414
|
}
|
|
12597
|
-
|
|
13415
|
+
onBeforeUnmount29(() => {
|
|
12598
13416
|
if (detachPanel) {
|
|
12599
13417
|
detachPanel();
|
|
12600
13418
|
detachPanel = null;
|
|
@@ -12719,7 +13537,7 @@ var date_time_picker_default = {
|
|
|
12719
13537
|
};
|
|
12720
13538
|
|
|
12721
13539
|
// src/components/virtual-list/index.js
|
|
12722
|
-
import { ref as
|
|
13540
|
+
import { ref as ref40, computed as computed26, watch as watch31, onMounted as onMounted16, onBeforeUnmount as onBeforeUnmount30 } from "vue";
|
|
12723
13541
|
var virtual_list_default = {
|
|
12724
13542
|
name: "DjmVirtualList",
|
|
12725
13543
|
props: {
|
|
@@ -12736,14 +13554,14 @@ var virtual_list_default = {
|
|
|
12736
13554
|
},
|
|
12737
13555
|
emits: ["scroll", "reach-bottom", "item-click"],
|
|
12738
13556
|
setup(props, { emit, expose }) {
|
|
12739
|
-
const viewport =
|
|
12740
|
-
const scrollTop =
|
|
12741
|
-
const viewHeight =
|
|
13557
|
+
const viewport = ref40(null);
|
|
13558
|
+
const scrollTop = ref40(0);
|
|
13559
|
+
const viewHeight = ref40(typeof props.height === "number" ? props.height : 320);
|
|
12742
13560
|
let bottomFired = false;
|
|
12743
13561
|
function rowHeight(item, index) {
|
|
12744
13562
|
return typeof props.itemHeight === "function" ? Math.max(1, Number(props.itemHeight(item, index)) || 1) : Math.max(1, props.itemHeight);
|
|
12745
13563
|
}
|
|
12746
|
-
const offsets =
|
|
13564
|
+
const offsets = computed26(() => {
|
|
12747
13565
|
const list = [0];
|
|
12748
13566
|
let sum = 0;
|
|
12749
13567
|
props.items.forEach((item, index) => {
|
|
@@ -12752,7 +13570,7 @@ var virtual_list_default = {
|
|
|
12752
13570
|
});
|
|
12753
13571
|
return list;
|
|
12754
13572
|
});
|
|
12755
|
-
const totalHeight =
|
|
13573
|
+
const totalHeight = computed26(() => offsets.value[offsets.value.length - 1]);
|
|
12756
13574
|
function findStart(top) {
|
|
12757
13575
|
const list = offsets.value;
|
|
12758
13576
|
let low = 0;
|
|
@@ -12764,7 +13582,7 @@ var virtual_list_default = {
|
|
|
12764
13582
|
}
|
|
12765
13583
|
return Math.max(0, low - 1);
|
|
12766
13584
|
}
|
|
12767
|
-
const range =
|
|
13585
|
+
const range = computed26(() => {
|
|
12768
13586
|
const total = props.items.length;
|
|
12769
13587
|
if (!total) return { start: 0, end: 0 };
|
|
12770
13588
|
const start = Math.max(0, findStart(scrollTop.value) - props.overscan);
|
|
@@ -12773,7 +13591,7 @@ var virtual_list_default = {
|
|
|
12773
13591
|
while (end < total && offsets.value[end] < limit) end += 1;
|
|
12774
13592
|
return { start, end: Math.min(total, end + props.overscan) };
|
|
12775
13593
|
});
|
|
12776
|
-
const visibleRows =
|
|
13594
|
+
const visibleRows = computed26(() => {
|
|
12777
13595
|
const { start, end } = range.value;
|
|
12778
13596
|
return props.items.slice(start, end).map((item, index) => {
|
|
12779
13597
|
const realIndex = start + index;
|
|
@@ -12808,7 +13626,7 @@ var virtual_list_default = {
|
|
|
12808
13626
|
else if (start < el.scrollTop) el.scrollTop = start;
|
|
12809
13627
|
else if (end > el.scrollTop + el.clientHeight) el.scrollTop = end - el.clientHeight;
|
|
12810
13628
|
}
|
|
12811
|
-
|
|
13629
|
+
watch31(
|
|
12812
13630
|
() => props.height,
|
|
12813
13631
|
() => {
|
|
12814
13632
|
if (viewport.value) viewHeight.value = viewport.value.clientHeight;
|
|
@@ -12825,7 +13643,7 @@ var virtual_list_default = {
|
|
|
12825
13643
|
resizeObserver.observe(viewport.value);
|
|
12826
13644
|
}
|
|
12827
13645
|
});
|
|
12828
|
-
|
|
13646
|
+
onBeforeUnmount30(() => {
|
|
12829
13647
|
if (resizeObserver) resizeObserver.disconnect();
|
|
12830
13648
|
});
|
|
12831
13649
|
function onItemClick(row) {
|
|
@@ -12870,7 +13688,7 @@ var virtual_list_default = {
|
|
|
12870
13688
|
};
|
|
12871
13689
|
|
|
12872
13690
|
// src/components/batch-bar/index.js
|
|
12873
|
-
import { computed as
|
|
13691
|
+
import { computed as computed27 } from "vue";
|
|
12874
13692
|
var batch_bar_default = {
|
|
12875
13693
|
name: "DjmBatchBar",
|
|
12876
13694
|
props: {
|
|
@@ -12885,8 +13703,8 @@ var batch_bar_default = {
|
|
|
12885
13703
|
},
|
|
12886
13704
|
emits: ["clear", "select-all"],
|
|
12887
13705
|
setup(props, { emit }) {
|
|
12888
|
-
const text =
|
|
12889
|
-
const canSelectAll =
|
|
13706
|
+
const text = computed27(() => props.label || t("batchBar.selected", { count: props.count }));
|
|
13707
|
+
const canSelectAll = computed27(() => props.total > props.count);
|
|
12890
13708
|
return {
|
|
12891
13709
|
text,
|
|
12892
13710
|
canSelectAll,
|
|
@@ -12914,7 +13732,7 @@ var batch_bar_default = {
|
|
|
12914
13732
|
};
|
|
12915
13733
|
|
|
12916
13734
|
// src/components/import-wizard/index.js
|
|
12917
|
-
import { ref as
|
|
13735
|
+
import { ref as ref41, computed as computed28, watch as watch32 } from "vue";
|
|
12918
13736
|
function matchAccept2(name, accept) {
|
|
12919
13737
|
if (!accept) return true;
|
|
12920
13738
|
const ext = "." + String(name).split(".").pop().toLowerCase();
|
|
@@ -12941,19 +13759,19 @@ var import_wizard_default = {
|
|
|
12941
13759
|
},
|
|
12942
13760
|
emits: ["update:step", "update:mapping", "file-change", "submit", "retry"],
|
|
12943
13761
|
setup(props, { emit }) {
|
|
12944
|
-
const innerStep =
|
|
12945
|
-
|
|
13762
|
+
const innerStep = ref41(props.step || 1);
|
|
13763
|
+
watch32(
|
|
12946
13764
|
() => props.step,
|
|
12947
13765
|
(value) => {
|
|
12948
13766
|
if (value) innerStep.value = value;
|
|
12949
13767
|
}
|
|
12950
13768
|
);
|
|
12951
|
-
const file =
|
|
12952
|
-
const fileError =
|
|
12953
|
-
const mappingError =
|
|
12954
|
-
const fileInput =
|
|
12955
|
-
const innerMapping =
|
|
12956
|
-
|
|
13769
|
+
const file = ref41(null);
|
|
13770
|
+
const fileError = ref41("");
|
|
13771
|
+
const mappingError = ref41("");
|
|
13772
|
+
const fileInput = ref41(null);
|
|
13773
|
+
const innerMapping = ref41({ ...props.mapping });
|
|
13774
|
+
watch32(
|
|
12957
13775
|
() => props.mapping,
|
|
12958
13776
|
(value) => {
|
|
12959
13777
|
innerMapping.value = { ...value };
|
|
@@ -12964,7 +13782,7 @@ var import_wizard_default = {
|
|
|
12964
13782
|
innerStep.value = next;
|
|
12965
13783
|
emit("update:step", next);
|
|
12966
13784
|
}
|
|
12967
|
-
const steps =
|
|
13785
|
+
const steps = computed28(() => [
|
|
12968
13786
|
{ index: 1, title: t("importWizard.stepFile") },
|
|
12969
13787
|
{ index: 2, title: t("importWizard.stepMapping") },
|
|
12970
13788
|
{ index: 3, title: t("importWizard.stepResult") }
|
|
@@ -13006,7 +13824,7 @@ var import_wizard_default = {
|
|
|
13006
13824
|
mappingError.value = "";
|
|
13007
13825
|
emit("update:mapping", next);
|
|
13008
13826
|
}
|
|
13009
|
-
const missingRequired =
|
|
13827
|
+
const missingRequired = computed28(
|
|
13010
13828
|
() => props.columns.filter((col) => col.required && !innerMapping.value[col.key])
|
|
13011
13829
|
);
|
|
13012
13830
|
function submit() {
|
|
@@ -13018,7 +13836,7 @@ var import_wizard_default = {
|
|
|
13018
13836
|
}
|
|
13019
13837
|
emit("submit", { ...innerMapping.value });
|
|
13020
13838
|
}
|
|
13021
|
-
|
|
13839
|
+
watch32(
|
|
13022
13840
|
() => props.result,
|
|
13023
13841
|
(value) => {
|
|
13024
13842
|
if (value && (value.total || value.success || value.failed || value.errors && value.errors.length)) {
|
|
@@ -13039,7 +13857,7 @@ var import_wizard_default = {
|
|
|
13039
13857
|
emit("retry");
|
|
13040
13858
|
goStep(2);
|
|
13041
13859
|
}
|
|
13042
|
-
const stats =
|
|
13860
|
+
const stats = computed28(() => {
|
|
13043
13861
|
const data = props.result || {};
|
|
13044
13862
|
return {
|
|
13045
13863
|
total: data.total || 0,
|
|
@@ -13185,7 +14003,7 @@ var import_wizard_default = {
|
|
|
13185
14003
|
};
|
|
13186
14004
|
|
|
13187
14005
|
// src/components/diff/index.js
|
|
13188
|
-
import { ref as
|
|
14006
|
+
import { ref as ref42, computed as computed29 } from "vue";
|
|
13189
14007
|
|
|
13190
14008
|
// src/utils/text-diff.js
|
|
13191
14009
|
var MAX_CELLS = 1e6;
|
|
@@ -13249,8 +14067,8 @@ var diff_default = {
|
|
|
13249
14067
|
afterLabel: { type: String, default: "" }
|
|
13250
14068
|
},
|
|
13251
14069
|
setup(props) {
|
|
13252
|
-
const rows =
|
|
13253
|
-
const stats =
|
|
14070
|
+
const rows = computed29(() => diffLines(props.before, props.after));
|
|
14071
|
+
const stats = computed29(() => {
|
|
13254
14072
|
let add = 0;
|
|
13255
14073
|
let remove = 0;
|
|
13256
14074
|
rows.value.forEach((row) => {
|
|
@@ -13259,11 +14077,11 @@ var diff_default = {
|
|
|
13259
14077
|
});
|
|
13260
14078
|
return { add, remove };
|
|
13261
14079
|
});
|
|
13262
|
-
const expandedBlocks =
|
|
14080
|
+
const expandedBlocks = ref42([]);
|
|
13263
14081
|
function expand(index) {
|
|
13264
14082
|
expandedBlocks.value = expandedBlocks.value.concat(index);
|
|
13265
14083
|
}
|
|
13266
|
-
const displayRows =
|
|
14084
|
+
const displayRows = computed29(() => {
|
|
13267
14085
|
const ctx = Math.max(0, props.context);
|
|
13268
14086
|
const list = rows.value;
|
|
13269
14087
|
if (!ctx) return list;
|
|
@@ -13294,7 +14112,7 @@ var diff_default = {
|
|
|
13294
14112
|
}
|
|
13295
14113
|
return out;
|
|
13296
14114
|
});
|
|
13297
|
-
const splitRows =
|
|
14115
|
+
const splitRows = computed29(() => {
|
|
13298
14116
|
const list = displayRows.value;
|
|
13299
14117
|
const out = [];
|
|
13300
14118
|
let i = 0;
|
|
@@ -13319,8 +14137,8 @@ var diff_default = {
|
|
|
13319
14137
|
}
|
|
13320
14138
|
return out;
|
|
13321
14139
|
});
|
|
13322
|
-
const beforeLabelText =
|
|
13323
|
-
const afterLabelText =
|
|
14140
|
+
const beforeLabelText = computed29(() => props.beforeLabel || t("diff.before"));
|
|
14141
|
+
const afterLabelText = computed29(() => props.afterLabel || t("diff.after"));
|
|
13324
14142
|
return {
|
|
13325
14143
|
stats,
|
|
13326
14144
|
displayRows,
|
|
@@ -13386,7 +14204,7 @@ var diff_default = {
|
|
|
13386
14204
|
};
|
|
13387
14205
|
|
|
13388
14206
|
// src/components/tree-table/index.js
|
|
13389
|
-
import { ref as
|
|
14207
|
+
import { ref as ref43, computed as computed30, watch as watch33 } from "vue";
|
|
13390
14208
|
function keyOf(row, rowKey) {
|
|
13391
14209
|
return row && row[rowKey] !== void 0 ? row[rowKey] : row && row.id;
|
|
13392
14210
|
}
|
|
@@ -13425,23 +14243,23 @@ var tree_table_default = {
|
|
|
13425
14243
|
eachNode(props.data, (row) => keys.push(keyOf(row, props.rowKey)));
|
|
13426
14244
|
return keys;
|
|
13427
14245
|
}
|
|
13428
|
-
const innerExpanded =
|
|
14246
|
+
const innerExpanded = ref43(
|
|
13429
14247
|
props.expandedKeys ? props.expandedKeys.slice() : props.defaultExpandAll ? allKeys() : []
|
|
13430
14248
|
);
|
|
13431
|
-
|
|
14249
|
+
watch33(
|
|
13432
14250
|
() => props.expandedKeys,
|
|
13433
14251
|
(value) => {
|
|
13434
14252
|
if (value) innerExpanded.value = value.slice();
|
|
13435
14253
|
}
|
|
13436
14254
|
);
|
|
13437
|
-
const innerChecked =
|
|
13438
|
-
|
|
14255
|
+
const innerChecked = ref43(props.checkedKeys ? props.checkedKeys.slice() : []);
|
|
14256
|
+
watch33(
|
|
13439
14257
|
() => props.checkedKeys,
|
|
13440
14258
|
(value) => {
|
|
13441
14259
|
if (value) innerChecked.value = value.slice();
|
|
13442
14260
|
}
|
|
13443
14261
|
);
|
|
13444
|
-
const rows =
|
|
14262
|
+
const rows = computed30(() => {
|
|
13445
14263
|
const out = [];
|
|
13446
14264
|
function walk(list, level, parentKey) {
|
|
13447
14265
|
;
|
|
@@ -13456,7 +14274,7 @@ var tree_table_default = {
|
|
|
13456
14274
|
walk(props.data, 1, null);
|
|
13457
14275
|
return out;
|
|
13458
14276
|
});
|
|
13459
|
-
const descendantMap =
|
|
14277
|
+
const descendantMap = computed30(() => {
|
|
13460
14278
|
const map = {};
|
|
13461
14279
|
function collect(row) {
|
|
13462
14280
|
const key = keyOf(row, props.rowKey);
|
|
@@ -13471,16 +14289,16 @@ var tree_table_default = {
|
|
|
13471
14289
|
(props.data || []).forEach(collect);
|
|
13472
14290
|
return map;
|
|
13473
14291
|
});
|
|
13474
|
-
const leafKeys =
|
|
14292
|
+
const leafKeys = computed30(() => {
|
|
13475
14293
|
const keys = [];
|
|
13476
14294
|
eachNode(props.data, (row) => {
|
|
13477
14295
|
if (!row.children || !row.children.length) keys.push(keyOf(row, props.rowKey));
|
|
13478
14296
|
});
|
|
13479
14297
|
return keys;
|
|
13480
14298
|
});
|
|
13481
|
-
const checkedSet =
|
|
13482
|
-
const allChecked =
|
|
13483
|
-
const someChecked =
|
|
14299
|
+
const checkedSet = computed30(() => new Set(innerChecked.value));
|
|
14300
|
+
const allChecked = computed30(() => leafKeys.value.length > 0 && leafKeys.value.every((key) => checkedSet.value.has(key)));
|
|
14301
|
+
const someChecked = computed30(() => !allChecked.value && leafKeys.value.some((key) => checkedSet.value.has(key)));
|
|
13484
14302
|
function isIndeterminate(row) {
|
|
13485
14303
|
if (!props.selectable || props.checkStrictly) return false;
|
|
13486
14304
|
const desc = descendantMap.value[keyOf(row, props.rowKey)] || [];
|
|
@@ -13514,7 +14332,7 @@ var tree_table_default = {
|
|
|
13514
14332
|
}
|
|
13515
14333
|
emitChecked(Array.from(set));
|
|
13516
14334
|
}
|
|
13517
|
-
const nodeMap =
|
|
14335
|
+
const nodeMap = computed30(() => {
|
|
13518
14336
|
const map = {};
|
|
13519
14337
|
eachNode(props.data, (row, level, parentKey) => {
|
|
13520
14338
|
map[keyOf(row, props.rowKey)] = { row, parentKey };
|
|
@@ -13561,11 +14379,11 @@ var tree_table_default = {
|
|
|
13561
14379
|
function onRowClick(item) {
|
|
13562
14380
|
emit("row-click", item.row, item);
|
|
13563
14381
|
}
|
|
13564
|
-
const scrollStyle =
|
|
14382
|
+
const scrollStyle = computed30(() => {
|
|
13565
14383
|
if (!props.maxHeight) return null;
|
|
13566
14384
|
return { maxHeight: typeof props.maxHeight === "number" ? props.maxHeight + "px" : props.maxHeight };
|
|
13567
14385
|
});
|
|
13568
|
-
const emptyLabel =
|
|
14386
|
+
const emptyLabel = computed30(() => props.emptyText || t("treeTable.empty"));
|
|
13569
14387
|
return {
|
|
13570
14388
|
rows,
|
|
13571
14389
|
innerExpanded,
|
|
@@ -13667,7 +14485,7 @@ var tree_table_default = {
|
|
|
13667
14485
|
};
|
|
13668
14486
|
|
|
13669
14487
|
// src/components/schedule/index.js
|
|
13670
|
-
import { ref as
|
|
14488
|
+
import { ref as ref44, computed as computed31, watch as watch34, onBeforeUnmount as onBeforeUnmount31 } from "vue";
|
|
13671
14489
|
var pad5 = (value) => String(value).padStart(2, "0");
|
|
13672
14490
|
function toKey3(date) {
|
|
13673
14491
|
return `${date.getFullYear()}-${pad5(date.getMonth() + 1)}-${pad5(date.getDate())}`;
|
|
@@ -13699,13 +14517,13 @@ var schedule_default = {
|
|
|
13699
14517
|
emits: ["update:modelValue", "event-click", "slot-click", "week-change"],
|
|
13700
14518
|
setup(props, { emit }) {
|
|
13701
14519
|
const todayKey = toKey3(/* @__PURE__ */ new Date());
|
|
13702
|
-
const nowMinutes =
|
|
14520
|
+
const nowMinutes = ref44((/* @__PURE__ */ new Date()).getHours() * 60 + (/* @__PURE__ */ new Date()).getMinutes());
|
|
13703
14521
|
const timer = window.setInterval(() => {
|
|
13704
14522
|
const now = /* @__PURE__ */ new Date();
|
|
13705
14523
|
nowMinutes.value = now.getHours() * 60 + now.getMinutes();
|
|
13706
14524
|
}, 6e4);
|
|
13707
|
-
const anchor =
|
|
13708
|
-
|
|
14525
|
+
const anchor = ref44(props.modelValue || todayKey);
|
|
14526
|
+
watch34(
|
|
13709
14527
|
() => props.modelValue,
|
|
13710
14528
|
(value) => {
|
|
13711
14529
|
if (value) anchor.value = value;
|
|
@@ -13717,8 +14535,8 @@ var schedule_default = {
|
|
|
13717
14535
|
const offset = (day + 6) % 7;
|
|
13718
14536
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate() - offset);
|
|
13719
14537
|
}
|
|
13720
|
-
const weekStartDate =
|
|
13721
|
-
const weekdays =
|
|
14538
|
+
const weekStartDate = computed31(() => startOfWeek(anchor.value));
|
|
14539
|
+
const weekdays = computed31(() => t("schedule.weekdays").split(","));
|
|
13722
14540
|
function layoutDay(list) {
|
|
13723
14541
|
const sorted = list.map((item) => {
|
|
13724
14542
|
const startMin = toMinutes(item.start, props.startHour * 60);
|
|
@@ -13751,7 +14569,7 @@ var schedule_default = {
|
|
|
13751
14569
|
};
|
|
13752
14570
|
});
|
|
13753
14571
|
}
|
|
13754
|
-
const days =
|
|
14572
|
+
const days = computed31(() => {
|
|
13755
14573
|
const start = weekStartDate.value;
|
|
13756
14574
|
const list = Array.from({ length: 7 }, (_, index) => {
|
|
13757
14575
|
const date = new Date(start.getFullYear(), start.getMonth(), start.getDate() + index);
|
|
@@ -13769,20 +14587,20 @@ var schedule_default = {
|
|
|
13769
14587
|
});
|
|
13770
14588
|
return props.showWeekend ? list : list.slice(0, 5);
|
|
13771
14589
|
});
|
|
13772
|
-
const hours =
|
|
14590
|
+
const hours = computed31(() => {
|
|
13773
14591
|
const list = [];
|
|
13774
14592
|
for (let hour = props.startHour; hour < props.endHour; hour++) list.push(hour);
|
|
13775
14593
|
return list;
|
|
13776
14594
|
});
|
|
13777
|
-
const bodyHeight =
|
|
13778
|
-
const gridStyle =
|
|
14595
|
+
const bodyHeight = computed31(() => (props.endHour - props.startHour) * props.hourHeight);
|
|
14596
|
+
const gridStyle = computed31(() => ({
|
|
13779
14597
|
gridTemplateColumns: "56px repeat(" + Math.max(1, days.value.length) + ", minmax(0, 1fr))"
|
|
13780
14598
|
}));
|
|
13781
|
-
const nowTop =
|
|
13782
|
-
const showNowLine =
|
|
14599
|
+
const nowTop = computed31(() => (nowMinutes.value - props.startHour * 60) / 60 * props.hourHeight);
|
|
14600
|
+
const showNowLine = computed31(
|
|
13783
14601
|
() => nowMinutes.value >= props.startHour * 60 && nowMinutes.value <= props.endHour * 60 && days.value.some((day) => day.today)
|
|
13784
14602
|
);
|
|
13785
|
-
const rangeLabel =
|
|
14603
|
+
const rangeLabel = computed31(() => {
|
|
13786
14604
|
const list = days.value;
|
|
13787
14605
|
if (!list.length) return "";
|
|
13788
14606
|
const first = list[0];
|
|
@@ -13812,7 +14630,7 @@ var schedule_default = {
|
|
|
13812
14630
|
const minute = minutes % 60;
|
|
13813
14631
|
emit("slot-click", { date: day.key, time: `${pad5(hour)}:${pad5(minute)}` });
|
|
13814
14632
|
}
|
|
13815
|
-
|
|
14633
|
+
onBeforeUnmount31(() => window.clearInterval(timer));
|
|
13816
14634
|
return {
|
|
13817
14635
|
days,
|
|
13818
14636
|
hours,
|
|
@@ -13912,7 +14730,7 @@ var schedule_default = {
|
|
|
13912
14730
|
};
|
|
13913
14731
|
|
|
13914
14732
|
// src/components/comment/index.js
|
|
13915
|
-
import { ref as
|
|
14733
|
+
import { ref as ref45, computed as computed32 } from "vue";
|
|
13916
14734
|
var comment_default = {
|
|
13917
14735
|
name: "DjmComment",
|
|
13918
14736
|
components: { DjmAvatar: avatar_default, DjmIcon: icon_default },
|
|
@@ -13929,16 +14747,16 @@ var comment_default = {
|
|
|
13929
14747
|
},
|
|
13930
14748
|
emits: ["submit", "reply", "remove"],
|
|
13931
14749
|
setup(props, { emit }) {
|
|
13932
|
-
const content =
|
|
13933
|
-
const replyTarget =
|
|
13934
|
-
const placeholderText =
|
|
14750
|
+
const content = ref45("");
|
|
14751
|
+
const replyTarget = ref45(null);
|
|
14752
|
+
const placeholderText = computed32(() => {
|
|
13935
14753
|
if (replyTarget.value) return t("comment.replyPlaceholder", { name: replyTarget.value.author });
|
|
13936
14754
|
return props.placeholder || t("comment.placeholder");
|
|
13937
14755
|
});
|
|
13938
|
-
const submitLabel =
|
|
13939
|
-
const emptyLabel =
|
|
13940
|
-
const overLimit =
|
|
13941
|
-
const canSubmit =
|
|
14756
|
+
const submitLabel = computed32(() => props.submitText || t("comment.submit"));
|
|
14757
|
+
const emptyLabel = computed32(() => props.emptyText || t("comment.empty"));
|
|
14758
|
+
const overLimit = computed32(() => content.value.length > props.maxLength);
|
|
14759
|
+
const canSubmit = computed32(() => content.value.trim().length > 0 && !overLimit.value && !props.disabled && !props.loading);
|
|
13942
14760
|
function onInput(event) {
|
|
13943
14761
|
content.value = event.target.value;
|
|
13944
14762
|
}
|
|
@@ -14043,7 +14861,7 @@ var comment_default = {
|
|
|
14043
14861
|
};
|
|
14044
14862
|
|
|
14045
14863
|
// src/components/signature/index.js
|
|
14046
|
-
import { ref as
|
|
14864
|
+
import { ref as ref46, onMounted as onMounted17, onBeforeUnmount as onBeforeUnmount32, watch as watch35 } from "vue";
|
|
14047
14865
|
var signature_default = {
|
|
14048
14866
|
name: "DjmSignature",
|
|
14049
14867
|
props: {
|
|
@@ -14057,10 +14875,10 @@ var signature_default = {
|
|
|
14057
14875
|
},
|
|
14058
14876
|
emits: ["update:modelValue", "change", "start", "end", "clear"],
|
|
14059
14877
|
setup(props, { emit }) {
|
|
14060
|
-
const canvas =
|
|
14061
|
-
const root =
|
|
14062
|
-
const strokes =
|
|
14063
|
-
const hasImage =
|
|
14878
|
+
const canvas = ref46(null);
|
|
14879
|
+
const root = ref46(null);
|
|
14880
|
+
const strokes = ref46([]);
|
|
14881
|
+
const hasImage = ref46(false);
|
|
14064
14882
|
let imageCache = null;
|
|
14065
14883
|
let drawing = false;
|
|
14066
14884
|
let current = null;
|
|
@@ -14175,7 +14993,7 @@ var signature_default = {
|
|
|
14175
14993
|
return canvas.value ? canvas.value.toDataURL("image/png") : "";
|
|
14176
14994
|
}
|
|
14177
14995
|
const isEmpty2 = () => strokes.value.length === 0 && !hasImage.value;
|
|
14178
|
-
|
|
14996
|
+
watch35(
|
|
14179
14997
|
() => props.modelValue,
|
|
14180
14998
|
(value) => {
|
|
14181
14999
|
if (value === lastEmitted) return;
|
|
@@ -14213,7 +15031,7 @@ var signature_default = {
|
|
|
14213
15031
|
if (root.value) observer.observe(root.value);
|
|
14214
15032
|
}
|
|
14215
15033
|
});
|
|
14216
|
-
|
|
15034
|
+
onBeforeUnmount32(() => {
|
|
14217
15035
|
if (observer) observer.disconnect();
|
|
14218
15036
|
});
|
|
14219
15037
|
return {
|
|
@@ -14253,7 +15071,7 @@ var signature_default = {
|
|
|
14253
15071
|
};
|
|
14254
15072
|
|
|
14255
15073
|
// src/components/print/index.js
|
|
14256
|
-
import { ref as
|
|
15074
|
+
import { ref as ref47, computed as computed33 } from "vue";
|
|
14257
15075
|
function escapeHtml(text) {
|
|
14258
15076
|
return String(text).replace(/[&<>"]/g, (ch) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[ch]);
|
|
14259
15077
|
}
|
|
@@ -14269,8 +15087,8 @@ var print_default = {
|
|
|
14269
15087
|
},
|
|
14270
15088
|
emits: ["before-print", "after-print"],
|
|
14271
15089
|
setup(props, { emit }) {
|
|
14272
|
-
const content =
|
|
14273
|
-
const label =
|
|
15090
|
+
const content = ref47(null);
|
|
15091
|
+
const label = computed33(() => props.buttonText || t("print.button"));
|
|
14274
15092
|
function collectStyles() {
|
|
14275
15093
|
return Array.from(document.querySelectorAll('link[rel="stylesheet"], style')).map((el) => el.outerHTML).join("");
|
|
14276
15094
|
}
|
|
@@ -14319,7 +15137,7 @@ var print_default = {
|
|
|
14319
15137
|
};
|
|
14320
15138
|
|
|
14321
15139
|
// src/components/gantt/index.js
|
|
14322
|
-
import { computed as
|
|
15140
|
+
import { computed as computed34 } from "vue";
|
|
14323
15141
|
var DAY = 864e5;
|
|
14324
15142
|
var pad6 = (value) => String(value).padStart(2, "0");
|
|
14325
15143
|
function parseDate3(value) {
|
|
@@ -14355,7 +15173,7 @@ var gantt_default = {
|
|
|
14355
15173
|
emits: ["task-click"],
|
|
14356
15174
|
setup(props, { emit }) {
|
|
14357
15175
|
const todayKey = toKey4(/* @__PURE__ */ new Date());
|
|
14358
|
-
const range =
|
|
15176
|
+
const range = computed34(() => {
|
|
14359
15177
|
const starts = props.tasks.map((task) => task.start).filter(Boolean).sort();
|
|
14360
15178
|
const ends = props.tasks.map((task) => task.end || task.start).filter(Boolean).sort();
|
|
14361
15179
|
let start = props.startDate || starts[0] || todayKey;
|
|
@@ -14368,7 +15186,7 @@ var gantt_default = {
|
|
|
14368
15186
|
}
|
|
14369
15187
|
return { start, end };
|
|
14370
15188
|
});
|
|
14371
|
-
const days =
|
|
15189
|
+
const days = computed34(() => {
|
|
14372
15190
|
const total = dayDiff(range.value.end, range.value.start) + 1;
|
|
14373
15191
|
const base = parseDate3(range.value.start);
|
|
14374
15192
|
return Array.from({ length: total }, (_, index) => {
|
|
@@ -14385,9 +15203,9 @@ var gantt_default = {
|
|
|
14385
15203
|
};
|
|
14386
15204
|
});
|
|
14387
15205
|
});
|
|
14388
|
-
const trackWidth =
|
|
14389
|
-
const innerWidth =
|
|
14390
|
-
const bars =
|
|
15206
|
+
const trackWidth = computed34(() => days.value.length * props.dayWidth);
|
|
15207
|
+
const innerWidth = computed34(() => props.nameWidth + trackWidth.value);
|
|
15208
|
+
const bars = computed34(
|
|
14391
15209
|
() => props.tasks.map((task, index) => {
|
|
14392
15210
|
const start = task.start || range.value.start;
|
|
14393
15211
|
const end = task.end || start;
|
|
@@ -14403,12 +15221,12 @@ var gantt_default = {
|
|
|
14403
15221
|
};
|
|
14404
15222
|
})
|
|
14405
15223
|
);
|
|
14406
|
-
const todayLeft =
|
|
15224
|
+
const todayLeft = computed34(() => {
|
|
14407
15225
|
const index = days.value.findIndex((day) => day.today);
|
|
14408
15226
|
if (index === -1) return null;
|
|
14409
15227
|
return props.nameWidth + index * props.dayWidth + props.dayWidth / 2;
|
|
14410
15228
|
});
|
|
14411
|
-
const emptyLabel =
|
|
15229
|
+
const emptyLabel = computed34(() => props.emptyText || t("gantt.empty"));
|
|
14412
15230
|
function onClick(bar) {
|
|
14413
15231
|
emit("task-click", bar.task);
|
|
14414
15232
|
}
|
|
@@ -14490,7 +15308,7 @@ var gantt_default = {
|
|
|
14490
15308
|
};
|
|
14491
15309
|
|
|
14492
15310
|
// src/components/field-list/index.js
|
|
14493
|
-
import { ref as
|
|
15311
|
+
import { ref as ref48, computed as computed35, watch as watch36 } from "vue";
|
|
14494
15312
|
var uidSeed8 = 0;
|
|
14495
15313
|
var field_list_default = {
|
|
14496
15314
|
name: "DjmFieldList",
|
|
@@ -14510,7 +15328,7 @@ var field_list_default = {
|
|
|
14510
15328
|
},
|
|
14511
15329
|
emits: ["update:modelValue", "add", "remove", "change"],
|
|
14512
15330
|
setup(props, { emit }) {
|
|
14513
|
-
const uids =
|
|
15331
|
+
const uids = ref48([]);
|
|
14514
15332
|
function syncUids() {
|
|
14515
15333
|
const length = props.modelValue.length;
|
|
14516
15334
|
if (uids.value.length === length) return;
|
|
@@ -14519,12 +15337,12 @@ var field_list_default = {
|
|
|
14519
15337
|
uids.value = next;
|
|
14520
15338
|
}
|
|
14521
15339
|
syncUids();
|
|
14522
|
-
|
|
14523
|
-
const errors =
|
|
14524
|
-
const addLabel =
|
|
14525
|
-
const emptyLabel =
|
|
14526
|
-
const canAdd =
|
|
14527
|
-
const canRemove =
|
|
15340
|
+
watch36(() => props.modelValue.length, syncUids);
|
|
15341
|
+
const errors = ref48({});
|
|
15342
|
+
const addLabel = computed35(() => props.addText || t("fieldList.add"));
|
|
15343
|
+
const emptyLabel = computed35(() => props.emptyText || t("fieldList.empty"));
|
|
15344
|
+
const canAdd = computed35(() => !props.disabled && (!props.max || props.modelValue.length < props.max));
|
|
15345
|
+
const canRemove = computed35(() => !props.disabled && props.modelValue.length > props.min);
|
|
14528
15346
|
function commit(list) {
|
|
14529
15347
|
emit("update:modelValue", list);
|
|
14530
15348
|
emit("change", list);
|
|
@@ -14686,7 +15504,7 @@ var field_list_default = {
|
|
|
14686
15504
|
};
|
|
14687
15505
|
|
|
14688
15506
|
// src/components/chat/index.js
|
|
14689
|
-
import { ref as
|
|
15507
|
+
import { ref as ref49, computed as computed36, watch as watch37, nextTick as nextTick15 } from "vue";
|
|
14690
15508
|
var chat_default = {
|
|
14691
15509
|
name: "DjmChat",
|
|
14692
15510
|
components: { DjmAvatar: avatar_default },
|
|
@@ -14703,17 +15521,17 @@ var chat_default = {
|
|
|
14703
15521
|
},
|
|
14704
15522
|
emits: ["submit"],
|
|
14705
15523
|
setup(props, { emit }) {
|
|
14706
|
-
const content =
|
|
14707
|
-
const listRef =
|
|
14708
|
-
const placeholderText =
|
|
14709
|
-
const sendLabel =
|
|
14710
|
-
const emptyLabel =
|
|
14711
|
-
const canSend =
|
|
15524
|
+
const content = ref49("");
|
|
15525
|
+
const listRef = ref49(null);
|
|
15526
|
+
const placeholderText = computed36(() => props.placeholder || t("chat.placeholder"));
|
|
15527
|
+
const sendLabel = computed36(() => props.sendText || t("chat.send"));
|
|
15528
|
+
const emptyLabel = computed36(() => props.emptyText || t("chat.empty"));
|
|
15529
|
+
const canSend = computed36(() => content.value.trim().length > 0 && !props.disabled && !props.loading);
|
|
14712
15530
|
function scrollToBottom() {
|
|
14713
15531
|
const el = listRef.value;
|
|
14714
15532
|
if (el) el.scrollTop = el.scrollHeight;
|
|
14715
15533
|
}
|
|
14716
|
-
|
|
15534
|
+
watch37(
|
|
14717
15535
|
() => props.messages.length,
|
|
14718
15536
|
() => nextTick15(scrollToBottom)
|
|
14719
15537
|
);
|
|
@@ -14826,7 +15644,7 @@ var chat_default = {
|
|
|
14826
15644
|
};
|
|
14827
15645
|
|
|
14828
15646
|
// src/components/org-chart/index.js
|
|
14829
|
-
import { ref as
|
|
15647
|
+
import { ref as ref50, computed as computed37, watch as watch38 } from "vue";
|
|
14830
15648
|
var org_chart_default = {
|
|
14831
15649
|
name: "DjmOrgChart",
|
|
14832
15650
|
components: { DjmAvatar: avatar_default, DjmIcon: icon_default },
|
|
@@ -14859,11 +15677,11 @@ var org_chart_default = {
|
|
|
14859
15677
|
walk(node);
|
|
14860
15678
|
return keys;
|
|
14861
15679
|
}
|
|
14862
|
-
const collapsed =
|
|
14863
|
-
|
|
15680
|
+
const collapsed = ref50(props.defaultExpandAll ? [] : collapsedByDefault(props.data));
|
|
15681
|
+
watch38(() => props.data, (data) => {
|
|
14864
15682
|
collapsed.value = props.defaultExpandAll ? [] : collapsedByDefault(data);
|
|
14865
15683
|
});
|
|
14866
|
-
const layout =
|
|
15684
|
+
const layout = computed37(() => {
|
|
14867
15685
|
if (!props.data) return { nodes: [], links: [], width: 0, height: 0 };
|
|
14868
15686
|
const rowH = props.nodeHeight + props.verticalGap;
|
|
14869
15687
|
let cursor = 0;
|
|
@@ -14928,7 +15746,7 @@ var org_chart_default = {
|
|
|
14928
15746
|
function onClick(item) {
|
|
14929
15747
|
emit("node-click", item.node);
|
|
14930
15748
|
}
|
|
14931
|
-
const emptyLabel =
|
|
15749
|
+
const emptyLabel = computed37(() => props.emptyText || t("orgChart.empty"));
|
|
14932
15750
|
return {
|
|
14933
15751
|
layout,
|
|
14934
15752
|
toggle,
|
|
@@ -14989,7 +15807,7 @@ var org_chart_default = {
|
|
|
14989
15807
|
};
|
|
14990
15808
|
|
|
14991
15809
|
// src/components/page-tabs/index.js
|
|
14992
|
-
import { computed as
|
|
15810
|
+
import { computed as computed38 } from "vue";
|
|
14993
15811
|
var page_tabs_default = {
|
|
14994
15812
|
name: "DjmPageTabs",
|
|
14995
15813
|
components: { DjmIcon: icon_default },
|
|
@@ -15000,7 +15818,7 @@ var page_tabs_default = {
|
|
|
15000
15818
|
},
|
|
15001
15819
|
emits: ["update:modelValue", "change", "close"],
|
|
15002
15820
|
setup(props, { emit }) {
|
|
15003
|
-
const label =
|
|
15821
|
+
const label = computed38(() => t("pageTabs.label"));
|
|
15004
15822
|
function canClose(tab) {
|
|
15005
15823
|
return tab.closable === void 0 ? props.closable : tab.closable;
|
|
15006
15824
|
}
|
|
@@ -15253,7 +16071,7 @@ var components = [
|
|
|
15253
16071
|
org_chart_default,
|
|
15254
16072
|
page_tabs_default
|
|
15255
16073
|
];
|
|
15256
|
-
var version = "0.
|
|
16074
|
+
var version = "0.73.0";
|
|
15257
16075
|
function install(app, options = {}) {
|
|
15258
16076
|
if (options.locale) setLocale(options.locale);
|
|
15259
16077
|
components.forEach((component) => app.component(component.name, component));
|
|
@@ -15375,6 +16193,7 @@ export {
|
|
|
15375
16193
|
djmMessage,
|
|
15376
16194
|
djmMessages,
|
|
15377
16195
|
getLocale,
|
|
16196
|
+
glass,
|
|
15378
16197
|
hasPermission,
|
|
15379
16198
|
initTheme,
|
|
15380
16199
|
install,
|
|
@@ -15384,6 +16203,7 @@ export {
|
|
|
15384
16203
|
primaryColor,
|
|
15385
16204
|
resetPrimaryColor,
|
|
15386
16205
|
sanitizeHtml,
|
|
16206
|
+
setGlass,
|
|
15387
16207
|
setLocale,
|
|
15388
16208
|
setPermissions,
|
|
15389
16209
|
setPrimaryColor,
|