@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-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', {
|
|
@@ -11129,14 +11135,98 @@ var FieldGroupWrap = Vue.extend({
|
|
|
11129
11135
|
|
|
11130
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;
|
|
11131
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
|
+
|
|
11132
11214
|
// 伪数组类型
|
|
11133
11215
|
var KeyValueArrayWidget = Vue.extend({
|
|
11134
11216
|
name: 'KeyValueArrayWidget',
|
|
11135
11217
|
props: _objectSpread2({}, props),
|
|
11218
|
+
data: function data() {
|
|
11219
|
+
return {
|
|
11220
|
+
columns: {},
|
|
11221
|
+
showTableHead: false
|
|
11222
|
+
};
|
|
11223
|
+
},
|
|
11136
11224
|
mounted: function mounted() {
|
|
11137
11225
|
var _this$value;
|
|
11138
11226
|
var _this$schema$minItems = this.schema.minItems,
|
|
11139
11227
|
minItems = _this$schema$minItems === void 0 ? 0 : _this$schema$minItems;
|
|
11228
|
+
var uiOptions = Schema.getUiOptions(this.schema);
|
|
11229
|
+
this.showTableHead = !!uiOptions.showTableHead;
|
|
11140
11230
|
// 补全minItems项
|
|
11141
11231
|
if (((_this$value = this.value) === null || _this$value === void 0 ? void 0 : _this$value.length) < minItems) {
|
|
11142
11232
|
var data = Schema.getSchemaDefaultValue(this.schema.items);
|
|
@@ -11178,16 +11268,23 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11178
11268
|
cursor: this.disabled ? 'not-allowed' : 'pointer',
|
|
11179
11269
|
display: 'inline-block'
|
|
11180
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
|
+
};
|
|
11181
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;
|
|
11182
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']);
|
|
11183
|
-
// props为空时,表示只有一个项
|
|
11184
|
-
var keysLen = Object.keys(properties || {}).length;
|
|
11185
|
-
var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
|
|
11186
|
-
var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
|
|
11187
|
-
display: 'grid',
|
|
11188
|
-
gridGap: '20px',
|
|
11189
|
-
'grid-template-columns': defaultCols // 默认配置
|
|
11190
|
-
});
|
|
11191
11288
|
var self = this;
|
|
11192
11289
|
var dealSchema = function dealSchema(schema) {
|
|
11193
11290
|
return (
|
|
@@ -11223,6 +11320,11 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11223
11320
|
on: {
|
|
11224
11321
|
input: function input(data) {
|
|
11225
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);
|
|
11226
11328
|
}
|
|
11227
11329
|
},
|
|
11228
11330
|
style: {
|
|
@@ -11230,37 +11332,53 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11230
11332
|
}
|
|
11231
11333
|
});
|
|
11232
11334
|
};
|
|
11233
|
-
return h("
|
|
11234
|
-
|
|
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;
|
|
11235
11348
|
var groupPath = Path.getCurPath(_this.path, "".concat(index));
|
|
11236
|
-
return h(
|
|
11349
|
+
return h(CommonGroupWrap, helper([{}, {
|
|
11237
11350
|
"props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
|
|
11238
11351
|
path: groupPath,
|
|
11239
11352
|
value: Path.getPathVal(_this.rootData, groupPath),
|
|
11240
11353
|
schema: _this.schema.items,
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
})
|
|
11354
|
+
tag: 'tr',
|
|
11355
|
+
layout: _objectSpread2({}, _this.layout)
|
|
11244
11356
|
})
|
|
11245
11357
|
}]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
|
|
11246
|
-
var _this$
|
|
11247
|
-
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];
|
|
11248
11360
|
var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
|
|
11249
11361
|
var lastProp = curPath.split('.').pop();
|
|
11250
11362
|
var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
|
|
11251
|
-
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({
|
|
11252
11368
|
path: curPath,
|
|
11253
11369
|
schema: dealSchema(schemaItem),
|
|
11254
11370
|
layout: layoutConfig,
|
|
11255
11371
|
required: Schema.isRequired(schemaItem, prop)
|
|
11256
|
-
});
|
|
11257
|
-
}) : renderSchemaField({
|
|
11372
|
+
})]);
|
|
11373
|
+
}) : h("td", [renderSchemaField({
|
|
11258
11374
|
path: Path.getCurPath(_this.path, index),
|
|
11259
|
-
schema: dealSchema(((_this$
|
|
11375
|
+
schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
|
|
11260
11376
|
layout: {},
|
|
11261
11377
|
required: false
|
|
11262
|
-
}), h("span", {
|
|
11263
|
-
"style": labelBtnStyle,
|
|
11378
|
+
})]), h("td", [h("span", {
|
|
11379
|
+
"style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
|
|
11380
|
+
marginBottom: '10px'
|
|
11381
|
+
}),
|
|
11264
11382
|
"on": {
|
|
11265
11383
|
"click": function click() {
|
|
11266
11384
|
return _this.handleRemoveItem(index);
|
|
@@ -11268,7 +11386,7 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11268
11386
|
}
|
|
11269
11387
|
}, [h("i", {
|
|
11270
11388
|
"class": "bk-icon icon-minus-line"
|
|
11271
|
-
})])]);
|
|
11389
|
+
})])])]);
|
|
11272
11390
|
}), h("span", {
|
|
11273
11391
|
"on": {
|
|
11274
11392
|
"click": this.handleAddItem
|
|
@@ -11276,7 +11394,7 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11276
11394
|
"style": labelBtnStyle
|
|
11277
11395
|
}, [h("i", {
|
|
11278
11396
|
"class": "bk-icon icon-plus-line"
|
|
11279
|
-
})])]);
|
|
11397
|
+
})])])]);
|
|
11280
11398
|
}
|
|
11281
11399
|
});
|
|
11282
11400
|
|