intable 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +378 -378
  3. package/dist/__uno.css +1 -1
  4. package/dist/components/AndOrFields.d.ts +1 -1
  5. package/dist/components/AndOrFields.js +193 -74
  6. package/dist/components/Filter.d.ts +0 -1
  7. package/dist/hooks/useVirtualizer.d.ts +3 -0
  8. package/dist/hooks/useVirtualizer.js +12 -2
  9. package/dist/index.d.ts +3 -3
  10. package/dist/index.js +17 -11
  11. package/dist/loading-bold.js +6 -0
  12. package/dist/plugins/CellMergePlugin.js +15 -16
  13. package/dist/plugins/CellSelectionPlugin.js +97 -69
  14. package/dist/plugins/CommandPlugin.js +3 -1
  15. package/dist/plugins/CopyPastePlugin.js +1 -1
  16. package/dist/plugins/DiffPlugin.d.ts +0 -1
  17. package/dist/plugins/DiffPlugin.js +2 -2
  18. package/dist/plugins/EditablePlugin.js +74 -74
  19. package/dist/plugins/ExpandPlugin.js +0 -1
  20. package/dist/plugins/FilterPlugin.js +95 -53
  21. package/dist/plugins/ImportExportPlugin.d.ts +9 -0
  22. package/dist/plugins/ImportExportPlugin.js +37 -0
  23. package/dist/plugins/LoadMorePlugin.js +1 -1
  24. package/dist/plugins/MenuPlugin.d.ts +1 -0
  25. package/dist/plugins/MenuPlugin.js +7 -0
  26. package/dist/plugins/RenderPlugin/index.d.ts +3 -3
  27. package/dist/plugins/RenderPlugin/index.js +12 -12
  28. package/dist/plugins/ResizePlugin.js +45 -36
  29. package/dist/plugins/RowGroupPlugin.js +1 -1
  30. package/dist/plugins/TreePlugin.js +25 -23
  31. package/dist/plugins/ValidatorPlugin.js +14 -12
  32. package/dist/plugins/VirtualScrollPlugin.js +16 -2
  33. package/dist/style.css +2 -2
  34. package/dist/theme/antd.scss +41 -41
  35. package/dist/theme/dark.scss +46 -46
  36. package/dist/theme/element-plus.scss +38 -38
  37. package/dist/theme/github.scss +80 -80
  38. package/dist/theme/material.scss +73 -73
  39. package/dist/theme/shadcn.scss +66 -66
  40. package/dist/theme/stripe.scss +57 -57
  41. package/package.json +3 -2
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-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;--radius-md:.375rem;--default-transition-timingFunction:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--radius-xl:.75rem;--fontWeight-medium:500;--radius-sm:.25rem;--colors-blue-DEFAULT:#54a2ff;--colors-red-DEFAULT:#ff6568;--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";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--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-3{font-size:.75rem}.text-3\.5{font-size:.875rem}.text-4{font-size:1rem}.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-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}.font-medium{--un-font-weight:var(--fontWeight-medium);font-weight:var(--fontWeight-medium)}.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}.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-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-\#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-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}.group:hover .group-hover\:op-100{opacity:1}.flex{display:flex}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-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-6{height:24px}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.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-52{min-width:208px}.w-10{width:40px}.w-10px\!{width:10px!important}.w-a\!{width:auto!important}.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-s-resize{cursor:s-resize}.cursor-w-resize{cursor:w-resize}.pointer-events-none{pointer-events:none}.resize{resize:both}.resize-none{resize:none}.select-none{-webkit-user-select:none;user-select:none}.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)}.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}.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}.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}: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-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-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;--radius-md:.375rem;--default-transition-timingFunction:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--radius-xl:.75rem;--fontWeight-medium:500;--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";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--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-xs{font-size:var(--text-xs-fontSize);line-height:var(--un-leading,var(--text-xs-lineHeight))}.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}.font-medium{--un-font-weight:var(--fontWeight-medium);font-weight:var(--fontWeight-medium)}.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}.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-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-\#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-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}.group:hover .group-hover\:op-100{opacity:1}.flex{display:flex}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-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-6{height:24px}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.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-52{min-width:208px}.w-10{width:40px}.w-10px\!{width:10px!important}.w-a\!{width:auto!important}.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-s-resize{cursor:s-resize}.cursor-w-resize{cursor:w-resize}.pointer-events-none{pointer-events:none}.resize{resize:both}.resize-none{resize:none}.select-none{-webkit-user-select:none;user-select:none}.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)}.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}.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}@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}: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,5 +1,5 @@
1
1
  import type { AndOrNode, RuleNode } from './AndOr';
2
- export type RuleOp = 'contains' | 'eq' | 'neq' | 'startwith' | 'endwith' | 'blank' | 'noblank' | 'lt' | 'gt' | 'lte' | 'gte' | 'true' | 'false';
2
+ export type RuleOp = 'contains' | 'eq' | 'ne' | 'in' | 'not_in' | 'startwith' | 'endwith' | 'blank' | 'noblank' | 'lt' | 'gt' | 'lte' | 'gte' | 'between' | 'not_between' | 'true' | 'false';
3
3
  export type Field = {
4
4
  id: string;
5
5
  name?: string;
@@ -1,10 +1,10 @@
1
1
  import { resolveOptions } from "../utils.js";
2
2
  import { AndOr } from "./AndOr.js";
3
- import { className, createComponent, delegateEvents, effect, insert, mergeProps, setAttribute, template } from "solid-js/web";
3
+ import { className, createComponent, delegateEvents, effect, insert, memo, mergeProps, setAttribute, template } from "solid-js/web";
4
4
  import { Match, Switch, createMemo } from "solid-js";
5
- var _tmpl$ = /* @__PURE__ */ template("<input type=number>"), _tmpl$2 = /* @__PURE__ */ template("<input type=date>"), _tmpl$3 = /* @__PURE__ */ template("<select><option value>"), _tmpl$4 = /* @__PURE__ */ template("<input>"), _tmpl$5 = /* @__PURE__ */ template("<option>"), _tmpl$6 = /* @__PURE__ */ template("<div class=\"flex items-center gap-2\"><select><option value disabled>选择字段</option></select><select class=\"px-2 py-1 rounded-md border\">"), VALUE_FREE_RULES = ["blank", "noblank"];
6
- function isValueFreeOp(e) {
7
- return VALUE_FREE_RULES.includes(e);
5
+ var _tmpl$ = /* @__PURE__ */ template("<select multiple>"), _tmpl$2 = /* @__PURE__ */ template("<input>"), _tmpl$3 = /* @__PURE__ */ template("<input type=number>"), _tmpl$4 = /* @__PURE__ */ template("<input type=date>"), _tmpl$5 = /* @__PURE__ */ template("<select><option value>"), _tmpl$6 = /* @__PURE__ */ template("<div class=\"flex-1 flex items-center gap-1\"><input placeholder=开始><span class=\"text-xs c-gray/70\">~</span><input placeholder=结束>"), _tmpl$7 = /* @__PURE__ */ template("<option>"), _tmpl$8 = /* @__PURE__ */ template("<div class=\"flex items-center gap-2\"><select><option value disabled>选择字段</option></select><select class=\"px-2 py-1 rounded-md border\">"), VALUE_FREE_RULES = ["blank", "noblank"];
6
+ function isValueFreeOp(o) {
7
+ return VALUE_FREE_RULES.includes(o);
8
8
  }
9
9
  const RULES_BY_TYPE = {
10
10
  text: [
@@ -18,7 +18,15 @@ const RULES_BY_TYPE = {
18
18
  },
19
19
  {
20
20
  label: "不等于",
21
- value: "neq"
21
+ value: "ne"
22
+ },
23
+ {
24
+ label: "在列表中",
25
+ value: "in"
26
+ },
27
+ {
28
+ label: "不在列表中",
29
+ value: "not_in"
22
30
  },
23
31
  {
24
32
  label: "开头是",
@@ -44,7 +52,7 @@ const RULES_BY_TYPE = {
44
52
  },
45
53
  {
46
54
  label: "不等于",
47
- value: "neq"
55
+ value: "ne"
48
56
  },
49
57
  {
50
58
  label: "小于",
@@ -62,6 +70,22 @@ const RULES_BY_TYPE = {
62
70
  label: "大于等于",
63
71
  value: "gte"
64
72
  },
73
+ {
74
+ label: "介于",
75
+ value: "between"
76
+ },
77
+ {
78
+ label: "不介于",
79
+ value: "not_between"
80
+ },
81
+ {
82
+ label: "在列表中",
83
+ value: "in"
84
+ },
85
+ {
86
+ label: "不在列表中",
87
+ value: "not_in"
88
+ },
65
89
  {
66
90
  label: "为空",
67
91
  value: "blank"
@@ -78,7 +102,7 @@ const RULES_BY_TYPE = {
78
102
  },
79
103
  {
80
104
  label: "不等于",
81
- value: "neq"
105
+ value: "ne"
82
106
  },
83
107
  {
84
108
  label: "早于",
@@ -96,6 +120,22 @@ const RULES_BY_TYPE = {
96
120
  label: "不早于",
97
121
  value: "gte"
98
122
  },
123
+ {
124
+ label: "介于",
125
+ value: "between"
126
+ },
127
+ {
128
+ label: "不介于",
129
+ value: "not_between"
130
+ },
131
+ {
132
+ label: "在列表中",
133
+ value: "in"
134
+ },
135
+ {
136
+ label: "不在列表中",
137
+ value: "not_in"
138
+ },
99
139
  {
100
140
  label: "为空",
101
141
  value: "blank"
@@ -112,7 +152,15 @@ const RULES_BY_TYPE = {
112
152
  },
113
153
  {
114
154
  label: "不等于",
115
- value: "neq"
155
+ value: "ne"
156
+ },
157
+ {
158
+ label: "在列表中",
159
+ value: "in"
160
+ },
161
+ {
162
+ label: "不在列表中",
163
+ value: "not_in"
116
164
  },
117
165
  {
118
166
  label: "为空",
@@ -130,7 +178,15 @@ const RULES_BY_TYPE = {
130
178
  },
131
179
  {
132
180
  label: "不等于",
133
- value: "neq"
181
+ value: "ne"
182
+ },
183
+ {
184
+ label: "在列表中",
185
+ value: "in"
186
+ },
187
+ {
188
+ label: "不在列表中",
189
+ value: "not_in"
134
190
  },
135
191
  {
136
192
  label: "为空",
@@ -141,26 +197,39 @@ const RULES_BY_TYPE = {
141
197
  value: "noblank"
142
198
  }
143
199
  ]
144
- }, RuleValueEditor = (_) => {
145
- let b = () => normalizeType(_.field), S = () => resolveOptions(_.enum ?? []);
200
+ };
201
+ function isBetweenOp(o) {
202
+ return o === "between" || o === "not_between";
203
+ }
204
+ function isListOp(o) {
205
+ return o === "in" || o === "not_in";
206
+ }
207
+ function toPair(o) {
208
+ return Array.isArray(o) ? [o[0] ?? "", o[1] ?? ""] : o == null || o === "" ? ["", ""] : [o, ""];
209
+ }
210
+ function toList(o) {
211
+ return Array.isArray(o) ? o : o == null || o === "" ? [] : String(o).split(",").map((o) => o.trim()).filter(Boolean);
212
+ }
213
+ const RuleValueEditor = (w) => {
214
+ let D = () => normalizeType(w.field), j = () => resolveOptions(w.enum ?? []), N = () => w.op || defaultOp(D());
146
215
  return createComponent(Switch, {
147
216
  get fallback() {
148
217
  return (() => {
149
- var e = _tmpl$4();
150
- return e.$$input = (e) => _.onChange(e.target.value), effect((y) => {
151
- var b = _.class ?? "flex-1 px-2 py-1 rounded-md border", x = _.placeholder;
152
- return b !== y.e && className(e, y.e = b), x !== y.t && setAttribute(e, "placeholder", y.t = x), y;
218
+ var o = _tmpl$2();
219
+ return o.$$input = (o) => w.onChange(o.target.value), effect((E) => {
220
+ var D = w.class ?? "flex-1 px-2 py-1 rounded-md border", O = w.placeholder;
221
+ return D !== E.e && className(o, E.e = D), O !== E.t && setAttribute(o, "placeholder", E.t = O), E;
153
222
  }, {
154
223
  e: void 0,
155
224
  t: void 0
156
- }), effect(() => e.value = _.value ?? ""), e;
225
+ }), effect(() => o.value = w.value ?? ""), o;
157
226
  })();
158
227
  },
159
228
  get children() {
160
229
  return [
161
230
  createComponent(Match, {
162
231
  get when() {
163
- return isValueFreeOp(_.op || defaultOp(b()));
232
+ return isValueFreeOp(w.op || defaultOp(D()));
164
233
  },
165
234
  get children() {
166
235
  return [];
@@ -168,38 +237,85 @@ const RULES_BY_TYPE = {
168
237
  }),
169
238
  createComponent(Match, {
170
239
  get when() {
171
- return b() === "number";
240
+ return isBetweenOp(N());
241
+ },
242
+ get children() {
243
+ return (() => {
244
+ let [o, E] = toPair(w.value), k = D() === "number" ? "number" : D() === "date" ? "date" : "text";
245
+ return (() => {
246
+ var D = _tmpl$6(), A = D.firstChild, j = A.nextSibling, N = j.nextSibling;
247
+ return A.$$input = (o) => w.onChange([o.target.value, E ?? ""]), setAttribute(A, "type", k), A.value = o ?? "", N.$$input = (T) => w.onChange([o ?? "", T.target.value]), setAttribute(N, "type", k), N.value = E ?? "", effect((o) => {
248
+ var E = w.class ?? "flex-1 px-2 py-1 rounded-md border", D = w.class ?? "flex-1 px-2 py-1 rounded-md border";
249
+ return E !== o.e && className(A, o.e = E), D !== o.t && className(N, o.t = D), o;
250
+ }, {
251
+ e: void 0,
252
+ t: void 0
253
+ }), D;
254
+ })();
255
+ })();
256
+ }
257
+ }),
258
+ createComponent(Match, {
259
+ get when() {
260
+ return memo(() => !!isListOp(N()))() && D() === "enum";
172
261
  },
173
262
  get children() {
174
- var e = _tmpl$();
175
- return e.$$input = (e) => _.onChange(e.target.value), effect((y) => {
176
- var b = _.class ?? "flex-1 px-2 py-1 rounded-md border", x = _.placeholder;
177
- return b !== y.e && className(e, y.e = b), x !== y.t && setAttribute(e, "placeholder", y.t = x), y;
263
+ var o = _tmpl$();
264
+ return o.addEventListener("change", (o) => w.onChange([...o.target.selectedOptions].map((o) => o.value))), insert(o, () => j().map((o) => (() => {
265
+ var w = _tmpl$7();
266
+ return insert(w, () => String(o.label)), effect(() => w.value = String(o.value)), w;
267
+ })())), effect(() => className(o, w.class ?? "flex-1 px-2 py-1 rounded-md border")), effect(() => o.value = toList(w.value).map((o) => String(o))), o;
268
+ }
269
+ }),
270
+ createComponent(Match, {
271
+ get when() {
272
+ return isListOp(N());
273
+ },
274
+ get children() {
275
+ var o = _tmpl$2();
276
+ return o.$$input = (o) => w.onChange(toList(o.target.value)), effect((E) => {
277
+ var D = w.class ?? "flex-1 px-2 py-1 rounded-md border", O = w.placeholder ?? "多个值用逗号分隔";
278
+ return D !== E.e && className(o, E.e = D), O !== E.t && setAttribute(o, "placeholder", E.t = O), E;
178
279
  }, {
179
280
  e: void 0,
180
281
  t: void 0
181
- }), effect(() => e.value = _.value ?? ""), e;
282
+ }), effect(() => o.value = toList(w.value).join(", ")), o;
182
283
  }
183
284
  }),
184
285
  createComponent(Match, {
185
286
  get when() {
186
- return b() === "date";
287
+ return D() === "number";
187
288
  },
188
289
  get children() {
189
- var e = _tmpl$2();
190
- return e.$$input = (e) => _.onChange(e.target.value), effect(() => className(e, _.class ?? "flex-1 px-2 py-1 rounded-md border")), effect(() => e.value = _.value ?? ""), e;
290
+ var o = _tmpl$3();
291
+ return o.$$input = (o) => w.onChange(o.target.value), effect((E) => {
292
+ var D = w.class ?? "flex-1 px-2 py-1 rounded-md border", O = w.placeholder;
293
+ return D !== E.e && className(o, E.e = D), O !== E.t && setAttribute(o, "placeholder", E.t = O), E;
294
+ }, {
295
+ e: void 0,
296
+ t: void 0
297
+ }), effect(() => o.value = w.value ?? ""), o;
191
298
  }
192
299
  }),
193
300
  createComponent(Match, {
194
301
  get when() {
195
- return b() === "enum";
302
+ return D() === "date";
196
303
  },
197
304
  get children() {
198
- var e = _tmpl$3();
199
- return e.firstChild, e.$$input = (e) => _.onChange(e.target.value), insert(e, () => S().map((e) => (() => {
200
- var _ = _tmpl$5();
201
- return insert(_, () => String(e.label)), effect(() => _.value = String(e.value)), _;
202
- })()), null), effect(() => className(e, _.class ?? "flex-1 px-2 py-1 rounded-md border")), effect(() => e.value = _.value ?? ""), e;
305
+ var o = _tmpl$4();
306
+ return o.$$input = (o) => w.onChange(o.target.value), effect(() => className(o, w.class ?? "flex-1 px-2 py-1 rounded-md border")), effect(() => o.value = w.value ?? ""), o;
307
+ }
308
+ }),
309
+ createComponent(Match, {
310
+ get when() {
311
+ return D() === "enum";
312
+ },
313
+ get children() {
314
+ var o = _tmpl$5();
315
+ return o.firstChild, o.$$input = (o) => w.onChange(o.target.value), insert(o, () => j().map((o) => (() => {
316
+ var w = _tmpl$7();
317
+ return insert(w, () => String(o.label)), effect(() => w.value = String(o.value)), w;
318
+ })()), null), effect(() => className(o, w.class ?? "flex-1 px-2 py-1 rounded-md border")), effect(() => o.value = w.value ?? ""), o;
203
319
  }
204
320
  }),
205
321
  createComponent(Match, {
@@ -208,72 +324,75 @@ const RULES_BY_TYPE = {
208
324
  "checkbox",
209
325
  "switch",
210
326
  "boolean"
211
- ].includes(b());
327
+ ].includes(D());
212
328
  },
213
329
  get children() {
214
- var e = _tmpl$3();
215
- return e.firstChild, e.$$input = (e) => _.onChange(e.target.value), insert(e, () => [!0, !1].map((e) => (() => {
216
- var _ = _tmpl$5();
217
- return insert(_, () => String(e)), effect(() => _.value = String(e)), _;
218
- })()), null), effect(() => className(e, _.class ?? "flex-1 px-2 py-1 rounded-md border")), effect(() => e.value = _.value ?? ""), e;
330
+ var o = _tmpl$5();
331
+ return o.firstChild, o.$$input = (o) => w.onChange(o.target.value), insert(o, () => [!0, !1].map((o) => (() => {
332
+ var w = _tmpl$7();
333
+ return insert(w, () => String(o)), effect(() => w.value = String(o)), w;
334
+ })()), null), effect(() => className(o, w.class ?? "flex-1 px-2 py-1 rounded-md border")), effect(() => o.value = w.value ?? ""), o;
219
335
  }
220
336
  })
221
337
  ];
222
338
  }
223
339
  });
224
340
  };
225
- function normalizeType(e) {
226
- return e?.enum ? "enum" : e?.type ?? "text";
341
+ function normalizeType(o) {
342
+ return o?.enum ? "enum" : o?.type ?? "text";
227
343
  }
228
- function defaultOp(e) {
229
- return RULES_BY_TYPE[e]?.[0]?.value;
344
+ function defaultOp(o) {
345
+ return RULES_BY_TYPE[o]?.[0]?.value;
230
346
  }
231
- function newRule(e, _) {
232
- let v = normalizeType(e), y = defaultOp(v);
347
+ function newRule(o, w) {
348
+ let T = normalizeType(o), E = defaultOp(T);
233
349
  return {
234
- field: e.id,
235
- op: y,
236
- value: VALUE_FREE_RULES.includes(y) ? null : "",
237
- ..._
350
+ field: o.id,
351
+ op: E,
352
+ value: VALUE_FREE_RULES.includes(E) ? null : "",
353
+ ...w
238
354
  };
239
355
  }
240
- const AndOrFields = (e) => createComponent(AndOr, mergeProps(e, { renderRule: (_) => {
241
- let b = createMemo(() => e.fields.find((e) => e.id === _.node.field)), S = createMemo(() => normalizeType(b())), C = createMemo(() => RULES_BY_TYPE[S()]);
356
+ function normalizeValueByOp(o, w) {
357
+ return VALUE_FREE_RULES.includes(o) ? null : isBetweenOp(o) ? toPair(w) : isListOp(o) ? toList(w) : w ?? "";
358
+ }
359
+ const AndOrFields = (o) => createComponent(AndOr, mergeProps(o, { renderRule: (w) => {
360
+ let D = createMemo(() => o.fields.find((o) => o.id === w.node.field)), A = createMemo(() => normalizeType(D())), j = createMemo(() => RULES_BY_TYPE[A()]);
242
361
  return (() => {
243
- var w = _tmpl$6(), T = w.firstChild;
244
- T.firstChild;
245
- var E = T.nextSibling;
246
- return T.$$input = (v) => {
247
- let y = v.target.value, b = e.fields.find((e) => e.id === y);
248
- _.update(newRule(b, { field: y }));
249
- }, insert(T, () => e.fields.map((e) => (() => {
250
- var _ = _tmpl$5();
251
- return insert(_, () => e.name), effect(() => _.value = e.id), _;
252
- })()), null), E.$$input = (e) => {
253
- let v = e.target.value;
254
- _.update({
255
- op: v,
256
- value: VALUE_FREE_RULES.includes(v) ? null : _.node.value ?? ""
362
+ var M = _tmpl$8(), N = M.firstChild;
363
+ N.firstChild;
364
+ var P = N.nextSibling;
365
+ return N.$$input = (T) => {
366
+ let E = T.target.value, D = o.fields.find((o) => o.id === E);
367
+ w.update(newRule(D, { field: E }));
368
+ }, insert(N, () => o.fields.map((o) => (() => {
369
+ var w = _tmpl$7();
370
+ return insert(w, () => o.name), effect(() => w.value = o.id), w;
371
+ })()), null), P.$$input = (o) => {
372
+ let T = o.target.value;
373
+ w.update({
374
+ op: T,
375
+ value: normalizeValueByOp(T, w.node.value)
257
376
  });
258
- }, insert(E, () => C().map((e) => (() => {
259
- var _ = _tmpl$5();
260
- return insert(_, () => e.label), effect(() => _.value = e.value), _;
261
- })())), insert(w, createComponent(RuleValueEditor, {
377
+ }, insert(P, () => j().map((o) => (() => {
378
+ var w = _tmpl$7();
379
+ return insert(w, () => o.label), effect(() => w.value = o.value), w;
380
+ })())), insert(M, createComponent(RuleValueEditor, {
262
381
  get field() {
263
- return b();
382
+ return D();
264
383
  },
265
384
  get op() {
266
- return _.node.op;
385
+ return w.node.op;
267
386
  },
268
387
  get value() {
269
- return _.node.value;
388
+ return w.node.value;
270
389
  },
271
390
  get enum() {
272
- return b()?.enum;
391
+ return D()?.enum;
273
392
  },
274
393
  class: "flex-1 px-2 py-1 rounded-md border",
275
- onChange: (e) => _.update({ value: e })
276
- }), null), effect(() => className(T, `px-2 py-1 rounded-md border ${e.hideFields ? "hidden" : ""}`)), effect(() => T.value = _.node.field), effect(() => E.value = _.node.op || defaultOp(S())), w;
394
+ onChange: (o) => w.update({ value: o })
395
+ }), null), effect(() => className(N, `px-2 py-1 rounded-md border ${o.hideFields ? "hidden" : ""}`)), effect(() => N.value = w.node.field), effect(() => P.value = w.node.op || defaultOp(A())), M;
277
396
  })();
278
397
  } }));
279
398
  delegateEvents(["input"]);
@@ -1,6 +1,5 @@
1
1
  import { type Field } from './AndOrFields';
2
2
  import type { AndOrNode } from './AndOr';
3
- export type FilterRule = 'contains' | 'eq' | 'neq' | 'startwith' | 'endwith' | 'blank' | 'noblank' | 'lt' | 'gt' | 'lte' | 'gte' | 'true' | 'false';
4
3
  type FilterProps = {
5
4
  col: Field;
6
5
  tree: AndOrNode | undefined;
@@ -4,6 +4,8 @@ interface VirtualizerOptions {
4
4
  batch?: number;
5
5
  getScrollElement: () => Element;
6
6
  horizontal?: boolean;
7
+ paddingStart?: number;
8
+ paddingEnd?: number;
7
9
  count: number;
8
10
  estimateSize: (i: number) => number;
9
11
  extras?: (startIdx: number, endIdx: number) => number[];
@@ -26,5 +28,6 @@ export declare function useVirtualizer(opt: VirtualizerOptions): {
26
28
  end: number;
27
29
  index: number;
28
30
  };
31
+ scrollToIndex: (i: number, center?: boolean) => void;
29
32
  };
30
33
  export {};
@@ -66,7 +66,7 @@ function useVirtualizer(d) {
66
66
  if (v(), !d.enable) return Array.from({ length: d.count }, (e, s) => S(s));
67
67
  let e = [];
68
68
  for (let s = C(); s <= w(); s++) e.push(S(s));
69
- return d.extras && (e.push(...d.extras(C(), w())?.map((e) => S(e)) || []), e = uniqBy(e, (e) => e.index)), e;
69
+ return d.extras && (e.push(...d.extras(C(), w())?.map((e) => S(e)) || []), e = uniqBy(e, (e) => e.index), e.sort((e, s) => e.index - s.index)), e;
70
70
  });
71
71
  return {
72
72
  options: d,
@@ -87,7 +87,17 @@ function useVirtualizer(d) {
87
87
  getVirtualItem: (() => {
88
88
  let e = createMemo(() => keyBy(T(), (e) => e.index));
89
89
  return (s) => e()[s];
90
- })()
90
+ })(),
91
+ scrollToIndex: (e, s) => {
92
+ let c = d.getScrollElement(), l = _.sum(e - 1);
93
+ d.horizontal ? c.scrollTo({
94
+ left: l + (s ? -c.offsetWidth / 2 : 0),
95
+ behavior: "instant"
96
+ }) : c.scrollTo({
97
+ top: l + (s ? -c.offsetHeight / 2 : 0),
98
+ behavior: "instant"
99
+ });
100
+ }
91
101
  };
92
102
  }
93
103
  export { useVirtualizer };
package/dist/index.d.ts CHANGED
@@ -64,12 +64,13 @@ export interface TableProps {
64
64
  style?: any;
65
65
  rowKey?: any;
66
66
  size?: string;
67
+ loading?: boolean;
67
68
  newRow?: (i: number) => any;
68
69
  Scroll?: Component<any>;
69
70
  Table?: Component<any>;
70
71
  Thead?: Component<any>;
71
72
  Tbody?: Component<any>;
72
- Td?: TD;
73
+ Td?: Component<TDProps>;
73
74
  Th?: Component<THProps>;
74
75
  Tr?: Component<{
75
76
  y?: number;
@@ -111,11 +112,11 @@ export type TDProps = {
111
112
  y: number;
112
113
  data: any;
113
114
  col: TableColumn;
115
+ value?: any;
114
116
  children?: JSX.Element;
115
117
  rowspan?: number;
116
118
  colspan?: number;
117
119
  };
118
- export type TD = Component<TDProps>;
119
120
  type Obj = Record<string | symbol, any>;
120
121
  export interface TableColumn extends Obj {
121
122
  id: any;
@@ -124,7 +125,6 @@ export interface TableColumn extends Obj {
124
125
  fixed?: 'left' | 'right';
125
126
  class?: any;
126
127
  style?: any;
127
- props?: (props: any) => JSX.HTMLAttributes<any>;
128
128
  }
129
129
  type Nullable<T> = T | undefined;
130
130
  export interface TableStore extends Obj {
package/dist/index.js CHANGED
@@ -17,7 +17,8 @@ import { CellMergePlugin } from "./plugins/CellMergePlugin.js";
17
17
  import { TreePlugin } from "./plugins/TreePlugin.js";
18
18
  import { HeaderGroupPlugin } from "./plugins/HeaderGroup.js";
19
19
  import { ValidatorPlugin } from "./plugins/ValidatorPlugin.js";
20
- import { createComponent, insert, memo, mergeProps, spread, template } from "solid-js/web";
20
+ import loading_bold_default from "./loading-bold.js";
21
+ import { createComponent, insert, memo, mergeProps, spread, template, use } from "solid-js/web";
21
22
  import { $PROXY, For, batch, createContext, createEffect, createMemo, createSignal, getOwner, mapArray, mergeProps as mergeProps$1, on, onCleanup, onMount, runWithOwner, untrack, useContext } from "solid-js";
22
23
  import { createMutable, reconcile } from "solid-js/store";
23
24
  import { combineProps } from "@solid-primitives/props";
@@ -25,7 +26,7 @@ import { createLazyMemo } from "@solid-primitives/memo";
25
26
  import { createElementSize, createResizeObserver, makeResizeObserver } from "@solid-primitives/resize-observer";
26
27
  import { createScrollPosition } from "@solid-primitives/scroll";
27
28
  import { difference, isEqual, memoize, sumBy } from "es-toolkit";
28
- var _tmpl$ = /* @__PURE__ */ template("<div>"), _tmpl$2 = /* @__PURE__ */ template("<table>"), _tmpl$3 = /* @__PURE__ */ template("<thead>"), _tmpl$4 = /* @__PURE__ */ template("<tbody>"), _tmpl$5 = /* @__PURE__ */ template("<tr>"), _tmpl$6 = /* @__PURE__ */ template("<th>"), _tmpl$7 = /* @__PURE__ */ template("<td>"), _tmpl$8 = /* @__PURE__ */ template("<div class=data-table__layers>"), _tmpl$9 = /* @__PURE__ */ template("<div class=data-table__empty>No data");
29
+ var _tmpl$ = /* @__PURE__ */ template("<div>"), _tmpl$2 = /* @__PURE__ */ template("<table>"), _tmpl$3 = /* @__PURE__ */ template("<thead>"), _tmpl$4 = /* @__PURE__ */ template("<tbody>"), _tmpl$5 = /* @__PURE__ */ template("<tr>"), _tmpl$6 = /* @__PURE__ */ template("<th>"), _tmpl$7 = /* @__PURE__ */ template("<td>"), _tmpl$8 = /* @__PURE__ */ template("<div class=data-table__layers>"), _tmpl$9 = /* @__PURE__ */ template("<div class=\"data-table--scroll-view h-full max-h-inherit\">"), _tmpl$0 = /* @__PURE__ */ template("<div class=data-table__empty>No data"), _tmpl$1 = /* @__PURE__ */ template("<div class=data-table__loading>");
29
30
  const Ctx = createContext({
30
31
  props: {},
31
32
  store: {}
@@ -131,7 +132,7 @@ var THead = () => {
131
132
  get data() {
132
133
  return K();
133
134
  },
134
- get children() {
135
+ get value() {
135
136
  return K()[J().id];
136
137
  }
137
138
  })
@@ -215,10 +216,7 @@ function BasePlugin() {
215
216
  let q = J.x == 0, X = J.x >= _.scrollWidth - (Y.width || 0);
216
217
  return q && X ? "" : !q && !X ? "is-scroll-mid" : q ? "is-scroll-left" : X ? "is-scroll-right" : "";
217
218
  });
218
- q = combineProps(q, {
219
- ref: (_) => K.scroll_el = _,
220
- class: "data-table--scroll-view"
221
- }, { get class() {
219
+ q = combineProps(q, { get class() {
222
220
  return `data-table ${K.props.border && "data-table--border"} data-table--${K.props.size}`;
223
221
  } }, {
224
222
  get class() {
@@ -237,9 +235,11 @@ function BasePlugin() {
237
235
  var _ = _tmpl$8();
238
236
  return insert(_, Z), _;
239
237
  })(),
240
- memo(() => q.children),
241
- createComponent(K.props.Footer, {}),
242
- memo(() => memo(() => !K.props.data.length)() && _tmpl$9())
238
+ (() => {
239
+ var _ = _tmpl$9();
240
+ return use((_) => K.scroll_el = _, _), insert(_, () => q.children, null), insert(_, createComponent(K.props.Footer, {}), null), _;
241
+ })(),
242
+ memo(() => memo(() => !K.props.data.length)() && _tmpl$0())
243
243
  ];
244
244
  } }));
245
245
  },
@@ -325,7 +325,13 @@ function BasePlugin() {
325
325
  children: (K, q) => _.children(() => K, q)
326
326
  })),
327
327
  renderer: ({ renderer: _ = (_) => _ }) => _
328
- }
328
+ },
329
+ layers: [function(_) {
330
+ return _.props.loading ? (() => {
331
+ var _ = _tmpl$1();
332
+ return insert(_, createComponent(loading_bold_default, { class: "text-2xl animate-spin" })), _;
333
+ })() : null;
334
+ }]
329
335
  };
330
336
  }
331
337
  const defaultsPlugins = [
@@ -0,0 +1,6 @@
1
+ import { spread, template } from "solid-js/web";
2
+ var _tmpl$ = /* @__PURE__ */ template("<svg viewBox=\"0 0 24 24\"width=1.2em height=1.2em><path fill=currentColor d=\"M12 6.5A1.5 1.5 0 0 0 13.5 5V2a1.5 1.5 0 0 0-3 0v3A1.5 1.5 0 0 0 12 6.5m-3.73-.39L6.15 4A1.53 1.53 0 0 0 4 4a1.48 1.48 0 0 0-.44 1.06A1.52 1.52 0 0 0 4 6.11l2.15 2.12a1.5 1.5 0 0 0 1.06.44a1.5 1.5 0 0 0 1.06-2.56M.5 12A1.5 1.5 0 0 0 2 13.5h3a1.5 1.5 0 0 0 0-3H2A1.5 1.5 0 0 0 .5 12M7 15.52a1.48 1.48 0 0 0-1.1.48l-2.13 2.08a1.51 1.51 0 0 0 0 2.12a1.51 1.51 0 0 0 2.13 0L8 18.08a1.5 1.5 0 0 0-1-2.56M10.5 22a1.5 1.5 0 0 0 3 0v-3a1.5 1.5 0 0 0-3 0Zm5.55-6a1.5 1.5 0 0 0 0 2.12l2.12 2.12a1.52 1.52 0 0 0 1.06.44a1.54 1.54 0 0 0 1.07-.44a1.5 1.5 0 0 0 .43-1.06a1.48 1.48 0 0 0-.44-1.07L18.17 16a1.5 1.5 0 0 0-2.12 0m7.45-4a1.5 1.5 0 0 0-1.5-1.5h-3a1.5 1.5 0 0 0-1.5 1.5a1.5 1.5 0 0 0 1.5 1.5h3a1.5 1.5 0 0 0 1.5-1.5M19 3.41a1.52 1.52 0 0 0-1 .44L15.86 6a1.5 1.5 0 0 0 0 2.12a1.51 1.51 0 0 0 2.13 0L20.11 6A1.5 1.5 0 0 0 19 3.41\">"), loading_bold_default = (n = {}) => (() => {
3
+ var r = _tmpl$();
4
+ return spread(r, n, !0, !0), r;
5
+ })();
6
+ export { loading_bold_default as default };