From ba094d5f2e87fc9e863fed2e2a6965ab67fcd4f3 Mon Sep 17 00:00:00 2001 From: nuintun Date: Wed, 28 Feb 2024 11:25:26 +0800 Subject: [PATCH] feat: Update examples --- packages/examples/src/js/pages/Encode.tsx | 42 +++++++++---------- packages/examples/static/index.html | 2 +- ...3af73943d0b8dc6.js => 74b68919d98b4113.js} | 2 +- ...fed202358660967.js => c94020bfbf2d34e2.js} | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) rename packages/examples/static/public/js/{c3af73943d0b8dc6.js => 74b68919d98b4113.js} (98%) rename packages/examples/static/public/js/{7fed202358660967.js => c94020bfbf2d34e2.js} (70%) diff --git a/packages/examples/src/js/pages/Encode.tsx b/packages/examples/src/js/pages/Encode.tsx index f0d910f0..a08a0d74 100644 --- a/packages/examples/src/js/pages/Encode.tsx +++ b/packages/examples/src/js/pages/Encode.tsx @@ -139,17 +139,26 @@ export default memo(function Encode() { - + - - + + @@ -168,26 +177,17 @@ export default memo(function Encode() { - + - - + + diff --git a/packages/examples/static/index.html b/packages/examples/static/index.html index 12fa7ef1..427b90f7 100644 --- a/packages/examples/static/index.html +++ b/packages/examples/static/index.html @@ -1 +1 @@ -二维码
\ No newline at end of file +二维码
\ No newline at end of file diff --git a/packages/examples/static/public/js/c3af73943d0b8dc6.js b/packages/examples/static/public/js/74b68919d98b4113.js similarity index 98% rename from packages/examples/static/public/js/c3af73943d0b8dc6.js rename to packages/examples/static/public/js/74b68919d98b4113.js index cf884e27..7da39821 100644 --- a/packages/examples/static/public/js/c3af73943d0b8dc6.js +++ b/packages/examples/static/public/js/74b68919d98b4113.js @@ -1 +1 @@ -!function(){"use strict";var e,t,n,r,o,u,i,f={},a={};function c(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return f[e](n,n.exports,c),n.exports}c.m=f,e=[],c.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u=o&&Object.keys(c.O).every(function(e){return c.O[e](n[a])})?n.splice(a--,1):(f=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u=o&&Object.keys(c.O).every(function(e){return c.O[e](n[a])})?n.splice(a--,1):(f=!1,oe,[e]),n}},9574:function(e,n,l){l.d(n,{A:function(){return i}});var s=l(5832),r=l(3645);function i(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:128,l=(0,s.useRef)(),i=(0,r.A)(n),[t,c]=(0,s.useState)(e),a=(0,s.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.current;clearTimeout(l.current),n<=0?c(e):l.current=setTimeout(()=>{c(e)},n)},[]);return(0,s.useEffect)(()=>()=>{clearTimeout(l.current)},[]),[t,a]}},5408:function(e,n,l){l.r(n),l.d(n,{default:function(){return M}});var s=l(9252),r={result:"ee1aa457",preview:"d52c0583"},i=l(5832),t=l(9574),c=l(1162),a=l(9847),u=l(8491),d=l(5714),o=l(2719),x=l(2574),h=l(1581),m=l(115),j=l(3877),A=l(5738),f=l(2754),v=l(5940),p=l(5726),b=l(7121);let{Option:g}=u.A,{TextArea:w}=d.A,{Item:I,useForm:k,useWatch:y}=o.A;function S(e){return"string"==typeof e?e:e.toHexString()}let C=(0,i.memo)(function(e){let{value:n}=e;if(n)switch(n.type){case"ok":return(0,s.jsx)(x.A,{src:n.payload,alt:"preview",className:r.preview});case"error":return(0,s.jsx)(h.A,{type:"error",message:n.message,showIcon:!0});default:return(0,s.jsx)(h.A,{type:"error",message:"发生未知错误",showIcon:!0})}return null});var M=(0,i.memo)(function(){let e=(0,i.useRef)(!1),n=(0,i.useRef)(),[d]=k(),[x,h]=(0,t.A)(!1),[M,T]=(0,i.useState)(),L=(0,i.useMemo)(()=>({level:"L",fnc1:"None",mode:"Auto",moduleSize:4,quietZone:16,aimIndicator:0,version:"Auto",charset:"UTF_8",background:"#ffffff",foreground:"#000000",content:"WIFI:S:Gadget Hacks;T:WPA;P:1234567890;;"}),[]),F=(0,i.useMemo)(()=>{let e=[(0,s.jsx)(g,{value:"Auto",children:"Auto"},"Auto")];for(let n=1;n<=40;n++)e.push((0,s.jsx)(g,{value:n,children:n},n));return e},[]),N=(0,i.useCallback)(l=>{let s=n.current;if(s&&!e.current){h(!0),e.current=!0;let n={...l,background:S(l.background),foreground:S(l.foreground)};s.postMessage(n)}},[]),H=(0,i.useCallback)(()=>{let e=d.getFieldValue("moduleSize");d.setFieldsValue({quietZone:4*e})},[]),z=y("mode",d)??L.mode,R=y(["fnc1"],d)??L.fnc1,U=y("content",d)??L.content;return(0,i.useEffect)(()=>{let s=new Worker(new URL(l.p+l.u(255),l.b));return s.addEventListener("message",n=>{let{data:l}=n;T(l),h(!1),e.current=!1}),n.current=s,()=>{s.terminate()}},[]),(0,s.jsxs)("div",{className:"ui-page",children:[(0,s.jsx)(o.A,{form:d,layout:"vertical",onFinish:N,initialValues:L,children:(0,s.jsxs)(m.A,{gutter:24,children:[(0,s.jsx)(j.A,{span:24,children:(0,s.jsx)(I,{name:"content",children:(0,s.jsx)(w,{rows:8,allowClear:!0})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"fnc1",label:"支持 FNC1",children:(0,s.jsxs)(u.A,{children:[(0,s.jsx)(g,{value:"None",children:"否"}),(0,s.jsx)(g,{value:"AIM",children:"AIM"}),(0,s.jsx)(g,{value:"GS1",children:"GS1"})]})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"aimIndicator",label:"AIM 标识",children:(0,s.jsx)(A.A,{disabled:"AIM"!==R,min:0,max:255,precision:0,style:{width:"100%"}})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"version",label:"版本大小",children:(0,s.jsx)(u.A,{children:F})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"level",label:"纠错等级",children:(0,s.jsxs)(u.A,{children:[(0,s.jsx)(g,{value:"L",children:"Level L (7%)"}),(0,s.jsx)(g,{value:"M",children:"Level M (15%)"}),(0,s.jsx)(g,{value:"Q",children:"Level Q (25%)"}),(0,s.jsx)(g,{value:"H",children:"Level H (30%)"})]})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"mode",label:"编码模式",children:(0,s.jsxs)(u.A,{children:[(0,s.jsx)(g,{value:"Auto",selected:!0,children:"Auto"}),(0,s.jsx)(g,{value:"Alphanumeric",children:"Alphanumeric"}),(0,s.jsx)(g,{value:"Byte",children:"Byte"}),(0,s.jsx)(g,{value:"Hanzi",children:"Hanzi"}),(0,s.jsx)(g,{value:"Kanji",children:"Kanji"}),(0,s.jsx)(g,{value:"Numeric",children:"Numeric"})]})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"charset",label:"字符编码",children:(0,s.jsxs)(u.A,{disabled:"Auto"!==z,children:[(0,s.jsx)(g,{value:"ASCII",children:"ASCII"}),(0,s.jsx)(g,{value:"UTF_8",children:"UTF-8"}),(0,s.jsx)(g,{value:"ISO_8859_1",children:"ISO-8859-1"})]})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"moduleSize",label:"模块大小",children:(0,s.jsx)(A.A,{min:1,max:50,precision:0,style:{width:"100%"}})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"quietZone",label:"静区大小",tooltip:"推荐 4 倍模块大小",children:(0,s.jsx)(A.A,{min:0,max:200,precision:0,style:{width:"100%"},addonAfter:(0,s.jsx)(f.A,{title:"自动计算",children:(0,s.jsx)(c.A,{onClick:H})})})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"foreground",label:"前景颜色",children:(0,s.jsx)(v.A,{showText:!0,disabledAlpha:!0})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"background",label:"背景颜色",children:(0,s.jsx)(v.A,{showText:!0,disabledAlpha:!0})})}),(0,s.jsx)(j.A,{span:24,children:(0,s.jsx)(p.Ay,{type:"primary",htmlType:"submit",loading:x,disabled:!U,icon:(0,s.jsx)(a.A,{component:b.A}),children:"编码"})})]})}),(0,s.jsx)("div",{className:r.result,children:(0,s.jsx)(C,{value:M})})]})})}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[408],{3645:function(e,n,l){l.d(n,{A:function(){return r}});var s=l(5832);function r(e){let n=(0,s.useRef)(e);return n.current=(0,s.useMemo)(()=>e,[e]),n}},9574:function(e,n,l){l.d(n,{A:function(){return i}});var s=l(5832),r=l(3645);function i(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:128,l=(0,s.useRef)(),i=(0,r.A)(n),[t,c]=(0,s.useState)(e),a=(0,s.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.current;clearTimeout(l.current),n<=0?c(e):l.current=setTimeout(()=>{c(e)},n)},[]);return(0,s.useEffect)(()=>()=>{clearTimeout(l.current)},[]),[t,a]}},5408:function(e,n,l){l.r(n),l.d(n,{default:function(){return M}});var s=l(9252),r={result:"ee1aa457",preview:"d52c0583"},i=l(5832),t=l(9574),c=l(1162),a=l(9847),u=l(8491),d=l(5714),o=l(2719),x=l(2574),h=l(1581),m=l(115),j=l(3877),A=l(5738),f=l(2754),v=l(5940),p=l(5726),b=l(7121);let{Option:g}=u.A,{TextArea:w}=d.A,{Item:I,useForm:k,useWatch:y}=o.A;function S(e){return"string"==typeof e?e:e.toHexString()}let C=(0,i.memo)(function(e){let{value:n}=e;if(n)switch(n.type){case"ok":return(0,s.jsx)(x.A,{src:n.payload,alt:"preview",className:r.preview});case"error":return(0,s.jsx)(h.A,{type:"error",message:n.message,showIcon:!0});default:return(0,s.jsx)(h.A,{type:"error",message:"发生未知错误",showIcon:!0})}return null});var M=(0,i.memo)(function(){let e=(0,i.useRef)(!1),n=(0,i.useRef)(),[d]=k(),[x,h]=(0,t.A)(!1),[M,T]=(0,i.useState)(),L=(0,i.useMemo)(()=>({level:"L",fnc1:"None",mode:"Auto",moduleSize:4,quietZone:16,aimIndicator:0,version:"Auto",charset:"UTF_8",background:"#ffffff",foreground:"#000000",content:"WIFI:S:Gadget Hacks;T:WPA;P:1234567890;;"}),[]),F=(0,i.useMemo)(()=>{let e=[(0,s.jsx)(g,{value:"Auto",children:"Auto"},"Auto")];for(let n=1;n<=40;n++)e.push((0,s.jsx)(g,{value:n,children:n},n));return e},[]),N=(0,i.useCallback)(l=>{let s=n.current;if(s&&!e.current){h(!0),e.current=!0;let n={...l,background:S(l.background),foreground:S(l.foreground)};s.postMessage(n)}},[]),H=(0,i.useCallback)(()=>{let e=d.getFieldValue("moduleSize");d.setFieldsValue({quietZone:4*e})},[]),z=y("mode",d)??L.mode,R=y(["fnc1"],d)??L.fnc1,U=y("content",d)??L.content;return(0,i.useEffect)(()=>{let s=new Worker(new URL(l.p+l.u(255),l.b));return s.addEventListener("message",n=>{let{data:l}=n;T(l),h(!1),e.current=!1}),n.current=s,()=>{s.terminate()}},[]),(0,s.jsxs)("div",{className:"ui-page",children:[(0,s.jsx)(o.A,{form:d,layout:"vertical",onFinish:N,initialValues:L,children:(0,s.jsxs)(m.A,{gutter:24,children:[(0,s.jsx)(j.A,{span:24,children:(0,s.jsx)(I,{name:"content",children:(0,s.jsx)(w,{rows:8,allowClear:!0})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"mode",label:"编码模式",children:(0,s.jsxs)(u.A,{children:[(0,s.jsx)(g,{value:"Auto",selected:!0,children:"Auto"}),(0,s.jsx)(g,{value:"Alphanumeric",children:"Alphanumeric"}),(0,s.jsx)(g,{value:"Byte",children:"Byte"}),(0,s.jsx)(g,{value:"Hanzi",children:"Hanzi"}),(0,s.jsx)(g,{value:"Kanji",children:"Kanji"}),(0,s.jsx)(g,{value:"Numeric",children:"Numeric"})]})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"charset",label:"字符编码",children:(0,s.jsxs)(u.A,{disabled:"Auto"!==z,children:[(0,s.jsx)(g,{value:"ASCII",children:"ASCII"}),(0,s.jsx)(g,{value:"UTF_8",children:"UTF-8"}),(0,s.jsx)(g,{value:"ISO_8859_1",children:"ISO-8859-1"})]})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"version",label:"版本大小",children:(0,s.jsx)(u.A,{children:F})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"level",label:"纠错等级",children:(0,s.jsxs)(u.A,{children:[(0,s.jsx)(g,{value:"L",children:"Level L (7%)"}),(0,s.jsx)(g,{value:"M",children:"Level M (15%)"}),(0,s.jsx)(g,{value:"Q",children:"Level Q (25%)"}),(0,s.jsx)(g,{value:"H",children:"Level H (30%)"})]})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"fnc1",label:"支持 FNC1",children:(0,s.jsxs)(u.A,{children:[(0,s.jsx)(g,{value:"None",children:"否"}),(0,s.jsx)(g,{value:"AIM",children:"AIM"}),(0,s.jsx)(g,{value:"GS1",children:"GS1"})]})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"aimIndicator",label:"AIM 标识",children:(0,s.jsx)(A.A,{disabled:"AIM"!==R,min:0,max:255,precision:0,style:{width:"100%"}})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"moduleSize",label:"模块大小",children:(0,s.jsx)(A.A,{min:1,max:50,precision:0,style:{width:"100%"}})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"quietZone",label:"静区大小",tooltip:"推荐 4 倍模块大小",children:(0,s.jsx)(A.A,{min:0,max:200,precision:0,style:{width:"100%"},addonAfter:(0,s.jsx)(f.A,{title:"自动计算",children:(0,s.jsx)(c.A,{onClick:H})})})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"foreground",label:"前景颜色",children:(0,s.jsx)(v.A,{showText:!0,disabledAlpha:!0})})}),(0,s.jsx)(j.A,{md:6,sm:12,xs:24,children:(0,s.jsx)(I,{name:"background",label:"背景颜色",children:(0,s.jsx)(v.A,{showText:!0,disabledAlpha:!0})})}),(0,s.jsx)(j.A,{span:24,children:(0,s.jsx)(p.Ay,{type:"primary",htmlType:"submit",loading:x,disabled:!U,icon:(0,s.jsx)(a.A,{component:b.A}),children:"编码"})})]})}),(0,s.jsx)("div",{className:r.result,children:(0,s.jsx)(C,{value:M})})]})})}}]); \ No newline at end of file