intable 0.0.30 → 0.0.32
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.
- package/LICENSE +21 -21
- package/README.md +463 -463
- package/dist/__uno.css +1 -1
- package/dist/components/Filter.d.ts +3 -1
- package/dist/components/Filter.js +18 -18
- package/dist/components/Popover.d.ts +7 -4
- package/dist/components/Popover.js +32 -25
- package/dist/hooks/useControlled.d.ts +112 -0
- package/dist/hooks/useControlled.js +16 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +12 -8
- package/dist/plugins/AutoFillPlugin.js +61 -54
- package/dist/plugins/DiffPlugin.d.ts +2 -2
- package/dist/plugins/DiffPlugin.js +3 -4
- package/dist/plugins/FilterPlugin.d.ts +5 -1
- package/dist/plugins/FilterPlugin.js +89 -89
- package/dist/plugins/ResizePlugin.js +41 -36
- package/dist/plugins/SortPlugin.d.ts +5 -1
- package/dist/plugins/SortPlugin.js +47 -46
- package/dist/style.css +2 -2
- package/dist/theme/antd.scss +41 -41
- package/dist/theme/dark.scss +46 -46
- package/dist/theme/element-plus.scss +38 -38
- package/dist/theme/github.scss +80 -80
- package/dist/theme/material.scss +73 -73
- package/dist/theme/shadcn.scss +66 -66
- package/dist/theme/stripe.scss +57 -57
- package/package.json +1 -1
package/dist/__uno.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--un-bg-opacity:100%;--un-leading:initial;--un-content:"";--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-text-opacity:100%;--un-border-opacity:100%;--un-space-y-reverse:initial;--un-space-x-reverse:initial;--un-outline-style:solid;--un-outline-opacity:100%}}@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-leading{syntax:"*";inherits:false}@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --un-outline-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-inset-ring-color{syntax:"*";inherits:false}@property --un-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow-color{syntax:"*";inherits:false}@property --un-ring-color{syntax:"*";inherits:false}@property --un-ring-inset{syntax:"*";inherits:false}@property --un-ring-offset-color{syntax:"*";inherits:false}@property --un-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --un-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow-color{syntax:"*";inherits:false}@property --un-translate-x{syntax:"*";inherits:false;initial-value:0}@property --un-translate-y{syntax:"*";inherits:false;initial-value:0}@property --un-translate-z{syntax:"*";inherits:false;initial-value:0}@property --un-numeric-figure{syntax:"*";inherits:false}@property --un-numeric-fraction{syntax:"*";inherits:false}@property --un-numeric-spacing{syntax:"*";inherits:false}@property --un-ordinal{syntax:"*";inherits:false}@property --un-slashed-zero{syntax:"*";inherits:false}@property --un-space-y-reverse{syntax:"*";inherits:false;initial-value:0}:root,:host{--spacing:.25rem;--radius-DEFAULT:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--default-transition-timingFunction:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--radius-md:.375rem;--radius-xl:.75rem;--fontWeight-medium:500;--fontWeight-semibold:600;--tracking-wide:.025em;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--radius-sm:.25rem;--colors-blue-DEFAULT:#54a2ff;--colors-red-DEFAULT:#ff6568;--text-2xl-fontSize:1.5rem;--text-2xl-lineHeight:2rem;--text-xs-fontSize:.75rem;--text-xs-lineHeight:1rem;--colors-green-DEFAULT:#05df72;--colors-black:#000;--font-sans:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--default-font-family:var(--font-sans);--default-monoFont-family:var(--font-mono)}@supports (color:lab(0% 0 0)){:root,:host{--colors-gray-DEFAULT:lab(65.9269% -.832677 -8.17474);--colors-blue-DEFAULT:lab(65.0361% -1.42065 -56.9802);--colors-red-DEFAULT:lab(63.7053% 60.745 31.3109);--colors-green-DEFAULT:lab(78.503% -64.9264 39.7492)}}*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-featureSettings,normal);font-variation-settings:var(--default-font-variationSettings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-monoFont-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-monoFont-featureSettings,normal);font-variation-settings:var(--default-monoFont-variationSettings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden~=until-found])){display:none!important}.container{width:100%}.aic{align-items:center}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.text-2xl{font-size:var(--text-2xl-fontSize);line-height:var(--un-leading,var(--text-2xl-lineHeight))}.text-3{font-size:.75rem}.text-3\.5{font-size:.875rem}.text-4{font-size:1rem}.text-sm{font-size:var(--text-sm-fontSize);line-height:var(--un-leading,var(--text-sm-lineHeight))}.text-xs{font-size:var(--text-xs-fontSize);line-height:var(--un-leading,var(--text-xs-lineHeight))}.c-\[--c-primary\]{color:color-mix(in oklab,var(--c-primary)var(--un-text-opacity),transparent)}.c-\#1e3a8a{color:color-mix(in oklab,#1e3a8a var(--un-text-opacity),transparent)}.c-\#7c2d12{color:color-mix(in oklab,#7c2d12 var(--un-text-opacity),transparent)}.c-blue{color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-text-opacity),transparent)}.c-gray\/70{color:color-mix(in srgb,var(--colors-gray-DEFAULT)70%,transparent)}.c-red\/75{color:color-mix(in srgb,var(--colors-red-DEFAULT)75%,transparent)}.leading-5{--un-leading:calc(4px*5);line-height:20px}.lh-\[1\]{--un-leading:1;line-height:1}.tracking-wide{--un-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.font-medium{--un-font-weight:var(--fontWeight-medium);font-weight:var(--fontWeight-medium)}.font-mono{font-family:var(--font-mono)}.font-semibold{--un-font-weight:var(--fontWeight-semibold);font-weight:var(--fontWeight-semibold)}.m9{margin:36px}.mx-1{margin-inline:4px}.mx-3\!{margin-inline:12px!important}.my-1{margin-block:4px}.ml{margin-left:16px}.ml-\.5{margin-left:2px}.ml-1{margin-left:4px}.mr--1{margin-right:-4px}.mr-1{margin-right:4px}.mr-2{margin-right:8px}.mr-2\.5{margin-right:10px}.mt-1{margin-top:4px}.p-1{padding:4px}.p-4\!{padding:16px!important}.px,.px-4{padding-inline:16px}.px-1\.5{padding-inline:6px}.px-2{padding-inline:8px}.px-3{padding-inline:12px}.py-1{padding-block:4px}.py-1\.5{padding-block:6px}.py-2{padding-block:8px}.pl-1{padding-left:4px}.pl-4{padding-left:16px}.pr-4{padding-right:16px}.ps{padding-inline-start:16px}.outline-0{outline-style:var(--un-outline-style);outline-width:0}.outline-2{outline-style:var(--un-outline-style);outline-width:2px}.outline-blue{outline-color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.outline-none{--un-outline-style:none;outline-style:none}.b,.b-1,.border{border-width:1px}.b-r-0{border-right-width:0}.b-\#00000000\!{border-color:color-mix(in oklab,#0000 var(--un-border-opacity),transparent)!important}.b-\#4f7ff0{border-color:color-mix(in oklab,#4f7ff0 var(--un-border-opacity),transparent)}.b-\#f59e0b{border-color:color-mix(in oklab,#f59e0b var(--un-border-opacity),transparent)}.rd-1{border-radius:.25rem}.rd-1\.5{border-radius:.375rem}.rd-2{border-radius:.5rem}.rd-sm{border-radius:var(--radius-sm)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rd-l-4{border-top-left-radius:1rem;border-bottom-left-radius:1rem}.b-dashed{--un-border-style:dashed;border-style:dashed}.b-solid{--un-border-style:solid;border-style:solid}.bg-\[--table-header-bg\]{background-color:color-mix(in oklab,var(--table-header-bg)var(--un-bg-opacity),transparent)}.bg-\#dbe6ff\/75{background-color:#dbe6ffbf;background-color:lab(91.0303% -.143617 -13.4803/.75)}.bg-\#fff{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent)}.bg-\#fff3d6\/85{background-color:#fff3d6d9;background-color:lab(96.236% .744313 15.5662/.85)}.bg-blue\/20\!{background-color:color-mix(in srgb,var(--colors-blue-DEFAULT)20%,transparent)!important}.bg-gray\/20{background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)20%,transparent)}.bg-green\!{background-color:color-mix(in srgb,var(--colors-green-DEFAULT)var(--un-bg-opacity),transparent)!important}.bg-red\!{background-color:color-mix(in srgb,var(--colors-red-DEFAULT)var(--un-bg-opacity),transparent)!important}.bg-transparent{background-color:#0000}.hover\:bg-\[--li-hover-bg\]:hover{background-color:color-mix(in oklab,var(--li-hover-bg)var(--un-bg-opacity),transparent)}.hover\:bg-black\/8:hover{background-color:color-mix(in srgb,var(--colors-black)8%,transparent)}.op-0{opacity:0}.op-15{opacity:.15}.op-60{opacity:.6}.op-75{opacity:.75}.op40{opacity:.4}.opacity-50{opacity:.5}.group:hover .group-hover\:op-100{opacity:1}.hover\:underline:hover{text-decoration-line:underline}.flex{display:flex}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-1{gap:4px}.gap-1\.5{gap:6px}.gap-2{gap:8px}.grid{display:grid}.size-3\.5{width:14px;height:14px}.size-4\!{width:16px!important;height:16px!important}.size-full{width:100%;height:100%}.h-1\!{height:4px!important}.h-3\.5{height:14px}.h-6{height:24px}.h-6\.5{height:26px}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.max-h-60{max-height:240px}.max-h-inherit{max-height:inherit}.min-h-16{min-height:64px}.min-h-40{min-height:160px}.min-h-a\!{min-height:auto!important}.min-w-24{min-width:96px}.min-w-44{min-width:176px}.min-w-52{min-width:208px}.w-10{width:40px}.w-10px\!{width:10px!important}.w-3\.5{width:14px}.w-6\.5{width:26px}.w-a\!{width:auto!important}.w-full{width:100%}.after\:h-1:after{height:4px}.after\:w-1:after{width:4px}.inline{display:inline}.block{display:block}.inline-block{display:inline-block}.contents{display:contents}.hidden{display:none}.visible{visibility:visible}.collapse{visibility:collapse}.cursor-pointer{cursor:pointer}.cursor-s-resize{cursor:s-resize}.cursor-w-resize{cursor:w-resize}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.resize{resize:both}.resize-none{resize:none}.select-none{-webkit-user-select:none;user-select:none}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.uppercase{text-transform:uppercase}.shadow-inner{--un-shadow:inset 0 2px 4px 0 var(--un-shadow-color,#0000000d);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-sm{--un-shadow:0 1px 3px 0 var(--un-shadow-color,#0000001a),0 1px 2px -1px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-xl{--un-shadow:0 20px 25px -5px var(--un-shadow-color,#0000001a),0 8px 10px -6px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.translate-x--1\/2{--un-translate-x:-50%;translate:var(--un-translate-x)var(--un-translate-y)}.translate-x-1\/2{--un-translate-x:50%;translate:var(--un-translate-x)var(--un-translate-y)}.translate-y--1\/2{--un-translate-y:-50%;translate:var(--un-translate-x)var(--un-translate-y)}.transform{transform:var(--un-rotate-x)var(--un-rotate-y)var(--un-rotate-z)var(--un-skew-x)var(--un-skew-y)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,--un-gradient-from,--un-gradient-via,--un-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--un-ease,var(--default-transition-timingFunction));transition-duration:var(--un-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--un-ease,var(--default-transition-timingFunction));transition-duration:var(--un-duration,var(--default-transition-duration))}.items-start{align-items:flex-start}.items-center{align-items:center}.box-border{box-sizing:border-box}.inset-0{inset:0}.bottom-0{bottom:0}.left--0,.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-1\/2{top:50%}.justify-end\!{justify-content:flex-end!important}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.z--1{z-index:-1}.z-1{z-index:1}.z-2{z-index:2}.z-9{z-index:9}.overflow-auto{overflow:auto}.of-y-auto{overflow-y:auto}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.filter{filter:var(--un-blur,)var(--un-brightness,)var(--un-contrast,)var(--un-grayscale,)var(--un-hue-rotate,)var(--un-invert,)var(--un-saturate,)var(--un-sepia,)var(--un-drop-shadow,)}.table{display:table}.table-cell{display:table-cell}.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal,)var(--un-slashed-zero,)var(--un-numeric-figure,)var(--un-numeric-spacing,)var(--un-numeric-fraction,)}:where(.space-y-5>:not(:last-child)){--un-space-y-reverse:0;margin-block-start:calc(calc(4px*5)*var(--un-space-y-reverse));margin-block-end:calc(calc(4px*5)*calc(1 - var(--un-space-y-reverse)))}@supports (color:color-mix(in lab, red, red)){.c-blue{color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-text-opacity),transparent)}.c-gray\/70{color:color-mix(in oklab,var(--colors-gray-DEFAULT)70%,transparent)}.c-red\/75{color:color-mix(in oklab,var(--colors-red-DEFAULT)75%,transparent)}.outline-blue{outline-color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.bg-blue\/20\!{background-color:color-mix(in oklab,var(--colors-blue-DEFAULT)20%,transparent)!important}.bg-gray\/20{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)20%,transparent)}.bg-green\!{background-color:color-mix(in oklab,var(--colors-green-DEFAULT)var(--un-bg-opacity),transparent)!important}.bg-red\!{background-color:color-mix(in oklab,var(--colors-red-DEFAULT)var(--un-bg-opacity),transparent)!important}.hover\:bg-black\/8:hover{background-color:color-mix(in oklab,var(--colors-black)8%,transparent)}}
|
|
1
|
+
@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--un-bg-opacity:100%;--un-leading:initial;--un-content:"";--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-text-opacity:100%;--un-border-opacity:100%;--un-space-y-reverse:initial;--un-space-x-reverse:initial;--un-outline-style:solid;--un-outline-opacity:100%}}@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-leading{syntax:"*";inherits:false}@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --un-outline-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-inset-ring-color{syntax:"*";inherits:false}@property --un-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow-color{syntax:"*";inherits:false}@property --un-ring-color{syntax:"*";inherits:false}@property --un-ring-inset{syntax:"*";inherits:false}@property --un-ring-offset-color{syntax:"*";inherits:false}@property --un-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --un-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow-color{syntax:"*";inherits:false}@property --un-translate-x{syntax:"*";inherits:false;initial-value:0}@property --un-translate-y{syntax:"*";inherits:false;initial-value:0}@property --un-translate-z{syntax:"*";inherits:false;initial-value:0}@property --un-numeric-figure{syntax:"*";inherits:false}@property --un-numeric-fraction{syntax:"*";inherits:false}@property --un-numeric-spacing{syntax:"*";inherits:false}@property --un-ordinal{syntax:"*";inherits:false}@property --un-slashed-zero{syntax:"*";inherits:false}@property --un-space-y-reverse{syntax:"*";inherits:false;initial-value:0}:root,:host{--spacing:.25rem;--radius-DEFAULT:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--default-transition-timingFunction:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--radius-md:.375rem;--radius-xl:.75rem;--fontWeight-medium:500;--fontWeight-semibold:600;--tracking-wide:.025em;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--radius-sm:.25rem;--colors-blue-DEFAULT:#54a2ff;--colors-red-DEFAULT:#ff6568;--text-2xl-fontSize:1.5rem;--text-2xl-lineHeight:2rem;--text-xs-fontSize:.75rem;--text-xs-lineHeight:1rem;--colors-green-DEFAULT:#05df72;--colors-black:#000;--font-sans:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--default-font-family:var(--font-sans);--default-monoFont-family:var(--font-mono)}@supports (color:lab(0% 0 0)){:root,:host{--colors-gray-DEFAULT:lab(65.9269% -.832707 -8.17474);--colors-blue-DEFAULT:lab(65.0361% -1.42062 -56.9803);--colors-red-DEFAULT:lab(63.7053% 60.7449 31.3109);--colors-green-DEFAULT:lab(78.503% -64.9265 39.7492)}}*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-featureSettings,normal);font-variation-settings:var(--default-font-variationSettings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-monoFont-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-monoFont-featureSettings,normal);font-variation-settings:var(--default-monoFont-variationSettings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden~=until-found])){display:none!important}.container{width:100%}.aic{align-items:center}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.text-2xl{font-size:var(--text-2xl-fontSize);line-height:var(--un-leading,var(--text-2xl-lineHeight))}.text-3{font-size:.75rem}.text-3\.5{font-size:.875rem}.text-4{font-size:1rem}.text-sm{font-size:var(--text-sm-fontSize);line-height:var(--un-leading,var(--text-sm-lineHeight))}.text-xs{font-size:var(--text-xs-fontSize);line-height:var(--un-leading,var(--text-xs-lineHeight))}.c-\[--c-primary\]{color:color-mix(in oklab,var(--c-primary)var(--un-text-opacity),transparent)}.c-\#1e3a8a{color:color-mix(in oklab,#1e3a8a var(--un-text-opacity),transparent)}.c-\#7c2d12{color:color-mix(in oklab,#7c2d12 var(--un-text-opacity),transparent)}.c-blue{color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-text-opacity),transparent)}.c-gray\/70{color:color-mix(in srgb,var(--colors-gray-DEFAULT)70%,transparent)}.c-red\/75{color:color-mix(in srgb,var(--colors-red-DEFAULT)75%,transparent)}.leading-5{--un-leading:calc(4px*5);line-height:20px}.lh-\[1\]{--un-leading:1;line-height:1}.tracking-wide{--un-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.font-medium{--un-font-weight:var(--fontWeight-medium);font-weight:var(--fontWeight-medium)}.font-mono{font-family:var(--font-mono)}.font-semibold{--un-font-weight:var(--fontWeight-semibold);font-weight:var(--fontWeight-semibold)}.m9{margin:36px}.mx-1{margin-inline:4px}.mx-3\!{margin-inline:12px!important}.my-1{margin-block:4px}.ml{margin-left:16px}.ml-\.5{margin-left:2px}.ml-1{margin-left:4px}.mr--1{margin-right:-4px}.mr-1{margin-right:4px}.mr-2{margin-right:8px}.mr-2\.5{margin-right:10px}.mt-1{margin-top:4px}.p-1{padding:4px}.p-4\!{padding:16px!important}.px,.px-4{padding-inline:16px}.px-1\.5{padding-inline:6px}.px-2{padding-inline:8px}.px-3{padding-inline:12px}.py-1{padding-block:4px}.py-1\.5{padding-block:6px}.py-2{padding-block:8px}.pl-1{padding-left:4px}.pl-4{padding-left:16px}.pr-4{padding-right:16px}.ps{padding-inline-start:16px}.outline-0{outline-style:var(--un-outline-style);outline-width:0}.outline-2{outline-style:var(--un-outline-style);outline-width:2px}.outline-blue{outline-color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.outline-none{--un-outline-style:none;outline-style:none}.b,.b-1,.border{border-width:1px}.b-2px{border-width:2px}.b-r-0{border-right-width:0}.b-\[--table-bg\]{border-color:color-mix(in oklab,var(--table-bg)var(--un-border-opacity),transparent)}.b-\#00000000\!{border-color:color-mix(in oklab,#0000 var(--un-border-opacity),transparent)!important}.b-\#4f7ff0{border-color:color-mix(in oklab,#4f7ff0 var(--un-border-opacity),transparent)}.b-\#f59e0b{border-color:color-mix(in oklab,#f59e0b var(--un-border-opacity),transparent)}.rd-1{border-radius:.25rem}.rd-1\.5{border-radius:.375rem}.rd-2{border-radius:.5rem}.rd-sm{border-radius:var(--radius-sm)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rd-l-4{border-top-left-radius:1rem;border-bottom-left-radius:1rem}.b-dashed{--un-border-style:dashed;border-style:dashed}.b-solid{--un-border-style:solid;border-style:solid}.bg-\[--c-primary\]{background-color:color-mix(in oklab,var(--c-primary)var(--un-bg-opacity),transparent)}.bg-\[--table-header-bg\]{background-color:color-mix(in oklab,var(--table-header-bg)var(--un-bg-opacity),transparent)}.bg-\#dbe6ff\/75{background-color:#dbe6ffbf;background-color:lab(91.0303% -.143617 -13.4803/.75)}.bg-\#fff{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent)}.bg-\#fff3d6\/85{background-color:#fff3d6d9;background-color:lab(96.236% .744224 15.5662/.85)}.bg-blue\/20\!{background-color:color-mix(in srgb,var(--colors-blue-DEFAULT)20%,transparent)!important}.bg-gray\/20{background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)20%,transparent)}.bg-green\!{background-color:color-mix(in srgb,var(--colors-green-DEFAULT)var(--un-bg-opacity),transparent)!important}.bg-red\!{background-color:color-mix(in srgb,var(--colors-red-DEFAULT)var(--un-bg-opacity),transparent)!important}.bg-transparent{background-color:#0000}.hover\:bg-\[--li-hover-bg\]:hover{background-color:color-mix(in oklab,var(--li-hover-bg)var(--un-bg-opacity),transparent)}.hover\:bg-black\/8:hover{background-color:color-mix(in srgb,var(--colors-black)8%,transparent)}.op-0{opacity:0}.op-15{opacity:.15}.op-60{opacity:.6}.op-75{opacity:.75}.op40{opacity:.4}.opacity-50{opacity:.5}.group:hover .group-hover\:op-100{opacity:1}.hover\:underline:hover{text-decoration-line:underline}.flex{display:flex}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-1{gap:4px}.gap-1\.5{gap:6px}.gap-2{gap:8px}.grid{display:grid}.size-3\.5{width:14px;height:14px}.size-4\!{width:16px!important;height:16px!important}.size-full{width:100%;height:100%}.h-1\!{height:4px!important}.h-2\.5{height:10px}.h-3\.5{height:14px}.h-6{height:24px}.h-6\.5{height:26px}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.max-h-60{max-height:240px}.max-h-inherit{max-height:inherit}.min-h-16{min-height:64px}.min-h-40{min-height:160px}.min-h-a\!{min-height:auto!important}.min-w-24{min-width:96px}.min-w-44{min-width:176px}.min-w-52{min-width:208px}.w-10{width:40px}.w-10px\!{width:10px!important}.w-2\.5{width:10px}.w-3\.5{width:14px}.w-6\.5{width:26px}.w-a\!{width:auto!important}.w-full{width:100%}.after\:h-1:after{height:4px}.after\:w-1:after{width:4px}.inline{display:inline}.block{display:block}.inline-block{display:inline-block}.contents{display:contents}.hidden{display:none}.visible{visibility:visible}.collapse{visibility:collapse}.cursor-pointer{cursor:pointer}.cursor-crosshair{cursor:crosshair}.cursor-s-resize{cursor:s-resize}.cursor-w-resize{cursor:w-resize}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.resize{resize:both}.resize-none{resize:none}.select-none{-webkit-user-select:none;user-select:none}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.uppercase{text-transform:uppercase}.shadow-inner{--un-shadow:inset 0 2px 4px 0 var(--un-shadow-color,#0000000d);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-sm{--un-shadow:0 1px 3px 0 var(--un-shadow-color,#0000001a),0 1px 2px -1px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-xl{--un-shadow:0 20px 25px -5px var(--un-shadow-color,#0000001a),0 8px 10px -6px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.translate-x--1\/2{--un-translate-x:-50%;translate:var(--un-translate-x)var(--un-translate-y)}.translate-x-1\/2{--un-translate-x:50%;translate:var(--un-translate-x)var(--un-translate-y)}.translate-y--1\/2{--un-translate-y:-50%;translate:var(--un-translate-x)var(--un-translate-y)}.transform{transform:var(--un-rotate-x)var(--un-rotate-y)var(--un-rotate-z)var(--un-skew-x)var(--un-skew-y)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,--un-gradient-from,--un-gradient-via,--un-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--un-ease,var(--default-transition-timingFunction));transition-duration:var(--un-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--un-ease,var(--default-transition-timingFunction));transition-duration:var(--un-duration,var(--default-transition-duration))}.items-start{align-items:flex-start}.items-center{align-items:center}.box-border{box-sizing:border-box}.inset-0{inset:0}.bottom-0{bottom:0}.left--0,.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-1\/2{top:50%}.justify-end\!{justify-content:flex-end!important}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.z--1{z-index:-1}.z-1{z-index:1}.z-2{z-index:2}.z-9{z-index:9}.overflow-auto{overflow:auto}.of-y-auto{overflow-y:auto}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.filter{filter:var(--un-blur,)var(--un-brightness,)var(--un-contrast,)var(--un-grayscale,)var(--un-hue-rotate,)var(--un-invert,)var(--un-saturate,)var(--un-sepia,)var(--un-drop-shadow,)}.table{display:table}.table-cell{display:table-cell}.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal,)var(--un-slashed-zero,)var(--un-numeric-figure,)var(--un-numeric-spacing,)var(--un-numeric-fraction,)}:where(.space-y-5>:not(:last-child)){--un-space-y-reverse:0;margin-block-start:calc(calc(4px*5)*var(--un-space-y-reverse));margin-block-end:calc(calc(4px*5)*calc(1 - var(--un-space-y-reverse)))}@supports (color:color-mix(in lab, red, red)){.c-blue{color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-text-opacity),transparent)}.c-gray\/70{color:color-mix(in oklab,var(--colors-gray-DEFAULT)70%,transparent)}.c-red\/75{color:color-mix(in oklab,var(--colors-red-DEFAULT)75%,transparent)}.outline-blue{outline-color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.bg-blue\/20\!{background-color:color-mix(in oklab,var(--colors-blue-DEFAULT)20%,transparent)!important}.bg-gray\/20{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)20%,transparent)}.bg-green\!{background-color:color-mix(in oklab,var(--colors-green-DEFAULT)var(--un-bg-opacity),transparent)!important}.bg-red\!{background-color:color-mix(in oklab,var(--colors-red-DEFAULT)var(--un-bg-opacity),transparent)!important}.hover\:bg-black\/8:hover{background-color:color-mix(in oklab,var(--colors-black)8%,transparent)}}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type Field } from './AndOrFields';
|
|
2
|
-
import type { AndOrNode } from './AndOr';
|
|
2
|
+
import type { AndOrNode, RuleNode } from './AndOr';
|
|
3
3
|
type FilterProps = {
|
|
4
4
|
col: Field;
|
|
5
5
|
tree: AndOrNode | undefined;
|
|
6
6
|
setTree: (tree?: AndOrNode) => void;
|
|
7
7
|
};
|
|
8
|
+
export declare function isRuleNode(node?: AndOrNode): node is RuleNode;
|
|
9
|
+
export declare function firstRule(node?: AndOrNode): RuleNode | undefined;
|
|
8
10
|
export declare const Filter: (props: FilterProps) => import("solid-js").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -2,12 +2,12 @@ import { Popover } from "./Popover.js";
|
|
|
2
2
|
import { AndOrFields, RuleValueEditor, isValueFreeOp, newRule } from "./AndOrFields.js";
|
|
3
3
|
import filter_default from "../filter.js";
|
|
4
4
|
import { addEventListener, className, createComponent, delegateEvents, effect, insert, template, use } from "solid-js/web";
|
|
5
|
-
import { Show } from "solid-js";
|
|
5
|
+
import { $PROXY, Show } from "solid-js";
|
|
6
6
|
import { isEqual } from "es-toolkit";
|
|
7
7
|
import { autoPlacement, offset } from "floating-ui-solid";
|
|
8
8
|
var _tmpl$ = /* @__PURE__ */ template("<div class=\"mt-1 flex gap-1.5\"><button aria-label=筛选 title=筛选>"), _tmpl$2 = /* @__PURE__ */ template("<div class=\"filter-input min-w-24 op-60 select-none\">"), _tmpl$3 = /* @__PURE__ */ template("<div class=\"tt-menu p-4! z-2\">");
|
|
9
9
|
function isRuleNode(e) {
|
|
10
|
-
return e
|
|
10
|
+
return e != null && e.op !== "and" && e.op !== "or";
|
|
11
11
|
}
|
|
12
12
|
function firstRule(e) {
|
|
13
13
|
if (e) {
|
|
@@ -19,26 +19,26 @@ function firstRule(e) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
const Filter = (y) => {
|
|
22
|
-
let b,
|
|
22
|
+
let b, S = () => y.tree, w = () => firstRule(S()), T = () => isValueFreeOp(w()?.op), E = (e) => {
|
|
23
23
|
if (isEqual({
|
|
24
|
-
...
|
|
24
|
+
...S(),
|
|
25
25
|
value: e
|
|
26
26
|
}, newRule(y.col))) {
|
|
27
27
|
y.setTree();
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
if (!
|
|
30
|
+
if (!S()) {
|
|
31
31
|
y.setTree(newRule(y.col, { value: e }));
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
let _ = firstRule(
|
|
35
|
-
_ && (_.value = e, y.setTree(
|
|
34
|
+
let _ = firstRule(S());
|
|
35
|
+
_ && (_[$PROXY].value = e, y.setTree(S()));
|
|
36
36
|
};
|
|
37
37
|
return (() => {
|
|
38
|
-
var v = _tmpl$(),
|
|
38
|
+
var v = _tmpl$(), x = v.firstChild;
|
|
39
39
|
v.$$click = (e) => e.stopPropagation(), addEventListener(v, "pointerdown", (e) => e.stopPropagation()), addEventListener(v, "keydown", (e) => e.stopPropagation()), insert(v, createComponent(Show, {
|
|
40
40
|
get when() {
|
|
41
|
-
return !
|
|
41
|
+
return !T();
|
|
42
42
|
},
|
|
43
43
|
get fallback() {
|
|
44
44
|
return _tmpl$2();
|
|
@@ -49,21 +49,21 @@ const Filter = (y) => {
|
|
|
49
49
|
return y.col;
|
|
50
50
|
},
|
|
51
51
|
get op() {
|
|
52
|
-
return
|
|
52
|
+
return w()?.op;
|
|
53
53
|
},
|
|
54
54
|
class: "filter-input h-6",
|
|
55
55
|
get value() {
|
|
56
|
-
return
|
|
56
|
+
return w()?.value ?? "";
|
|
57
57
|
},
|
|
58
58
|
get enum() {
|
|
59
59
|
return y.col.enum;
|
|
60
60
|
},
|
|
61
|
-
onChange: (e) =>
|
|
61
|
+
onChange: (e) => E(String(e ?? ""))
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
}),
|
|
65
|
-
var
|
|
66
|
-
return typeof
|
|
64
|
+
}), x);
|
|
65
|
+
var C = b;
|
|
66
|
+
return typeof C == "function" ? use(C, x) : b = x, insert(x, createComponent(filter_default, { class: "size-3.5 op-75" })), insert(v, createComponent(Popover, {
|
|
67
67
|
trigger: "click",
|
|
68
68
|
strategy: "fixed",
|
|
69
69
|
placement: "bottom",
|
|
@@ -82,7 +82,7 @@ const Filter = (y) => {
|
|
|
82
82
|
return [y.col];
|
|
83
83
|
},
|
|
84
84
|
get value() {
|
|
85
|
-
return
|
|
85
|
+
return S() ?? newRule(y.col);
|
|
86
86
|
},
|
|
87
87
|
onChange: (e) => y.setTree(isEqual(e, newRule(y.col)) ? void 0 : e),
|
|
88
88
|
newRule: () => newRule(y.col),
|
|
@@ -90,8 +90,8 @@ const Filter = (y) => {
|
|
|
90
90
|
})), e;
|
|
91
91
|
})();
|
|
92
92
|
}
|
|
93
|
-
}), null), effect(() => className(
|
|
93
|
+
}), null), effect(() => className(x, `filter-input w-a! flex items-center justify-center ${S() && "bg-blue/20! c-blue b-#00000000!"}`)), v;
|
|
94
94
|
})();
|
|
95
95
|
};
|
|
96
96
|
delegateEvents(["click"]);
|
|
97
|
-
export { Filter };
|
|
97
|
+
export { Filter, firstRule, isRuleNode };
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { type JSX } from 'solid-js';
|
|
1
|
+
import { type Accessor, type JSX } from 'solid-js';
|
|
2
2
|
import { type createFloatingProps, type ReferenceType } from 'floating-ui-solid';
|
|
3
3
|
import type { AutoUpdateOptions } from '@floating-ui/dom';
|
|
4
4
|
export declare function Popover(attrs: FloatingProps): JSX.Element;
|
|
5
5
|
type FloatingProps = {
|
|
6
|
-
reference: ReferenceType | JSX.Element
|
|
7
|
-
floating?: JSX.Element
|
|
6
|
+
reference: Accessor<ReferenceType | JSX.Element>;
|
|
7
|
+
floating?: Accessor<JSX.Element>;
|
|
8
8
|
portal?: HTMLElement;
|
|
9
9
|
trigger?: 'click' | 'hover';
|
|
10
10
|
} & createFloatingProps;
|
|
11
|
-
export declare function Floating(
|
|
11
|
+
export declare function Floating(props: FloatingProps & {
|
|
12
12
|
update?: Partial<AutoUpdateOptions>;
|
|
13
13
|
}): JSX.Element;
|
|
14
|
+
export declare const useFloating: (attrs: FloatingProps & {
|
|
15
|
+
update?: Partial<AutoUpdateOptions>;
|
|
16
|
+
}) => void;
|
|
14
17
|
export {};
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import { useClicked, useHover, useMemoAsync } from "../hooks/index.js";
|
|
2
2
|
import { Portal, createComponent, memo, mergeProps } from "solid-js/web";
|
|
3
|
-
import { children, createEffect,
|
|
4
|
-
import {
|
|
3
|
+
import { children, createEffect, splitProps } from "solid-js";
|
|
4
|
+
import { createLazyMemo } from "@solid-primitives/memo";
|
|
5
|
+
import { delay, mapValues } from "es-toolkit";
|
|
5
6
|
import { autoUpdate, createFloating } from "floating-ui-solid";
|
|
6
|
-
function Popover(
|
|
7
|
-
let [
|
|
8
|
-
return createComponent(Floating, mergeProps(
|
|
9
|
-
reference:
|
|
10
|
-
floating:
|
|
7
|
+
function Popover(u) {
|
|
8
|
+
let [f, p] = splitProps(u, ["reference", "floating"]), m = (u.trigger == "click" ? useClicked : useHover)(() => [g(), _()].filter((e) => e)), h = useMemoAsync(() => u.trigger == "click" ? m() : m() ? delay(100).then(() => !0) : delay(200).then(() => !1)), g = children(() => u.reference), _ = children(() => h() ? u.floating : void 0);
|
|
9
|
+
return createComponent(Floating, mergeProps(p, {
|
|
10
|
+
reference: g,
|
|
11
|
+
floating: _
|
|
11
12
|
}));
|
|
12
13
|
}
|
|
13
14
|
function Floating(e) {
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
let c = children(() => e.reference), l = children(() => e.floating);
|
|
16
|
+
return useFloating(e), [memo(c), memo(() => memo(() => !!(e.portal && l()))() ? createComponent(Portal, {
|
|
17
|
+
get mount() {
|
|
18
|
+
return e.portal;
|
|
19
|
+
},
|
|
20
|
+
get children() {
|
|
21
|
+
return l();
|
|
22
|
+
}
|
|
23
|
+
}) : l())];
|
|
24
|
+
}
|
|
25
|
+
const useFloating = (e) => {
|
|
26
|
+
let [c, l] = splitProps(e, ["reference", "floating"]), u = children(() => e.reference), d = children(() => e.floating), f = createLazyMemo(() => d() && u() ? createFloating({
|
|
27
|
+
whileElementsMounted(c, l, u) {
|
|
28
|
+
return autoUpdate(c, l, u, {
|
|
17
29
|
ancestorResize: !0,
|
|
18
30
|
elementResize: !0,
|
|
19
31
|
layoutShift: !0,
|
|
@@ -21,21 +33,16 @@ function Floating(e) {
|
|
|
21
33
|
...e.update
|
|
22
34
|
});
|
|
23
35
|
},
|
|
24
|
-
...
|
|
36
|
+
...l,
|
|
25
37
|
elements: {
|
|
26
|
-
reference:
|
|
27
|
-
floating:
|
|
38
|
+
reference: u,
|
|
39
|
+
floating: d
|
|
28
40
|
}
|
|
29
41
|
}).floatingStyles : void 0);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return f();
|
|
38
|
-
}
|
|
39
|
-
}) : f())];
|
|
40
|
-
}
|
|
41
|
-
export { Floating, Popover };
|
|
42
|
+
createEffect((e) => {
|
|
43
|
+
e = mapValues(e ?? {}, () => null);
|
|
44
|
+
let c = f()?.();
|
|
45
|
+
return c ||= { display: "none" }, d() && Object.assign(d().style, e, c), c;
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
export { Floating, Popover, useFloating };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
type Opt = Partial<{
|
|
2
|
+
value: any;
|
|
3
|
+
onChange: any;
|
|
4
|
+
defaultValue: any;
|
|
5
|
+
initialValue: any;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const useControlled: <T extends Opt>(opt: T, owner?: any) => ((T extends any ? {} & { [K in keyof T]: K extends never ? T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends undefined ? {}[K] : T_1 : never : never : T[K]; } : {} & T) extends infer T_2 ? T_2 extends (T extends any ? {} & { [K in keyof T]: K extends never ? T[K] extends infer T_8 ? T_8 extends T[K] ? T_8 extends undefined ? {}[K] : T_8 : never : never : T[K]; } : {} & T) ? T_2 extends any ? { [K_1 in keyof T_2]: K_1 extends "value" | "onChange" | "$setOpt" ? {
|
|
8
|
+
readonly value: any;
|
|
9
|
+
onChange: (v: any) => void;
|
|
10
|
+
$setOpt: any;
|
|
11
|
+
}[K_1] extends infer T_3 ? T_3 extends {
|
|
12
|
+
readonly value: any;
|
|
13
|
+
onChange: (v: any) => void;
|
|
14
|
+
$setOpt: any;
|
|
15
|
+
}[K_1] ? T_3 extends undefined ? T_2[K_1] : T_3 : never : never : T_2[K_1]; } & {
|
|
16
|
+
readonly value: "value" extends infer T_4 ? T_4 extends "value" ? T_4 extends keyof T_2 ? {
|
|
17
|
+
readonly value: any;
|
|
18
|
+
onChange: (v: any) => void;
|
|
19
|
+
$setOpt: any;
|
|
20
|
+
}[T_4] extends infer T_5 ? T_5 extends {
|
|
21
|
+
readonly value: any;
|
|
22
|
+
onChange: (v: any) => void;
|
|
23
|
+
$setOpt: any;
|
|
24
|
+
}[T_4] ? T_5 extends undefined ? T_2[T_4] : T_5 : never : never : {
|
|
25
|
+
readonly value: any;
|
|
26
|
+
onChange: (v: any) => void;
|
|
27
|
+
$setOpt: any;
|
|
28
|
+
}[T_4] : never : never;
|
|
29
|
+
onChange: "onChange" extends infer T_4 ? T_4 extends "onChange" ? T_4 extends keyof T_2 ? {
|
|
30
|
+
readonly value: any;
|
|
31
|
+
onChange: (v: any) => void;
|
|
32
|
+
$setOpt: any;
|
|
33
|
+
}[T_4] extends infer T_5 ? T_5 extends {
|
|
34
|
+
readonly value: any;
|
|
35
|
+
onChange: (v: any) => void;
|
|
36
|
+
$setOpt: any;
|
|
37
|
+
}[T_4] ? T_5 extends undefined ? T_2[T_4] : T_5 : never : never : {
|
|
38
|
+
readonly value: any;
|
|
39
|
+
onChange: (v: any) => void;
|
|
40
|
+
$setOpt: any;
|
|
41
|
+
}[T_4] : never : never;
|
|
42
|
+
$setOpt: "$setOpt" extends infer T_6 ? T_6 extends "$setOpt" ? T_6 extends keyof T_2 ? {
|
|
43
|
+
readonly value: any;
|
|
44
|
+
onChange: (v: any) => void;
|
|
45
|
+
$setOpt: any;
|
|
46
|
+
}[T_6] extends infer T_7 ? T_7 extends {
|
|
47
|
+
readonly value: any;
|
|
48
|
+
onChange: (v: any) => void;
|
|
49
|
+
$setOpt: any;
|
|
50
|
+
}[T_6] ? T_7 extends undefined ? T_2[T_6] : T_7 : never : never : {
|
|
51
|
+
readonly value: any;
|
|
52
|
+
onChange: (v: any) => void;
|
|
53
|
+
$setOpt: any;
|
|
54
|
+
}[T_6] : never : never;
|
|
55
|
+
} : T_2 & {
|
|
56
|
+
readonly value: any;
|
|
57
|
+
onChange: (v: any) => void;
|
|
58
|
+
$setOpt: any;
|
|
59
|
+
} : never : never) extends infer T_9 ? T_9 extends ((T extends any ? {} & { [K in keyof T]: K extends never ? T[K] extends infer T_10 ? T_10 extends T[K] ? T_10 extends undefined ? {}[K] : T_10 : never : never : T[K]; } : {} & T) extends infer T_11 ? T_11 extends (T extends any ? {} & { [K in keyof T]: K extends never ? T[K] extends infer T_17 ? T_17 extends T[K] ? T_17 extends undefined ? {}[K] : T_17 : never : never : T[K]; } : {} & T) ? T_11 extends any ? { [K_3 in keyof T_11]: K_3 extends "value" | "onChange" | "$setOpt" ? {
|
|
60
|
+
readonly value: any;
|
|
61
|
+
onChange: (v: any) => void;
|
|
62
|
+
$setOpt: any;
|
|
63
|
+
}[K_3] extends infer T_12 ? T_12 extends {
|
|
64
|
+
readonly value: any;
|
|
65
|
+
onChange: (v: any) => void;
|
|
66
|
+
$setOpt: any;
|
|
67
|
+
}[K_3] ? T_12 extends undefined ? T_11[K_3] : T_12 : never : never : T_11[K_3]; } & {
|
|
68
|
+
readonly value: "value" extends infer T_13 ? T_13 extends "value" ? T_13 extends keyof T_11 ? {
|
|
69
|
+
readonly value: any;
|
|
70
|
+
onChange: (v: any) => void;
|
|
71
|
+
$setOpt: any;
|
|
72
|
+
}[T_13] extends infer T_14 ? T_14 extends {
|
|
73
|
+
readonly value: any;
|
|
74
|
+
onChange: (v: any) => void;
|
|
75
|
+
$setOpt: any;
|
|
76
|
+
}[T_13] ? T_14 extends undefined ? T_11[T_13] : T_14 : never : never : {
|
|
77
|
+
readonly value: any;
|
|
78
|
+
onChange: (v: any) => void;
|
|
79
|
+
$setOpt: any;
|
|
80
|
+
}[T_13] : never : never;
|
|
81
|
+
onChange: "onChange" extends infer T_13 ? T_13 extends "onChange" ? T_13 extends keyof T_11 ? {
|
|
82
|
+
readonly value: any;
|
|
83
|
+
onChange: (v: any) => void;
|
|
84
|
+
$setOpt: any;
|
|
85
|
+
}[T_13] extends infer T_14 ? T_14 extends {
|
|
86
|
+
readonly value: any;
|
|
87
|
+
onChange: (v: any) => void;
|
|
88
|
+
$setOpt: any;
|
|
89
|
+
}[T_13] ? T_14 extends undefined ? T_11[T_13] : T_14 : never : never : {
|
|
90
|
+
readonly value: any;
|
|
91
|
+
onChange: (v: any) => void;
|
|
92
|
+
$setOpt: any;
|
|
93
|
+
}[T_13] : never : never;
|
|
94
|
+
$setOpt: "$setOpt" extends infer T_15 ? T_15 extends "$setOpt" ? T_15 extends keyof T_11 ? {
|
|
95
|
+
readonly value: any;
|
|
96
|
+
onChange: (v: any) => void;
|
|
97
|
+
$setOpt: any;
|
|
98
|
+
}[T_15] extends infer T_16 ? T_16 extends {
|
|
99
|
+
readonly value: any;
|
|
100
|
+
onChange: (v: any) => void;
|
|
101
|
+
$setOpt: any;
|
|
102
|
+
}[T_15] ? T_16 extends undefined ? T_11[T_15] : T_16 : never : never : {
|
|
103
|
+
readonly value: any;
|
|
104
|
+
onChange: (v: any) => void;
|
|
105
|
+
$setOpt: any;
|
|
106
|
+
}[T_15] : never : never;
|
|
107
|
+
} : T_11 & {
|
|
108
|
+
readonly value: any;
|
|
109
|
+
onChange: (v: any) => void;
|
|
110
|
+
$setOpt: any;
|
|
111
|
+
} : never : never) ? T_9 extends any ? { [K_2 in keyof T_9]: T_9[K_2]; } : T_9 : never : never;
|
|
112
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createSignal, mergeProps, runWithOwner } from "solid-js";
|
|
2
|
+
const useControlled = (r, i) => {
|
|
3
|
+
let a = (e) => i ? runWithOwner(i, e) : e(), [o, s] = a(() => createSignal(r ?? {}));
|
|
4
|
+
r = a(() => mergeProps(o));
|
|
5
|
+
let [c, l] = a(() => createSignal(r.value ?? r.initialValue ?? r.defaultValue)), u = () => "value" in r ? r.value : c();
|
|
6
|
+
return mergeProps(r, {
|
|
7
|
+
get value() {
|
|
8
|
+
return u();
|
|
9
|
+
},
|
|
10
|
+
onChange: (e) => {
|
|
11
|
+
e ??= r.defaultValue, l(e), r.onChange?.(e);
|
|
12
|
+
},
|
|
13
|
+
$setOpt: s
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export { useControlled };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type JSX, type Component } from 'solid-js';
|
|
1
|
+
import { type JSX, type Component, type Owner } from 'solid-js';
|
|
2
2
|
import 'virtual:uno.css';
|
|
3
3
|
import './style.scss';
|
|
4
4
|
import './plugins/CellSelectionPlugin';
|
|
@@ -44,6 +44,7 @@ export interface Plugin {
|
|
|
44
44
|
store?: (store: TableStore) => Partial<TableStore> | void;
|
|
45
45
|
rewriteProps?: ProcessProps;
|
|
46
46
|
layers?: Component<TableStore>[];
|
|
47
|
+
onInit?: (store: TableStore) => void;
|
|
47
48
|
onMount?: (store: TableStore) => void;
|
|
48
49
|
/**
|
|
49
50
|
* Declare keyboard shortcuts for this plugin.
|
|
@@ -147,11 +148,12 @@ export interface TableStore extends Obj {
|
|
|
147
148
|
height: number;
|
|
148
149
|
}>[];
|
|
149
150
|
internal: symbol;
|
|
150
|
-
raw:
|
|
151
|
+
raw: any;
|
|
151
152
|
props: TableProps2;
|
|
152
153
|
rawProps: TableProps;
|
|
153
154
|
ID: string;
|
|
154
155
|
plugins: Plugin[];
|
|
156
|
+
owner: Owner;
|
|
155
157
|
}
|
|
156
158
|
export declare const Intable: (props: TableProps) => JSX.Element;
|
|
157
159
|
export default Intable;
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { FilterPlugin } from "./plugins/FilterPlugin.js";
|
|
|
24
24
|
import { ImportExportPlugin } from "./plugins/ImportExportPlugin.js";
|
|
25
25
|
import loading_bold_default from "./loading-bold.js";
|
|
26
26
|
import { createComponent, insert, memo, mergeProps, spread, template, use } from "solid-js/web";
|
|
27
|
-
import { $PROXY, For, batch, createContext, createEffect, createMemo, createSignal, getOwner, mapArray, mergeProps as mergeProps$1, on, onCleanup, onMount, runWithOwner, untrack, useContext } from "solid-js";
|
|
27
|
+
import { $PROXY, For, batch, createComputed, createContext, createEffect, createMemo, createSignal, getOwner, mapArray, mergeProps as mergeProps$1, on, onCleanup, onMount, runWithOwner, untrack, useContext } from "solid-js";
|
|
28
28
|
import { createMutable, reconcile } from "solid-js/store";
|
|
29
29
|
import { combineProps } from "@solid-primitives/props";
|
|
30
30
|
import { createLazyMemo } from "@solid-primitives/memo";
|
|
@@ -43,7 +43,8 @@ const Ctx = createContext({
|
|
|
43
43
|
},
|
|
44
44
|
get plugins() {
|
|
45
45
|
return X();
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
owner: getOwner()
|
|
47
48
|
}), Y = memoize((_) => runWithOwner(K, () => unFn(_, J))), X = createMemo((q) => {
|
|
48
49
|
let X = [
|
|
49
50
|
...defaultsPlugins,
|
|
@@ -62,7 +63,7 @@ const Ctx = createContext({
|
|
|
62
63
|
return new Proxy({}, { get(_, K, q) {
|
|
63
64
|
return K == $PROXY ? q : Y(K)();
|
|
64
65
|
} });
|
|
65
|
-
})(), onMount(() => {
|
|
66
|
+
})(), createComputed(mapArray(X, (_) => _.onInit?.(J))), onMount(() => {
|
|
66
67
|
createEffect(mapArray(X, (_) => _.onMount?.(J)));
|
|
67
68
|
});
|
|
68
69
|
let Q = createMutable({
|
|
@@ -213,7 +214,10 @@ function BasePlugin() {
|
|
|
213
214
|
rewriteProps: {
|
|
214
215
|
data: ({ data: _ = [] }) => _,
|
|
215
216
|
columns: ({ columns: _ = [] }) => _,
|
|
216
|
-
newRow: ({ newRow: _
|
|
217
|
+
newRow: ({ newRow: _ }, { store: K }) => function() {
|
|
218
|
+
let q = _?.(...arguments) || {};
|
|
219
|
+
return q[K.props.rowKey] ??= Symbol(), q;
|
|
220
|
+
},
|
|
217
221
|
Scroll: ({ Scroll: _ = K }, { store: q }) => (K) => {
|
|
218
222
|
let J = createScrollPosition(() => q.scroll_el), Y = createElementSize(() => q.scroll_el), X = createMemo(() => {
|
|
219
223
|
let _ = q.scroll_el;
|
|
@@ -262,7 +266,7 @@ function BasePlugin() {
|
|
|
262
266
|
return q = combineProps({ ref: Y }, q), createEffect(() => {
|
|
263
267
|
let { y: _ } = q;
|
|
264
268
|
_ != null && (K.trs[_] = J(), K.trObs.observe(J()), onCleanup(() => {
|
|
265
|
-
K.
|
|
269
|
+
K.trObs.unobserve(J()), K.trs[_] = void 0, !(K.props.data.length > _) && (K.trSizes[_] = void 0);
|
|
266
270
|
}));
|
|
267
271
|
}), createComponent(_, q);
|
|
268
272
|
},
|
|
@@ -282,13 +286,13 @@ function BasePlugin() {
|
|
|
282
286
|
return J.col.style;
|
|
283
287
|
}
|
|
284
288
|
}, { get style() {
|
|
285
|
-
return J.col.width ? `width: ${J.col.width}px` : "";
|
|
289
|
+
return J.col.width ? `width: ${J.col.width}px; max-width: ${J.col.width}px` : "";
|
|
286
290
|
} });
|
|
287
291
|
return createEffect(() => {
|
|
288
292
|
if (J.covered || (J.colspan ?? 1) != 1) return;
|
|
289
293
|
let { x: _ } = J;
|
|
290
294
|
K.ths[_] = Y(), K.thObs.observe(Y()), onCleanup(() => {
|
|
291
|
-
K.
|
|
295
|
+
K.thObs.unobserve(Y()), K.ths[_] = void 0, !(K.props.columns.length > _) && (K.thSizes[_] = void 0);
|
|
292
296
|
});
|
|
293
297
|
}), createComponent(_, mergeProps(Q, { get children() {
|
|
294
298
|
return J.children;
|
|
@@ -310,7 +314,7 @@ function BasePlugin() {
|
|
|
310
314
|
return K.col.style;
|
|
311
315
|
}
|
|
312
316
|
}, { get style() {
|
|
313
|
-
return K.col.width ? `width: ${K.col.width}px` : "";
|
|
317
|
+
return K.col.width ? `width: ${K.col.width}px; max-width: ${K.col.width}px` : "";
|
|
314
318
|
} });
|
|
315
319
|
return createComponent(_, mergeProps(Y, { get children() {
|
|
316
320
|
return K.children;
|