cloud-web-corejs 1.0.277 → 1.0.279

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.
@@ -0,0 +1,50 @@
1
+ const modules = {};
2
+ import vue from "vue";
3
+
4
+ // 壳组件懒加载:首屏只留本入口几十行;抽屉壳(含 select 逻辑、按钮公共模块)
5
+ // 随首次调用进独立 chunk,xform 渲染器与 formDialog 共享同一异步 chunk
6
+ let FormDrawerCtor = null;
7
+
8
+ function loadCtor() {
9
+ if (FormDrawerCtor) return Promise.resolve(FormDrawerCtor);
10
+ return import(
11
+ /* webpackChunkName: "form-drawer" */ "./drawer.vue"
12
+ ).then((m) => {
13
+ FormDrawerCtor = vue.extend(m.default);
14
+ return FormDrawerCtor;
15
+ });
16
+ }
17
+
18
+ /**
19
+ * JS 调用打开 formCode 抽屉。每次调用创建独立实例,支持叠开多层。
20
+ * options:{ formCode, title, size, direction, param, queryParam, conditionParam, plain,
21
+ * select: {multiple, rows, fieldKey, queryParam, onConfirm},
22
+ * buttons, showFooter, readonly, onReady, beforeConfirm, model, ... }
23
+ * resolve:默认按钮下 select 模式返回选中行数组、表单模式返回表单数据;
24
+ * 配置了自定义按钮(formConfig.actionButtons / options.buttons)返回 {action, data};
25
+ * 取消/关闭返回 null。详见 components/formDialog/README.md。
26
+ */
27
+ function open(options = {}) {
28
+ return loadCtor().then((Ctor) => {
29
+ const parent
30
+ = typeof window !== "undefined" && window.$vueRoot ? window.$vueRoot : null;
31
+ const instanceOptions = {};
32
+ if (parent) {
33
+ instanceOptions.parent = parent;
34
+ if (parent._i18n) {
35
+ instanceOptions.i18n = parent._i18n;
36
+ }
37
+ }
38
+ const instance = new Ctor(instanceOptions);
39
+ instance.$mount();
40
+ document.body.appendChild(instance.$el);
41
+ return instance.open(options);
42
+ });
43
+ }
44
+
45
+ modules.install = function (Vue) {
46
+ Vue.prototype.$formDrawer = open;
47
+ };
48
+ modules.open = open;
49
+
50
+ export default modules;