@deppon/deppon-template 2.3.3 → 2.3.6

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.
@@ -12,38 +12,42 @@
12
12
  row-gap: 8px;
13
13
  }
14
14
  .field-tag-input .tag-input-input-row .tag-input-input-wrap {
15
- display: inline-flex;
15
+ display: flex;
16
16
  align-items: stretch;
17
- border-radius: var(--el-border-radius-base, 4px);
18
- border: 1px solid var(--el-border-color, #dcdfe6);
19
- background: var(--el-fill-color-blank, #fff);
20
- transition: border-color 0.2s, box-shadow 0.2s;
21
- }
22
- .field-tag-input .tag-input-input-row .tag-input-input-wrap:focus-within {
23
- border-color: var(--el-color-primary);
24
- box-shadow: 0 0 0 2px var(--el-color-primary-light-7, rgba(64, 158, 255, 0.2));
17
+ flex: 1 1 360px;
18
+ width: 100%;
19
+ max-width: 100%;
20
+ min-width: 0;
25
21
  }
26
22
  .field-tag-input .tag-input-input-row .tag-input-input-wrap .tag-input-input {
27
- width: 200px;
28
- border: none;
23
+ width: 100%;
24
+ min-width: 0;
29
25
  }
30
- .field-tag-input .tag-input-input-row .tag-input-input-wrap .tag-input-input .el-input__wrapper {
26
+ .field-tag-input .tag-input-input-row .tag-input-input-wrap .tag-input-input .el-input,
27
+ .field-tag-input .tag-input-input-row .tag-input-input-wrap .tag-input-input .el-input-group,
28
+ .field-tag-input .tag-input-input-row .tag-input-input-wrap .tag-input-input .el-input-group--append {
29
+ width: 100%;
30
+ max-width: 100%;
31
+ }
32
+ .field-tag-input .tag-input-input-row .tag-input-input-wrap .tag-input-input .el-input-group__append {
33
+ padding: 0;
31
34
  border: none;
32
- box-shadow: none;
33
- border-radius: var(--el-border-radius-base, 4px) 0 0 var(--el-border-radius-base, 4px);
35
+ background: transparent;
34
36
  }
35
37
  .field-tag-input .tag-input-input-row .tag-input-input-wrap .tag-input-add-btn {
36
- border-radius: 0 var(--el-border-radius-base, 4px) var(--el-border-radius-base, 4px);
37
- border-left: 1px solid var(--el-border-color-lighter, #e4e7ed);
38
+ border-top-left-radius: 0;
39
+ border-bottom-left-radius: 0;
40
+ border-color: var(--el-color-primary);
41
+ background-color: var(--el-color-primary);
42
+ color: #fff;
38
43
  }
39
44
  .field-tag-input .tag-input-input-row .tag-input-tip {
40
45
  color: var(--el-text-color-secondary);
41
46
  font-size: 12px;
42
47
  line-height: 32px;
43
48
  }
44
- .field-tag-input .tag-input-input-row.has-error .tag-input-input-wrap {
45
- border-color: var(--el-color-danger);
46
- box-shadow: 0 0 0 2px var(--el-color-danger-light-7, rgba(245, 108, 108, 0.2));
49
+ .field-tag-input .tag-input-input-row.has-error .tag-input-input-wrap .el-input__wrapper {
50
+ box-shadow: 0 0 0 1px var(--el-color-danger) inset;
47
51
  }
48
52
  .field-tag-input .tag-input-add-error {
49
53
  font-size: 12px;
@@ -2,7 +2,7 @@ import '../../../_virtual/_rollup-plugin-inject-process-env.js';
2
2
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
3
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
4
4
  import _regeneratorRuntime from '@babel/runtime/regenerator';
5
- import { ref, computed, onMounted, nextTick, onUnmounted, watch, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, toDisplayString, createCommentVNode, normalizeClass, withKeys, withModifiers, createTextVNode, TransitionGroup, Fragment, renderList, createBlock } from 'vue';
5
+ import { ref, computed, onMounted, nextTick, onUnmounted, watch, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, toDisplayString, createCommentVNode, normalizeClass, withKeys, withModifiers, renderSlot, createBlock, createTextVNode, TransitionGroup, Fragment, renderList } from 'vue';
6
6
  import { ElTooltip, ElInput, ElButton, ElTag } from '@deppon/deppon-ui';
7
7
 
8
8
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
@@ -154,7 +154,9 @@ var script = {
154
154
  var trimmed = (value || '').trim();
155
155
  var rules = addRules.value;
156
156
  if (!rules.length) {
157
- if (!trimmed) return '请输入';
157
+ // 未显式配置添加校验规则时,空输入仅拦截,不展示内部错误,
158
+ // 避免与外层 el-form-item 的必填提示重复显示。
159
+ if (!trimmed) return '';
158
160
  return '';
159
161
  }
160
162
  var _iterator = _createForOfIteratorHelper(rules),
@@ -210,31 +212,41 @@ var script = {
210
212
  raw = (_inputValue$value = inputValue.value) !== null && _inputValue$value !== void 0 ? _inputValue$value : '';
211
213
  name = raw.trim();
212
214
  list = _toConsumableArray(tagList.value);
215
+ if (name) {
216
+ _context.next = 2;
217
+ break;
218
+ }
219
+ // 空值不允许加入;未配置 addRules 时静默拦截,避免与外层必填提示重复。
220
+ if (addRules.value.length) {
221
+ addError.value = validateAddInput(raw, list);
222
+ }
223
+ return _context.abrupt("return");
224
+ case 2:
213
225
  err = validateAddInput(raw, list);
214
226
  if (!err) {
215
- _context.next = 2;
227
+ _context.next = 3;
216
228
  break;
217
229
  }
218
230
  addError.value = err;
219
231
  return _context.abrupt("return");
220
- case 2:
232
+ case 3:
221
233
  if (!(list.length >= maxCount.value)) {
222
- _context.next = 3;
234
+ _context.next = 4;
223
235
  break;
224
236
  }
225
237
  addError.value = "\u6700\u591A\u6DFB\u52A0".concat(maxCount.value, "\u4E2A");
226
238
  return _context.abrupt("return");
227
- case 3:
239
+ case 4:
228
240
  onAdd = (_props$fieldProps1 = props.fieldProps) === null || _props$fieldProps1 === void 0 ? void 0 : _props$fieldProps1.onAdd;
229
241
  if (!(typeof onAdd === 'function')) {
230
- _context.next = 9;
242
+ _context.next = 10;
231
243
  break;
232
244
  }
233
245
  addLoading.value = true;
234
- _context.prev = 4;
235
- _context.next = 5;
246
+ _context.prev = 5;
247
+ _context.next = 6;
236
248
  return Promise.resolve(onAdd(name, list));
237
- case 5:
249
+ case 6:
238
250
  result = _context.sent;
239
251
  if (Array.isArray(result)) {
240
252
  emit('update:text', result);
@@ -254,18 +266,18 @@ var script = {
254
266
  return (_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 || (_inputRef$value2$focu = _inputRef$value2.focus) === null || _inputRef$value2$focu === void 0 ? void 0 : _inputRef$value2$focu.call(_inputRef$value2);
255
267
  });
256
268
  }
257
- _context.next = 7;
269
+ _context.next = 8;
258
270
  break;
259
- case 6:
260
- _context.prev = 6;
261
- _context["catch"](4);
262
271
  case 7:
263
272
  _context.prev = 7;
264
- addLoading.value = false;
265
- return _context.finish(7);
273
+ _context["catch"](5);
266
274
  case 8:
267
- return _context.abrupt("return");
275
+ _context.prev = 8;
276
+ addLoading.value = false;
277
+ return _context.finish(8);
268
278
  case 9:
279
+ return _context.abrupt("return");
280
+ case 10:
269
281
  list.push(name);
270
282
  emit('update:text', list);
271
283
  inputValue.value = '';
@@ -274,11 +286,11 @@ var script = {
274
286
  var _inputRef$value3, _inputRef$value3$focu;
275
287
  return (_inputRef$value3 = inputRef.value) === null || _inputRef$value3 === void 0 || (_inputRef$value3$focu = _inputRef$value3.focus) === null || _inputRef$value3$focu === void 0 ? void 0 : _inputRef$value3$focu.call(_inputRef$value3);
276
288
  });
277
- case 10:
289
+ case 11:
278
290
  case "end":
279
291
  return _context.stop();
280
292
  }
281
- }, _callee, null, [[4, 6, 7, 8]]);
293
+ }, _callee, null, [[5, 7, 8, 9]]);
282
294
  }));
283
295
  return _addItem.apply(this, arguments);
284
296
  }
@@ -383,18 +395,30 @@ var script = {
383
395
  onKeydown: _cache[2] || (_cache[2] = withKeys(withModifiers(function ($event) {
384
396
  return !isDisabled.value && addItem();
385
397
  }, ["prevent"]), ["enter"]))
386
- }, null, 8 /* PROPS */, ["modelValue", "placeholder", "disabled"]), createVNode(unref(ElButton), {
387
- type: "primary",
388
- "class": "tag-input-add-btn",
389
- loading: addLoading.value,
390
- disabled: addLoading.value || isDisabled.value,
391
- onClick: addItem
392
398
  }, {
393
- "default": withCtx(function () {
394
- return [createTextVNode(toDisplayString(addButtonText.value), 1 /* TEXT */)];
399
+ append: withCtx(function () {
400
+ return [_ctx.$slots.append ? renderSlot(_ctx.$slots, "append", {
401
+ key: 0,
402
+ addItem: addItem,
403
+ inputValue: inputValue.value,
404
+ addLoading: addLoading.value,
405
+ disabled: addLoading.value || isDisabled.value
406
+ }) : (openBlock(), createBlock(unref(ElButton), {
407
+ key: 1,
408
+ type: "primary",
409
+ "class": "tag-input-add-btn",
410
+ loading: addLoading.value,
411
+ disabled: addLoading.value || isDisabled.value,
412
+ onClick: addItem
413
+ }, {
414
+ "default": withCtx(function () {
415
+ return [createTextVNode(toDisplayString(addButtonText.value), 1 /* TEXT */)];
416
+ }),
417
+ _: 1 /* STABLE */
418
+ }, 8 /* PROPS */, ["loading", "disabled"]))];
395
419
  }),
396
- _: 1 /* STABLE */
397
- }, 8 /* PROPS */, ["loading", "disabled"])]), tip.value ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(tip.value), 1 /* TEXT */)) : createCommentVNode("v-if", true)], 2 /* CLASS */), addError.value ? (openBlock(), createElementBlock("div", _hoisted_5, toDisplayString(addError.value), 1 /* TEXT */)) : createCommentVNode("v-if", true), createCommentVNode(" 标签列表:有数据时才显示 "), tagList.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_6, [listLabel.value ? (openBlock(), createElementBlock("div", _hoisted_7, toDisplayString(listLabel.value) + "(" + toDisplayString(tagList.value.length) + "/" + toDisplayString(maxCount.value) + ") ", 1 /* TEXT */)) : createCommentVNode("v-if", true), createElementVNode("div", {
420
+ _: 3 /* FORWARDED */
421
+ }, 8 /* PROPS */, ["modelValue", "placeholder", "disabled"])]), tip.value ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(tip.value), 1 /* TEXT */)) : createCommentVNode("v-if", true)], 2 /* CLASS */), addError.value ? (openBlock(), createElementBlock("div", _hoisted_5, toDisplayString(addError.value), 1 /* TEXT */)) : createCommentVNode("v-if", true), createCommentVNode(" 标签列表:有数据时才显示 "), tagList.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_6, [listLabel.value ? (openBlock(), createElementBlock("div", _hoisted_7, toDisplayString(listLabel.value) + "(" + toDisplayString(tagList.value.length) + "/" + toDisplayString(maxCount.value) + ") ", 1 /* TEXT */)) : createCommentVNode("v-if", true), createElementVNode("div", {
398
422
  "class": normalizeClass(["tag-input-list-content", {
399
423
  'is-removing': removingIndex.value >= 0
400
424
  }])
@@ -608,16 +608,17 @@ var script = {
608
608
  // 获取 append 插槽组件
609
609
  var getAppendSlotComponent = function getAppendSlotComponent(item) {
610
610
  var _item$slots;
611
+ var slotProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
611
612
  var appendSlot = (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.append;
612
613
  if (!appendSlot) return null;
613
614
 
614
615
  // 如果是函数,调用它并返回结果(应该是组件或 VNode)
615
616
  if (typeof appendSlot === 'function') {
616
- return appendSlot({
617
+ return appendSlot(_objectSpread({
617
618
  item: item,
618
619
  value: formModel[item.name],
619
620
  formModel: formModel
620
- });
621
+ }, slotProps));
621
622
  }
622
623
 
623
624
  // 否则直接返回(字符串组件名或组件对象)
@@ -1285,8 +1286,8 @@ var script = {
1285
1286
  };
1286
1287
  }), (_item$slots2 = item.slots) !== null && _item$slots2 !== void 0 && _item$slots2.append ? {
1287
1288
  name: "append",
1288
- fn: withCtx(function () {
1289
- return [(openBlock(), createBlock(resolveDynamicComponent(getAppendSlotComponent(item))))];
1289
+ fn: withCtx(function (slotProps) {
1290
+ return [(openBlock(), createBlock(resolveDynamicComponent(getAppendSlotComponent(item, slotProps))))];
1290
1291
  }),
1291
1292
  key: "0"
1292
1293
  } : undefined]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["text", "value-type", "mode", "plain", "light", "value-enum", "label", "field-props", "form-item-props", "empty-text", "onUpdate:text"])) : (_item$slots3 = item.slots) !== null && _item$slots3 !== void 0 && _item$slots3["default"] ? renderSlot(_ctx.$slots, item.name, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deppon/deppon-template",
3
- "version": "2.3.3",
3
+ "version": "2.3.6",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "es/index.d.ts",
@@ -43,11 +43,11 @@
43
43
  "less": "^4.2.0"
44
44
  },
45
45
  "dependencies": {
46
- "@deppon/deppon-assets": "2.3.3",
47
- "@deppon/deppon-request": "2.3.3",
48
- "@deppon/deppon-router": "2.3.3",
49
- "@deppon/deppon-ui": "2.3.3",
50
- "@deppon/deppon-utils": "2.3.3",
46
+ "@deppon/deppon-assets": "2.3.6",
47
+ "@deppon/deppon-request": "2.3.6",
48
+ "@deppon/deppon-router": "2.3.6",
49
+ "@deppon/deppon-ui": "2.3.6",
50
+ "@deppon/deppon-utils": "2.3.6",
51
51
  "dayjs": "^1.11.10",
52
52
  "lodash-es": "^4.17.21",
53
53
  "mitt": "^3.0.1"