@truenewx/tnxvue3 3.0.0-alpha.9 → 3.0.1

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 (34) hide show
  1. package/package.json +7 -4
  2. package/src/aj-captcha/utils/ase.js +7 -6
  3. package/src/bootstrap-vue/button/Button.vue +26 -0
  4. package/src/bootstrap-vue/enum-select/EnumSelect.vue +133 -0
  5. package/src/bootstrap-vue/loading/Loading.vue +43 -0
  6. package/src/bootstrap-vue/pagination/Pagination.vue +102 -0
  7. package/src/bootstrap-vue/query-table/QueryTable.vue +84 -0
  8. package/src/bootstrap-vue/select/Select.vue +348 -0
  9. package/src/bootstrap-vue/tnxbsv.css +31 -0
  10. package/src/bootstrap-vue/tnxbsv.js +42 -0
  11. package/src/element-plus/button/Button.vue +51 -16
  12. package/src/element-plus/date-picker/DatePicker.vue +1 -1
  13. package/src/element-plus/dialog/Dialog.vue +19 -16
  14. package/src/element-plus/dropdown-item/DropdownItem.vue +3 -0
  15. package/src/element-plus/edit-table/EditTable.vue +602 -0
  16. package/src/element-plus/enum-select/EnumSelect.vue +29 -9
  17. package/src/element-plus/enum-view/EnumView.vue +41 -0
  18. package/src/element-plus/fss-upload/FssUpload.vue +2 -2
  19. package/src/element-plus/icon/Icon.vue +76 -1
  20. package/src/element-plus/input-dropdown/InputDropdown.vue +74 -0
  21. package/src/element-plus/input-number/InputNumber.vue +17 -13
  22. package/src/element-plus/query-table/QueryTable.vue +1 -1
  23. package/src/element-plus/select/Select.vue +65 -23
  24. package/src/element-plus/steps-nav/StepsNav.vue +2 -2
  25. package/src/element-plus/submit-form/SubmitForm.vue +22 -6
  26. package/src/element-plus/tabs/Tabs.vue +13 -1
  27. package/src/element-plus/tnxel.css +31 -37
  28. package/src/element-plus/tnxel.js +38 -17
  29. package/src/element-plus/toolbar/ToolBarItem.js +15 -0
  30. package/src/element-plus/toolbar/ToolBarItem.vue +53 -0
  31. package/src/element-plus/toolbar/Toolbar.vue +56 -0
  32. package/src/element-plus/upload/Upload.vue +26 -25
  33. package/src/tnxvue-router.js +32 -22
  34. package/src/tnxvue.js +71 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truenewx/tnxvue3",
3
- "version": "3.0.0-alpha.9",
3
+ "version": "3.0.1",
4
4
  "description": "互联网技术解决方案:Vue3扩展支持",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -20,14 +20,14 @@
20
20
  },
21
21
  "peerDependencies": {
22
22
  "element-plus": "~2.8.0",
23
- "vue": "~3.4.0",
23
+ "bootstrap-vue-next": "~0.26.0",
24
+ "vue": "~3.5.0",
24
25
  "vue-router": "~4.4.0"
25
26
  },
26
27
  "dependencies": {
27
- "@truenewx/tnxcore": "3.0.0-alpha.4",
28
+ "@truenewx/tnxcore": "3.0.1",
28
29
  "@element-plus/icons-vue": "2.3.1",
29
30
  "async-validator": "4.2.5",
30
- "crypto-js": "4.2.0",
31
31
  "mitt": "3.0.1"
32
32
  },
33
33
  "devDependencies": {
@@ -65,6 +65,9 @@
65
65
  ],
66
66
  "no-undef": "warn",
67
67
  "no-useless-escape": "warn",
68
+ "no-empty": "off",
69
+ "vue/no-side-effects-in-computed-properties": "warn",
70
+ "vue/no-mutating-props": "warn",
68
71
  "vue/no-v-model-argument": "off",
69
72
  "vue/multi-word-component-names": "off"
70
73
  }
@@ -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
  }
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <BButton>
3
+ <i :class="icon" v-if="icon"></i>
4
+ <span><slot></slot></span>
5
+ </BButton>
6
+ </template>
7
+
8
+ <script>
9
+ import {BButton} from 'bootstrap-vue-next';
10
+
11
+ export default {
12
+ name: 'TnxbsvButton',
13
+ components: {BButton},
14
+ props: {
15
+ icon: String,
16
+ },
17
+ data() {
18
+ return {};
19
+ },
20
+ methods: {}
21
+ }
22
+ </script>
23
+
24
+ <style>
25
+
26
+ </style>
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <Select v-model="model"
3
+ :id="id"
4
+ :selector="selector"
5
+ :items="items"
6
+ value-name="key" text-name="caption" index-name="searchIndex"
7
+ :default-value="defaultValue"
8
+ :empty="empty"
9
+ :empty-value="emptyValue"
10
+ :placeholder="placeholder"
11
+ :disabled="disabled"
12
+ :filterable="filterable"
13
+ :theme="theme"
14
+ :size="size"
15
+ :tag-click="tagClick"
16
+ :change="change"
17
+ />
18
+ </template>
19
+
20
+ <script>
21
+ import Select, {isMultiSelector} from '../select/Select.vue';
22
+
23
+ export default {
24
+ name: 'TnxbsvEnumSelect',
25
+ components: {Select},
26
+ props: {
27
+ id: [Number, String],
28
+ modelValue: [String, Number, Boolean, Array],
29
+ selector: String,
30
+ type: {
31
+ type: String,
32
+ required: true,
33
+ },
34
+ subtype: String,
35
+ defaultValue: String,
36
+ empty: {
37
+ type: [Boolean, String],
38
+ default: false,
39
+ },
40
+ emptyValue: {
41
+ type: [String, Number, Boolean, Array],
42
+ default: '', // 设为null会告警,暂时先设为空字符,在非字符串类型的情况下是否有问题,有待检验
43
+ },
44
+ placeholder: String,
45
+ disabled: Boolean,
46
+ tagClick: Function,
47
+ change: Function,
48
+ grouped: {
49
+ type: Boolean,
50
+ default: false,
51
+ },
52
+ filterable: Boolean,
53
+ theme: String,
54
+ size: String,
55
+ app: {
56
+ type: String,
57
+ default: () => window.tnx.componentDefaultApp, // 设置为方法以延时加载,确保更改的值生效
58
+ },
59
+ },
60
+ emits: ['update:modelValue'],
61
+ data() {
62
+ return {
63
+ model: this.modelValue,
64
+ items: null,
65
+ };
66
+ },
67
+ watch: {
68
+ model(value) {
69
+ this.$emit('update:modelValue', value);
70
+ },
71
+ modelValue() {
72
+ this.initModel();
73
+ },
74
+ type() {
75
+ this.init();
76
+ },
77
+ subtype() {
78
+ this.init();
79
+ }
80
+ },
81
+ mounted() {
82
+ this.init();
83
+ },
84
+ methods: {
85
+ init() {
86
+ if (typeof this.type === 'string') {
87
+ if (this.type.toLowerCase() === 'boolean') {
88
+ this.items = [{
89
+ key: true,
90
+ caption: true.toText(),
91
+ }, {
92
+ key: false,
93
+ caption: false.toText(),
94
+ }];
95
+ this.initModel();
96
+ } else {
97
+ let vm = this;
98
+ window.tnx.app.rpc.loadEnumItems(this.type, this.subtype, function (items) {
99
+ vm.items = items;
100
+ vm.initModel();
101
+ }, {
102
+ app: this.app,
103
+ });
104
+ }
105
+ }
106
+ },
107
+ initModel() {
108
+ let oldModel = this.model;
109
+ this.model = this.modelValue;
110
+ if (isMultiSelector(this.selector)) {
111
+ return;
112
+ }
113
+ if ((this.model === undefined || this.model === null) && !this.empty && this.items && this.items.length) {
114
+ let item = this.items[0];
115
+ this.model = item.key;
116
+ if (this.model !== oldModel && this.change) {
117
+ this.change(item);
118
+ }
119
+ }
120
+ },
121
+ getText(value) {
122
+ // 暂不支持分组枚举类型
123
+ if (this.$refs.select) {
124
+ return this.$refs.select.getText(value);
125
+ }
126
+ return undefined;
127
+ },
128
+ disableItem(itemKey, disabled, reverseOther) {
129
+ this.$refs.select.disableItem(itemKey, disabled, reverseOther);
130
+ },
131
+ }
132
+ }
133
+ </script>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <div class="spinner-border" :class="extraClass" role="status">
3
+ <span class="visually-hidden">{{ text }}</span>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+
9
+ export default {
10
+ name: 'TnxbsvLoading',
11
+ props: {
12
+ small: {
13
+ type: Boolean,
14
+ default: true,
15
+ },
16
+ theme: {
17
+ type: String,
18
+ default: 'secondary',
19
+ },
20
+ text: {
21
+ type: String,
22
+ default: '加载中...',
23
+ }
24
+ },
25
+ data() {
26
+ return {};
27
+ },
28
+ computed: {
29
+ extraClass() {
30
+ let extraClass = 'text-' + this.theme;
31
+ if (this.small) {
32
+ extraClass += ' spinner-border-sm';
33
+ }
34
+ return extraClass;
35
+ },
36
+ },
37
+ methods: {}
38
+ }
39
+ </script>
40
+
41
+ <style>
42
+
43
+ </style>
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div class="tnxbsv-pagination" :class="'justify-content-' + align" v-if="paged">
3
+ <div class="pagination-text">
4
+ <span>每页</span>
5
+ <Select v-model="pageSize" :items="pageSizeItems" v-if="pageSizeChangeable"/>
6
+ <span class="mx-1" v-else>{{ pageSize }}</span>
7
+ <span>条,共</span>
8
+ <span class="mx-1">{{ paged.total }}</span>
9
+ <span>条</span>
10
+ </div>
11
+ <BPagination v-model="pageNo"
12
+ :total-rows="paged.total"
13
+ :per-page="paged.pageSize"
14
+ :aria-controls="ariaControls"
15
+ :aria-label="ariaLabel"
16
+ />
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import {BPagination} from 'bootstrap-vue-next';
22
+ import Select from '../select/Select.vue';
23
+
24
+ export default {
25
+ name: 'TnxbsvPagination',
26
+ components: {BPagination, Select},
27
+ props: {
28
+ paged: Object,
29
+ pageSizeChangeable: Boolean,
30
+ align: {
31
+ type: String,
32
+ default: 'end', // start | center | end
33
+ },
34
+ ariaControls: String,
35
+ ariaLabel: String,
36
+ query: Function,
37
+ },
38
+ data() {
39
+ return {
40
+ pageSize: this.paged?.pageSize || 20,
41
+ pageNo: this.paged?.pageNo || 1,
42
+ };
43
+ },
44
+ computed: {
45
+ pageSizeItems() {
46
+ return [{
47
+ value: 10,
48
+ text: '10',
49
+ }, {
50
+ value: 20,
51
+ text: '20',
52
+ }, {
53
+ value: 50,
54
+ text: '50',
55
+ }];
56
+ },
57
+ },
58
+ watch: {
59
+ pageNo() {
60
+ this.toQuery();
61
+ },
62
+ pageSize() {
63
+ this.toQuery();
64
+ },
65
+ },
66
+ methods: {
67
+ toQuery() {
68
+ if (this.query) {
69
+ this.query({
70
+ pageSize: this.pageSize,
71
+ pageNo: this.pageNo,
72
+ });
73
+ }
74
+ },
75
+ }
76
+ }
77
+ </script>
78
+
79
+ <style>
80
+ .tnxbsv-pagination {
81
+ width: 100%;
82
+ display: flex;
83
+ align-items: center;
84
+ }
85
+
86
+ .tnxbsv-pagination .pagination-text {
87
+ display: flex;
88
+ align-items: center;
89
+ color: var(--bs-secondary-color);
90
+ margin: 0 0.5rem;
91
+ white-space: nowrap;
92
+ }
93
+
94
+ .tnxbsv-pagination .form-select {
95
+ width: 4.5rem;
96
+ margin: 0 0.5rem;
97
+ }
98
+
99
+ .tnxbsv-pagination ul {
100
+ margin-bottom: 0;
101
+ }
102
+ </style>
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <BTable class="tnxbsv-query-table"
3
+ :id="id"
4
+ :items="result.records || []"
5
+ :fields="fields"
6
+ :busy="result.records === null"
7
+ >
8
+ <template v-for="(_, slot) of $slots" v-slot:[slot]="scope">
9
+ <slot :name="slot" v-bind="scope"></slot>
10
+ </template>
11
+ <template #custom-foot>
12
+ <tr>
13
+ <td colspan="100%">
14
+ <Pagination :paged="result.paged"
15
+ :query="query"
16
+ :page-size-changeable="pageSizeChangeable"
17
+ :aria-controls="id"
18
+ />
19
+ </td>
20
+ </tr>
21
+ </template>
22
+ </BTable>
23
+ </template>
24
+
25
+ <script>
26
+ import {BTable} from 'bootstrap-vue-next';
27
+ import Pagination from '../pagination/Pagination.vue';
28
+
29
+ export default {
30
+ name: 'TnxbsvQueryTable',
31
+ components: {BTable, Pagination},
32
+ props: {
33
+ id: {
34
+ type: String,
35
+ default: () => {
36
+ return 'query-table-' + window.tnx.util.string.uuid32();
37
+ },
38
+ },
39
+ url: {
40
+ type: String,
41
+ required: true,
42
+ },
43
+ params: {
44
+ type: Object,
45
+ required: true,
46
+ },
47
+ fields: {
48
+ type: Array,
49
+ required: true,
50
+ },
51
+ init: Boolean,
52
+ pageSizeChangeable: Boolean,
53
+ },
54
+ data() {
55
+ return {
56
+ result: {
57
+ records: null,
58
+ paged: null,
59
+ },
60
+ };
61
+ },
62
+ mounted() {
63
+ if (this.init) {
64
+ this.query();
65
+ }
66
+ },
67
+ methods: {
68
+ query(paging) {
69
+ let params = Object.assign({}, this.params, paging);
70
+ this.result.records = null;
71
+ window.tnx.app.rpc.get(this.url, params, result => {
72
+ this.result = result;
73
+ });
74
+ },
75
+ }
76
+ }
77
+ </script>
78
+
79
+ <style>
80
+ .tnxbsv-query-table th,
81
+ .tnxbsv-query-table td {
82
+ vertical-align: middle;
83
+ }
84
+ </style>