@blueking/bkui-form 0.0.44 → 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 +142 -24
- package/dist/bkui-form-es.js.map +1 -1
- package/dist/bkui-form-umd-min.js +2 -2
- package/dist/bkui-form-umd.js +142 -24
- package/dist/bkui-form-umd.js.map +1 -1
- package/package.json +1 -1
package/dist/bkui-form-umd.js
CHANGED
|
@@ -1826,6 +1826,7 @@
|
|
|
1826
1826
|
crtInstance = _ref.instance; // 当前组件实例,用来条件表达式判断
|
|
1827
1827
|
var _ref2 = widgetTree.widgetMap[targetPath] || {},
|
|
1828
1828
|
operateInstance = _ref2.instance; // 需要执行操作的组件实例,可能为其他组件也可能为当前组件
|
|
1829
|
+
if (!crtInstance || !operateInstance) return;
|
|
1829
1830
|
var fullfill = true;
|
|
1830
1831
|
var deps = [];
|
|
1831
1832
|
if (reaction.source) {
|
|
@@ -9975,6 +9976,11 @@
|
|
|
9975
9976
|
setState: function setState(key, value) {
|
|
9976
9977
|
if (Reflect.has(this.state, key)) {
|
|
9977
9978
|
this.state[key] = value;
|
|
9979
|
+
// state变化
|
|
9980
|
+
this.$emit('state-change', {
|
|
9981
|
+
path: this.path,
|
|
9982
|
+
state: this.state
|
|
9983
|
+
});
|
|
9978
9984
|
} else if (key === 'value') {
|
|
9979
9985
|
// 特殊处理value设置
|
|
9980
9986
|
this.$emit('input', {
|
|
@@ -11137,14 +11143,98 @@
|
|
|
11137
11143
|
|
|
11138
11144
|
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;
|
|
11139
11145
|
|
|
11146
|
+
var CommonGroupWrap = Vue__default["default"].extend({
|
|
11147
|
+
name: 'CommonFieldGroupWrap',
|
|
11148
|
+
inject: ['widgetTree'],
|
|
11149
|
+
props: _objectSpread2(_objectSpread2({}, props), {}, {
|
|
11150
|
+
// 组类型
|
|
11151
|
+
type: {
|
|
11152
|
+
type: String,
|
|
11153
|
+
default: 'default',
|
|
11154
|
+
validator: function validator(value) {
|
|
11155
|
+
return ['default', 'normal', 'card'].includes(value);
|
|
11156
|
+
}
|
|
11157
|
+
},
|
|
11158
|
+
// 是否显示组title
|
|
11159
|
+
showTitle: {
|
|
11160
|
+
type: Boolean,
|
|
11161
|
+
default: false
|
|
11162
|
+
},
|
|
11163
|
+
// 是否显示border
|
|
11164
|
+
border: {
|
|
11165
|
+
type: Boolean,
|
|
11166
|
+
default: false
|
|
11167
|
+
},
|
|
11168
|
+
verifiable: {
|
|
11169
|
+
type: Boolean,
|
|
11170
|
+
default: false
|
|
11171
|
+
},
|
|
11172
|
+
hideEmptyRow: {
|
|
11173
|
+
type: Boolean,
|
|
11174
|
+
default: false
|
|
11175
|
+
},
|
|
11176
|
+
description: {
|
|
11177
|
+
type: String,
|
|
11178
|
+
default: ''
|
|
11179
|
+
},
|
|
11180
|
+
tag: {
|
|
11181
|
+
type: String,
|
|
11182
|
+
default: 'div'
|
|
11183
|
+
}
|
|
11184
|
+
}),
|
|
11185
|
+
data: function data() {
|
|
11186
|
+
return {
|
|
11187
|
+
state: {
|
|
11188
|
+
// 组类型目前只支持visible
|
|
11189
|
+
visible: true
|
|
11190
|
+
}
|
|
11191
|
+
};
|
|
11192
|
+
},
|
|
11193
|
+
created: function created() {
|
|
11194
|
+
// 注册widget TreeNode
|
|
11195
|
+
this.widgetTree.addWidgetNode(this.path, this, 'group');
|
|
11196
|
+
},
|
|
11197
|
+
mounted: function mounted() {
|
|
11198
|
+
// 更新样式
|
|
11199
|
+
this.$forceUpdate();
|
|
11200
|
+
},
|
|
11201
|
+
beforeDestroy: function beforeDestroy() {
|
|
11202
|
+
this.widgetTree.removeWidgetNode(this.path, this);
|
|
11203
|
+
},
|
|
11204
|
+
methods: {
|
|
11205
|
+
setState: function setState(key, value) {
|
|
11206
|
+
if (Reflect.has(this.state, key)) {
|
|
11207
|
+
this.state[key] = value;
|
|
11208
|
+
} else {
|
|
11209
|
+
console.warn("Group unsupported ".concat(key, " state, please check"));
|
|
11210
|
+
}
|
|
11211
|
+
}
|
|
11212
|
+
},
|
|
11213
|
+
render: function render(h) {
|
|
11214
|
+
var _this$layout;
|
|
11215
|
+
var groupContentStyle = _objectSpread2({}, (_this$layout = this.layout) === null || _this$layout === void 0 ? void 0 : _this$layout.container);
|
|
11216
|
+
return h(this.tag, {
|
|
11217
|
+
style: groupContentStyle
|
|
11218
|
+
}, [this.$slots.default]);
|
|
11219
|
+
}
|
|
11220
|
+
});
|
|
11221
|
+
|
|
11140
11222
|
// 伪数组类型
|
|
11141
11223
|
var KeyValueArrayWidget = Vue__default["default"].extend({
|
|
11142
11224
|
name: 'KeyValueArrayWidget',
|
|
11143
11225
|
props: _objectSpread2({}, props),
|
|
11226
|
+
data: function data() {
|
|
11227
|
+
return {
|
|
11228
|
+
columns: {},
|
|
11229
|
+
showTableHead: false
|
|
11230
|
+
};
|
|
11231
|
+
},
|
|
11144
11232
|
mounted: function mounted() {
|
|
11145
11233
|
var _this$value;
|
|
11146
11234
|
var _this$schema$minItems = this.schema.minItems,
|
|
11147
11235
|
minItems = _this$schema$minItems === void 0 ? 0 : _this$schema$minItems;
|
|
11236
|
+
var uiOptions = Schema.getUiOptions(this.schema);
|
|
11237
|
+
this.showTableHead = !!uiOptions.showTableHead;
|
|
11148
11238
|
// 补全minItems项
|
|
11149
11239
|
if (((_this$value = this.value) === null || _this$value === void 0 ? void 0 : _this$value.length) < minItems) {
|
|
11150
11240
|
var data = Schema.getSchemaDefaultValue(this.schema.items);
|
|
@@ -11186,16 +11276,23 @@
|
|
|
11186
11276
|
cursor: this.disabled ? 'not-allowed' : 'pointer',
|
|
11187
11277
|
display: 'inline-block'
|
|
11188
11278
|
};
|
|
11279
|
+
var theadStyle = {
|
|
11280
|
+
display: this.showTableHead ? '' : 'none'
|
|
11281
|
+
};
|
|
11282
|
+
var thStyle = {
|
|
11283
|
+
fontSize: '14px',
|
|
11284
|
+
textAlign: 'left',
|
|
11285
|
+
fontWeight: 'normal',
|
|
11286
|
+
color: '#63656E',
|
|
11287
|
+
paddingLeft: '10px',
|
|
11288
|
+
paddingRight: '10px'
|
|
11289
|
+
};
|
|
11290
|
+
var tdStyle = {
|
|
11291
|
+
paddingLeft: '10px',
|
|
11292
|
+
paddingRight: '10px'
|
|
11293
|
+
};
|
|
11189
11294
|
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;
|
|
11190
11295
|
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']);
|
|
11191
|
-
// props为空时,表示只有一个项
|
|
11192
|
-
var keysLen = Object.keys(properties || {}).length;
|
|
11193
|
-
var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
|
|
11194
|
-
var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
|
|
11195
|
-
display: 'grid',
|
|
11196
|
-
gridGap: '20px',
|
|
11197
|
-
'grid-template-columns': defaultCols // 默认配置
|
|
11198
|
-
});
|
|
11199
11296
|
var self = this;
|
|
11200
11297
|
var dealSchema = function dealSchema(schema) {
|
|
11201
11298
|
return (
|
|
@@ -11231,6 +11328,11 @@
|
|
|
11231
11328
|
on: {
|
|
11232
11329
|
input: function input(data) {
|
|
11233
11330
|
self.handleInput(data);
|
|
11331
|
+
},
|
|
11332
|
+
'state-change': function stateChange(_ref2) {
|
|
11333
|
+
var path = _ref2.path,
|
|
11334
|
+
state = _ref2.state;
|
|
11335
|
+
_this.$set(_this.columns, path, state);
|
|
11234
11336
|
}
|
|
11235
11337
|
},
|
|
11236
11338
|
style: {
|
|
@@ -11238,37 +11340,53 @@
|
|
|
11238
11340
|
}
|
|
11239
11341
|
});
|
|
11240
11342
|
};
|
|
11241
|
-
return h("
|
|
11242
|
-
|
|
11343
|
+
return h("table", [h("thead", {
|
|
11344
|
+
"style": theadStyle
|
|
11345
|
+
}, [h("tr", [props === null || props === void 0 ? void 0 : props.map(function (prop) {
|
|
11346
|
+
var _this$schema3, _this$schema3$items, _this$columns$path;
|
|
11347
|
+
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];
|
|
11348
|
+
var path = Path.getCurPath(_this.path, "0.".concat(prop));
|
|
11349
|
+
return h("th", {
|
|
11350
|
+
"style": _objectSpread2(_objectSpread2({}, thStyle), {}, {
|
|
11351
|
+
display: ((_this$columns$path = _this.columns[path]) === null || _this$columns$path === void 0 ? void 0 : _this$columns$path.visible) === false ? 'none' : ''
|
|
11352
|
+
})
|
|
11353
|
+
}, [schemaItem === null || schemaItem === void 0 ? void 0 : schemaItem.title]);
|
|
11354
|
+
}), h("th")])]), h("tbody", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
|
|
11355
|
+
var _this$schema5;
|
|
11243
11356
|
var groupPath = Path.getCurPath(_this.path, "".concat(index));
|
|
11244
|
-
return h(
|
|
11357
|
+
return h(CommonGroupWrap, helper([{}, {
|
|
11245
11358
|
"props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
|
|
11246
11359
|
path: groupPath,
|
|
11247
11360
|
value: Path.getPathVal(_this.rootData, groupPath),
|
|
11248
11361
|
schema: _this.schema.items,
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
})
|
|
11362
|
+
tag: 'tr',
|
|
11363
|
+
layout: _objectSpread2({}, _this.layout)
|
|
11252
11364
|
})
|
|
11253
11365
|
}]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
|
|
11254
|
-
var _this$
|
|
11255
|
-
var schemaItem = (_this$
|
|
11366
|
+
var _this$schema4, _this$schema4$items, _this$columns$curPath;
|
|
11367
|
+
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];
|
|
11256
11368
|
var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
|
|
11257
11369
|
var lastProp = curPath.split('.').pop();
|
|
11258
11370
|
var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
|
|
11259
|
-
return
|
|
11371
|
+
return h("td", {
|
|
11372
|
+
"style": _objectSpread2(_objectSpread2({}, tdStyle), {}, {
|
|
11373
|
+
display: ((_this$columns$curPath = _this.columns[curPath]) === null || _this$columns$curPath === void 0 ? void 0 : _this$columns$curPath.visible) === false ? 'none' : ''
|
|
11374
|
+
})
|
|
11375
|
+
}, [renderSchemaField({
|
|
11260
11376
|
path: curPath,
|
|
11261
11377
|
schema: dealSchema(schemaItem),
|
|
11262
11378
|
layout: layoutConfig,
|
|
11263
11379
|
required: Schema.isRequired(schemaItem, prop)
|
|
11264
|
-
});
|
|
11265
|
-
}) : renderSchemaField({
|
|
11380
|
+
})]);
|
|
11381
|
+
}) : h("td", [renderSchemaField({
|
|
11266
11382
|
path: Path.getCurPath(_this.path, index),
|
|
11267
|
-
schema: dealSchema(((_this$
|
|
11383
|
+
schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
|
|
11268
11384
|
layout: {},
|
|
11269
11385
|
required: false
|
|
11270
|
-
}), h("span", {
|
|
11271
|
-
"style": labelBtnStyle,
|
|
11386
|
+
})]), h("td", [h("span", {
|
|
11387
|
+
"style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
|
|
11388
|
+
marginBottom: '10px'
|
|
11389
|
+
}),
|
|
11272
11390
|
"on": {
|
|
11273
11391
|
"click": function click() {
|
|
11274
11392
|
return _this.handleRemoveItem(index);
|
|
@@ -11276,7 +11394,7 @@
|
|
|
11276
11394
|
}
|
|
11277
11395
|
}, [h("i", {
|
|
11278
11396
|
"class": "bk-icon icon-minus-line"
|
|
11279
|
-
})])]);
|
|
11397
|
+
})])])]);
|
|
11280
11398
|
}), h("span", {
|
|
11281
11399
|
"on": {
|
|
11282
11400
|
"click": this.handleAddItem
|
|
@@ -11284,7 +11402,7 @@
|
|
|
11284
11402
|
"style": labelBtnStyle
|
|
11285
11403
|
}, [h("i", {
|
|
11286
11404
|
"class": "bk-icon icon-plus-line"
|
|
11287
|
-
})])]);
|
|
11405
|
+
})])])]);
|
|
11288
11406
|
}
|
|
11289
11407
|
});
|
|
11290
11408
|
|