@ditari/bsui 1.0.9 → 1.0.11

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=require("./dic.worker.cjs.js"),l=require("../../store/modules/DataDictionary.cjs.js"),i=e.defineComponent({name:"DicReplace",props:{name:{type:String,default:""},value:{type:String,default:""}},setup(r){const{list:o}=l.useDataDicStore(),u=e.ref(!1),n=e.ref(""),t=new c.default;return t.onerror=()=>{u.value=!1},t.onmessage=a=>{n.value=a.data},e.watchEffect(()=>{const a=r.value,s=r.name;t.postMessage({list:o,name:s,value:a})}),e.createVNode(e.Fragment,null,[n.value])}});exports.default=i;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=require("./replace.worker.cjs.js"),c=require("../../store/modules/DataDictionary.cjs.js"),i=e.defineComponent({name:"DicReplace",props:{name:{type:String,default:""},value:{type:String,default:""}},setup(r){const{list:u}=c.useDataDicStore(),n=e.ref(!0),o=e.ref(""),t=new s.default;return t.onerror=()=>{n.value=!1},t.onmessage=a=>{o.value=a.data},console.log(n.value),e.watchEffect(()=>{const a=r.value,l=r.name;t.postMessage({list:JSON.stringify(u),name:l,value:a})}),()=>e.createVNode(e.Fragment,null,[o.value])}});exports.default=i;
@@ -7,7 +7,7 @@ declare const _default: import("vue").DefineComponent<{
7
7
  type: any;
8
8
  default: string;
9
9
  };
10
- }, JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
10
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
11
11
  name: {
12
12
  type: StringConstructor;
13
13
  default: string;
@@ -7,7 +7,7 @@ export declare const DDicReplace: import("../../utils/install").SFCWithInstall<i
7
7
  type: any;
8
8
  default: string;
9
9
  };
10
- }, JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
10
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
11
11
  name: {
12
12
  type: StringConstructor;
13
13
  default: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),S=require("ant-design-vue"),C=require("../../utils/html.cjs.js"),D=require("../theme/index.cjs.js"),K=()=>({data:{type:Object,required:!0},height:{type:Number,default:300},keys:Array,rowKey:{type:String,required:!0,default:"id"},loading:{type:Boolean,default:!1},pagination:{type:Object,default:()=>({})},config:{type:Object,default:()=>({})}}),m={defaultPageSize:20,hideOnSinglePage:!1,pageSizeOptions:["10","20","30","40"],responsive:!0,showQuickJumper:!0,showLessItems:!0,showTotal:a=>`总共 ${a} 条`},k=`${D.prefixName}-pagination`,V=n.defineComponent({name:"DTable",props:K(),emits:["update:keys"],setup(a,{emit:y,slots:w}){console.log(w);const e=n.ref(a.keys),N=n.computed(()=>a.data),T=n.computed(()=>{var t;return((t=a.config)==null?void 0:t.columns)??[]}),f=n.computed(()=>{var t;return((t=a.config)==null?void 0:t.pagination)??{}}),{tableRef:P,tableHeight:z,onPageChange:R,onRowClassName:x}=O();function O(){const{rowClassName:t,keepSelected:l,selection:h,onPageChange:g}=a.config,i=n.ref(null),o=n.ref(),s=n.ref(null),u=c=>{var p;const d=(p=i==null?void 0:i.value)==null?void 0:p.$el,j=C.useEleHeight(d.getElementsByClassName("ant-table-header")[0]);let b=0;a.config.pagination&&(b=C.useEleHeight(document.getElementsByClassName(k)[0])),o.value=c-(j+b),d.getElementsByClassName("ant-table-body")[0].style.height=o.value-10+"px",s.value=d.getElementsByClassName("ant-table-body")[0]};return n.watchEffect(()=>{a.height!==0&&n.nextTick(()=>{u(a.height)})}),{tableRef:i,tableHeight:o,onPageChange:(c,d)=>{g&&g({page:c,size:d}),s.value.scrollTop=0,(h==="S"||!l)&&(e.value=[],y("update:keys",e.value))},onRowClassName:(c,d)=>t?t(c,d):void 0}}const E=q();function q(){const{rowKey:t,config:{selection:l,getCheckboxProps:h}}=a;if(l==="N")return;const g=(o,s)=>{l==="S"?(e.value=[],e.value=s?[o[t]]:[]):e.value=s?e.value.concat(o[t]):e.value.filter(u=>u!==o[t]),y("update:keys",e.value)},i=(o,s,u)=>{const v=u.map(r=>r[t]);e.value=o?e.value.concat(v):e.value.filter(r=>!v.includes(r)),y("update:keys",e.value)};return n.watch(()=>a.keys,o=>{e.value=o}),{selectedRowKeys:e,onSelect:g,onSelectAll:i,fixed:!0,columnTitle:l==="S"?"选择":null,columnWidth:l==="S"?60:40,getCheckboxProps:h}}const H=B();function B(){return t=>{let l;const{rowKey:h,config:{click:g,dbClick:i,selection:o,getCheckboxProps:s}}=a,u=t[h],v=()=>{if(o==="N")return;e.value.some(c=>c===u)?e.value=e.value.filter(c=>c!==u):(o==="S"&&(e.value=[]),e.value.push(u)),y("update:keys",e.value)};return{onClick:()=>{if(!g)return;const r=s?s(t):null;r&&r.value===u||(clearTimeout(l),l=setTimeout(()=>{v(),g(t)},200))},onDblclick:()=>{i&&(clearTimeout(l),i(t))}}}}return()=>{var t;return n.createVNode(n.Fragment,null,[n.createVNode(S.Table,{ref:P,"row-key":a.rowKey,bordered:a.config.bordered,columns:T.value,dataSource:N.value,loading:a.loading,size:((t=a.config)==null?void 0:t.size)??"small",scroll:{scrollToFirstRowOnChange:!0,x:"100%",y:z.value+"px"},pagination:!1,customRow:H,rowSelection:E,rowClassName:x},{bodyCell:({column:l})=>{if(l.slot==="action")return n.createVNode(S.Space,null,{default:()=>[w.action&&w.action()]})}}),n.withDirectives(n.createVNode(S.Pagination,{class:[k],current:f.value.current,"onUpdate:current":l=>f.value.current=l,pageSize:f.value.pageSize,"onUpdate:pageSize":l=>f.value.pageSize=l,disabled:a.loading,"show-size-changer":!0,size:"default","hide-on-single-page":m.hideOnSinglePage,"show-quick-jumper":m.showQuickJumper,"default-page-size":m.defaultPageSize,"page-size-options":m.pageSizeOptions,"show-total":m.showTotal,total:f.value.total,onChange:R},null),[[n.vShow,f.value]])])}}});exports.default=V;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),w=require("ant-design-vue"),C=require("../../utils/html.cjs.js"),D=require("../theme/index.cjs.js"),K=()=>({data:{type:Object,required:!0},height:{type:Number,default:300},keys:Array,rowKey:{type:String,required:!0,default:"id"},loading:{type:Boolean,default:!1},pagination:{type:Object,default:()=>({})},config:{type:Object,default:()=>({})}}),v={defaultPageSize:20,hideOnSinglePage:!1,pageSizeOptions:["10","20","30","40"],responsive:!0,showQuickJumper:!0,showLessItems:!0,showTotal:a=>`总共 ${a} 条`},k=`${D.prefixName}-pagination`,V=n.defineComponent({name:"DTable",props:K(),emits:["update:keys"],setup(a,{emit:y,slots:S}){const e=n.ref(a.keys),N=n.computed(()=>a.data),T=n.computed(()=>{var t;return((t=a.config)==null?void 0:t.columns)??[]}),f=n.computed(()=>{var t;return((t=a.config)==null?void 0:t.pagination)??{}}),{tableRef:P,tableHeight:z,onPageChange:R,onRowClassName:x}=O();function O(){const{rowClassName:t,keepSelected:l,selection:h,onPageChange:g}=a.config,u=n.ref(null),o=n.ref(),s=n.ref(null),i=c=>{var p;const d=(p=u==null?void 0:u.value)==null?void 0:p.$el,j=C.useEleHeight(d.getElementsByClassName("ant-table-header")[0]);let b=0;a.config.pagination&&(b=C.useEleHeight(document.getElementsByClassName(k)[0])),o.value=c-(j+b),d.getElementsByClassName("ant-table-body")[0].style.height=o.value-10+"px",s.value=d.getElementsByClassName("ant-table-body")[0]};return n.watchEffect(()=>{a.height!==0&&n.nextTick(()=>{i(a.height)})}),{tableRef:u,tableHeight:o,onPageChange:(c,d)=>{g&&g({page:c,size:d}),s.value.scrollTop=0,(h==="S"||!l)&&(e.value=[],y("update:keys",e.value))},onRowClassName:(c,d)=>t?t(c,d):void 0}}const E=q();function q(){const{rowKey:t,config:{selection:l,getCheckboxProps:h}}=a;if(l==="N")return;const g=(o,s)=>{l==="S"?(e.value=[],e.value=s?[o[t]]:[]):e.value=s?e.value.concat(o[t]):e.value.filter(i=>i!==o[t]),y("update:keys",e.value)},u=(o,s,i)=>{const m=i.map(r=>r[t]);e.value=o?e.value.concat(m):e.value.filter(r=>!m.includes(r)),y("update:keys",e.value)};return n.watch(()=>a.keys,o=>{e.value=o}),{selectedRowKeys:e,onSelect:g,onSelectAll:u,fixed:!0,columnTitle:l==="S"?"选择":null,columnWidth:l==="S"?60:40,getCheckboxProps:h}}const H=B();function B(){return t=>{let l;const{rowKey:h,config:{click:g,dbClick:u,selection:o,getCheckboxProps:s}}=a,i=t[h],m=()=>{if(o==="N")return;e.value.some(c=>c===i)?e.value=e.value.filter(c=>c!==i):(o==="S"&&(e.value=[]),e.value.push(i)),y("update:keys",e.value)};return{onClick:()=>{if(!g)return;const r=s?s(t):null;r&&r.value===i||(clearTimeout(l),l=setTimeout(()=>{m(),g(t)},200))},onDblclick:()=>{u&&(clearTimeout(l),u(t))}}}}return()=>{var t;return n.createVNode(n.Fragment,null,[n.createVNode(w.Table,{ref:P,"row-key":a.rowKey,bordered:a.config.bordered,columns:T.value,dataSource:N.value,loading:a.loading,size:((t=a.config)==null?void 0:t.size)??"small",scroll:{scrollToFirstRowOnChange:!0,x:"100%",y:z.value+"px"},pagination:!1,customRow:H,rowSelection:E,rowClassName:x},{bodyCell:({column:l})=>{if(l.slot==="action")return n.createVNode(w.Space,null,{default:()=>[S.action&&S.action()]})}}),n.withDirectives(n.createVNode(w.Pagination,{class:[k],current:f.value.current,"onUpdate:current":l=>f.value.current=l,pageSize:f.value.pageSize,"onUpdate:pageSize":l=>f.value.pageSize=l,disabled:a.loading,"show-size-changer":!0,size:"default","hide-on-single-page":v.hideOnSinglePage,"show-quick-jumper":v.showQuickJumper,"default-page-size":v.defaultPageSize,"page-size-options":v.pageSizeOptions,"show-total":v.showTotal,total:f.value.total,onChange:R},null),[[n.vShow,a.config.pagination]])])}}});exports.default=V;
@@ -7,7 +7,7 @@ declare const _default: import("vue").DefineComponent<{
7
7
  type: any;
8
8
  default: string;
9
9
  };
10
- }, JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
10
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
11
11
  name: {
12
12
  type: StringConstructor;
13
13
  default: string;
@@ -1,7 +1,7 @@
1
- import { defineComponent as c, ref as o, watchEffect as u, createVNode as m, Fragment as p } from "vue";
2
- import f from "./dic.worker.esm.js";
3
- import { useDataDicStore as i } from "../../store/modules/DataDictionary.esm.js";
4
- const w = /* @__PURE__ */ c({
1
+ import { defineComponent as c, ref as n, watchEffect as u, createVNode as i, Fragment as m } from "vue";
2
+ import p from "./replace.worker.esm.js";
3
+ import { useDataDicStore as f } from "../../store/modules/DataDictionary.esm.js";
4
+ const S = /* @__PURE__ */ c({
5
5
  name: "DicReplace",
6
6
  props: {
7
7
  // 字典名称
@@ -17,22 +17,22 @@ const w = /* @__PURE__ */ c({
17
17
  },
18
18
  setup(a) {
19
19
  const {
20
- list: n
21
- } = i(), s = o(!1), r = o(""), e = new f();
20
+ list: s
21
+ } = f(), o = n(!0), r = n(""), e = new p();
22
22
  return e.onerror = () => {
23
- s.value = !1;
23
+ o.value = !1;
24
24
  }, e.onmessage = (t) => {
25
25
  r.value = t.data;
26
- }, u(() => {
26
+ }, console.log(o.value), u(() => {
27
27
  const t = a.value, l = a.name;
28
28
  e.postMessage({
29
- list: n,
29
+ list: JSON.stringify(s),
30
30
  name: l,
31
31
  value: t
32
32
  });
33
- }), m(p, null, [r.value]);
33
+ }), () => i(m, null, [r.value]);
34
34
  }
35
35
  });
36
36
  export {
37
- w as default
37
+ S as default
38
38
  };
@@ -7,7 +7,7 @@ export declare const DDicReplace: import("../../utils/install").SFCWithInstall<i
7
7
  type: any;
8
8
  default: string;
9
9
  };
10
- }, JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
10
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
11
11
  name: {
12
12
  type: StringConstructor;
13
13
  default: string;
@@ -1,4 +1,4 @@
1
- import { defineComponent as q, ref as y, computed as S, watchEffect as $, nextTick as A, watch as F, createVNode as p, Fragment as J, withDirectives as Q, vShow as U } from "vue";
1
+ import { defineComponent as q, ref as y, computed as p, watchEffect as $, nextTick as A, watch as F, createVNode as w, Fragment as J, withDirectives as Q, vShow as U } from "vue";
2
2
  import { Table as I, Space as L, Pagination as V } from "ant-design-vue";
3
3
  import { useEleHeight as k } from "../../utils/html.esm.js";
4
4
  import { prefixName as W } from "../theme/index.esm.js";
@@ -45,13 +45,12 @@ const X = () => ({
45
45
  emits: ["update:keys"],
46
46
  setup(a, {
47
47
  emit: v,
48
- slots: w
48
+ slots: S
49
49
  }) {
50
- console.log(w);
51
- const e = y(a.keys), T = S(() => a.data), z = S(() => {
50
+ const e = y(a.keys), T = p(() => a.data), z = p(() => {
52
51
  var t;
53
52
  return ((t = a.config) == null ? void 0 : t.columns) ?? [];
54
- }), d = S(() => {
53
+ }), f = p(() => {
55
54
  var t;
56
55
  return ((t = a.config) == null ? void 0 : t.pagination) ?? {};
57
56
  }), {
@@ -64,7 +63,7 @@ const X = () => ({
64
63
  const {
65
64
  rowClassName: t,
66
65
  keepSelected: n,
67
- selection: f,
66
+ selection: d,
68
67
  onPageChange: r
69
68
  } = a.config, i = y(null), l = y(), u = y(null), o = (s) => {
70
69
  var C;
@@ -83,7 +82,7 @@ const X = () => ({
83
82
  r && r({
84
83
  page: s,
85
84
  size: g
86
- }), u.value.scrollTop = 0, (f === "S" || !n) && (e.value = [], v("update:keys", e.value));
85
+ }), u.value.scrollTop = 0, (d === "S" || !n) && (e.value = [], v("update:keys", e.value));
87
86
  },
88
87
  onRowClassName: (s, g) => t ? t(s, g) : void 0
89
88
  };
@@ -94,7 +93,7 @@ const X = () => ({
94
93
  rowKey: t,
95
94
  config: {
96
95
  selection: n,
97
- getCheckboxProps: f
96
+ getCheckboxProps: d
98
97
  }
99
98
  } = a;
100
99
  if (n === "N")
@@ -114,7 +113,7 @@ const X = () => ({
114
113
  fixed: !0,
115
114
  columnTitle: n === "S" ? "选择" : null,
116
115
  columnWidth: n === "S" ? 60 : 40,
117
- getCheckboxProps: f
116
+ getCheckboxProps: d
118
117
  };
119
118
  }
120
119
  const K = j();
@@ -122,14 +121,14 @@ const X = () => ({
122
121
  return (t) => {
123
122
  let n;
124
123
  const {
125
- rowKey: f,
124
+ rowKey: d,
126
125
  config: {
127
126
  click: r,
128
127
  dbClick: i,
129
128
  selection: l,
130
129
  getCheckboxProps: u
131
130
  }
132
- } = a, o = t[f], h = () => {
131
+ } = a, o = t[d], h = () => {
133
132
  if (l === "N")
134
133
  return;
135
134
  e.value.some((s) => s === o) ? e.value = e.value.filter((s) => s !== o) : (l === "S" && (e.value = []), e.value.push(o)), v("update:keys", e.value);
@@ -161,7 +160,7 @@ const X = () => ({
161
160
  }
162
161
  return () => {
163
162
  var t;
164
- return p(J, null, [p(I, {
163
+ return w(J, null, [w(I, {
165
164
  ref: P,
166
165
  "row-key": a.rowKey,
167
166
  bordered: a.config.bordered,
@@ -183,16 +182,16 @@ const X = () => ({
183
182
  column: n
184
183
  }) => {
185
184
  if (n.slot === "action")
186
- return p(L, null, {
187
- default: () => [w.action && w.action()]
185
+ return w(L, null, {
186
+ default: () => [S.action && S.action()]
188
187
  });
189
188
  }
190
- }), Q(p(V, {
189
+ }), Q(w(V, {
191
190
  class: [N],
192
- current: d.value.current,
193
- "onUpdate:current": (n) => d.value.current = n,
194
- pageSize: d.value.pageSize,
195
- "onUpdate:pageSize": (n) => d.value.pageSize = n,
191
+ current: f.value.current,
192
+ "onUpdate:current": (n) => f.value.current = n,
193
+ pageSize: f.value.pageSize,
194
+ "onUpdate:pageSize": (n) => f.value.pageSize = n,
196
195
  disabled: a.loading,
197
196
  "show-size-changer": !0,
198
197
  size: "default",
@@ -201,9 +200,9 @@ const X = () => ({
201
200
  "default-page-size": m.defaultPageSize,
202
201
  "page-size-options": m.pageSizeOptions,
203
202
  "show-total": m.showTotal,
204
- total: d.value.total,
203
+ total: f.value.total,
205
204
  onChange: x
206
- }, null), [[U, d.value]])]);
205
+ }, null), [[U, a.config.pagination]])]);
207
206
  };
208
207
  }
209
208
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -6,7 +6,7 @@
6
6
  import { defineComponent, ref, watchEffect } from "vue";
7
7
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
8
8
  // @ts-ignore
9
- import DicWorker from "./dic.worker?worker&inline";
9
+ import DicWorker from "./replace.worker?worker&inline";
10
10
  import { useDataDicStore } from "../../store/modules/DataDictionary";
11
11
 
12
12
  export default defineComponent({
@@ -26,7 +26,7 @@ export default defineComponent({
26
26
  setup(props) {
27
27
  const { list } = useDataDicStore();
28
28
 
29
- const workerStatus = ref(false);
29
+ const workerStatus = ref(true);
30
30
  const dicValueTxt = ref<any>("");
31
31
  const worker = new DicWorker();
32
32
  /**
@@ -43,13 +43,14 @@ export default defineComponent({
43
43
  // 赋值给下拉选择数据变量
44
44
  dicValueTxt.value = e.data;
45
45
  };
46
+ console.log(workerStatus.value);
46
47
 
47
48
  watchEffect(() => {
48
49
  const value = props.value;
49
50
  const name = props.name;
50
- worker.postMessage({ list, name, value });
51
+ worker.postMessage({ list: JSON.stringify(list), name, value });
51
52
  });
52
53
 
53
- return <>{dicValueTxt.value}</>;
54
+ return () => <>{dicValueTxt.value}</>;
54
55
  }
55
56
  });
@@ -45,7 +45,7 @@ function useSelect() {
45
45
  // }
46
46
  // );
47
47
  // const worker = new Worker(
48
- // new URL("./dic.worker.ts?worker&inline", import.meta.url),
48
+ // new URL("./replace.worker.ts?worker&inline", import.meta.url),
49
49
  // {
50
50
  // type: "module"
51
51
  // }
@@ -83,7 +83,6 @@ const DXTable = defineComponent({
83
83
  // TODO 需要做调整
84
84
  emits: ["update:keys"],
85
85
  setup(props, { emit, slots }) {
86
- console.log(slots);
87
86
  // 保存选中的唯一id
88
87
  const selectedRowKeys = ref<any>(props.keys);
89
88
  // 数据源
@@ -318,7 +317,7 @@ const DXTable = defineComponent({
318
317
  }}
319
318
  </Table>
320
319
  <Pagination
321
- v-show={paginationState.value}
320
+ v-show={props.config.pagination}
322
321
  class={[basePageClassName]}
323
322
  v-model:current={paginationState.value.current}
324
323
  v-model:pageSize={paginationState.value.pageSize}