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.
package/README.md CHANGED
@@ -8,9 +8,8 @@ PC 端 Vue 2 + Element UI 通用组件库,公司内部项目复用。
8
8
  |------|------|------|
9
9
  | N20CopyText | 点击复制文本,弹出「已复制」反馈 | ✅ 已完成 |
10
10
  | N20FloatingToolbar | 选中文字后浮现操作工具条 | 🔲 待开发 |
11
- | N20Marquee | 滚动通知条(水平/垂直) | 🔲 待开发 |
12
11
  | N20FrequentWords | 常用词输入,自动记录到本地缓存 | 🔲 待开发 |
13
- | N20BatchInput | 批量输入,粘贴自动拆分为多个标签 | 🔲 待开发 |
12
+ | N20BatchInput | 批量输入,粘贴自动拆分为多个标签 | 已完成 |
14
13
 
15
14
  ---
16
15
 
@@ -117,47 +116,6 @@ export default {
117
116
 
118
117
  ---
119
118
 
120
- ## 组件文档
121
-
122
- ### N20CopyText
123
-
124
- 点击复制文本到剪贴板,显示「已复制」反馈气泡。
125
-
126
- #### 基础用法
127
-
128
- ```vue
129
- <N20CopyText text="需要复制的内容">显示的文字</N20CopyText>
130
- ```
131
-
132
- #### 在表格中使用
133
-
134
- ```vue
135
- <el-table-column label="单据编号">
136
- <template slot-scope="{ row }">
137
- <N20CopyText :text="row.billNo">{{ row.billNo }}</N20CopyText>
138
- </template>
139
- </el-table-column>
140
- ```
141
-
142
- #### Props
143
-
144
- | 参数 | 说明 | 类型 | 默认值 |
145
- |------|------|------|--------|
146
- | text | 要复制的文本,留空则取 slot 内容 | String / Number | '' |
147
- | successTip | 复制成功提示 | String | '已复制' |
148
- | showIcon | 是否显示复制图标 | Boolean | true |
149
- | iconPosition | 图标位置 left / right | String | 'right' |
150
- | disabled | 是否禁用 | Boolean | false |
151
-
152
- #### Events
153
-
154
- | 事件名 | 说明 | 参数 |
155
- |--------|------|------|
156
- | copy | 复制成功 | (text) |
157
- | error | 复制失败 | (error) |
158
-
159
- ---
160
-
161
119
  ## 本地开发
162
120
 
163
121
  ```bash
@@ -96,6 +96,13 @@ module.exports =
96
96
  /* unused harmony reexport * */
97
97
 
98
98
 
99
+ /***/ }),
100
+
101
+ /***/ "141c":
102
+ /***/ (function(module, exports, __webpack_require__) {
103
+
104
+ // extracted by mini-css-extract-plugin
105
+
99
106
  /***/ }),
100
107
 
101
108
  /***/ "3f46":
@@ -107,6 +114,24 @@ module.exports =
107
114
  /* unused harmony reexport * */
108
115
 
109
116
 
117
+ /***/ }),
118
+
119
+ /***/ "b006":
120
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
121
+
122
+ "use strict";
123
+ /* 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");
124
+ /* 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__);
125
+ /* unused harmony reexport * */
126
+
127
+
128
+ /***/ }),
129
+
130
+ /***/ "b553":
131
+ /***/ (function(module, exports, __webpack_require__) {
132
+
133
+ // extracted by mini-css-extract-plugin
134
+
110
135
  /***/ }),
111
136
 
112
137
  /***/ "c5db":
@@ -114,6 +139,17 @@ module.exports =
114
139
 
115
140
  // extracted by mini-css-extract-plugin
116
141
 
142
+ /***/ }),
143
+
144
+ /***/ "e863":
145
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
146
+
147
+ "use strict";
148
+ /* 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");
149
+ /* 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__);
150
+ /* unused harmony reexport * */
151
+
152
+
117
153
  /***/ }),
118
154
 
119
155
  /***/ "f14e":
@@ -133,6 +169,8 @@ __webpack_require__.r(__webpack_exports__);
133
169
  // EXPORTS
134
170
  __webpack_require__.d(__webpack_exports__, "DemoButton", function() { return /* reexport */ DemoButton; });
135
171
  __webpack_require__.d(__webpack_exports__, "N20CopyText", function() { return /* reexport */ N20CopyText; });
172
+ __webpack_require__.d(__webpack_exports__, "N20FloatingToolbar", function() { return /* reexport */ N20FloatingToolbar; });
173
+ __webpack_require__.d(__webpack_exports__, "N20BatchInput", function() { return /* reexport */ N20BatchInput; });
136
174
 
137
175
  // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
138
176
  // This file is imported into lib/wc client bundles.
@@ -150,7 +188,7 @@ if (typeof window !== 'undefined') {
150
188
  // Indicate to webpack that this file can be concatenated
151
189
  /* harmony default export */ var setPublicPath = (null);
152
190
 
153
- // 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
191
+ // 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
154
192
  var render = function render() {
155
193
  var _vm = this,
156
194
  _c = _vm._self._c;
@@ -174,7 +212,7 @@ var staticRenderFns = [];
174
212
 
175
213
  // CONCATENATED MODULE: ./src/components/DemoButton/index.vue?vue&type=template&id=1c0b7107&scoped=true
176
214
 
177
- // 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
215
+ // 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
178
216
  /**
179
217
  * DemoButton - 示例按钮组件
180
218
  *
@@ -347,7 +385,7 @@ var component = normalizeComponent(
347
385
  )
348
386
 
349
387
  /* harmony default export */ var DemoButton = (component.exports);
350
- // 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
388
+ // 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
351
389
  var N20CopyTextvue_type_template_id_35583176_scoped_true_render = function render() {
352
390
  var _vm = this,
353
391
  _c = _vm._self._c;
@@ -375,7 +413,7 @@ var N20CopyTextvue_type_template_id_35583176_scoped_true_staticRenderFns = [];
375
413
 
376
414
  // CONCATENATED MODULE: ./src/components/N20CopyText/index.vue?vue&type=template&id=35583176&scoped=true
377
415
 
378
- // 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
416
+ // 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
379
417
  /**
380
418
  * N20CopyText - 点击复制文本组件
381
419
  *
@@ -485,6 +523,504 @@ var N20CopyText_component = normalizeComponent(
485
523
  )
486
524
 
487
525
  /* harmony default export */ var N20CopyText = (N20CopyText_component.exports);
526
+ // 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
527
+ var N20FloatingToolbarvue_type_template_id_1b434c24_scoped_true_render = function render() {
528
+ var _vm = this,
529
+ _c = _vm._self._c;
530
+ return _c('div', {
531
+ ref: "wrapper",
532
+ staticClass: "n20-floating-toolbar-wrapper",
533
+ on: {
534
+ "mouseup": _vm.handleMouseUp
535
+ }
536
+ }, [_vm._t("default"), _c('transition', {
537
+ attrs: {
538
+ "name": "n20-toolbar-fade"
539
+ }
540
+ }, [_vm.visible ? _c('div', {
541
+ ref: "toolbar",
542
+ staticClass: "n20-floating-toolbar",
543
+ style: _vm.toolbarStyle,
544
+ on: {
545
+ "mousedown": function ($event) {
546
+ $event.preventDefault();
547
+ }
548
+ }
549
+ }, [_c('div', {
550
+ staticClass: "n20-floating-toolbar__arrow"
551
+ }), _c('div', {
552
+ staticClass: "n20-floating-toolbar__body"
553
+ }, [_vm._l(_vm.actions, function (btn, idx) {
554
+ return _c('button', {
555
+ key: idx,
556
+ staticClass: "n20-floating-toolbar__btn",
557
+ attrs: {
558
+ "title": btn.label
559
+ },
560
+ on: {
561
+ "click": function ($event) {
562
+ $event.stopPropagation();
563
+ return _vm.handleAction(btn, idx);
564
+ }
565
+ }
566
+ }, [btn.icon ? _c('i', {
567
+ class: btn.icon
568
+ }) : _vm._e(), btn.label && _vm.showLabel ? _c('span', [_vm._v(_vm._s(btn.label))]) : _vm._e()]);
569
+ }), _vm._t("toolbar", null, {
570
+ "selectedText": _vm.selectedText
571
+ })], 2)]) : _vm._e()])], 2);
572
+ };
573
+ var N20FloatingToolbarvue_type_template_id_1b434c24_scoped_true_staticRenderFns = [];
574
+
575
+ // CONCATENATED MODULE: ./src/components/N20FloatingToolbar/index.vue?vue&type=template&id=1b434c24&scoped=true
576
+
577
+ // 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
578
+ /**
579
+ * N20FloatingToolbar — 选中浮现工具栏
580
+ *
581
+ * 包裹内容区域,用户选中文字后在选区上方浮现操作按钮条。
582
+ * 鼠标拖选文字松开后,选区上方浮现深色工具条,
583
+ * 点击按钮触发事件,点其他地方消失。
584
+ *
585
+ * @example
586
+ * <N20FloatingToolbar
587
+ * :actions="[
588
+ * { label: '复制', icon: 'el-icon-document-copy' },
589
+ * { label: '搜索', icon: 'el-icon-search' },
590
+ * { label: '高亮', icon: 'el-icon-edit' },
591
+ * ]"
592
+ * @action="handleToolbarAction"
593
+ * >
594
+ * <p>这里是一段可以被选中的文本内容...</p>
595
+ * </N20FloatingToolbar>
596
+ */
597
+ /* harmony default export */ var N20FloatingToolbarvue_type_script_lang_js = ({
598
+ name: 'N20FloatingToolbar',
599
+ props: {
600
+ /**
601
+ * 工具栏按钮列表
602
+ * 每项 { label: string, icon?: string, command?: string }
603
+ */
604
+ actions: {
605
+ type: Array,
606
+ default: () => [{
607
+ label: '复制',
608
+ icon: 'el-icon-document-copy',
609
+ command: 'copy'
610
+ }, {
611
+ label: '搜索',
612
+ icon: 'el-icon-search',
613
+ command: 'search'
614
+ }, {
615
+ label: '高亮',
616
+ icon: 'el-icon-edit',
617
+ command: 'highlight'
618
+ }]
619
+ },
620
+ /** 是否在按钮中显示文字标签 */
621
+ showLabel: {
622
+ type: Boolean,
623
+ default: true
624
+ },
625
+ /** 工具栏与选区的垂直间距(px) */
626
+ offset: {
627
+ type: Number,
628
+ default: 8
629
+ },
630
+ /** 是否禁用 */
631
+ disabled: {
632
+ type: Boolean,
633
+ default: false
634
+ },
635
+ /** 选中最少字符数才触发 */
636
+ minLength: {
637
+ type: Number,
638
+ default: 1
639
+ }
640
+ },
641
+ data() {
642
+ return {
643
+ visible: false,
644
+ selectedText: '',
645
+ toolbarStyle: {
646
+ top: '0px',
647
+ left: '0px'
648
+ }
649
+ };
650
+ },
651
+ mounted() {
652
+ // 监听全局点击 → 隐藏工具栏
653
+ this._onDocClick = e => {
654
+ if (this.visible && this.$refs.toolbar && !this.$refs.toolbar.contains(e.target)) {
655
+ this.hide();
656
+ }
657
+ };
658
+ // 监听滚动 → 隐藏工具栏
659
+ this._onScroll = () => {
660
+ if (this.visible) {
661
+ this.hide();
662
+ }
663
+ };
664
+ document.addEventListener('mousedown', this._onDocClick, true);
665
+ window.addEventListener('scroll', this._onScroll, true);
666
+ },
667
+ beforeDestroy() {
668
+ document.removeEventListener('mousedown', this._onDocClick, true);
669
+ window.removeEventListener('scroll', this._onScroll, true);
670
+ },
671
+ methods: {
672
+ /** 鼠标松开时判断是否有选区 */
673
+ handleMouseUp() {
674
+ if (this.disabled) return;
675
+
676
+ // 延迟一帧让浏览器完成选区更新
677
+ this.$nextTick(() => {
678
+ setTimeout(() => {
679
+ this.checkSelection();
680
+ }, 0);
681
+ });
682
+ },
683
+ /** 检测当前选区 */
684
+ checkSelection() {
685
+ const selection = window.getSelection();
686
+ if (!selection || selection.isCollapsed || !selection.toString().trim()) {
687
+ this.hide();
688
+ return;
689
+ }
690
+ const text = selection.toString().trim();
691
+ if (text.length < this.minLength) {
692
+ this.hide();
693
+ return;
694
+ }
695
+
696
+ // 确保选区在 wrapper 内
697
+ const wrapper = this.$refs.wrapper;
698
+ if (!wrapper) return;
699
+ const range = selection.getRangeAt(0);
700
+ if (!wrapper.contains(range.commonAncestorContainer)) {
701
+ this.hide();
702
+ return;
703
+ }
704
+ this.selectedText = text;
705
+ this.positionToolbar(range);
706
+ this.visible = true;
707
+ },
708
+ /** 根据选区 Range 定位工具栏 */
709
+ positionToolbar(range) {
710
+ const rect = range.getBoundingClientRect();
711
+ const wrapperRect = this.$refs.wrapper.getBoundingClientRect();
712
+
713
+ // 工具栏居中于选区上方
714
+ const left = rect.left + rect.width / 2 - wrapperRect.left;
715
+ const top = rect.top - wrapperRect.top - this.offset;
716
+ this.toolbarStyle = {
717
+ left: `${left}px`,
718
+ top: `${top}px`
719
+ };
720
+ },
721
+ /** 点击按钮 */
722
+ handleAction(btn, idx) {
723
+ this.$emit('action', {
724
+ command: btn.command || btn.label,
725
+ label: btn.label,
726
+ index: idx,
727
+ text: this.selectedText
728
+ });
729
+
730
+ // 内置 copy 行为
731
+ if (btn.command === 'copy') {
732
+ this.doCopy(this.selectedText);
733
+ }
734
+ this.hide();
735
+ },
736
+ /** 复制文本到剪贴板 */
737
+ async doCopy(text) {
738
+ try {
739
+ if (navigator.clipboard && window.isSecureContext) {
740
+ await navigator.clipboard.writeText(text);
741
+ } else {
742
+ const textarea = document.createElement('textarea');
743
+ textarea.value = text;
744
+ textarea.style.position = 'fixed';
745
+ textarea.style.left = '-9999px';
746
+ document.body.appendChild(textarea);
747
+ textarea.select();
748
+ document.execCommand('copy');
749
+ document.body.removeChild(textarea);
750
+ }
751
+ this.$message && this.$message.success('已复制');
752
+ } catch (err) {
753
+ this.$message && this.$message.error('复制失败');
754
+ }
755
+ },
756
+ /** 隐藏工具栏 */
757
+ hide() {
758
+ this.visible = false;
759
+ this.selectedText = '';
760
+ },
761
+ /** 外部可调用:手动显示 */
762
+ show() {
763
+ this.checkSelection();
764
+ }
765
+ }
766
+ });
767
+ // CONCATENATED MODULE: ./src/components/N20FloatingToolbar/index.vue?vue&type=script&lang=js
768
+ /* harmony default export */ var components_N20FloatingToolbarvue_type_script_lang_js = (N20FloatingToolbarvue_type_script_lang_js);
769
+ // EXTERNAL MODULE: ./src/components/N20FloatingToolbar/index.vue?vue&type=style&index=0&id=1b434c24&prod&lang=scss&scoped=true
770
+ var N20FloatingToolbarvue_type_style_index_0_id_1b434c24_prod_lang_scss_scoped_true = __webpack_require__("e863");
771
+
772
+ // CONCATENATED MODULE: ./src/components/N20FloatingToolbar/index.vue
773
+
774
+
775
+
776
+
777
+
778
+
779
+ /* normalize component */
780
+
781
+ var N20FloatingToolbar_component = normalizeComponent(
782
+ components_N20FloatingToolbarvue_type_script_lang_js,
783
+ N20FloatingToolbarvue_type_template_id_1b434c24_scoped_true_render,
784
+ N20FloatingToolbarvue_type_template_id_1b434c24_scoped_true_staticRenderFns,
785
+ false,
786
+ null,
787
+ "1b434c24",
788
+ null
789
+
790
+ )
791
+
792
+ /* harmony default export */ var N20FloatingToolbar = (N20FloatingToolbar_component.exports);
793
+ // 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
794
+ var N20BatchInputvue_type_template_id_081f8b8a_scoped_true_render = function render() {
795
+ var _vm = this,
796
+ _c = _vm._self._c;
797
+ return _c('div', {
798
+ staticClass: "n20-batch-input"
799
+ }, [_c('el-input', {
800
+ staticClass: "n20-batch-input__trigger",
801
+ attrs: {
802
+ "value": _vm.displayValue,
803
+ "placeholder": _vm.placeholder,
804
+ "disabled": _vm.disabled,
805
+ "readonly": ""
806
+ },
807
+ nativeOn: {
808
+ "click": function ($event) {
809
+ return _vm.handleOpen.apply(null, arguments);
810
+ }
811
+ }
812
+ }, [_c('template', {
813
+ slot: "suffix"
814
+ }, [_c('span', {
815
+ staticClass: "n20-batch-input__suffix"
816
+ }, [_vm.value && !_vm.disabled ? _c('i', {
817
+ staticClass: "el-icon-circle-close n20-batch-input__clear",
818
+ on: {
819
+ "click": function ($event) {
820
+ $event.stopPropagation();
821
+ return _vm.handleClear.apply(null, arguments);
822
+ }
823
+ }
824
+ }) : _vm._e(), _c('i', {
825
+ staticClass: "el-icon-edit-outline n20-batch-input__edit",
826
+ on: {
827
+ "click": function ($event) {
828
+ $event.stopPropagation();
829
+ return _vm.handleOpen.apply(null, arguments);
830
+ }
831
+ }
832
+ })])])], 2), _c('el-dialog', {
833
+ attrs: {
834
+ "title": _vm.dialogTitle,
835
+ "visible": _vm.dialogVisible,
836
+ "width": "520px",
837
+ "close-on-click-modal": false
838
+ },
839
+ on: {
840
+ "update:visible": function ($event) {
841
+ _vm.dialogVisible = $event;
842
+ },
843
+ "open": _vm.handleDialogOpen,
844
+ "closed": _vm.handleDialogClosed
845
+ }
846
+ }, [_c('div', {
847
+ staticClass: "n20-batch-input__body"
848
+ }, [_c('el-input', {
849
+ attrs: {
850
+ "type": "textarea",
851
+ "rows": 10,
852
+ "placeholder": _vm.textareaPlaceholder
853
+ },
854
+ on: {
855
+ "input": _vm.handleTextareaInput
856
+ },
857
+ model: {
858
+ value: _vm.draftText,
859
+ callback: function ($$v) {
860
+ _vm.draftText = $$v;
861
+ },
862
+ expression: "draftText"
863
+ }
864
+ }), _c('div', {
865
+ staticClass: "n20-batch-input__counter",
866
+ class: {
867
+ 'is-over': _vm.isOverLimit
868
+ }
869
+ }, [_vm.isOverLimit ? _c('span', {
870
+ staticClass: "n20-batch-input__error"
871
+ }, [_vm._v(" 已超出最大条数 " + _vm._s(_vm.max) + ",请删减后提交 ")]) : _vm._e(), _c('span', {
872
+ staticClass: "n20-batch-input__count"
873
+ }, [_vm._v(" 当前 " + _vm._s(_vm.parsedItems.length) + " 条 / 最大 " + _vm._s(_vm.max) + " 条 ")])])], 1), _c('div', {
874
+ attrs: {
875
+ "slot": "footer"
876
+ },
877
+ slot: "footer"
878
+ }, [_c('el-button', {
879
+ on: {
880
+ "click": function ($event) {
881
+ _vm.dialogVisible = false;
882
+ }
883
+ }
884
+ }, [_vm._v("取 消")]), _c('el-button', {
885
+ attrs: {
886
+ "type": "primary",
887
+ "disabled": _vm.isOverLimit
888
+ },
889
+ on: {
890
+ "click": _vm.handleConfirm
891
+ }
892
+ }, [_vm._v(" 确 认 ")])], 1)])], 1);
893
+ };
894
+ var N20BatchInputvue_type_template_id_081f8b8a_scoped_true_staticRenderFns = [];
895
+
896
+ // CONCATENATED MODULE: ./src/components/N20BatchInput/index.vue?vue&type=template&id=081f8b8a&scoped=true
897
+
898
+ // 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
899
+ /**
900
+ * N20BatchInput - 批量输入组件
901
+ *
902
+ * 点击输入框打开弹窗,支持从 Excel 粘贴内容,自动按换行/制表符/逗号拆分为多个条目。
903
+ * v-model 绑定逗号分隔的字符串。
904
+ *
905
+ * @example
906
+ * <N20BatchInput v-model="batchValue" :max="50" />
907
+ */
908
+ /* harmony default export */ var N20BatchInputvue_type_script_lang_js = ({
909
+ name: 'N20BatchInput',
910
+ model: {
911
+ prop: 'value',
912
+ event: 'input'
913
+ },
914
+ props: {
915
+ /** v-model 绑定值,逗号分隔字符串 */
916
+ value: {
917
+ type: String,
918
+ default: ''
919
+ },
920
+ /** 最大条数限制 */
921
+ max: {
922
+ type: Number,
923
+ default: 100
924
+ },
925
+ /** 输入框占位符 */
926
+ placeholder: {
927
+ type: String,
928
+ default: '请输入'
929
+ },
930
+ /** 弹窗标题 */
931
+ dialogTitle: {
932
+ type: String,
933
+ default: '批量输入'
934
+ },
935
+ /** 文本域占位符 */
936
+ textareaPlaceholder: {
937
+ type: String,
938
+ default: '支持从 Excel 粘贴,每行 / 逗号 / Tab 自动识别为一条'
939
+ },
940
+ /** 是否禁用 */
941
+ disabled: {
942
+ type: Boolean,
943
+ default: false
944
+ }
945
+ },
946
+ data() {
947
+ return {
948
+ dialogVisible: false,
949
+ draftText: '',
950
+ parsedItems: []
951
+ };
952
+ },
953
+ computed: {
954
+ displayValue() {
955
+ return this.value || '';
956
+ },
957
+ isOverLimit() {
958
+ return this.parsedItems.length > this.max;
959
+ }
960
+ },
961
+ methods: {
962
+ handleOpen() {
963
+ if (this.disabled) return;
964
+ this.dialogVisible = true;
965
+ },
966
+ handleDialogOpen() {
967
+ // 将当前 value 还原为每行一条
968
+ if (this.value) {
969
+ const items = this.value.split(',').map(s => s.trim()).filter(Boolean);
970
+ this.draftText = items.join('\n');
971
+ this.parsedItems = items;
972
+ } else {
973
+ this.draftText = '';
974
+ this.parsedItems = [];
975
+ }
976
+ },
977
+ handleDialogClosed() {
978
+ this.draftText = '';
979
+ this.parsedItems = [];
980
+ },
981
+ handleTextareaInput(val) {
982
+ const items = val.split(/[\n\r\t,,]+/).map(s => s.trim()).filter(Boolean);
983
+ this.parsedItems = items;
984
+ },
985
+ handleConfirm() {
986
+ if (this.isOverLimit) return;
987
+ const result = this.parsedItems.join(',');
988
+ this.$emit('input', result);
989
+ this.$emit('change', result);
990
+ this.dialogVisible = false;
991
+ },
992
+ handleClear() {
993
+ this.$emit('input', '');
994
+ this.$emit('change', '');
995
+ }
996
+ }
997
+ });
998
+ // CONCATENATED MODULE: ./src/components/N20BatchInput/index.vue?vue&type=script&lang=js
999
+ /* harmony default export */ var components_N20BatchInputvue_type_script_lang_js = (N20BatchInputvue_type_script_lang_js);
1000
+ // EXTERNAL MODULE: ./src/components/N20BatchInput/index.vue?vue&type=style&index=0&id=081f8b8a&prod&scoped=true&lang=css
1001
+ var N20BatchInputvue_type_style_index_0_id_081f8b8a_prod_scoped_true_lang_css = __webpack_require__("b006");
1002
+
1003
+ // CONCATENATED MODULE: ./src/components/N20BatchInput/index.vue
1004
+
1005
+
1006
+
1007
+
1008
+
1009
+
1010
+ /* normalize component */
1011
+
1012
+ var N20BatchInput_component = normalizeComponent(
1013
+ components_N20BatchInputvue_type_script_lang_js,
1014
+ N20BatchInputvue_type_template_id_081f8b8a_scoped_true_render,
1015
+ N20BatchInputvue_type_template_id_081f8b8a_scoped_true_staticRenderFns,
1016
+ false,
1017
+ null,
1018
+ "081f8b8a",
1019
+ null
1020
+
1021
+ )
1022
+
1023
+ /* harmony default export */ var N20BatchInput = (N20BatchInput_component.exports);
488
1024
  // CONCATENATED MODULE: ./src/index.js
489
1025
  /**
490
1026
  * n20-project-component
@@ -495,10 +1031,14 @@ var N20CopyText_component = normalizeComponent(
495
1031
 
496
1032
 
497
1033
 
1034
+
1035
+
498
1036
  // ========== 组件列表 ==========
499
1037
  const components = {
500
1038
  DemoButton: DemoButton,
501
- N20CopyText: N20CopyText
1039
+ N20CopyText: N20CopyText,
1040
+ N20FloatingToolbar: N20FloatingToolbar,
1041
+ N20BatchInput: N20BatchInput
502
1042
  };
503
1043
 
504
1044
  // ========== 按需导出 ==========
@@ -1 +1 @@
1
- .n20-demo-button[data-v-1c0b7107]{border-radius:4px;font-size:14px}.n20-copy-text[data-v-35583176]{display:inline-flex;align-items:center;gap:4px;cursor:pointer}.n20-copy-text:hover .n20-copy-text__icon[data-v-35583176]{opacity:1}.n20-copy-text__content[data-v-35583176]{display:inline}.n20-copy-text__icon[data-v-35583176]{font-size:14px;color:#909399;opacity:.4;transition:all .2s ease}.n20-copy-text__icon.el-icon-check[data-v-35583176]{color:#67c23a;opacity:1}
1
+ .n20-demo-button[data-v-1c0b7107]{border-radius:4px;font-size:14px}.n20-copy-text[data-v-35583176]{display:inline-flex;align-items:center;gap:4px;cursor:pointer}.n20-copy-text:hover .n20-copy-text__icon[data-v-35583176]{opacity:1}.n20-copy-text__content[data-v-35583176]{display:inline}.n20-copy-text__icon[data-v-35583176]{font-size:14px;color:#909399;opacity:.4;transition:all .2s ease}.n20-copy-text__icon.el-icon-check[data-v-35583176]{color:#67c23a;opacity:1}.n20-floating-toolbar-wrapper[data-v-1b434c24]{position:relative;display:inline-block;width:100%}.n20-floating-toolbar[data-v-1b434c24]{position:absolute;z-index:9999;transform:translateX(-50%) translateY(-100%);pointer-events:auto}.n20-floating-toolbar__arrow[data-v-1b434c24]{position:absolute;left:50%;bottom:-5px;transform:translateX(-50%) rotate(45deg);width:10px;height:10px;background:#1f2937;border-radius:0 0 2px 0}.n20-floating-toolbar__body[data-v-1b434c24]{display:inline-flex;align-items:center;gap:2px;padding:4px 6px;background:#1f2937;border-radius:6px;box-shadow:0 4px 16px rgba(0,0,0,.24),inset 0 0 0 1px hsla(0,0%,100%,.06);white-space:nowrap}.n20-floating-toolbar__btn[data-v-1b434c24]{display:inline-flex;align-items:center;gap:4px;padding:5px 10px;border:none;border-radius:4px;background:transparent;color:#e5e7eb;font-size:13px;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease;outline:none}.n20-floating-toolbar__btn i[data-v-1b434c24]{font-size:14px}.n20-floating-toolbar__btn[data-v-1b434c24]:hover{background:hsla(0,0%,100%,.12);color:#fff}.n20-floating-toolbar__btn[data-v-1b434c24]:active{background:hsla(0,0%,100%,.18)}.n20-floating-toolbar__btn+.n20-floating-toolbar__btn[data-v-1b434c24]{margin-left:1px}.n20-toolbar-fade-enter-active[data-v-1b434c24]{transition:opacity .18s ease,transform .18s ease}.n20-toolbar-fade-leave-active[data-v-1b434c24]{transition:opacity .12s ease,transform .12s ease}.n20-toolbar-fade-enter[data-v-1b434c24],.n20-toolbar-fade-leave-to[data-v-1b434c24]{opacity:0;transform:translateX(-50%) translateY(-100%) scale(.92)}.n20-batch-input[data-v-081f8b8a]{display:inline-block;width:100%}.n20-batch-input__trigger[data-v-081f8b8a]{cursor:pointer}.n20-batch-input__trigger[data-v-081f8b8a] .el-input__inner{cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-right:52px}.n20-batch-input__suffix[data-v-081f8b8a]{display:inline-flex;align-items:center;height:100%;gap:4px}.n20-batch-input__clear[data-v-081f8b8a]:hover{color:#909399}.n20-batch-input__edit[data-v-081f8b8a]{color:#c0c4cc;cursor:pointer}.n20-batch-input__edit[data-v-081f8b8a]:hover{color:#409eff}.n20-batch-input__body[data-v-081f8b8a]{padding:0 4px}.n20-batch-input__counter[data-v-081f8b8a]{display:flex;justify-content:flex-end;align-items:center;margin-top:8px;font-size:13px;color:#909399;gap:12px}.n20-batch-input__counter.is-over[data-v-081f8b8a]{color:#f56c6c}.n20-batch-input__error[data-v-081f8b8a]{flex:1;color:#f56c6c}.n20-batch-input__count[data-v-081f8b8a]{white-space:nowrap}