@company-ui/autocomplete-core
Advanced tools
Comparing version 1.3.0 to 1.4.0
/*! | ||
* @company-ui/autocomplete-core v1.3.0 | ||
* @company-ui/autocomplete-core v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
@@ -69,3 +69,3 @@ * Released under the MIT License. | ||
/*! | ||
* @company-ui/shared v1.3.0 | ||
* @company-ui/shared v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
@@ -193,10 +193,11 @@ * Released under the MIT License. | ||
var queryQccOpenAPI = function (keyword, options) { return __awaiter(void 0, void 0, void 0, function () { | ||
var searchUrl, url, res, json, result; | ||
var timestamp, searchUrl, url, res, json, result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (keyword.length < 2) { | ||
if (keyword.length < 2 || keyword.length > 100) { | ||
return [2 /*return*/, []]; | ||
} | ||
searchUrl = 'https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}'; | ||
timestamp = Math.floor(Date.now() / 1e3); | ||
searchUrl = "https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}&v=v1.0&r=/company/getCompanyName&t=".concat(timestamp); | ||
url = getSearchUrl(keyword, searchUrl, options.searchUrl); | ||
@@ -203,0 +204,0 @@ return [4 /*yield*/, fetch(url, { |
@@ -1,7 +0,7 @@ | ||
"use strict";function e(e,t,r,n){return new(r||(r=Promise))((function(c,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function i(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?c(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,i)}s((n=n.apply(e,t||[])).next())}))}function t(e,t){var r,n,c,o,a={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(r=1,n&&(c=2&i[0]?n.return:i[0]?n.throw||((c=n.return)&&c.call(n),0):n.next)&&!(c=c.call(n,i[1])).done)return c;switch(n=0,c&&(i=[2&i[0],c.value]),i[0]){case 0:case 1:c=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(c=a.trys,(c=c.length>0&&c[c.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!c||i[1]>c[0]&&i[1]<c[3])){a.label=i[1];break}if(6===i[0]&&a.label<c[1]){a.label=c[1],c=i;break}if(c&&a.label<c[2]){a.label=c[2],a.ops.push(i);break}c[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=c=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}"function"==typeof SuppressedError&&SuppressedError; | ||
"use strict";function e(e,t,r,n){return new(r||(r=Promise))((function(o,c){function a(e){try{s(n.next(e))}catch(e){c(e)}}function i(e){try{s(n.throw(e))}catch(e){c(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,i)}s((n=n.apply(e,t||[])).next())}))}function t(e,t){var r,n,o,c,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return c={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function i(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;c&&(c=0,i[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}"function"==typeof SuppressedError&&SuppressedError; | ||
/*! | ||
* @company-ui/shared v1.3.0 | ||
* @company-ui/shared v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
* Released under the MIT License. | ||
*/ | ||
var r=function(e,t,r){return e.replace(new RegExp(t,"g"),r)},n=function(e){try{var t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return[]}},c=["https://image.qcc.com/logo/{id}.jpg","https://image.qcc.com/auto/{id}.jpg"],o=function(n,c){return e(void 0,void 0,void 0,(function(){var e,o,a,i,s,u,l;return t(this,(function(t){switch(t.label){case 0:e=0,o=c,t.label=1;case 1:if(!(e<o.length))return[3,8];a=o[e],t.label=2;case 2:return t.trys.push([2,6,,7]),i=r(a,"{id}",n),[4,fetch(i)];case 3:return 200!==(s=t.sent()).status?[3,5]:[4,s.blob()];case 4:return u=t.sent(),[2,URL.createObjectURL(u)];case 5:return[3,7];case 6:return l=t.sent(),console.error(l),[3,7];case 7:return e++,[3,1];case 8:return[2,""]}}))}))},a=function(e,t,n){return r(n||t,"{keyword}",e)},i=function(r,n){return e(void 0,void 0,void 0,(function(){var e,c,o;return t(this,(function(t){switch(t.label){case 0:return r.length<2?[2,[]]:("https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}",e=a(r,"https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}",n.searchUrl),[4,fetch(e,{method:"GET",mode:"cors",headers:{Referer:"https://c.qcc.com/"}})]);case 1:return[4,t.sent().json()];case 2:return c=t.sent(),o=[],"200"!==c.status?[2,o]:[2,c.result.map((function(e){return{name:e.companyName,id:e.keyNo}}))]}}))}))},s=function(r,n){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return r.length<2||r.length>=100?[2,[]]:("https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",e=a(r,"https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",n.searchUrl),[4,fetch(e,{method:"GET",mode:"cors"})]);case 1:return[4,t.sent().json()];case 2:return[2,t.sent().map((function(e){return{name:e.name,id:e.domain,avatar:e.logo}}))]}}))}))},u=function(e){if(!e.enabled||!e.key)return[];var t=("localStorage"===e.type?localStorage:sessionStorage).getItem(e.key)||"";return n(t)};exports.addHistory=function(e,t){if(t.enabled&&t.key){var r="localStorage"===t.type?localStorage:sessionStorage,n=u(t),c=n.findIndex((function(t){return t.id===e.id}));c>-1&&n.splice(c,1),n.splice(0,0,e),r.setItem(t.key,JSON.stringify(n.length>5?n.slice(0,5):n))}},exports.getHistory=u,exports.getImageData=o,exports.handleAvatar=function(r,n){return e(void 0,void 0,void 0,(function(){var e,a,i;return t(this,(function(t){switch(t.label){case 0:return e=r.dataset.id||"",n.avatarUrl?(a=r,[4,o(e,[n.avatarUrl])]):[3,2];case 1:return a.src=t.sent(),[2];case 2:return"qcc_open"===n.api?[3,3]:[3,5];case 3:return i=r,[4,o(e,c)];case 4:return i.src=t.sent(),[3,5];case 5:return[2]}}))}))},exports.handleQueryData=function(r,n){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:switch(n.api){case"qcc_open":return[3,1];case"clearbit":return[3,3]}return[3,5];case 1:return[4,i(r,n)];case 2:case 4:return[2,e.sent()];case 3:return[4,s(r,n)];case 5:return[2,[]]}}))}))},exports.initialOptions={target:"body",api:"qcc_open",queryDelay:500,placeholder:"请输入企业名称或统一社会信用代码",clearable:!0,backFill:!1,clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg>',autoFocus:!0,history:{enabled:!0,type:"localStorage",key:"company-history",showClear:!0,itemIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="history" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z"></path></svg>',clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="delete" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path></svg>'},onFetch:function(){},onSelect:function(){},onClear:function(){},onFocus:function(){},onBlur:function(){},onDropdownVisibleChange:function(){},showSubmitButton:!0,submitButtonLabel:"Submit",offsetTop:5,autoFlip:!1,submitCallback:function(){}},exports.removeHistory=function(e){("localStorage"===e.type?localStorage:sessionStorage).removeItem(e.key)}; | ||
var r=function(e,t,r){return e.replace(new RegExp(t,"g"),r)},n=function(e){try{var t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return[]}},o=["https://image.qcc.com/logo/{id}.jpg","https://image.qcc.com/auto/{id}.jpg"],c=function(n,o){return e(void 0,void 0,void 0,(function(){var e,c,a,i,s,u,l;return t(this,(function(t){switch(t.label){case 0:e=0,c=o,t.label=1;case 1:if(!(e<c.length))return[3,8];a=c[e],t.label=2;case 2:return t.trys.push([2,6,,7]),i=r(a,"{id}",n),[4,fetch(i)];case 3:return 200!==(s=t.sent()).status?[3,5]:[4,s.blob()];case 4:return u=t.sent(),[2,URL.createObjectURL(u)];case 5:return[3,7];case 6:return l=t.sent(),console.error(l),[3,7];case 7:return e++,[3,1];case 8:return[2,""]}}))}))},a=function(e,t,n){return r(n||t,"{keyword}",e)},i=function(r,n){return e(void 0,void 0,void 0,(function(){var e,o,c,i,s;return t(this,(function(t){switch(t.label){case 0:return r.length<2||r.length>100?[2,[]]:(e=Math.floor(Date.now()/1e3),o="https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}&v=v1.0&r=/company/getCompanyName&t=".concat(e),c=a(r,o,n.searchUrl),[4,fetch(c,{method:"GET",mode:"cors",headers:{Referer:"https://c.qcc.com/"}})]);case 1:return[4,t.sent().json()];case 2:return i=t.sent(),s=[],"200"!==i.status?[2,s]:[2,i.result.map((function(e){return{name:e.companyName,id:e.keyNo}}))]}}))}))},s=function(r,n){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return r.length<2||r.length>=100?[2,[]]:("https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",e=a(r,"https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",n.searchUrl),[4,fetch(e,{method:"GET",mode:"cors"})]);case 1:return[4,t.sent().json()];case 2:return[2,t.sent().map((function(e){return{name:e.name,id:e.domain,avatar:e.logo}}))]}}))}))},u=function(e){if(!e.enabled||!e.key)return[];var t=("localStorage"===e.type?localStorage:sessionStorage).getItem(e.key)||"";return n(t)};exports.addHistory=function(e,t){if(t.enabled&&t.key){var r="localStorage"===t.type?localStorage:sessionStorage,n=u(t),o=n.findIndex((function(t){return t.id===e.id}));o>-1&&n.splice(o,1),n.splice(0,0,e),r.setItem(t.key,JSON.stringify(n.length>5?n.slice(0,5):n))}},exports.getHistory=u,exports.getImageData=c,exports.handleAvatar=function(r,n){return e(void 0,void 0,void 0,(function(){var e,a,i;return t(this,(function(t){switch(t.label){case 0:return e=r.dataset.id||"",n.avatarUrl?(a=r,[4,c(e,[n.avatarUrl])]):[3,2];case 1:return a.src=t.sent(),[2];case 2:return"qcc_open"===n.api?[3,3]:[3,5];case 3:return i=r,[4,c(e,o)];case 4:return i.src=t.sent(),[3,5];case 5:return[2]}}))}))},exports.handleQueryData=function(r,n){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:switch(n.api){case"qcc_open":return[3,1];case"clearbit":return[3,3]}return[3,5];case 1:return[4,i(r,n)];case 2:case 4:return[2,e.sent()];case 3:return[4,s(r,n)];case 5:return[2,[]]}}))}))},exports.initialOptions={target:"body",api:"qcc_open",queryDelay:500,placeholder:"请输入企业名称或统一社会信用代码",clearable:!0,backFill:!1,clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg>',autoFocus:!0,history:{enabled:!0,type:"localStorage",key:"company-history",showClear:!0,itemIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="history" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z"></path></svg>',clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="delete" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path></svg>'},onFetch:function(){},onSelect:function(){},onClear:function(){},onFocus:function(){},onBlur:function(){},onDropdownVisibleChange:function(){},showSubmitButton:!0,submitButtonLabel:"Submit",offsetTop:5,autoFlip:!1,submitCallback:function(){}},exports.removeHistory=function(e){("localStorage"===e.type?localStorage:sessionStorage).removeItem(e.key)}; |
/*! | ||
* @company-ui/autocomplete-core v1.3.0 | ||
* @company-ui/autocomplete-core v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
@@ -67,3 +67,3 @@ * Released under the MIT License. | ||
/*! | ||
* @company-ui/shared v1.3.0 | ||
* @company-ui/shared v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
@@ -191,10 +191,11 @@ * Released under the MIT License. | ||
var queryQccOpenAPI = function (keyword, options) { return __awaiter(void 0, void 0, void 0, function () { | ||
var searchUrl, url, res, json, result; | ||
var timestamp, searchUrl, url, res, json, result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (keyword.length < 2) { | ||
if (keyword.length < 2 || keyword.length > 100) { | ||
return [2 /*return*/, []]; | ||
} | ||
searchUrl = 'https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}'; | ||
timestamp = Math.floor(Date.now() / 1e3); | ||
searchUrl = "https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}&v=v1.0&r=/company/getCompanyName&t=".concat(timestamp); | ||
url = getSearchUrl(keyword, searchUrl, options.searchUrl); | ||
@@ -201,0 +202,0 @@ return [4 /*yield*/, fetch(url, { |
@@ -1,7 +0,7 @@ | ||
function e(e,t,r,n){return new(r||(r=Promise))((function(c,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function i(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?c(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,i)}s((n=n.apply(e,t||[])).next())}))}function t(e,t){var r,n,c,o,a={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(r=1,n&&(c=2&i[0]?n.return:i[0]?n.throw||((c=n.return)&&c.call(n),0):n.next)&&!(c=c.call(n,i[1])).done)return c;switch(n=0,c&&(i=[2&i[0],c.value]),i[0]){case 0:case 1:c=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(c=a.trys,(c=c.length>0&&c[c.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!c||i[1]>c[0]&&i[1]<c[3])){a.label=i[1];break}if(6===i[0]&&a.label<c[1]){a.label=c[1],c=i;break}if(c&&a.label<c[2]){a.label=c[2],a.ops.push(i);break}c[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=c=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}"function"==typeof SuppressedError&&SuppressedError; | ||
function e(e,t,n,r){return new(n||(n=Promise))((function(c,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function i(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?c(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}u((r=r.apply(e,t||[])).next())}))}function t(e,t){var n,r,c,o,a={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,r&&(c=2&i[0]?r.return:i[0]?r.throw||((c=r.return)&&c.call(r),0):r.next)&&!(c=c.call(r,i[1])).done)return c;switch(r=0,c&&(i=[2&i[0],c.value]),i[0]){case 0:case 1:c=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(c=a.trys,(c=c.length>0&&c[c.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!c||i[1]>c[0]&&i[1]<c[3])){a.label=i[1];break}if(6===i[0]&&a.label<c[1]){a.label=c[1],c=i;break}if(c&&a.label<c[2]){a.label=c[2],a.ops.push(i);break}c[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=c=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}"function"==typeof SuppressedError&&SuppressedError; | ||
/*! | ||
* @company-ui/shared v1.3.0 | ||
* @company-ui/shared v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
* Released under the MIT License. | ||
*/ | ||
var r=function(e,t,r){return e.replace(new RegExp(t,"g"),r)},n=function(e){try{var t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return[]}},c=["https://image.qcc.com/logo/{id}.jpg","https://image.qcc.com/auto/{id}.jpg"],o=function(r,n){return e(void 0,void 0,void 0,(function(){var e,o,i;return t(this,(function(t){switch(t.label){case 0:return e=r.dataset.id||"",n.avatarUrl?(o=r,[4,a(e,[n.avatarUrl])]):[3,2];case 1:return o.src=t.sent(),[2];case 2:return"qcc_open"===n.api?[3,3]:[3,5];case 3:return i=r,[4,a(e,c)];case 4:return i.src=t.sent(),[3,5];case 5:return[2]}}))}))},a=function(n,c){return e(void 0,void 0,void 0,(function(){var e,o,a,i,s,u,l;return t(this,(function(t){switch(t.label){case 0:e=0,o=c,t.label=1;case 1:if(!(e<o.length))return[3,8];a=o[e],t.label=2;case 2:return t.trys.push([2,6,,7]),i=r(a,"{id}",n),[4,fetch(i)];case 3:return 200!==(s=t.sent()).status?[3,5]:[4,s.blob()];case 4:return u=t.sent(),[2,URL.createObjectURL(u)];case 5:return[3,7];case 6:return l=t.sent(),console.error(l),[3,7];case 7:return e++,[3,1];case 8:return[2,""]}}))}))},i=function(r,n){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:switch(n.api){case"qcc_open":return[3,1];case"clearbit":return[3,3]}return[3,5];case 1:return[4,u(r,n)];case 2:case 4:return[2,e.sent()];case 3:return[4,l(r,n)];case 5:return[2,[]]}}))}))},s=function(e,t,n){return r(n||t,"{keyword}",e)},u=function(r,n){return e(void 0,void 0,void 0,(function(){var e,c,o;return t(this,(function(t){switch(t.label){case 0:return r.length<2?[2,[]]:("https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}",e=s(r,"https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}",n.searchUrl),[4,fetch(e,{method:"GET",mode:"cors",headers:{Referer:"https://c.qcc.com/"}})]);case 1:return[4,t.sent().json()];case 2:return c=t.sent(),o=[],"200"!==c.status?[2,o]:[2,c.result.map((function(e){return{name:e.companyName,id:e.keyNo}}))]}}))}))},l=function(r,n){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return r.length<2||r.length>=100?[2,[]]:("https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",e=s(r,"https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",n.searchUrl),[4,fetch(e,{method:"GET",mode:"cors"})]);case 1:return[4,t.sent().json()];case 2:return[2,t.sent().map((function(e){return{name:e.name,id:e.domain,avatar:e.logo}}))]}}))}))},h=function(e,t){if(t.enabled&&t.key){var r="localStorage"===t.type?localStorage:sessionStorage,n=f(t),c=n.findIndex((function(t){return t.id===e.id}));c>-1&&n.splice(c,1),n.splice(0,0,e),r.setItem(t.key,JSON.stringify(n.length>5?n.slice(0,5):n))}},f=function(e){if(!e.enabled||!e.key)return[];var t=("localStorage"===e.type?localStorage:sessionStorage).getItem(e.key)||"";return n(t)},p=function(e){("localStorage"===e.type?localStorage:sessionStorage).removeItem(e.key)},d={target:"body",api:"qcc_open",queryDelay:500,placeholder:"请输入企业名称或统一社会信用代码",clearable:!0,backFill:!1,clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg>',autoFocus:!0,history:{enabled:!0,type:"localStorage",key:"company-history",showClear:!0,itemIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="history" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z"></path></svg>',clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="delete" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path></svg>'},onFetch:function(){},onSelect:function(){},onClear:function(){},onFocus:function(){},onBlur:function(){},onDropdownVisibleChange:function(){},showSubmitButton:!0,submitButtonLabel:"Submit",offsetTop:5,autoFlip:!1,submitCallback:function(){}};export{h as addHistory,f as getHistory,a as getImageData,o as handleAvatar,i as handleQueryData,d as initialOptions,p as removeHistory}; | ||
var n=function(e,t,n){return e.replace(new RegExp(t,"g"),n)},r=function(e){try{var t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return[]}},c=["https://image.qcc.com/logo/{id}.jpg","https://image.qcc.com/auto/{id}.jpg"],o=function(n,r){return e(void 0,void 0,void 0,(function(){var e,o,i;return t(this,(function(t){switch(t.label){case 0:return e=n.dataset.id||"",r.avatarUrl?(o=n,[4,a(e,[r.avatarUrl])]):[3,2];case 1:return o.src=t.sent(),[2];case 2:return"qcc_open"===r.api?[3,3]:[3,5];case 3:return i=n,[4,a(e,c)];case 4:return i.src=t.sent(),[3,5];case 5:return[2]}}))}))},a=function(r,c){return e(void 0,void 0,void 0,(function(){var e,o,a,i,u,s,l;return t(this,(function(t){switch(t.label){case 0:e=0,o=c,t.label=1;case 1:if(!(e<o.length))return[3,8];a=o[e],t.label=2;case 2:return t.trys.push([2,6,,7]),i=n(a,"{id}",r),[4,fetch(i)];case 3:return 200!==(u=t.sent()).status?[3,5]:[4,u.blob()];case 4:return s=t.sent(),[2,URL.createObjectURL(s)];case 5:return[3,7];case 6:return l=t.sent(),console.error(l),[3,7];case 7:return e++,[3,1];case 8:return[2,""]}}))}))},i=function(n,r){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:switch(r.api){case"qcc_open":return[3,1];case"clearbit":return[3,3]}return[3,5];case 1:return[4,s(n,r)];case 2:case 4:return[2,e.sent()];case 3:return[4,l(n,r)];case 5:return[2,[]]}}))}))},u=function(e,t,r){return n(r||t,"{keyword}",e)},s=function(n,r){return e(void 0,void 0,void 0,(function(){var e,c,o,a,i;return t(this,(function(t){switch(t.label){case 0:return n.length<2||n.length>100?[2,[]]:(e=Math.floor(Date.now()/1e3),c="https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}&v=v1.0&r=/company/getCompanyName&t=".concat(e),o=u(n,c,r.searchUrl),[4,fetch(o,{method:"GET",mode:"cors",headers:{Referer:"https://c.qcc.com/"}})]);case 1:return[4,t.sent().json()];case 2:return a=t.sent(),i=[],"200"!==a.status?[2,i]:[2,a.result.map((function(e){return{name:e.companyName,id:e.keyNo}}))]}}))}))},l=function(n,r){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return n.length<2||n.length>=100?[2,[]]:("https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",e=u(n,"https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",r.searchUrl),[4,fetch(e,{method:"GET",mode:"cors"})]);case 1:return[4,t.sent().json()];case 2:return[2,t.sent().map((function(e){return{name:e.name,id:e.domain,avatar:e.logo}}))]}}))}))},h=function(e,t){if(t.enabled&&t.key){var n="localStorage"===t.type?localStorage:sessionStorage,r=f(t),c=r.findIndex((function(t){return t.id===e.id}));c>-1&&r.splice(c,1),r.splice(0,0,e),n.setItem(t.key,JSON.stringify(r.length>5?r.slice(0,5):r))}},f=function(e){if(!e.enabled||!e.key)return[];var t=("localStorage"===e.type?localStorage:sessionStorage).getItem(e.key)||"";return r(t)},p=function(e){("localStorage"===e.type?localStorage:sessionStorage).removeItem(e.key)},d={target:"body",api:"qcc_open",queryDelay:500,placeholder:"请输入企业名称或统一社会信用代码",clearable:!0,backFill:!1,clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg>',autoFocus:!0,history:{enabled:!0,type:"localStorage",key:"company-history",showClear:!0,itemIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="history" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z"></path></svg>',clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="delete" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path></svg>'},onFetch:function(){},onSelect:function(){},onClear:function(){},onFocus:function(){},onBlur:function(){},onDropdownVisibleChange:function(){},showSubmitButton:!0,submitButtonLabel:"Submit",offsetTop:5,autoFlip:!1,submitCallback:function(){}};export{h as addHistory,f as getHistory,a as getImageData,o as handleAvatar,i as handleQueryData,d as initialOptions,p as removeHistory}; |
/*! | ||
* @company-ui/autocomplete-core v1.3.0 | ||
* @company-ui/autocomplete-core v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
@@ -70,3 +70,3 @@ * Released under the MIT License. | ||
/*! | ||
* @company-ui/shared v1.3.0 | ||
* @company-ui/shared v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
@@ -194,10 +194,11 @@ * Released under the MIT License. | ||
var queryQccOpenAPI = function (keyword, options) { return __awaiter(void 0, void 0, void 0, function () { | ||
var searchUrl, url, res, json, result; | ||
var timestamp, searchUrl, url, res, json, result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (keyword.length < 2) { | ||
if (keyword.length < 2 || keyword.length > 100) { | ||
return [2 /*return*/, []]; | ||
} | ||
searchUrl = 'https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}'; | ||
timestamp = Math.floor(Date.now() / 1e3); | ||
searchUrl = "https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}&v=v1.0&r=/company/getCompanyName&t=".concat(timestamp); | ||
url = getSearchUrl(keyword, searchUrl, options.searchUrl); | ||
@@ -204,0 +205,0 @@ return [4 /*yield*/, fetch(url, { |
@@ -1,7 +0,7 @@ | ||
var CompanyUIAutocompleteCore=function(e){"use strict";function t(e,t,r,n){return new(r||(r=Promise))((function(c,a){function o(e){try{s(n.next(e))}catch(e){a(e)}}function i(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?c(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,i)}s((n=n.apply(e,t||[])).next())}))}function r(e,t){var r,n,c,a,o={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(o=0)),o;)try{if(r=1,n&&(c=2&i[0]?n.return:i[0]?n.throw||((c=n.return)&&c.call(n),0):n.next)&&!(c=c.call(n,i[1])).done)return c;switch(n=0,c&&(i=[2&i[0],c.value]),i[0]){case 0:case 1:c=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(c=o.trys,(c=c.length>0&&c[c.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!c||i[1]>c[0]&&i[1]<c[3])){o.label=i[1];break}if(6===i[0]&&o.label<c[1]){o.label=c[1],c=i;break}if(c&&o.label<c[2]){o.label=c[2],o.ops.push(i);break}c[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=c=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}"function"==typeof SuppressedError&&SuppressedError; | ||
var CompanyUIAutocompleteCore=function(e){"use strict";function t(e,t,r,n){return new(r||(r=Promise))((function(c,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function i(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?c(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,i)}u((n=n.apply(e,t||[])).next())}))}function r(e,t){var r,n,c,a,o={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(o=0)),o;)try{if(r=1,n&&(c=2&i[0]?n.return:i[0]?n.throw||((c=n.return)&&c.call(n),0):n.next)&&!(c=c.call(n,i[1])).done)return c;switch(n=0,c&&(i=[2&i[0],c.value]),i[0]){case 0:case 1:c=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(c=o.trys,(c=c.length>0&&c[c.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!c||i[1]>c[0]&&i[1]<c[3])){o.label=i[1];break}if(6===i[0]&&o.label<c[1]){o.label=c[1],c=i;break}if(c&&o.label<c[2]){o.label=c[2],o.ops.push(i);break}c[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=c=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}"function"==typeof SuppressedError&&SuppressedError; | ||
/*! | ||
* @company-ui/shared v1.3.0 | ||
* @company-ui/shared v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
* Released under the MIT License. | ||
*/ | ||
var n=function(e,t,r){return e.replace(new RegExp(t,"g"),r)},c=function(e){try{var t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return[]}},a=["https://image.qcc.com/logo/{id}.jpg","https://image.qcc.com/auto/{id}.jpg"],o=function(e,c){return t(void 0,void 0,void 0,(function(){var t,a,o,i,s,u,l;return r(this,(function(r){switch(r.label){case 0:t=0,a=c,r.label=1;case 1:if(!(t<a.length))return[3,8];o=a[t],r.label=2;case 2:return r.trys.push([2,6,,7]),i=n(o,"{id}",e),[4,fetch(i)];case 3:return 200!==(s=r.sent()).status?[3,5]:[4,s.blob()];case 4:return u=r.sent(),[2,URL.createObjectURL(u)];case 5:return[3,7];case 6:return l=r.sent(),console.error(l),[3,7];case 7:return t++,[3,1];case 8:return[2,""]}}))}))},i=function(e,t,r){return n(r||t,"{keyword}",e)},s=function(e,n){return t(void 0,void 0,void 0,(function(){var t,c,a;return r(this,(function(r){switch(r.label){case 0:return e.length<2?[2,[]]:("https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}",t=i(e,"https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}",n.searchUrl),[4,fetch(t,{method:"GET",mode:"cors",headers:{Referer:"https://c.qcc.com/"}})]);case 1:return[4,r.sent().json()];case 2:return c=r.sent(),a=[],"200"!==c.status?[2,a]:[2,c.result.map((function(e){return{name:e.companyName,id:e.keyNo}}))]}}))}))},u=function(e,n){return t(void 0,void 0,void 0,(function(){var t;return r(this,(function(r){switch(r.label){case 0:return e.length<2||e.length>=100?[2,[]]:("https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",t=i(e,"https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",n.searchUrl),[4,fetch(t,{method:"GET",mode:"cors"})]);case 1:return[4,r.sent().json()];case 2:return[2,r.sent().map((function(e){return{name:e.name,id:e.domain,avatar:e.logo}}))]}}))}))},l=function(e){if(!e.enabled||!e.key)return[];var t=("localStorage"===e.type?localStorage:sessionStorage).getItem(e.key)||"";return c(t)};return e.addHistory=function(e,t){if(t.enabled&&t.key){var r="localStorage"===t.type?localStorage:sessionStorage,n=l(t),c=n.findIndex((function(t){return t.id===e.id}));c>-1&&n.splice(c,1),n.splice(0,0,e),r.setItem(t.key,JSON.stringify(n.length>5?n.slice(0,5):n))}},e.getHistory=l,e.getImageData=o,e.handleAvatar=function(e,n){return t(void 0,void 0,void 0,(function(){var t,c,i;return r(this,(function(r){switch(r.label){case 0:return t=e.dataset.id||"",n.avatarUrl?(c=e,[4,o(t,[n.avatarUrl])]):[3,2];case 1:return c.src=r.sent(),[2];case 2:return"qcc_open"===n.api?[3,3]:[3,5];case 3:return i=e,[4,o(t,a)];case 4:return i.src=r.sent(),[3,5];case 5:return[2]}}))}))},e.handleQueryData=function(e,n){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:switch(n.api){case"qcc_open":return[3,1];case"clearbit":return[3,3]}return[3,5];case 1:return[4,s(e,n)];case 2:case 4:return[2,t.sent()];case 3:return[4,u(e,n)];case 5:return[2,[]]}}))}))},e.initialOptions={target:"body",api:"qcc_open",queryDelay:500,placeholder:"请输入企业名称或统一社会信用代码",clearable:!0,backFill:!1,clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg>',autoFocus:!0,history:{enabled:!0,type:"localStorage",key:"company-history",showClear:!0,itemIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="history" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z"></path></svg>',clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="delete" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path></svg>'},onFetch:function(){},onSelect:function(){},onClear:function(){},onFocus:function(){},onBlur:function(){},onDropdownVisibleChange:function(){},showSubmitButton:!0,submitButtonLabel:"Submit",offsetTop:5,autoFlip:!1,submitCallback:function(){}},e.removeHistory=function(e){("localStorage"===e.type?localStorage:sessionStorage).removeItem(e.key)},e}({}); | ||
var n=function(e,t,r){return e.replace(new RegExp(t,"g"),r)},c=function(e){try{var t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return[]}},a=["https://image.qcc.com/logo/{id}.jpg","https://image.qcc.com/auto/{id}.jpg"],o=function(e,c){return t(void 0,void 0,void 0,(function(){var t,a,o,i,u,s,l;return r(this,(function(r){switch(r.label){case 0:t=0,a=c,r.label=1;case 1:if(!(t<a.length))return[3,8];o=a[t],r.label=2;case 2:return r.trys.push([2,6,,7]),i=n(o,"{id}",e),[4,fetch(i)];case 3:return 200!==(u=r.sent()).status?[3,5]:[4,u.blob()];case 4:return s=r.sent(),[2,URL.createObjectURL(s)];case 5:return[3,7];case 6:return l=r.sent(),console.error(l),[3,7];case 7:return t++,[3,1];case 8:return[2,""]}}))}))},i=function(e,t,r){return n(r||t,"{keyword}",e)},u=function(e,n){return t(void 0,void 0,void 0,(function(){var t,c,a,o,u;return r(this,(function(r){switch(r.label){case 0:return e.length<2||e.length>100?[2,[]]:(t=Math.floor(Date.now()/1e3),c="https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}&v=v1.0&r=/company/getCompanyName&t=".concat(t),a=i(e,c,n.searchUrl),[4,fetch(a,{method:"GET",mode:"cors",headers:{Referer:"https://c.qcc.com/"}})]);case 1:return[4,r.sent().json()];case 2:return o=r.sent(),u=[],"200"!==o.status?[2,u]:[2,o.result.map((function(e){return{name:e.companyName,id:e.keyNo}}))]}}))}))},s=function(e,n){return t(void 0,void 0,void 0,(function(){var t;return r(this,(function(r){switch(r.label){case 0:return e.length<2||e.length>=100?[2,[]]:("https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",t=i(e,"https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",n.searchUrl),[4,fetch(t,{method:"GET",mode:"cors"})]);case 1:return[4,r.sent().json()];case 2:return[2,r.sent().map((function(e){return{name:e.name,id:e.domain,avatar:e.logo}}))]}}))}))},l=function(e){if(!e.enabled||!e.key)return[];var t=("localStorage"===e.type?localStorage:sessionStorage).getItem(e.key)||"";return c(t)};return e.addHistory=function(e,t){if(t.enabled&&t.key){var r="localStorage"===t.type?localStorage:sessionStorage,n=l(t),c=n.findIndex((function(t){return t.id===e.id}));c>-1&&n.splice(c,1),n.splice(0,0,e),r.setItem(t.key,JSON.stringify(n.length>5?n.slice(0,5):n))}},e.getHistory=l,e.getImageData=o,e.handleAvatar=function(e,n){return t(void 0,void 0,void 0,(function(){var t,c,i;return r(this,(function(r){switch(r.label){case 0:return t=e.dataset.id||"",n.avatarUrl?(c=e,[4,o(t,[n.avatarUrl])]):[3,2];case 1:return c.src=r.sent(),[2];case 2:return"qcc_open"===n.api?[3,3]:[3,5];case 3:return i=e,[4,o(t,a)];case 4:return i.src=r.sent(),[3,5];case 5:return[2]}}))}))},e.handleQueryData=function(e,n){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:switch(n.api){case"qcc_open":return[3,1];case"clearbit":return[3,3]}return[3,5];case 1:return[4,u(e,n)];case 2:case 4:return[2,t.sent()];case 3:return[4,s(e,n)];case 5:return[2,[]]}}))}))},e.initialOptions={target:"body",api:"qcc_open",queryDelay:500,placeholder:"请输入企业名称或统一社会信用代码",clearable:!0,backFill:!1,clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg>',autoFocus:!0,history:{enabled:!0,type:"localStorage",key:"company-history",showClear:!0,itemIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="history" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z"></path></svg>',clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="delete" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path></svg>'},onFetch:function(){},onSelect:function(){},onClear:function(){},onFocus:function(){},onBlur:function(){},onDropdownVisibleChange:function(){},showSubmitButton:!0,submitButtonLabel:"Submit",offsetTop:5,autoFlip:!1,submitCallback:function(){}},e.removeHistory=function(e){("localStorage"===e.type?localStorage:sessionStorage).removeItem(e.key)},e}({}); |
/*! | ||
* @company-ui/autocomplete-core v1.3.0 | ||
* @company-ui/autocomplete-core v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
@@ -73,3 +73,3 @@ * Released under the MIT License. | ||
/*! | ||
* @company-ui/shared v1.3.0 | ||
* @company-ui/shared v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
@@ -197,10 +197,11 @@ * Released under the MIT License. | ||
var queryQccOpenAPI = function (keyword, options) { return __awaiter(void 0, void 0, void 0, function () { | ||
var searchUrl, url, res, json, result; | ||
var timestamp, searchUrl, url, res, json, result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (keyword.length < 2) { | ||
if (keyword.length < 2 || keyword.length > 100) { | ||
return [2 /*return*/, []]; | ||
} | ||
searchUrl = 'https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}'; | ||
timestamp = Math.floor(Date.now() / 1e3); | ||
searchUrl = "https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}&v=v1.0&r=/company/getCompanyName&t=".concat(timestamp); | ||
url = getSearchUrl(keyword, searchUrl, options.searchUrl); | ||
@@ -207,0 +208,0 @@ return [4 /*yield*/, fetch(url, { |
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CompanyUIAutocompleteCore={})}(this,(function(e){"use strict";function t(e,t,n,r){return new(n||(n=Promise))((function(o,c){function a(e){try{s(r.next(e))}catch(e){c(e)}}function i(e){try{s(r.throw(e))}catch(e){c(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}s((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,o,c,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return c={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function i(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c&&(c=0,i[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}"function"==typeof SuppressedError&&SuppressedError; | ||
/*! | ||
* @company-ui/shared v1.3.0 | ||
* @company-ui/shared v1.4.0 | ||
* (c) 2022-2023 Michael Sun | ||
* Released under the MIT License. | ||
*/ | ||
var r=function(e,t,n){return e.replace(new RegExp(t,"g"),n)},o=function(e){try{var t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return[]}},c=["https://image.qcc.com/logo/{id}.jpg","https://image.qcc.com/auto/{id}.jpg"],a=function(e,o){return t(void 0,void 0,void 0,(function(){var t,c,a,i,s,u,l;return n(this,(function(n){switch(n.label){case 0:t=0,c=o,n.label=1;case 1:if(!(t<c.length))return[3,8];a=c[t],n.label=2;case 2:return n.trys.push([2,6,,7]),i=r(a,"{id}",e),[4,fetch(i)];case 3:return 200!==(s=n.sent()).status?[3,5]:[4,s.blob()];case 4:return u=n.sent(),[2,URL.createObjectURL(u)];case 5:return[3,7];case 6:return l=n.sent(),console.error(l),[3,7];case 7:return t++,[3,1];case 8:return[2,""]}}))}))},i=function(e,t,n){return r(n||t,"{keyword}",e)},s=function(e,r){return t(void 0,void 0,void 0,(function(){var t,o,c;return n(this,(function(n){switch(n.label){case 0:return e.length<2?[2,[]]:("https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}",t=i(e,"https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}",r.searchUrl),[4,fetch(t,{method:"GET",mode:"cors",headers:{Referer:"https://c.qcc.com/"}})]);case 1:return[4,n.sent().json()];case 2:return o=n.sent(),c=[],"200"!==o.status?[2,c]:[2,o.result.map((function(e){return{name:e.companyName,id:e.keyNo}}))]}}))}))},u=function(e,r){return t(void 0,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return e.length<2||e.length>=100?[2,[]]:("https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",t=i(e,"https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",r.searchUrl),[4,fetch(t,{method:"GET",mode:"cors"})]);case 1:return[4,n.sent().json()];case 2:return[2,n.sent().map((function(e){return{name:e.name,id:e.domain,avatar:e.logo}}))]}}))}))},l=function(e){if(!e.enabled||!e.key)return[];var t=("localStorage"===e.type?localStorage:sessionStorage).getItem(e.key)||"";return o(t)};e.addHistory=function(e,t){if(t.enabled&&t.key){var n="localStorage"===t.type?localStorage:sessionStorage,r=l(t),o=r.findIndex((function(t){return t.id===e.id}));o>-1&&r.splice(o,1),r.splice(0,0,e),n.setItem(t.key,JSON.stringify(r.length>5?r.slice(0,5):r))}},e.getHistory=l,e.getImageData=a,e.handleAvatar=function(e,r){return t(void 0,void 0,void 0,(function(){var t,o,i;return n(this,(function(n){switch(n.label){case 0:return t=e.dataset.id||"",r.avatarUrl?(o=e,[4,a(t,[r.avatarUrl])]):[3,2];case 1:return o.src=n.sent(),[2];case 2:return"qcc_open"===r.api?[3,3]:[3,5];case 3:return i=e,[4,a(t,c)];case 4:return i.src=n.sent(),[3,5];case 5:return[2]}}))}))},e.handleQueryData=function(e,r){return t(void 0,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:switch(r.api){case"qcc_open":return[3,1];case"clearbit":return[3,3]}return[3,5];case 1:return[4,s(e,r)];case 2:case 4:return[2,t.sent()];case 3:return[4,u(e,r)];case 5:return[2,[]]}}))}))},e.initialOptions={target:"body",api:"qcc_open",queryDelay:500,placeholder:"请输入企业名称或统一社会信用代码",clearable:!0,backFill:!1,clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg>',autoFocus:!0,history:{enabled:!0,type:"localStorage",key:"company-history",showClear:!0,itemIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="history" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z"></path></svg>',clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="delete" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path></svg>'},onFetch:function(){},onSelect:function(){},onClear:function(){},onFocus:function(){},onBlur:function(){},onDropdownVisibleChange:function(){},showSubmitButton:!0,submitButtonLabel:"Submit",offsetTop:5,autoFlip:!1,submitCallback:function(){}},e.removeHistory=function(e){("localStorage"===e.type?localStorage:sessionStorage).removeItem(e.key)}})); | ||
var r=function(e,t,n){return e.replace(new RegExp(t,"g"),n)},o=function(e){try{var t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return[]}},c=["https://image.qcc.com/logo/{id}.jpg","https://image.qcc.com/auto/{id}.jpg"],a=function(e,o){return t(void 0,void 0,void 0,(function(){var t,c,a,i,s,u,l;return n(this,(function(n){switch(n.label){case 0:t=0,c=o,n.label=1;case 1:if(!(t<c.length))return[3,8];a=c[t],n.label=2;case 2:return n.trys.push([2,6,,7]),i=r(a,"{id}",e),[4,fetch(i)];case 3:return 200!==(s=n.sent()).status?[3,5]:[4,s.blob()];case 4:return u=n.sent(),[2,URL.createObjectURL(u)];case 5:return[3,7];case 6:return l=n.sent(),console.error(l),[3,7];case 7:return t++,[3,1];case 8:return[2,""]}}))}))},i=function(e,t,n){return r(n||t,"{keyword}",e)},s=function(e,r){return t(void 0,void 0,void 0,(function(){var t,o,c,a,s;return n(this,(function(n){switch(n.label){case 0:return e.length<2||e.length>100?[2,[]]:(t=Math.floor(Date.now()/1e3),o="https://c.qcc.com/embed/api/company/getCompanyName?searchKey={keyword}&v=v1.0&r=/company/getCompanyName&t=".concat(t),c=i(e,o,r.searchUrl),[4,fetch(c,{method:"GET",mode:"cors",headers:{Referer:"https://c.qcc.com/"}})]);case 1:return[4,n.sent().json()];case 2:return a=n.sent(),s=[],"200"!==a.status?[2,s]:[2,a.result.map((function(e){return{name:e.companyName,id:e.keyNo}}))]}}))}))},u=function(e,r){return t(void 0,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return e.length<2||e.length>=100?[2,[]]:("https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",t=i(e,"https://autocomplete.clearbit.com/v1/companies/suggest?query={keyword}",r.searchUrl),[4,fetch(t,{method:"GET",mode:"cors"})]);case 1:return[4,n.sent().json()];case 2:return[2,n.sent().map((function(e){return{name:e.name,id:e.domain,avatar:e.logo}}))]}}))}))},l=function(e){if(!e.enabled||!e.key)return[];var t=("localStorage"===e.type?localStorage:sessionStorage).getItem(e.key)||"";return o(t)};e.addHistory=function(e,t){if(t.enabled&&t.key){var n="localStorage"===t.type?localStorage:sessionStorage,r=l(t),o=r.findIndex((function(t){return t.id===e.id}));o>-1&&r.splice(o,1),r.splice(0,0,e),n.setItem(t.key,JSON.stringify(r.length>5?r.slice(0,5):r))}},e.getHistory=l,e.getImageData=a,e.handleAvatar=function(e,r){return t(void 0,void 0,void 0,(function(){var t,o,i;return n(this,(function(n){switch(n.label){case 0:return t=e.dataset.id||"",r.avatarUrl?(o=e,[4,a(t,[r.avatarUrl])]):[3,2];case 1:return o.src=n.sent(),[2];case 2:return"qcc_open"===r.api?[3,3]:[3,5];case 3:return i=e,[4,a(t,c)];case 4:return i.src=n.sent(),[3,5];case 5:return[2]}}))}))},e.handleQueryData=function(e,r){return t(void 0,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:switch(r.api){case"qcc_open":return[3,1];case"clearbit":return[3,3]}return[3,5];case 1:return[4,s(e,r)];case 2:case 4:return[2,t.sent()];case 3:return[4,u(e,r)];case 5:return[2,[]]}}))}))},e.initialOptions={target:"body",api:"qcc_open",queryDelay:500,placeholder:"请输入企业名称或统一社会信用代码",clearable:!0,backFill:!1,clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg>',autoFocus:!0,history:{enabled:!0,type:"localStorage",key:"company-history",showClear:!0,itemIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="history" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z"></path></svg>',clearIcon:'<svg viewBox="64 64 896 896" focusable="false" data-icon="delete" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path></svg>'},onFetch:function(){},onSelect:function(){},onClear:function(){},onFocus:function(){},onBlur:function(){},onDropdownVisibleChange:function(){},showSubmitButton:!0,submitButtonLabel:"Submit",offsetTop:5,autoFlip:!1,submitCallback:function(){}},e.removeHistory=function(e){("localStorage"===e.type?localStorage:sessionStorage).removeItem(e.key)}})); |
{ | ||
"name": "@company-ui/autocomplete-core", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Company UI autocomplete core", | ||
@@ -55,3 +55,3 @@ "author": "zhensherlock", | ||
"dependencies": { | ||
"@company-ui/shared": "^1.3.0" | ||
"@company-ui/shared": "^1.4.0" | ||
}, | ||
@@ -58,0 +58,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
271628
1641
Updated@company-ui/shared@^1.4.0