@truenewx/tnxvue3 3.0.0-alpha.8 → 3.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truenewx/tnxvue3",
3
- "version": "3.0.0-alpha.8",
3
+ "version": "3.0.0",
4
4
  "description": "互联网技术解决方案:Vue3扩展支持",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -20,14 +20,13 @@
20
20
  },
21
21
  "peerDependencies": {
22
22
  "element-plus": "~2.8.0",
23
- "vue": "~3.4.0",
23
+ "vue": "~3.5.0",
24
24
  "vue-router": "~4.4.0"
25
25
  },
26
26
  "dependencies": {
27
- "@truenewx/tnxcore": "3.0.0-alpha.4",
27
+ "@truenewx/tnxcore": "3.0.0",
28
28
  "@element-plus/icons-vue": "2.3.1",
29
29
  "async-validator": "4.2.5",
30
- "crypto-js": "4.2.0",
31
30
  "mitt": "3.0.1"
32
31
  },
33
32
  "devDependencies": {
@@ -65,6 +64,9 @@
65
64
  ],
66
65
  "no-undef": "warn",
67
66
  "no-useless-escape": "warn",
67
+ "no-empty": "off",
68
+ "vue/no-side-effects-in-computed-properties": "warn",
69
+ "vue/no-mutating-props": "warn",
68
70
  "vue/no-v-model-argument": "off",
69
71
  "vue/multi-word-component-names": "off"
70
72
  }
@@ -1,11 +1,12 @@
1
- import CryptoJS from 'crypto-js'
1
+ import CryptoES from 'crypto-es';
2
+
2
3
  /**
3
4
  * @word 要加密的内容
4
5
  * @keyWord String 服务器随机返回的关键字
5
6
  * */
6
- export function aesEncrypt(word,keyWord="XwKsGlMcdPMEhR1B"){
7
- let key = CryptoJS.enc.Utf8.parse(keyWord);
8
- let srcs = CryptoJS.enc.Utf8.parse(word);
9
- let encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
10
- return encrypted.toString();
7
+ export function aesEncrypt(word, keyWord = "XwKsGlMcdPMEhR1B") {
8
+ let key = CryptoES.enc.Utf8.parse(keyWord);
9
+ let srcs = CryptoES.enc.Utf8.parse(word);
10
+ let encrypted = CryptoES.AES.encrypt(srcs, key, {mode: CryptoES.mode.ECB, padding: CryptoES.pad.Pkcs7});
11
+ return encrypted.toString();
11
12
  }
@@ -1,8 +1,11 @@
1
1
  <template>
2
- <el-tooltip :content="tooltipContent" :placement="tooltipPlacement" :disabled="disabled || !tooltipContent"
3
- v-if="disabled === false || disabledTip !== false">
4
- <el-dropdown split-button :type="type" :class="className" :disabled="disabled" :title="title" :size="size"
5
- :style="$attrs.style" @click="clickButton" @command="clickItem" v-if="dropdownItems.length">
2
+ <el-tooltip
3
+ :content="tooltipContent"
4
+ :placement="tooltipPlacement"
5
+ :show-after="tooltipShowAfter"
6
+ :disabled="finalDisabled || !tooltipContent">
7
+ <el-dropdown split-button :type="type" :class="className" :disabled="finalDisabled" :title="title" :size="size"
8
+ :style="$attrs.style" @click="clickButton" @command="clickItem" v-if="dropdownItems.length">
6
9
  <i :class="icon" style="margin-right: 0.5rem;" v-if="icon"></i>
7
10
  <template v-if="!hiddenCaption">
8
11
  <slot v-if="$slots.default"></slot>
@@ -11,18 +14,30 @@
11
14
  <template #dropdown>
12
15
  <el-dropdown-menu>
13
16
  <el-dropdown-item v-for="dropdownItem of dropdownItems" :key="dropdownItem.path"
14
- :icon="dropdownItem.icon" :disabled="dropdownItem.disabled"
15
- :title="dropdownItem.title"
16
- :command="dropdownItem">
17
+ :icon="dropdownItem.icon" :disabled="dropdownItem.disabled"
18
+ :title="dropdownItem.title"
19
+ :command="dropdownItem">
17
20
  {{ dropdownItem.caption || (dropdownItem.menuItem ? dropdownItem.menuItem.caption : '') }}
18
21
  </el-dropdown-item>
19
22
  </el-dropdown-menu>
20
23
  </template>
21
24
  </el-dropdown>
22
- <el-button :type="type" :class="className" :disabled="disabled" :title="title" @click="clickButton" :size="size"
23
- :loading="loading" :plain="plain" :link="link" :text="text" :bg="bg" :autofocus="autofocus"
24
- :round="round"
25
- :circle="circle" :style="$attrs.style" v-else>
25
+ <el-button :type="type"
26
+ :class="className"
27
+ :disabled="finalDisabled"
28
+ :title="title"
29
+ @click="clickButton"
30
+ :size="size"
31
+ :loading="loading"
32
+ :plain="plain"
33
+ :link="link"
34
+ :text="text"
35
+ :bg="bg"
36
+ :autofocus="autofocus"
37
+ :round="round"
38
+ :circle="circle"
39
+ :style="$attrs.style"
40
+ v-else>
26
41
  <tnxel-icon :value="icon" v-if="icon"/>
27
42
  <span v-if="!hiddenCaption && ($slots.default || menuItem)">
28
43
  <slot>{{ menuItem ? menuItem.caption : '' }}</slot>
@@ -52,7 +67,13 @@ export default {
52
67
  },
53
68
  type: String,
54
69
  icon: String,
55
- size: String,
70
+ size: {
71
+ type: String,
72
+ validator: value => {
73
+ return ['small', 'default', 'large'].includes(value);
74
+ },
75
+ default: 'default',
76
+ },
56
77
  loading: Boolean,
57
78
  plain: Boolean,
58
79
  link: Boolean,
@@ -69,6 +90,11 @@ export default {
69
90
  type: String,
70
91
  default: 'top',
71
92
  },
93
+ tooltipShowAfter: Number,
94
+ disabled: {
95
+ type: Boolean,
96
+ default: false,
97
+ },
72
98
  disabledTip: {
73
99
  type: [String, Boolean],
74
100
  default: '没有操作权限',
@@ -84,7 +110,7 @@ export default {
84
110
  }
85
111
  return {
86
112
  menuItem: menuItem,
87
- disabled: null,
113
+ finalDisabled: this.disabled,
88
114
  dropdownItems: [],
89
115
  }
90
116
  },
@@ -106,7 +132,13 @@ export default {
106
132
  return undefined;
107
133
  },
108
134
  title() {
109
- return this.disabled ? this.disabledTip : this.$attrs.title;
135
+ if (this.finalDisabled) {
136
+ if (this.disabledTip === false) {
137
+ return undefined;
138
+ }
139
+ return this.disabledTip;
140
+ }
141
+ return this.$attrs.title;
110
142
  }
111
143
  },
112
144
  created() {
@@ -116,6 +148,9 @@ export default {
116
148
  granted() {
117
149
  this.init();
118
150
  },
151
+ disabled() {
152
+ this.init();
153
+ },
119
154
  dropdown() {
120
155
  this.buildDropdownItems();
121
156
  },
@@ -123,11 +158,11 @@ export default {
123
158
  methods: {
124
159
  init() {
125
160
  if (this.granted !== null) {
126
- this.disabled = !this.granted;
161
+ this.finalDisabled = this.disabled || !this.granted;
127
162
  } else if (this.menu && this.path) {
128
163
  let vm = this;
129
164
  this.menu.loadGrantedItems(function () {
130
- vm.disabled = !vm.menu.isGranted(vm.path);
165
+ vm.finalDisabled = this.disabled || !vm.menu.isGranted(vm.path);
131
166
  vm.buildDropdownItems();
132
167
  });
133
168
  }
@@ -15,7 +15,7 @@
15
15
  </template>
16
16
 
17
17
  <script>
18
- import * as $ from 'jquery';
18
+ import $ from 'cash-dom';
19
19
 
20
20
  const util = window.tnx.util;
21
21
 
@@ -31,7 +31,7 @@
31
31
  </template>
32
32
 
33
33
  <script>
34
- import $ from 'jquery';
34
+ import $ from 'cash-dom';
35
35
  import DialogContent from './DialogContent.vue';
36
36
 
37
37
  const util = window.tnx.util;
@@ -42,7 +42,10 @@ export default {
42
42
  'tnxel-dialog-content': DialogContent,
43
43
  },
44
44
  props: {
45
- id: window.tnx.util.string.uuid32(),
45
+ id: {
46
+ type: String,
47
+ default: () => window.tnx.util.string.uuid32(),
48
+ },
46
49
  modelValue: Boolean,
47
50
  container: String,
48
51
  title: String,
@@ -153,7 +156,7 @@ export default {
153
156
  }
154
157
  }
155
158
  if (!$dialog || !$dialog.length) {
156
- $dialog = $('.el-dialog__wrapper[data-v-id="' + this.id + '"] .el-dialog:last');
159
+ $dialog = $('.tnxel-dialog[data-v-id="' + this.id + '"]');
157
160
  }
158
161
  if ($dialog.length) {
159
162
  let top = window.tnx.util.dom.getTopVerticallyCenteredOnPage($dialog[0]);
@@ -13,8 +13,11 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
+ import TnxelIcon from '../icon/Icon.vue'
17
+
16
18
  export default {
17
19
  name: 'TnxelDropdownItem',
20
+ components: {TnxelIcon},
18
21
  props: {
19
22
  icon: String,
20
23
  iconSize: Number,