bkui-vue 0.0.1-beta.46 → 0.0.1-beta.49
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/dist/index.cjs.js +23 -23
- package/dist/index.esm.js +372 -273
- package/dist/index.umd.js +24 -24
- package/dist/style.css +1 -1
- package/lib/button/button.css +31 -23
- package/lib/button/button.d.ts +13 -6
- package/lib/button/button.less +22 -18
- package/lib/button/button.variable.css +31 -23
- package/lib/button/index.d.ts +20 -9
- package/lib/button/index.js +1 -1
- package/lib/checkbox/checkbox.css +12 -0
- package/lib/checkbox/checkbox.d.ts +5 -11
- package/lib/checkbox/checkbox.less +17 -0
- package/lib/checkbox/checkbox.variable.css +12 -0
- package/lib/checkbox/common.d.ts +3 -3
- package/lib/checkbox/index.d.ts +10 -18
- package/lib/checkbox/index.js +1 -1
- package/lib/checkbox/type.d.ts +2 -6
- package/lib/dialog/dialog.css +31 -0
- package/lib/dialog/dialog.less +2 -0
- package/lib/dialog/dialog.variable.css +31 -0
- package/lib/dropdown/dropdown.d.ts +3 -1
- package/lib/dropdown/index.d.ts +11 -3
- package/lib/dropdown/index.js +1 -1
- package/lib/form/compose-form-item.d.ts +16 -0
- package/lib/form/form.css +73 -12
- package/lib/form/form.less +120 -46
- package/lib/form/form.variable.css +167 -12
- package/lib/form/index.d.ts +17 -1
- package/lib/form/index.js +1 -1
- package/lib/icon/index.js +1 -0
- package/lib/icon/info-line.js +1 -0
- package/lib/icon/info.js +1 -0
- package/lib/icon/left-shape.js +1 -0
- package/lib/icon/play-shape.js +1 -0
- package/lib/icon/plus.js +1 -0
- package/lib/icon/qq.js +1 -0
- package/lib/icon/right-shape.js +1 -0
- package/lib/icon/search.js +1 -0
- package/lib/icon/share.js +1 -0
- package/lib/icon/spinner.js +1 -0
- package/lib/icon/success.js +1 -0
- package/lib/icon/switcher-loading.js +1 -0
- package/lib/icon/text-file.js +1 -0
- package/lib/icon/tree-application-shape.js +1 -0
- package/lib/icon/unvisible.js +1 -0
- package/lib/icon/up-shape.js +1 -0
- package/lib/icon/warn.js +1 -0
- package/lib/icon/weixin.js +1 -0
- package/lib/input/index.js +1 -0
- package/lib/link/index.js +1 -0
- package/lib/loading/index.js +1 -0
- package/lib/loading/loading.css +1 -0
- package/lib/loading/loading.less +1 -0
- package/lib/loading/loading.variable.css +1 -0
- package/lib/menu/index.js +1 -0
- package/lib/message/index.js +1 -0
- package/lib/modal/index.js +1 -0
- package/lib/navigation/index.js +1 -0
- package/lib/notify/index.js +1 -0
- package/lib/pagination/index.js +1 -0
- package/lib/popover/index.js +1 -0
- package/lib/process/index.js +1 -0
- package/lib/progress/index.js +1 -0
- package/lib/radio/common.d.ts +5 -5
- package/lib/radio/index.d.ts +17 -16
- package/lib/radio/index.js +1 -0
- package/lib/radio/radio-button.d.ts +5 -4
- package/lib/radio/radio.css +2 -2
- package/lib/radio/radio.d.ts +4 -4
- package/lib/radio/radio.less +2 -2
- package/lib/radio/radio.variable.css +2 -2
- package/lib/radio/type.d.ts +9 -4
- package/lib/rate/index.js +1 -0
- package/lib/resize-layout/index.js +1 -0
- package/lib/select/index.js +1 -0
- package/lib/shared/index.js +1 -0
- package/lib/shared/popover.d.ts +2 -2
- package/lib/sideslider/index.js +1 -0
- package/lib/slider/index.js +1 -0
- package/lib/steps/index.js +1 -0
- package/lib/swiper/index.js +1 -0
- package/lib/switcher/index.js +1 -0
- package/lib/tab/index.js +1 -0
- package/lib/table/index.js +1 -0
- package/lib/table/table.css +90 -0
- package/lib/table/table.d.ts +0 -1
- package/lib/table/table.less +2 -1
- package/lib/table/table.variable.css +104 -14
- package/lib/tag/index.js +1 -0
- package/lib/tag-input/index.js +1 -0
- package/lib/timeline/index.js +1 -0
- package/lib/transfer/index.js +1 -0
- package/lib/tree/index.js +1 -0
- package/lib/virtual-render/index.js +1 -0
- package/package.json +2 -1
@@ -92,18 +92,108 @@
|
|
92
92
|
--table-row-hover-bg-color: #f5f7fa;
|
93
93
|
--table-row-active-bg-color: #f0f1f5;
|
94
94
|
}
|
95
|
+
.bk-table-head-action {
|
96
|
+
display: flex;
|
97
|
+
width: 32px;
|
98
|
+
height: var(--row-height);
|
99
|
+
margin-left: 4px;
|
100
|
+
font-size: 12px;
|
101
|
+
color: #c4c6cc;
|
102
|
+
cursor: pointer;
|
103
|
+
align-items: center;
|
104
|
+
}
|
105
|
+
.bk-table-head-action.active {
|
106
|
+
color: #3a84ff;
|
107
|
+
}
|
108
|
+
.bk-table-head-action.opened {
|
109
|
+
color: inherit;
|
110
|
+
}
|
111
|
+
.bk-table-head-filter {
|
112
|
+
padding: 5px 0 0 0;
|
113
|
+
background-color: #fff;
|
114
|
+
border-radius: 2px;
|
115
|
+
box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.1);
|
116
|
+
}
|
117
|
+
.bk-table-head-filter .content-list {
|
118
|
+
max-width: 200px;
|
119
|
+
min-width: 140px;
|
120
|
+
overflow: auto;
|
121
|
+
}
|
122
|
+
.bk-table-head-filter .content-list .list-item {
|
123
|
+
width: 100%;
|
124
|
+
height: 32px;
|
125
|
+
padding: 0 10px;
|
126
|
+
font-size: 12px;
|
127
|
+
line-height: 32px;
|
128
|
+
color: #63656e;
|
129
|
+
text-align: left;
|
130
|
+
}
|
131
|
+
.bk-table-head-filter .content-list .list-item:hover {
|
132
|
+
background: #f0f1f5;
|
133
|
+
}
|
134
|
+
.bk-table-head-filter .content-footer {
|
135
|
+
display: flex;
|
136
|
+
height: 42px;
|
137
|
+
padding: 0 10px;
|
138
|
+
border-top: solid 1px #dcdee5;
|
139
|
+
justify-content: center;
|
140
|
+
align-items: center;
|
141
|
+
}
|
142
|
+
.bk-table-head-filter .content-footer span {
|
143
|
+
display: inline-flex;
|
144
|
+
height: 100%;
|
145
|
+
padding: 6px 12px;
|
146
|
+
font-size: 14px;
|
147
|
+
line-height: 22px;
|
148
|
+
color: #3a84ff;
|
149
|
+
cursor: pointer;
|
150
|
+
align-items: center;
|
151
|
+
}
|
152
|
+
.bk-table-head-filter .content-footer span.btn-filter-split {
|
153
|
+
width: 1px;
|
154
|
+
height: calc(100% - 12px);
|
155
|
+
padding: 6px 0;
|
156
|
+
cursor: default;
|
157
|
+
background: #f0f1f5;
|
158
|
+
}
|
159
|
+
.bk-table-head-filter .content-footer span.btn-filter-reset.disable {
|
160
|
+
color: #979ba5;
|
161
|
+
cursor: not-allowed;
|
162
|
+
}
|
163
|
+
.bk-head-cell-sort {
|
164
|
+
display: flex;
|
165
|
+
flex-direction: column;
|
166
|
+
margin-left: 4px;
|
167
|
+
font-size: 10px;
|
168
|
+
}
|
169
|
+
.bk-head-cell-sort .sort-action {
|
170
|
+
display: flex;
|
171
|
+
width: 18px;
|
172
|
+
height: calc(var(--row-height)/2);
|
173
|
+
color: #c0c4cc;
|
174
|
+
cursor: pointer;
|
175
|
+
}
|
176
|
+
.bk-head-cell-sort .sort-action.active {
|
177
|
+
color: #3a84ff;
|
178
|
+
}
|
179
|
+
.bk-head-cell-sort .sort-action.sort-asc {
|
180
|
+
align-items: flex-end;
|
181
|
+
}
|
182
|
+
.bk-head-cell-sort .sort-action.sort-desc {
|
183
|
+
align-items: flex-start;
|
184
|
+
}
|
95
185
|
.bk-table {
|
96
186
|
height: 100%;
|
97
187
|
overflow: hidden;
|
98
|
-
border-top: 1px solid
|
99
|
-
border-bottom: 1px solid
|
188
|
+
border-top: 1px solid #dcdee5;
|
189
|
+
border-bottom: 1px solid #dcdee5;
|
100
190
|
}
|
101
191
|
.bk-table .bk-table-body {
|
102
192
|
overflow: auto;
|
103
193
|
}
|
104
194
|
.bk-table .bk-table-head,
|
105
195
|
.bk-table .bk-table-body {
|
106
|
-
background:
|
196
|
+
background: white;
|
107
197
|
}
|
108
198
|
.bk-table .bk-table-head table,
|
109
199
|
.bk-table .bk-table-body table {
|
@@ -126,21 +216,21 @@
|
|
126
216
|
padding: 0 15px;
|
127
217
|
overflow: hidden;
|
128
218
|
line-height: var(--row-height);
|
129
|
-
color:
|
219
|
+
color: #575961;
|
130
220
|
text-align: left;
|
131
221
|
text-overflow: ellipsis;
|
132
222
|
white-space: nowrap;
|
133
223
|
}
|
134
224
|
.bk-table .bk-table-head table thead th,
|
135
225
|
.bk-table .bk-table-body table thead th {
|
136
|
-
color:
|
137
|
-
background-color:
|
226
|
+
color: #313238;
|
227
|
+
background-color: #fafbfd;
|
138
228
|
}
|
139
229
|
.bk-table .bk-table-head table thead th.active,
|
140
230
|
.bk-table .bk-table-body table thead th.active,
|
141
231
|
.bk-table .bk-table-head table thead th:hover,
|
142
232
|
.bk-table .bk-table-body table thead th:hover {
|
143
|
-
background:
|
233
|
+
background: #f0f1f5;
|
144
234
|
}
|
145
235
|
.bk-table .bk-table-head table tbody tr td .cell,
|
146
236
|
.bk-table .bk-table-body table tbody tr td .cell {
|
@@ -149,22 +239,22 @@
|
|
149
239
|
}
|
150
240
|
.bk-table .bk-table-head table tbody tr:hover td,
|
151
241
|
.bk-table .bk-table-body table tbody tr:hover td {
|
152
|
-
background:
|
242
|
+
background: #f5f7fa;
|
153
243
|
}
|
154
244
|
.bk-table .bk-table-footer {
|
155
245
|
line-height: 40px;
|
156
246
|
}
|
157
247
|
.bk-table.bordered-row td,
|
158
248
|
.bk-table.bordered-row th {
|
159
|
-
border-bottom: 1px solid
|
249
|
+
border-bottom: 1px solid #dcdee5;
|
160
250
|
}
|
161
251
|
.bk-table.bordered-outer {
|
162
|
-
border-right: 1px solid
|
163
|
-
border-left: 1px solid
|
252
|
+
border-right: 1px solid #dcdee5;
|
253
|
+
border-left: 1px solid #dcdee5;
|
164
254
|
}
|
165
255
|
.bk-table.bordered-col th,
|
166
256
|
.bk-table.bordered-col td {
|
167
|
-
border-right: 1px solid
|
257
|
+
border-right: 1px solid #dcdee5;
|
168
258
|
}
|
169
259
|
.bk-table.bordered-col th:last-child,
|
170
260
|
.bk-table.bordered-col td:last-child {
|
@@ -181,9 +271,9 @@
|
|
181
271
|
width: 100%;
|
182
272
|
}
|
183
273
|
.bk-table colgroup col {
|
184
|
-
background:
|
274
|
+
background: white;
|
185
275
|
}
|
186
276
|
.bk-table colgroup col.active {
|
187
277
|
position: relative;
|
188
|
-
background:
|
278
|
+
background: #f0f1f5;
|
189
279
|
}
|
package/lib/tag/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../icon"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon"],t);else{var o="object"==typeof exports?t(require("../shared"),require("vue"),require("../icon")):t(e["../shared"],e.vue,e["../icon"]);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(self,((e,t,o)=>(()=>{"use strict";var r={6870:e=>{e.exports=o},4212:t=>{t.exports=e},748:e=>{e.exports=t}},s={};function n(e){var t=s[e];if(void 0!==t)return t.exports;var o=s[e]={exports:{}};return r[e](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{n.r(a),n.d(a,{default:()=>c});var e=n(4212);function t(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var o=n(748),r=n(6870);const s=(0,o.defineComponent)({name:"Tag",props:{theme:e.PropTypes.theme(["success","info","warning","danger"]).def(""),closable:e.PropTypes.bool.def(!1),type:e.PropTypes.commonType(["","filled","stroke"]).def(""),checkable:e.PropTypes.bool.def(!1),checked:e.PropTypes.bool.def(!1),radius:e.PropTypes.string.def("2px"),extCls:e.PropTypes.string.def("")},emits:["change","close"],slots:["icon"],setup:function(r,s){var n=s.emit;return{wrapperCls:(0,o.computed)((function(){var o;return(0,e.classes)((t(o={"bk-tag-closable":r.closable,"bk-tag-checkable":r.checkable,"bk-tag-check":r.checked},"bk-tag-".concat(r.type),r.type),t(o,"bk-tag-".concat(r.theme),r.theme),t(o,r.extCls,!!r.extCls),o),"bk-tag")})),wrapperStyle:(0,o.computed)((function(){return{borderRadius:r.radius}})),handleClose:function(e){e.preventDefault(),e.stopPropagation(),n("close",e)},handleClick:function(e){e.preventDefault(),e.stopPropagation(),r.checkable&&n("change",!r.checked)}}},render:function(){var e,t;return(0,o.createVNode)("div",{class:this.wrapperCls,style:this.wrapperStyle,onClick:this.handleClick},[this.$slots.icon?(0,o.createVNode)("span",{class:"bk-tag-icon"},[this.$slots.icon()]):"",(0,o.createVNode)("span",{class:"bk-tag-text"},[null===(t=(e=this.$slots).default)||void 0===t?void 0:t.call(e)]),this.closable?(0,o.createVNode)(r.Error,{class:"bk-tag-close",onClick:this.handleClose},null):""])}}),c=(0,e.withInstall)(s)})(),a})()));
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("vue"),require("../directives"),require("../icon"),require("../loading"),require("../popover"),require("../shared"));else if("function"==typeof define&&define.amd)define(["vue","../directives","../icon","../loading","../popover","../shared"],t);else{var r="object"==typeof exports?t(require("vue"),require("../directives"),require("../icon"),require("../loading"),require("../popover"),require("../shared")):t(e.vue,e["../directives"],e["../icon"],e["../loading"],e["../popover"],e["../shared"]);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(self,((e,t,r,a,n,o)=>(()=>{"use strict";var i={4061:e=>{e.exports=t},6870:e=>{e.exports=r},4870:e=>{e.exports=a},5537:e=>{e.exports=n},4212:e=>{e.exports=o},748:t=>{t.exports=e}},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={exports:{}};return i[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function r(e,r){if(e){if("string"==typeof e)return t(e,r);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?t(e,r):void 0}}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}s.r(u),s.d(u,{default:()=>b});var o=s(748),i=s(4061),l=s(6870),c=s(4870),d=s.n(c),p=s(5537),f=s.n(p),g=12,v=function(e){for(var t=e.length,r=0,a=0;a<t;a++)0!=(65280&e.charCodeAt(a))&&(r+=1),r+=1;return r},h=s(4212);const y=(0,o.defineComponent)({name:"ListTagRender",props:{node:h.PropTypes.object,searchKey:h.PropTypes.oneOfType([h.PropTypes.string,h.PropTypes.arrayOf(h.PropTypes.string)]),displayKey:h.PropTypes.string,searchKeyword:h.PropTypes.string,tpl:{type:Function,default:null}},render:function(){var e=this,t=function(t){if(e.searchKeyword){var r=new RegExp("(".concat(e.searchKeyword,")"),"i");return t.replace(r,'<strong class="highlight-text">$1</strong>')}return t};if(this.tpl)return this.tpl(this.node,t,o.h,this);var r=this.node[this.displayKey];return(0,o.createVNode)("div",{class:"bk-selector-node"},[(0,o.createVNode)("span",{class:"text",innerHTML:t(r)},[r])])}}),m=(0,o.defineComponent)({name:"TagRender",props:{node:h.PropTypes.object,displayKey:h.PropTypes.string,tpl:{type:Function,default:null}},render:function(){return this.tpl?this.tpl(this.node,o.h,this):(0,o.createVNode)("div",{class:"tag"},[(0,o.createVNode)("span",{class:"text"},[this.node[this.displayKey]])])}}),T=(0,o.defineComponent)({name:"BkTagInput",directives:{bkTooltips:i.bkTooltips},props:{modelValue:h.PropTypes.arrayOf(h.PropTypes.string).def([]),placeholder:h.PropTypes.string.def("请输入并按 Enter 结束"),list:h.PropTypes.arrayOf(h.PropTypes.object).def([]),disabled:h.PropTypes.bool.def(!1),tooltipKey:h.PropTypes.string.def(""),saveKey:h.PropTypes.string.def("id"),displayKey:h.PropTypes.string.def("name"),hasDeleteIcon:h.PropTypes.bool.def(!1),clearable:h.PropTypes.bool.def(!0),trigger:h.PropTypes.commonType(["focus","search"]).def("search"),searchKey:h.PropTypes.oneOfType([h.PropTypes.string,h.PropTypes.arrayOf(h.PropTypes.string)]).def("name"),useGroup:h.PropTypes.bool.def(!1),allowCreate:h.PropTypes.bool.def(!1),maxData:h.PropTypes.number.def(-1),maxResult:h.PropTypes.number.def(10),contentMaxHeight:h.PropTypes.number.def(300),contentWidth:h.PropTypes.number.def(190),separator:h.PropTypes.string.def(""),allowNextFocus:h.PropTypes.bool.def(!0),allowAutoMatch:h.PropTypes.bool.def(!1),showClearOnlyHover:h.PropTypes.bool.def(!1),leftSpace:h.PropTypes.number.def(0),createTagValidator:{type:Function,default:null},filterCallback:{type:Function,default:null},tagTpl:{type:Function,default:null},tpl:{type:Function,default:null},pasteFn:{type:Function,default:null}},emits:["update:modelValue","change","select","blur","remove","removeAll"],setup:function(t,i){var l=i.emit,s=(0,o.reactive)({isEdit:!1,isHover:!1,focusItemIndex:t.allowCreate?-1:0}),u=(0,o.reactive)({isShow:!1,width:190,modifiers:[{name:"offset",options:{offset:[0,4]}}]}),c=function(e){var t=(0,o.reactive)({curPage:1,totalSize:0,totalPage:0,pageSize:e,isPageLoading:!1,curPageList:[],renderListPaged:[]});return{pageState:t,initPage:function(){var e,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.curPage=1,t.totalSize=a.length,t.totalPage=Math.ceil(t.totalSize/t.pageSize)||1;var o=[];if(t.pageSize>0)for(var i=0;i<t.totalSize;i+=t.pageSize)o.push(a.slice(i,i+t.pageSize));(e=t.renderListPaged).splice.apply(e,[0,t.renderListPaged.length].concat(o)),(r=t.curPageList).splice.apply(r,[0,t.curPageList.length].concat(n(t.renderListPaged[t.curPage-1]||[])))},pageChange:function(e){var r;t.curPage=e,(r=t.curPageList).splice.apply(r,[t.curPageList.length,0].concat(n(t.renderListPaged[t.curPage-1]||[]))),t.isPageLoading=!1}}}((0,o.toRefs)(t).maxResult),d=c.pageState,p=c.initPage,f=c.pageChange,h=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,a=e;return(0,o.customRef)((function(e,n){return{get:function(){return e(),a},set:function(e){clearTimeout(t),t=setTimeout((function(){a=e,n()}),r)}}}))}("",150),y=(0,o.ref)(null),m=(0,o.ref)(null),T=(0,o.ref)(null),b=(0,o.ref)(null),L=(0,o.ref)(null),w=(0,o.ref)(null),P=(0,o.ref)(null),x=(0,o.computed)((function(){return!t.disabled&&t.hasDeleteIcon})),I=(0,o.computed)((function(){return 1===t.maxData})),S=(0,o.computed)((function(){return 0===R.selectedTagList.length&&""===h.value&&!s.isEdit})),C=(0,o.computed)((function(){return t.clearable&&!t.disabled&&0!==R.selectedTagList.length&&(!t.showClearOnlyHover||s.isHover)})),K=(0,o.computed)((function(){return{"bk-tag-input-trigger":!0,active:s.isEdit,disabled:t.disabled}}));(0,o.watch)([function(){return n(t.modelValue)},function(){return n(t.list)}],(function(){D()})),(0,o.watch)(h,(function(e){var r=0!==d.curPageList.length;""!==e&&r||""===e&&"focus"===t.trigger?u.isShow=!0:"focus"===t.trigger&&r||(u.isShow=!1)})),(0,o.watch)((function(){return u.isShow}),(function(e){k(),e&&L.value&&((0,o.nextTick)((function(){L.value.scrollTop=0})),L.value.removeEventListener("scroll",V),L.value.addEventListener("scroll",V))}));var k=function(){var e,t,r=I.value?0:null===(e=b.value)||void 0===e?void 0:e.offsetLeft;u.modifiers=[{name:"offset",options:{offset:[r,4]}}],null===(t=w.value)||void 0===t||t.update()},V=function(){if(!d.isPageLoading&&0!==L.value.scrollTop){var e=L.value;if(e.scrollTop+e.offsetHeight>=e.scrollHeight){var t=d.curPage+1;t<=d.totalPage&&(d.isPageLoading=!0,setTimeout((function(){f(t)}),500))}}},N=function(){var e;return Array.from((null===(e=T.value)||void 0===e?void 0:e.childNodes)||[]).filter((function(e){return e.nodeType!==Node.TEXT_NODE}))},A=function(e){if(!t.disabled){if(null==e?void 0:e.target){var r=e.target.className;(r.indexOf("bk-tag-input-trigger")>-1||r.indexOf("tag-list")>-1)&&T.value.appendChild(b.value)}clearTimeout(P.value),I.value&&O.value.length&&(R.tagListCache=n(O.value),R.selectedTagListCache=n(R.selectedTagList),h.value=R.selectedTagListCache[0][t.saveKey],W(R.selectedTagList[0],0),q()),s.isEdit=!0,(0,o.nextTick)((function(){var e;null===(e=y.value)||void 0===e||e.focus(),"focus"===t.trigger&&0!==R.localList.length&&(F(),u.isShow?k():u.isShow=!0)}))}},R=(0,o.reactive)({localList:[],tagListCache:[],selectedTagList:[],selectedTagListCache:[]}),O=(0,o.computed)((function(){return R.selectedTagList.map((function(e){return e[t.saveKey]}))})),j=function(e){var t=(0,o.toRefs)(e),r=t.useGroup,a=t.saveKey,i=t.displayKey,l=t.list,s=(0,o.reactive)([]);return(0,o.watch)([r,a,i,l],(function(){var e=l.value;r.value&&(e=l.value.reduce((function(e,t){var r=[];return t.children&&(r=t.children.map((function(e){return Object.assign({group:{groupId:t[a.value],groupName:t[i.value]}},e)}))),e.concat(r)}),[])),s.splice.apply(s,[0,s.length].concat(n(e)))}),{immediate:!0,deep:!0}),s}(t),E=(0,o.computed)((function(){if(t.useGroup){var e={};return d.curPageList.forEach((function(t,r){t.__index__=r,e[t.group.groupId]||(e[t.group.groupId]={id:t.group.groupId,name:t.group.groupName,children:[]}),e[t.group.groupId].children.push(t)})),Object.keys(e).map((function(t){return e[t]}))}return d.curPageList})),D=function(){var e=t.saveKey,r=t.modelValue,o=t.displayKey,i=t.allowCreate,l=t.trigger;R.selectedTagList=[],R.localList=n(j),r.length&&(r.forEach((function(t){var r=R.localList.find((function(r){return t===r[e]}));if(void 0!==r)R.selectedTagList.push(r);else if(i&&!O.value.includes(t)){var n;R.selectedTagList.push((a(n={},e,t),a(n,o,t),n))}})),I.value||(R.localList=R.localList.filter((function(t){return!r.includes(t[e])})))),"focus"===l&&F()},F=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=t.searchKey,a=t.filterCallback,n=e.toLowerCase(),o=[];if("function"==typeof a)o=a(n,r,R.localList)||[];else if(Array.isArray(r)){var i=r.map((function(e){return R.localList.filter((function(t){return-1!==t[e].toLowerCase().indexOf(n)}))}));o=Array.from(new Set(i.flat()))}else o=R.localList.filter((function(e){return-1!==e[r].toLowerCase().indexOf(n)}));p(o)};(0,o.onMounted)((function(){D()}));var z=function(){h.value=""},_=function(){if(I.value)return 0;var e=N().findIndex((function(e){return"tagInputItem"===e.id}));return e>=0?e:0},M=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t&&e){var a=t;r&&(a=t.nextElementSibling||null),t.parentNode.insertBefore(e,a)}},q=function(e){var r=t.maxData,a=t.trigger,n=t.allowCreate;if(-1===r||r>O.value.length){var o=((null==e?void 0:e.target)?e.target:h).value,i=v(o);i?(F(o),y.value.style.width="".concat(i*g,"px")):"focus"===a&&F()}else H(),h.value="",u.isShow=!1;s.isEdit=!0,s.focusItemIndex=n?-1:0},H=function(){P.value=setTimeout((function(){var e,a,n=h.value;if(z(),s.isEdit=!1,I.value){var o=(e=R.tagListCache,a=1,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(o.push(a.value),!t||o.length!==t);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(e,a)||r(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];n&&n===o&&R.selectedTagListCache.length?U(R.selectedTagListCache[0],"select"):G("remove")}else if(t.allowAutoMatch&&n){var i=d.curPageList.find((function(e){return Array.isArray(t.searchKey)?t.searchKey.map((function(t){return e[t]})).includes(n):e[t.searchKey]===n}));i?B(i,"select"):t.allowCreate&&B(n,"custom")}u.isShow=!1,l("blur",n,O.value)}),50)},B=function(e,t,r){null==r||r.stopPropagation(),e&&!e.disabled&&(I.value&&(R.tagListCache=[],R.selectedTagListCache=[],R.selectedTagList=[]),U(e,t),G("select"),z(),u.isShow=!1)},G=function(e){l("change",O.value),l(e),l("update:modelValue",O.value)},Z=function(){var e=L.value.clientHeight,t=L.value.getBoundingClientRect().y;(0,o.nextTick)((function(){var r=L.value.querySelector(".bk-selector-actived");if(r){var a=r.clientHeight,n=r.getBoundingClientRect().y;n<t&&(L.value.scrollTop=L.value.scrollTop-(t-n));var o=n+a-t;o>e&&(L.value.scrollTop=L.value.scrollTop+o-e)}}))},U=function(r,i){if(!(R.selectedTagList.length>=t.maxData&&-1!==t.maxData)){var l,s=t.separator,u=t.saveKey,c=t.displayKey,d=t.createTagValidator,p=_(),f=1,v=!1,h=function(e){return"function"!=typeof d||d(e)},m=function(e){return R.localList.find((function(t){return t[u]===e}))};if("custom"===i)if(s){var T,L=r.split(s),w=(L=L.filter((function(e){return(null==e?void 0:e.trim())&&!O.value.includes(e)&&h(e)}))).map((function(e){var t;return m(e)||(a(t={},u,e),a(t,c,e),t)}));L.length&&((T=R.selectedTagList).splice.apply(T,[p,0].concat(n(w))),f=w.length,v=!0)}else{var P="object"===e(r);if(void 0!==(l=(l=P?r[u]:r.trim()).replace(/\s+/g,""))&&!O.value.includes(l)&&h(l)){var x,S=m(l)||(P?r:(a(x={},u,l),a(x,c,l),x));R.selectedTagList.splice(p,0,S),v=!0}}else r&&(void 0===(l=r[u])||O.value.includes(l)||(R.selectedTagList.splice(p,0,r),v=!0));v&&(0,o.nextTick)((function(){for(var e=1;e<=f;e++){var r=N()[p+e];M(r,b.value)}y.value.style.width="".concat(g,"px"),I.value||(t.allowNextFocus&&A(),R.localList=R.localList.filter((function(e){return!O.value.includes(e[u])})))}))}},W=function(e,r){R.selectedTagList.splice(r,1);var a=j.some((function(r){return r===e[t.saveKey]}));(t.allowCreate&&a||!t.allowCreate)&&!I.value&&R.localList.push(e)};return Object.assign(Object.assign(Object.assign(Object.assign({popoverProps:u},(0,o.toRefs)(s)),(0,o.toRefs)(R)),(0,o.toRefs)(d)),{isShowPlaceholder:S,isShowClear:C,curInputValue:h,formatList:j,renderList:E,showTagClose:x,tagInputRef:y,bkTagSelectorRef:m,tagListRef:T,tagInputItemRef:b,selectorListRef:L,popoverRef:w,triggerClass:K,focusInputTrigger:A,activeClass:function(e,r){var a={"bk-selector-actived":!1,"bk-selector-selected":O.value.includes(e[t.saveKey])};return t.useGroup?a["bk-selector-actived"]=e.__index__===s.focusItemIndex:a["bk-selector-actived"]=r===s.focusItemIndex,a},handleInput:q,handleFocus:function(){var e;u.width=I.value?null===(e=m.value)||void 0===e?void 0:e.clientWidth:t.contentWidth},handleBlur:H,handleTagSelected:B,handleTagRemove:function(e,t,r){null==r||r.stopPropagation(),W(e,t),z(),G("remove"),y.value.style.width="".concat(g,"px")},handleClear:function(e){e.stopPropagation();var r=R.selectedTagList;R.selectedTagList=[];var a,o=j.filter((function(e){return r.some((function(r){return r[t.saveKey]===e[t.saveKey]}))}));(!t.allowCreate||0===o.length)&&t.allowCreate||I.value||(a=R.localList).push.apply(a,n(o)),G("removeAll")},tagFocus:function(e){t.disabled||(M(b.value,e.currentTarget,!0),y.value.style.width="".concat(g,"px"),u.isShow&&k())},handleKeydown:function(e){if(!d.isPageLoading){var r=e.target.value,a=v(r),n=_(),o=N();switch(e.code){case"ArrowUp":if(e.preventDefault(),!u.isShow)return;s.focusItemIndex=s.focusItemIndex-1,s.focusItemIndex=s.focusItemIndex<0?-1:s.focusItemIndex,-1===s.focusItemIndex&&(s.focusItemIndex=d.curPageList.length-1),Z();break;case"ArrowDown":if(e.preventDefault(),!u.isShow)return;s.focusItemIndex=s.focusItemIndex+1,s.focusItemIndex=s.focusItemIndex>d.curPageList.length-1?d.curPageList.length:s.focusItemIndex,s.focusItemIndex===d.curPageList.length&&(s.focusItemIndex=0),Z();break;case"ArrowLeft":if(s.isEdit=!0,!a){if(n<1)return;M(b.value,o[n-1]),A()}break;case"ArrowRight":if(s.isEdit=!0,!a){if(n===o.length-1)return;M(o[n+1],b.value),A()}break;case"Enter":case"NumpadEnter":!t.allowCreate&&u.isShow||t.allowCreate&&s.focusItemIndex>=0&&u.isShow?B(d.curPageList[s.focusItemIndex],"select",e):t.allowCreate&&B(h.value,"custom",e),e.preventDefault();break;case"Backspace":0===n||h.value||function(e,r){var a=N();M(b.value,a[e-1]),R.selectedTagList.splice(e-1,1),A();var n=j.some((function(e){return e===r[t.saveKey]}));(t.allowCreate&&n||!t.allowCreate)&&!I.value&&R.localList.push(r),y.value="".concat(g,"px"),G("remove")}(n,R.selectedTagList[n-1])}}},handlePaste:function(e){if(e.preventDefault(),I.value)return!1;var r=t.maxData,o=t.saveKey,i=t.pasteFn,l=e.clipboardData.getData("text"),s=i?i(l):function(e){var r=[];return e.split(";").forEach((function(e){if(e.match(/^[a-zA-Z][a-zA-Z_]+/g)){var n,o=e.match(/^[a-zA-Z][a-zA-Z_]+/g).join("");r.push((a(n={},t.saveKey,o),a(n,t.displayKey,o),n))}})),r}(l),u=s.map((function(e){return e[o]}));if(u.length){var c=N(),d=_(),p=R.localList.map((function(e){return e[o]}));if(u=u.filter((function(e){return(null==e?void 0:e.trim())&&!O.value.includes(e)&&p.includes(e)})),-1!==r){var f=R.selectedTagList.length;if(f<r){var v=r-f;u.length>v&&(u=n(u.slice(0,v)))}else u=[]}var h,m=R.localList.filter((function(e){return u.includes(e[o])}));u.length&&((h=R.selectedTagList).splice.apply(h,[d,0].concat(n(m))),M(b.value,c[d]),y.value.style.width="".concat(g,"px"),R.localList=R.localList.filter((function(e){return!u.includes(e[o])})),G("select"),A())}}})},render:function(){var e=this;return(0,o.createVNode)("div",{class:"bk-tag-input",ref:"bkTagSelectorRef",onClick:this.focusInputTrigger,onMouseenter:function(){return e.isHover=!0},onMouseleave:function(){return e.isHover=!1}},[(0,o.createVNode)(f(),{ref:"popoverRef",theme:"light",trigger:"manual",placement:"bottom-start",arrow:!1,width:this.popoverProps.width,isShow:this.popoverProps.isShow,modifiers:this.popoverProps.modifiers},{default:function(){return(0,o.createVNode)("div",{class:e.triggerClass},[(0,o.createVNode)("ul",{class:"tag-list",ref:"tagListRef",style:{marginLeft:"".concat(e.leftSpace,"px")}},[e.selectedTagList.map((function(t,r){var a={boundary:"window",theme:"light",distance:12,content:t[e.tooltipKey],disabled:!e.tooltipKey};return(0,o.withDirectives)((0,o.createVNode)("li",{class:"tag-item",onClick:e.tagFocus},[(0,o.createVNode)(m,{node:t,tpl:e.tagTpl,displayKey:e.displayKey},null),e.showTagClose?(0,o.createVNode)(l.Error,{class:"remove-tag",onClick:e.handleTagRemove.bind(e,t,r)},null):null]),[[(0,o.resolveDirective)("bk-tooltips"),a]])})),(0,o.withDirectives)((0,o.createVNode)("li",{ref:"tagInputItemRef",id:"tagInputItem",class:"tag-input-item",role:"input"},[(0,o.withDirectives)((0,o.createVNode)("input",{type:"text",class:"tag-input",ref:"tagInputRef","onUpdate:modelValue":function(t){return e.curInputValue=t},onInput:e.handleInput,onFocus:e.handleFocus,onBlur:e.handleBlur,onKeydown:e.handleKeydown,onPaste:e.handlePaste},null),[[o.vModelText,e.curInputValue]])]),[[o.vShow,e.isEdit]])]),(0,o.withDirectives)((0,o.createVNode)("p",{class:"placeholder"},[e.placeholder]),[[o.vShow,e.isShowPlaceholder]]),e.isShowClear?(0,o.createVNode)(l.Close,{class:"clear-icon",onClick:e.handleClear},null):null])},content:function(){return(0,o.createVNode)("div",{class:"bk-selector-list"},[(0,o.createVNode)("ul",{ref:"selectorListRef",style:{"max-height":"".concat(e.contentMaxHeight,"px")},class:"outside-ul"},[e.useGroup?e.renderList.map((function(t){return(0,o.createVNode)("li",{class:"bk-selector-group-item"},[(0,o.createVNode)("span",{class:"group-name"},[t.name,(0,o.createTextVNode)(" ("),t.children.length,(0,o.createTextVNode)(")")]),(0,o.createVNode)("ul",{class:"bk-selector-group-list-item"},[t.children.map((function(t,r){return(0,o.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,o.createVNode)(y,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])}))])])})):e.renderList.map((function(t,r){return(0,o.createVNode)("li",{class:["bk-selector-list-item",{disabled:t.disabled},e.activeClass(t,r)],onClick:e.handleTagSelected.bind(e,t,"select")},[(0,o.createVNode)(y,{node:t,displayKey:e.displayKey,tpl:e.tpl,searchKey:e.searchKey,searchKeyword:e.curInputValue},null)])})),e.isPageLoading?(0,o.createVNode)("li",{class:"bk-selector-list-item loading"},[(0,o.createVNode)(d(),{theme:"primary",size:c.BkLoadingSize.Small},null)]):null])])}})])}});T.install=function(e){e.component(T.name,T)};const b=T})(),u})()));
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"));else if("function"==typeof define&&define.amd)define(["../shared","vue"],t);else{var o="object"==typeof exports?t(require("../shared"),require("vue")):t(e["../shared"],e.vue);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(self,((e,t)=>(()=>{"use strict";var o={4212:t=>{t.exports=e},748:e=>{e.exports=t}},n={};function c(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,c),r.exports}c.d=(e,t)=>{for(var o in t)c.o(t,o)&&!c.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{c.r(r),c.d(r,{default:()=>l});var e=c(4212),t=c(748),o={list:e.PropTypes.array.def([]),titleAble:e.PropTypes.bool.def(!1),extCls:e.PropTypes.string};const n=(0,t.defineComponent)({name:"Timeline",props:o,emits:["select"],setup:function(e,o){var n=o.emit,c=(0,t.ref)([]);return(0,t.onMounted)((function(){var t,o,n,r,l;(t=c.value).splice.apply(t,[0,c.value.length].concat([{tag:"步骤1",content:"内容1"},{tag:"步骤2",content:"内容2"},{tag:"步骤3",content:"内容3"}])),(null===(o=e.list)||void 0===o?void 0:o.length)&&(n=e.list,l=[],n.forEach((function(e){l.push({tag:e.tag,content:e.content,type:e.type,size:e.size,color:e.color,icon:e.icon,filled:e.filled})})),(r=c.value).splice.apply(r,[0,c.value.length].concat(l)))})),{defaultTimelines:c,titleSelect:function(e){try{n("select",e)}catch(e){console.warn(e)}}}},render:function(){var o=this,n=function(e){var t=e.icon;return!!t&&"[object Object]"===Object.prototype.toString.call(t)},c=function(t){var o="bk-timeline",n=t.type?"".concat(o,"-").concat(t.type):"".concat(o,"-default"),c=t.size?"".concat(o,"-").concat(t.size):"",r=t.filled?"".concat(o,"-filled"):"",l=t.color&&["blue","red","green","yellow","gray"].includes(t.color)?"".concat(o,"-").concat(t.color):"";return(0,e.classes)({},"".concat(o," ").concat(n," ").concat(c," ").concat(l," ").concat(r))};return(0,t.createVNode)("ul",{class:["bk-timeline",this.extCls]},[this.defaultTimelines.map((function(e){var r,l,i;return(0,t.createVNode)("li",{class:["bk-timeline-dot",c(e)]},[n(e)?(0,t.createVNode)("div",{class:"bk-timeline-icon"},[(0,t.createVNode)("span",{class:"bk-timeline-icon-inner"},[e.icon])]):"",(0,t.createVNode)("div",{class:"bk-timeline-section"},[(0,t.createVNode)("div",{class:"bk-timeline-title",onClick:function(){o.titleSelect(e)}},[null!==(i=null===(l=(r=o.$slots).default)||void 0===l?void 0:l.call(r))&&void 0!==i?i:(0,t.createVNode)("span",{innerHTML:e.tag},null)]),e.content?(0,t.createVNode)("div",{class:"bk-timeline-content",innerHTML:e.content},null):""])])}))])}}),l=(0,e.withInstall)(n)})(),r})()));
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("../icon/"),require("../input"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon/","../input"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("../icon/"),require("../input")):t(e["../shared"],e.vue,e["../icon/"],e["../input"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n)=>(()=>{"use strict";var a={7685:e=>{e.exports=r},8133:e=>{e.exports=n},4212:t=>{t.exports=e},748:e=>{e.exports=t}},o={};function l(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{l.r(u),l.d(u,{default:()=>v});var e=l(4212);function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],l=!0,u=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{l||null==r.return||r.return()}finally{if(u)throw a}}return o}}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var o=l(748),i=l(7685),s=l(8133),c=l.n(s);e.PropTypes.string,e.PropTypes.string,e.PropTypes.string,e.PropTypes.string,e.PropTypes.bool,e.PropTypes.bool,e.PropTypes.string,e.PropTypes.bool;const f=(0,o.defineComponent)({name:"Transfer",props:{title:{type:Array,default:function(){return[]}},extCls:{type:String,default:""},searchPlaceholder:{type:String,default:""},settingKey:{type:String,default:"id"},displayKey:{type:String,default:"value"},sortKey:{type:String,default:""},showOverflowTips:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},sortable:{type:Boolean,default:!1},sourceList:{type:Array,default:function(){return[]}},targetList:{type:Array,default:function(){return[]}},emptyContent:{type:Array,default:function(){return[]}}},emits:["change"],slots:["left-header","right-header","source-option","target-option","left-empty-content","right-empty-content"],setup:function(t,r){var l=r.emit,u=[],i=t.sortKey,s=t.sortable,c=(0,o.ref)(""),f=(0,o.ref)(null),v=(0,o.ref)([]),d=(0,o.ref)([]),p=(0,o.ref)(-1),h=(0,o.ref)(-1),y=(0,o.computed)((function(){return t.sourceList&&Array.isArray(t.sourceList)?-1!==t.sourceList.toString().indexOf("[object Object]"):"empty"})),g=(0,o.computed)((function(){return y.value?t.settingKey:"index"})),m=(0,o.computed)((function(){return y.value?t.displayKey:"value"})),b=(0,o.computed)((function(){return c.value?v.value.filter((function(t){return!(0,e.isEmpty)(t[m.value])&&String(t[m.value]).indexOf(c.value)>-1})):v.value}));(0,o.watch)((function(){return t.sourceList}),(function(){"empty"!==y.value&&(L(),w())}),{deep:!0}),(0,o.watch)((function(){return t.targetList}),(function(){L(),w()}),{deep:!0}),(0,o.watch)((function(){return[m.value,g.value]}),(function(){L()})),(0,o.watch)((function(){return t.sortKey}),(function(e){i=e,w()})),(0,o.watch)((function(){return t.sortable}),(function(e){s=e,w()}));var L=function(){"empty"!==y.value&&(y.value?S():x())},x=function(){if(!t.targetList.length||t.targetList.length>t.sourceList.length){for(var e,r=[],n=0;n<t.sourceList.length;n++)r.push({index:n,value:t.sourceList[n]});v.value=[].concat(r),(e=d.value).splice.apply(e,[0,d.value.length].concat([])),l("change",v.value,[],[])}else{for(var o=[],u=[],i=0;i<t.sourceList.length;i++)o.push({index:i,value:t.sourceList[i]});t.targetList.forEach((function(e){var t=o.find((function(t){return t.value===e}));t&&u.push(t)})),d.value=[].concat(u);var s=o.filter((function(e){return u.every((function(t){return t.index!==e.index}))}));v.value=a(s),l("change",v.value,a(N(d.value,!1)),[])}},S=function(){if(!t.targetList.length||t.targetList.length>t.sourceList.length){var e;(e=v.value).splice.apply(e,[0,v.value.length].concat(a(t.sourceList))),d.value=[],l("change",v.value,[],[])}else{var r=t.sourceList.filter((function(e){return t.targetList.every((function(t){return t!==e[g.value]}))})),n=[];t.sourceList.forEach((function(e){t.targetList.forEach((function(t){e[g.value]===t&&n.push(e)}))})),d.value=[].concat(n),v.value=a(r);var o=a(N(d.value));l("change",v.value,d.value,o)}},w=function(){var e=[];if(y.value)s||(i=""),e=a(t.sourceList);else{i=s?"index":"";for(var r=0;r<t.sourceList.length;r++)e.push({index:r,value:t.sourceList[r]})}if(i){var n=[];if(e.forEach((function(e){n.push(e[i])})),(u=[].concat(n)).length===t.sourceList.length){var o=a(v.value);v.value=a(T(o,i,u))}}},V=function(){var e=v.value,t=y.value?d.value:a(N(d.value,!1)),r=y.value?a(N(d.value)):[];l("change",e,t,r)},N=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=[];if(!e.length)return[];var o=a(e);return o.forEach((function(e){if(t)for(var a=0,o=Object.entries(e);a<o.length;a++){var l=n(o[a],2),u=l[0],i=l[1];u===g.value&&r.push(i)}else r.push(e.value)})),r},T=function(e,t,r){var n=r;return e.sort((function(e,r){return n.indexOf(e[t])-n.indexOf(r[t])>=0}))},A=function(e){v.value=v.value.filter((function(t){return t[g.value]!==e[g.value]}))};return"empty"!==y.value&&(y.value?S():x(),w()),{keyword:c,transferRef:f,dataList:v,allToRight:function(){p.value=-1;var e=b.value,r=d.value;e.forEach((function(e){r.push(e),A(e)})),u.length===t.sourceList.length?d.value=a(T(r,i,u)):d.value=a(r),V()},allToLeft:function(){h.value=-1;for(var e=d.value,r=v.value;e.length;){var n=e.shift();r.push(n),u.length===t.sourceList.length?v.value=a(T(r,i,u)):v.value=a(r)}V()},displayDataList:b,displayCode:m,leftHoverIndex:p,rightHoverIndex:h,handleItemMouseEvent:function(e,t,r,n){t.preventDefault(),t.stopPropagation();var a="over"===e?n:-1;r?p.value=a:h.value=a},handleItemClick:function(e,r,n){e.preventDefault(),e.stopPropagation(),n?p.value=-1:h.value=-1;var o=n?b.value[r]:d.value.splice(r,1)[0],l=n?d.value:v.value;l.push(o),n&&A(o);var s=u.length===t.sourceList.length?a(T(l,i,u)):a(l);n?d.value=a(s):v.value=a(s),V()},hasSelectedList:d}},render:function(){var e=this,t=this.$props,r=t.extCls,n=t.title,a=t.emptyContent,l=t.searchable,u=t.searchPlaceholder,s=function(t){var r,a,l="left-header"===t,u="".concat(l?null!==(r=n[0])&&void 0!==r?r:"左侧列表":null!==(a=n[1])&&void 0!==a?a:"右侧列表"),i=l?!e.dataList.length:!e.hasSelectedList.length;return e.$slots[t]?(0,o.createVNode)("div",{class:"slot-header"},[(0,o.createVNode)("div",{class:"slot-content"},[e.$slots[t]()])]):(0,o.createVNode)("div",{class:"header"},["".concat(u,"(共").concat(e.dataList.length,"条)"),(0,o.createVNode)("span",{class:{disabled:i},onClick:function(){return l&&e.dataList.length&&e.allToRight(),void(!l&&e.hasSelectedList.length&&e.allToLeft())}},[l?"全部添加":"清空"])])},f=function(t,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=n?e.leftHoverIndex:e.rightHoverIndex;return(0,o.createVNode)("div",{class:"item-content"},[(0,o.createVNode)("span",{class:"content-text",title:t[e.displayCode]},[t[e.displayCode]]),(0,o.createVNode)("span",{class:["icon-wrapper",r===a?"hover":""]},[n?(0,o.createVNode)(i.ArrowsRight,{class:"bk-icon"},null):(0,o.createVNode)(i.Error,{class:"bk-icon"},null)])])},v=function(t){var r="left"===t,n=r?e.displayDataList:e.hasSelectedList,u=r?"source-option":"target-option",i=r?"left-empty-content":"right-empty-content";return n.length?(0,o.createVNode)("ul",{class:["content",l&&r?"is-search":""]},[n.map((function(t,n){var a,l,i;return(0,o.createVNode)("li",{key:n,class:[e.$slots[u]?"custom-item":""],onClick:function(t){return e.handleItemClick(t,n,r)},onMouseover:function(t){return e.handleItemMouseEvent("over",t,r,n)},onMouseleave:function(t){return e.handleItemMouseEvent("leave",t,r,n)}},[null!==(i=null===(l=(a=e.$slots)[u])||void 0===l?void 0:l.call(a,t))&&void 0!==i?i:f(t,n,r)])}))]):function(t){var r,n="left-empty-content"===t,l=null!==(r=n?a[0]:a[1])&&void 0!==r?r:n?"无数据":"未选择任何项";return e.$slots[t]?(0,o.createVNode)("div",null,[e.$slots[t]()]):(0,o.createVNode)("div",{class:"empty"},[l])}(i)};return(0,o.createVNode)("div",{class:["bk-transfer",r],ref:"transferRef"},[(0,o.createVNode)("div",{class:"source-list"},[s("left-header"),l&&(0,o.createVNode)(c(),{modelValue:e.keyword,"onUpdate:modelValue":function(t){return e.keyword=t},class:"transfer-search-input",clearable:!0,placeholder:u||"请输入搜索关键字",type:"search","left-icon":"bk-icon icon-search"},null),v("left")]),(0,o.createVNode)("div",{class:"transfer"},null),(0,o.createVNode)("div",{class:"target-list"},[s("right-header"),v("right")])])}}),v=(0,e.withInstall)(f)})(),u})()));
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n(require("../shared"),require("vue"),require("../icon/"),require("../virtual-render"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon/","../virtual-render"],n);else{var t="object"==typeof exports?n(require("../shared"),require("vue"),require("../icon/"),require("../virtual-render")):n(e["../shared"],e.vue,e["../icon/"],e["../virtual-render"]);for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(self,((e,n,t,r)=>(()=>{var o={8022:(e,n,t)=>{var r=t(4481),o=t(6426),i=o;i.v1=r,i.v4=o,e.exports=i},8725:e=>{for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},9157:e=>{var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}},4481:(e,n,t)=>{var r,o,i=t(9157),a=t(8725),l=0,u=0;e.exports=function(e,n,t){var c=n&&t||0,s=n||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:o;if(null==f||null==d){var p=i();null==f&&(f=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var v=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,h=v-l+(y-u)/1e4;if(h<0&&void 0===e.clockseq&&(d=d+1&16383),(h<0||v>l)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=v,u=y,o=d;var _=(1e4*(268435455&(v+=122192928e5))+y)%4294967296;s[c++]=_>>>24&255,s[c++]=_>>>16&255,s[c++]=_>>>8&255,s[c++]=255&_;var m=v/4294967296*1e4&268435455;s[c++]=m>>>8&255,s[c++]=255&m,s[c++]=m>>>24&15|16,s[c++]=m>>>16&255,s[c++]=d>>>8|128,s[c++]=255&d;for(var g=0;g<6;++g)s[c+g]=f[g];return n||a(s)}},6426:(e,n,t)=>{var r=t(9157),o=t(8725);e.exports=function(e,n,t){var i=n&&t||0;"string"==typeof e&&(n="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n)for(var l=0;l<16;++l)n[i+l]=a[l];return n||o(a)}},7685:e=>{"use strict";e.exports=t},4212:n=>{"use strict";n.exports=e},3511:e=>{"use strict";e.exports=r},748:e=>{"use strict";e.exports=n}},i={};function a(e){var n=i[e];if(void 0!==n)return n.exports;var t=i[e]={exports:{}};return o[e](t,t.exports,a),t.exports}a.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return a.d(n,{a:n}),n},a.d=(e,n)=>{for(var t in n)a.o(n,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},a.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{"use strict";a.r(l),a.d(l,{default:()=>T});var e=a(4212);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var r=a(748),o=a(7685),i=a(3511),u=a.n(i),c={data:e.PropTypes.arrayOf(e.PropTypes.any).def([]),label:e.PropTypes.oneOfType([e.PropTypes.func.def(void 0),e.PropTypes.string.def("label")]),children:e.PropTypes.string.def("children"),indent:e.PropTypes.number.def(18),lineHeight:e.PropTypes.number.def(32),levelLine:e.PropTypes.oneOfType([e.PropTypes.bool.def(!1),e.PropTypes.func.def(void 0),e.PropTypes.string.def("1px dashed #c3cdd7")]).def(!1),virtualRender:e.PropTypes.bool.def(!1),prefixIcon:e.PropTypes.oneOfType([e.PropTypes.func.def((function(){})),e.PropTypes.bool.def(!1)]).def(!0),async:e.PropTypes.shape({callback:e.PropTypes.func.def(null),cache:e.PropTypes.bool.def(!0)}),offsetLeft:e.PropTypes.number.def(5)};function s(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function f(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return s(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?s(e,n):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d=a(8022),p=void 0,v="1px dashed #c3cdd7",y=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=e.data,a=e.children,l=[],u=0,c=new Map;function s(e,n,t,r){var i=(o||[]).find((function(n){return n.__uuid===e}));return i?i[r]:n[t]}function f(e,n){return s(e,n,"isOpen","__isOpen")}function p(e,n){return s(e,n,"checked","__checked")}function v(e){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=e.length,y=0;y<s;y++){var h=e[y];if(Array.isArray(h))v(h,r,o,i);else if("object"===n(h)&&null!==h){var _=h.__uuid||(0,d.v4)(),m=null!==i?"".concat(i,"-").concat(y):"".concat(y),g=!!(h[a]||[]).length,b=t({__depth:r,__index:y,__uuid:_,__parentId:o,__hasChild:g,__path:m,__isRoot:null===o,__order:u,__isOpen:f(_,h)&&g,__checked:p(_,h)},a,null);Object.assign(h,{__uuid:_}),c.set(_,b),u+=1,l.push(Object.assign(Object.assign({},h),t({},a,null))),Object.prototype.hasOwnProperty.call(h,a)&&v(h[a]||[],r+1,_,m)}}}return v(r||i),[l,c]},h=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[],a=e[n];return"boolean"==typeof a?a?r:o:_(t,e,n,i)},_=function(e,t,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=t[r];if("string"==typeof i)return"object"===n(e)&&null!==e?(Object.prototype.hasOwnProperty.call(e,i)||console.error("cannot find node label with key ".concat(i)),e[i]):i;if("function"==typeof i){var a=i.apply(p,[e].concat(f(o)));return"string"==typeof a?a:void console.error("props label with function return value is not string, please check and return string")}},m=function(e,n){return _(e,n,"label")},g=function(e,n){return e.get(n)||{}},b=function(e,n,t){var r;return null===(r=g(e,n))||void 0===r?void 0:r[t]},x=function(e,n){return{"--level-line":h(n,"levelLine",e,v,null,["tree"]),"--lineHeight":"".concat(n.lineHeight,"px"),"--indent":"".concat(n.indent,"px"),"--offset-left":"".concat(n.offsetLeft,"px")}},N=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.schema,o=b(r,e.__uuid,"__depth");return Object.assign({"--depth":o},"function"==typeof n.levelLine?{"--level-line":h(n,"levelLine",e,v,null,["node"])}:{})},O=function(e,n,t){var r=g(n,e.__uuid)||{};return{"is-root":r.__isRoot,"bk-tree-node":!0,"is-open":r.__isOpen,"is-virtual-render":t.virtualRender,"level-line":t.levelLine}},j=function(n,r){return t({"is-checked":(g(r,n.__uuid)||{}).__checked},(0,e.resolveClassName)("node-row"),!0)},P=function(e,n,t,r){var o=e.split("-").reduce((function(e,n){var r=Number(n);return Array.isArray(e)?e[r]:e[t][r]}),n);Object.assign(o,r||{})};const C=(0,r.defineComponent)({name:"Tree",props:c,emits:["check"],setup:function(i,a){var l=y(i),u=[],c=(0,r.reactive)({data:l[0],schema:l[1],levelLineSchema:{}});(0,r.watch)((function(){return[i.data]}),(function(e){var n=y(i,e,s.value);c.data=n[0],c.schema=n[1]}),{deep:!0});var s=(0,r.computed)((function(){return Array.from(c.schema.values())})),f=function(e){return c.schema.get(e)},d=function(e,n){var t;return null===(t=f(e.__uuid))||void 0===t?void 0:t[n]},p=function(e,n,r){return c.schema.set(e.__uuid,Object.assign(Object.assign({},f(e.__uuid)),t({},n,r)))},v=function(e){return d(e,"__path")},h=function(e){return d(e,"__isRoot")},_=function(e){return d(e,"__isOpen")},m=function(e){return d(e,"__hasChild")},g=(0,r.computed)((function(){return c.data.filter((function(e){return C(e)}))})),b=function(e){var t;return"object"===n(e)?_(e):"string"==typeof e&&(null===(t=f(e))||void 0===t?void 0:t.__isOpen)},x=function(n){return b(n)?(0,r.createVNode)(o.FolderShapeOpen,{class:(0,e.resolveClassName)("tree-icon")},null):(0,r.createVNode)(o.Folder,{class:(0,e.resolveClassName)("tree-icon")},null)},N=function(e){if("string"==typeof e)return e;if("object"===n(e)&&null!==e){if(e.__v_isVNode)return e;var t=e.node,o=e.className,i=e.text,a=e.style;return(0,r.h)(t,{class:o,style:a},i)}return null},O=function(e,r){if("object"===n(e)&&null!==e){p(r,"__isOpen",!0);var o=Array.isArray(e)?e:[e];!function(e,n,r,o,i){P(e,n,r,t({},o,i))}(v(r),i.data,i.children,i.children,o)}},j=function(e){if(e.async){var n=i.async||{},t=n.callback,r=void 0===t?null:t,o=n.cache,a=void 0===o||o;if("function"==typeof r){if(e.cached)return;Object.assign(e,{loading:!0}),r(e,(function(n){return O(n,e)})).then((function(n){return O(n,e)})).catch((function(e){return console.error("load remote data error:",e)})).finally((function(){P(v(e),i.data,i.children,Object.assign({loading:!1},a?{cached:!0}:{}))}))}else console.error("async need to set prop: asyncLoad with function wich will return promise object")}m(e)&&function(e){var n=!b(e);p(e,"__isOpen",n),n||g.value.filter((function(n){return String.prototype.startsWith.call(v(n),v(e))})).forEach((function(e){return p(e,"__isOpen",n)}))}(e)},C=function(e){return h(e)||b(e)||b(d(e,"__parentId"))},T=(0,r.ref)(),w=function(){var n;if(null===(n=T.value)||void 0===n?void 0:n.$el){var t=".".concat((0,e.resolveClassName)("tree-node")),r=".".concat((0,e.resolveClassName)("node-content"));Array.prototype.forEach.call(T.value.$el.querySelectorAll(t),(function(e){var n=e.querySelectorAll("".concat(r," span")),t=Array.prototype.slice.call(n,-1)[0];if(t){var o=e.offsetWidth-t.offsetLeft;t.style.setProperty("max-width","".concat(o,"px"))}}))}};return(0,r.onMounted)((function(){w()})),(0,r.onUpdated)((function(){w()})),{renderData:g,flatData:c,root:T,hanldeTreeNodeClick:j,handleNodeContentClick:function(e){u.includes(e.__uuid)||(u.forEach((function(e){return p({__uuid:e},"__checked",!1)})),u.length=0,p(e,"__checked",!0),u.push(e.__uuid),_(e)||j(e),a.emit("check",e,f(e.__uuid)))},handleNodeActionClick:function(e,n){e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),j(n)},getActionIcon:function(e){var n=null;return"function"==typeof i.prefixIcon&&"default"!==(n=i.prefixIcon(h(e),m(e)||e.async,b(e),"action",e))?N(n):("default"===n||"boolean"==typeof i.prefixIcon&&i.prefixIcon)&&(m(e)||e.async)?b(e)?(0,r.createVNode)(o.DownShape,null,null):(0,r.createVNode)(o.RightShape,null,null):null},getRootIcon:x,getVirtualLines:function(e){if(!i.levelLine)return null;var n=d(e,"__depth")+1;return new Array(n).fill("").map((function(e,n){return n})).filter((function(n){return function(e,n){if(h(n))return!1;var t=v(n),r="".concat(t).split("-").slice(0,e+1);if(r.join("-")===t)return!0;var o=r.pop(),i=parseInt(o,10);r.push("".concat(i+1));var a=r.join("-");return s.value.some((function(e){return e.__path===a}))}(n,e)})).filter((function(e){return e>0})).map((function(e){return(0,r.createVNode)("span",{class:"node-virtual-line",style:(t=n-e,{"--depth":t})},null);var t}))},getNodePrefixIcon:function(n){var t=null;return"function"==typeof i.prefixIcon&&"default"!==(t=i.prefixIcon(h(n),m(n)||n.async,b(n),"node_type",n))?N(t):"default"===t||"boolean"==typeof i.prefixIcon&&i.prefixIcon?h(n)||m(n)?x(n):(0,r.createVNode)(o.TextFile,{class:(0,e.resolveClassName)("tree-icon")},null):null},getLoadingIcon:function(e){return e.loading?(0,r.createVNode)(o.Spinner,null,null):""}}},render:function(){var n=this,t=this.$props,o=function(o){return(0,r.createVNode)("div",{class:j(o,n.flatData.schema)},[(0,r.createVNode)("div",{class:O(o,n.flatData.schema,t),style:N(o,t,n.flatData),onClick:function(){return n.handleNodeContentClick(o)}},[(0,r.createVNode)("span",{class:(0,e.resolveClassName)("node-action"),onClick:function(e){return n.handleNodeActionClick(e,o)}},[n.getActionIcon(o)]),(0,r.createVNode)("span",{class:(0,e.resolveClassName)("node-content")},[[n.getNodePrefixIcon(o),n.getLoadingIcon(o)],(0,r.createVNode)("span",{class:(0,e.resolveClassName)("node-text")},[m(o,t)])]),n.getVirtualLines(o)])])};return(0,r.createVNode)(u(),{class:(0,e.resolveClassName)("tree"),style:x(null,t),list:this.renderData,lineHeight:t.lineHeight,enabled:t.virtualRender,contentClassName:(0,e.resolveClassName)("container"),throttleDelay:0,ref:"root"},{default:function(e){return(e.data||[]).map(o)}})}}),T=(0,e.withInstall)(C)})(),l})()));
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("lodash"));else if("function"==typeof define&&define.amd)define(["../shared","vue","lodash"],t);else{var o="object"==typeof exports?t(require("../shared"),require("vue"),require("lodash")):t(e["../shared"],e.vue,e.lodash);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(self,((e,t,o)=>(()=>{"use strict";var n={4212:t=>{t.exports=e},467:e=>{e.exports=o},748:e=>{e.exports=t}},r={};function l(e){var t=r[e];if(void 0!==t)return t.exports;var o=r[e]={exports:{}};return n[e](o,o.exports,l),o.exports}l.d=(e,t)=>{for(var o in t)l.o(t,o)&&!l.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{l.r(i),l.d(i,{default:()=>g});var e=l(4212);function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function o(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,o){if(e){if("string"==typeof e)return t(e,o);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,o):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var r=l(748),a={onContentScroll:Function},s=Object.assign({list:e.PropTypes.array.def([]),enabled:e.PropTypes.bool.def(!0),lineHeight:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.func]).def(30),minHeight:e.PropTypes.number.def(30),height:e.PropTypes.oneOfType([e.PropTypes.string.def("100%"),e.PropTypes.number]).def("100%"),width:e.PropTypes.oneOfType([e.PropTypes.string.def("100%"),e.PropTypes.number]).def("100%"),className:e.PropTypes.oneOfType([e.PropTypes.arrayOf(e.PropTypes.string),e.PropTypes.object,e.PropTypes.arrayOf(e.PropTypes.object),e.PropTypes.string]).def(""),contentClassName:e.PropTypes.oneOfType([e.PropTypes.arrayOf(e.PropTypes.string),e.PropTypes.object,e.PropTypes.arrayOf(e.PropTypes.object),e.PropTypes.string]).def(""),contentStyle:e.PropTypes.object.def({}),scrollXName:e.PropTypes.string.def("bk-scroll-x"),scrollYName:e.PropTypes.string.def("bk-scroll-y"),groupItemCount:e.PropTypes.number.def(1),preloadItemCount:e.PropTypes.number.def(1),renderAs:e.PropTypes.string.def("div"),contentAs:e.PropTypes.string.def("div"),scrollOffsetTop:e.PropTypes.number.def(0),scrollPosition:e.PropTypes.string.def("content"),abosuteHeight:e.PropTypes.oneOfType([e.PropTypes.string.def("auto"),e.PropTypes.number]).def("auto"),throttleDelay:e.PropTypes.number.def(60)},a),u=l(467),c=void 0;function p(e,t,o,n){for(var r=0,l=0,i=0,a=0;r<e;r++){if(l+(a=n(r,[r*o,(r+1)*o]))>t){i=t-l;break}l+=a}return{startIndex:r,height:l,diffHeight:i}}function f(e,t,o,n,r){if(n){var l=n.scrollTop,i=o.scrollTop,a=o.count,s=o.groupItemCount,u=o.startIndex,c=o.endIndex,f=n.offsetHeight,d=0,y=0,v=0;if("number"==typeof e&&(d=Math.floor(l/e),y=Math.ceil(f/e)+d,v=l%e),"function"==typeof e){var m=p(a,l,s,e);d=m.startIndex>0?m.startIndex:0,v=m.diffHeight,y=p(a,f,s,e).startIndex+d+1}l===i&&d===u&&y===c||"function"==typeof t&&t(r,d,y,l,v)}}function d(e,t,o){var n=o.value,r=n.lineHeight,l=void 0===r?30:r,i=n.handleScrollCallback,a=n.pagination,s=void 0===a?{}:a,u=s.startIndex,c=s.endIndex,p=s.groupItemCount,d=s.count;f(l,i,{scrollTop:s.scrollTop,startIndex:u,endIndex:c,groupItemCount:p,count:d},t,e)}var y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:60;return(0,u.throttle)((function(e,t,o){return d(e,t,o)}),e)},v=null,m=function(e,t,o){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:60;v||(v=y(n)),"function"==typeof v&&v.call(c,e,t,o)};const b={mounted:function(e,t){var o=e.parentNode,n=t.value.throttleDelay;o.addEventListener("scroll",(function(e){m(e,o,t,n)}))},updated:function(e,t){var o=e.parentNode,n=t.value.throttleDelay;m(null,o,t,n)},unbind:function(e){if(e){var t=e.parentNode;if(!t)return;t.removeEventListener("scroll",y)}}},h=(0,r.defineComponent)({name:"VirtualRender",directives:{bkVirtualRender:b},props:s,emits:["content-scroll"],setup:function(e,t){var l=this,i=e.renderAs,a=e.contentAs,s=function(e){return"string"==typeof e?[e]:"object"!==n(e)||Array.isArray(e)?e:[e]};if(!e.enabled)return function(){var o,n,l,u,c,p,f,d,y;return(0,r.h)(i,{class:s(e.className)},[null!==(l=null===(n=(o=t.slots).beforeContent)||void 0===n?void 0:n.call(o))&&void 0!==l?l:"",(0,r.h)(a,{class:s(e.contentClassName),style:e.contentStyle},[null!==(p=null===(c=(u=t.slots).default)||void 0===c?void 0:c.call(u,{data:e.list}))&&void 0!==p?p:""]),null!==(y=null===(d=(f=t.slots).afterContent)||void 0===d?void 0:d.call(f))&&void 0!==y?y:""])};var u=(0,r.ref)(null),c=(0,r.reactive)({startIndex:0,endIndex:0,scrollTop:1,translateY:0,count:0,groupItemCount:e.groupItemCount}),p=function(e,o,n,r,l){c.startIndex=o,c.endIndex=n,c.scrollTop=r,c.translateY=l,t.emit("content-scroll",[e,c])};(0,r.onMounted)((function(){(0,r.nextTick)((function(){m(e.list),b()}))})),(0,r.watch)((function(){return e.list}),(function(){d(),b()}),{deep:!0}),(0,r.watch)((function(){return e.lineHeight}),(function(){d(),b()}));var d=function(){m(e.list)},y=(0,r.ref)(0),v=(0,r.ref)(0),m=function(t){if(y.value=Math.ceil((t||[]).length/e.groupItemCount),c.count=y.value,c.startIndex=0,c.endIndex=0,c.translateY=0,c.scrollTop=0,"string"==typeof e.abosuteHeight&&"auto"===e.abosuteHeight)if("function"==typeof e.lineHeight){v.value=0;for(var o=0,n=0;n<y.value;n++){var r=e.lineHeight.call(l,n,t.slice(n*e.groupItemCount,e.groupItemCount));o+="number"==typeof r?r:0}v.value=o}else v.value=e.lineHeight*y.value;else v.value=e.abosuteHeight},b=function(){var t,o=null===(t=u.value)||void 0===t?void 0:t.parentNode;f(e.lineHeight,p,c,o,null)},h=(0,r.computed)((function(){return(e.list||[]).map((function(e,t){return Object.assign(Object.assign({},e),{$index:t})}))})),g=(0,r.computed)((function(){return h.value.slice(c.startIndex*e.groupItemCount,(c.endIndex+e.preloadItemCount)*e.groupItemCount)})),T=(0,r.computed)((function(){return"content"===e.scrollPosition?{top:"".concat(c.scrollTop+e.scrollOffsetTop,"px"),transform:"translateY(-".concat(c.translateY,"px)")}:{}})),P=(0,r.computed)((function(){return Object.assign({height:"number"==typeof e.height?"".concat(e.height,"px"):e.height,width:"number"==typeof e.width?"".concat(e.width,"px"):e.width,display:"inline-block"},"container"===e.scrollPosition?T.value:{})})),x=(0,r.computed)((function(){var t="number"==typeof e.abosuteHeight&&0===e.abosuteHeight;return{height:"".concat(v.value<e.minHeight?e.minHeight:v.value,"px"),display:t?"none":"block"}})),I=(0,r.computed)((function(){return["bk-virtual-render",e.scrollXName,e.scrollYName].concat(o(s(e.className)),["container"===e.scrollPosition?"bk-virtual-content":""])})),C=(0,r.computed)((function(){return["content"===e.scrollPosition?"bk-virtual-content":""].concat(o(s(e.contentClassName)))})),O=(0,r.resolveDirective)("bkVirtualRender"),j={lineHeight:e.lineHeight,handleScrollCallback:p,pagination:c,throttleDelay:e.throttleDelay};return function(){var o,n,l,s,c,p,f,d,y;return(0,r.h)(i||"div",{ref:u,class:I.value,style:P.value},[null!==(l=null===(n=(o=t.slots).beforeContent)||void 0===n?void 0:n.call(o))&&void 0!==l?l:"",(0,r.withDirectives)((0,r.h)(a||"div",{class:C.value,style:Object.assign(Object.assign({},T.value),e.contentStyle)},[null!==(p=null===(c=(s=t.slots).default)||void 0===c?void 0:c.call(s,{data:g.value}))&&void 0!==p?p:""]),[[O,j]]),null!==(y=null===(d=(f=t.slots).afterContent)||void 0===d?void 0:d.call(f))&&void 0!==y?y:"",(0,r.h)("div",{class:["bk-virtual-section"],style:x.value})])}}}),g=(0,e.withInstall)(h)})(),i})()));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "bkui-vue",
|
3
|
-
"version": "0.0.1-beta.
|
3
|
+
"version": "0.0.1-beta.49",
|
4
4
|
"workspaces": {
|
5
5
|
"packages": [
|
6
6
|
"packages/!(**.bak)*",
|
@@ -18,6 +18,7 @@
|
|
18
18
|
"build:site": "vite build site --mode development",
|
19
19
|
"build:dist": "rimraf dist && lerna run --stream --scope cli dist",
|
20
20
|
"build:lib": "rimraf lib && lerna run --stream --scope cli lib",
|
21
|
+
"lib:dev": "rimraf lib && node --inspect-brk ./node_modules/.bin/ts-node --project=./scripts/cli/tsconfig.json ./scripts/cli/index.ts lib",
|
21
22
|
"help:release": "lerna run --stream --scope cli release",
|
22
23
|
"release": "run-s build help:release",
|
23
24
|
"analyze:lib": "rimraf lib && lerna run --stream --scope cli lib -- -a",
|