@cmstops/pro-compo 0.3.72 → 0.3.73-beta

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.
@@ -1,5 +1,6 @@
1
1
  import { defineComponent, computed, ref, onMounted, openBlock, createBlock, unref, withCtx, createTextVNode, toDisplayString, createVNode, createCommentVNode } from "vue";
2
2
  import { Modal, Tabs, TabPane, Button } from "@arco-design/web-vue";
3
+ import { Enum, License } from "@cmstops/utils";
3
4
  import _sfc_main$1 from "./components/ViewAllColumn/index.js";
4
5
  import _sfc_main$4 from "./components/CompoList/index.js";
5
6
  import _sfc_main$6 from "./components/MpAccountList/index.js";
@@ -44,7 +45,20 @@ const _sfc_main = defineComponent({
44
45
  const hasSelected = computed(() => {
45
46
  return selectedData.value.length > 0;
46
47
  });
47
- const typeDataController = ref(props.typeData);
48
+ const typeDataController = computed(() => {
49
+ const ret = props.typeData;
50
+ const appList = [
51
+ { license: "courselearning", key: "addCourse", type: Enum.CheckTypeEnum.MARKET },
52
+ { license: "maavd", key: "addMpAccount", type: Enum.CheckTypeEnum.MARKET },
53
+ { license: "maavd", key: "addMpContent", type: Enum.CheckTypeEnum.MARKET }
54
+ ];
55
+ appList.forEach((item) => {
56
+ if (!License.check(item.type, item.license)) {
57
+ ret[item.key] = false;
58
+ }
59
+ });
60
+ return ret;
61
+ });
48
62
  const setVisible = (bool) => {
49
63
  emit("update:visible", bool);
50
64
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent, openBlock, createElementBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, createElementVNode, createCommentVNode, createVNode, isRef, Fragment, createTextVNode } from "vue";
1
+ import { defineComponent, watch, openBlock, createElementBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, createElementVNode, createCommentVNode, createVNode, isRef, Fragment, createTextVNode } from "vue";
2
2
  import { Drawer, Modal, Button } from "@arco-design/web-vue";
3
3
  import emptyData from "../emptyData/index.js";
4
4
  import _sfc_main$1 from "./components/ListTabs/index.js";
@@ -33,7 +33,19 @@ const _sfc_main = defineComponent({
33
33
  const emits = __emit;
34
34
  const { selected, selectedKeys, disableSelect, handleSelect, handleClear } = useResourceSelect(props);
35
35
  const { activeKey, activeComponent, tabKeyList, handelChangeTab } = useTabFilter(props);
36
- const { wrapProps, close, submit } = useCompoentLifycycle(props, emits);
36
+ const { wrapProps, close, submit } = useCompoentLifycycle(props, emits, {
37
+ onClose: () => {
38
+ handleClear();
39
+ }
40
+ });
41
+ watch(
42
+ () => props.visible,
43
+ (val) => {
44
+ if (val)
45
+ activeKey.value = tabKeyList.value[0].key;
46
+ },
47
+ { immediate: true }
48
+ );
37
49
  const handleOptions = (options, handleOptions2) => {
38
50
  const { key, item } = options;
39
51
  if (key === "select-one") {
@@ -70,7 +82,8 @@ const _sfc_main = defineComponent({
70
82
  onClose: unref(close)
71
83
  }, null, 8, ["model-value", "tabList", "onClose"]),
72
84
  createCommentVNode(" \u5217\u8868\u5206\u53D1\u5668 "),
73
- (openBlock(), createBlock(resolveDynamicComponent(unref(activeComponent)), {
85
+ _ctx.visible ? (openBlock(), createBlock(resolveDynamicComponent(unref(activeComponent)), {
86
+ key: 0,
74
87
  "active-key": unref(activeKey),
75
88
  onChangeTab: unref(handelChangeTab)
76
89
  }, {
@@ -136,7 +149,7 @@ const _sfc_main = defineComponent({
136
149
  ], 64))
137
150
  ]),
138
151
  _: 1
139
- }, 40, ["active-key", "onChangeTab"]))
152
+ }, 40, ["active-key", "onChangeTab"])) : createCommentVNode("v-if", true)
140
153
  ])) : (openBlock(), createBlock(unref(emptyData), {
141
154
  key: 1,
142
155
  type: "empty",
@@ -1,9 +1,13 @@
1
- export default function useCompoentLifycycle(props: any, emits: any): {
1
+ declare type LifeCycleHandler = {
2
+ onClose: () => void;
3
+ };
4
+ export default function useCompoentLifycycle(props: any, emits: any, handler?: LifeCycleHandler): {
2
5
  wrapProps: import("vue").ComputedRef<{
3
6
  class: string;
4
7
  header: boolean;
5
8
  width: string;
6
9
  footer: boolean;
10
+ unmountOnClose: boolean;
7
11
  bodyClass?: undefined;
8
12
  closable?: undefined;
9
13
  hideTitle?: undefined;
@@ -13,9 +17,11 @@ export default function useCompoentLifycycle(props: any, emits: any): {
13
17
  closable: boolean;
14
18
  hideTitle: boolean;
15
19
  footer: boolean;
20
+ unmountOnClose: boolean;
16
21
  class?: undefined;
17
22
  header?: undefined;
18
23
  }>;
19
- close: () => any;
24
+ close: () => void;
20
25
  submit: (data: any, ...args: any) => void;
21
26
  };
27
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { computed, provide } from "vue";
2
2
  import { DEFAULT_BASE_API } from "../../config.js";
3
- function useCompoentLifycycle(props, emits) {
3
+ function useCompoentLifycycle(props, emits, handler) {
4
4
  const BASE_API = props.BASE_API || DEFAULT_BASE_API;
5
5
  const wrapProps = computed(() => {
6
6
  if (props.wrap === "drawer") {
@@ -8,7 +8,8 @@ function useCompoentLifycycle(props, emits) {
8
8
  class: "resource-select-drawer",
9
9
  header: false,
10
10
  width: "1024px",
11
- footer: false
11
+ footer: false,
12
+ unmountOnClose: true
12
13
  };
13
14
  }
14
15
  return {
@@ -16,7 +17,8 @@ function useCompoentLifycycle(props, emits) {
16
17
  width: "986px",
17
18
  closable: false,
18
19
  hideTitle: false,
19
- footer: false
20
+ footer: false,
21
+ unmountOnClose: true
20
22
  };
21
23
  });
22
24
  provide("baseAPI", BASE_API);
@@ -25,12 +27,16 @@ function useCompoentLifycycle(props, emits) {
25
27
  provide("mediaUseType", computed(() => props.mediaUseType));
26
28
  provide("aiThumbList", computed(() => props.aiThumbList));
27
29
  provide("videoThumbOptions", computed(() => props.videoThumbOptions));
30
+ function close() {
31
+ emits("update:visible", false);
32
+ handler == null ? void 0 : handler.onClose();
33
+ }
28
34
  return {
29
35
  wrapProps,
30
- close: () => emits("update:visible", false),
36
+ close,
31
37
  submit: (data, ...args) => {
32
38
  emits("submit", JSON.parse(JSON.stringify(data)), ...args);
33
- emits("update:visible", false);
39
+ close();
34
40
  }
35
41
  };
36
42
  }
@@ -26,7 +26,6 @@ function useTabFilter(props) {
26
26
  keys.unshift("ai");
27
27
  if (videoThumbOptions)
28
28
  keys.unshift("video");
29
- [activeKey.value] = keys;
30
29
  return keys.map((key) => ({
31
30
  key,
32
31
  title: TAB_DICT[key].title
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  var vue = require("vue");
3
3
  var webVue = require("@arco-design/web-vue");
4
+ var utils = require("@cmstops/utils");
4
5
  var index = require("./components/ViewAllColumn/index.js");
5
6
  var index$3 = require("./components/CompoList/index.js");
6
7
  var index$5 = require("./components/MpAccountList/index.js");
@@ -45,7 +46,20 @@ const _sfc_main = vue.defineComponent({
45
46
  const hasSelected = vue.computed(() => {
46
47
  return selectedData.value.length > 0;
47
48
  });
48
- const typeDataController = vue.ref(props.typeData);
49
+ const typeDataController = vue.computed(() => {
50
+ const ret = props.typeData;
51
+ const appList = [
52
+ { license: "courselearning", key: "addCourse", type: utils.Enum.CheckTypeEnum.MARKET },
53
+ { license: "maavd", key: "addMpAccount", type: utils.Enum.CheckTypeEnum.MARKET },
54
+ { license: "maavd", key: "addMpContent", type: utils.Enum.CheckTypeEnum.MARKET }
55
+ ];
56
+ appList.forEach((item) => {
57
+ if (!utils.License.check(item.type, item.license)) {
58
+ ret[item.key] = false;
59
+ }
60
+ });
61
+ return ret;
62
+ });
49
63
  const setVisible = (bool) => {
50
64
  emit("update:visible", bool);
51
65
  };
@@ -34,7 +34,19 @@ const _sfc_main = vue.defineComponent({
34
34
  const emits = __emit;
35
35
  const { selected, selectedKeys, disableSelect, handleSelect, handleClear } = useResourceSelect.useResourceSelect(props);
36
36
  const { activeKey, activeComponent, tabKeyList, handelChangeTab } = useTabFilter(props);
37
- const { wrapProps, close, submit } = useCompoLf(props, emits);
37
+ const { wrapProps, close, submit } = useCompoLf(props, emits, {
38
+ onClose: () => {
39
+ handleClear();
40
+ }
41
+ });
42
+ vue.watch(
43
+ () => props.visible,
44
+ (val) => {
45
+ if (val)
46
+ activeKey.value = tabKeyList.value[0].key;
47
+ },
48
+ { immediate: true }
49
+ );
38
50
  const handleOptions = (options, handleOptions2) => {
39
51
  const { key, item } = options;
40
52
  if (key === "select-one") {
@@ -71,7 +83,8 @@ const _sfc_main = vue.defineComponent({
71
83
  onClose: vue.unref(close)
72
84
  }, null, 8, ["model-value", "tabList", "onClose"]),
73
85
  vue.createCommentVNode(" \u5217\u8868\u5206\u53D1\u5668 "),
74
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), {
86
+ _ctx.visible ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), {
87
+ key: 0,
75
88
  "active-key": vue.unref(activeKey),
76
89
  onChangeTab: vue.unref(handelChangeTab)
77
90
  }, {
@@ -137,7 +150,7 @@ const _sfc_main = vue.defineComponent({
137
150
  ], 64))
138
151
  ]),
139
152
  _: 1
140
- }, 40, ["active-key", "onChangeTab"]))
153
+ }, 40, ["active-key", "onChangeTab"])) : vue.createCommentVNode("v-if", true)
141
154
  ])) : (vue.openBlock(), vue.createBlock(vue.unref(index$2), {
142
155
  key: 1,
143
156
  type: "empty",
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var vue = require("vue");
3
3
  var config = require("../../config.js");
4
- function useCompoentLifycycle(props, emits) {
4
+ function useCompoentLifycycle(props, emits, handler) {
5
5
  const BASE_API = props.BASE_API || config.DEFAULT_BASE_API;
6
6
  const wrapProps = vue.computed(() => {
7
7
  if (props.wrap === "drawer") {
@@ -9,7 +9,8 @@ function useCompoentLifycycle(props, emits) {
9
9
  class: "resource-select-drawer",
10
10
  header: false,
11
11
  width: "1024px",
12
- footer: false
12
+ footer: false,
13
+ unmountOnClose: true
13
14
  };
14
15
  }
15
16
  return {
@@ -17,7 +18,8 @@ function useCompoentLifycycle(props, emits) {
17
18
  width: "986px",
18
19
  closable: false,
19
20
  hideTitle: false,
20
- footer: false
21
+ footer: false,
22
+ unmountOnClose: true
21
23
  };
22
24
  });
23
25
  vue.provide("baseAPI", BASE_API);
@@ -26,12 +28,16 @@ function useCompoentLifycycle(props, emits) {
26
28
  vue.provide("mediaUseType", vue.computed(() => props.mediaUseType));
27
29
  vue.provide("aiThumbList", vue.computed(() => props.aiThumbList));
28
30
  vue.provide("videoThumbOptions", vue.computed(() => props.videoThumbOptions));
31
+ function close() {
32
+ emits("update:visible", false);
33
+ handler == null ? void 0 : handler.onClose();
34
+ }
29
35
  return {
30
36
  wrapProps,
31
- close: () => emits("update:visible", false),
37
+ close,
32
38
  submit: (data, ...args) => {
33
39
  emits("submit", JSON.parse(JSON.stringify(data)), ...args);
34
- emits("update:visible", false);
40
+ close();
35
41
  }
36
42
  };
37
43
  }
@@ -27,7 +27,6 @@ function useTabFilter(props) {
27
27
  keys.unshift("ai");
28
28
  if (videoThumbOptions)
29
29
  keys.unshift("video");
30
- [activeKey.value] = keys;
31
30
  return keys.map((key) => ({
32
31
  key,
33
32
  title: TAB_DICT[key].title
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmstops/pro-compo",
3
- "version": "0.3.72",
3
+ "version": "0.3.73-beta",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vue",
@@ -133,5 +133,8 @@
133
133
  "es",
134
134
  "lib",
135
135
  "dist"
136
- ]
136
+ ],
137
+ "dependencies": {
138
+ "@cmstops/utils": "^1.0.4"
139
+ }
137
140
  }