@deppon/deppon-template 2.2.6 → 2.2.7
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/es/pro-field/components/TagInput/FieldTagInput.vue_vue_type_script_setup_true_lang.vue.js
CHANGED
|
@@ -106,6 +106,10 @@ var script = {
|
|
|
106
106
|
var _ref2, _props$fieldProps$rul, _props$fieldProps8, _props$fieldProps9;
|
|
107
107
|
return (_ref2 = (_props$fieldProps$rul = (_props$fieldProps8 = props.fieldProps) === null || _props$fieldProps8 === void 0 ? void 0 : _props$fieldProps8.rules) !== null && _props$fieldProps$rul !== void 0 ? _props$fieldProps$rul : (_props$fieldProps9 = props.fieldProps) === null || _props$fieldProps9 === void 0 ? void 0 : _props$fieldProps9.addRules) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
108
108
|
});
|
|
109
|
+
var isDisabled = computed(function () {
|
|
110
|
+
var _props$fieldProps0;
|
|
111
|
+
return ((_props$fieldProps0 = props.fieldProps) === null || _props$fieldProps0 === void 0 ? void 0 : _props$fieldProps0.disabled) === true;
|
|
112
|
+
});
|
|
109
113
|
var tagList = computed(function () {
|
|
110
114
|
var val = props.text;
|
|
111
115
|
if (Array.isArray(val)) return val;
|
|
@@ -162,40 +166,46 @@ var script = {
|
|
|
162
166
|
}
|
|
163
167
|
function _addItem() {
|
|
164
168
|
_addItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
165
|
-
var _inputValue$value, _props$
|
|
169
|
+
var _inputValue$value, _props$fieldProps1;
|
|
166
170
|
var raw, name, list, err, onAdd, result, nextList;
|
|
167
171
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
168
172
|
while (1) switch (_context.prev = _context.next) {
|
|
169
173
|
case 0:
|
|
174
|
+
if (!isDisabled.value) {
|
|
175
|
+
_context.next = 1;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
return _context.abrupt("return");
|
|
179
|
+
case 1:
|
|
170
180
|
addError.value = '';
|
|
171
181
|
raw = (_inputValue$value = inputValue.value) !== null && _inputValue$value !== void 0 ? _inputValue$value : '';
|
|
172
182
|
name = raw.trim();
|
|
173
183
|
list = _toConsumableArray(tagList.value);
|
|
174
184
|
err = validateAddInput(raw, list);
|
|
175
185
|
if (!err) {
|
|
176
|
-
_context.next =
|
|
186
|
+
_context.next = 2;
|
|
177
187
|
break;
|
|
178
188
|
}
|
|
179
189
|
addError.value = err;
|
|
180
190
|
return _context.abrupt("return");
|
|
181
|
-
case
|
|
191
|
+
case 2:
|
|
182
192
|
if (!(list.length >= maxCount.value)) {
|
|
183
|
-
_context.next =
|
|
193
|
+
_context.next = 3;
|
|
184
194
|
break;
|
|
185
195
|
}
|
|
186
196
|
addError.value = "\u6700\u591A\u6DFB\u52A0".concat(maxCount.value, "\u4E2A");
|
|
187
197
|
return _context.abrupt("return");
|
|
188
|
-
case
|
|
189
|
-
onAdd = (_props$
|
|
198
|
+
case 3:
|
|
199
|
+
onAdd = (_props$fieldProps1 = props.fieldProps) === null || _props$fieldProps1 === void 0 ? void 0 : _props$fieldProps1.onAdd;
|
|
190
200
|
if (!(typeof onAdd === 'function')) {
|
|
191
|
-
_context.next =
|
|
201
|
+
_context.next = 9;
|
|
192
202
|
break;
|
|
193
203
|
}
|
|
194
204
|
addLoading.value = true;
|
|
195
|
-
_context.prev =
|
|
196
|
-
_context.next =
|
|
205
|
+
_context.prev = 4;
|
|
206
|
+
_context.next = 5;
|
|
197
207
|
return Promise.resolve(onAdd(name, list));
|
|
198
|
-
case
|
|
208
|
+
case 5:
|
|
199
209
|
result = _context.sent;
|
|
200
210
|
if (Array.isArray(result)) {
|
|
201
211
|
emit('update:text', result);
|
|
@@ -215,18 +225,18 @@ var script = {
|
|
|
215
225
|
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);
|
|
216
226
|
});
|
|
217
227
|
}
|
|
218
|
-
_context.next =
|
|
228
|
+
_context.next = 7;
|
|
219
229
|
break;
|
|
220
|
-
case 5:
|
|
221
|
-
_context.prev = 5;
|
|
222
|
-
_context["catch"](3);
|
|
223
230
|
case 6:
|
|
224
231
|
_context.prev = 6;
|
|
225
|
-
|
|
226
|
-
return _context.finish(6);
|
|
232
|
+
_context["catch"](4);
|
|
227
233
|
case 7:
|
|
228
|
-
|
|
234
|
+
_context.prev = 7;
|
|
235
|
+
addLoading.value = false;
|
|
236
|
+
return _context.finish(7);
|
|
229
237
|
case 8:
|
|
238
|
+
return _context.abrupt("return");
|
|
239
|
+
case 9:
|
|
230
240
|
list.push(name);
|
|
231
241
|
emit('update:text', list);
|
|
232
242
|
inputValue.value = '';
|
|
@@ -235,11 +245,11 @@ var script = {
|
|
|
235
245
|
var _inputRef$value3, _inputRef$value3$focu;
|
|
236
246
|
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);
|
|
237
247
|
});
|
|
238
|
-
case
|
|
248
|
+
case 10:
|
|
239
249
|
case "end":
|
|
240
250
|
return _context.stop();
|
|
241
251
|
}
|
|
242
|
-
}, _callee, null, [[
|
|
252
|
+
}, _callee, null, [[4, 6, 7, 8]]);
|
|
243
253
|
}));
|
|
244
254
|
return _addItem.apply(this, arguments);
|
|
245
255
|
}
|
|
@@ -248,29 +258,35 @@ var script = {
|
|
|
248
258
|
}
|
|
249
259
|
function _removeItem() {
|
|
250
260
|
_removeItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(index) {
|
|
251
|
-
var _props$
|
|
261
|
+
var _props$fieldProps10;
|
|
252
262
|
var list, name, onRemove, result, nextList;
|
|
253
263
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
254
264
|
while (1) switch (_context2.prev = _context2.next) {
|
|
255
265
|
case 0:
|
|
266
|
+
if (!isDisabled.value) {
|
|
267
|
+
_context2.next = 1;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
return _context2.abrupt("return");
|
|
271
|
+
case 1:
|
|
256
272
|
list = _toConsumableArray(tagList.value);
|
|
257
273
|
name = list[index];
|
|
258
274
|
if (!(name == null)) {
|
|
259
|
-
_context2.next =
|
|
275
|
+
_context2.next = 2;
|
|
260
276
|
break;
|
|
261
277
|
}
|
|
262
278
|
return _context2.abrupt("return");
|
|
263
|
-
case
|
|
264
|
-
onRemove = (_props$
|
|
279
|
+
case 2:
|
|
280
|
+
onRemove = (_props$fieldProps10 = props.fieldProps) === null || _props$fieldProps10 === void 0 ? void 0 : _props$fieldProps10.onRemove;
|
|
265
281
|
if (!(typeof onRemove === 'function')) {
|
|
266
|
-
_context2.next =
|
|
282
|
+
_context2.next = 8;
|
|
267
283
|
break;
|
|
268
284
|
}
|
|
269
285
|
removingIndex.value = index;
|
|
270
|
-
_context2.prev =
|
|
271
|
-
_context2.next =
|
|
286
|
+
_context2.prev = 3;
|
|
287
|
+
_context2.next = 4;
|
|
272
288
|
return Promise.resolve(onRemove(index, name, list));
|
|
273
|
-
case
|
|
289
|
+
case 4:
|
|
274
290
|
result = _context2.sent;
|
|
275
291
|
if (Array.isArray(result)) {
|
|
276
292
|
emit('update:text', result);
|
|
@@ -279,25 +295,25 @@ var script = {
|
|
|
279
295
|
nextList.splice(index, 1);
|
|
280
296
|
emit('update:text', nextList);
|
|
281
297
|
}
|
|
282
|
-
_context2.next =
|
|
298
|
+
_context2.next = 6;
|
|
283
299
|
break;
|
|
284
|
-
case 4:
|
|
285
|
-
_context2.prev = 4;
|
|
286
|
-
_context2["catch"](2);
|
|
287
300
|
case 5:
|
|
288
301
|
_context2.prev = 5;
|
|
289
|
-
|
|
290
|
-
return _context2.finish(5);
|
|
302
|
+
_context2["catch"](3);
|
|
291
303
|
case 6:
|
|
292
|
-
|
|
304
|
+
_context2.prev = 6;
|
|
305
|
+
removingIndex.value = -1;
|
|
306
|
+
return _context2.finish(6);
|
|
293
307
|
case 7:
|
|
308
|
+
return _context2.abrupt("return");
|
|
309
|
+
case 8:
|
|
294
310
|
list.splice(index, 1);
|
|
295
311
|
emit('update:text', list);
|
|
296
|
-
case
|
|
312
|
+
case 9:
|
|
297
313
|
case "end":
|
|
298
314
|
return _context2.stop();
|
|
299
315
|
}
|
|
300
|
-
}, _callee2, null, [[
|
|
316
|
+
}, _callee2, null, [[3, 5, 6, 7]]);
|
|
301
317
|
}));
|
|
302
318
|
return _removeItem.apply(this, arguments);
|
|
303
319
|
}
|
|
@@ -314,17 +330,20 @@ var script = {
|
|
|
314
330
|
return inputValue.value = $event;
|
|
315
331
|
}),
|
|
316
332
|
placeholder: inputPlaceholder.value,
|
|
333
|
+
disabled: isDisabled.value,
|
|
317
334
|
clearable: "",
|
|
318
335
|
"class": "tag-input-input",
|
|
319
336
|
onInput: _cache[1] || (_cache[1] = function ($event) {
|
|
320
337
|
return addError.value = '';
|
|
321
338
|
}),
|
|
322
|
-
onKeydown: withKeys(withModifiers(
|
|
323
|
-
|
|
339
|
+
onKeydown: _cache[2] || (_cache[2] = withKeys(withModifiers(function ($event) {
|
|
340
|
+
return !isDisabled.value && addItem();
|
|
341
|
+
}, ["prevent"]), ["enter"]))
|
|
342
|
+
}, null, 8 /* PROPS */, ["modelValue", "placeholder", "disabled"]), createVNode(unref(ElButton), {
|
|
324
343
|
type: "primary",
|
|
325
344
|
"class": "tag-input-add-btn",
|
|
326
345
|
loading: addLoading.value,
|
|
327
|
-
disabled: addLoading.value,
|
|
346
|
+
disabled: addLoading.value || isDisabled.value,
|
|
328
347
|
onClick: addItem
|
|
329
348
|
}, {
|
|
330
349
|
"default": withCtx(function () {
|
|
@@ -344,7 +363,7 @@ var script = {
|
|
|
344
363
|
return [(openBlock(true), createElementBlock(Fragment, null, renderList(tagList.value, function (name, idx) {
|
|
345
364
|
return openBlock(), createBlock(unref(ElTag), {
|
|
346
365
|
key: "".concat(idx, "-").concat(name),
|
|
347
|
-
closable:
|
|
366
|
+
closable: !isDisabled.value,
|
|
348
367
|
"class": normalizeClass(["tag-input-tag", {
|
|
349
368
|
'is-removing': removingIndex.value === idx
|
|
350
369
|
}]),
|
|
@@ -356,7 +375,7 @@ var script = {
|
|
|
356
375
|
return [createTextVNode(toDisplayString(name), 1 /* TEXT */)];
|
|
357
376
|
}),
|
|
358
377
|
_: 2 /* DYNAMIC */
|
|
359
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "onClose"]);
|
|
378
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["closable", "class", "onClose"]);
|
|
360
379
|
}), 128 /* KEYED_FRAGMENT */))];
|
|
361
380
|
}),
|
|
362
381
|
_: 1 /* STABLE */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deppon/deppon-template",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
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.2.
|
|
47
|
-
"@deppon/deppon-request": "2.2.
|
|
48
|
-
"@deppon/deppon-router": "2.2.
|
|
49
|
-
"@deppon/deppon-ui": "2.2.
|
|
50
|
-
"@deppon/deppon-utils": "2.2.
|
|
46
|
+
"@deppon/deppon-assets": "2.2.7",
|
|
47
|
+
"@deppon/deppon-request": "2.2.7",
|
|
48
|
+
"@deppon/deppon-router": "2.2.7",
|
|
49
|
+
"@deppon/deppon-ui": "2.2.7",
|
|
50
|
+
"@deppon/deppon-utils": "2.2.7",
|
|
51
51
|
"dayjs": "^1.11.10",
|
|
52
52
|
"lodash-es": "^4.17.21",
|
|
53
53
|
"mitt": "^3.0.1"
|