fast-crud-ui3 1.5.16-tsc-beta → 1.5.16
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/lib/fast-crud-ui3.cjs.js +7 -7
- package/lib/fast-crud-ui3.es.js +1960 -2003
- package/lib/fast-crud-ui3.umd.js +7 -7
- package/lib/style.css +1 -1
- package/package.json +5 -18
- package/lib/assets/fonts/iconfont.d.ts +0 -0
- package/lib/components/checkbox-group/index.d.ts +0 -2
- package/lib/components/checkbox-group/src/fast-checkbox-group.d.ts +0 -72
- package/lib/components/content-dialog/index.d.ts +0 -2
- package/lib/components/content-dialog/src/fast-cell-content.d.ts +0 -83
- package/lib/components/json-viewer/index.d.ts +0 -2
- package/lib/components/json-viewer/src/fast-json-viewer.d.ts +0 -48
- package/lib/components/mapping.d.ts +0 -5
- package/lib/components/object-picker/index.d.ts +0 -2
- package/lib/components/object-picker/src/fast-object-picker.d.ts +0 -132
- package/lib/components/select/index.d.ts +0 -2
- package/lib/components/select/src/fast-select.d.ts +0 -83
- package/lib/components/table/index.d.ts +0 -2
- package/lib/components/table/src/RowConfirm.d.ts +0 -39
- package/lib/components/table/src/dynamic-filter-form.d.ts +0 -118
- package/lib/components/table/src/dynamic-filter-list.d.ts +0 -57
- package/lib/components/table/src/easy-filter.d.ts +0 -118
- package/lib/components/table/src/export-confirm.d.ts +0 -12
- package/lib/components/table/src/quick-filter-form.d.ts +0 -42
- package/lib/components/table/src/row-form.d.ts +0 -33
- package/lib/components/table/src/stored-filter-manager.d.ts +0 -55
- package/lib/components/table/src/stored-filter.d.ts +0 -37
- package/lib/components/table/src/table-head-cell.d.ts +0 -9
- package/lib/components/table/src/table.d.ts +0 -497
- package/lib/components/table/src/util.d.ts +0 -77
- package/lib/components/table-column/config.d.ts +0 -5
- package/lib/components/table-column/index.d.ts +0 -2
- package/lib/components/table-column/src/table-column.d.ts +0 -256
- package/lib/components/table-column-date-picker/config.d.ts +0 -5
- package/lib/components/table-column-date-picker/index.d.ts +0 -2
- package/lib/components/table-column-date-picker/src/table-column-date-picker.d.ts +0 -173
- package/lib/components/table-column-file/config.d.ts +0 -5
- package/lib/components/table-column-file/index.d.ts +0 -2
- package/lib/components/table-column-file/src/table-column-file.d.ts +0 -285
- package/lib/components/table-column-img/config.d.ts +0 -5
- package/lib/components/table-column-img/index.d.ts +0 -2
- package/lib/components/table-column-img/src/table-column-img.d.ts +0 -285
- package/lib/components/table-column-input/config.d.ts +0 -5
- package/lib/components/table-column-input/index.d.ts +0 -2
- package/lib/components/table-column-input/src/table-column-input.d.ts +0 -173
- package/lib/components/table-column-number/config.d.ts +0 -5
- package/lib/components/table-column-number/index.d.ts +0 -2
- package/lib/components/table-column-number/src/table-column-number.d.ts +0 -173
- package/lib/components/table-column-object/config.d.ts +0 -5
- package/lib/components/table-column-object/index.d.ts +0 -2
- package/lib/components/table-column-object/src/table-column-object.d.ts +0 -315
- package/lib/components/table-column-select/config.d.ts +0 -5
- package/lib/components/table-column-select/index.d.ts +0 -2
- package/lib/components/table-column-select/src/table-column-select.d.ts +0 -276
- package/lib/components/table-column-switch/config.d.ts +0 -5
- package/lib/components/table-column-switch/index.d.ts +0 -2
- package/lib/components/table-column-switch/src/table-column-switch.d.ts +0 -175
- package/lib/components/table-column-textarea/config.d.ts +0 -5
- package/lib/components/table-column-textarea/index.d.ts +0 -2
- package/lib/components/table-column-textarea/src/table-column-textarea.d.ts +0 -173
- package/lib/components/table-column-time-picker/config.d.ts +0 -5
- package/lib/components/table-column-time-picker/index.d.ts +0 -2
- package/lib/components/table-column-time-picker/src/table-column-time-picker.d.ts +0 -173
- package/lib/components/upload/index.d.ts +0 -2
- package/lib/components/upload/src/fast-upload.d.ts +0 -120
- package/lib/global.d.ts +0 -42
- package/lib/index.d.ts +0 -56
- package/lib/mixins/table-column.d.ts +0 -104
- package/lib/mixins/upload.d.ts +0 -15
- package/lib/model/cond.d.ts +0 -25
- package/lib/model/editComponentConfig.d.ts +0 -25
- package/lib/model/fastTableOption.d.ts +0 -355
- package/lib/model/filterComponentConfig.d.ts +0 -57
- package/lib/model/opt.d.ts +0 -20
- package/lib/model/order.d.ts +0 -7
- package/lib/model/pageQuery.d.ts +0 -23
- package/lib/model/query.d.ts +0 -33
- package/lib/model/rel.d.ts +0 -5
- package/lib/util/cache.d.ts +0 -17
- package/lib/util/dialog.d.ts +0 -49
- package/lib/util/escape.d.ts +0 -7
- package/lib/util/http.d.ts +0 -8
- package/lib/util/pick.d.ts +0 -14
- package/lib/util/util.d.ts +0 -252
- package/packages/assets/fonts/iconfont.css +0 -163
- package/packages/assets/fonts/iconfont.js +0 -1
- package/packages/assets/fonts/iconfont.ttf +0 -0
- package/packages/assets/fonts/iconfont.woff +0 -0
- package/packages/assets/fonts/iconfont.woff2 +0 -0
- package/packages/components/checkbox-group/index.js +0 -7
- package/packages/components/checkbox-group/src/fast-checkbox-group.vue +0 -83
- package/packages/components/content-dialog/index.js +0 -7
- package/packages/components/content-dialog/src/fast-cell-content.vue +0 -115
- package/packages/components/json-viewer/index.js +0 -7
- package/packages/components/json-viewer/src/fast-json-viewer.vue +0 -54
- package/packages/components/mapping.js +0 -95
- package/packages/components/object-picker/index.js +0 -7
- package/packages/components/object-picker/src/fast-object-picker.vue +0 -170
- package/packages/components/select/index.js +0 -7
- package/packages/components/select/src/fast-select.vue +0 -89
- package/packages/components/table/index.js +0 -7
- package/packages/components/table/src/RowConfirm.vue +0 -87
- package/packages/components/table/src/dynamic-filter-form.vue +0 -253
- package/packages/components/table/src/dynamic-filter-list.vue +0 -172
- package/packages/components/table/src/easy-filter.vue +0 -129
- package/packages/components/table/src/export-confirm.vue +0 -55
- package/packages/components/table/src/quick-filter-form.vue +0 -140
- package/packages/components/table/src/row-form.vue +0 -137
- package/packages/components/table/src/stored-filter-manager.vue +0 -240
- package/packages/components/table/src/stored-filter.vue +0 -180
- package/packages/components/table/src/table-head-cell.vue +0 -41
- package/packages/components/table/src/table.vue +0 -1309
- package/packages/components/table/src/util.js +0 -496
- package/packages/components/table-column/config.js +0 -64
- package/packages/components/table-column/index.js +0 -7
- package/packages/components/table-column/src/table-column.vue +0 -44
- package/packages/components/table-column-date-picker/config.js +0 -139
- package/packages/components/table-column-date-picker/index.js +0 -7
- package/packages/components/table-column-date-picker/src/table-column-date-picker.vue +0 -54
- package/packages/components/table-column-file/config.js +0 -83
- package/packages/components/table-column-file/index.js +0 -7
- package/packages/components/table-column-file/src/table-column-file.vue +0 -79
- package/packages/components/table-column-img/config.js +0 -83
- package/packages/components/table-column-img/index.js +0 -7
- package/packages/components/table-column-img/src/table-column-img.vue +0 -82
- package/packages/components/table-column-input/config.js +0 -77
- package/packages/components/table-column-input/index.js +0 -7
- package/packages/components/table-column-input/src/table-column-input.vue +0 -60
- package/packages/components/table-column-number/config.js +0 -89
- package/packages/components/table-column-number/index.js +0 -7
- package/packages/components/table-column-number/src/table-column-number.vue +0 -54
- package/packages/components/table-column-object/config.js +0 -66
- package/packages/components/table-column-object/index.js +0 -7
- package/packages/components/table-column-object/src/table-column-object.vue +0 -75
- package/packages/components/table-column-select/config.js +0 -66
- package/packages/components/table-column-select/index.js +0 -7
- package/packages/components/table-column-select/src/table-column-select.vue +0 -101
- package/packages/components/table-column-switch/config.js +0 -55
- package/packages/components/table-column-switch/index.js +0 -7
- package/packages/components/table-column-switch/src/table-column-switch.vue +0 -82
- package/packages/components/table-column-textarea/config.js +0 -77
- package/packages/components/table-column-textarea/index.js +0 -7
- package/packages/components/table-column-textarea/src/table-column-textarea.vue +0 -56
- package/packages/components/table-column-time-picker/config.js +0 -62
- package/packages/components/table-column-time-picker/index.js +0 -7
- package/packages/components/table-column-time-picker/src/table-column-time-picker.vue +0 -53
- package/packages/components/upload/index.js +0 -7
- package/packages/components/upload/src/fast-upload.vue +0 -272
- package/packages/global.d.ts +0 -42
- package/packages/index.js +0 -145
- package/packages/mixins/table-column.js +0 -133
- package/packages/mixins/upload.js +0 -14
- package/packages/model/cond.js +0 -65
- package/packages/model/editComponentConfig.js +0 -72
- package/packages/model/fastTableOption.js +0 -538
- package/packages/model/filterComponentConfig.js +0 -185
- package/packages/model/opt.js +0 -21
- package/packages/model/order.js +0 -16
- package/packages/model/pageQuery.js +0 -31
- package/packages/model/query.js +0 -93
- package/packages/model/rel.js +0 -5
- package/packages/style.scss +0 -5
- package/packages/util/cache.js +0 -92
- package/packages/util/dialog.js +0 -133
- package/packages/util/escape.js +0 -34
- package/packages/util/http.js +0 -18
- package/packages/util/pick.js +0 -92
- package/packages/util/util.js +0 -833
package/packages/index.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import FastCheckboxGroup from "./components/checkbox-group";
|
|
2
|
-
import FastCellContent from "./components/content-dialog/src/fast-cell-content.vue";
|
|
3
|
-
import FastJsonViewer from "./components/json-viewer/src/fast-json-viewer.vue";
|
|
4
|
-
import FastSelect from "./components/select";
|
|
5
|
-
import FastUpload from "./components/upload";
|
|
6
|
-
import FastObjectPicker from './components/object-picker'
|
|
7
|
-
import FastTable from './components/table'
|
|
8
|
-
import FastTableColumn from './components/table-column'
|
|
9
|
-
import FastTableColumnDatePicker from './components/table-column-date-picker'
|
|
10
|
-
import FastTableColumnImg from './components/table-column-img'
|
|
11
|
-
import FastTableColumnFile from './components/table-column-file'
|
|
12
|
-
import FastTableColumnInput from './components/table-column-input'
|
|
13
|
-
import FastTableColumnNumber from './components/table-column-number'
|
|
14
|
-
import FastTableColumnObject from './components/table-column-object'
|
|
15
|
-
import FastTableColumnSelect from './components/table-column-select'
|
|
16
|
-
import FastTableColumnSwitch from './components/table-column-switch'
|
|
17
|
-
import FastTableColumnTextarea from './components/table-column-textarea'
|
|
18
|
-
import FastTableColumnTimePicker from './components/table-column-time-picker'
|
|
19
|
-
import {openDialog} from "./util/dialog";
|
|
20
|
-
import {pick} from "./util/pick";
|
|
21
|
-
import "./style.scss"
|
|
22
|
-
import FastTableOption from "./model/fastTableOption.js";
|
|
23
|
-
import Opt from './model/opt.js'
|
|
24
|
-
import Cond from './model/cond.js'
|
|
25
|
-
import Order from './model/order.js'
|
|
26
|
-
import Query from './model/query.js'
|
|
27
|
-
import PageQuery from './model/pageQuery.js'
|
|
28
|
-
import {
|
|
29
|
-
isEmpty,
|
|
30
|
-
isString,
|
|
31
|
-
isNumber,
|
|
32
|
-
isArray,
|
|
33
|
-
ifBlank,
|
|
34
|
-
isFunction,
|
|
35
|
-
isObject,
|
|
36
|
-
isBoolean,
|
|
37
|
-
isNull,
|
|
38
|
-
isUndefined,
|
|
39
|
-
defaultIfEmpty,
|
|
40
|
-
defaultIfBlank,
|
|
41
|
-
camelCaseTo,
|
|
42
|
-
caseToCamel,
|
|
43
|
-
clear,
|
|
44
|
-
deepClone,
|
|
45
|
-
merge,
|
|
46
|
-
coverMerge
|
|
47
|
-
} from "./util/util";
|
|
48
|
-
|
|
49
|
-
const components = [
|
|
50
|
-
FastCheckboxGroup,
|
|
51
|
-
FastSelect,
|
|
52
|
-
FastUpload,
|
|
53
|
-
FastObjectPicker,
|
|
54
|
-
FastTable,
|
|
55
|
-
FastTableColumn,
|
|
56
|
-
FastTableColumnDatePicker,
|
|
57
|
-
FastTableColumnFile,
|
|
58
|
-
FastTableColumnImg,
|
|
59
|
-
FastTableColumnInput,
|
|
60
|
-
FastTableColumnNumber,
|
|
61
|
-
FastTableColumnObject,
|
|
62
|
-
FastTableColumnSelect,
|
|
63
|
-
FastTableColumnSwitch,
|
|
64
|
-
FastTableColumnTextarea,
|
|
65
|
-
FastTableColumnTimePicker
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
const directives = [
|
|
69
|
-
]
|
|
70
|
-
|
|
71
|
-
// 全局应用上下文
|
|
72
|
-
let globalAppContext = null
|
|
73
|
-
const install = function (app, opts = {}) {
|
|
74
|
-
globalAppContext = app._context // 保存上下文
|
|
75
|
-
if (opts.hasOwnProperty('$http')) {
|
|
76
|
-
FastTableOption.$http = opts.$http
|
|
77
|
-
}
|
|
78
|
-
if (opts.hasOwnProperty('$router')) {
|
|
79
|
-
FastTableOption.$router = opts.$router
|
|
80
|
-
}
|
|
81
|
-
components.forEach(component => {
|
|
82
|
-
app.component(component.name, component);
|
|
83
|
-
});
|
|
84
|
-
directives.forEach(directive => {
|
|
85
|
-
app.use(directive)
|
|
86
|
-
})
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const util = {
|
|
90
|
-
isEmpty,
|
|
91
|
-
isString,
|
|
92
|
-
isNumber,
|
|
93
|
-
isArray,
|
|
94
|
-
ifBlank,
|
|
95
|
-
isFunction,
|
|
96
|
-
isObject,
|
|
97
|
-
isBoolean,
|
|
98
|
-
isNull,
|
|
99
|
-
isUndefined,
|
|
100
|
-
defaultIfEmpty,
|
|
101
|
-
defaultIfBlank,
|
|
102
|
-
camelCaseTo,
|
|
103
|
-
caseToCamel,
|
|
104
|
-
clear,
|
|
105
|
-
deepClone,
|
|
106
|
-
merge,
|
|
107
|
-
coverMerge,
|
|
108
|
-
openDialog,
|
|
109
|
-
pick
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export {
|
|
113
|
-
FastCheckboxGroup,
|
|
114
|
-
FastCellContent,
|
|
115
|
-
FastJsonViewer,
|
|
116
|
-
FastSelect,
|
|
117
|
-
FastUpload,
|
|
118
|
-
FastObjectPicker,
|
|
119
|
-
FastTable,
|
|
120
|
-
FastTableColumn,
|
|
121
|
-
FastTableColumnDatePicker,
|
|
122
|
-
FastTableColumnFile,
|
|
123
|
-
FastTableColumnImg,
|
|
124
|
-
FastTableColumnInput,
|
|
125
|
-
FastTableColumnNumber,
|
|
126
|
-
FastTableColumnObject,
|
|
127
|
-
FastTableColumnSelect,
|
|
128
|
-
FastTableColumnSwitch,
|
|
129
|
-
FastTableColumnTextarea,
|
|
130
|
-
FastTableColumnTimePicker,
|
|
131
|
-
FastTableOption,
|
|
132
|
-
Opt,
|
|
133
|
-
PageQuery,
|
|
134
|
-
Query,
|
|
135
|
-
Order,
|
|
136
|
-
Cond,
|
|
137
|
-
util
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// 获取App上下文
|
|
141
|
-
export const getAppContext = () => globalAppContext
|
|
142
|
-
|
|
143
|
-
export default {
|
|
144
|
-
install
|
|
145
|
-
};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {colEditable} from "../components/table/src/util"
|
|
2
|
-
import FastTableHeadCell from "../components/table/src/table-head-cell.vue"
|
|
3
|
-
import FastCellContent from "../components/content-dialog/src/fast-cell-content.vue";
|
|
4
|
-
import {convertKeyFromCaseToCamel, replaceKey} from "../util/util.js";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
inject: ['openDynamicFilterForm', 'tableStyle', 'context'],
|
|
8
|
-
emits: ['change', 'focus', 'blur', 'input', 'clear'],
|
|
9
|
-
components: {FastTableHeadCell, FastCellContent},
|
|
10
|
-
props: {
|
|
11
|
-
prop: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
label: {
|
|
16
|
-
type: String,
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
// 值为Boolean且为true时, 则将单元格内容作为链接地址; 值为字符串其非空时,将值作为跳转地址,且以超链接的形式展示单元格内容, 并支持点击, 值支持路由地址、路由名、绝对地址
|
|
20
|
-
link: {
|
|
21
|
-
type: [Boolean, String],
|
|
22
|
-
default: () => false
|
|
23
|
-
},
|
|
24
|
-
// 以实现某一列不显示, 仍然可以参与生成筛选项
|
|
25
|
-
hidden: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
default: () => false
|
|
28
|
-
},
|
|
29
|
-
// 此列是否支持过滤. 若为false, 则简筛、快筛、动筛都将不支持。此优先级高于quickFilter和dynamicFilter
|
|
30
|
-
filter: {
|
|
31
|
-
type: [Boolean, Number],
|
|
32
|
-
default: () => true
|
|
33
|
-
},
|
|
34
|
-
// 此列是否支持快筛
|
|
35
|
-
quickFilter: {
|
|
36
|
-
type: [Boolean, Number],
|
|
37
|
-
default: () => false
|
|
38
|
-
},
|
|
39
|
-
quickFilterBlock: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: () => false
|
|
42
|
-
},
|
|
43
|
-
// 快筛更多配置: 解决筛选项级联问题
|
|
44
|
-
quickFilterConfig: Object, // {onChange: Function, onClick: Function}
|
|
45
|
-
// 此列是否支持动筛: 若为false, 则列头不可点击
|
|
46
|
-
dynamicFilter: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: () => true
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* 1.5.12 是否唯一, 若为true, 新增或更新时, 会校验此值的唯一性(前后端均校验)
|
|
52
|
-
*/
|
|
53
|
-
unique: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
default: () => false
|
|
56
|
-
},
|
|
57
|
-
// deprecated: 1.6.0
|
|
58
|
-
firstFilter: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: () => false
|
|
61
|
-
},
|
|
62
|
-
showOverflowTooltip: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: () => false
|
|
65
|
-
},
|
|
66
|
-
/**
|
|
67
|
-
* 显示的字符长度, 超长时会显示"...", 并支持弹窗预览完整信息
|
|
68
|
-
*/
|
|
69
|
-
showLength: {
|
|
70
|
-
type: Number,
|
|
71
|
-
default: () => Number.MAX_VALUE
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
data() {
|
|
75
|
-
let attrs = convertKeyFromCaseToCamel(this.$attrs, '-');
|
|
76
|
-
attrs = replaceKey(attrs, '_q')
|
|
77
|
-
attrs = replaceKey(attrs, '_e')
|
|
78
|
-
return {
|
|
79
|
-
columnProp: {
|
|
80
|
-
...attrs,
|
|
81
|
-
prop: this.prop,
|
|
82
|
-
label: this.label,
|
|
83
|
-
filter: this.filter,
|
|
84
|
-
dynamicFilter: this.dynamicFilter,
|
|
85
|
-
order: '' // '', 'asc', 'desc'
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
methods: {
|
|
90
|
-
/**
|
|
91
|
-
* 是否展示编辑模式
|
|
92
|
-
* @param fatRow
|
|
93
|
-
* @param column element原生列配置
|
|
94
|
-
* @param $index 当前行索引
|
|
95
|
-
* @returns {boolean}
|
|
96
|
-
*/
|
|
97
|
-
canEdit(fatRow, column, $index) {
|
|
98
|
-
return colEditable.call(this.context !== null && this.context !== undefined ? this.context : this, fatRow, column.property);
|
|
99
|
-
},
|
|
100
|
-
showLabel(fatRow) {
|
|
101
|
-
const {row, editRow, status} = fatRow;
|
|
102
|
-
return status === 'normal' ? row[this.prop] : editRow[this.prop];
|
|
103
|
-
},
|
|
104
|
-
headCellClick(column) {
|
|
105
|
-
if (this.filter !== false && this.dynamicFilter !== false) {
|
|
106
|
-
this.openDynamicFilterForm(this.columnProp)
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
// change事件上抛并触发验证
|
|
110
|
-
handleChange(val, scope) {
|
|
111
|
-
this.$emit('change', val, scope);
|
|
112
|
-
const {column, $index, row: {editRow, config}} = scope;
|
|
113
|
-
const {property} = column;
|
|
114
|
-
const ref = this.$refs[property + $index];
|
|
115
|
-
const {eventMethods: {valid} = {}, props} = config[property]
|
|
116
|
-
if (valid) {
|
|
117
|
-
valid(val, editRow, ref, props);
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
handleFocus(event, scope) {
|
|
121
|
-
this.$emit('focus', event, scope)
|
|
122
|
-
},
|
|
123
|
-
handleBlur(event, scope) {
|
|
124
|
-
this.$emit('blur', event, scope)
|
|
125
|
-
},
|
|
126
|
-
handleInput(val, scope) {
|
|
127
|
-
this.$emit('input', val, scope);
|
|
128
|
-
},
|
|
129
|
-
handleClear(scope) {
|
|
130
|
-
this.$emit('clear', scope);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
props: {
|
|
3
|
-
onPreview: Function,
|
|
4
|
-
beforeRemove: Function,
|
|
5
|
-
onRemove: Function,
|
|
6
|
-
onSuccess: Function,
|
|
7
|
-
onError: Function,
|
|
8
|
-
onProgress: Function,
|
|
9
|
-
onChange: Function,
|
|
10
|
-
onExceed: Function,
|
|
11
|
-
beforeUpload: Function,
|
|
12
|
-
responseHandler: Function
|
|
13
|
-
}
|
|
14
|
-
}
|
package/packages/model/cond.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {assert, defaultIfBlank, isEmpty, isObject, isString} from "../util/util.js";
|
|
2
|
-
import Opt from "./opt.js";
|
|
3
|
-
|
|
4
|
-
class Cond {
|
|
5
|
-
col;
|
|
6
|
-
opt;
|
|
7
|
-
val;
|
|
8
|
-
|
|
9
|
-
constructor(col, opt, val) {
|
|
10
|
-
assert(isString(col) && !isEmpty(col), 'col必须为有效字符串')
|
|
11
|
-
assert(Object.values(Opt).indexOf(opt) > -1, `opt无效:${opt}`)
|
|
12
|
-
/**
|
|
13
|
-
* 字段名
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
|
-
this.col = col;
|
|
17
|
-
/**
|
|
18
|
-
* 操作符
|
|
19
|
-
* @type {string}
|
|
20
|
-
*/
|
|
21
|
-
this.opt = opt;
|
|
22
|
-
/**
|
|
23
|
-
* 值
|
|
24
|
-
* @type {object}
|
|
25
|
-
*/
|
|
26
|
-
this.val = val;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 设置操作符
|
|
31
|
-
* @param opt {string}
|
|
32
|
-
* @return {Cond}
|
|
33
|
-
*/
|
|
34
|
-
setOpt(opt) {
|
|
35
|
-
this.opt = opt;
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 设置值
|
|
41
|
-
* @param val {object}
|
|
42
|
-
* @return {Cond}
|
|
43
|
-
*/
|
|
44
|
-
setVal(val) {
|
|
45
|
-
this.val = val;
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 通过json构建条件
|
|
51
|
-
* @param condJson {object} 条件的json
|
|
52
|
-
* @return {Cond}
|
|
53
|
-
*/
|
|
54
|
-
static build(condJson) {
|
|
55
|
-
if (condJson instanceof Cond) {
|
|
56
|
-
return condJson;
|
|
57
|
-
}
|
|
58
|
-
assert(isObject(condJson), 'cond不是json格式!')
|
|
59
|
-
const {col, opt = Opt.EQ, val} = condJson
|
|
60
|
-
assert(!isEmpty(col), 'cond格式不正确: 无col属性或其值为空!')
|
|
61
|
-
return new Cond(col, defaultIfBlank(opt, Opt.EQ), val);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default Cond
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import {isEmpty, isFunction, isNull, isUndefined} from "../util/util.js";
|
|
2
|
-
import FastTableOption from "./fastTableOption.js";
|
|
3
|
-
import Opt from './opt.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 编辑组件配置
|
|
7
|
-
*/
|
|
8
|
-
class EditComponentConfig {
|
|
9
|
-
component;
|
|
10
|
-
col;
|
|
11
|
-
label;
|
|
12
|
-
props;
|
|
13
|
-
val;
|
|
14
|
-
editable; // 是否可编辑, true 表示可编辑, false表示不可编辑, insert-表示新增时可编辑, update-表示更新时可编辑. 默认为true.
|
|
15
|
-
type; // inline, form
|
|
16
|
-
eventMethods; // 组件事件触发时调用其中的方法,例如参数验证
|
|
17
|
-
|
|
18
|
-
constructor({component, col, label, props, val, eventMethods, type, unique, tableOption}) {
|
|
19
|
-
this.component = component;
|
|
20
|
-
this.col = col;
|
|
21
|
-
this.label = label;
|
|
22
|
-
const {editable, ...validProps} = props; // 移除props中的editable属性,避免editable对组件影响
|
|
23
|
-
this.props = validProps;
|
|
24
|
-
this.val = val;
|
|
25
|
-
this.editable = editable;
|
|
26
|
-
this.eventMethods = eventMethods;
|
|
27
|
-
this.type = type;
|
|
28
|
-
// 将unique转换为 props.rules一部分
|
|
29
|
-
if (unique !== false && (tableOption instanceof FastTableOption)) {
|
|
30
|
-
const pkField = tableOption.idField
|
|
31
|
-
const uniqueValidator = async (rule, value, callback, source, options) => {
|
|
32
|
-
if (isNull(value) || isUndefined(value)) {
|
|
33
|
-
return Promise.resolve()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const {getRow} = rule
|
|
37
|
-
if (!isFunction(getRow)) {
|
|
38
|
-
// 无法获取当前行
|
|
39
|
-
console.error('无法进行唯一性校验:无法获取当前记录完整数据')
|
|
40
|
-
return Promise.resolve()
|
|
41
|
-
}
|
|
42
|
-
const currentRow = getRow()
|
|
43
|
-
const pkVal = currentRow[pkField]
|
|
44
|
-
if (type === 'inline') {
|
|
45
|
-
if (isEmpty(tableOption.ref?.editRows)) {
|
|
46
|
-
return Promise.resolve()
|
|
47
|
-
}
|
|
48
|
-
const editRows = tableOption.ref.editRows.map(fatRow => fatRow.editRow)
|
|
49
|
-
const duplicates = editRows.filter(row => row[rule.field] === value && row[pkField] !== pkVal)
|
|
50
|
-
if (duplicates.length > 0) {
|
|
51
|
-
return Promise.reject(`【${label}】${value}已存在于其它编辑行`)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// 后端唯一性校验
|
|
56
|
-
const result = await tableOption._exist([
|
|
57
|
-
{col: pkField, opt: Opt.NE, val: pkVal}, // 避免自身编辑时误报
|
|
58
|
-
{col: col, opt: Opt.EQ, val: value}
|
|
59
|
-
])
|
|
60
|
-
if (result) { // 表示存在
|
|
61
|
-
return Promise.reject(`【${label}】${value}已存在`)
|
|
62
|
-
}
|
|
63
|
-
return Promise.resolve()
|
|
64
|
-
}
|
|
65
|
-
props?.rules.push({
|
|
66
|
-
validator: uniqueValidator, trigger: 'blur'
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default EditComponentConfig
|