@deppon/deppon-template 2.5.3 → 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 +296 -4
  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
@@ -0,0 +1,85 @@
1
+ import '../_virtual/_rollup-plugin-inject-process-env.js';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
+ import _typeof from '@babel/runtime/helpers/typeof';
4
+ import { computed, openBlock, createBlock, mergeProps, createSlots, withCtx, renderSlot, normalizeProps, guardReactiveProps } from 'vue';
5
+ import { useRoute } from '@deppon/deppon-router';
6
+ import './ProIframe.vue.js';
7
+ import { resolveIframeSrcFromRoute } from './resolveIframeSrc.js';
8
+ import script$1 from './ProIframe.vue_vue_type_script_setup_true_lang.vue.js';
9
+
10
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ var script = {
13
+ __name: 'ProIframeRouteView',
14
+ setup: function setup(__props) {
15
+ var route = useRoute();
16
+ var resolvedSrc = computed(function () {
17
+ return resolveIframeSrcFromRoute(route);
18
+ });
19
+ var iframeName = computed(function () {
20
+ var meta = route.meta || {};
21
+ return meta.iframeName || route.name || 'pro-iframe-route';
22
+ });
23
+ var iframeTitle = computed(function () {
24
+ var _route$query, _route$query2;
25
+ var meta = route.meta || {};
26
+ var fromQuery = ((_route$query = route.query) === null || _route$query === void 0 ? void 0 : _route$query.title) || ((_route$query2 = route.query) === null || _route$query2 === void 0 ? void 0 : _route$query2.iframeTitle);
27
+ var q = Array.isArray(fromQuery) ? fromQuery[0] : fromQuery;
28
+ return q && String(q) || meta.title || meta.iframeTitle || '';
29
+ });
30
+ var fixParentStyle = computed(function () {
31
+ var _route$meta;
32
+ return Boolean((_route$meta = route.meta) === null || _route$meta === void 0 ? void 0 : _route$meta.iframeFixParentStyle);
33
+ });
34
+ var iframeBindProps = computed(function () {
35
+ var meta = route.meta || {};
36
+ var extra = meta.iframeProps && _typeof(meta.iframeProps) === 'object' ? meta.iframeProps : {};
37
+ return _objectSpread({
38
+ loading: meta.iframeLoading !== false,
39
+ loadingText: meta.iframeLoadingText,
40
+ sandbox: meta.iframeSandbox,
41
+ allow: meta.iframeAllow,
42
+ lazy: Boolean(meta.iframeLazy),
43
+ full: meta.iframeFull !== false
44
+ }, extra);
45
+ });
46
+ return function (_ctx, _cache) {
47
+ return openBlock(), createBlock(script$1, mergeProps({
48
+ key: resolvedSrc.value,
49
+ src: resolvedSrc.value,
50
+ name: iframeName.value,
51
+ title: iframeTitle.value,
52
+ "append-route-query": false,
53
+ "fix-parent-style": fixParentStyle.value
54
+ }, iframeBindProps.value), createSlots({
55
+ _: 2 /* DYNAMIC */
56
+ }, [_ctx.$slots.toolbar ? {
57
+ name: "toolbar",
58
+ fn: withCtx(function (slotProps) {
59
+ return [renderSlot(_ctx.$slots, "toolbar", normalizeProps(guardReactiveProps(slotProps)))];
60
+ }),
61
+ key: "0"
62
+ } : undefined, _ctx.$slots.loading ? {
63
+ name: "loading",
64
+ fn: withCtx(function (slotProps) {
65
+ return [renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(slotProps)))];
66
+ }),
67
+ key: "1"
68
+ } : undefined, _ctx.$slots.error ? {
69
+ name: "error",
70
+ fn: withCtx(function (slotProps) {
71
+ return [renderSlot(_ctx.$slots, "error", normalizeProps(guardReactiveProps(slotProps)))];
72
+ }),
73
+ key: "2"
74
+ } : undefined, _ctx.$slots.empty ? {
75
+ name: "empty",
76
+ fn: withCtx(function () {
77
+ return [renderSlot(_ctx.$slots, "empty")];
78
+ }),
79
+ key: "3"
80
+ } : undefined]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["src", "name", "title", "fix-parent-style"]);
81
+ };
82
+ }
83
+ };
84
+
85
+ export { script as default };
@@ -0,0 +1,18 @@
1
+ import type { RouteLocationRaw } from 'vue-router';
2
+ export interface BuildIframeRouteLocationOptions {
3
+ /** 写入路由 query 的地址键,默认 `url` */
4
+ urlQueryKey?: string;
5
+ /** 页签/iframe 标题,写入 query.title(ProIframeRouteView 可读) */
6
+ title?: string;
7
+ /** 除 url 外一并传入的 query(会拼到内嵌页,需路由开启 iframeAppendQuery) */
8
+ query?: Record<string, string | number | boolean>;
9
+ params?: Record<string, string | number>;
10
+ }
11
+ /**
12
+ * 构造跳转到「动态 iframe 路由」的 location,避免在 router 表里写死内嵌 URL
13
+ *
14
+ * @example
15
+ * router.push(buildIframeRouteLocation('ProIframeView', '/examples/pro-table', { title: 'ProTable' }))
16
+ * router.push(buildIframeRouteLocation('ProIframeView', 'https://example.com/a', { query: { id: '1' } }))
17
+ */
18
+ export declare function buildIframeRouteLocation(routeName: string, iframeUrl: string, options?: BuildIframeRouteLocationOptions): RouteLocationRaw;
@@ -0,0 +1,34 @@
1
+ import '../_virtual/_rollup-plugin-inject-process-env.js';
2
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+
5
+ /**
6
+ * 构造跳转到「动态 iframe 路由」的 location,避免在 router 表里写死内嵌 URL
7
+ *
8
+ * @example
9
+ * router.push(buildIframeRouteLocation('ProIframeView', '/examples/pro-table', { title: 'ProTable' }))
10
+ * router.push(buildIframeRouteLocation('ProIframeView', 'https://example.com/a', { query: { id: '1' } }))
11
+ */
12
+ function buildIframeRouteLocation(routeName, iframeUrl) {
13
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
14
+ var urlQueryKey = options.urlQueryKey || 'url';
15
+ var query = _defineProperty({}, urlQueryKey, iframeUrl);
16
+ if (options.title) {
17
+ query.title = options.title;
18
+ }
19
+ if (options.query) {
20
+ Object.entries(options.query).forEach(function (_ref) {
21
+ var _ref2 = _slicedToArray(_ref, 2),
22
+ key = _ref2[0],
23
+ value = _ref2[1];
24
+ query[key] = String(value);
25
+ });
26
+ }
27
+ return {
28
+ name: routeName,
29
+ query: query,
30
+ params: options.params
31
+ };
32
+ }
33
+
34
+ export { buildIframeRouteLocation };
@@ -0,0 +1,33 @@
1
+ import type { RouteRecordRaw } from 'vue-router';
2
+ import type { ProIframeRouteMeta } from './types';
3
+ export interface CreateIframeRouteOptions {
4
+ path: string;
5
+ name: string;
6
+ /**
7
+ * 静态内嵌地址(可选)。
8
+ * 与 meta.iframeDynamic / iframeUrlTemplate 二选一;动态场景可不传,跳转时用 query.url 等传参。
9
+ */
10
+ iframeUrl?: string;
11
+ meta?: ProIframeRouteMeta & Record<string, unknown>;
12
+ /** 透传给 RouteRecordRaw 的其它字段 */
13
+ route?: Partial<RouteRecordRaw>;
14
+ }
15
+ /**
16
+ * 生成 iframe 内嵌路由配置,component 固定为 ProIframeRouteView
17
+ *
18
+ * @example 静态地址
19
+ * createIframeRoute({
20
+ * path: 'report',
21
+ * name: 'Report',
22
+ * iframeUrl: '/legacy/report',
23
+ * meta: { title: '报表' },
24
+ * })
25
+ *
26
+ * @example 动态地址(跳转时 buildIframeRouteLocation('ProIframeView', url))
27
+ * createIframeRoute({
28
+ * path: 'iframe/view',
29
+ * name: 'ProIframeView',
30
+ * meta: { title: '内嵌页', iframeDynamic: true },
31
+ * })
32
+ */
33
+ export declare function createIframeRoute(options: CreateIframeRouteOptions): RouteRecordRaw;
@@ -0,0 +1,46 @@
1
+ import '../_virtual/_rollup-plugin-inject-process-env.js';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
+ import './ProIframeRouteView.vue.js';
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ /**
7
+ * 生成 iframe 内嵌路由配置,component 固定为 ProIframeRouteView
8
+ *
9
+ * @example 静态地址
10
+ * createIframeRoute({
11
+ * path: 'report',
12
+ * name: 'Report',
13
+ * iframeUrl: '/legacy/report',
14
+ * meta: { title: '报表' },
15
+ * })
16
+ *
17
+ * @example 动态地址(跳转时 buildIframeRouteLocation('ProIframeView', url))
18
+ * createIframeRoute({
19
+ * path: 'iframe/view',
20
+ * name: 'ProIframeView',
21
+ * meta: { title: '内嵌页', iframeDynamic: true },
22
+ * })
23
+ */
24
+ function createIframeRoute(options) {
25
+ var path = options.path,
26
+ name = options.name,
27
+ iframeUrl = options.iframeUrl,
28
+ _options$meta = options.meta,
29
+ meta = _options$meta === void 0 ? {} : _options$meta,
30
+ _options$route = options.route,
31
+ route = _options$route === void 0 ? {} : _options$route;
32
+ var routeMeta = _objectSpread({
33
+ iframe: true
34
+ }, meta);
35
+ if (iframeUrl) {
36
+ routeMeta.iframeUrl = iframeUrl;
37
+ }
38
+ return _objectSpread({
39
+ path: path,
40
+ name: name,
41
+ component: script,
42
+ meta: routeMeta
43
+ }, route);
44
+ }
45
+
46
+ export { createIframeRoute };
@@ -0,0 +1,43 @@
1
+ import type { DefineComponent } from 'vue';
2
+ import type { RouteLocationNormalizedLoaded, RouteLocationRaw, RouteRecordRaw } from 'vue-router';
3
+ import type { BuildIframeRouteLocationOptions } from './buildIframeRouteLocation';
4
+ import type { CreateIframeRouteOptions } from './createIframeRoute';
5
+ import type { ProIframeProps, ProIframeRouteMeta } from './types';
6
+
7
+ declare const ProIframe: DefineComponent<ProIframeProps, Record<string, never>, any>;
8
+ declare const ProIframeRouteView: DefineComponent<Record<string, never>, Record<string, never>, any>;
9
+
10
+ export { ProIframe, ProIframeRouteView };
11
+ export {
12
+ resolveIframeSrcFromRoute,
13
+ appendQueryToUrl,
14
+ isIframeRoute,
15
+ decodeIframeUrlValue,
16
+ applyIframeUrlTemplate,
17
+ resolveDynamicIframeBaseUrl,
18
+ PRO_IFRAME_URL_QUERY_KEYS,
19
+ PRO_IFRAME_URL_RESERVED_QUERY_KEYS,
20
+ } from './resolveIframeSrc';
21
+ export { buildIframeRouteLocation } from './buildIframeRouteLocation';
22
+ export { isInIframeEmbed } from './isInIframeEmbed';
23
+ export { createIframeRoute } from './createIframeRoute';
24
+ export function isInIframeEmbed(): boolean;
25
+ export type { ProIframeRouteMeta, ProIframeProps, CreateIframeRouteOptions, BuildIframeRouteLocationOptions };
26
+
27
+ export function resolveIframeSrcFromRoute(route: RouteLocationNormalizedLoaded): string;
28
+ export function appendQueryToUrl(url: string, query: Record<string, string>): string;
29
+ export function isIframeRoute(route: RouteLocationNormalizedLoaded): boolean;
30
+ export function decodeIframeUrlValue(value: string): string;
31
+ export function applyIframeUrlTemplate(template: string, route: RouteLocationNormalizedLoaded): string;
32
+ export function resolveDynamicIframeBaseUrl(
33
+ route: RouteLocationNormalizedLoaded,
34
+ meta: ProIframeRouteMeta,
35
+ ): string;
36
+ export function buildIframeRouteLocation(
37
+ routeName: string,
38
+ iframeUrl: string,
39
+ options?: BuildIframeRouteLocationOptions,
40
+ ): RouteLocationRaw;
41
+ export function createIframeRoute(options: CreateIframeRouteOptions): RouteRecordRaw;
42
+
43
+ export default ProIframe;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 当前页面是否运行在 iframe 内(用于 Layout 内嵌模式:仅渲染 router-view,避免壳层套娃)
3
+ */
4
+ export declare function isInIframeEmbed(): boolean;
@@ -0,0 +1,15 @@
1
+ import '../_virtual/_rollup-plugin-inject-process-env.js';
2
+
3
+ /**
4
+ * 当前页面是否运行在 iframe 内(用于 Layout 内嵌模式:仅渲染 router-view,避免壳层套娃)
5
+ */
6
+ function isInIframeEmbed() {
7
+ if (typeof window === 'undefined') return false;
8
+ try {
9
+ return window.self !== window.top;
10
+ } catch (_unused) {
11
+ return true;
12
+ }
13
+ }
14
+
15
+ export { isInIframeEmbed };
@@ -0,0 +1,19 @@
1
+ import type { RouteLocationNormalizedLoaded } from 'vue-router';
2
+ import type { ProIframeRouteMeta } from './types';
3
+ /** 从 query / params 解析完整 iframe 地址时常用的键名(按优先级) */
4
+ export declare const PRO_IFRAME_URL_QUERY_KEYS: readonly ["iframeUrl", "url", "link", "src"];
5
+ export declare const PRO_IFRAME_URL_PARAM_KEYS: readonly ["iframeUrl", "url", "link", "src", "path"];
6
+ /** 作为 iframe 主地址的 query 键,默认不参与「拼接到内嵌页」 */
7
+ export declare const PRO_IFRAME_URL_RESERVED_QUERY_KEYS: readonly ["iframeUrl", "url", "link", "src", "title", "iframeTitle"];
8
+ /** 解码路由上的 url(支持 encodeURIComponent 后的完整地址) */
9
+ export declare function decodeIframeUrlValue(value: string): string;
10
+ /** 将 query 对象合并进 URL(覆盖同名 search 参数) */
11
+ export declare function appendQueryToUrl(url: string, query: Record<string, string>): string;
12
+ /** 将 meta.iframeUrl 中的 :param / :queryKey 占位替换为路由 params、query */
13
+ export declare function applyIframeUrlTemplate(template: string, route: RouteLocationNormalizedLoaded): string;
14
+ /** 从 query / params 动态解析 iframe 主地址 */
15
+ export declare function resolveDynamicIframeBaseUrl(route: RouteLocationNormalizedLoaded, meta: ProIframeRouteMeta): string;
16
+ /** 从路由 meta / query / params 解析 iframe 地址 */
17
+ export declare function resolveIframeSrcFromRoute(route: RouteLocationNormalizedLoaded): string;
18
+ /** 根据 meta 判断是否为 iframe 路由 */
19
+ export declare function isIframeRoute(route: RouteLocationNormalizedLoaded): boolean;
@@ -0,0 +1,177 @@
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
+
5
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
6
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
7
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
8
+ /** 从 query / params 解析完整 iframe 地址时常用的键名(按优先级) */
9
+ var PRO_IFRAME_URL_QUERY_KEYS = ['iframeUrl', 'url', 'link', 'src'];
10
+ var PRO_IFRAME_URL_PARAM_KEYS = ['iframeUrl', 'url', 'link', 'src', 'path'];
11
+
12
+ /** 作为 iframe 主地址的 query 键,默认不参与「拼接到内嵌页」 */
13
+ var PRO_IFRAME_URL_RESERVED_QUERY_KEYS = [].concat(PRO_IFRAME_URL_QUERY_KEYS, ['title', 'iframeTitle']);
14
+ function pickQuery(query, keys, exclude) {
15
+ var result = {};
16
+ var excludeSet = new Set(exclude || []);
17
+ var entries = Object.entries(query);
18
+ for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
19
+ var _entries$_i = _slicedToArray(_entries[_i], 2),
20
+ key = _entries$_i[0],
21
+ raw = _entries$_i[1];
22
+ if (excludeSet.has(key)) continue;
23
+ if (keys && !keys.includes(key)) continue;
24
+ if (raw == null) continue;
25
+ var value = Array.isArray(raw) ? raw[0] : raw;
26
+ if (value != null && value !== '') {
27
+ result[key] = String(value);
28
+ }
29
+ }
30
+ return result;
31
+ }
32
+ function pickRouteValue(bag, key) {
33
+ var raw = bag[key];
34
+ if (raw == null) return '';
35
+ var value = Array.isArray(raw) ? raw[0] : raw;
36
+ return value != null && value !== '' ? String(value) : '';
37
+ }
38
+
39
+ /** 解码路由上的 url(支持 encodeURIComponent 后的完整地址) */
40
+ function decodeIframeUrlValue(value) {
41
+ if (!value) return '';
42
+ try {
43
+ return decodeURIComponent(value);
44
+ } catch (_unused) {
45
+ return value;
46
+ }
47
+ }
48
+
49
+ /** 将 query 对象合并进 URL(覆盖同名 search 参数) */
50
+ function appendQueryToUrl(url, query) {
51
+ if (!url || !Object.keys(query).length) return url;
52
+ try {
53
+ var base = url.startsWith('/') && !url.startsWith('//') ? "".concat(typeof window !== 'undefined' ? window.location.origin : '').concat(url) : url;
54
+ var parsed = new URL(base);
55
+ Object.entries(query).forEach(function (_ref) {
56
+ var _ref2 = _slicedToArray(_ref, 2),
57
+ key = _ref2[0],
58
+ value = _ref2[1];
59
+ parsed.searchParams.set(key, value);
60
+ });
61
+ if (url.startsWith('/') && !url.startsWith('//')) {
62
+ return "".concat(parsed.pathname).concat(parsed.search).concat(parsed.hash);
63
+ }
64
+ return parsed.toString();
65
+ } catch (_unused2) {
66
+ var separator = url.includes('?') ? '&' : '?';
67
+ var qs = Object.entries(query).map(function (_ref3) {
68
+ var _ref4 = _slicedToArray(_ref3, 2),
69
+ k = _ref4[0],
70
+ v = _ref4[1];
71
+ return "".concat(encodeURIComponent(k), "=").concat(encodeURIComponent(v));
72
+ }).join('&');
73
+ return "".concat(url).concat(separator).concat(qs);
74
+ }
75
+ }
76
+ function normalizeIframeBaseUrl(url) {
77
+ var trimmed = (url || '').trim();
78
+ if (!trimmed) return '';
79
+ if (trimmed.startsWith('/') && !trimmed.startsWith('//')) {
80
+ if (typeof window !== 'undefined') {
81
+ return "".concat(window.location.origin).concat(trimmed);
82
+ }
83
+ }
84
+ return trimmed;
85
+ }
86
+
87
+ /** 将 meta.iframeUrl 中的 :param / :queryKey 占位替换为路由 params、query */
88
+ function applyIframeUrlTemplate(template, route) {
89
+ if (!template) return '';
90
+ return template.replace(/:([A-Za-z0-9_]+)/g, function (_, key) {
91
+ var fromParams = pickRouteValue(route.params, key);
92
+ if (fromParams) return decodeIframeUrlValue(fromParams);
93
+ var fromQuery = pickRouteValue(route.query, key);
94
+ if (fromQuery) return decodeIframeUrlValue(fromQuery);
95
+ return '';
96
+ });
97
+ }
98
+ function resolveUrlFromBag(bag, preferredKey) {
99
+ var fallbackKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : PRO_IFRAME_URL_QUERY_KEYS;
100
+ if (preferredKey) {
101
+ var v = pickRouteValue(bag, preferredKey);
102
+ if (v) return decodeIframeUrlValue(v);
103
+ }
104
+ var _iterator = _createForOfIteratorHelper(fallbackKeys),
105
+ _step;
106
+ try {
107
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
108
+ var key = _step.value;
109
+ var _v = pickRouteValue(bag, key);
110
+ if (_v) return decodeIframeUrlValue(_v);
111
+ }
112
+ } catch (err) {
113
+ _iterator.e(err);
114
+ } finally {
115
+ _iterator.f();
116
+ }
117
+ return '';
118
+ }
119
+
120
+ /** 从 query / params 动态解析 iframe 主地址 */
121
+ function resolveDynamicIframeBaseUrl(route, meta) {
122
+ var fromQuery = resolveUrlFromBag(route.query, meta.iframeUrlQueryKey, PRO_IFRAME_URL_QUERY_KEYS);
123
+ if (fromQuery) return fromQuery;
124
+ var fromParams = resolveUrlFromBag(route.params, meta.iframeUrlParamKey, PRO_IFRAME_URL_PARAM_KEYS);
125
+ if (fromParams) return fromParams;
126
+ return '';
127
+ }
128
+ function resolveStaticBaseUrl(route, meta) {
129
+ var template = meta.iframeUrlTemplate || meta.iframeUrl || meta.link || meta.url || '';
130
+ if (!template) return '';
131
+ if (template.includes(':')) {
132
+ return applyIframeUrlTemplate(template, route);
133
+ }
134
+ return template;
135
+ }
136
+
137
+ /** 从路由 meta / query / params 解析 iframe 地址 */
138
+ function resolveIframeSrcFromRoute(route) {
139
+ var meta = route.meta || {};
140
+ var base = '';
141
+ var dynamicEnabled = Boolean(meta.iframeDynamic || meta.iframeUrlFromQuery || meta.iframeUrlFromParams);
142
+ if (dynamicEnabled) {
143
+ base = resolveDynamicIframeBaseUrl(route, meta);
144
+ }
145
+ if (!base) {
146
+ base = resolveStaticBaseUrl(route, meta);
147
+ }
148
+ if (!base && dynamicEnabled) {
149
+ return '';
150
+ }
151
+ if (!base && !dynamicEnabled) {
152
+ base = resolveDynamicIframeBaseUrl(route, meta);
153
+ }
154
+ base = normalizeIframeBaseUrl(base);
155
+ if (!base) return '';
156
+ var appendQuery = meta.iframeAppendQuery !== false;
157
+ if (appendQuery) {
158
+ var _meta$iframeExcludeQu;
159
+ var exclude = (_meta$iframeExcludeQu = meta.iframeExcludeQueryKeys) !== null && _meta$iframeExcludeQu !== void 0 ? _meta$iframeExcludeQu : _toConsumableArray(PRO_IFRAME_URL_RESERVED_QUERY_KEYS);
160
+ var query = pickQuery(route.query, meta.iframeQueryKeys, exclude);
161
+ if (Object.keys(query).length) {
162
+ base = appendQueryToUrl(base, query);
163
+ }
164
+ }
165
+ if (typeof meta.iframeTransformSrc === 'function') {
166
+ base = meta.iframeTransformSrc(base, route);
167
+ }
168
+ return base;
169
+ }
170
+
171
+ /** 根据 meta 判断是否为 iframe 路由 */
172
+ function isIframeRoute(route) {
173
+ var meta = route.meta;
174
+ return Boolean((meta === null || meta === void 0 ? void 0 : meta.iframe) || (meta === null || meta === void 0 ? void 0 : meta.iframeDynamic) || (meta === null || meta === void 0 ? void 0 : meta.iframeUrlFromQuery) || (meta === null || meta === void 0 ? void 0 : meta.iframeUrlFromParams) || (meta === null || meta === void 0 ? void 0 : meta.iframeUrl) || (meta === null || meta === void 0 ? void 0 : meta.iframeUrlTemplate) || (meta === null || meta === void 0 ? void 0 : meta.link) || (meta === null || meta === void 0 ? void 0 : meta.url));
175
+ }
176
+
177
+ export { PRO_IFRAME_URL_PARAM_KEYS, PRO_IFRAME_URL_QUERY_KEYS, PRO_IFRAME_URL_RESERVED_QUERY_KEYS, appendQueryToUrl, applyIframeUrlTemplate, decodeIframeUrlValue, isIframeRoute, resolveDynamicIframeBaseUrl, resolveIframeSrcFromRoute };
@@ -0,0 +1,60 @@
1
+ import type { RouteLocationNormalizedLoaded } from 'vue-router';
2
+ /** 路由 meta 中用于 ProIframe 的约定字段 */
3
+ export interface ProIframeRouteMeta {
4
+ /** 标记为 iframe 路由(可选,供菜单/守卫识别) */
5
+ iframe?: boolean;
6
+ /**
7
+ * 动态模式:iframe 主地址从 query(url / iframeUrl / link / src)或 params 读取,
8
+ * 无需在路由表写死 iframeUrl
9
+ */
10
+ iframeDynamic?: boolean;
11
+ /** @deprecated 使用 iframeDynamic */
12
+ iframeUrlFromQuery?: boolean;
13
+ /** 从 route.params 读取主地址 */
14
+ iframeUrlFromParams?: boolean;
15
+ /** 指定 query 键作为主地址,默认按 iframeUrl > url > link > src 优先级 */
16
+ iframeUrlQueryKey?: string;
17
+ /** 指定 params 键作为主地址 */
18
+ iframeUrlParamKey?: string;
19
+ /** 静态内嵌地址;支持 :id 占位(来自 params / query) */
20
+ iframeUrl?: string;
21
+ /** 与 iframeUrl 相同,支持 :page 等占位 */
22
+ iframeUrlTemplate?: string;
23
+ link?: string;
24
+ url?: string;
25
+ /** 是否将当前路由 query 拼到 iframe src(排除 iframeExcludeQueryKeys),默认 true */
26
+ iframeAppendQuery?: boolean;
27
+ /** 仅合并指定 query 键;未设置则合并全部(排除保留键) */
28
+ iframeQueryKeys?: string[];
29
+ /** 不参与拼接到内嵌页的 query 键;默认排除 url/iframeUrl/link/src/title 等 */
30
+ iframeExcludeQueryKeys?: string[];
31
+ /** 解析完成后二次处理 src */
32
+ iframeTransformSrc?: (src: string, route: RouteLocationNormalizedLoaded) => string;
33
+ iframeName?: string;
34
+ iframeTitle?: string;
35
+ iframeLoading?: boolean;
36
+ iframeLoadingText?: string;
37
+ iframeSandbox?: string;
38
+ iframeAllow?: string;
39
+ iframeLazy?: boolean;
40
+ iframeFull?: boolean;
41
+ iframeFixParentStyle?: boolean;
42
+ iframeProps?: Record<string, unknown>;
43
+ }
44
+ export interface ProIframeProps {
45
+ src: string;
46
+ name?: string;
47
+ title?: string;
48
+ loading?: boolean;
49
+ loadingText?: string;
50
+ appendRouteQuery?: boolean;
51
+ sandbox?: string;
52
+ allow?: string;
53
+ referrerpolicy?: string;
54
+ frameborder?: string | number;
55
+ lazy?: boolean;
56
+ /** 占满父级内容区(ProLayout main) */
57
+ full?: boolean;
58
+ /** 子应用在父级 UAP/Ext iframe 中时,初始化父页样式修复 */
59
+ fixParentStyle?: boolean;
60
+ }