@truenewx/tnxvue3 3.4.0 → 3.4.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 (55) hide show
  1. package/eslint.config.cjs +58 -0
  2. package/index.html +12 -12
  3. package/package.json +16 -40
  4. package/src/aj-captcha/Verify/VerifySlide.vue +9 -9
  5. package/src/aj-captcha/api/index.js +2 -10
  6. package/src/aj-captcha/utils/ase.js +1 -1
  7. package/src/bootstrap-vue/alert/Alert.vue +79 -79
  8. package/src/bootstrap-vue/button/Button.vue +40 -40
  9. package/src/bootstrap-vue/enum-select/EnumSelect.vue +4 -5
  10. package/src/bootstrap-vue/form/Form.vue +320 -320
  11. package/src/bootstrap-vue/form/FormGroup.vue +73 -73
  12. package/src/bootstrap-vue/loading-icon/LoadingIcon.vue +46 -46
  13. package/src/bootstrap-vue/paged/Paged.vue +119 -119
  14. package/src/bootstrap-vue/progress/Progress.vue +58 -58
  15. package/src/bootstrap-vue/query-table/QueryTable.vue +84 -84
  16. package/src/bootstrap-vue/region-cascader/RegionCascader.vue +119 -119
  17. package/src/bootstrap-vue/select/Select.vue +375 -375
  18. package/src/bootstrap-vue/submit-form/SubmitForm.vue +180 -176
  19. package/src/bootstrap-vue/tags-input/TagsInput.vue +64 -64
  20. package/src/bootstrap-vue/tnxbsv.css +107 -107
  21. package/src/bootstrap-vue/tnxbsv.js +109 -92
  22. package/src/bootstrap-vue/upload/Upload.vue +173 -173
  23. package/src/element-plus/avatar/Avatar.vue +8 -9
  24. package/src/element-plus/button/Button.vue +2 -2
  25. package/src/element-plus/curd/Curd.vue +20 -23
  26. package/src/element-plus/date-picker/DatePicker.vue +1 -1
  27. package/src/element-plus/detail-form/DetailForm.vue +1 -1
  28. package/src/element-plus/dialog/Dialog.vue +18 -20
  29. package/src/element-plus/drawer/Drawer.vue +10 -9
  30. package/src/element-plus/edit-table/EditTable.vue +3 -3
  31. package/src/element-plus/enum-select/EnumSelect.vue +3 -3
  32. package/src/element-plus/enum-view/EnumView.vue +41 -41
  33. package/src/element-plus/fetch-cascader/FetchCascader.vue +3 -4
  34. package/src/element-plus/fetch-select/FetchSelect.vue +10 -11
  35. package/src/element-plus/fetch-tags/FetchTags.vue +4 -5
  36. package/src/element-plus/fss-upload/FssUpload.vue +18 -18
  37. package/src/element-plus/fss-view/FssView.vue +1 -1
  38. package/src/element-plus/icon/Icon.vue +6 -0
  39. package/src/element-plus/input-dropdown/InputDropdown.vue +74 -74
  40. package/src/element-plus/query-form/QueryForm.vue +1 -1
  41. package/src/element-plus/query-table/QueryTable.vue +22 -26
  42. package/src/element-plus/region-cascader/RegionCascader.vue +4 -5
  43. package/src/element-plus/select/Select.vue +2 -2
  44. package/src/element-plus/steps-nav/StepsNav.vue +3 -4
  45. package/src/element-plus/submit-form/SubmitForm.vue +36 -39
  46. package/src/element-plus/tabs/Tabs.vue +1 -1
  47. package/src/element-plus/tnxel.css +22 -0
  48. package/src/element-plus/tnxel.js +101 -93
  49. package/src/element-plus/toolbar/ToolBarItem.js +15 -15
  50. package/src/element-plus/toolbar/Toolbar.vue +56 -56
  51. package/src/element-plus/transfer/Transfer.vue +8 -9
  52. package/src/element-plus/upload/Upload.vue +24 -24
  53. package/src/tnxvue-router.js +4 -4
  54. package/src/tnxvue-validator.js +8 -2
  55. package/src/tnxvue.js +13 -26
@@ -1,176 +1,180 @@
1
- <template>
2
- <TnxbsvForm ref="form" :model="model" :rules="validationRules" :disabled="disabled">
3
- <slot></slot>
4
- <TnxbsvFormGroup v-if="submit !== undefined && submit !== null">
5
- <div class="flex-v-center">
6
- <TnxbsvButton :type="theme || 'primary'" :size="size" @click="toSubmit" v-if="submit !== false">
7
- {{ _submitText }}
8
- </TnxbsvButton>
9
- <TnxbsvButton class="ms-2" :size="size" @click="toCancel" v-if="cancel !== false">
10
- {{ cancelText }}
11
- </TnxbsvButton>
12
- </div>
13
- </TnxbsvFormGroup>
14
- </TnxbsvForm>
15
- </template>
16
-
17
- <script>
18
- import TnxbsvForm from '../form/Form.vue';
19
- import TnxbsvFormGroup from '../form/FormGroup.vue';
20
- import TnxbsvButton from '../button/Button.vue';
21
-
22
- export default {
23
- name: 'TnxbsvSubmitForm',
24
- components: {TnxbsvForm, TnxbsvFormGroup, TnxbsvButton},
25
- props: {
26
- model: Object,
27
- rules: [String, Object], // 加载字段校验规则的URL地址,或规则集对象
28
- rulesApp: { // 加载字段校验规则的应用名称
29
- type: String,
30
- default: () => window.tnx.componentDefaultApp, // 设置为方法以延时加载,确保更改的值生效
31
- },
32
- rulesLoaded: Function, // 规则集加载后的附加处理函数,仅在rules为字符串类型的URL地址时有效
33
- submit: {
34
- type: [Function, Boolean],
35
- default: null,
36
- },
37
- submitText: String,
38
- theme: String,
39
- cancel: {
40
- type: [String, Function, Boolean],
41
- default: true
42
- },
43
- cancelText: {
44
- type: String,
45
- default: '取消'
46
- },
47
- errorFocus: {
48
- type: Boolean,
49
- default: false,
50
- },
51
- size: String,
52
- },
53
- emits: ['rules-loaded', 'meta'],
54
- data() {
55
- return {
56
- validationRules: {},
57
- disabled: false,
58
- fieldNames: [],
59
- };
60
- },
61
- computed: {
62
- _submitText() {
63
- if (this.submitText) {
64
- return this.submitText;
65
- }
66
- return this.cancel === false ? '保存' : '提交';
67
- }
68
- },
69
- watch: {
70
- rules() {
71
- this.initRules();
72
- },
73
- },
74
- mounted() {
75
- this.initRules();
76
- },
77
- methods: {
78
- initRules() {
79
- if (this.rules) {
80
- if (typeof this.rules === 'string') {
81
- window.tnx.app.rpc.getMeta(this.rules, meta => {
82
- if (this.rulesLoaded) {
83
- this.rulesLoaded(meta.$rules);
84
- } else {
85
- this.$emit('rules-loaded', meta.$rules);
86
- }
87
- this.validationRules = meta.$rules;
88
- delete meta.$rules;
89
- this.$emit('meta', meta);
90
- this.fieldNames = Object.keys(meta);
91
- }, this.rulesApp);
92
- } else {
93
- this.validationRules = {};
94
- Object.keys(this.rules).forEach(fieldName => {
95
- let fieldRules = this.rules[fieldName] || [];
96
- if (!Array.isArray(fieldRules)) {
97
- fieldRules = [fieldRules];
98
- }
99
- if (fieldRules.length) {
100
- this.validationRules[fieldName] = fieldRules.filter((rule, index) => {
101
- let valid = rule !== undefined && rule !== null;
102
- if (!valid) {
103
- console.error(`invalid rules[${index}] for field "${fieldName}": `, rule);
104
- }
105
- return valid;
106
- });
107
- }
108
- });
109
- }
110
- } else {
111
- this.validationRules = {};
112
- }
113
- },
114
- validate(callback, errorFocus) {
115
- this.$refs.form.validate().then(() => {
116
- if (typeof callback === 'function') {
117
- callback(true);
118
- }
119
- }).catch(errors => {
120
- if (this.errorFocus && errorFocus !== false) {
121
- this.$nextTick(() => {
122
- this.focusError.call(this, errors);
123
- });
124
- }
125
- if (typeof callback === 'function') {
126
- callback(false);
127
- }
128
- });
129
- },
130
- focusError(errors) {
131
- let fieldNames = Object.keys(errors);
132
- let fieldName = fieldNames[0];
133
- if (fieldName) {
134
- let fieldElement = this.$refs.form.getFieldElement(fieldName);
135
- if (fieldElement) {
136
- fieldElement.focus();
137
- return;
138
- }
139
- // 没有找到错误字段输入框,则滚动到错误栏目处
140
- this.$refs.form.scrollToField(fieldName);
141
- }
142
- },
143
- disable(disabled) {
144
- this.disabled = disabled !== false;
145
- },
146
- toSubmit(callback, disabled) {
147
- this.validate(success => {
148
- if (success) {
149
- if (typeof callback !== 'function') {
150
- callback = this.submit;
151
- }
152
- if (typeof callback === 'function') {
153
- if (disabled !== false) {
154
- this.disable();
155
- }
156
- callback(this);
157
- }
158
- }
159
- });
160
- },
161
- toCancel() {
162
- if (typeof this.cancel === 'function') {
163
- this.cancel();
164
- } else if (typeof this.cancel === 'string') {
165
- this.$router.back(this.cancel);
166
- } else if (this.cancel !== false) {
167
- this.$router.back();
168
- }
169
- },
170
- }
171
- }
172
- </script>
173
-
174
- <style>
175
-
176
- </style>
1
+ <template>
2
+ <TnxbsvForm ref="form" :model="model" :rules="validationRules" :disabled="disabled">
3
+ <slot></slot>
4
+ <TnxbsvFormGroup v-if="submit !== undefined && submit !== null">
5
+ <div class="flex-v-center">
6
+ <TnxbsvButton :type="theme || 'primary'" :size="size" @click="toSubmit" v-if="submit !== false">
7
+ {{ _submitText }}
8
+ </TnxbsvButton>
9
+ <TnxbsvButton class="ms-2" :size="size" @click="toCancel" v-if="cancel !== false">
10
+ {{ cancelText }}
11
+ </TnxbsvButton>
12
+ </div>
13
+ </TnxbsvFormGroup>
14
+ </TnxbsvForm>
15
+ </template>
16
+
17
+ <script>
18
+ import TnxbsvForm from '../form/Form.vue';
19
+ import TnxbsvFormGroup from '../form/FormGroup.vue';
20
+ import TnxbsvButton from '../button/Button.vue';
21
+
22
+ export default {
23
+ name: 'TnxbsvSubmitForm',
24
+ components: {TnxbsvForm, TnxbsvFormGroup, TnxbsvButton},
25
+ props: {
26
+ model: Object,
27
+ rules: [String, Object], // 加载字段校验规则的URL地址,或规则集对象
28
+ rulesApp: { // 加载字段校验规则的应用名称
29
+ type: String,
30
+ default: () => window.tnx.componentDefaultApp, // 设置为方法以延时加载,确保更改的值生效
31
+ },
32
+ rulesLoaded: Function, // 规则集加载后的附加处理函数,仅在rules为字符串类型的URL地址时有效
33
+ submit: {
34
+ type: [Function, Boolean],
35
+ default: null,
36
+ },
37
+ submitText: String,
38
+ theme: String,
39
+ cancel: {
40
+ type: [String, Function, Boolean],
41
+ default: true
42
+ },
43
+ cancelText: {
44
+ type: String,
45
+ default: '取消'
46
+ },
47
+ errorFocus: {
48
+ type: Boolean,
49
+ default: false,
50
+ },
51
+ size: String,
52
+ },
53
+ emits: ['rules-loaded', 'meta'],
54
+ data() {
55
+ return {
56
+ validationRules: {},
57
+ disabled: false,
58
+ fieldNames: [],
59
+ };
60
+ },
61
+ computed: {
62
+ _submitText() {
63
+ if (this.submitText) {
64
+ return this.submitText;
65
+ }
66
+ return this.cancel === false ? '保存' : '提交';
67
+ }
68
+ },
69
+ watch: {
70
+ rules() {
71
+ this.initRules();
72
+ },
73
+ },
74
+ mounted() {
75
+ this.initRules();
76
+ },
77
+ methods: {
78
+ initRules() {
79
+ if (this.rules) {
80
+ if (typeof this.rules === 'string') {
81
+ window.tnx.app.rpc.getMeta(this.rules, this.rulesApp).then(meta => {
82
+ if (this.rulesLoaded) {
83
+ this.rulesLoaded(meta.$rules);
84
+ } else {
85
+ this.$emit('rules-loaded', meta.$rules);
86
+ }
87
+ this.validationRules = meta.$rules;
88
+ delete meta.$rules;
89
+ this.$emit('meta', meta);
90
+ this.fieldNames = Object.keys(meta);
91
+ });
92
+ } else {
93
+ this.validationRules = {};
94
+ Object.keys(this.rules).forEach(fieldName => {
95
+ let fieldRules = this.rules[fieldName] || [];
96
+ if (!Array.isArray(fieldRules)) {
97
+ fieldRules = [fieldRules];
98
+ }
99
+ if (fieldRules.length) {
100
+ this.validationRules[fieldName] = fieldRules.filter((rule, index) => {
101
+ let valid = rule !== undefined && rule !== null;
102
+ if (!valid) {
103
+ console.error(`invalid rules[${index}] for field "${fieldName}": `, rule);
104
+ }
105
+ return valid;
106
+ });
107
+ }
108
+ });
109
+ }
110
+ } else {
111
+ this.validationRules = {};
112
+ }
113
+ },
114
+ validate(callback, errorFocus) {
115
+ const promise = this.$refs.form.validate().then(() => {
116
+ return true;
117
+ }).catch(errors => {
118
+ if (this.errorFocus && errorFocus !== false) {
119
+ this.$nextTick(() => {
120
+ this.focusError.call(this, errors);
121
+ });
122
+ }
123
+ return false;
124
+ });
125
+
126
+ if (typeof callback === 'function') {
127
+ return promise.then(result => {
128
+ callback(result);
129
+ return result;
130
+ });
131
+ }
132
+ return promise;
133
+ },
134
+ focusError(errors) {
135
+ let fieldNames = Object.keys(errors);
136
+ let fieldName = fieldNames[0];
137
+ if (fieldName) {
138
+ let fieldElement = this.$refs.form.getFieldElement(fieldName);
139
+ if (fieldElement) {
140
+ fieldElement.focus();
141
+ return;
142
+ }
143
+ // 没有找到错误字段输入框,则滚动到错误栏目处
144
+ this.$refs.form.scrollToField(fieldName);
145
+ }
146
+ },
147
+ disable(disabled) {
148
+ this.disabled = disabled !== false;
149
+ },
150
+ toSubmit(callback, disabled) {
151
+ this.validate(success => {
152
+ if (success) {
153
+ if (typeof callback !== 'function') {
154
+ callback = this.submit;
155
+ }
156
+ if (typeof callback === 'function') {
157
+ if (disabled !== false) {
158
+ this.disable();
159
+ }
160
+ callback(this);
161
+ }
162
+ }
163
+ });
164
+ },
165
+ toCancel() {
166
+ if (typeof this.cancel === 'function') {
167
+ this.cancel();
168
+ } else if (typeof this.cancel === 'string') {
169
+ this.$router.back(this.cancel);
170
+ } else if (this.cancel !== false) {
171
+ this.$router.back();
172
+ }
173
+ },
174
+ }
175
+ }
176
+ </script>
177
+
178
+ <style>
179
+
180
+ </style>
@@ -1,64 +1,64 @@
1
- <template>
2
- <BFormTags class="tnxbsv-tags-input"
3
- v-model="model"
4
- :placeholder="placeholder"
5
- :separator="separator"
6
- :tag-variant="tagVariant || 'light'"
7
- add-button-text="+"
8
- :duplicate-tag-text="duplicateTagText"
9
- remove-on-delete
10
- />
11
- </template>
12
-
13
- <script>
14
- import {BFormTags} from 'bootstrap-vue-next';
15
-
16
- export default {
17
- name: 'TnxbsvTagsInput',
18
- components: {BFormTags},
19
- props: {
20
- modelValue: {
21
- type: Array,
22
- default: () => [],
23
- },
24
- placeholder: {
25
- type: String,
26
- default: '输入后回车以添加',
27
- },
28
- separator: {
29
- type: String,
30
- default: ','
31
- },
32
- tagVariant: String,
33
- duplicateTagText: {
34
- type: String,
35
- default: '标签重复',
36
- },
37
- },
38
- data() {
39
- return {
40
- model: this.modelValue,
41
- };
42
- },
43
- watch: {
44
- modelValue() {
45
- this.model = this.modelValue;
46
- },
47
- model() {
48
- this.$emit('update:modelValue', this.model);
49
- },
50
- },
51
- methods: {}
52
- }
53
- </script>
54
-
55
- <style>
56
- .tnxbsv-tags-input .b-form-tag + .b-from-tags-field > div {
57
- padding-left: 0.25rem;
58
- }
59
-
60
- .tnxbsv-tags-input .btn.b-form-tags-button {
61
- --bs-btn-padding-x: 0.5rem;
62
- margin-left: 0.5rem;
63
- }
64
- </style>
1
+ <template>
2
+ <BFormTags class="tnxbsv-tags-input"
3
+ v-model="model"
4
+ :placeholder="placeholder"
5
+ :separator="separator"
6
+ :tag-variant="tagVariant || 'light'"
7
+ add-button-text="+"
8
+ :duplicate-tag-text="duplicateTagText"
9
+ remove-on-delete
10
+ />
11
+ </template>
12
+
13
+ <script>
14
+ import {BFormTags} from 'bootstrap-vue-next';
15
+
16
+ export default {
17
+ name: 'TnxbsvTagsInput',
18
+ components: {BFormTags},
19
+ props: {
20
+ modelValue: {
21
+ type: Array,
22
+ default: () => [],
23
+ },
24
+ placeholder: {
25
+ type: String,
26
+ default: '输入后回车以添加',
27
+ },
28
+ separator: {
29
+ type: String,
30
+ default: ','
31
+ },
32
+ tagVariant: String,
33
+ duplicateTagText: {
34
+ type: String,
35
+ default: '标签重复',
36
+ },
37
+ },
38
+ data() {
39
+ return {
40
+ model: this.modelValue,
41
+ };
42
+ },
43
+ watch: {
44
+ modelValue() {
45
+ this.model = this.modelValue;
46
+ },
47
+ model() {
48
+ this.$emit('update:modelValue', this.model);
49
+ },
50
+ },
51
+ methods: {}
52
+ }
53
+ </script>
54
+
55
+ <style>
56
+ .tnxbsv-tags-input .b-form-tag + .b-from-tags-field > div {
57
+ padding-left: 0.25rem;
58
+ }
59
+
60
+ .tnxbsv-tags-input .btn.b-form-tags-button {
61
+ --bs-btn-padding-x: 0.5rem;
62
+ margin-left: 0.5rem;
63
+ }
64
+ </style>