@blueking/bkui-form 0.0.43 → 0.0.45
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/dist/adapter/vue2/common/CommonGroupWrap.d.ts +32 -0
- package/dist/adapter/vue2/widget/KeyValueArrayWidget.d.ts +4 -1
- package/dist/bkui-form-es-min.js +2 -2
- package/dist/bkui-form-es.js +145 -25
- package/dist/bkui-form-es.js.map +1 -1
- package/dist/bkui-form-umd-min.js +2 -2
- package/dist/bkui-form-umd.js +145 -25
- package/dist/bkui-form-umd.js.map +1 -1
- package/package.json +2 -2
package/dist/bkui-form-es.js
CHANGED
|
@@ -1818,6 +1818,7 @@ var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction,
|
|
|
1818
1818
|
crtInstance = _ref.instance; // 当前组件实例,用来条件表达式判断
|
|
1819
1819
|
var _ref2 = widgetTree.widgetMap[targetPath] || {},
|
|
1820
1820
|
operateInstance = _ref2.instance; // 需要执行操作的组件实例,可能为其他组件也可能为当前组件
|
|
1821
|
+
if (!crtInstance || !operateInstance) return;
|
|
1821
1822
|
var fullfill = true;
|
|
1822
1823
|
var deps = [];
|
|
1823
1824
|
if (reaction.source) {
|
|
@@ -9967,6 +9968,11 @@ var Widget = Vue.extend({
|
|
|
9967
9968
|
setState: function setState(key, value) {
|
|
9968
9969
|
if (Reflect.has(this.state, key)) {
|
|
9969
9970
|
this.state[key] = value;
|
|
9971
|
+
// state变化
|
|
9972
|
+
this.$emit('state-change', {
|
|
9973
|
+
path: this.path,
|
|
9974
|
+
state: this.state
|
|
9975
|
+
});
|
|
9970
9976
|
} else if (key === 'value') {
|
|
9971
9977
|
// 特殊处理value设置
|
|
9972
9978
|
this.$emit('input', {
|
|
@@ -10248,7 +10254,9 @@ var NumberField = Vue.extend({
|
|
|
10248
10254
|
'ui:component': {
|
|
10249
10255
|
props: {
|
|
10250
10256
|
type: 'number',
|
|
10251
|
-
min: ((_ctx$props$schema = ctx.props.schema) === null || _ctx$props$schema === void 0 ? void 0 : _ctx$props$schema.type) === 'integer' ? 0 : -Infinity
|
|
10257
|
+
min: ((_ctx$props$schema = ctx.props.schema) === null || _ctx$props$schema === void 0 ? void 0 : _ctx$props$schema.type) === 'integer' ? 0 : -Infinity,
|
|
10258
|
+
allowNumberPaste: true,
|
|
10259
|
+
allowNumberCopy: true
|
|
10252
10260
|
}
|
|
10253
10261
|
}
|
|
10254
10262
|
}, ctx.props.schema)
|
|
@@ -11127,14 +11135,98 @@ var FieldGroupWrap = Vue.extend({
|
|
|
11127
11135
|
|
|
11128
11136
|
function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}var normalMerge=["attrs","props","domProps"],toArrayMerge=["class","style","directives"],functionalMerge=["on","nativeOn"],mergeJsxProps=function(a){return a.reduce(function(c,a){for(var b in a)if(!c[b])c[b]=a[b];else if(-1!==normalMerge.indexOf(b))c[b]=_extends({},c[b],a[b]);else if(-1!==toArrayMerge.indexOf(b)){var d=c[b]instanceof Array?c[b]:[c[b]],e=a[b]instanceof Array?a[b]:[a[b]];c[b]=[].concat(d,e);}else if(-1!==functionalMerge.indexOf(b)){for(var f in a[b])if(c[b][f]){var g=c[b][f]instanceof Array?c[b][f]:[c[b][f]],h=a[b][f]instanceof Array?a[b][f]:[a[b][f]];c[b][f]=[].concat(g,h);}else c[b][f]=a[b][f];}else if("hook"===b)for(var i in a[b])c[b][i]=c[b][i]?mergeFn(c[b][i],a[b][i]):a[b][i];else c[b]=a[b];return c},{})},mergeFn=function(a,b){return function(){a&&a.apply(this,arguments),b&&b.apply(this,arguments);}};var helper=mergeJsxProps;
|
|
11129
11137
|
|
|
11138
|
+
var CommonGroupWrap = Vue.extend({
|
|
11139
|
+
name: 'CommonFieldGroupWrap',
|
|
11140
|
+
inject: ['widgetTree'],
|
|
11141
|
+
props: _objectSpread2(_objectSpread2({}, props), {}, {
|
|
11142
|
+
// 组类型
|
|
11143
|
+
type: {
|
|
11144
|
+
type: String,
|
|
11145
|
+
default: 'default',
|
|
11146
|
+
validator: function validator(value) {
|
|
11147
|
+
return ['default', 'normal', 'card'].includes(value);
|
|
11148
|
+
}
|
|
11149
|
+
},
|
|
11150
|
+
// 是否显示组title
|
|
11151
|
+
showTitle: {
|
|
11152
|
+
type: Boolean,
|
|
11153
|
+
default: false
|
|
11154
|
+
},
|
|
11155
|
+
// 是否显示border
|
|
11156
|
+
border: {
|
|
11157
|
+
type: Boolean,
|
|
11158
|
+
default: false
|
|
11159
|
+
},
|
|
11160
|
+
verifiable: {
|
|
11161
|
+
type: Boolean,
|
|
11162
|
+
default: false
|
|
11163
|
+
},
|
|
11164
|
+
hideEmptyRow: {
|
|
11165
|
+
type: Boolean,
|
|
11166
|
+
default: false
|
|
11167
|
+
},
|
|
11168
|
+
description: {
|
|
11169
|
+
type: String,
|
|
11170
|
+
default: ''
|
|
11171
|
+
},
|
|
11172
|
+
tag: {
|
|
11173
|
+
type: String,
|
|
11174
|
+
default: 'div'
|
|
11175
|
+
}
|
|
11176
|
+
}),
|
|
11177
|
+
data: function data() {
|
|
11178
|
+
return {
|
|
11179
|
+
state: {
|
|
11180
|
+
// 组类型目前只支持visible
|
|
11181
|
+
visible: true
|
|
11182
|
+
}
|
|
11183
|
+
};
|
|
11184
|
+
},
|
|
11185
|
+
created: function created() {
|
|
11186
|
+
// 注册widget TreeNode
|
|
11187
|
+
this.widgetTree.addWidgetNode(this.path, this, 'group');
|
|
11188
|
+
},
|
|
11189
|
+
mounted: function mounted() {
|
|
11190
|
+
// 更新样式
|
|
11191
|
+
this.$forceUpdate();
|
|
11192
|
+
},
|
|
11193
|
+
beforeDestroy: function beforeDestroy() {
|
|
11194
|
+
this.widgetTree.removeWidgetNode(this.path, this);
|
|
11195
|
+
},
|
|
11196
|
+
methods: {
|
|
11197
|
+
setState: function setState(key, value) {
|
|
11198
|
+
if (Reflect.has(this.state, key)) {
|
|
11199
|
+
this.state[key] = value;
|
|
11200
|
+
} else {
|
|
11201
|
+
console.warn("Group unsupported ".concat(key, " state, please check"));
|
|
11202
|
+
}
|
|
11203
|
+
}
|
|
11204
|
+
},
|
|
11205
|
+
render: function render(h) {
|
|
11206
|
+
var _this$layout;
|
|
11207
|
+
var groupContentStyle = _objectSpread2({}, (_this$layout = this.layout) === null || _this$layout === void 0 ? void 0 : _this$layout.container);
|
|
11208
|
+
return h(this.tag, {
|
|
11209
|
+
style: groupContentStyle
|
|
11210
|
+
}, [this.$slots.default]);
|
|
11211
|
+
}
|
|
11212
|
+
});
|
|
11213
|
+
|
|
11130
11214
|
// 伪数组类型
|
|
11131
11215
|
var KeyValueArrayWidget = Vue.extend({
|
|
11132
11216
|
name: 'KeyValueArrayWidget',
|
|
11133
11217
|
props: _objectSpread2({}, props),
|
|
11218
|
+
data: function data() {
|
|
11219
|
+
return {
|
|
11220
|
+
columns: {},
|
|
11221
|
+
showTableHead: false
|
|
11222
|
+
};
|
|
11223
|
+
},
|
|
11134
11224
|
mounted: function mounted() {
|
|
11135
11225
|
var _this$value;
|
|
11136
11226
|
var _this$schema$minItems = this.schema.minItems,
|
|
11137
11227
|
minItems = _this$schema$minItems === void 0 ? 0 : _this$schema$minItems;
|
|
11228
|
+
var uiOptions = Schema.getUiOptions(this.schema);
|
|
11229
|
+
this.showTableHead = !!uiOptions.showTableHead;
|
|
11138
11230
|
// 补全minItems项
|
|
11139
11231
|
if (((_this$value = this.value) === null || _this$value === void 0 ? void 0 : _this$value.length) < minItems) {
|
|
11140
11232
|
var data = Schema.getSchemaDefaultValue(this.schema.items);
|
|
@@ -11176,16 +11268,23 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11176
11268
|
cursor: this.disabled ? 'not-allowed' : 'pointer',
|
|
11177
11269
|
display: 'inline-block'
|
|
11178
11270
|
};
|
|
11271
|
+
var theadStyle = {
|
|
11272
|
+
display: this.showTableHead ? '' : 'none'
|
|
11273
|
+
};
|
|
11274
|
+
var thStyle = {
|
|
11275
|
+
fontSize: '14px',
|
|
11276
|
+
textAlign: 'left',
|
|
11277
|
+
fontWeight: 'normal',
|
|
11278
|
+
color: '#63656E',
|
|
11279
|
+
paddingLeft: '10px',
|
|
11280
|
+
paddingRight: '10px'
|
|
11281
|
+
};
|
|
11282
|
+
var tdStyle = {
|
|
11283
|
+
paddingLeft: '10px',
|
|
11284
|
+
paddingRight: '10px'
|
|
11285
|
+
};
|
|
11179
11286
|
var properties = (_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : (_this$schema$items = _this$schema.items) === null || _this$schema$items === void 0 ? void 0 : _this$schema$items.properties;
|
|
11180
11287
|
var props = orderProperties(Object.keys(properties || {}), (_this$schema2 = this.schema) === null || _this$schema2 === void 0 ? void 0 : (_this$schema2$items = _this$schema2.items) === null || _this$schema2$items === void 0 ? void 0 : _this$schema2$items['ui:order']);
|
|
11181
|
-
// props为空时,表示只有一个项
|
|
11182
|
-
var keysLen = Object.keys(properties || {}).length;
|
|
11183
|
-
var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
|
|
11184
|
-
var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
|
|
11185
|
-
display: 'grid',
|
|
11186
|
-
gridGap: '20px',
|
|
11187
|
-
'grid-template-columns': defaultCols // 默认配置
|
|
11188
|
-
});
|
|
11189
11288
|
var self = this;
|
|
11190
11289
|
var dealSchema = function dealSchema(schema) {
|
|
11191
11290
|
return (
|
|
@@ -11221,6 +11320,11 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11221
11320
|
on: {
|
|
11222
11321
|
input: function input(data) {
|
|
11223
11322
|
self.handleInput(data);
|
|
11323
|
+
},
|
|
11324
|
+
'state-change': function stateChange(_ref2) {
|
|
11325
|
+
var path = _ref2.path,
|
|
11326
|
+
state = _ref2.state;
|
|
11327
|
+
_this.$set(_this.columns, path, state);
|
|
11224
11328
|
}
|
|
11225
11329
|
},
|
|
11226
11330
|
style: {
|
|
@@ -11228,37 +11332,53 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11228
11332
|
}
|
|
11229
11333
|
});
|
|
11230
11334
|
};
|
|
11231
|
-
return h("
|
|
11232
|
-
|
|
11335
|
+
return h("table", [h("thead", {
|
|
11336
|
+
"style": theadStyle
|
|
11337
|
+
}, [h("tr", [props === null || props === void 0 ? void 0 : props.map(function (prop) {
|
|
11338
|
+
var _this$schema3, _this$schema3$items, _this$columns$path;
|
|
11339
|
+
var schemaItem = (_this$schema3 = _this.schema) === null || _this$schema3 === void 0 ? void 0 : (_this$schema3$items = _this$schema3.items) === null || _this$schema3$items === void 0 ? void 0 : _this$schema3$items.properties[prop];
|
|
11340
|
+
var path = Path.getCurPath(_this.path, "0.".concat(prop));
|
|
11341
|
+
return h("th", {
|
|
11342
|
+
"style": _objectSpread2(_objectSpread2({}, thStyle), {}, {
|
|
11343
|
+
display: ((_this$columns$path = _this.columns[path]) === null || _this$columns$path === void 0 ? void 0 : _this$columns$path.visible) === false ? 'none' : ''
|
|
11344
|
+
})
|
|
11345
|
+
}, [schemaItem === null || schemaItem === void 0 ? void 0 : schemaItem.title]);
|
|
11346
|
+
}), h("th")])]), h("tbody", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
|
|
11347
|
+
var _this$schema5;
|
|
11233
11348
|
var groupPath = Path.getCurPath(_this.path, "".concat(index));
|
|
11234
|
-
return h(
|
|
11349
|
+
return h(CommonGroupWrap, helper([{}, {
|
|
11235
11350
|
"props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
|
|
11236
11351
|
path: groupPath,
|
|
11237
11352
|
value: Path.getPathVal(_this.rootData, groupPath),
|
|
11238
11353
|
schema: _this.schema.items,
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
})
|
|
11354
|
+
tag: 'tr',
|
|
11355
|
+
layout: _objectSpread2({}, _this.layout)
|
|
11242
11356
|
})
|
|
11243
11357
|
}]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
|
|
11244
|
-
var _this$
|
|
11245
|
-
var schemaItem = (_this$
|
|
11358
|
+
var _this$schema4, _this$schema4$items, _this$columns$curPath;
|
|
11359
|
+
var schemaItem = (_this$schema4 = _this.schema) === null || _this$schema4 === void 0 ? void 0 : (_this$schema4$items = _this$schema4.items) === null || _this$schema4$items === void 0 ? void 0 : _this$schema4$items.properties[prop];
|
|
11246
11360
|
var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
|
|
11247
11361
|
var lastProp = curPath.split('.').pop();
|
|
11248
11362
|
var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
|
|
11249
|
-
return
|
|
11363
|
+
return h("td", {
|
|
11364
|
+
"style": _objectSpread2(_objectSpread2({}, tdStyle), {}, {
|
|
11365
|
+
display: ((_this$columns$curPath = _this.columns[curPath]) === null || _this$columns$curPath === void 0 ? void 0 : _this$columns$curPath.visible) === false ? 'none' : ''
|
|
11366
|
+
})
|
|
11367
|
+
}, [renderSchemaField({
|
|
11250
11368
|
path: curPath,
|
|
11251
11369
|
schema: dealSchema(schemaItem),
|
|
11252
11370
|
layout: layoutConfig,
|
|
11253
11371
|
required: Schema.isRequired(schemaItem, prop)
|
|
11254
|
-
});
|
|
11255
|
-
}) : renderSchemaField({
|
|
11372
|
+
})]);
|
|
11373
|
+
}) : h("td", [renderSchemaField({
|
|
11256
11374
|
path: Path.getCurPath(_this.path, index),
|
|
11257
|
-
schema: dealSchema(((_this$
|
|
11375
|
+
schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
|
|
11258
11376
|
layout: {},
|
|
11259
11377
|
required: false
|
|
11260
|
-
}), h("span", {
|
|
11261
|
-
"style": labelBtnStyle,
|
|
11378
|
+
})]), h("td", [h("span", {
|
|
11379
|
+
"style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
|
|
11380
|
+
marginBottom: '10px'
|
|
11381
|
+
}),
|
|
11262
11382
|
"on": {
|
|
11263
11383
|
"click": function click() {
|
|
11264
11384
|
return _this.handleRemoveItem(index);
|
|
@@ -11266,7 +11386,7 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11266
11386
|
}
|
|
11267
11387
|
}, [h("i", {
|
|
11268
11388
|
"class": "bk-icon icon-minus-line"
|
|
11269
|
-
})])]);
|
|
11389
|
+
})])])]);
|
|
11270
11390
|
}), h("span", {
|
|
11271
11391
|
"on": {
|
|
11272
11392
|
"click": this.handleAddItem
|
|
@@ -11274,7 +11394,7 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11274
11394
|
"style": labelBtnStyle
|
|
11275
11395
|
}, [h("i", {
|
|
11276
11396
|
"class": "bk-icon icon-plus-line"
|
|
11277
|
-
})])]);
|
|
11397
|
+
})])])]);
|
|
11278
11398
|
}
|
|
11279
11399
|
});
|
|
11280
11400
|
|