n20-project-component 1.0.1 → 1.0.3

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.
@@ -105,6 +105,13 @@ return /******/ (function(modules) { // webpackBootstrap
105
105
  /* unused harmony reexport * */
106
106
 
107
107
 
108
+ /***/ }),
109
+
110
+ /***/ "141c":
111
+ /***/ (function(module, exports, __webpack_require__) {
112
+
113
+ // extracted by mini-css-extract-plugin
114
+
108
115
  /***/ }),
109
116
 
110
117
  /***/ "3f46":
@@ -116,6 +123,24 @@ return /******/ (function(modules) { // webpackBootstrap
116
123
  /* unused harmony reexport * */
117
124
 
118
125
 
126
+ /***/ }),
127
+
128
+ /***/ "b006":
129
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
130
+
131
+ "use strict";
132
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_081f8b8a_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("141c");
133
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_081f8b8a_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_081f8b8a_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0__);
134
+ /* unused harmony reexport * */
135
+
136
+
137
+ /***/ }),
138
+
139
+ /***/ "b553":
140
+ /***/ (function(module, exports, __webpack_require__) {
141
+
142
+ // extracted by mini-css-extract-plugin
143
+
119
144
  /***/ }),
120
145
 
121
146
  /***/ "c5db":
@@ -123,6 +148,17 @@ return /******/ (function(modules) { // webpackBootstrap
123
148
 
124
149
  // extracted by mini-css-extract-plugin
125
150
 
151
+ /***/ }),
152
+
153
+ /***/ "e863":
154
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
155
+
156
+ "use strict";
157
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_1b434c24_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("b553");
158
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_1b434c24_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_1b434c24_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
159
+ /* unused harmony reexport * */
160
+
161
+
126
162
  /***/ }),
127
163
 
128
164
  /***/ "f14e":
@@ -142,6 +178,8 @@ __webpack_require__.r(__webpack_exports__);
142
178
  // EXPORTS
143
179
  __webpack_require__.d(__webpack_exports__, "DemoButton", function() { return /* reexport */ DemoButton; });
144
180
  __webpack_require__.d(__webpack_exports__, "N20CopyText", function() { return /* reexport */ N20CopyText; });
181
+ __webpack_require__.d(__webpack_exports__, "N20FloatingToolbar", function() { return /* reexport */ N20FloatingToolbar; });
182
+ __webpack_require__.d(__webpack_exports__, "N20BatchInput", function() { return /* reexport */ N20BatchInput; });
145
183
 
146
184
  // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
147
185
  // This file is imported into lib/wc client bundles.
@@ -159,7 +197,7 @@ if (typeof window !== 'undefined') {
159
197
  // Indicate to webpack that this file can be concatenated
160
198
  /* harmony default export */ var setPublicPath = (null);
161
199
 
162
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"733de36c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/DemoButton/index.vue?vue&type=template&id=1c0b7107&scoped=true
200
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"45186dc4-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/DemoButton/index.vue?vue&type=template&id=1c0b7107&scoped=true
163
201
  var render = function render() {
164
202
  var _vm = this,
165
203
  _c = _vm._self._c;
@@ -183,7 +221,7 @@ var staticRenderFns = [];
183
221
 
184
222
  // CONCATENATED MODULE: ./src/components/DemoButton/index.vue?vue&type=template&id=1c0b7107&scoped=true
185
223
 
186
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/DemoButton/index.vue?vue&type=script&lang=js
224
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/DemoButton/index.vue?vue&type=script&lang=js
187
225
  /**
188
226
  * DemoButton - 示例按钮组件
189
227
  *
@@ -356,7 +394,7 @@ var component = normalizeComponent(
356
394
  )
357
395
 
358
396
  /* harmony default export */ var DemoButton = (component.exports);
359
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"733de36c-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/N20CopyText/index.vue?vue&type=template&id=35583176&scoped=true
397
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"45186dc4-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/N20CopyText/index.vue?vue&type=template&id=35583176&scoped=true
360
398
  var N20CopyTextvue_type_template_id_35583176_scoped_true_render = function render() {
361
399
  var _vm = this,
362
400
  _c = _vm._self._c;
@@ -384,7 +422,7 @@ var N20CopyTextvue_type_template_id_35583176_scoped_true_staticRenderFns = [];
384
422
 
385
423
  // CONCATENATED MODULE: ./src/components/N20CopyText/index.vue?vue&type=template&id=35583176&scoped=true
386
424
 
387
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/N20CopyText/index.vue?vue&type=script&lang=js
425
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/N20CopyText/index.vue?vue&type=script&lang=js
388
426
  /**
389
427
  * N20CopyText - 点击复制文本组件
390
428
  *
@@ -494,6 +532,504 @@ var N20CopyText_component = normalizeComponent(
494
532
  )
495
533
 
496
534
  /* harmony default export */ var N20CopyText = (N20CopyText_component.exports);
535
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"45186dc4-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/N20FloatingToolbar/index.vue?vue&type=template&id=1b434c24&scoped=true
536
+ var N20FloatingToolbarvue_type_template_id_1b434c24_scoped_true_render = function render() {
537
+ var _vm = this,
538
+ _c = _vm._self._c;
539
+ return _c('div', {
540
+ ref: "wrapper",
541
+ staticClass: "n20-floating-toolbar-wrapper",
542
+ on: {
543
+ "mouseup": _vm.handleMouseUp
544
+ }
545
+ }, [_vm._t("default"), _c('transition', {
546
+ attrs: {
547
+ "name": "n20-toolbar-fade"
548
+ }
549
+ }, [_vm.visible ? _c('div', {
550
+ ref: "toolbar",
551
+ staticClass: "n20-floating-toolbar",
552
+ style: _vm.toolbarStyle,
553
+ on: {
554
+ "mousedown": function ($event) {
555
+ $event.preventDefault();
556
+ }
557
+ }
558
+ }, [_c('div', {
559
+ staticClass: "n20-floating-toolbar__arrow"
560
+ }), _c('div', {
561
+ staticClass: "n20-floating-toolbar__body"
562
+ }, [_vm._l(_vm.actions, function (btn, idx) {
563
+ return _c('button', {
564
+ key: idx,
565
+ staticClass: "n20-floating-toolbar__btn",
566
+ attrs: {
567
+ "title": btn.label
568
+ },
569
+ on: {
570
+ "click": function ($event) {
571
+ $event.stopPropagation();
572
+ return _vm.handleAction(btn, idx);
573
+ }
574
+ }
575
+ }, [btn.icon ? _c('i', {
576
+ class: btn.icon
577
+ }) : _vm._e(), btn.label && _vm.showLabel ? _c('span', [_vm._v(_vm._s(btn.label))]) : _vm._e()]);
578
+ }), _vm._t("toolbar", null, {
579
+ "selectedText": _vm.selectedText
580
+ })], 2)]) : _vm._e()])], 2);
581
+ };
582
+ var N20FloatingToolbarvue_type_template_id_1b434c24_scoped_true_staticRenderFns = [];
583
+
584
+ // CONCATENATED MODULE: ./src/components/N20FloatingToolbar/index.vue?vue&type=template&id=1b434c24&scoped=true
585
+
586
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/N20FloatingToolbar/index.vue?vue&type=script&lang=js
587
+ /**
588
+ * N20FloatingToolbar — 选中浮现工具栏
589
+ *
590
+ * 包裹内容区域,用户选中文字后在选区上方浮现操作按钮条。
591
+ * 鼠标拖选文字松开后,选区上方浮现深色工具条,
592
+ * 点击按钮触发事件,点其他地方消失。
593
+ *
594
+ * @example
595
+ * <N20FloatingToolbar
596
+ * :actions="[
597
+ * { label: '复制', icon: 'el-icon-document-copy' },
598
+ * { label: '搜索', icon: 'el-icon-search' },
599
+ * { label: '高亮', icon: 'el-icon-edit' },
600
+ * ]"
601
+ * @action="handleToolbarAction"
602
+ * >
603
+ * <p>这里是一段可以被选中的文本内容...</p>
604
+ * </N20FloatingToolbar>
605
+ */
606
+ /* harmony default export */ var N20FloatingToolbarvue_type_script_lang_js = ({
607
+ name: 'N20FloatingToolbar',
608
+ props: {
609
+ /**
610
+ * 工具栏按钮列表
611
+ * 每项 { label: string, icon?: string, command?: string }
612
+ */
613
+ actions: {
614
+ type: Array,
615
+ default: () => [{
616
+ label: '复制',
617
+ icon: 'el-icon-document-copy',
618
+ command: 'copy'
619
+ }, {
620
+ label: '搜索',
621
+ icon: 'el-icon-search',
622
+ command: 'search'
623
+ }, {
624
+ label: '高亮',
625
+ icon: 'el-icon-edit',
626
+ command: 'highlight'
627
+ }]
628
+ },
629
+ /** 是否在按钮中显示文字标签 */
630
+ showLabel: {
631
+ type: Boolean,
632
+ default: true
633
+ },
634
+ /** 工具栏与选区的垂直间距(px) */
635
+ offset: {
636
+ type: Number,
637
+ default: 8
638
+ },
639
+ /** 是否禁用 */
640
+ disabled: {
641
+ type: Boolean,
642
+ default: false
643
+ },
644
+ /** 选中最少字符数才触发 */
645
+ minLength: {
646
+ type: Number,
647
+ default: 1
648
+ }
649
+ },
650
+ data() {
651
+ return {
652
+ visible: false,
653
+ selectedText: '',
654
+ toolbarStyle: {
655
+ top: '0px',
656
+ left: '0px'
657
+ }
658
+ };
659
+ },
660
+ mounted() {
661
+ // 监听全局点击 → 隐藏工具栏
662
+ this._onDocClick = e => {
663
+ if (this.visible && this.$refs.toolbar && !this.$refs.toolbar.contains(e.target)) {
664
+ this.hide();
665
+ }
666
+ };
667
+ // 监听滚动 → 隐藏工具栏
668
+ this._onScroll = () => {
669
+ if (this.visible) {
670
+ this.hide();
671
+ }
672
+ };
673
+ document.addEventListener('mousedown', this._onDocClick, true);
674
+ window.addEventListener('scroll', this._onScroll, true);
675
+ },
676
+ beforeDestroy() {
677
+ document.removeEventListener('mousedown', this._onDocClick, true);
678
+ window.removeEventListener('scroll', this._onScroll, true);
679
+ },
680
+ methods: {
681
+ /** 鼠标松开时判断是否有选区 */
682
+ handleMouseUp() {
683
+ if (this.disabled) return;
684
+
685
+ // 延迟一帧让浏览器完成选区更新
686
+ this.$nextTick(() => {
687
+ setTimeout(() => {
688
+ this.checkSelection();
689
+ }, 0);
690
+ });
691
+ },
692
+ /** 检测当前选区 */
693
+ checkSelection() {
694
+ const selection = window.getSelection();
695
+ if (!selection || selection.isCollapsed || !selection.toString().trim()) {
696
+ this.hide();
697
+ return;
698
+ }
699
+ const text = selection.toString().trim();
700
+ if (text.length < this.minLength) {
701
+ this.hide();
702
+ return;
703
+ }
704
+
705
+ // 确保选区在 wrapper 内
706
+ const wrapper = this.$refs.wrapper;
707
+ if (!wrapper) return;
708
+ const range = selection.getRangeAt(0);
709
+ if (!wrapper.contains(range.commonAncestorContainer)) {
710
+ this.hide();
711
+ return;
712
+ }
713
+ this.selectedText = text;
714
+ this.positionToolbar(range);
715
+ this.visible = true;
716
+ },
717
+ /** 根据选区 Range 定位工具栏 */
718
+ positionToolbar(range) {
719
+ const rect = range.getBoundingClientRect();
720
+ const wrapperRect = this.$refs.wrapper.getBoundingClientRect();
721
+
722
+ // 工具栏居中于选区上方
723
+ const left = rect.left + rect.width / 2 - wrapperRect.left;
724
+ const top = rect.top - wrapperRect.top - this.offset;
725
+ this.toolbarStyle = {
726
+ left: `${left}px`,
727
+ top: `${top}px`
728
+ };
729
+ },
730
+ /** 点击按钮 */
731
+ handleAction(btn, idx) {
732
+ this.$emit('action', {
733
+ command: btn.command || btn.label,
734
+ label: btn.label,
735
+ index: idx,
736
+ text: this.selectedText
737
+ });
738
+
739
+ // 内置 copy 行为
740
+ if (btn.command === 'copy') {
741
+ this.doCopy(this.selectedText);
742
+ }
743
+ this.hide();
744
+ },
745
+ /** 复制文本到剪贴板 */
746
+ async doCopy(text) {
747
+ try {
748
+ if (navigator.clipboard && window.isSecureContext) {
749
+ await navigator.clipboard.writeText(text);
750
+ } else {
751
+ const textarea = document.createElement('textarea');
752
+ textarea.value = text;
753
+ textarea.style.position = 'fixed';
754
+ textarea.style.left = '-9999px';
755
+ document.body.appendChild(textarea);
756
+ textarea.select();
757
+ document.execCommand('copy');
758
+ document.body.removeChild(textarea);
759
+ }
760
+ this.$message && this.$message.success('已复制');
761
+ } catch (err) {
762
+ this.$message && this.$message.error('复制失败');
763
+ }
764
+ },
765
+ /** 隐藏工具栏 */
766
+ hide() {
767
+ this.visible = false;
768
+ this.selectedText = '';
769
+ },
770
+ /** 外部可调用:手动显示 */
771
+ show() {
772
+ this.checkSelection();
773
+ }
774
+ }
775
+ });
776
+ // CONCATENATED MODULE: ./src/components/N20FloatingToolbar/index.vue?vue&type=script&lang=js
777
+ /* harmony default export */ var components_N20FloatingToolbarvue_type_script_lang_js = (N20FloatingToolbarvue_type_script_lang_js);
778
+ // EXTERNAL MODULE: ./src/components/N20FloatingToolbar/index.vue?vue&type=style&index=0&id=1b434c24&prod&lang=scss&scoped=true
779
+ var N20FloatingToolbarvue_type_style_index_0_id_1b434c24_prod_lang_scss_scoped_true = __webpack_require__("e863");
780
+
781
+ // CONCATENATED MODULE: ./src/components/N20FloatingToolbar/index.vue
782
+
783
+
784
+
785
+
786
+
787
+
788
+ /* normalize component */
789
+
790
+ var N20FloatingToolbar_component = normalizeComponent(
791
+ components_N20FloatingToolbarvue_type_script_lang_js,
792
+ N20FloatingToolbarvue_type_template_id_1b434c24_scoped_true_render,
793
+ N20FloatingToolbarvue_type_template_id_1b434c24_scoped_true_staticRenderFns,
794
+ false,
795
+ null,
796
+ "1b434c24",
797
+ null
798
+
799
+ )
800
+
801
+ /* harmony default export */ var N20FloatingToolbar = (N20FloatingToolbar_component.exports);
802
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"45186dc4-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/N20BatchInput/index.vue?vue&type=template&id=081f8b8a&scoped=true
803
+ var N20BatchInputvue_type_template_id_081f8b8a_scoped_true_render = function render() {
804
+ var _vm = this,
805
+ _c = _vm._self._c;
806
+ return _c('div', {
807
+ staticClass: "n20-batch-input"
808
+ }, [_c('el-input', {
809
+ staticClass: "n20-batch-input__trigger",
810
+ attrs: {
811
+ "value": _vm.displayValue,
812
+ "placeholder": _vm.placeholder,
813
+ "disabled": _vm.disabled,
814
+ "readonly": ""
815
+ },
816
+ nativeOn: {
817
+ "click": function ($event) {
818
+ return _vm.handleOpen.apply(null, arguments);
819
+ }
820
+ }
821
+ }, [_c('template', {
822
+ slot: "suffix"
823
+ }, [_c('span', {
824
+ staticClass: "n20-batch-input__suffix"
825
+ }, [_vm.value && !_vm.disabled ? _c('i', {
826
+ staticClass: "el-icon-circle-close n20-batch-input__clear",
827
+ on: {
828
+ "click": function ($event) {
829
+ $event.stopPropagation();
830
+ return _vm.handleClear.apply(null, arguments);
831
+ }
832
+ }
833
+ }) : _vm._e(), _c('i', {
834
+ staticClass: "el-icon-edit-outline n20-batch-input__edit",
835
+ on: {
836
+ "click": function ($event) {
837
+ $event.stopPropagation();
838
+ return _vm.handleOpen.apply(null, arguments);
839
+ }
840
+ }
841
+ })])])], 2), _c('el-dialog', {
842
+ attrs: {
843
+ "title": _vm.dialogTitle,
844
+ "visible": _vm.dialogVisible,
845
+ "width": "520px",
846
+ "close-on-click-modal": false
847
+ },
848
+ on: {
849
+ "update:visible": function ($event) {
850
+ _vm.dialogVisible = $event;
851
+ },
852
+ "open": _vm.handleDialogOpen,
853
+ "closed": _vm.handleDialogClosed
854
+ }
855
+ }, [_c('div', {
856
+ staticClass: "n20-batch-input__body"
857
+ }, [_c('el-input', {
858
+ attrs: {
859
+ "type": "textarea",
860
+ "rows": 10,
861
+ "placeholder": _vm.textareaPlaceholder
862
+ },
863
+ on: {
864
+ "input": _vm.handleTextareaInput
865
+ },
866
+ model: {
867
+ value: _vm.draftText,
868
+ callback: function ($$v) {
869
+ _vm.draftText = $$v;
870
+ },
871
+ expression: "draftText"
872
+ }
873
+ }), _c('div', {
874
+ staticClass: "n20-batch-input__counter",
875
+ class: {
876
+ 'is-over': _vm.isOverLimit
877
+ }
878
+ }, [_vm.isOverLimit ? _c('span', {
879
+ staticClass: "n20-batch-input__error"
880
+ }, [_vm._v(" 已超出最大条数 " + _vm._s(_vm.max) + ",请删减后提交 ")]) : _vm._e(), _c('span', {
881
+ staticClass: "n20-batch-input__count"
882
+ }, [_vm._v(" 当前 " + _vm._s(_vm.parsedItems.length) + " 条 / 最大 " + _vm._s(_vm.max) + " 条 ")])])], 1), _c('div', {
883
+ attrs: {
884
+ "slot": "footer"
885
+ },
886
+ slot: "footer"
887
+ }, [_c('el-button', {
888
+ on: {
889
+ "click": function ($event) {
890
+ _vm.dialogVisible = false;
891
+ }
892
+ }
893
+ }, [_vm._v("取 消")]), _c('el-button', {
894
+ attrs: {
895
+ "type": "primary",
896
+ "disabled": _vm.isOverLimit
897
+ },
898
+ on: {
899
+ "click": _vm.handleConfirm
900
+ }
901
+ }, [_vm._v(" 确 认 ")])], 1)])], 1);
902
+ };
903
+ var N20BatchInputvue_type_template_id_081f8b8a_scoped_true_staticRenderFns = [];
904
+
905
+ // CONCATENATED MODULE: ./src/components/N20BatchInput/index.vue?vue&type=template&id=081f8b8a&scoped=true
906
+
907
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/N20BatchInput/index.vue?vue&type=script&lang=js
908
+ /**
909
+ * N20BatchInput - 批量输入组件
910
+ *
911
+ * 点击输入框打开弹窗,支持从 Excel 粘贴内容,自动按换行/制表符/逗号拆分为多个条目。
912
+ * v-model 绑定逗号分隔的字符串。
913
+ *
914
+ * @example
915
+ * <N20BatchInput v-model="batchValue" :max="50" />
916
+ */
917
+ /* harmony default export */ var N20BatchInputvue_type_script_lang_js = ({
918
+ name: 'N20BatchInput',
919
+ model: {
920
+ prop: 'value',
921
+ event: 'input'
922
+ },
923
+ props: {
924
+ /** v-model 绑定值,逗号分隔字符串 */
925
+ value: {
926
+ type: String,
927
+ default: ''
928
+ },
929
+ /** 最大条数限制 */
930
+ max: {
931
+ type: Number,
932
+ default: 100
933
+ },
934
+ /** 输入框占位符 */
935
+ placeholder: {
936
+ type: String,
937
+ default: '请输入'
938
+ },
939
+ /** 弹窗标题 */
940
+ dialogTitle: {
941
+ type: String,
942
+ default: '批量输入'
943
+ },
944
+ /** 文本域占位符 */
945
+ textareaPlaceholder: {
946
+ type: String,
947
+ default: '支持从 Excel 粘贴,每行 / 逗号 / Tab 自动识别为一条'
948
+ },
949
+ /** 是否禁用 */
950
+ disabled: {
951
+ type: Boolean,
952
+ default: false
953
+ }
954
+ },
955
+ data() {
956
+ return {
957
+ dialogVisible: false,
958
+ draftText: '',
959
+ parsedItems: []
960
+ };
961
+ },
962
+ computed: {
963
+ displayValue() {
964
+ return this.value || '';
965
+ },
966
+ isOverLimit() {
967
+ return this.parsedItems.length > this.max;
968
+ }
969
+ },
970
+ methods: {
971
+ handleOpen() {
972
+ if (this.disabled) return;
973
+ this.dialogVisible = true;
974
+ },
975
+ handleDialogOpen() {
976
+ // 将当前 value 还原为每行一条
977
+ if (this.value) {
978
+ const items = this.value.split(',').map(s => s.trim()).filter(Boolean);
979
+ this.draftText = items.join('\n');
980
+ this.parsedItems = items;
981
+ } else {
982
+ this.draftText = '';
983
+ this.parsedItems = [];
984
+ }
985
+ },
986
+ handleDialogClosed() {
987
+ this.draftText = '';
988
+ this.parsedItems = [];
989
+ },
990
+ handleTextareaInput(val) {
991
+ const items = val.split(/[\n\r\t,,]+/).map(s => s.trim()).filter(Boolean);
992
+ this.parsedItems = items;
993
+ },
994
+ handleConfirm() {
995
+ if (this.isOverLimit) return;
996
+ const result = this.parsedItems.join(',');
997
+ this.$emit('input', result);
998
+ this.$emit('change', result);
999
+ this.dialogVisible = false;
1000
+ },
1001
+ handleClear() {
1002
+ this.$emit('input', '');
1003
+ this.$emit('change', '');
1004
+ }
1005
+ }
1006
+ });
1007
+ // CONCATENATED MODULE: ./src/components/N20BatchInput/index.vue?vue&type=script&lang=js
1008
+ /* harmony default export */ var components_N20BatchInputvue_type_script_lang_js = (N20BatchInputvue_type_script_lang_js);
1009
+ // EXTERNAL MODULE: ./src/components/N20BatchInput/index.vue?vue&type=style&index=0&id=081f8b8a&prod&scoped=true&lang=css
1010
+ var N20BatchInputvue_type_style_index_0_id_081f8b8a_prod_scoped_true_lang_css = __webpack_require__("b006");
1011
+
1012
+ // CONCATENATED MODULE: ./src/components/N20BatchInput/index.vue
1013
+
1014
+
1015
+
1016
+
1017
+
1018
+
1019
+ /* normalize component */
1020
+
1021
+ var N20BatchInput_component = normalizeComponent(
1022
+ components_N20BatchInputvue_type_script_lang_js,
1023
+ N20BatchInputvue_type_template_id_081f8b8a_scoped_true_render,
1024
+ N20BatchInputvue_type_template_id_081f8b8a_scoped_true_staticRenderFns,
1025
+ false,
1026
+ null,
1027
+ "081f8b8a",
1028
+ null
1029
+
1030
+ )
1031
+
1032
+ /* harmony default export */ var N20BatchInput = (N20BatchInput_component.exports);
497
1033
  // CONCATENATED MODULE: ./src/index.js
498
1034
  /**
499
1035
  * n20-project-component
@@ -504,10 +1040,14 @@ var N20CopyText_component = normalizeComponent(
504
1040
 
505
1041
 
506
1042
 
1043
+
1044
+
507
1045
  // ========== 组件列表 ==========
508
1046
  const components = {
509
1047
  DemoButton: DemoButton,
510
- N20CopyText: N20CopyText
1048
+ N20CopyText: N20CopyText,
1049
+ N20FloatingToolbar: N20FloatingToolbar,
1050
+ N20BatchInput: N20BatchInput
511
1051
  };
512
1052
 
513
1053
  // ========== 按需导出 ==========
@@ -1 +1 @@
1
- (function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["n20-project-component"]=t():e["n20-project-component"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({"021e":function(e,t,n){"use strict";n("f14e")},"3f46":function(e,t,n){"use strict";n("c5db")},c5db:function(e,t,n){},f14e:function(e,t,n){},fb15:function(e,t,n){"use strict";if(n.r(t),n.d(t,"DemoButton",(function(){return d})),n.d(t,"N20CopyText",(function(){return _})),"undefined"!==typeof window){var o=window.document.currentScript,i=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var r=function(){var e=this,t=e._self._c;return t("el-button",{staticClass:"n20-demo-button",attrs:{type:e.type,size:e.size,disabled:e.disabled,loading:e.loading,icon:e.icon},on:{click:e.handleClick}},[e._t("default",(function(){return[e._v(e._s(e.text))]}))],2)},s=[],c={name:"N20DemoButton",props:{text:{type:String,default:"按钮"},type:{type:String,default:"primary"},size:{type:String,default:""},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icon:{type:String,default:""}},methods:{handleClick(e){this.$emit("click",e)}}},a=c;n("021e");function u(e,t,n,o,i,r,s,c){var a,u="function"===typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=n,u._compiled=!0),o&&(u.functional=!0),r&&(u._scopeId="data-v-"+r),s?(a=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},u._ssrRegister=a):i&&(a=c?function(){i.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:i),a)if(u.functional){u._injectStyles=a;var l=u.render;u.render=function(e,t){return a.call(t),l(e,t)}}else{var d=u.beforeCreate;u.beforeCreate=d?[].concat(d,a):[a]}return{exports:e,options:u}}var l=u(a,r,s,!1,null,"1c0b7107",null),d=l.exports,f=function(){var e=this,t=e._self._c;return t("span",{staticClass:"n20-copy-text",on:{click:function(t){return t.stopPropagation(),e.handleCopy.apply(null,arguments)}}},[t("span",{ref:"content",staticClass:"n20-copy-text__content"},[e._t("default",(function(){return[e._v(e._s(e.text))]}))],2),e.showIcon?t("i",{class:["n20-copy-text__icon",e.copied?"el-icon-check":"el-icon-document-copy"],style:{order:"left"===e.iconPosition?-1:1}}):e._e()])},p=[],y={name:"N20CopyText",props:{text:{type:[String,Number],default:""},successTip:{type:String,default:"已复制"},showIcon:{type:Boolean,default:!0},iconPosition:{type:String,default:"right",validator:e=>["left","right"].includes(e)},disabled:{type:Boolean,default:!1}},data(){return{copied:!1,timer:null}},beforeDestroy(){clearTimeout(this.timer)},methods:{async handleCopy(){if(this.disabled||this.copied)return;const e=this.text||this.$refs.content&&this.$refs.content.innerText||"";if(e)try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(String(e));else{const t=document.createElement("textarea");t.value=String(e),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}this.copied=!0,this.$message.success(this.successTip),this.$emit("copy",String(e)),this.timer=setTimeout(()=>{this.copied=!1},2e3)}catch(t){this.$message.error("复制失败"),this.$emit("error",t)}}}},m=y,h=(n("3f46"),u(m,f,p,!1,null,"35583176",null)),_=h.exports;const b={DemoButton:d,N20CopyText:_},x=e=>{x.installed||(x.installed=!0,Object.values(b).forEach(t=>{e.component(t.name,t)}))};"undefined"!==typeof window&&window.Vue&&x(window.Vue);var v={install:x,...b};t["default"]=v}})}));
1
+ (function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["n20-project-component"]=e():t["n20-project-component"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"021e":function(t,e,n){"use strict";n("f14e")},"141c":function(t,e,n){},"3f46":function(t,e,n){"use strict";n("c5db")},b006:function(t,e,n){"use strict";n("141c")},b553:function(t,e,n){},c5db:function(t,e,n){},e863:function(t,e,n){"use strict";n("b553")},f14e:function(t,e,n){},fb15:function(t,e,n){"use strict";if(n.r(e),n.d(e,"DemoButton",(function(){return u})),n.d(e,"N20CopyText",(function(){return y})),n.d(e,"N20FloatingToolbar",(function(){return w})),n.d(e,"N20BatchInput",(function(){return j})),"undefined"!==typeof window){var i=window.document.currentScript,o=i&&i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(n.p=o[1])}var s=function(){var t=this,e=t._self._c;return e("el-button",{staticClass:"n20-demo-button",attrs:{type:t.type,size:t.size,disabled:t.disabled,loading:t.loading,icon:t.icon},on:{click:t.handleClick}},[t._t("default",(function(){return[t._v(t._s(t.text))]}))],2)},a=[],l={name:"N20DemoButton",props:{text:{type:String,default:"按钮"},type:{type:String,default:"primary"},size:{type:String,default:""},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icon:{type:String,default:""}},methods:{handleClick(t){this.$emit("click",t)}}},r=l;n("021e");function c(t,e,n,i,o,s,a,l){var r,c="function"===typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),i&&(c.functional=!0),s&&(c._scopeId="data-v-"+s),a?(r=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},c._ssrRegister=r):o&&(r=l?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),r)if(c.functional){c._injectStyles=r;var d=c.render;c.render=function(t,e){return r.call(e),d(t,e)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,r):[r]}return{exports:t,options:c}}var d=c(r,s,a,!1,null,"1c0b7107",null),u=d.exports,p=function(){var t=this,e=t._self._c;return e("span",{staticClass:"n20-copy-text",on:{click:function(e){return e.stopPropagation(),t.handleCopy.apply(null,arguments)}}},[e("span",{ref:"content",staticClass:"n20-copy-text__content"},[t._t("default",(function(){return[t._v(t._s(t.text))]}))],2),t.showIcon?e("i",{class:["n20-copy-text__icon",t.copied?"el-icon-check":"el-icon-document-copy"],style:{order:"left"===t.iconPosition?-1:1}}):t._e()])},f=[],h={name:"N20CopyText",props:{text:{type:[String,Number],default:""},successTip:{type:String,default:"已复制"},showIcon:{type:Boolean,default:!0},iconPosition:{type:String,default:"right",validator:t=>["left","right"].includes(t)},disabled:{type:Boolean,default:!1}},data(){return{copied:!1,timer:null}},beforeDestroy(){clearTimeout(this.timer)},methods:{async handleCopy(){if(this.disabled||this.copied)return;const t=this.text||this.$refs.content&&this.$refs.content.innerText||"";if(t)try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(String(t));else{const e=document.createElement("textarea");e.value=String(t),e.style.position="fixed",e.style.left="-9999px",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}this.copied=!0,this.$message.success(this.successTip),this.$emit("copy",String(t)),this.timer=setTimeout(()=>{this.copied=!1},2e3)}catch(e){this.$message.error("复制失败"),this.$emit("error",e)}}}},m=h,b=(n("3f46"),c(m,p,f,!1,null,"35583176",null)),y=b.exports,_=function(){var t=this,e=t._self._c;return e("div",{ref:"wrapper",staticClass:"n20-floating-toolbar-wrapper",on:{mouseup:t.handleMouseUp}},[t._t("default"),e("transition",{attrs:{name:"n20-toolbar-fade"}},[t.visible?e("div",{ref:"toolbar",staticClass:"n20-floating-toolbar",style:t.toolbarStyle,on:{mousedown:function(t){t.preventDefault()}}},[e("div",{staticClass:"n20-floating-toolbar__arrow"}),e("div",{staticClass:"n20-floating-toolbar__body"},[t._l(t.actions,(function(n,i){return e("button",{key:i,staticClass:"n20-floating-toolbar__btn",attrs:{title:n.label},on:{click:function(e){return e.stopPropagation(),t.handleAction(n,i)}}},[n.icon?e("i",{class:n.icon}):t._e(),n.label&&t.showLabel?e("span",[t._v(t._s(n.label))]):t._e()])})),t._t("toolbar",null,{selectedText:t.selectedText})],2)]):t._e()])],2)},g=[],v={name:"N20FloatingToolbar",props:{actions:{type:Array,default:()=>[{label:"复制",icon:"el-icon-document-copy",command:"copy"},{label:"搜索",icon:"el-icon-search",command:"search"},{label:"高亮",icon:"el-icon-edit",command:"highlight"}]},showLabel:{type:Boolean,default:!0},offset:{type:Number,default:8},disabled:{type:Boolean,default:!1},minLength:{type:Number,default:1}},data(){return{visible:!1,selectedText:"",toolbarStyle:{top:"0px",left:"0px"}}},mounted(){this._onDocClick=t=>{this.visible&&this.$refs.toolbar&&!this.$refs.toolbar.contains(t.target)&&this.hide()},this._onScroll=()=>{this.visible&&this.hide()},document.addEventListener("mousedown",this._onDocClick,!0),window.addEventListener("scroll",this._onScroll,!0)},beforeDestroy(){document.removeEventListener("mousedown",this._onDocClick,!0),window.removeEventListener("scroll",this._onScroll,!0)},methods:{handleMouseUp(){this.disabled||this.$nextTick(()=>{setTimeout(()=>{this.checkSelection()},0)})},checkSelection(){const t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return void this.hide();const e=t.toString().trim();if(e.length<this.minLength)return void this.hide();const n=this.$refs.wrapper;if(!n)return;const i=t.getRangeAt(0);n.contains(i.commonAncestorContainer)?(this.selectedText=e,this.positionToolbar(i),this.visible=!0):this.hide()},positionToolbar(t){const e=t.getBoundingClientRect(),n=this.$refs.wrapper.getBoundingClientRect(),i=e.left+e.width/2-n.left,o=e.top-n.top-this.offset;this.toolbarStyle={left:i+"px",top:o+"px"}},handleAction(t,e){this.$emit("action",{command:t.command||t.label,label:t.label,index:e,text:this.selectedText}),"copy"===t.command&&this.doCopy(this.selectedText),this.hide()},async doCopy(t){try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(t);else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.left="-9999px",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}this.$message&&this.$message.success("已复制")}catch(e){this.$message&&this.$message.error("复制失败")}},hide(){this.visible=!1,this.selectedText=""},show(){this.checkSelection()}}},x=v,C=(n("e863"),c(x,_,g,!1,null,"1b434c24",null)),w=C.exports,T=function(){var t=this,e=t._self._c;return e("div",{staticClass:"n20-batch-input"},[e("el-input",{staticClass:"n20-batch-input__trigger",attrs:{value:t.displayValue,placeholder:t.placeholder,disabled:t.disabled,readonly:""},nativeOn:{click:function(e){return t.handleOpen.apply(null,arguments)}}},[e("template",{slot:"suffix"},[e("span",{staticClass:"n20-batch-input__suffix"},[t.value&&!t.disabled?e("i",{staticClass:"el-icon-circle-close n20-batch-input__clear",on:{click:function(e){return e.stopPropagation(),t.handleClear.apply(null,arguments)}}}):t._e(),e("i",{staticClass:"el-icon-edit-outline n20-batch-input__edit",on:{click:function(e){return e.stopPropagation(),t.handleOpen.apply(null,arguments)}}})])])],2),e("el-dialog",{attrs:{title:t.dialogTitle,visible:t.dialogVisible,width:"520px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible=e},open:t.handleDialogOpen,closed:t.handleDialogClosed}},[e("div",{staticClass:"n20-batch-input__body"},[e("el-input",{attrs:{type:"textarea",rows:10,placeholder:t.textareaPlaceholder},on:{input:t.handleTextareaInput},model:{value:t.draftText,callback:function(e){t.draftText=e},expression:"draftText"}}),e("div",{staticClass:"n20-batch-input__counter",class:{"is-over":t.isOverLimit}},[t.isOverLimit?e("span",{staticClass:"n20-batch-input__error"},[t._v(" 已超出最大条数 "+t._s(t.max)+",请删减后提交 ")]):t._e(),e("span",{staticClass:"n20-batch-input__count"},[t._v(" 当前 "+t._s(t.parsedItems.length)+" 条 / 最大 "+t._s(t.max)+" 条 ")])])],1),e("div",{attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.dialogVisible=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary",disabled:t.isOverLimit},on:{click:t.handleConfirm}},[t._v(" 确 认 ")])],1)])],1)},S=[],$={name:"N20BatchInput",model:{prop:"value",event:"input"},props:{value:{type:String,default:""},max:{type:Number,default:100},placeholder:{type:String,default:"请输入"},dialogTitle:{type:String,default:"批量输入"},textareaPlaceholder:{type:String,default:"支持从 Excel 粘贴,每行 / 逗号 / Tab 自动识别为一条"},disabled:{type:Boolean,default:!1}},data(){return{dialogVisible:!1,draftText:"",parsedItems:[]}},computed:{displayValue(){return this.value||""},isOverLimit(){return this.parsedItems.length>this.max}},methods:{handleOpen(){this.disabled||(this.dialogVisible=!0)},handleDialogOpen(){if(this.value){const t=this.value.split(",").map(t=>t.trim()).filter(Boolean);this.draftText=t.join("\n"),this.parsedItems=t}else this.draftText="",this.parsedItems=[]},handleDialogClosed(){this.draftText="",this.parsedItems=[]},handleTextareaInput(t){const e=t.split(/[\n\r\t,,]+/).map(t=>t.trim()).filter(Boolean);this.parsedItems=e},handleConfirm(){if(this.isOverLimit)return;const t=this.parsedItems.join(",");this.$emit("input",t),this.$emit("change",t),this.dialogVisible=!1},handleClear(){this.$emit("input",""),this.$emit("change","")}}},k=$,O=(n("b006"),c(k,T,S,!1,null,"081f8b8a",null)),j=O.exports;const B={DemoButton:u,N20CopyText:y,N20FloatingToolbar:w,N20BatchInput:j},I=t=>{I.installed||(I.installed=!0,Object.values(B).forEach(e=>{t.component(e.name,e)}))};"undefined"!==typeof window&&window.Vue&&I(window.Vue);var N={install:I,...B};e["default"]=N}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-project-component",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "PC 端 Vue 2 + Element UI 组件库",
5
5
  "main": "dist/n20-project-component.umd.min.js",
6
6
  "module": "dist/n20-project-component.common.js",