@blueking/bkui-form 0.0.42-beta.2 → 0.0.42-beta.4

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.
@@ -836,7 +836,6 @@ var Registry = /*#__PURE__*/function () {
836
836
  key = _ref2[0],
837
837
  value = _ref2[1];
838
838
  if (_this[props].has(key)) {
839
- console.warn('repeat key', key);
840
839
  return;
841
840
  }
842
841
  _this[props].set(key, value);
@@ -1535,6 +1534,10 @@ var props$1 = {
1535
1534
  type: Boolean,
1536
1535
  default: false
1537
1536
  },
1537
+ disabled: {
1538
+ type: Boolean,
1539
+ default: false
1540
+ },
1538
1541
  readonlyMode: {
1539
1542
  type: String,
1540
1543
  default: 'value',
@@ -10225,7 +10228,14 @@ var Widget = Vue.extend({
10225
10228
  }
10226
10229
  },
10227
10230
  render: function render(h) {
10228
- var _events$callbacks, _this$$scopedSlots$de, _this$$scopedSlots$de2, _this$$scopedSlots, _this$widgetSchema$ui5, _this$$scopedSlots$su, _this$$scopedSlots2;
10231
+ var _events$callbacks,
10232
+ _this$$scopedSlots$de,
10233
+ _this$$scopedSlots$de2,
10234
+ _this$$scopedSlots,
10235
+ _this5 = this,
10236
+ _this$widgetSchema$ui5,
10237
+ _this$$scopedSlots$su,
10238
+ _this$$scopedSlots2;
10229
10239
  var _Schema$getUiComponen = Schema.getUiComponent(this.widgetSchema),
10230
10240
  name = _Schema$getUiComponen.name,
10231
10241
  uiVnodeData = _objectWithoutProperties(_Schema$getUiComponen, _excluded2);
@@ -10274,7 +10284,10 @@ var Widget = Vue.extend({
10274
10284
  // 渲染删除按钮(用于数组类型widget删除)
10275
10285
  var renderDelete = function renderDelete() {
10276
10286
  return h('span', {
10277
- class: ['bk-schema-form-group-delete'],
10287
+ class: ['bk-schema-form-group-delete', {
10288
+ disabled: _this5.disabled,
10289
+ readonly: _this5.readonly
10290
+ }],
10278
10291
  style: {
10279
10292
  right: '0px',
10280
10293
  top: '0px'
@@ -10437,6 +10450,7 @@ var ArrayWidget = Vue.extend({
10437
10450
  },
10438
10451
  // 添加item
10439
10452
  handleAddItem: function handleAddItem() {
10453
+ if (this.disabled || this.readonly) return;
10440
10454
  var data = Schema.getSchemaDefaultValue(this.schema.items);
10441
10455
  var value = JSON.parse(JSON.stringify(this.value || []));
10442
10456
  value.push(data);
@@ -10447,6 +10461,7 @@ var ArrayWidget = Vue.extend({
10447
10461
  },
10448
10462
  // 删除item
10449
10463
  handleDeleteItem: function handleDeleteItem(path) {
10464
+ if (this.disabled || this.readonly) return;
10450
10465
  var index = Number(Path.getPathLastProp(path));
10451
10466
  var value = JSON.parse(JSON.stringify(this.value || []));
10452
10467
  value.splice(index, 1);
@@ -10492,7 +10507,10 @@ var ArrayWidget = Vue.extend({
10492
10507
  'bk-schema-form-item-auto-height': true
10493
10508
  }
10494
10509
  }, [h('span', {
10495
- class: ['bk-schema-form-group-add'],
10510
+ class: ['bk-schema-form-group-add', {
10511
+ disabled: this.disabled,
10512
+ readonly: this.readonly
10513
+ }],
10496
10514
  on: {
10497
10515
  click: function click() {
10498
10516
  self.handleAddItem();
@@ -11160,9 +11178,9 @@ var FieldGroupWrap = Vue.extend({
11160
11178
  render: function render(h) {
11161
11179
  var _this$layout,
11162
11180
  _this$layout2,
11181
+ _this = this,
11163
11182
  _this$schema,
11164
- _this$layout3,
11165
- _this = this;
11183
+ _this$layout3;
11166
11184
  var schemaFormStyle = _objectSpread2({
11167
11185
  position: 'relative',
11168
11186
  border: this.border ? '1px solid #dcdee5' : 'none',
@@ -11175,7 +11193,10 @@ var FieldGroupWrap = Vue.extend({
11175
11193
  var self = this;
11176
11194
  var renderDelete = function renderDelete() {
11177
11195
  return h('span', {
11178
- class: ['bk-schema-form-group-delete'],
11196
+ class: ['bk-schema-form-group-delete', {
11197
+ disabled: _this.disabled,
11198
+ readonly: _this.readonly
11199
+ }],
11179
11200
  style: {
11180
11201
  right: '10px',
11181
11202
  top: '10px'
@@ -11233,12 +11254,12 @@ var KeyValueArrayWidget = Vue.extend({
11233
11254
  },
11234
11255
  methods: {
11235
11256
  handleAddItem: function handleAddItem() {
11236
- if (this.disabled) return;
11257
+ if (this.disabled || this.readonly) return;
11237
11258
  var data = Schema.getSchemaDefaultValue(this.schema.items);
11238
11259
  this.$emit('input', [].concat(_toConsumableArray(this.value), [data]));
11239
11260
  },
11240
11261
  handleRemoveItem: function handleRemoveItem(index) {
11241
- if (this.disabled) return;
11262
+ if (this.disabled || this.readonly) return;
11242
11263
  var value = JSON.parse(JSON.stringify(this.value));
11243
11264
  value.splice(index, 1);
11244
11265
  this.$emit('input', value);
@@ -11261,7 +11282,7 @@ var KeyValueArrayWidget = Vue.extend({
11261
11282
  _this$value2;
11262
11283
  var labelBtnStyle = {
11263
11284
  'font-size': '16px',
11264
- color: '#979ba5',
11285
+ color: this.disabled ? '#c4c6cc' : '#979ba5',
11265
11286
  cursor: this.disabled ? 'not-allowed' : 'pointer',
11266
11287
  display: 'inline-block'
11267
11288
  };