intable 0.0.19 → 0.0.21

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/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-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-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@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}:root,:host{--spacing:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--radius-sm:.25rem;--default-transition-timingFunction:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--colors-blue-DEFAULT:#54a2ff;--colors-green-DEFAULT:#05df72;--colors-red-DEFAULT:#ff6568;--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-green-DEFAULT:lab(78.503% -64.9264 39.7492);--colors-red-DEFAULT:lab(63.7053% 60.745 31.3109)}}*,: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\.5{font-size:.875rem}.lh-\[1\]{--un-leading:1;line-height:1}.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}.p-1{padding:4px}.px,.px-4{padding-inline:16px}.px-2{padding-inline:8px}.py-1{padding-block:4px}.py-2{padding-block:8px}.pl-1{padding-left:4px}.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)}.b{border-width:1px}.rd-2{border-radius:.5rem}.rd-sm{border-radius:var(--radius-sm)}.bg-\#fff{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent)}.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}.op-20{opacity:.2}.op-75{opacity:.75}.op40{opacity:.4}.flex{display:flex}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-2{gap:8px}.grid{display:grid}.size-4\!{width:16px!important;height:16px!important}.size-full{width:100%;height:100%}.h-1\!{height:4px!important}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.min-h-40{min-height:160px}.min-h-a\!{min-height:auto!important}.w-10px\!{width:10px!important}.after\:h-1:after{height:4px}.after\:w-1:after{width:4px}.inline{display:inline}.block{display:block}.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}.translate-x-1\/2{--un-translate-x: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))}.items-center{align-items:center}.box-border{box-sizing:border-box}.inset-0{inset:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.justify-end\!{justify-content:flex-end!important}.justify-center{justify-content:center}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.z--1{z-index:-1}.z-1{z-index:1}.z-9{z-index:9}.overflow-auto{overflow:auto}.table{display:table}.table-cell{display:table-cell}@supports (color:color-mix(in lab, red, red)){.outline-blue{outline-color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.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}}
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-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@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}:root,:host{--spacing:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--radius-sm:.25rem;--default-transition-timingFunction:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--colors-blue-DEFAULT:#54a2ff;--colors-red-DEFAULT:#ff6568;--colors-green-DEFAULT:#05df72;--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-3\.5{font-size:.875rem}.c-red\/75{color:color-mix(in srgb,var(--colors-red-DEFAULT)75%,transparent)}.lh-\[1\]{--un-leading:1;line-height:1}.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}.p-1{padding:4px}.px,.px-4{padding-inline:16px}.px-2{padding-inline:8px}.py-1{padding-block:4px}.py-2{padding-block:8px}.pl-1{padding-left:4px}.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)}.b{border-width:1px}.rd-2{border-radius:.5rem}.rd-sm{border-radius:var(--radius-sm)}.bg-\#fff{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent)}.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}.op-20{opacity:.2}.op-75{opacity:.75}.op40{opacity:.4}.flex{display:flex}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-2{gap:8px}.grid{display:grid}.size-4\!{width:16px!important;height:16px!important}.size-full{width:100%;height:100%}.h-1\!{height:4px!important}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.min-h-40{min-height:160px}.min-h-a\!{min-height:auto!important}.w-10px\!{width:10px!important}.after\:h-1:after{height:4px}.after\:w-1:after{width:4px}.inline{display:inline}.block{display:block}.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}.translate-x-1\/2{--un-translate-x: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))}.items-center{align-items:center}.box-border{box-sizing:border-box}.inset-0{inset:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.justify-end\!{justify-content:flex-end!important}.justify-center{justify-content:center}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.z--1{z-index:-1}.z-1{z-index:1}.z-9{z-index:9}.overflow-auto{overflow:auto}.table{display:table}.table-cell{display:table-cell}@supports (color:color-mix(in lab, red, red)){.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-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}}
@@ -88,29 +88,23 @@ const CellSelectionPlugin = {
88
88
  } }));
89
89
  }
90
90
  },
91
- keybindings: (e) => {
92
- let i = () => {
93
- let i = e.table?.querySelector(`td[x="${e.selected.start[0]}"][y="${e.selected.start[1]}"]`);
94
- i?.scrollIntoViewIfNeeded(!1), i?.focus();
95
- };
96
- return {
97
- ArrowLeft: () => {
98
- let { start: a, end: o } = e.selected;
99
- a.length && (a[0] = o[0] = Math.max(a[0] - 1, 0), o[1] = a[1], i());
100
- },
101
- ArrowRight: () => {
102
- let { start: a, end: o } = e.selected;
103
- a.length && (a[0] = o[0] = Math.min(a[0] + 1, e.props.columns.length - 1), o[1] = a[1], i());
104
- },
105
- ArrowUp: () => {
106
- let { start: a, end: o } = e.selected;
107
- a.length && (a[1] = o[1] = Math.max(a[1] - 1, 0), o[0] = a[0], i());
108
- },
109
- ArrowDown: () => {
110
- let { start: a, end: o } = e.selected;
111
- a.length && (a[1] = o[1] = Math.min(a[1] + 1, e.props.data.length - 1), o[0] = a[0], i());
112
- }
113
- };
114
- }
91
+ keybindings: (e) => ({
92
+ ArrowLeft: () => {
93
+ let { start: i, end: a } = e.selected;
94
+ i.length && (i[0] = a[0] = Math.max(i[0] - 1, 0), a[1] = i[1], e.scrollCellIfNeeded(i[0], i[1]));
95
+ },
96
+ ArrowRight: () => {
97
+ let { start: i, end: a } = e.selected;
98
+ i.length && (i[0] = a[0] = Math.min(i[0] + 1, e.props.columns.length - 1), a[1] = i[1], e.scrollCellIfNeeded(i[0], i[1]));
99
+ },
100
+ ArrowUp: () => {
101
+ let { start: i, end: a } = e.selected;
102
+ i.length && (i[1] = a[1] = Math.max(i[1] - 1, 0), a[0] = i[0], e.scrollCellIfNeeded(i[0], i[1]));
103
+ },
104
+ ArrowDown: () => {
105
+ let { start: i, end: a } = e.selected;
106
+ i.length && (i[1] = a[1] = Math.min(i[1] + 1, e.props.data.length - 1), a[0] = i[0], e.scrollCellIfNeeded(i[0], i[1]));
107
+ }
108
+ })
115
109
  };
116
110
  export { CellSelectionPlugin };
@@ -4,7 +4,8 @@ declare module '../index' {
4
4
  }
5
5
  interface TableStore {
6
6
  commands: Commands;
7
- scrollToCell?: (x: number | object, y: number | object, opt?: ScrollIntoViewOptions) => void;
7
+ scrollToCell: (x: number | object, y: number | object, opt?: ScrollIntoViewOptions) => void;
8
+ scrollCellIfNeeded: (x: number | object, y: number | object, opt?: boolean) => void;
8
9
  }
9
10
  interface Plugin {
10
11
  commands?: (store: TableStore, commands: Partial<Commands>) => Partial<Commands> & Record<string, any>;
@@ -19,6 +19,11 @@ const CommandPlugin = {
19
19
  behavior: "smooth",
20
20
  ...i
21
21
  });
22
+ },
23
+ scrollCellIfNeeded(n, r, i = !1) {
24
+ n = typeof n == "object" ? e.props.columns.indexOf(n) : n, r = typeof r == "object" ? e.props.data.indexOf(r) : r;
25
+ let a = e.table.querySelector(`[x="${n}"][y="${r}"]`);
26
+ a && (a.scrollIntoViewIfNeeded(i), a.focus());
22
27
  }
23
28
  };
24
29
  },
@@ -29,8 +29,13 @@ const ClipboardPlugin = {
29
29
  if (!n?.length) return;
30
30
  let i = (await navigator.clipboard.readText()).replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n$/, "").split("\n").map((e) => e.split(" ")), a = i.length, o = i[0].length, [s, c] = [n[0], r[0]].sort((e, t) => e - t), [l, u] = [n[1], r[1]].sort((e, t) => e - t), d = u - l + 1, f = c - s + 1, p = d > a && d % a === 0 ? d : a, m = f > o && f % o === 0 ? f : o, h = t.props.columns, g = [];
31
31
  for (let e = s; e < h.length && g.length < m; e++) h[e][t.internal] || g.push(h[e]);
32
- let _ = t.props.data.slice(), v = Math.min(l + p - 1, _.length - 1);
33
- for (let n = 0; n <= v - l; n++) {
32
+ let _ = t.props.data.slice(), v = l + p;
33
+ if (v > _.length) for (let e = _.length; e < v; e++) {
34
+ let n = t.props.newRow?.(e) || {};
35
+ _.push(n);
36
+ }
37
+ let y = l + p - 1;
38
+ for (let n = 0; n <= y - l; n++) {
34
39
  let r = {};
35
40
  g.forEach((s, c) => {
36
41
  let u = _[l + n];
@@ -45,9 +50,9 @@ const ClipboardPlugin = {
45
50
  ...r
46
51
  };
47
52
  }
48
- let y = s, b = 0;
49
- for (let e = s; e < h.length && b < g.length; e++) h[e][t.internal] || (y = e, b++);
50
- t.selected.end = [y, v], t.props.onDataChange?.(_);
53
+ let b = s, x = 0;
54
+ for (let e = s; e < h.length && x < g.length; e++) h[e][t.internal] || (b = e, x++);
55
+ t.selected.end = [b, y], t.props.onDataChange?.(_);
51
56
  }
52
57
  })
53
58
  };
@@ -12,44 +12,40 @@ const EditablePlugin = {
12
12
  name: "editable",
13
13
  store: () => ({ editors: { ...editors } }),
14
14
  rewriteProps: {
15
- editable: ({ editable: e }, { store: g }) => (v) => {
16
- let y = [v.col.editable, e].filter((e) => e != null);
17
- return !!y.length && y.every((e) => unFn(e, v)) && !v.data[g.internal] && !v.col[g.internal];
15
+ editable: ({ editable: e }, { store: h }) => (_) => {
16
+ let v = [_.col.editable, e].filter((e) => e != null);
17
+ return !!v.length && v.every((e) => unFn(e, _)) && !_.data[h.internal] && !_.col[h.internal];
18
18
  },
19
- Td: ({ Td: e }, { store: g }) => (v) => {
20
- let y, { props: x } = useContext(Ctx), S = createMemo(() => unFn(x.editable, v)), [w, T] = createSignal(!1), A = "", j = createMemo(() => (([e, g]) => v.x == e && v.y == g)(g.selected.start || [])), M = createMemo(() => j() && S() && !w()), [N, P] = createSignal(!1);
21
- createEffect(() => {
22
- w() || (g.clearCellValidation?.(v.data, v.col), P(!1));
23
- });
24
- let F = createAsyncMemo(() => {
19
+ Td: ({ Td: e }, { store: h }) => (_) => {
20
+ let v, { props: x } = useContext(Ctx), S = createMemo(() => unFn(x.editable, _)), [w, T] = createSignal(!1), A = "", j = createMemo(() => (([e, h]) => _.x == e && _.y == h)(h.selected.start || [])), M = createMemo(() => j() && S() && !w()), [N, P] = createSignal(!1), F = createAsyncMemo(() => {
25
21
  if (w()) {
26
- let e = !1, _ = ((e) => typeof e == "string" ? g.editors[e] : e)(v.col.editor || "text"), y = {
27
- props: v.col.editorProps,
28
- col: v.col,
22
+ let e = !1, g = _.data[_.col.id], v = ((e) => typeof e == "string" ? h.editors[e] : e)(_.col.editor || "text"), y = {
23
+ props: _.col.editorProps,
24
+ col: _.col,
29
25
  eventKey: A,
30
- data: v.data,
31
- value: v.data[v.col.id],
26
+ data: _.data,
27
+ value: g,
32
28
  ok: async () => {
33
29
  await I(b.getValue()), T(!1);
34
30
  },
35
- cancel: () => (e = !0, g.clearCellValidation?.(v.data, v.col), T(!1)),
36
- onChange: (e) => I(e).catch(() => {})
37
- }, b = _(y);
31
+ cancel: () => (e = !0, T(!1)),
32
+ onChange: (e) => w() && I(e).catch(() => {})
33
+ }, b = v(y);
38
34
  return onCleanup(() => {
39
- if (!e && b.getValue() !== v.data[v.col.id]) {
35
+ if (!e && b.getValue() !== g) {
40
36
  let e = [...x.data];
41
- e[v.y] = {
42
- ...e[v.y],
43
- [v.col.id]: b.getValue()
37
+ e[_.y] = {
38
+ ...e[_.y],
39
+ [_.col.id]: b.getValue()
44
40
  }, x.onDataChange?.(e);
45
41
  }
46
- e || I(b.getValue()), b.destroy();
42
+ e || I(b.getValue()).catch(() => {}), b.destroy();
47
43
  }), [y, b];
48
44
  }
49
45
  });
50
46
  async function I(e) {
51
- if (g.validateCell) try {
52
- P(!0), await g.validateCell(e, v.data, v.col);
47
+ try {
48
+ P(!0), console.log("validate", e), await h.validateCell(e, _.data, _.col);
53
49
  } finally {
54
50
  P(!1);
55
51
  }
@@ -58,7 +54,7 @@ const EditablePlugin = {
58
54
  F()?.[1]?.focus?.();
59
55
  }), createEffect(() => {
60
56
  if (w()) {
61
- let e = createMemo(() => JSON.stringify(g.selected));
57
+ let e = createMemo(() => JSON.stringify(h.selected));
62
58
  createEffect(on(e, () => T(!1), { defer: !0 }));
63
59
  }
64
60
  });
@@ -66,8 +62,8 @@ const EditablePlugin = {
66
62
  w: 0,
67
63
  h: 0
68
64
  });
69
- return createComputed(() => w() && (R.w = y.getBoundingClientRect().width, R.h = y.getBoundingClientRect().height)), v = combineProps(v, {
70
- ref: (e) => y = e,
65
+ return createComputed(() => w() && (R.w = v.getBoundingClientRect().width, R.h = v.getBoundingClientRect().height)), _ = combineProps(_, {
66
+ ref: (e) => v = e,
71
67
  get class() {
72
68
  return w() ? "is-editing" : "";
73
69
  },
@@ -77,7 +73,7 @@ const EditablePlugin = {
77
73
  onClick: () => L?.focus?.(),
78
74
  onDblClick: () => T(S()),
79
75
  onKeyDown: (e) => e.key == "Escape" && F()?.[0].cancel()
80
- }), createComponent(e, mergeProps(v, { get children() {
76
+ }), createComponent(e, mergeProps(_, { get children() {
81
77
  return [memo(() => memo(() => !!M())() && (() => {
82
78
  var e = _tmpl$();
83
79
  return e.addEventListener("compositionend", () => {
@@ -95,13 +91,13 @@ const EditablePlugin = {
95
91
  var e = memo(() => !!N());
96
92
  return () => e() && _tmpl$3();
97
93
  })(), null), e;
98
- })() : v.children)];
94
+ })() : _.children)];
99
95
  } }));
100
96
  }
101
97
  }
102
98
  };
103
- var createEditor = (e, _, v) => ({ eventKey: y, value: b, col: x, ok: S, cancel: C, props: w, onChange: T }) => createRoot((E) => {
104
- let [D, O] = createSignal(y || b), k;
99
+ var createEditor = (e, g, _) => ({ eventKey: v, value: y, col: x, ok: S, cancel: C, props: w, onChange: T }) => createRoot((E) => {
100
+ let [D, O] = createSignal(v || y), k;
105
101
  return createComponent(e, mergeProps({
106
102
  ref: (e) => k = e,
107
103
  class: "relative block px-2 size-full z-9 box-border resize-none outline-0",
@@ -109,7 +105,7 @@ var createEditor = (e, _, v) => ({ eventKey: y, value: b, col: x, ok: S, cancel:
109
105
  return D();
110
106
  },
111
107
  onInput: (e) => (O(e instanceof Event ? e.target.value : e), T?.(D())),
112
- onChange: (e) => (O(e instanceof Event ? e.target.value : e), T?.(D()), v && S()),
108
+ onChange: (e) => (O(e instanceof Event ? e.target.value : e), T?.(D()), _ && S()),
113
109
  "on:pointerdown": (e) => e.stopPropagation(),
114
110
  "on:keydown": (e) => {
115
111
  e.stopPropagation(), e.key == "Enter" && !e.shiftKey && S(), e.key == "Escape" && C();
@@ -117,21 +113,21 @@ var createEditor = (e, _, v) => ({ eventKey: y, value: b, col: x, ok: S, cancel:
117
113
  get options() {
118
114
  return memo(() => !!x.enum)() ? resolveOptions(x.enum ?? []) : void 0;
119
115
  }
120
- }, _, w)), {
116
+ }, g, w)), {
121
117
  el: k,
122
118
  getValue: D,
123
119
  focus: () => k.focus(),
124
120
  destroy: E
125
121
  };
126
122
  }), Input = (e) => (() => {
127
- var g = _tmpl$4();
128
- return spread(g, e, !1, !1), g;
123
+ var h = _tmpl$4();
124
+ return spread(h, e, !1, !1), h;
129
125
  })();
130
126
  const editors = {
131
127
  text: createEditor(Input),
132
128
  textarea: createEditor((e) => (() => {
133
- var g = _tmpl$5();
134
- return spread(g, e, !1, !1), g;
129
+ var h = _tmpl$5();
130
+ return spread(h, e, !1, !1), h;
135
131
  })()),
136
132
  number: createEditor(Input, { type: "number" }),
137
133
  range: createEditor(Input, { type: "range" }),
@@ -141,27 +137,27 @@ const editors = {
141
137
  color: createEditor(Input, { type: "color" }),
142
138
  tel: createEditor(Input, { type: "tel" }),
143
139
  password: createEditor(Input, { type: "password" }),
144
- file: createEditor((g) => createComponent(Files, mergeProps(g, {
140
+ file: createEditor((h) => createComponent(Files, mergeProps(h, {
145
141
  class: "relative z-9 outline-2 outline-blue min-h-a! h-a! p-1 bg-#fff",
146
- onAdd: () => chooseFile({ multiple: !0 }).then((e) => g.onChange([...g.value || [], ...e.map((e) => ({
142
+ onAdd: () => chooseFile({ multiple: !0 }).then((e) => h.onChange([...h.value || [], ...e.map((e) => ({
147
143
  name: e.name,
148
144
  size: e.size
149
145
  }))]))
150
146
  }))),
151
147
  checkbox: createEditor((e) => (() => {
152
- var g = _tmpl$6(), _ = e.ref;
153
- return typeof _ == "function" ? use(_, g) : e.ref = g, insert(g, createComponent(Checkbox, mergeProps(e, {
148
+ var h = _tmpl$6(), g = e.ref;
149
+ return typeof g == "function" ? use(g, h) : e.ref = h, insert(h, createComponent(Checkbox, mergeProps(e, {
154
150
  ref: () => {},
155
151
  onInput: () => {},
156
152
  class: "mx-3!"
157
- }))), g;
153
+ }))), h;
158
154
  })()),
159
155
  select: createEditor((e) => (() => {
160
- var g = _tmpl$7();
161
- return spread(g, e, !1, !0), insert(g, () => e.options?.map((e) => (() => {
162
- var g = _tmpl$8();
163
- return insert(g, () => e.label), effect(() => g.value = e.value), g;
164
- })())), g;
156
+ var h = _tmpl$7();
157
+ return spread(h, e, !1, !0), insert(h, () => e.options?.map((e) => (() => {
158
+ var h = _tmpl$8();
159
+ return insert(h, () => e.label), effect(() => h.value = e.value), h;
160
+ })())), h;
165
161
  })(), {}, !0)
166
162
  };
167
163
  delegateEvents(["keydown", "input"]);
@@ -5,26 +5,26 @@ import { Menu } from "../components/Menu.js";
5
5
  import { createComponent, memo, mergeProps } from "solid-js/web";
6
6
  import { batch, createMemo, createSignal, mapArray } from "solid-js";
7
7
  import { combineProps } from "@solid-primitives/props";
8
- import { range, remove } from "es-toolkit";
8
+ import { delay, range, remove } from "es-toolkit";
9
9
  import { createEventListener } from "@solid-primitives/event-listener";
10
10
  import { autoPlacement, computePosition } from "@floating-ui/dom";
11
11
  const MenuPlugin = {
12
12
  name: "menu",
13
13
  priority: Infinity,
14
14
  store: (e) => ({}),
15
- rewriteProps: { Table: ({ Table: n }, { store: s }) => (f) => {
16
- let [p, g] = createSignal(), _ = mapArray(() => s.plugins || [], (e) => createMemo(() => e.menus?.(s))), v = createMemo(() => _().flatMap((e) => e() || [])), [y, b] = createSignal();
15
+ rewriteProps: { Table: ({ Table: r }, { store: c }) => (p) => {
16
+ let [m, h] = createSignal(), _ = mapArray(() => c.plugins || [], (e) => createMemo(() => e.menus?.(c))), v = createMemo(() => _().flatMap((e) => e() || [])), [y, b] = createSignal();
17
17
  function x(e) {
18
- e.preventDefault(), s.table.contains(e.target) && b({
18
+ e.preventDefault(), c.table.contains(e.target) && b({
19
19
  x: e.x,
20
20
  y: e.y
21
21
  });
22
22
  }
23
23
  createEventListener(document, "pointerdown", (e) => {
24
- p()?.contains(e.target) || b();
24
+ m()?.contains(e.target) || b();
25
25
  });
26
26
  let S = useMemoAsync(() => {
27
- let e = p();
27
+ let e = m();
28
28
  if (e) return computePosition({ getBoundingClientRect: () => DOMRect.fromRect(y()) }, e, {
29
29
  strategy: "fixed",
30
30
  placement: "top-start",
@@ -32,20 +32,20 @@ const MenuPlugin = {
32
32
  boundary: document.body,
33
33
  alignment: "start"
34
34
  })]
35
- }).then(({ x: e, y: n }) => ({
35
+ }).then(({ x: e, y: r }) => ({
36
36
  position: "fixed",
37
- transform: `translate(${e}px, ${n}px)`,
37
+ transform: `translate(${e}px, ${r}px)`,
38
38
  top: 0,
39
39
  left: 0,
40
40
  "z-index": 10
41
41
  }));
42
42
  });
43
- return f = combineProps({
43
+ return p = combineProps({
44
44
  tabindex: -1,
45
45
  onContextMenu: x
46
- }, f), createComponent(n, mergeProps(f, { get children() {
46
+ }, p), createComponent(r, mergeProps(p, { get children() {
47
47
  return [memo(() => memo(() => !!y())() && createComponent(Menu, {
48
- ref: g,
48
+ ref: h,
49
49
  get style() {
50
50
  return S() || "position: fixed";
51
51
  },
@@ -53,7 +53,7 @@ const MenuPlugin = {
53
53
  return v();
54
54
  },
55
55
  onAction: () => b()
56
- })), memo(() => f.children)];
56
+ })), memo(() => p.children)];
57
57
  } }));
58
58
  } },
59
59
  menus: (e) => [
@@ -67,66 +67,68 @@ const MenuPlugin = {
67
67
  },
68
68
  {
69
69
  label: "删除行",
70
- cb: () => e.commands.deleteRows(range(...((e) => [e[0], e[1] + 1])([e.selected.start[1], e.selected.end[1]].sort((e, n) => e - n))))
70
+ cb: () => e.commands.deleteRows(range(...((e) => [e[0], e[1] + 1])([e.selected.start[1], e.selected.end[1]].sort((e, r) => e - r))))
71
71
  }
72
72
  ],
73
73
  commands: (e) => ({
74
- rowEquals(e, n) {
75
- return e == n;
74
+ rowEquals(e, r) {
75
+ return e == r;
76
76
  },
77
- rowIndexOf(n, r) {
78
- return n.findIndex((n) => e.commands.rowEquals(n, r));
77
+ rowIndexOf(r, i) {
78
+ return r.findIndex((r) => e.commands.rowEquals(r, i));
79
79
  },
80
- rowChange(n, r) {
81
- let i = [...e.rawProps.data || []];
82
- r = r == null ? e.commands.rowIndexOf(i, n) : i.findIndex((n) => n == e.props.data[r]), r > -1 && (i[r] = n, e.props.onDataChange?.(i));
80
+ rowChange(r, i) {
81
+ let a = [...e.rawProps.data || []];
82
+ i = i == null ? e.commands.rowIndexOf(a, r) : a.findIndex((r) => r == e.props.data[i]), i > -1 && (a[i] = r, e.props.onDataChange?.(a));
83
83
  },
84
- addRows(n, r, i = !0) {
85
- addRows(e, n, r, i);
84
+ addRows(r, i, a = !0) {
85
+ addRows(e, r, i, a);
86
86
  },
87
- deleteRows(n) {
88
- let { rowKey: r, data: i } = e.props, a = [...e.rawProps.data || []], o = new Set(n.map((e) => i[e]));
89
- remove(a, (e) => o.has(e)), e.props?.onDataChange?.(a);
87
+ deleteRows(r) {
88
+ let { rowKey: i, data: a } = e.props, o = [...e.rawProps.data || []], s = new Set(r.map((e) => a[e]));
89
+ remove(o, (e) => s.has(e)), e.props?.onDataChange?.(o);
90
90
  },
91
- moveRows(r, i) {
92
- let { data: a } = e.props, o = r.map((e) => a[e]).filter((n) => n && !n?.[e.internal]);
93
- if (!o.length) return;
94
- let s = i >= 0 && i < a.length ? a[i] : null, { rowKey: c } = e.props, l = e.props.tree?.children || Symbol(), u = new Set(o.map((e) => e[c])), d = [];
95
- function f(e) {
96
- return e.reduce((e, n) => {
97
- if (u.has(n[c])) return d.push(n), e;
98
- if (Array.isArray(n[l]) && n[l].length) {
99
- let e = f(n[l]);
100
- n = e.length === n[l].length ? n : {
101
- ...n,
102
- [l]: e
91
+ moveRows(i, a) {
92
+ let { data: o } = e.props, s = i.map((e) => o[e]).filter((r) => r && !r?.[e.internal]);
93
+ if (!s.length) return;
94
+ let c = a >= 0 && a < o.length ? o[a] : null, { rowKey: l } = e.props, u = e.props.tree?.children || Symbol(), d = new Set(s.map((e) => e[l])), f = [];
95
+ function p(e) {
96
+ return e.reduce((e, r) => {
97
+ if (d.has(r[l])) return f.push(r), e;
98
+ if (Array.isArray(r[u]) && r[u].length) {
99
+ let e = p(r[u]);
100
+ r = e.length === r[u].length ? r : {
101
+ ...r,
102
+ [u]: e
103
103
  };
104
104
  }
105
- return e.push(n), e;
105
+ return e.push(r), e;
106
106
  }, []);
107
107
  }
108
- let p = f([...e.rawProps.data || []]), m = findParent(p, (e) => e[c] === s?.[c])?.children ?? p, h = s ? m.findIndex((e) => e[c] === s[c]) : -1;
109
- if (h > -1 ? m.splice(h, 0, d) : m.push(...d), e.selected) {
110
- let n = Math.max(0, i - o.length);
111
- e.selected.start = [0, n], e.selected.end = [Infinity, n + d.length - 1];
108
+ let m = p([...e.rawProps.data || []]), h = findParent(m, (e) => e[l] === c?.[l])?.children ?? m, g = c ? h.findIndex((e) => e[l] === c[l]) : -1;
109
+ if (g > -1 ? h.splice(g, 0, f) : h.push(...f), e.selected) {
110
+ let r = Math.max(0, a - s.length);
111
+ e.selected.start = [0, r], e.selected.end = [Infinity, r + f.length - 1];
112
112
  }
113
- e.props?.onDataChange?.(p);
113
+ e.props?.onDataChange?.(m);
114
114
  }
115
115
  })
116
116
  };
117
- function addRows(e, n, r, i) {
118
- let { data: a } = e.props, o = (n) => {
119
- for (i = !1; --n >= 0 && a[n]?.[e.internal];);
120
- return n >= 0 ? a[n] : null;
121
- }, c = (n) => {
122
- for (i = !0; ++n < a.length && a[n]?.[e.internal];);
123
- return n < a.length ? a[n] : null;
124
- }, l = a[n]?.[e.internal] ? i ? o(n) || c(n) : c(n) || o(n) : a[n];
125
- l && batch(() => {
126
- n = e.commands.rowIndexOf(a, l), e.selected && (e.selected.start = [0, n + (i ? 0 : 1)], e.selected.end = [Infinity, n + r.length - 1 + (i ? 0 : 1)]);
117
+ function addRows(e, r, i, a) {
118
+ let { data: o } = e.props, s = (r) => {
119
+ for (a = !1; --r >= 0 && o[r]?.[e.internal];);
120
+ return r >= 0 ? o[r] : null;
121
+ }, l = (r) => {
122
+ for (a = !0; ++r < o.length && o[r]?.[e.internal];);
123
+ return r < o.length ? o[r] : null;
124
+ }, u = o[r]?.[e.internal] ? a ? s(r) || l(r) : l(r) || s(r) : o[r];
125
+ u && batch(() => {
126
+ r = e.commands.rowIndexOf(o, u), e.selected && (e.selected.start = [0, r + (a ? 0 : 1)], e.selected.end = [Infinity, r + i.length - 1 + (a ? 0 : 1)]);
127
127
  }), (() => {
128
- let n = [...e.rawProps.data || []], a = l ? e.commands.rowIndexOf(n, l) + (i ? 0 : 1) : n.length;
129
- n.splice(a, 0, ...r), e.props?.onDataChange?.(n);
130
- })();
128
+ let r = [...e.rawProps.data || []], o = u ? e.commands.rowIndexOf(r, u) + (a ? 0 : 1) : r.length;
129
+ r.splice(o, 0, ...i), e.props?.onDataChange?.(r);
130
+ })(), delay(0).then(() => {
131
+ e.scrollCellIfNeeded(e.selected.start[0], e.selected.start[1]);
132
+ });
131
133
  }
132
134
  export { MenuPlugin };
@@ -5,6 +5,7 @@ declare module '../index' {
5
5
  validator?: (value: any, data: any, col: TableColumn) => void | Promise<void>;
6
6
  }
7
7
  interface TableColumn {
8
+ required?: boolean;
8
9
  validator?: (value: any, rowData: any, col: TableColumn) => void | Promise<void>;
9
10
  }
10
11
  interface TableStore {
@@ -1,12 +1,19 @@
1
1
  import { createComponent, insert, memo, mergeProps, template } from "solid-js/web";
2
2
  import { combineProps } from "@solid-primitives/props";
3
- var _tmpl$ = /* @__PURE__ */ template("<div class=cell-validation-error>");
3
+ var _tmpl$ = /* @__PURE__ */ template("<div class=cell-validation-error>"), _tmpl$2 = /* @__PURE__ */ template("<span class=\"mr-1 c-red/75\">*"), isEmpty = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || typeof e == "object" && Object.keys(e).length === 0;
4
4
  const ValidatorPlugin = {
5
5
  name: "validator",
6
6
  store: (e) => ({
7
7
  cellValidationErrors: {},
8
8
  validateCell: async (t, n, r, i) => {
9
- let a = [e.props.validator, r.validator], o = n[e.props.rowKey];
9
+ if (n[e.internal] || r[e.internal]) return;
10
+ let a = [
11
+ () => {
12
+ if (r.required && isEmpty(t)) throw Error("Required");
13
+ },
14
+ r.validator,
15
+ e.props.validator
16
+ ], o = n[e.props.rowKey];
10
17
  for (let s of a) {
11
18
  if (!s) continue;
12
19
  try {
@@ -46,16 +53,21 @@ const ValidatorPlugin = {
46
53
  e.cellValidationErrors = {};
47
54
  }
48
55
  }),
49
- rewriteProps: { Td: ({ Td: i }, { store: s }) => (c) => {
50
- let l = () => s.cellValidationErrors[c.data[s.props.rowKey]]?.[c.col.id], u = combineProps(c, { get class() {
51
- return l() == null ? "" : "is-invalid";
52
- } });
53
- return createComponent(i, mergeProps(u, { get children() {
54
- return [memo(() => c.children), memo(() => memo(() => l() != null)() && (() => {
55
- var e = _tmpl$();
56
- return insert(e, l), e;
57
- })())];
58
- } }));
59
- } }
56
+ rewriteProps: {
57
+ Td: ({ Td: i }, { store: s }) => (c) => {
58
+ let l = () => s.cellValidationErrors[c.data[s.props.rowKey]]?.[c.col.id], u = combineProps(c, { get class() {
59
+ return l() == null ? "" : "is-invalid";
60
+ } });
61
+ return createComponent(i, mergeProps(u, { get children() {
62
+ return [memo(() => c.children), memo(() => memo(() => l() != null)() && (() => {
63
+ var e = _tmpl$();
64
+ return insert(e, l), e;
65
+ })())];
66
+ } }));
67
+ },
68
+ Th: ({ Th: t }, { store: i }) => (i) => createComponent(t, mergeProps(i, { get children() {
69
+ return [memo(() => memo(() => !!i.col.required)() && _tmpl$2()), memo(() => i.children)];
70
+ } }))
71
+ }
60
72
  };
61
73
  export { ValidatorPlugin };