@deppon/deppon-template 2.4.24 → 2.5.4

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 (55) hide show
  1. package/README.md +4 -0
  2. package/es/index.d.ts +2 -0
  3. package/es/index.js +8 -0
  4. package/es/pro-dialog/ProDialog.vue.css +39 -2
  5. package/es/pro-field/ProField.vue.css +39 -2
  6. package/es/pro-field/components/DatePicker/FieldDatePicker.vue.css +39 -2
  7. package/es/pro-field/components/Select/FieldSelect.vue.css +39 -2
  8. package/es/pro-form/ProForm.vue.css +39 -2
  9. package/es/pro-iframe/ProIframe.vue.css +78 -0
  10. package/es/pro-iframe/ProIframe.vue.js +7 -0
  11. package/es/pro-iframe/ProIframe.vue_vue_type_script_setup_true_lang.vue.js +271 -0
  12. package/es/pro-iframe/ProIframe.vue_vue_type_style_index_0_id_7119d75d_scoped_true_lang.vue.js +1 -0
  13. package/es/pro-iframe/ProIframeRouteView.vue.js +5 -0
  14. package/es/pro-iframe/ProIframeRouteView.vue_vue_type_script_setup_true_lang.vue.js +85 -0
  15. package/es/pro-iframe/buildIframeRouteLocation.d.ts +18 -0
  16. package/es/pro-iframe/buildIframeRouteLocation.js +34 -0
  17. package/es/pro-iframe/createIframeRoute.d.ts +33 -0
  18. package/es/pro-iframe/createIframeRoute.js +46 -0
  19. package/es/pro-iframe/index.d.ts +43 -0
  20. package/es/pro-iframe/isInIframeEmbed.d.ts +4 -0
  21. package/es/pro-iframe/isInIframeEmbed.js +15 -0
  22. package/es/pro-iframe/resolveIframeSrc.d.ts +19 -0
  23. package/es/pro-iframe/resolveIframeSrc.js +177 -0
  24. package/es/pro-iframe/types.d.ts +60 -0
  25. package/es/pro-layout/ProLayout.vue.css +521 -129
  26. package/es/pro-layout/ProLayout.vue_vue_type_script_setup_true_lang.vue.js +747 -68
  27. package/es/pro-layout/ProLayoutColumnsAside.vue.css +62 -0
  28. package/es/pro-layout/ProLayoutColumnsAside.vue.js +7 -0
  29. package/es/pro-layout/ProLayoutColumnsAside.vue_vue_type_script_setup_true_lang.vue.js +86 -0
  30. package/es/pro-layout/ProLayoutColumnsAside.vue_vue_type_style_index_0_id_18647f64_scoped_true_lang.vue.js +1 -0
  31. package/es/pro-layout/ProLayoutSettingsDrawer.vue.css +140 -0
  32. package/es/pro-layout/ProLayoutSettingsDrawer.vue.js +7 -0
  33. package/es/pro-layout/ProLayoutSettingsDrawer.vue_vue_type_script_setup_true_lang.vue.js +280 -0
  34. package/es/pro-layout/ProLayoutSettingsDrawer.vue_vue_type_style_index_0_id_5b67a386_scoped_true_lang.vue.js +1 -0
  35. package/es/pro-layout/ProLayoutSettingsFab.vue.css +81 -0
  36. package/es/pro-layout/ProLayoutSettingsFab.vue.js +7 -0
  37. package/es/pro-layout/ProLayoutSettingsFab.vue_vue_type_script_setup_true_lang.vue.js +106 -0
  38. package/es/pro-layout/ProLayoutSettingsFab.vue_vue_type_style_index_0_id_3bf2eb6b_scoped_true_lang.vue.js +1 -0
  39. package/es/pro-layout/index.d.ts +51 -1
  40. package/es/pro-layout/index.js +3 -0
  41. package/es/pro-layout/pro-layout-context.d.ts +8 -0
  42. package/es/pro-layout/pro-layout-context.js +5 -0
  43. package/es/pro-layout/proLayoutGlobalColors.d.ts +16 -0
  44. package/es/pro-layout/proLayoutGlobalColors.js +171 -0
  45. package/es/pro-layout/proLayoutTheme.d.ts +29 -0
  46. package/es/pro-layout/proLayoutTheme.js +232 -0
  47. package/es/pro-layout/types.d.ts +52 -0
  48. package/es/pro-table/ProTable.vue.css +39 -2
  49. package/es/pro-table/ProTableColumn.vue.css +39 -2
  50. package/es/pro-table/ToolBar/ColumnSetting.vue.css +39 -2
  51. package/es/pro-table/ToolBar/Density.vue.css +39 -2
  52. package/es/pro-table/ToolBar/Fullscreen.vue.css +39 -2
  53. package/es/pro-table/ToolBar/index.vue.css +39 -2
  54. package/es/styles/index.css +39 -2
  55. package/package.json +6 -6
package/README.md CHANGED
@@ -325,6 +325,10 @@ const handleClick = () => {
325
325
  </script>
326
326
  ```
327
327
 
328
+ ## ProIframe 内嵌页
329
+
330
+ 在 ProLayout 内通过 iframe 加载页面,支持路由动态传 `url`。详见 [docs/pro-iframe.md](./docs/pro-iframe.md) 或文档站 [ProIframe 说明](../../docs/docs/deppon-template-pro-iframe.md)。
331
+
328
332
  ## License
329
333
 
330
334
  MIT
package/es/index.d.ts CHANGED
@@ -3,3 +3,5 @@ export { default as ProForm } from './pro-form';
3
3
  export { default as ProTable } from './pro-table';
4
4
  export { default as ProLayout } from './pro-layout';
5
5
  export { default as ProDialog } from './pro-dialog';
6
+ export { ProIframe, ProIframeRouteView, createIframeRoute, buildIframeRouteLocation, resolveIframeSrcFromRoute, appendQueryToUrl, isIframeRoute, decodeIframeUrlValue, applyIframeUrlTemplate, resolveDynamicIframeBaseUrl, PRO_IFRAME_URL_QUERY_KEYS, PRO_IFRAME_URL_RESERVED_QUERY_KEYS, isInIframeEmbed, } from './pro-iframe';
7
+ export type { ProIframeRouteMeta, ProIframeProps, CreateIframeRouteOptions, BuildIframeRouteLocationOptions, } from './pro-iframe';
package/es/index.js CHANGED
@@ -13,4 +13,12 @@ export { default as ProTable } from './pro-table';
13
13
  import './pro-layout';
14
14
  export { default as ProLayout } from './pro-layout';
15
15
  export { default as ProDialog } from './pro-dialog/ProDialog.vue_vue_type_script_setup_true_lang.vue.js';
16
+ import './pro-iframe/ProIframe.vue.js';
17
+ export { default as ProIframe } from './pro-iframe/ProIframe.vue_vue_type_script_setup_true_lang.vue.js';
18
+ import './pro-iframe/ProIframeRouteView.vue.js';
19
+ export { default as ProIframeRouteView } from './pro-iframe/ProIframeRouteView.vue_vue_type_script_setup_true_lang.vue.js';
16
20
  export { default as ProFieldText } from './pro-field/components/Text';
21
+ export { createIframeRoute } from './pro-iframe/createIframeRoute.js';
22
+ export { buildIframeRouteLocation } from './pro-iframe/buildIframeRouteLocation.js';
23
+ export { PRO_IFRAME_URL_QUERY_KEYS, PRO_IFRAME_URL_RESERVED_QUERY_KEYS, appendQueryToUrl, applyIframeUrlTemplate, decodeIframeUrlValue, isIframeRoute, resolveDynamicIframeBaseUrl, resolveIframeSrcFromRoute } from './pro-iframe/resolveIframeSrc.js';
24
+ export { isInIframeEmbed } from './pro-iframe/isInIframeEmbed.js';
@@ -166,8 +166,8 @@
166
166
  }
167
167
  .pro-layout__top-menu-el .pro-layout__top-menu-item-badge {
168
168
  position: absolute;
169
- top: 3px;
170
- right: 4px;
169
+ top: 2px;
170
+ right: -15px;
171
171
  transform: scale(0.75);
172
172
  vertical-align: top;
173
173
  }
@@ -367,6 +367,43 @@
367
367
  opacity: 1 !important;
368
368
  visibility: visible !important;
369
369
  }
370
+ .el-menu--collapse {
371
+ width: 100% !important;
372
+ max-width: 100% !important;
373
+ min-width: 0 !important;
374
+ box-sizing: border-box !important;
375
+ }
376
+ .el-menu--collapse .el-menu-item,
377
+ .el-menu--collapse .el-sub-menu__title {
378
+ justify-content: center !important;
379
+ max-width: 100%;
380
+ box-sizing: border-box !important;
381
+ }
382
+ .el-menu--collapse .el-menu-tooltip__trigger {
383
+ padding: 0 !important;
384
+ justify-content: center !important;
385
+ }
386
+ .el-menu--collapse .el-menu-item [class^='el-icon'],
387
+ .el-menu--collapse .el-sub-menu__title [class^='el-icon'] {
388
+ margin-right: 0 !important;
389
+ margin-left: 0 !important;
390
+ }
391
+ .el-menu--collapse .el-menu-item > .pro-layout__menu-item-char,
392
+ .el-menu--collapse .el-sub-menu__title > .pro-layout__menu-item-char {
393
+ display: inline-flex !important;
394
+ width: 20px !important;
395
+ min-width: 20px !important;
396
+ height: 20px !important;
397
+ overflow: visible !important;
398
+ visibility: visible !important;
399
+ }
400
+ .el-menu--collapse .el-menu-item.is-active,
401
+ .el-menu--collapse .el-sub-menu.is-active > .el-sub-menu__title {
402
+ background: linear-gradient(135deg, var(--pro-layout-accent-soft, #eef2ff) 0%, var(--pro-layout-accent-muted, #e0e7ff) 100%) !important;
403
+ color: var(--pro-layout-accent-dark, #4338ca) !important;
404
+ font-weight: 600;
405
+ box-shadow: inset 3px 0 0 0 var(--pro-layout-accent, #6366f1) !important;
406
+ }
370
407
  .el-menu--collapse .el-sub-menu__title .pro-layout__menu-item-char {
371
408
  color: var(--el-text-color-regular, #606266) !important;
372
409
  opacity: 1 !important;
@@ -166,8 +166,8 @@
166
166
  }
167
167
  .pro-layout__top-menu-el .pro-layout__top-menu-item-badge {
168
168
  position: absolute;
169
- top: 3px;
170
- right: 4px;
169
+ top: 2px;
170
+ right: -15px;
171
171
  transform: scale(0.75);
172
172
  vertical-align: top;
173
173
  }
@@ -367,6 +367,43 @@
367
367
  opacity: 1 !important;
368
368
  visibility: visible !important;
369
369
  }
370
+ .el-menu--collapse {
371
+ width: 100% !important;
372
+ max-width: 100% !important;
373
+ min-width: 0 !important;
374
+ box-sizing: border-box !important;
375
+ }
376
+ .el-menu--collapse .el-menu-item,
377
+ .el-menu--collapse .el-sub-menu__title {
378
+ justify-content: center !important;
379
+ max-width: 100%;
380
+ box-sizing: border-box !important;
381
+ }
382
+ .el-menu--collapse .el-menu-tooltip__trigger {
383
+ padding: 0 !important;
384
+ justify-content: center !important;
385
+ }
386
+ .el-menu--collapse .el-menu-item [class^='el-icon'],
387
+ .el-menu--collapse .el-sub-menu__title [class^='el-icon'] {
388
+ margin-right: 0 !important;
389
+ margin-left: 0 !important;
390
+ }
391
+ .el-menu--collapse .el-menu-item > .pro-layout__menu-item-char,
392
+ .el-menu--collapse .el-sub-menu__title > .pro-layout__menu-item-char {
393
+ display: inline-flex !important;
394
+ width: 20px !important;
395
+ min-width: 20px !important;
396
+ height: 20px !important;
397
+ overflow: visible !important;
398
+ visibility: visible !important;
399
+ }
400
+ .el-menu--collapse .el-menu-item.is-active,
401
+ .el-menu--collapse .el-sub-menu.is-active > .el-sub-menu__title {
402
+ background: linear-gradient(135deg, var(--pro-layout-accent-soft, #eef2ff) 0%, var(--pro-layout-accent-muted, #e0e7ff) 100%) !important;
403
+ color: var(--pro-layout-accent-dark, #4338ca) !important;
404
+ font-weight: 600;
405
+ box-shadow: inset 3px 0 0 0 var(--pro-layout-accent, #6366f1) !important;
406
+ }
370
407
  .el-menu--collapse .el-sub-menu__title .pro-layout__menu-item-char {
371
408
  color: var(--el-text-color-regular, #606266) !important;
372
409
  opacity: 1 !important;
@@ -166,8 +166,8 @@
166
166
  }
167
167
  .pro-layout__top-menu-el .pro-layout__top-menu-item-badge {
168
168
  position: absolute;
169
- top: 3px;
170
- right: 4px;
169
+ top: 2px;
170
+ right: -15px;
171
171
  transform: scale(0.75);
172
172
  vertical-align: top;
173
173
  }
@@ -367,6 +367,43 @@
367
367
  opacity: 1 !important;
368
368
  visibility: visible !important;
369
369
  }
370
+ .el-menu--collapse {
371
+ width: 100% !important;
372
+ max-width: 100% !important;
373
+ min-width: 0 !important;
374
+ box-sizing: border-box !important;
375
+ }
376
+ .el-menu--collapse .el-menu-item,
377
+ .el-menu--collapse .el-sub-menu__title {
378
+ justify-content: center !important;
379
+ max-width: 100%;
380
+ box-sizing: border-box !important;
381
+ }
382
+ .el-menu--collapse .el-menu-tooltip__trigger {
383
+ padding: 0 !important;
384
+ justify-content: center !important;
385
+ }
386
+ .el-menu--collapse .el-menu-item [class^='el-icon'],
387
+ .el-menu--collapse .el-sub-menu__title [class^='el-icon'] {
388
+ margin-right: 0 !important;
389
+ margin-left: 0 !important;
390
+ }
391
+ .el-menu--collapse .el-menu-item > .pro-layout__menu-item-char,
392
+ .el-menu--collapse .el-sub-menu__title > .pro-layout__menu-item-char {
393
+ display: inline-flex !important;
394
+ width: 20px !important;
395
+ min-width: 20px !important;
396
+ height: 20px !important;
397
+ overflow: visible !important;
398
+ visibility: visible !important;
399
+ }
400
+ .el-menu--collapse .el-menu-item.is-active,
401
+ .el-menu--collapse .el-sub-menu.is-active > .el-sub-menu__title {
402
+ background: linear-gradient(135deg, var(--pro-layout-accent-soft, #eef2ff) 0%, var(--pro-layout-accent-muted, #e0e7ff) 100%) !important;
403
+ color: var(--pro-layout-accent-dark, #4338ca) !important;
404
+ font-weight: 600;
405
+ box-shadow: inset 3px 0 0 0 var(--pro-layout-accent, #6366f1) !important;
406
+ }
370
407
  .el-menu--collapse .el-sub-menu__title .pro-layout__menu-item-char {
371
408
  color: var(--el-text-color-regular, #606266) !important;
372
409
  opacity: 1 !important;
@@ -166,8 +166,8 @@
166
166
  }
167
167
  .pro-layout__top-menu-el .pro-layout__top-menu-item-badge {
168
168
  position: absolute;
169
- top: 3px;
170
- right: 4px;
169
+ top: 2px;
170
+ right: -15px;
171
171
  transform: scale(0.75);
172
172
  vertical-align: top;
173
173
  }
@@ -367,6 +367,43 @@
367
367
  opacity: 1 !important;
368
368
  visibility: visible !important;
369
369
  }
370
+ .el-menu--collapse {
371
+ width: 100% !important;
372
+ max-width: 100% !important;
373
+ min-width: 0 !important;
374
+ box-sizing: border-box !important;
375
+ }
376
+ .el-menu--collapse .el-menu-item,
377
+ .el-menu--collapse .el-sub-menu__title {
378
+ justify-content: center !important;
379
+ max-width: 100%;
380
+ box-sizing: border-box !important;
381
+ }
382
+ .el-menu--collapse .el-menu-tooltip__trigger {
383
+ padding: 0 !important;
384
+ justify-content: center !important;
385
+ }
386
+ .el-menu--collapse .el-menu-item [class^='el-icon'],
387
+ .el-menu--collapse .el-sub-menu__title [class^='el-icon'] {
388
+ margin-right: 0 !important;
389
+ margin-left: 0 !important;
390
+ }
391
+ .el-menu--collapse .el-menu-item > .pro-layout__menu-item-char,
392
+ .el-menu--collapse .el-sub-menu__title > .pro-layout__menu-item-char {
393
+ display: inline-flex !important;
394
+ width: 20px !important;
395
+ min-width: 20px !important;
396
+ height: 20px !important;
397
+ overflow: visible !important;
398
+ visibility: visible !important;
399
+ }
400
+ .el-menu--collapse .el-menu-item.is-active,
401
+ .el-menu--collapse .el-sub-menu.is-active > .el-sub-menu__title {
402
+ background: linear-gradient(135deg, var(--pro-layout-accent-soft, #eef2ff) 0%, var(--pro-layout-accent-muted, #e0e7ff) 100%) !important;
403
+ color: var(--pro-layout-accent-dark, #4338ca) !important;
404
+ font-weight: 600;
405
+ box-shadow: inset 3px 0 0 0 var(--pro-layout-accent, #6366f1) !important;
406
+ }
370
407
  .el-menu--collapse .el-sub-menu__title .pro-layout__menu-item-char {
371
408
  color: var(--el-text-color-regular, #606266) !important;
372
409
  opacity: 1 !important;
@@ -166,8 +166,8 @@
166
166
  }
167
167
  .pro-layout__top-menu-el .pro-layout__top-menu-item-badge {
168
168
  position: absolute;
169
- top: 3px;
170
- right: 4px;
169
+ top: 2px;
170
+ right: -15px;
171
171
  transform: scale(0.75);
172
172
  vertical-align: top;
173
173
  }
@@ -367,6 +367,43 @@
367
367
  opacity: 1 !important;
368
368
  visibility: visible !important;
369
369
  }
370
+ .el-menu--collapse {
371
+ width: 100% !important;
372
+ max-width: 100% !important;
373
+ min-width: 0 !important;
374
+ box-sizing: border-box !important;
375
+ }
376
+ .el-menu--collapse .el-menu-item,
377
+ .el-menu--collapse .el-sub-menu__title {
378
+ justify-content: center !important;
379
+ max-width: 100%;
380
+ box-sizing: border-box !important;
381
+ }
382
+ .el-menu--collapse .el-menu-tooltip__trigger {
383
+ padding: 0 !important;
384
+ justify-content: center !important;
385
+ }
386
+ .el-menu--collapse .el-menu-item [class^='el-icon'],
387
+ .el-menu--collapse .el-sub-menu__title [class^='el-icon'] {
388
+ margin-right: 0 !important;
389
+ margin-left: 0 !important;
390
+ }
391
+ .el-menu--collapse .el-menu-item > .pro-layout__menu-item-char,
392
+ .el-menu--collapse .el-sub-menu__title > .pro-layout__menu-item-char {
393
+ display: inline-flex !important;
394
+ width: 20px !important;
395
+ min-width: 20px !important;
396
+ height: 20px !important;
397
+ overflow: visible !important;
398
+ visibility: visible !important;
399
+ }
400
+ .el-menu--collapse .el-menu-item.is-active,
401
+ .el-menu--collapse .el-sub-menu.is-active > .el-sub-menu__title {
402
+ background: linear-gradient(135deg, var(--pro-layout-accent-soft, #eef2ff) 0%, var(--pro-layout-accent-muted, #e0e7ff) 100%) !important;
403
+ color: var(--pro-layout-accent-dark, #4338ca) !important;
404
+ font-weight: 600;
405
+ box-shadow: inset 3px 0 0 0 var(--pro-layout-accent, #6366f1) !important;
406
+ }
370
407
  .el-menu--collapse .el-sub-menu__title .pro-layout__menu-item-char {
371
408
  color: var(--el-text-color-regular, #606266) !important;
372
409
  opacity: 1 !important;
@@ -0,0 +1,78 @@
1
+ .pro-iframe {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 100%;
5
+ min-height: 200px;
6
+ box-sizing: border-box;
7
+ background: var(--el-bg-color, #fff);
8
+ }
9
+ .pro-iframe--full {
10
+ height: 100%;
11
+ min-height: 0;
12
+ }
13
+ .pro-iframe__toolbar {
14
+ flex-shrink: 0;
15
+ padding: 8px 12px;
16
+ border-bottom: 1px solid var(--el-border-color-lighter, #ebeef5);
17
+ }
18
+ .pro-iframe__body {
19
+ position: relative;
20
+ flex: 1;
21
+ min-height: 0;
22
+ overflow: hidden;
23
+ }
24
+ .pro-iframe__frame {
25
+ display: block;
26
+ width: 100%;
27
+ height: 100%;
28
+ border: 0;
29
+ background: #fff;
30
+ }
31
+ .pro-iframe__empty,
32
+ .pro-iframe__error {
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ width: 100%;
37
+ height: 100%;
38
+ min-height: 240px;
39
+ }
40
+ .pro-iframe__loading {
41
+ position: absolute;
42
+ inset: 0;
43
+ z-index: 2;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ background: rgba(255, 255, 255, 0.72);
48
+ pointer-events: none;
49
+ }
50
+ .pro-iframe__loading-inner {
51
+ display: flex;
52
+ flex-direction: column;
53
+ align-items: center;
54
+ gap: 10px;
55
+ }
56
+ .pro-iframe__loading-spinner {
57
+ width: 28px;
58
+ height: 28px;
59
+ border: 2px solid var(--el-border-color, #dcdfe6);
60
+ border-top-color: var(--el-color-primary, #409eff);
61
+ border-radius: 50%;
62
+ animation: pro-iframe-spin 0.8s linear infinite;
63
+ }
64
+ .pro-iframe__loading-text {
65
+ font-size: 13px;
66
+ color: var(--el-text-color-secondary, #909399);
67
+ }
68
+ .pro-iframe__error {
69
+ position: absolute;
70
+ inset: 0;
71
+ z-index: 3;
72
+ background: var(--el-bg-color, #fff);
73
+ }
74
+ @keyframes pro-iframe-spin {
75
+ to {
76
+ transform: rotate(360deg);
77
+ }
78
+ }
@@ -0,0 +1,7 @@
1
+ import '../_virtual/_rollup-plugin-inject-process-env.js';
2
+ import script from './ProIframe.vue_vue_type_script_setup_true_lang.vue.js';
3
+ export { default } from './ProIframe.vue_vue_type_script_setup_true_lang.vue.js';
4
+ import './ProIframe.vue_vue_type_style_index_0_id_7119d75d_scoped_true_lang.vue.js';
5
+
6
+ script.__scopeId = "data-v-7119d75d";
7
+ script.__file = "packages/deppon-template/src/pro-iframe/ProIframe.vue";
@@ -0,0 +1,271 @@
1
+ import '../_virtual/_rollup-plugin-inject-process-env.js';
2
+ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
+ import { ref, computed, watch, onMounted, onUnmounted, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, createElementVNode, createVNode, unref, toDisplayString, withCtx, createTextVNode } from 'vue';
5
+ import { useRoute } from '@deppon/deppon-router';
6
+ import { ElEmpty, ElButton } from '@deppon/deppon-ui';
7
+ import { initIframeStyleFix } from '@deppon/deppon-utils';
8
+ import { appendQueryToUrl, PRO_IFRAME_URL_RESERVED_QUERY_KEYS } from './resolveIframeSrc.js';
9
+
10
+ var _hoisted_1 = {
11
+ key: 0,
12
+ "class": "pro-iframe__toolbar"
13
+ };
14
+ var _hoisted_2 = {
15
+ "class": "pro-iframe__body"
16
+ };
17
+ var _hoisted_3 = ["name", "title", "src", "sandbox", "allow", "referrerpolicy", "frameborder", "loading"];
18
+ var _hoisted_4 = {
19
+ key: 1,
20
+ "class": "pro-iframe__empty"
21
+ };
22
+ var _hoisted_5 = {
23
+ key: 2,
24
+ "class": "pro-iframe__loading"
25
+ };
26
+ var _hoisted_6 = {
27
+ "class": "pro-iframe__loading-inner"
28
+ };
29
+ var _hoisted_7 = {
30
+ "class": "pro-iframe__loading-text"
31
+ };
32
+ var _hoisted_8 = {
33
+ key: 3,
34
+ "class": "pro-iframe__error"
35
+ };
36
+ var script = {
37
+ __name: 'ProIframe',
38
+ props: {
39
+ /** iframe 地址;不传时可由路由 meta 解析(需配合 appendRouteQuery) */
40
+ src: {
41
+ type: String,
42
+ "default": ''
43
+ },
44
+ name: {
45
+ type: String,
46
+ "default": 'pro-iframe'
47
+ },
48
+ title: {
49
+ type: String,
50
+ "default": ''
51
+ },
52
+ loading: {
53
+ type: Boolean,
54
+ "default": true
55
+ },
56
+ loadingText: {
57
+ type: String,
58
+ "default": '加载中…'
59
+ },
60
+ /** 将当前路由 query 拼接到 src */
61
+ appendRouteQuery: {
62
+ type: Boolean,
63
+ "default": false
64
+ },
65
+ sandbox: {
66
+ type: String,
67
+ "default": ''
68
+ },
69
+ allow: {
70
+ type: String,
71
+ "default": ''
72
+ },
73
+ referrerpolicy: {
74
+ type: String,
75
+ "default": ''
76
+ },
77
+ frameborder: {
78
+ type: [String, Number],
79
+ "default": 0
80
+ },
81
+ lazy: {
82
+ type: Boolean,
83
+ "default": false
84
+ },
85
+ full: {
86
+ type: Boolean,
87
+ "default": true
88
+ },
89
+ /** 子应用在父级 iframe 壳中时,初始化 UAP 父页样式修复 */
90
+ fixParentStyle: {
91
+ type: Boolean,
92
+ "default": false
93
+ },
94
+ /** 加载超时(毫秒),超时后关闭 loading 遮罩,0 表示不超时 */
95
+ loadTimeout: {
96
+ type: Number,
97
+ "default": 30000
98
+ }
99
+ },
100
+ emits: ['load', 'error', 'src-change'],
101
+ setup: function setup(__props, _ref) {
102
+ var __expose = _ref.expose,
103
+ __emit = _ref.emit;
104
+ var RESERVED_ROUTE_QUERY_KEYS = new Set(PRO_IFRAME_URL_RESERVED_QUERY_KEYS);
105
+ var props = __props;
106
+ var emit = __emit;
107
+ var route = useRoute();
108
+ var iframeRef = ref(null);
109
+ var loadError = ref(false);
110
+ var frameLoading = ref(false);
111
+ var reloadToken = ref(0);
112
+ var loadTimeoutTimer = null;
113
+ function clearLoadTimeout() {
114
+ if (loadTimeoutTimer != null) {
115
+ clearTimeout(loadTimeoutTimer);
116
+ loadTimeoutTimer = null;
117
+ }
118
+ }
119
+ function scheduleLoadTimeout() {
120
+ clearLoadTimeout();
121
+ if (!props.loadTimeout || props.loadTimeout <= 0) return;
122
+ loadTimeoutTimer = setTimeout(function () {
123
+ if (frameLoading.value) {
124
+ frameLoading.value = false;
125
+ }
126
+ }, props.loadTimeout);
127
+ }
128
+ var routeQueryRecord = computed(function () {
129
+ var q = route.query || {};
130
+ var result = {};
131
+ Object.entries(q).forEach(function (_ref2) {
132
+ var _ref3 = _slicedToArray(_ref2, 2),
133
+ key = _ref3[0],
134
+ raw = _ref3[1];
135
+ if (RESERVED_ROUTE_QUERY_KEYS.has(key)) return;
136
+ if (raw == null) return;
137
+ var value = Array.isArray(raw) ? raw[0] : raw;
138
+ if (value != null && value !== '') result[key] = String(value);
139
+ });
140
+ return result;
141
+ });
142
+ var baseSrc = computed(function () {
143
+ var raw = (props.src || '').trim();
144
+ if (!raw) return '';
145
+ if (raw.startsWith('/') && !raw.startsWith('//') && typeof window !== 'undefined') {
146
+ return "".concat(window.location.origin).concat(raw);
147
+ }
148
+ return raw;
149
+ });
150
+ var srcWithQuery = computed(function () {
151
+ if (!baseSrc.value || !props.appendRouteQuery) return baseSrc.value;
152
+ return appendQueryToUrl(baseSrc.value, routeQueryRecord.value);
153
+ });
154
+ var effectiveSrc = computed(function () {
155
+ if (!srcWithQuery.value) return '';
156
+ if (reloadToken.value > 0) {
157
+ return appendQueryToUrl(srcWithQuery.value, {
158
+ _pro_iframe_ts: String(reloadToken.value)
159
+ });
160
+ }
161
+ return srcWithQuery.value;
162
+ });
163
+ var loadingVisible = computed(function () {
164
+ return props.loading && frameLoading.value && !loadError.value;
165
+ });
166
+ watch(function () {
167
+ return srcWithQuery.value;
168
+ }, function (next, prev) {
169
+ if (!next) {
170
+ frameLoading.value = false;
171
+ return;
172
+ }
173
+ if (next !== prev) {
174
+ loadError.value = false;
175
+ frameLoading.value = true;
176
+ scheduleLoadTimeout();
177
+ emit('src-change', next);
178
+ }
179
+ }, {
180
+ immediate: true
181
+ });
182
+ function handleLoad() {
183
+ clearLoadTimeout();
184
+ frameLoading.value = false;
185
+ loadError.value = false;
186
+ emit('load', iframeRef.value);
187
+ }
188
+ function handleError() {
189
+ clearLoadTimeout();
190
+ frameLoading.value = false;
191
+ loadError.value = true;
192
+ emit('error', iframeRef.value);
193
+ }
194
+ function reload() {
195
+ loadError.value = false;
196
+ frameLoading.value = true;
197
+ scheduleLoadTimeout();
198
+ reloadToken.value += 1;
199
+ }
200
+ onMounted(function () {
201
+ if (props.fixParentStyle) {
202
+ initIframeStyleFix();
203
+ }
204
+ });
205
+ onUnmounted(function () {
206
+ clearLoadTimeout();
207
+ });
208
+ __expose({
209
+ reload: reload,
210
+ iframeRef: iframeRef,
211
+ effectiveSrc: effectiveSrc
212
+ });
213
+ return function (_ctx, _cache) {
214
+ return openBlock(), createElementBlock("div", {
215
+ "class": normalizeClass(["pro-iframe", {
216
+ 'pro-iframe--full': __props.full
217
+ }])
218
+ }, [_ctx.$slots.toolbar ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "toolbar", {
219
+ reload: reload,
220
+ src: effectiveSrc.value
221
+ })])) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_2, [effectiveSrc.value ? (openBlock(), createElementBlock("iframe", {
222
+ key: effectiveSrc.value,
223
+ ref_key: "iframeRef",
224
+ ref: iframeRef,
225
+ "class": "pro-iframe__frame",
226
+ name: __props.name,
227
+ title: __props.title,
228
+ src: effectiveSrc.value,
229
+ sandbox: __props.sandbox || undefined,
230
+ allow: __props.allow || undefined,
231
+ referrerpolicy: __props.referrerpolicy || undefined,
232
+ frameborder: __props.frameborder,
233
+ loading: __props.lazy ? 'lazy' : undefined,
234
+ onLoad: handleLoad,
235
+ onError: handleError
236
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_3)) : (openBlock(), createElementBlock("div", _hoisted_4, [renderSlot(_ctx.$slots, "empty", {}, function () {
237
+ return [createVNode(unref(ElEmpty), {
238
+ description: "未配置 iframe 地址"
239
+ })];
240
+ })])), loadingVisible.value ? (openBlock(), createElementBlock("div", _hoisted_5, [renderSlot(_ctx.$slots, "loading", {
241
+ text: __props.loadingText
242
+ }, function () {
243
+ return [createElementVNode("div", _hoisted_6, [_cache[0] || (_cache[0] = createElementVNode("span", {
244
+ "class": "pro-iframe__loading-spinner"
245
+ }, null, -1 /* CACHED */)), createElementVNode("span", _hoisted_7, toDisplayString(__props.loadingText), 1 /* TEXT */)])];
246
+ })])) : createCommentVNode("v-if", true), loadError.value ? (openBlock(), createElementBlock("div", _hoisted_8, [renderSlot(_ctx.$slots, "error", {
247
+ reload: reload,
248
+ src: effectiveSrc.value
249
+ }, function () {
250
+ return [createVNode(unref(ElEmpty), {
251
+ description: "页面加载失败"
252
+ }, {
253
+ "default": withCtx(function () {
254
+ return [createVNode(unref(ElButton), {
255
+ type: "primary",
256
+ onClick: reload
257
+ }, {
258
+ "default": withCtx(function () {
259
+ return _toConsumableArray(_cache[1] || (_cache[1] = [createTextVNode("重新加载", -1 /* CACHED */)]));
260
+ }),
261
+ _: 1 /* STABLE */
262
+ })];
263
+ }),
264
+ _: 1 /* STABLE */
265
+ })];
266
+ })])) : createCommentVNode("v-if", true)])], 2 /* CLASS */);
267
+ };
268
+ }
269
+ };
270
+
271
+ export { script as default };
@@ -0,0 +1,5 @@
1
+ import '../_virtual/_rollup-plugin-inject-process-env.js';
2
+ import script from './ProIframeRouteView.vue_vue_type_script_setup_true_lang.vue.js';
3
+ export { default } from './ProIframeRouteView.vue_vue_type_script_setup_true_lang.vue.js';
4
+
5
+ script.__file = "packages/deppon-template/src/pro-iframe/ProIframeRouteView.vue";