@jetlinks-web/components 2.0.37 → 2.1.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.
Files changed (74) hide show
  1. package/es/CardSelect/style/index.js +1 -0
  2. package/es/CheckButton/style/index.js +1 -0
  3. package/es/DragModal/DragModal.js +307 -0
  4. package/es/DragModal/index.js +5 -0
  5. package/es/DragModal/style/index.css +81 -0
  6. package/es/DragModal/style/index.js +1 -0
  7. package/es/DragModal/style/index.less +96 -0
  8. package/es/EditTable/Body.js +368 -0
  9. package/es/EditTable/EditTable.js +412 -0
  10. package/es/EditTable/Header.js +242 -0
  11. package/es/EditTable/components/ContextMenu/Menu.js +154 -0
  12. package/es/EditTable/components/ContextMenu/index.js +81 -0
  13. package/es/EditTable/components/Search/Search.js +290 -0
  14. package/es/EditTable/components/Search/index.js +1 -0
  15. package/es/EditTable/consts.js +7 -0
  16. package/es/EditTable/hooks/index.js +40 -0
  17. package/es/EditTable/hooks/useResizeObserver.js +31 -0
  18. package/es/EditTable/hooks/useValidate.js +87 -0
  19. package/es/EditTable/index.js +9 -0
  20. package/es/EditTable/props.js +50 -0
  21. package/es/EditTable/style/body.less +76 -0
  22. package/es/EditTable/style/header.less +77 -0
  23. package/es/EditTable/style/index.css +214 -0
  24. package/es/EditTable/style/index.js +1 -0
  25. package/es/EditTable/style/index.less +38 -0
  26. package/es/EditTable/style/table.less +42 -0
  27. package/es/EditTable/utils.js +97 -0
  28. package/es/Ellipsis/style/index.js +1 -0
  29. package/es/FullPage/FullPage.js +1 -1
  30. package/es/Search/Advanced/SaveHistory.js +1 -1
  31. package/es/Search/Item.js +1 -1
  32. package/es/Search/Search.js +1 -1
  33. package/es/components.js +3 -1
  34. package/es/style/index.css +287 -0
  35. package/es/style/index.less +9 -7
  36. package/es/style.js +3 -1
  37. package/lib/CardSelect/style/index.js +3 -0
  38. package/lib/CheckButton/style/index.js +3 -0
  39. package/lib/DragModal/DragModal.js +307 -0
  40. package/lib/DragModal/index.js +12 -0
  41. package/lib/DragModal/style/index.css +81 -0
  42. package/lib/DragModal/style/index.js +3 -0
  43. package/lib/DragModal/style/index.less +96 -0
  44. package/lib/EditTable/Body.js +368 -0
  45. package/lib/EditTable/EditTable.js +412 -0
  46. package/lib/EditTable/Header.js +242 -0
  47. package/lib/EditTable/components/ContextMenu/Menu.js +154 -0
  48. package/lib/EditTable/components/ContextMenu/index.js +88 -0
  49. package/lib/EditTable/components/Search/Search.js +290 -0
  50. package/lib/EditTable/components/Search/index.js +13 -0
  51. package/lib/EditTable/consts.js +13 -0
  52. package/lib/EditTable/hooks/index.js +79 -0
  53. package/lib/EditTable/hooks/useResizeObserver.js +38 -0
  54. package/lib/EditTable/hooks/useValidate.js +94 -0
  55. package/lib/EditTable/index.js +16 -0
  56. package/lib/EditTable/props.js +56 -0
  57. package/lib/EditTable/style/body.less +76 -0
  58. package/lib/EditTable/style/header.less +77 -0
  59. package/lib/EditTable/style/index.css +214 -0
  60. package/lib/EditTable/style/index.js +3 -0
  61. package/lib/EditTable/style/index.less +38 -0
  62. package/lib/EditTable/style/table.less +42 -0
  63. package/lib/EditTable/utils.js +104 -0
  64. package/lib/Ellipsis/style/index.js +3 -0
  65. package/lib/FullPage/FullPage.js +1 -1
  66. package/lib/Search/Advanced/SaveHistory.js +1 -1
  67. package/lib/Search/Item.js +1 -1
  68. package/lib/Search/Search.js +1 -1
  69. package/lib/components.js +14 -0
  70. package/lib/style/components.less +2 -0
  71. package/lib/style/index.css +287 -0
  72. package/lib/style/index.less +9 -7
  73. package/lib/style.js +3 -1
  74. package/package.json +3 -1
@@ -21,7 +21,7 @@
21
21
  } */
22
22
  import { defineComponent as _defineComponent } from 'vue';
23
23
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
24
- const _withScopeId = n => (_pushScopeId("data-v-1720601920280"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1722997808659"), n = n(), _popScopeId(), n);
25
25
  const _hoisted_1 = {
26
26
  key: 0,
27
27
  style: { "width": "240px" }
package/es/Search/Item.js CHANGED
@@ -78,7 +78,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
78
78
  } */
79
79
  import { defineComponent as _defineComponent } from 'vue';
80
80
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
81
- const _withScopeId = n => (_pushScopeId("data-v-1720601919690"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1722997808112"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,
@@ -36,7 +36,7 @@
36
36
  } */
37
37
  import { defineComponent as _defineComponent } from 'vue';
38
38
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, unref as _unref, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
39
- const _withScopeId = n => (_pushScopeId("data-v-1720601919810"), n = n(), _popScopeId(), n);
39
+ const _withScopeId = n => (_pushScopeId("data-v-1722997808265"), n = n(), _popScopeId(), n);
40
40
  const _hoisted_1 = { class: "JSearch-content simple" };
41
41
  const _hoisted_2 = { class: "JSearch-items" };
42
42
  import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
package/es/components.js CHANGED
@@ -15,4 +15,6 @@ export { default as ProTable } from './ProTable';
15
15
  export { default as Scrollbar } from './Scrollbar';
16
16
  export { default as Search, AdvancedSearch } from './Search';
17
17
  export { default as ValueItem } from './ValueItem';
18
- export { default as TimeFormat } from './TimeFormat';
18
+ export { default as TimeFormat } from './TimeFormat';
19
+ export { default as DragModal } from './DragModal';
20
+ export { default as EditTable } from './EditTable';
@@ -1319,3 +1319,290 @@ textarea.ant-pagination-options-quick-jumper input {
1319
1319
  .j-card-select .j-card-select-item .j-card-select-describe {
1320
1320
  color: #263237;
1321
1321
  }
1322
+ .dialog-enter-active,
1323
+ .dialog-leave-active {
1324
+ transition: opacity 0.5s;
1325
+ }
1326
+ .dialog-enter,
1327
+ .dialog-leave-to {
1328
+ opacity: 0;
1329
+ }
1330
+ .jetlinks-drag-modal {
1331
+ position: fixed;
1332
+ z-index: 1000;
1333
+ }
1334
+ .jetlinks-drag-modal .jetlinks-drag-modal-sprite {
1335
+ position: absolute;
1336
+ width: 100%;
1337
+ height: 100%;
1338
+ display: flex;
1339
+ flex-direction: column;
1340
+ overflow: hidden;
1341
+ z-index: 23456765435;
1342
+ background-color: #ffffff;
1343
+ border-radius: 4px;
1344
+ border: 1px solid #91CAFF;
1345
+ box-shadow: 0 3px 8px 0 rgba(22, 119, 255, 0.24);
1346
+ }
1347
+ .jetlinks-drag-modal .jetlinks-drag-modal-sprite .header {
1348
+ padding: 5px 15px;
1349
+ font-size: 18px;
1350
+ font-weight: 700;
1351
+ color: #333;
1352
+ display: flex;
1353
+ justify-content: space-between;
1354
+ align-items: center;
1355
+ border-bottom: 1px solid #f0f0f0;
1356
+ cursor: move;
1357
+ }
1358
+ .jetlinks-drag-modal .jetlinks-drag-modal-sprite .jetlinks-drag-modal-body {
1359
+ flex: 1;
1360
+ min-height: 0;
1361
+ overflow-y: auto;
1362
+ padding: 24px 20px;
1363
+ }
1364
+ .jetlinks-drag-modal .jetlinks-drag-modal-sprite .jetlinks-drag-modal-footer {
1365
+ border-top: 1px solid #f0f0f0;
1366
+ padding: 5px 15px;
1367
+ }
1368
+ .jetlinks-drag-modal .jetlinks-drag-modal-range {
1369
+ position: absolute;
1370
+ width: 16px;
1371
+ height: 16px;
1372
+ border-radius: 100%;
1373
+ z-index: 23456765436;
1374
+ }
1375
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-bottom-right:hover,
1376
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-top-left:hover {
1377
+ cursor: nwse-resize;
1378
+ }
1379
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-bottom-left:hover,
1380
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-top-right:hover {
1381
+ cursor: nesw-resize;
1382
+ }
1383
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-top-right {
1384
+ top: -6px;
1385
+ right: -6px;
1386
+ }
1387
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-top-left {
1388
+ top: -6px;
1389
+ left: -6px;
1390
+ }
1391
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-bottom-right {
1392
+ bottom: -6px;
1393
+ right: -6px;
1394
+ }
1395
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-bottom-left {
1396
+ bottom: -6px;
1397
+ left: -6px;
1398
+ }
1399
+ .jetlinks-edit-table-wrapper {
1400
+ background: #fff;
1401
+ height: 100%;
1402
+ position: relative;
1403
+ }
1404
+ .jetlinks-edit-table-wrapper.table-full-screen {
1405
+ padding: 24px;
1406
+ }
1407
+ .jetlinks-edit-table-wrapper .jetlinks-edit-table {
1408
+ display: flex;
1409
+ flex-direction: column;
1410
+ flex-grow: 0;
1411
+ flex-shrink: 0;
1412
+ }
1413
+ .jetlinks-edit-table-wrapper .jetlinks-edit-table .jetlinks-edit-table-header {
1414
+ overflow: hidden;
1415
+ width: 100%;
1416
+ position: relative;
1417
+ }
1418
+ .jetlinks-edit-table-wrapper .jetlinks-edit-table .jetlinks-edit-table-header .jetlinks-edit-table-header-scroll-hidden {
1419
+ position: absolute;
1420
+ top: 0;
1421
+ right: 0;
1422
+ bottom: 0;
1423
+ z-index: 5;
1424
+ background: #fafafa;
1425
+ }
1426
+ .jetlinks-edit-table-wrapper .jetlinks-edit-table .jetlinks-edit-table-body {
1427
+ background-color: #fff;
1428
+ overflow-y: hidden;
1429
+ position: relative;
1430
+ height: 100%;
1431
+ width: 100%;
1432
+ flex: 1 1 auto;
1433
+ flex-direction: row;
1434
+ }
1435
+ .jetlinks-edit-table-body-viewport {
1436
+ max-height: 100%;
1437
+ width: 100%;
1438
+ overflow: hidden auto;
1439
+ position: relative;
1440
+ }
1441
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-scrollbar {
1442
+ position: absolute;
1443
+ left: 0;
1444
+ top: 0;
1445
+ right: 0;
1446
+ z-index: -1;
1447
+ }
1448
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-body-container {
1449
+ display: flex;
1450
+ }
1451
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-center,
1452
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-left,
1453
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-right {
1454
+ position: relative;
1455
+ min-width: 0;
1456
+ height: 100%;
1457
+ z-index: 5;
1458
+ flex-shrink: 0;
1459
+ flex-grow: 0;
1460
+ }
1461
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-center .jetlinks-edit-table-row,
1462
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-left .jetlinks-edit-table-row,
1463
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-right .jetlinks-edit-table-row {
1464
+ width: 100%;
1465
+ display: flex;
1466
+ align-items: center;
1467
+ transition: top 0.2s, height 0.2s, background-color 0.1s;
1468
+ border-bottom: 1px solid #ebebeb;
1469
+ background-color: #fff;
1470
+ }
1471
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-center .jetlinks-edit-table-row.jetlinks-edit-table-row-hover,
1472
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-left .jetlinks-edit-table-row.jetlinks-edit-table-row-hover,
1473
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-right .jetlinks-edit-table-row.jetlinks-edit-table-row-hover {
1474
+ background-color: #f8f8f8;
1475
+ }
1476
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-center .jetlinks-edit-table-row.jetlinks-edit-table-row-selected,
1477
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-left .jetlinks-edit-table-row.jetlinks-edit-table-row-selected,
1478
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-right .jetlinks-edit-table-row.jetlinks-edit-table-row-selected {
1479
+ background-color: var(--ant-primary-1);
1480
+ }
1481
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-center .jetlinks-edit-table-row .jetlinks-edit-table-cell,
1482
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-left .jetlinks-edit-table-row .jetlinks-edit-table-cell,
1483
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-right .jetlinks-edit-table-row .jetlinks-edit-table-cell {
1484
+ min-width: 0;
1485
+ }
1486
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-center .jetlinks-edit-table-row .body-cell-box,
1487
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-left .jetlinks-edit-table-row .body-cell-box,
1488
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-right .jetlinks-edit-table-row .body-cell-box {
1489
+ padding: 0 12px;
1490
+ position: relative;
1491
+ }
1492
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-left {
1493
+ position: sticky;
1494
+ left: 0;
1495
+ }
1496
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-right {
1497
+ position: sticky;
1498
+ right: 0;
1499
+ }
1500
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-center {
1501
+ z-index: 1;
1502
+ }
1503
+ .jetlinks-edit-table-body-viewport .jetlinks-edit-table-center > div {
1504
+ position: relative;
1505
+ }
1506
+ .jetlinks-edit-table-body-empty {
1507
+ display: flex;
1508
+ width: 100%;
1509
+ justify-content: center;
1510
+ padding-top: 24px;
1511
+ }
1512
+ .jetlinks-edit-table-header-container {
1513
+ height: 100%;
1514
+ position: relative;
1515
+ display: flex;
1516
+ width: 100%;
1517
+ }
1518
+ .jetlinks-edit-table-header-container .jetlinks-header-left,
1519
+ .jetlinks-edit-table-header-container .jetlinks-header-center,
1520
+ .jetlinks-edit-table-header-container .jetlinks-header-right {
1521
+ position: relative;
1522
+ z-index: 5;
1523
+ min-width: 0;
1524
+ height: 100%;
1525
+ width: 100%;
1526
+ background: #fafafa;
1527
+ }
1528
+ .jetlinks-edit-table-header-container .jetlinks-header-center {
1529
+ z-index: 2;
1530
+ }
1531
+ .jetlinks-edit-table-header-container .jetlinks-header-center > div {
1532
+ position: relative;
1533
+ height: 100%;
1534
+ }
1535
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell {
1536
+ height: 100%;
1537
+ display: inline-flex;
1538
+ align-items: center;
1539
+ float: left;
1540
+ overflow: visible;
1541
+ background: #fafafa;
1542
+ }
1543
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box {
1544
+ padding: 0 12px;
1545
+ width: 100%;
1546
+ position: relative;
1547
+ }
1548
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box.header-cell-box-tool {
1549
+ display: flex;
1550
+ justify-content: space-between;
1551
+ align-items: center;
1552
+ }
1553
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .table-header-cell-title {
1554
+ flex: 1;
1555
+ display: flex;
1556
+ align-items: center;
1557
+ font-weight: 600;
1558
+ }
1559
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .header-cell-required {
1560
+ color: #ff4d4f;
1561
+ padding-left: 8px;
1562
+ transform: translateY(3px);
1563
+ font-weight: 500;
1564
+ }
1565
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box::before {
1566
+ position: absolute;
1567
+ top: 50%;
1568
+ right: 1px;
1569
+ width: 1px;
1570
+ height: 1.6em;
1571
+ pointer-events: none;
1572
+ background-color: rgba(0, 0, 0, 0.06);
1573
+ transform: translateY(-50%);
1574
+ transition: background-color 0.3s;
1575
+ content: "";
1576
+ }
1577
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box:not(:last-child)::before {
1578
+ background-color: transparent;
1579
+ }
1580
+ .edit-table-search-header {
1581
+ display: flex;
1582
+ justify-content: space-between;
1583
+ }
1584
+ .edit-table-search-result-total {
1585
+ color: #1890ff;
1586
+ }
1587
+ .jetlinks-edit-table-horizontal-scroll {
1588
+ height: 17px;
1589
+ width: 100%;
1590
+ display: flex;
1591
+ position: relative;
1592
+ z-index: 4;
1593
+ }
1594
+ .jetlinks-edit-table-horizontal-scroll .jetlinks-edit-table-horizontal-scroll-viewport {
1595
+ overflow-y: hidden;
1596
+ overflow-x: scroll;
1597
+ position: relative;
1598
+ flex: 1 1 0;
1599
+ height: 17px;
1600
+ width: 100%;
1601
+ }
1602
+ .jetlinks-edit-table-horizontal-scroll .jetlinks-edit-table-horizontal-scroll-viewport > div {
1603
+ height: 17px;
1604
+ }
1605
+ .jetlinks-edit-table-horizontal-scroll .jetlinks-edit-table-horizontal-scroll-hidden {
1606
+ height: 100%;
1607
+ overflow-x: hidden;
1608
+ }
@@ -1,7 +1,9 @@
1
- @import '../Ellipsis/style/index.less';
2
- @import '../CheckButton/style/index.less';
3
- @import '../ProLayout/style/style.less';
4
- @import '../ProTable/style/ProTable.less';
5
- @import '../Search/style/Search.less';
6
- @import '../Search/style/Item.less';
7
- @import '../CardSelect/style/index.less';
1
+ @import '../Ellipsis/style/index.less';
2
+ @import '../CheckButton/style/index.less';
3
+ @import '../ProLayout/style/style.less';
4
+ @import '../ProTable/style/ProTable.less';
5
+ @import '../Search/style/Search.less';
6
+ @import '../Search/style/Item.less';
7
+ @import '../CardSelect/style/index.less';
8
+ @import '../DragModal/style/index.less';
9
+ @import "../EditTable/style/index.less";
package/es/style.js CHANGED
@@ -3,4 +3,6 @@ import './CheckButton/style';
3
3
  import './ProLayout/style';
4
4
  import './ProTable/style';
5
5
  import './Search/style';
6
- import './CardSelect/style';
6
+ import './CardSelect/style';
7
+ import './DragModal/style';
8
+ import './EditTable/style';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ require("./index.less");
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ require("./index.less");
@@ -0,0 +1,307 @@
1
+ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
+ const op = ops[i];
3
+ const fn = ops[i + 1];
4
+ i += 2;
5
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
+ return undefined;
7
+ }
8
+ if (op === 'access' || op === 'optionalAccess') {
9
+ lastAccessLHS = value;
10
+ value = fn(value);
11
+ }
12
+ else if (op === 'call' || op === 'optionalCall') {
13
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
14
+ lastAccessLHS = undefined;
15
+ }
16
+ } return value; }
17
+ /* Analyzed bindings: {
18
+ "title": "props",
19
+ "width": "props",
20
+ "height": "props",
21
+ "dragRang": "props",
22
+ "bodyStyle": "props",
23
+ "footer": "props",
24
+ "ref": "setup-const",
25
+ "useSlots": "setup-const",
26
+ "defineOptions": "setup-const",
27
+ "computed": "setup-const",
28
+ "onMounted": "setup-const",
29
+ "watch": "setup-const",
30
+ "Button": "setup-maybe-ref",
31
+ "props": "setup-reactive-const",
32
+ "emits": "setup-const",
33
+ "slots": "setup-maybe-ref",
34
+ "ele": "setup-maybe-ref",
35
+ "dialog": "setup-ref",
36
+ "header": "setup-ref",
37
+ "baseWidth": "setup-ref",
38
+ "baseHeight": "setup-ref",
39
+ "baseLeft": "setup-ref",
40
+ "baseTop": "setup-ref",
41
+ "styles": "setup-ref",
42
+ "getFixed": "setup-const",
43
+ "onDrag": "setup-const",
44
+ "handleClear": "setup-const",
45
+ "rangeMove": "setup-const",
46
+ "onCancel": "setup-const",
47
+ "onOk": "setup-const"
48
+ } */
49
+ import { defineComponent as _defineComponent } from 'vue';
50
+ import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, withModifiers as _withModifiers, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, createTextVNode as _createTextVNode, unref as _unref, Transition as _Transition } from "vue";
51
+ const _hoisted_1 = {
52
+ key: 0,
53
+ class: "header"
54
+ };
55
+ const _hoisted_2 = {
56
+ key: 1,
57
+ class: "jetlinks-drag-modal-footer"
58
+ };
59
+ import { ref, useSlots, computed, onMounted, watch } from 'vue';
60
+ import { Button } from 'ant-design-vue';
61
+ const __sfc_main__ = _defineComponent({
62
+ ...{
63
+ name: 'JDragModal'
64
+ },
65
+ props: {
66
+ title: {
67
+ type: [String, Boolean],
68
+ default: ''
69
+ },
70
+ width: {
71
+ type: Number,
72
+ default: 400
73
+ },
74
+ height: {
75
+ type: Number,
76
+ default: 100
77
+ },
78
+ dragRang: {
79
+ type: [Array, Number],
80
+ default: [400, 200]
81
+ },
82
+ bodyStyle: {
83
+ type: Object,
84
+ default: () => ({})
85
+ },
86
+ footer: {
87
+ type: Boolean,
88
+ default: true
89
+ }
90
+ },
91
+ emits: ['cancel', 'heightChange', 'ok', 'visibleChange'],
92
+ setup(__props, { emit: __emit }) {
93
+ const props = __props;
94
+ const emits = __emit;
95
+ const slots = useSlots();
96
+ const ele = document.body;
97
+ const dialog = ref();
98
+ const header = ref();
99
+ const baseWidth = ref(props.width || 400);
100
+ const baseHeight = ref(props.height || 100);
101
+ const baseLeft = ref(100);
102
+ const baseTop = ref(100);
103
+ const styles = computed(() => {
104
+ return {
105
+ top: getFixed(baseTop.value) + 'px',
106
+ left: getFixed(baseLeft.value) + 'px',
107
+ width: getFixed(baseWidth.value) + 'px',
108
+ height: getFixed(baseHeight.value) + 'px'
109
+ };
110
+ });
111
+ const getFixed = (val) => {
112
+ return Number(val.toFixed(2));
113
+ };
114
+ const onDrag = () => {
115
+ let active = false;
116
+ let initialX;
117
+ let initialY;
118
+ let initialWindowX;
119
+ let initialWindowY;
120
+ header.value.addEventListener('mousedown', (e) => {
121
+ active = true;
122
+ initialX = e.clientX;
123
+ initialY = e.clientY;
124
+ initialWindowX = dialog.value.offsetLeft;
125
+ initialWindowY = dialog.value.offsetTop;
126
+ });
127
+ document.addEventListener('mouseup', () => {
128
+ active = false;
129
+ });
130
+ document.addEventListener('mousemove', (e) => {
131
+ if (active) {
132
+ const dx = e.clientX - initialX;
133
+ const dy = e.clientY - initialY;
134
+ baseLeft.value = initialWindowX + dx;
135
+ baseTop.value = initialWindowY + dy;
136
+ }
137
+ });
138
+ };
139
+ const handleClear = () => {
140
+ document.onmouseup = () => {
141
+ document.onmousemove = null;
142
+ document.onmouseup = null;
143
+ };
144
+ };
145
+ const rangeMove = (e, position) => {
146
+ //移动的方向
147
+ let x = false;
148
+ let y = false;
149
+ //移动的位置
150
+ let xp = false;
151
+ let yp = false;
152
+ //移动的正负
153
+ let xc = false;
154
+ let yc = false;
155
+ let disX = e.clientX;
156
+ let disY = e.clientY;
157
+ document.onmousemove = e => {
158
+ if (position === 'drag-bottom-right') {
159
+ x = true;
160
+ y = true;
161
+ }
162
+ else if (position === 'drag-bottom-left') {
163
+ x = true;
164
+ y = true;
165
+ xp = true;
166
+ xc = true;
167
+ }
168
+ else if (position === 'drag-top-right') {
169
+ x = true;
170
+ y = true;
171
+ yp = true;
172
+ yc = true;
173
+ }
174
+ else if (position === 'drag-top-left') {
175
+ x = true;
176
+ y = true;
177
+ xp = true;
178
+ xc = true;
179
+ yp = true;
180
+ yc = true;
181
+ }
182
+ let left = e.clientX - disX;
183
+ let top = e.clientY - disY;
184
+ disX = e.clientX;
185
+ disY = e.clientY;
186
+ if (x) {
187
+ let calc = left;
188
+ if (xc) {
189
+ calc = -calc;
190
+ }
191
+ if (xp) {
192
+ baseLeft.value = baseLeft.value - calc;
193
+ }
194
+ const width = baseWidth.value + calc;
195
+ baseWidth.value = width <= props.dragRang[0] ? props.dragRang[0] : width;
196
+ }
197
+ if (y) {
198
+ let calc = top;
199
+ if (yc) {
200
+ calc = -calc;
201
+ }
202
+ if (yp) {
203
+ baseTop.value = baseTop.value - calc;
204
+ }
205
+ const height = baseHeight.value + calc;
206
+ baseHeight.value = height <= props.dragRang[1] ? props.dragRang[1] : height;
207
+ emits('heightChange', baseHeight.value);
208
+ }
209
+ };
210
+ handleClear();
211
+ };
212
+ const onCancel = () => {
213
+ emits("cancel");
214
+ emits('visibleChange', false);
215
+ };
216
+ const onOk = () => {
217
+ emits("ok");
218
+ emits('visibleChange', true);
219
+ };
220
+ onMounted(() => {
221
+ if (dialog.value && header.value) {
222
+ onDrag();
223
+ }
224
+ if (ele) {
225
+ const data = _optionalChain([ele, 'optionalAccess', _2 => _2.getBoundingClientRect, 'call', _3 => _3()]);
226
+ baseLeft.value = (_optionalChain([data, 'optionalAccess', _4 => _4.right]) - baseWidth.value) / 2 || 0;
227
+ baseTop.value = _optionalChain([data, 'optionalAccess', _5 => _5.top]) + 200 || 0;
228
+ }
229
+ });
230
+ watch(() => props.height, () => {
231
+ if (props.height > baseHeight.value) {
232
+ baseHeight.value = props.height;
233
+ }
234
+ });
235
+ return (_ctx, _cache) => {
236
+ const _component_AIcon = _resolveComponent("AIcon");
237
+ const _component_a_button = _resolveComponent("a-button");
238
+ return (_openBlock(), _createElementBlock("div", {
239
+ ref_key: "dialog",
240
+ ref: dialog,
241
+ style: _normalizeStyle(styles.value),
242
+ class: "jetlinks-drag-modal"
243
+ }, [
244
+ _createVNode(_Transition, { name: "dialog" }, {
245
+ default: _withCtx(() => [
246
+ _createElementVNode("div", {
247
+ class: "jetlinks-drag-modal-sprite",
248
+ ref_key: "header",
249
+ ref: header
250
+ }, [
251
+ (__props.title !== false)
252
+ ? (_openBlock(), _createElementBlock("div", _hoisted_1, [
253
+ _createElementVNode("span", null, _toDisplayString(__props.title), 1 /* TEXT */),
254
+ _createVNode(_component_a_button, {
255
+ size: "small",
256
+ type: "text",
257
+ onClick: _withModifiers(onCancel, ["stop"])
258
+ }, {
259
+ default: _withCtx(() => [
260
+ _createVNode(_component_AIcon, { type: "CloseOutlined" })
261
+ ]),
262
+ _: 1 /* STABLE */
263
+ })
264
+ ]))
265
+ : _createCommentVNode("v-if", true),
266
+ _createElementVNode("div", {
267
+ class: "jetlinks-drag-modal-body",
268
+ style: _normalizeStyle(__props.bodyStyle)
269
+ }, [
270
+ _renderSlot(_ctx.$slots, "default")
271
+ ], 4 /* STYLE */),
272
+ (__props.footer !== false)
273
+ ? (_openBlock(), _createElementBlock("div", _hoisted_2, [
274
+ _renderSlot(_ctx.$slots, "footer", {}, () => [
275
+ _createVNode(_unref(Button), {
276
+ onClick: _withModifiers(onCancel, ["stop"])
277
+ }, {
278
+ default: _withCtx(() => [
279
+ _createTextVNode("取消")
280
+ ]),
281
+ _: 1 /* STABLE */
282
+ }),
283
+ _createVNode(_unref(Button), {
284
+ type: "primary",
285
+ onClick: _withModifiers(onOk, ["stop"])
286
+ }, {
287
+ default: _withCtx(() => [
288
+ _createTextVNode("确认")
289
+ ]),
290
+ _: 1 /* STABLE */
291
+ })
292
+ ])
293
+ ]))
294
+ : _createCommentVNode("v-if", true)
295
+ ], 512 /* NEED_PATCH */)
296
+ ]),
297
+ _: 3 /* FORWARDED */
298
+ }),
299
+ _createElementVNode("div", {
300
+ class: "jetlinks-drag-modal-range drag-bottom-right",
301
+ onMousedown: _cache[0] || (_cache[0] = _withModifiers(($event) => (rangeMove($event, "drag-bottom-right")), ["stop"]))
302
+ }, null, 32 /* NEED_HYDRATION */)
303
+ ], 4 /* STYLE */));
304
+ };
305
+ }
306
+ });
307
+ export default __sfc_main__;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _DragModal = _interopRequireDefault(require("./DragModal.js"));
9
+ _DragModal.default.install = function (app) {
10
+ app.component(_DragModal.default.name, _DragModal.default);
11
+ };
12
+ var _default = exports.default = _DragModal.default;