@daoyi/nmtl-ui 2.0.1-beta.41 → 2.0.1-beta.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r}from"./_rollupPluginBabelHelpers-b6a1ebe2.js";import e,{useMemo as t}from"react";import{b as n,c as o}from"./index-b2745105.js";import a from"prop-types";import{useHistory as i,Link as s}from"react-router-dom";import{Tooltip as c}from"@material-ui/core";import{s as l}from"./style-inject.es-1f59c1d0.js";var p=new RegExp("%[a-f0-9]{2}","gi"),u=new RegExp("(%[a-f0-9]{2})+","gi");function
|
|
1
|
+
import{c as r}from"./_rollupPluginBabelHelpers-b6a1ebe2.js";import e,{useMemo as t}from"react";import{b as n,c as o}from"./index-b2745105.js";import a from"prop-types";import{useHistory as i,Link as s}from"react-router-dom";import{Tooltip as c}from"@material-ui/core";import{s as l}from"./style-inject.es-1f59c1d0.js";var p=new RegExp("%[a-f0-9]{2}","gi"),u=new RegExp("(%[a-f0-9]{2})+","gi");function d(r,e){try{return decodeURIComponent(r.join(""))}catch(r){}if(1===r.length)return r;e=e||1;var t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],d(t),d(n))}function f(r){try{return decodeURIComponent(r)}catch(n){for(var e=r.match(p),t=1;t<e.length;t++)e=(r=d(e,t).join("")).match(p);return r}}var m=function(r){if("string"!=typeof r)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch(e){return function(r){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=u.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(r){var n=f(t[0]);n!==t[0]&&(e[t[0]]=n)}t=u.exec(r)}e["%C2"]="�";for(var o=Object.keys(e),a=0;a<o.length;a++){var i=o[a];r=r.replace(new RegExp(i,"g"),e[i])}return r}(r)}},y=(r,e)=>{if("string"!=typeof r||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[r];const t=r.indexOf(e);return-1===t?[r]:[r.slice(0,t),r.slice(t+e.length)]},g=n((function(r,e){function t(r){if("string"!=typeof r||1!==r.length)throw new TypeError("arrayFormatSeparator must be single character string")}function n(r,e){return e.encode?e.strict?encodeURIComponent(r).replace(/[!'()*]/g,(r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`)):encodeURIComponent(r):r}function o(r,e){return e.decode?m(r):r}function a(r){return Array.isArray(r)?r.sort():"object"==typeof r?a(Object.keys(r)).sort(((r,e)=>Number(r)-Number(e))).map((e=>r[e])):r}function i(r){const e=r.indexOf("#");return-1!==e&&(r=r.slice(0,e)),r}function s(r){const e=(r=i(r)).indexOf("?");return-1===e?"":r.slice(e+1)}function c(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&"string"==typeof r&&""!==r.trim()?r=Number(r):!e.parseBooleans||null===r||"true"!==r.toLowerCase()&&"false"!==r.toLowerCase()||(r="true"===r.toLowerCase()),r}function l(r,e){t((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);const n=function(r){let e;switch(r.arrayFormat){case"index":return(r,t,n)=>{e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),e?(void 0===n[r]&&(n[r]={}),n[r][e[1]]=t):n[r]=t};case"bracket":return(r,t,n)=>{e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),e?void 0!==n[r]?n[r]=[].concat(n[r],t):n[r]=[t]:n[r]=t};case"comma":case"separator":return(e,t,n)=>{const a="string"==typeof t&&t.split("").indexOf(r.arrayFormatSeparator)>-1?t.split(r.arrayFormatSeparator).map((e=>o(e,r))):null===t?t:o(t,r);n[e]=a};default:return(r,e,t)=>{void 0!==t[r]?t[r]=[].concat(t[r],e):t[r]=e}}}(e),i=Object.create(null);if("string"!=typeof r)return i;if(!(r=r.trim().replace(/^[?#&]/,"")))return i;for(const t of r.split("&")){let[r,a]=y(e.decode?t.replace(/\+/g," "):t,"=");a=void 0===a?null:["comma","separator"].includes(e.arrayFormat)?a:o(a,e),n(o(r,e),a,i)}for(const r of Object.keys(i)){const t=i[r];if("object"==typeof t&&null!==t)for(const r of Object.keys(t))t[r]=c(t[r],e);else i[r]=c(t,e)}return!1===e.sort?i:(!0===e.sort?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce(((r,e)=>{const t=i[e];return Boolean(t)&&"object"==typeof t&&!Array.isArray(t)?r[e]=a(t):r[e]=t,r}),Object.create(null))}e.extract=s,e.parse=l,e.stringify=(r,e)=>{if(!r)return"";t((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);const o=t=>e.skipNull&&null==r[t]||e.skipEmptyString&&""===r[t],a=function(r){switch(r.arrayFormat){case"index":return e=>(t,o)=>{const a=t.length;return void 0===o||r.skipNull&&null===o||r.skipEmptyString&&""===o?t:null===o?[...t,[n(e,r),"[",a,"]"].join("")]:[...t,[n(e,r),"[",n(a,r),"]=",n(o,r)].join("")]};case"bracket":return e=>(t,o)=>void 0===o||r.skipNull&&null===o||r.skipEmptyString&&""===o?t:null===o?[...t,[n(e,r),"[]"].join("")]:[...t,[n(e,r),"[]=",n(o,r)].join("")];case"comma":case"separator":return e=>(t,o)=>null==o||0===o.length?t:0===t.length?[[n(e,r),"=",n(o,r)].join("")]:[[t,n(o,r)].join(r.arrayFormatSeparator)];default:return e=>(t,o)=>void 0===o||r.skipNull&&null===o||r.skipEmptyString&&""===o?t:null===o?[...t,n(e,r)]:[...t,[n(e,r),"=",n(o,r)].join("")]}}(e),i={};for(const e of Object.keys(r))o(e)||(i[e]=r[e]);const s=Object.keys(i);return!1!==e.sort&&s.sort(e.sort),s.map((t=>{const o=r[t];return void 0===o?"":null===o?n(t,e):Array.isArray(o)?o.reduce(a(t),[]).join("&"):n(t,e)+"="+n(o,e)})).filter((r=>r.length>0)).join("&")},e.parseUrl=(r,e)=>({url:i(r).split("?")[0]||"",query:l(s(r),e)}),e.stringifyUrl=(r,t)=>{const n=i(r.url).split("?")[0]||"",o=e.extract(r.url),a=e.parse(o),s=function(r){let e="";const t=r.indexOf("#");return-1!==t&&(e=r.slice(t)),e}(r.url),c=Object.assign(a,r.query);let l=e.stringify(c,t);return l&&(l=`?${l}`),`${n}${l}${s}`}}));g.extract,g.parse,g.stringify,g.parseUrl,g.stringifyUrl;l(".forwardLink {\n width: -moz-fit-content;\n width: fit-content; }\n .forwardLink__link {\n color: unset;\n text-decoration: none;\n cursor: pointer; }\n .forwardLink__link--disabled {\n cursor: not-allowed; }\n");var h=["className","title","disabled","children","tip","onClick"],b=function(n){var a=n.className,l=n.title,p=n.disabled,u=n.children,d=n.tip;n.onClick;var f=r(n,h),m=i(),y=t((function(){var r;if(p)return{};var e=null===(r=f.pathname)||void 0===r?void 0:r.indexOf("?");return e>-1?{pathname:f.pathname.substring(0,e),search:f.pathname.substring(e)}:{pathname:f.pathname||"/",search:"string"==typeof f.search?f.search:g.stringify(f.search)}}),[m,p,f.pathname,f.search]),b=y.pathname,v=void 0===b?"":b,j=y.search,k=void 0===j?"":j,w=e.createElement("div",{className:o("forwardLink",a)},p?e.createElement("div",{title:d?void 0:l,className:"forwardLink__link--disabled"},u):e.createElement(s,{className:"forwardLink__link",title:d?void 0:l,to:{pathname:"".concat("/zh-tw").concat(v),search:k}},u));return d?e.createElement(c,{title:d,placement:"top"},w):w};b.defaultProps={className:void 0,title:void 0,disabled:void 0,children:void 0,search:void 0,tip:void 0,onClick:function(){return!0}},b.propTypes={className:a.string,title:a.string,disabled:a.bool,children:a.node,pathname:a.string.isRequired,search:a.oneOfType([a.object,a.string]),tip:a.string,onClick:a.func};export{b as default};
|
package/package.json
CHANGED