@blueking/bkui-form 0.0.30 → 0.0.31
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/bkui-form-es-min.js +3 -3
- package/dist/bkui-form-es.js +168 -16
- package/dist/bkui-form-es.js.map +1 -1
- package/dist/bkui-form-umd-min.js +3 -3
- package/dist/bkui-form-umd.js +168 -16
- package/dist/bkui-form-umd.js.map +1 -1
- package/dist/bkui-form.css +9 -0
- package/dist/types/bkui-form.d.ts +1 -1
- package/package.json +1 -1
package/dist/bkui-form-es.js
CHANGED
|
@@ -2192,22 +2192,24 @@ var WidgetTree = /*#__PURE__*/function () {
|
|
|
2192
2192
|
value: function removeWidgetNode(path, instance) {
|
|
2193
2193
|
var node = this.widgetMap[path];
|
|
2194
2194
|
|
|
2195
|
-
if (node
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
if (index > -1) {
|
|
2202
|
-
children.splice(index, 1);
|
|
2203
|
-
children.slice(index).forEach(function (node, i) {
|
|
2204
|
-
node.index = index + i;
|
|
2195
|
+
if (node) {
|
|
2196
|
+
if (node.parent) {
|
|
2197
|
+
var children = node.parent.children;
|
|
2198
|
+
var index = children.findIndex(function (item) {
|
|
2199
|
+
return item.instance === instance;
|
|
2205
2200
|
});
|
|
2201
|
+
|
|
2202
|
+
if (index > -1) {
|
|
2203
|
+
children.splice(index, 1);
|
|
2204
|
+
children.slice(index).forEach(function (node, i) {
|
|
2205
|
+
node.index = index + i;
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2206
2208
|
}
|
|
2207
|
-
}
|
|
2208
2209
|
|
|
2209
|
-
|
|
2210
|
-
|
|
2210
|
+
if (node.instance === instance) {
|
|
2211
|
+
delete this.widgetMap[path];
|
|
2212
|
+
}
|
|
2211
2213
|
}
|
|
2212
2214
|
}
|
|
2213
2215
|
}]);
|
|
@@ -10562,7 +10564,9 @@ var Widget = Vue.extend({
|
|
|
10562
10564
|
})
|
|
10563
10565
|
}, mergeDeep(uiVnodeData, {
|
|
10564
10566
|
props: _objectSpread2(_objectSpread2({}, this.state), {}, {
|
|
10565
|
-
datasource: this.datasource
|
|
10567
|
+
datasource: this.datasource,
|
|
10568
|
+
readonly: this.readonly,
|
|
10569
|
+
readonlyMode: this.readonlyMode
|
|
10566
10570
|
}),
|
|
10567
10571
|
attrs: _objectSpread2({}, this.state)
|
|
10568
10572
|
})));
|
|
@@ -11207,12 +11211,160 @@ var ButtonWidget = Vue.extend({
|
|
|
11207
11211
|
}
|
|
11208
11212
|
});
|
|
11209
11213
|
|
|
11214
|
+
// 获取表格单行默认值
|
|
11215
|
+
|
|
11216
|
+
var getRowDefaultData = function getRowDefaultData() {
|
|
11217
|
+
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11218
|
+
var keys = Object.keys(properties);
|
|
11219
|
+
var data = {};
|
|
11220
|
+
keys.forEach(function (key) {
|
|
11221
|
+
data[key] = Schema.getSchemaDefaultValue(properties[key]);
|
|
11222
|
+
});
|
|
11223
|
+
return [data];
|
|
11224
|
+
};
|
|
11225
|
+
|
|
11210
11226
|
var TableWidget = Vue.extend({
|
|
11211
11227
|
name: 'TableWidget',
|
|
11228
|
+
props: props,
|
|
11229
|
+
methods: {
|
|
11230
|
+
// 单元格表单编辑
|
|
11231
|
+
handleCellValChange: function handleCellValChange(_ref) {
|
|
11232
|
+
var path = _ref.path,
|
|
11233
|
+
value = _ref.value;
|
|
11234
|
+
var subPath = Path.getSubPath(this.path, path);
|
|
11235
|
+
var newValue = Path.setPathValue(this.value, subPath, value);
|
|
11236
|
+
this.$emit('input', newValue);
|
|
11237
|
+
},
|
|
11238
|
+
// 新增
|
|
11239
|
+
handleAddRow: function handleAddRow(index) {
|
|
11240
|
+
var _this$$props$schema$i;
|
|
11241
|
+
|
|
11242
|
+
var newValue = this.value.slice(0);
|
|
11243
|
+
newValue.splice.apply(newValue, [index + 1, 0].concat(_toConsumableArray(getRowDefaultData((_this$$props$schema$i = this.$props.schema.items) === null || _this$$props$schema$i === void 0 ? void 0 : _this$$props$schema$i.properties))));
|
|
11244
|
+
this.$emit('input', newValue);
|
|
11245
|
+
},
|
|
11246
|
+
// 删除
|
|
11247
|
+
handleDelRow: function handleDelRow(index) {
|
|
11248
|
+
var newValue = this.value.slice(0);
|
|
11249
|
+
newValue.splice(index, 1);
|
|
11250
|
+
this.$emit('input', newValue);
|
|
11251
|
+
}
|
|
11252
|
+
},
|
|
11212
11253
|
render: function render(h) {
|
|
11254
|
+
var _schema$items,
|
|
11255
|
+
_this = this;
|
|
11256
|
+
|
|
11257
|
+
var self = this;
|
|
11258
|
+
var _this$$props = this.$props,
|
|
11259
|
+
schema = _this$$props.schema,
|
|
11260
|
+
readonly = _this$$props.readonly,
|
|
11261
|
+
readonlyMode = _this$$props.readonlyMode,
|
|
11262
|
+
path = _this$$props.path,
|
|
11263
|
+
context = _this$$props.context,
|
|
11264
|
+
rootData = _this$$props.rootData,
|
|
11265
|
+
value = _this$$props.value;
|
|
11266
|
+
var columnsKey = Object.keys(((_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.properties) || []);
|
|
11267
|
+
|
|
11268
|
+
var getTableColumn = function getTableColumn() {
|
|
11269
|
+
var VNodeList = columnsKey.map(function (key) {
|
|
11270
|
+
var colField = schema.items.properties[key];
|
|
11271
|
+
return h(registry.getBaseWidget('table-column'), {
|
|
11272
|
+
props: {
|
|
11273
|
+
label: colField.title
|
|
11274
|
+
},
|
|
11275
|
+
scopedSlots: {
|
|
11276
|
+
default: function _default(props) {
|
|
11277
|
+
return h(SchemaField, {
|
|
11278
|
+
props: {
|
|
11279
|
+
context: context,
|
|
11280
|
+
rootData: rootData,
|
|
11281
|
+
readonly: readonly,
|
|
11282
|
+
readonlyMode: readonlyMode,
|
|
11283
|
+
schema: mergeDeep(colField, {
|
|
11284
|
+
'ui:props': {
|
|
11285
|
+
// 默认不展示标题
|
|
11286
|
+
showTitle: false,
|
|
11287
|
+
// 0.1 兼容formItem设置 labelWidth 0 不生效问题
|
|
11288
|
+
labelWidth: 0.1
|
|
11289
|
+
}
|
|
11290
|
+
}),
|
|
11291
|
+
path: Path.getCurPath(path, "".concat(props.$index, ".").concat(key)),
|
|
11292
|
+
value: props.row[key]
|
|
11293
|
+
},
|
|
11294
|
+
on: {
|
|
11295
|
+
input: function input(data) {
|
|
11296
|
+
self.handleCellValChange(data);
|
|
11297
|
+
}
|
|
11298
|
+
}
|
|
11299
|
+
}, [props.row]);
|
|
11300
|
+
}
|
|
11301
|
+
}
|
|
11302
|
+
});
|
|
11303
|
+
});
|
|
11304
|
+
|
|
11305
|
+
if (!_this.readonly) {
|
|
11306
|
+
VNodeList.push(h(registry.getBaseWidget('table-column'), {
|
|
11307
|
+
props: {
|
|
11308
|
+
label: '操作',
|
|
11309
|
+
width: 100
|
|
11310
|
+
},
|
|
11311
|
+
scopedSlots: {
|
|
11312
|
+
default: function _default(props) {
|
|
11313
|
+
return h('div', {
|
|
11314
|
+
class: 'table-widget-actions'
|
|
11315
|
+
}, [h('i', {
|
|
11316
|
+
class: 'bk-icon icon-plus-circle action-btn',
|
|
11317
|
+
on: {
|
|
11318
|
+
click: function click() {
|
|
11319
|
+
self.handleAddRow(props.$index);
|
|
11320
|
+
}
|
|
11321
|
+
}
|
|
11322
|
+
}), h('i', {
|
|
11323
|
+
class: 'bk-icon icon-minus-circle action-btn',
|
|
11324
|
+
on: {
|
|
11325
|
+
click: function click() {
|
|
11326
|
+
self.handleDelRow(props.$index);
|
|
11327
|
+
}
|
|
11328
|
+
}
|
|
11329
|
+
})]);
|
|
11330
|
+
}
|
|
11331
|
+
}
|
|
11332
|
+
}));
|
|
11333
|
+
}
|
|
11334
|
+
|
|
11335
|
+
return VNodeList;
|
|
11336
|
+
};
|
|
11337
|
+
|
|
11213
11338
|
return h(registry.getBaseWidget('table'), {
|
|
11214
|
-
props: _objectSpread2({},
|
|
11215
|
-
|
|
11339
|
+
props: _objectSpread2(_objectSpread2({}, schema['ui:component'].props || {}), {}, {
|
|
11340
|
+
data: value
|
|
11341
|
+
}),
|
|
11342
|
+
on: {
|
|
11343
|
+
input: function input(_ref2) {
|
|
11344
|
+
var path = _ref2.path,
|
|
11345
|
+
value = _ref2.value;
|
|
11346
|
+
self.$emit('input', {
|
|
11347
|
+
path: path,
|
|
11348
|
+
value: value
|
|
11349
|
+
});
|
|
11350
|
+
}
|
|
11351
|
+
},
|
|
11352
|
+
scopedSlots: {
|
|
11353
|
+
empty: function empty() {
|
|
11354
|
+
return _this.readonly ? null : h('div', {
|
|
11355
|
+
style: {
|
|
11356
|
+
'color': '#3a84ff',
|
|
11357
|
+
'cursor': 'pointer'
|
|
11358
|
+
},
|
|
11359
|
+
on: {
|
|
11360
|
+
click: function click() {
|
|
11361
|
+
self.handleAddRow(0);
|
|
11362
|
+
}
|
|
11363
|
+
}
|
|
11364
|
+
}, '点击添加数据');
|
|
11365
|
+
}
|
|
11366
|
+
}
|
|
11367
|
+
}, getTableColumn());
|
|
11216
11368
|
}
|
|
11217
11369
|
});
|
|
11218
11370
|
|