bm-admin-ui 1.0.38-alpha → 1.0.40-alpha

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.
Files changed (64) hide show
  1. package/es/components/__tests__/util/domHook.d.ts +6 -0
  2. package/es/components/feedback/index.js +2 -2
  3. package/es/components/float-table/index.js +36 -27
  4. package/es/components/flow-designer/src/bm-nodes/BmConditionNode.vue.d.ts +4 -4
  5. package/es/components/form-create/index.js +215 -107
  6. package/es/components/form-designer/index.js +86 -47
  7. package/es/components/input-tags-display/index.js +30 -13
  8. package/es/components/input-tags-display/src/input-tags-display.vue.d.ts +9 -0
  9. package/es/components/over-tooltips/index.js +27 -20
  10. package/es/components/search-filter/index.js +18 -10
  11. package/es/components/select-all/index.js +17 -9
  12. package/es/components/shops-filter/index.js +19 -13
  13. package/es/components/staffs-selector/index.js +116 -82
  14. package/es/components/timeline/__tests__/index.test.d.ts +1 -0
  15. package/es/components/timeline/index.js +8 -7
  16. package/es/components/upload/__tests__/mock.d.ts +2 -0
  17. package/es/components/upload/__tests__/requests.d.ts +7 -0
  18. package/es/components/upload/__tests__/upload.test.d.ts +1 -0
  19. package/es/components/upload/index.js +115 -78
  20. package/index.esm.js +41000 -4676
  21. package/index.js +40999 -4675
  22. package/lib/components/__tests__/util/domHook.d.ts +6 -0
  23. package/lib/components/feedback/index.js +1 -1
  24. package/lib/components/float-table/index.js +36 -27
  25. package/lib/components/flow-designer/src/bm-nodes/BmConditionNode.vue.d.ts +4 -4
  26. package/lib/components/form-create/index.js +214 -106
  27. package/lib/components/form-designer/index.js +86 -47
  28. package/lib/components/input-tags-display/index.js +30 -13
  29. package/lib/components/input-tags-display/src/input-tags-display.vue.d.ts +9 -0
  30. package/lib/components/over-tooltips/index.js +27 -20
  31. package/lib/components/search-filter/index.js +18 -10
  32. package/lib/components/select-all/index.js +17 -9
  33. package/lib/components/shops-filter/index.js +19 -13
  34. package/lib/components/staffs-selector/index.js +116 -82
  35. package/lib/components/timeline/__tests__/index.test.d.ts +1 -0
  36. package/lib/components/timeline/index.js +8 -7
  37. package/lib/components/upload/__tests__/mock.d.ts +2 -0
  38. package/lib/components/upload/__tests__/requests.d.ts +7 -0
  39. package/lib/components/upload/__tests__/upload.test.d.ts +1 -0
  40. package/lib/components/upload/index.js +115 -78
  41. package/package.json +1 -1
  42. package/theme-chalk/button.css +1 -1
  43. package/theme-chalk/feedback.css +1 -1
  44. package/theme-chalk/float-table.css +1 -1
  45. package/theme-chalk/floating-vue.css +1 -1
  46. package/theme-chalk/flow-designer.css +1 -1
  47. package/theme-chalk/form-create.css +1 -1
  48. package/theme-chalk/form-designer.css +1 -1
  49. package/theme-chalk/index.css +1 -1
  50. package/theme-chalk/input-tags-display.css +1 -1
  51. package/theme-chalk/modal.css +1 -1
  52. package/theme-chalk/over-tooltips.css +1 -1
  53. package/theme-chalk/search-filter.css +1 -1
  54. package/theme-chalk/select-all.css +1 -1
  55. package/theme-chalk/staffs-selector.css +1 -1
  56. package/theme-chalk/timeline.css +1 -1
  57. package/theme-chalk/upload.css +1 -1
  58. package/types/components/__tests__/util/domHook.d.ts +6 -0
  59. package/types/components/flow-designer/src/bm-nodes/BmConditionNode.vue.d.ts +4 -4
  60. package/types/components/input-tags-display/src/input-tags-display.vue.d.ts +9 -0
  61. package/types/components/timeline/__tests__/index.test.d.ts +1 -0
  62. package/types/components/upload/__tests__/mock.d.ts +2 -0
  63. package/types/components/upload/__tests__/requests.d.ts +7 -0
  64. package/types/components/upload/__tests__/upload.test.d.ts +1 -0
@@ -129,39 +129,50 @@ const _sfc_main$3 = vue.defineComponent({
129
129
  return data ? data.title : "\u672A\u77E5";
130
130
  }
131
131
  };
132
- vue.watch(() => state.listChecked, () => {
133
- let list = [];
134
- for (let [key, value] of Object.entries(state.listChecked)) {
135
- value && list.push(key);
136
- }
137
- if (props.limit > 0 && list.length >= props.limit)
138
- state.isFulfill = true;
139
- else
140
- state.isFulfill = false;
141
- methods.setState();
142
- emit("update:selected", list);
143
- }, { deep: true });
144
- vue.watch(() => state.departmentChecked, () => {
145
- let flatMap = props.dataMap;
146
- let curlistKeys = props.curlistKeys;
147
- let hadselected = new Set(props.selected);
148
- let curselect = new Set(state.departmentChecked);
149
- for (let key of hadselected) {
150
- if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
151
- hadselected.delete(key);
132
+ vue.watch(
133
+ () => state.listChecked,
134
+ () => {
135
+ let list = [];
136
+ for (let [key, value] of Object.entries(state.listChecked)) {
137
+ value && list.push(key);
152
138
  }
153
- }
154
- for (let key of curselect) {
155
- let obj = flatMap.get(key);
156
- if (obj && !curselect.has(obj["parent"])) {
157
- hadselected.add(key);
139
+ if (props.limit > 0 && list.length >= props.limit)
140
+ state.isFulfill = true;
141
+ else
142
+ state.isFulfill = false;
143
+ methods.setState();
144
+ emit("update:selected", list);
145
+ },
146
+ { deep: true }
147
+ );
148
+ vue.watch(
149
+ () => state.departmentChecked,
150
+ () => {
151
+ let flatMap = props.dataMap;
152
+ let curlistKeys = props.curlistKeys;
153
+ let hadselected = new Set(props.selected);
154
+ let curselect = new Set(state.departmentChecked);
155
+ for (let key of hadselected) {
156
+ if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
157
+ hadselected.delete(key);
158
+ }
158
159
  }
160
+ for (let key of curselect) {
161
+ let obj = flatMap.get(key);
162
+ if (obj && !curselect.has(obj["parent"])) {
163
+ hadselected.add(key);
164
+ }
165
+ }
166
+ emit("update:selected", Array.from(hadselected));
167
+ },
168
+ { deep: true }
169
+ );
170
+ vue.watch(
171
+ () => props.list,
172
+ () => {
173
+ !props.isTree && methods.setState();
159
174
  }
160
- emit("update:selected", Array.from(hadselected));
161
- }, { deep: true });
162
- vue.watch(() => props.list, () => {
163
- !props.isTree && methods.setState();
164
- });
175
+ );
165
176
  vue.onMounted(() => {
166
177
  let list = props.selected;
167
178
  list && list.forEach((key) => {
@@ -497,57 +508,73 @@ const _sfc_main$1 = vue.defineComponent({
497
508
  return data ? data.title : "\u672A\u77E5";
498
509
  }
499
510
  };
500
- vue.watch(() => departmentChecked, () => {
501
- let flatMap = props.dataMap;
502
- let curlistKeys = props.curlistKeys;
503
- let hadselected = new Set(props.selected);
504
- let curselect = new Set(departmentChecked.value);
505
- for (let key of hadselected) {
506
- if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
507
- hadselected.delete(key);
511
+ vue.watch(
512
+ () => departmentChecked,
513
+ () => {
514
+ let flatMap = props.dataMap;
515
+ let curlistKeys = props.curlistKeys;
516
+ let hadselected = new Set(props.selected);
517
+ let curselect = new Set(departmentChecked.value);
518
+ for (let key of hadselected) {
519
+ if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
520
+ hadselected.delete(key);
521
+ }
508
522
  }
509
- }
510
- for (let key of curselect) {
511
- let obj = flatMap.get(key);
512
- if (obj && !curselect.has(obj["parent"])) {
513
- hadselected.add(key);
523
+ for (let key of curselect) {
524
+ let obj = flatMap.get(key);
525
+ if (obj && !curselect.has(obj["parent"])) {
526
+ hadselected.add(key);
527
+ }
514
528
  }
515
- }
516
- emit("update:selected", Array.from(hadselected));
517
- }, { deep: true });
518
- vue.watch(() => staffsChecked, () => {
519
- let set = new Set(props.selected.length ? props.selected : null);
520
- for (let [key, value] of Object.entries(staffsChecked.value)) {
521
- if (value) {
522
- set.add(key);
523
- } else {
524
- set.has(key) && set.delete(key);
529
+ emit("update:selected", Array.from(hadselected));
530
+ },
531
+ { deep: true }
532
+ );
533
+ vue.watch(
534
+ () => staffsChecked,
535
+ () => {
536
+ let set = new Set(props.selected.length ? props.selected : null);
537
+ for (let [key, value] of Object.entries(staffsChecked.value)) {
538
+ if (value) {
539
+ set.add(key);
540
+ } else {
541
+ set.has(key) && set.delete(key);
542
+ }
525
543
  }
526
- }
527
- emit("update:selected", Array.from(set));
528
- }, { deep: true });
529
- vue.watch(() => shopChecked, () => {
530
- let set = new Set(props.selected.length ? props.selected : null);
531
- for (let [key, value] of Object.entries(shopChecked.value)) {
532
- if (value) {
533
- set.add(key);
534
- } else {
535
- set.has(key) && set.delete(key);
544
+ emit("update:selected", Array.from(set));
545
+ },
546
+ { deep: true }
547
+ );
548
+ vue.watch(
549
+ () => shopChecked,
550
+ () => {
551
+ let set = new Set(props.selected.length ? props.selected : null);
552
+ for (let [key, value] of Object.entries(shopChecked.value)) {
553
+ if (value) {
554
+ set.add(key);
555
+ } else {
556
+ set.has(key) && set.delete(key);
557
+ }
536
558
  }
537
- }
538
- emit("update:selected", Array.from(set));
539
- }, { deep: true });
540
- vue.watch(() => groupChecked, () => {
541
- let set = new Set(props.selected.length ? props.selected : null);
542
- for (let [key, value] of Object.entries(groupChecked.value)) {
543
- if (value) {
544
- set.add(key);
545
- } else {
546
- set.has(key) && set.delete(key);
559
+ emit("update:selected", Array.from(set));
560
+ },
561
+ { deep: true }
562
+ );
563
+ vue.watch(
564
+ () => groupChecked,
565
+ () => {
566
+ let set = new Set(props.selected.length ? props.selected : null);
567
+ for (let [key, value] of Object.entries(groupChecked.value)) {
568
+ if (value) {
569
+ set.add(key);
570
+ } else {
571
+ set.has(key) && set.delete(key);
572
+ }
547
573
  }
548
- }
549
- emit("update:selected", Array.from(set));
550
- }, { deep: true });
574
+ emit("update:selected", Array.from(set));
575
+ },
576
+ { deep: true }
577
+ );
551
578
  vue.onMounted(() => {
552
579
  let list = props.selected;
553
580
  list && list.forEach((key) => {
@@ -833,7 +860,10 @@ const _sfc_main = vue.defineComponent({
833
860
  if (["string", "number"].includes(typeof state.selected)) {
834
861
  emit("update:select", [state.dataMap.get(state.selected)]);
835
862
  } else if (state.selected instanceof Array) {
836
- emit("update:select", state.selected.map((item) => state.dataMap.get(item)));
863
+ emit(
864
+ "update:select",
865
+ state.selected.map((item) => state.dataMap.get(item))
866
+ );
837
867
  } else ;
838
868
  state.list = [];
839
869
  methods.modalCancel();
@@ -854,11 +884,15 @@ const _sfc_main = vue.defineComponent({
854
884
  return 648;
855
885
  })
856
886
  });
857
- vue.watch(() => props.visible, (val) => {
858
- if (val && props.immediateFetch) {
859
- methods.fetch({});
860
- }
861
- }, { immediate: true });
887
+ vue.watch(
888
+ () => props.visible,
889
+ (val) => {
890
+ if (val && props.immediateFetch) {
891
+ methods.fetch({});
892
+ }
893
+ },
894
+ { immediate: true }
895
+ );
862
896
  return {
863
897
  ...methods,
864
898
  ...vue.toRefs(state)
@@ -0,0 +1 @@
1
+ export {};
@@ -38,17 +38,17 @@ function isPlainObject(o) {
38
38
  return true;
39
39
  }
40
40
 
41
- function t(){return t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e},t.apply(this,arguments)}function r(e,t){if(null==e)return {};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}const n={silent:!1,logLevel:"warn"},i=["validator"],o=Object.prototype,a=o.toString,s=o.hasOwnProperty,u=/^\s*function (\w+)/;function l(e){var t;const r=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(r){const e=r.toString().match(u);return e?e[1]:""}return ""}const c=isPlainObject,f=e=>e;let d=f;if("production"!==process.env.NODE_ENV){const e="undefined"!=typeof console;d=e?function(e,t=n.logLevel){!1===n.silent&&console[t](`[VueTypes warn]: ${e}`);}:f;}const p=(e,t)=>s.call(e,t),y=Number.isInteger||function(e){return "number"==typeof e&&isFinite(e)&&Math.floor(e)===e},v=Array.isArray||function(e){return "[object Array]"===a.call(e)},h=e=>"[object Function]"===a.call(e),b=e=>c(e)&&p(e,"_vueTypes_name"),g=e=>c(e)&&(p(e,"type")||["_vueTypes_name","validator","default","required"].some(t=>p(e,t)));function O(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function m(e,t,r=!1){let n,i=!0,o="";n=c(e)?e:{type:e};const a=b(n)?n._vueTypes_name+" - ":"";if(g(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return i;if(!n.required&&void 0===t)return i;v(n.type)?(i=n.type.some(e=>!0===m(e,t,!0)),o=n.type.map(e=>l(e)).join(" or ")):(o=l(n),i="Array"===o?v(t):"Object"===o?c(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return "";const t=e.constructor.toString().match(u);return t?t[1]:""}(t)===o:t instanceof n.type);}if(!i){const e=`${a}value "${t}" should be of type "${o}"`;return !1===r?(d(e),!1):e}if(p(n,"validator")&&h(n.validator)){const e=d,o=[];if(d=e=>{o.push(e);},i=n.validator(t),d=e,!i){const e=(o.length>1?"* ":"")+o.join("\n* ");return o.length=0,!1===r?(d(e),i):e}}return i}function j(e,t){const r=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get(){return this.required=!0,this}},def:{value(e){return void 0===e?(p(this,"default")&&delete this.default,this):h(e)||!0===m(this,e,!0)?(this.default=v(e)?()=>[...e]:c(e)?()=>Object.assign({},e):e,this):(d(`${this._vueTypes_name} - invalid default value: "${e}"`),this)}}}),{validator:n}=r;return h(n)&&(r.validator=O(n,r)),r}function _(e,t){const r=j(e,t);return Object.defineProperty(r,"validate",{value(e){return h(this.validator)&&d(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:\n${JSON.stringify(this)}`),this.validator=O(e,this),this}})}function T(e,t,n){const o=function(e){const t={};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=Object.getOwnPropertyDescriptor(e,r);}),Object.defineProperties({},t)}(t);if(o._vueTypes_name=e,!c(n))return o;const{validator:a}=n,s=r(n,i);if(h(a)){let{validator:e}=o;e&&(e=null!==(l=(u=e).__original)&&void 0!==l?l:u),o.validator=O(e?function(t){return e.call(this,t)&&a.call(this,t)}:a,o);}var u,l;return Object.assign(o,s)}function $(e){return e.replace(/^(?!\s*$)/gm," ")}const w=()=>_("any",{}),P=()=>_("function",{type:Function}),x=()=>_("boolean",{type:Boolean}),E=()=>_("string",{type:String}),N=()=>_("number",{type:Number}),q=()=>_("array",{type:Array}),A=()=>_("object",{type:Object}),V=()=>j("integer",{type:Number,validator:e=>y(e)}),S=()=>j("symbol",{validator:e=>"symbol"==typeof e});function k(e,t="custom validation failed"){if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return j(e.name||"<<anonymous function>>",{type:null,validator(r){const n=e(r);return n||d(`${this._vueTypes_name} - ${t}`),n}})}function D(e){if(!v(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");const t=`oneOf - value should be one of "${e.join('", "')}".`,r=e.reduce((e,t)=>{if(null!=t){const r=t.constructor;-1===e.indexOf(r)&&e.push(r);}return e},[]);return j("oneOf",{type:r.length>0?r:void 0,validator(r){const n=-1!==e.indexOf(r);return n||d(t),n}})}function L(e){if(!v(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");let t=!1,r=[];for(let n=0;n<e.length;n+=1){const i=e[n];if(g(i)){if(b(i)&&"oneOf"===i._vueTypes_name&&i.type){r=r.concat(i.type);continue}if(h(i.validator)&&(t=!0),!0===i.type||!i.type){d('oneOfType - invalid usage of "true" or "null" as types.');continue}r=r.concat(i.type);}else r.push(i);}r=r.filter((e,t)=>r.indexOf(e)===t);const n=r.length>0?r:null;return j("oneOfType",t?{type:n,validator(t){const r=[],n=e.some(e=>{const n=m(b(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return "string"==typeof n&&r.push(n),!0===n});return n||d(`oneOfType - provided value does not match any of the ${r.length} passed-in validators:\n${$(r.join("\n"))}`),n}}:{type:n})}function F(e){return j("arrayOf",{type:Array,validator(t){let r="";const n=t.every(t=>(r=m(e,t,!0),!0===r));return n||d(`arrayOf - value validation error:\n${$(r)}`),n}})}function Y(e){return j("instanceOf",{type:e})}function B(e){return j("objectOf",{type:Object,validator(t){let r="";const n=Object.keys(t).every(n=>(r=m(e,t[n],!0),!0===r));return n||d(`objectOf - value validation error:\n${$(r)}`),n}})}function I(e){const t=Object.keys(e),r=t.filter(t=>{var r;return !(null===(r=e[t])||void 0===r||!r.required)}),n=j("shape",{type:Object,validator(n){if(!c(n))return !1;const i=Object.keys(n);if(r.length>0&&r.some(e=>-1===i.indexOf(e))){const e=r.filter(e=>-1===i.indexOf(e));return d(1===e.length?`shape - required property "${e[0]}" is not defined.`:`shape - required properties "${e.join('", "')}" are not defined.`),!1}return i.every(r=>{if(-1===t.indexOf(r))return !0===this._vueTypes_isLoose||(d(`shape - shape definition does not include a "${r}" property. Allowed keys: "${t.join('", "')}".`),!1);const i=m(e[r],n[r],!0);return "string"==typeof i&&d(`shape - "${r}" property validation error:\n ${$(i)}`),!0===i})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),n}const J=["name","validate","getter"],M=/*#__PURE__*/(()=>{var e,t;return t=e=class{static get any(){return w()}static get func(){return P().def(this.defaults.func)}static get bool(){return x().def(this.defaults.bool)}static get string(){return E().def(this.defaults.string)}static get number(){return N().def(this.defaults.number)}static get array(){return q().def(this.defaults.array)}static get object(){return A().def(this.defaults.object)}static get integer(){return V().def(this.defaults.integer)}static get symbol(){return S()}static extend(e){if(v(e))return e.forEach(e=>this.extend(e)),this;const{name:t,validate:n=!1,getter:i=!1}=e,o=r(e,J);if(p(this,t))throw new TypeError(`[VueTypes error]: Type "${t}" already defined`);const{type:a}=o;if(b(a))return delete o.type,Object.defineProperty(this,t,i?{get:()=>T(t,a,o)}:{value(...e){const r=T(t,a,o);return r.validator&&(r.validator=r.validator.bind(r,...e)),r}});let s;return s=i?{get(){const e=Object.assign({},o);return n?_(t,e):j(t,e)},enumerable:!0}:{value(...e){const r=Object.assign({},o);let i;return i=n?_(t,r):j(t,r),r.validator&&(i.validator=r.validator.bind(i,...e)),i},enumerable:!0},Object.defineProperty(this,t,s)}},e.defaults={},e.sensibleDefaults=void 0,e.config=n,e.custom=k,e.oneOf=D,e.instanceOf=Y,e.oneOfType=L,e.arrayOf=F,e.objectOf=B,e.shape=I,e.utils={validate:(e,t)=>!0===m(t,e,!0),toType:(e,t,r=!1)=>r?_(e,t):j(e,t)},t})();function R(e={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var r,n;return n=r=class extends M{static get sensibleDefaults(){return t({},this.defaults)}static set sensibleDefaults(r){this.defaults=!1!==r?t({},!0!==r?r:e):{};}},r.defaults=t({},e),n}class z extends(R()){}
41
+ function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e},t.apply(this,arguments)}function r(e,t){if(null==e)return {};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}const n={silent:!1,logLevel:"warn"},i=["validator"],o=Object.prototype,a=o.toString,s=o.hasOwnProperty,u=/^\s*function (\w+)/;function l(e){var t;const r=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(r){const e=r.toString().match(u);return e?e[1]:""}return ""}const c=isPlainObject,f=e=>e;let d=f;if("production"!==process.env.NODE_ENV){const e="undefined"!=typeof console;d=e?function(e,t=n.logLevel){!1===n.silent&&console[t](`[VueTypes warn]: ${e}`);}:f;}const p=(e,t)=>s.call(e,t),y=Number.isInteger||function(e){return "number"==typeof e&&isFinite(e)&&Math.floor(e)===e},v=Array.isArray||function(e){return "[object Array]"===a.call(e)},h=e=>"[object Function]"===a.call(e),b=e=>c(e)&&p(e,"_vueTypes_name"),g=e=>c(e)&&(p(e,"type")||["_vueTypes_name","validator","default","required"].some(t=>p(e,t)));function O(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function m(e,t,r=!1){let n,i=!0,o="";n=c(e)?e:{type:e};const a=b(n)?n._vueTypes_name+" - ":"";if(g(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return i;if(!n.required&&void 0===t)return i;v(n.type)?(i=n.type.some(e=>!0===m(e,t,!0)),o=n.type.map(e=>l(e)).join(" or ")):(o=l(n),i="Array"===o?v(t):"Object"===o?c(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return "";const t=e.constructor.toString().match(u);return t?t[1]:""}(t)===o:t instanceof n.type);}if(!i){const e=`${a}value "${t}" should be of type "${o}"`;return !1===r?(d(e),!1):e}if(p(n,"validator")&&h(n.validator)){const e=d,o=[];if(d=e=>{o.push(e);},i=n.validator(t),d=e,!i){const e=(o.length>1?"* ":"")+o.join("\n* ");return o.length=0,!1===r?(d(e),i):e}}return i}function j(e,t){const r=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get(){return this.required=!0,this}},def:{value(e){return void 0===e?(p(this,"default")&&delete this.default,this):h(e)||!0===m(this,e,!0)?(this.default=v(e)?()=>[...e]:c(e)?()=>Object.assign({},e):e,this):(d(`${this._vueTypes_name} - invalid default value: "${e}"`),this)}}}),{validator:n}=r;return h(n)&&(r.validator=O(n,r)),r}function _(e,t){const r=j(e,t);return Object.defineProperty(r,"validate",{value(e){return h(this.validator)&&d(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:\n${JSON.stringify(this)}`),this.validator=O(e,this),this}})}function T(e,t,n){const o=function(e){const t={};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=Object.getOwnPropertyDescriptor(e,r);}),Object.defineProperties({},t)}(t);if(o._vueTypes_name=e,!c(n))return o;const{validator:a}=n,s=r(n,i);if(h(a)){let{validator:e}=o;e&&(e=null!==(l=(u=e).__original)&&void 0!==l?l:u),o.validator=O(e?function(t){return e.call(this,t)&&a.call(this,t)}:a,o);}var u,l;return Object.assign(o,s)}function $(e){return e.replace(/^(?!\s*$)/gm," ")}const w=()=>_("any",{}),P=()=>_("function",{type:Function}),x=()=>_("boolean",{type:Boolean}),E=()=>_("string",{type:String}),N=()=>_("number",{type:Number}),q=()=>_("array",{type:Array}),A=()=>_("object",{type:Object}),V=()=>j("integer",{type:Number,validator:e=>y(e)}),S=()=>j("symbol",{validator:e=>"symbol"==typeof e});function D(e,t="custom validation failed"){if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return j(e.name||"<<anonymous function>>",{type:null,validator(r){const n=e(r);return n||d(`${this._vueTypes_name} - ${t}`),n}})}function L(e){if(!v(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");const t=`oneOf - value should be one of "${e.join('", "')}".`,r=e.reduce((e,t)=>{if(null!=t){const r=t.constructor;-1===e.indexOf(r)&&e.push(r);}return e},[]);return j("oneOf",{type:r.length>0?r:void 0,validator(r){const n=-1!==e.indexOf(r);return n||d(t),n}})}function F(e){if(!v(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");let t=!1,r=[];for(let n=0;n<e.length;n+=1){const i=e[n];if(g(i)){if(b(i)&&"oneOf"===i._vueTypes_name&&i.type){r=r.concat(i.type);continue}if(h(i.validator)&&(t=!0),!0===i.type||!i.type){d('oneOfType - invalid usage of "true" or "null" as types.');continue}r=r.concat(i.type);}else r.push(i);}r=r.filter((e,t)=>r.indexOf(e)===t);const n=r.length>0?r:null;return j("oneOfType",t?{type:n,validator(t){const r=[],n=e.some(e=>{const n=m(b(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return "string"==typeof n&&r.push(n),!0===n});return n||d(`oneOfType - provided value does not match any of the ${r.length} passed-in validators:\n${$(r.join("\n"))}`),n}}:{type:n})}function Y(e){return j("arrayOf",{type:Array,validator(t){let r="";const n=t.every(t=>(r=m(e,t,!0),!0===r));return n||d(`arrayOf - value validation error:\n${$(r)}`),n}})}function B(e){return j("instanceOf",{type:e})}function I(e){return j("objectOf",{type:Object,validator(t){let r="";const n=Object.keys(t).every(n=>(r=m(e,t[n],!0),!0===r));return n||d(`objectOf - value validation error:\n${$(r)}`),n}})}function J(e){const t=Object.keys(e),r=t.filter(t=>{var r;return !(null===(r=e[t])||void 0===r||!r.required)}),n=j("shape",{type:Object,validator(n){if(!c(n))return !1;const i=Object.keys(n);if(r.length>0&&r.some(e=>-1===i.indexOf(e))){const e=r.filter(e=>-1===i.indexOf(e));return d(1===e.length?`shape - required property "${e[0]}" is not defined.`:`shape - required properties "${e.join('", "')}" are not defined.`),!1}return i.every(r=>{if(-1===t.indexOf(r))return !0===this._vueTypes_isLoose||(d(`shape - shape definition does not include a "${r}" property. Allowed keys: "${t.join('", "')}".`),!1);const i=m(e[r],n[r],!0);return "string"==typeof i&&d(`shape - "${r}" property validation error:\n ${$(i)}`),!0===i})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),n}const M=["name","validate","getter"],R=/*#__PURE__*/(()=>{var e;return (e=class{static get any(){return w()}static get func(){return P().def(this.defaults.func)}static get bool(){return x().def(this.defaults.bool)}static get string(){return E().def(this.defaults.string)}static get number(){return N().def(this.defaults.number)}static get array(){return q().def(this.defaults.array)}static get object(){return A().def(this.defaults.object)}static get integer(){return V().def(this.defaults.integer)}static get symbol(){return S()}static get nullable(){return {type:null}}static extend(e){if(v(e))return e.forEach(e=>this.extend(e)),this;const{name:t,validate:n=!1,getter:i=!1}=e,o=r(e,M);if(p(this,t))throw new TypeError(`[VueTypes error]: Type "${t}" already defined`);const{type:a}=o;if(b(a))return delete o.type,Object.defineProperty(this,t,i?{get:()=>T(t,a,o)}:{value(...e){const r=T(t,a,o);return r.validator&&(r.validator=r.validator.bind(r,...e)),r}});let s;return s=i?{get(){const e=Object.assign({},o);return n?_(t,e):j(t,e)},enumerable:!0}:{value(...e){const r=Object.assign({},o);let i;return i=n?_(t,r):j(t,r),r.validator&&(i.validator=r.validator.bind(i,...e)),i},enumerable:!0},Object.defineProperty(this,t,s)}}).defaults={},e.sensibleDefaults=void 0,e.config=n,e.custom=D,e.oneOf=L,e.instanceOf=B,e.oneOfType=F,e.arrayOf=Y,e.objectOf=I,e.shape=J,e.utils={validate:(e,t)=>!0===m(t,e,!0),toType:(e,t,r=!1)=>r?_(e,t):j(e,t)},e})();function z(e={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var r;return (r=class extends R{static get sensibleDefaults(){return t({},this.defaults)}static set sensibleDefaults(r){this.defaults=!1!==r?t({},!0!==r?r:e):{};}}).defaults=t({},e),r}class C extends(z()){}
42
42
 
43
43
  const timelineProps = () => ({
44
- mode: z.oneOf(['left', 'right']).def('left'),
45
- size: z.oneOf(['normal', 'small']).def('normal'),
46
- labelWidth: z.string.def(''),
44
+ mode: C.oneOf(['left', 'right']).def('left'),
45
+ size: C.oneOf(['normal', 'small']).def('normal'),
46
+ labelWidth: C.string.def(''),
47
47
  });
48
48
  const timelineItemProps = () => ({
49
- color: z.oneOf(['blue', 'red', 'green', 'gray']).def('blue'),
50
- dot: z.any.def(''),
51
- label: z.any.def(''),
49
+ color: C.oneOf(['blue', 'red', 'green', 'gray']).def('blue'),
50
+ dot: C.any.def(''),
51
+ label: C.any.def(''),
52
52
  });
53
53
 
54
54
  var _export_sfc = (sfc, props) => {
@@ -165,6 +165,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
165
165
  });
166
166
  var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "timeline-item.vue"]]);
167
167
 
168
+ Timeline.Item = TimelineItem;
168
169
  const BmTimeline = withInstall.withInstall(Timeline);
169
170
  const BmTimelineItem = withInstall.withInstall(TimelineItem);
170
171
 
@@ -0,0 +1,2 @@
1
+ export function setup(): void;
2
+ export const teardown: () => import("xhr-mock/lib/XHRMock").XHRMock;
@@ -0,0 +1,7 @@
1
+ export function successRequest({ onSuccess, file }: {
2
+ onSuccess: any;
3
+ file: any;
4
+ }): void;
5
+ export function errorRequest({ onError }: {
6
+ onError: any;
7
+ }): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -44,16 +44,19 @@ const _sfc_main$1 = {
44
44
  isShow: false,
45
45
  openShow: false
46
46
  });
47
- const observer = new IntersectionObserver((entries) => {
48
- entries.forEach((item) => {
49
- if (item.intersectionRatio > 0.3) {
50
- observerDom();
51
- observer.disconnect();
52
- }
53
- });
54
- }, {
55
- threshold: 0.3
56
- });
47
+ const observer = new IntersectionObserver(
48
+ (entries) => {
49
+ entries.forEach((item) => {
50
+ if (item.intersectionRatio > 0.3) {
51
+ observerDom();
52
+ observer.disconnect();
53
+ }
54
+ });
55
+ },
56
+ {
57
+ threshold: 0.3
58
+ }
59
+ );
57
60
  function observerDom() {
58
61
  if (props.line === 1) {
59
62
  if (mySelf.value.scrollWidth > mySelf.value.clientWidth) {
@@ -69,16 +72,20 @@ const _sfc_main$1 = {
69
72
  observer.disconnect();
70
73
  });
71
74
  let mySelf = vue.ref();
72
- vue.watch(() => props.showAlways, function(showAlways) {
73
- if (showAlways)
74
- state.openShow = showAlways;
75
- mySelf.value && observer.unobserve(mySelf.value);
76
- vue.nextTick(function() {
77
- mySelf.value && observer.observe(mySelf.value);
78
- });
79
- }, {
80
- immediate: true
81
- });
75
+ vue.watch(
76
+ () => props.showAlways,
77
+ function(showAlways) {
78
+ if (showAlways)
79
+ state.openShow = showAlways;
80
+ mySelf.value && observer.unobserve(mySelf.value);
81
+ vue.nextTick(function() {
82
+ mySelf.value && observer.observe(mySelf.value);
83
+ });
84
+ },
85
+ {
86
+ immediate: true
87
+ }
88
+ );
82
89
  const handleVisibleChange = (val) => {
83
90
  state.isShow = !state.openShow ? false : val;
84
91
  };
@@ -277,15 +284,25 @@ const _sfc_main = {
277
284
  disabled: false,
278
285
  async customRequest({ file, fileField, data }) {
279
286
  if (file.size > state.extraConfigs.maxSize * 1024 * 1024) {
280
- return methods.uploadError(new Error(props.customErrors?.maxSize || `\u4E0D\u80FD\u4E0A\u4F20\u5927\u4E8E${state.extraConfigs.maxSize}M\u7684\u6587\u4EF6`));
287
+ return methods.uploadError(
288
+ new Error(
289
+ props.customErrors?.maxSize || `\u4E0D\u80FD\u4E0A\u4F20\u5927\u4E8E${state.extraConfigs.maxSize}M\u7684\u6587\u4EF6`
290
+ )
291
+ );
281
292
  }
282
293
  if (Object.keys(state.fileList).length >= state.extraConfigs.maxCount) {
283
- return methods.uploadError(new Error(props.customErrors?.maxCount || `\u4E0D\u80FD\u4E0A\u4F20\u591A\u4E8E${state.extraConfigs.maxCount}\u4E2A\u6587\u4EF6`));
294
+ return methods.uploadError(
295
+ new Error(
296
+ props.customErrors?.maxCount || `\u4E0D\u80FD\u4E0A\u4F20\u591A\u4E8E${state.extraConfigs.maxCount}\u4E2A\u6587\u4EF6`
297
+ )
298
+ );
284
299
  }
285
300
  let name = file.name;
286
301
  let fileFormat = name.split(".").pop();
287
302
  if (!state.uploadConfigs.accept.includes(`.${fileFormat}`)) {
288
- return methods.uploadError(new Error(props.customErrors?.format || `\u4E0D\u80FD\u4E0A\u4F20\u8BE5\u7C7B\u578B\u6587\u4EF6`));
303
+ return methods.uploadError(
304
+ new Error(props.customErrors?.format || `\u4E0D\u80FD\u4E0A\u4F20\u8BE5\u7C7B\u578B\u6587\u4EF6`)
305
+ );
289
306
  }
290
307
  state.fileList[file.uid] = {
291
308
  uid: file.uid,
@@ -382,7 +399,9 @@ const _sfc_main = {
382
399
  async deleteFile(uid) {
383
400
  let targetFile = state.fileList[uid];
384
401
  delete state.fileList[uid];
385
- const index = state.uploadedList.findIndex((ele) => ele.url === targetFile.url);
402
+ const index = state.uploadedList.findIndex(
403
+ (ele) => ele.url === targetFile.url
404
+ );
386
405
  if (index !== -1) {
387
406
  state.uploadedList.splice(index, 1);
388
407
  }
@@ -448,64 +467,78 @@ const _sfc_main = {
448
467
  }
449
468
  },
450
469
  handleReject(e) {
451
- return methods.uploadError(new Error(props.customErrors?.format || `\u4E0D\u80FD\u4E0A\u4F20\u8BE5\u7C7B\u578B\u6587\u4EF6`));
470
+ return methods.uploadError(
471
+ new Error(props.customErrors?.format || `\u4E0D\u80FD\u4E0A\u4F20\u8BE5\u7C7B\u578B\u6587\u4EF6`)
472
+ );
452
473
  }
453
474
  };
454
- vue.watch(() => props.defaultList, function(list) {
455
- if (list?.length) {
456
- list.forEach((item) => {
457
- if (!item.uid) {
458
- item.uid = utils.getuid();
459
- }
460
- });
461
- list.forEach(function(item) {
462
- let uid = item.uid || utils.getuid();
463
- if (!item.url.includes("http") && !item.url.includes(CLOUND_PRE))
464
- item.url = props.cloudReadUrl + item.url;
465
- state.fileList[uid] = {
466
- uid,
467
- name: item.name,
468
- url: item.url,
469
- type: item.type || "png",
470
- progress: 100,
471
- isDoneDeloy: true
472
- };
473
- if (!state.uploadedList.find((item2) => item2.uid === uid)) {
474
- state.uploadedList.push(item);
475
- }
476
- });
477
- } else {
478
- state.fileList = {};
479
- state.uploadedList = [];
475
+ vue.watch(
476
+ () => props.defaultList,
477
+ function(list) {
478
+ if (list?.length) {
479
+ list.forEach((item) => {
480
+ if (!item.uid) {
481
+ item.uid = utils.getuid();
482
+ }
483
+ });
484
+ list.forEach(function(item) {
485
+ let uid = item.uid || utils.getuid();
486
+ if (!item.url.includes("http") && !item.url.includes(CLOUND_PRE))
487
+ item.url = props.cloudReadUrl + item.url;
488
+ state.fileList[uid] = {
489
+ uid,
490
+ name: item.name,
491
+ url: item.url,
492
+ type: item.type || "png",
493
+ progress: 100,
494
+ isDoneDeloy: true
495
+ };
496
+ if (!state.uploadedList.find((item2) => item2.uid === uid)) {
497
+ state.uploadedList.push(item);
498
+ }
499
+ });
500
+ } else {
501
+ state.fileList = {};
502
+ state.uploadedList = [];
503
+ }
504
+ },
505
+ {
506
+ immediate: true
480
507
  }
481
- }, {
482
- immediate: true
483
- });
484
- vue.watch([() => props.uploadProps, () => props.extraProps], function([config, extra]) {
485
- state.uploadConfigs = {
486
- ...state.uploadConfigs,
487
- ...config,
488
- showUploadList: false
489
- };
490
- state.extraConfigs = {
491
- ...state.extraConfigs,
492
- ...extra
493
- };
494
- }, {
495
- immediate: true,
496
- deep: true
497
- });
508
+ );
509
+ vue.watch(
510
+ [() => props.uploadProps, () => props.extraProps],
511
+ function([config, extra]) {
512
+ state.uploadConfigs = {
513
+ ...state.uploadConfigs,
514
+ ...config,
515
+ showUploadList: false
516
+ };
517
+ state.extraConfigs = {
518
+ ...state.extraConfigs,
519
+ ...extra
520
+ };
521
+ },
522
+ {
523
+ immediate: true,
524
+ deep: true
525
+ }
526
+ );
498
527
  const uploadDisabled = vue.computed(() => {
499
528
  if (props.uploadProps.disabled || Object.keys(state.fileList).length >= state.extraConfigs.maxCount) {
500
529
  return true;
501
530
  }
502
531
  return false;
503
532
  });
504
- vue.watch(() => uploadDisabled.value, (value) => {
505
- emit("updateDisabledStatus", value);
506
- }, {
507
- immediate: true
508
- });
533
+ vue.watch(
534
+ () => uploadDisabled.value,
535
+ (value) => {
536
+ emit("updateDisabledStatus", value);
537
+ },
538
+ {
539
+ immediate: true
540
+ }
541
+ );
509
542
  const isUploading = vue.computed(() => {
510
543
  let ret = false;
511
544
  let fileList = state.fileList || {};
@@ -516,11 +549,15 @@ const _sfc_main = {
516
549
  });
517
550
  return ret;
518
551
  });
519
- vue.watch(() => isUploading.value, (value) => {
520
- emit("updateIsUploadingStatus", value);
521
- }, {
522
- immediate: true
523
- });
552
+ vue.watch(
553
+ () => isUploading.value,
554
+ (value) => {
555
+ emit("updateIsUploadingStatus", value);
556
+ },
557
+ {
558
+ immediate: true
559
+ }
560
+ );
524
561
  return {
525
562
  ...vue.toRefs(state),
526
563
  icons,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bm-admin-ui",
3
- "version": "1.0.38-alpha",
3
+ "version": "1.0.40-alpha",
4
4
  "private": false,
5
5
  "description": "An Admin Component Library for Bm",
6
6
  "license": "UNLICENSED",