@spectric/ui 0.0.25 → 0.0.27
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/components/input.d.ts +5 -0
- package/dist/components/query_bar/QueryBar.d.ts +4 -4
- package/dist/components/table/table.d.ts +6 -1
- package/dist/components/table/virtualBody.d.ts +3 -1
- package/dist/custom-elements.json +16 -6
- package/dist/index.es.js +1242 -1229
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +141 -145
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/input.ts +10 -0
- package/src/components/query_bar/QueryBar.css +67 -68
- package/src/components/query_bar/QueryBar.ts +24 -14
- package/src/components/query_bar/__tests__/test_highlighting.spec.ts +101 -0
- package/src/components/query_bar/querylanguage/outputTypes/toHTML.ts +25 -4
- package/src/components/table/header.css +54 -39
- package/src/components/table/header.ts +8 -8
- package/src/components/table/table.css +81 -71
- package/src/components/table/table.ts +25 -12
- package/src/components/table/virtualBody.ts +35 -50
- package/src/stories/QueryBar.stories.ts +9 -8
- package/src/stories/fixtures/data.ts +14 -17
- /package/src/components/query_bar/querylanguage/kuery/ast/{kuery.peg → kuery.peggy} +0 -0
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
spectric-input{--input-color: var(--spectric-input-color, #f4f4f4);--border-radius: var(--spectric-border-radius, .4em);--input-bottom: var(--spectric-input-bottom, var(--spectric-button-primary, #a8a8a8));--input-bottom-focused: var(--primary, #1ea7fd);--text-on-color: var(--spectric-text-on-color, #ffffff);--text-on-color-disabled: var(--spectric-text-on-color-disabled, #8d8d8d);--text-placeholder: rgba(22, 22, 22, .4);--text-primary: var(--spectric-text-primary, #161616);--text-secondary: var(--spectric-text-secondary, #525252)}spectric-input .inputWrapper{color:var(--text-secondary)}spectric-input .inputWrapper input{box-sizing:border-box;margin:0;vertical-align:baseline;font-size:.875rem;font-weight:400;line-height:1.28572;letter-spacing:.16px;outline:transparent solid 2px;outline-offset:-2px;border:none;padding:0 1rem;background-color:var(--input-color);color:var(--text-primary, #161616);font-family:inherit;inline-size:100%;block-size:2.5rem}spectric-input .inputWrapper .inputContainer:active:after,spectric-input .inputContainer:focus-within:after{border-bottom-color:var(--input-bottom-focused);width:calc(100% - 5px);transition:width .4s ease-in-out}spectric-input .inputWrapper input:read-only{background-color:transparent;border-bottom-color:var(--border-disabled)}spectric-input .inputContainer{position:relative;border-radius:var(--border-radius);overflow:hidden}spectric-input .inputContainer:after{content:"";width:0px;transition:background-color .4s cubic-bezier(.2,0,.38,.9),border-bottom-color .4s cubic-bezier(.2,0,.38,.9);border-bottom-color:var(--input-bottom);border-bottom-style:solid;border-bottom-width:1px;position:absolute;left:2.5px;bottom:0}spectric-input #helper-text{height:18px}spectric-input #helper-text.hidden{display:none}spectric-input .input-button-right{position:absolute;right:4px;bottom:3px}spectric-input .checkbox{display:flex;justify-self:center;align-items:center}spectric-input .checkbox spectric-button~span{padding-left:5px}spectric-input spectric-colorpicker{display:block}spectric-input[variant=color] .fieldwrapper{display:inline-block}spectric-query{font-family:monospace}spectric-query .autocomplete{color:var(--spectric-text-primary, #161616);border-radius:0em 0em var(--spectric-border-radius, .4em) var(--spectric-border-radius, .4em);background-color:var(--spectric-background, #ffffff);border:1px solid var(--spectric-background-hover, rgba(141, 141, 141, .12));max-height:300px;border-top:0px;margin:0;position:fixed;top:anchor(bottom);justify-self:anchor-center;text-align:center}spectric-query .autocomplete [popover]{overflow:visible}spectric-query .autocomplete .tooltip-content{width:100%}spectric-query .autocomplete .optiontype{float:left;max-width:10px}spectric-query .autocomplete .label{position:absolute;right:0}spectric-query .autocomplete .option.active,spectric-query .autocomplete .option:hover{background-color:var(--spectric-background-hover, rgba(141, 141, 141, .12));border-bottom:1px solid var(--primary, #1ea7fd)}spectric-query .autocomplete .option{border-bottom:1px solid transparent;padding:8px}.query-bar-date-quick-select{display:flex;justify-content:space-evenly}spectric-query span.field-name{color:#50b8f1}spectric-query span.expression-value{color:#c5937b}spectric-query span.field-numeric{color:#bacdab}spectric-query span.wild-card{color:#a94230}spectric-query span.value-constant{color:#3a7cc5}spectric-query .syntax-highlighter{color:#bc89bd;position:absolute;z-index:100;font-size:.875rem;letter-spacing:.16px;padding:0 1rem;font-family:inherit;inline-size:calc(100% - .5rem);block-size:2.5rem;content:no-close-quote;vertical-align:baseline;display:flex;align-items:center;pointer-events:none;white-space:nowrap;box-sizing:border-box}spectric-query .syntax-highlighter>*{overflow:hidden}spectric-query:focus-within .syntax-highlighter{display:none}spectric-query spectric-input .inputWrapper input{color:transparent}spectric-query:focus-within spectric-input .inputWrapper input{color:initial}spectric-pagination .spectric-pagination-container{display:flex;justify-content:space-between;align-items:center}spectric-pagination .spectric-pagination-text{flex-grow:1;text-align:center}spectric-table{display:flex;flex-direction:column;overflow:hidden;line-height:1}spectric-table .table-wrapper{overflow:auto;flex-grow:1;position:relative}spectric-table tr{text-align:center}spectric-table tr.odd{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 90%)}spectric-table spectric-table-virtual-body tr:hover{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 70%)}spectric-table spectric-table-virtual-body tr{height:var(--rowHeight)}spectric-table td{padding:1px;border:1px solid transparent}spectric-table spectric-table-virtual-body td{height:var(--rowHeight)}spectric-table div[role=table]{display:table;min-width:100%}spectric-table-cell{display:contents;vertical-align:middle}spectric-table-cell td{position:relative}spectric-table td:hover:has(.hasActions){border:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-cell .table-cell-actions{position:absolute;display:flex;width:100%;flex-direction:row-reverse;visibility:hidden;z-index:1}spectric-table-cell .table-cell-actions.tiny{top:-10px}spectric-table-cell .table-cell-actions.xxsmall{top:-16px}spectric-table-cell td:hover .table-cell-actions{visibility:unset}spectric-table .table-checkbox-single spectric-button{--button-border-radius: 50%}spectric-input.table-checkbox-single[checked] spectric-button{--text-on-color: transparent;border-radius:50%;position:relative}spectric-input.table-checkbox-single[checked] spectric-button:before{position:absolute;content:" ";height:50%;width:50%;left:25%;top:25%;border-radius:50%;z-index:1;box-shadow:0 0 0 4px var(--input-color)}spectric-table .cell-contents{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:var(--lineClamp,1);-webkit-box-pack:center;overflow:hidden;text-overflow:ellipsis;font-size:var(--fontSize);line-height:calc(var(--lineClamp) * var(--fontSize));height:var(--rowHeight)}spectric-table-header{display:table-header-group;font-weight:700;position:sticky;top:0;left:0;z-index:1;background:var(--spectric-background, #ffffff)}spectric-table-header td{vertical-align:middle;position:relative}spectric-table-header .header-contents{position:relative}spectric-table-header .header-contents .sort-direction{position:absolute;right:2px;top:calc(50% - 8px)}spectric-table-header .header-contents.sortable{cursor:pointer;padding-right:15px}spectric-table-header .header-contents.resizing{-webkit-user-select:none;user-select:none}spectric-table-header .header-contents.sortable:hover .sort-direction.none:before{content:"⮁"}spectric-table-header td .header-resize-handle{width:2px;position:absolute;right:-1px;top:1px;visibility:hidden;background-color:var(--spectric-primary, #1ea7fd);height:100%;cursor:ew-resize;z-index:1}spectric-table-header td:hover .header-resize-handle{visibility:visible}spectric-table-header td:hover:has(*.header-resize-handle){border-bottom:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-body{display:table-row-group}spectric-table-virtual-body{display:contents}spectric-table-virtual-body .virtual-scroll-spacer td{padding:0;border:0px}.spectric-popover-portal{margin:0;border:0px;padding:0;position:fixed;z-index:9999;background:transparent;pointer-events:all;--spectric-tooltip-background-color: var(--spectric-tooltip-background, var(--spectric-background,#ffffff));--spectric-tooltip-text-color: var(--spectric-tooltip-text, var(--spectric-text-primary, rgb(0, 0, 0)));--spectric-tooltip-accent-color: var(--spectric-tooltip-accent, var(--spectric-primary, #1ea7fd))}.spectric-popover-portal.spectric-tooltip-portal{pointer-events:none}.spectric-popover-portal .tooltip-container{display:flex;justify-content:center;align-items:center}.spectric-popover-portal.top .tooltip-container{flex-direction:column-reverse}.spectric-popover-portal.bottom .tooltip-container{flex-direction:column}.spectric-popover-portal.left .tooltip-container{flex-direction:row-reverse}.spectric-popover-portal .tooltip-content{background:var(--spectric-tooltip-background-color);border-radius:var(--spectric-border-radius,.4em);border:1px solid color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%);box-shadow:0 0 .01em .01em color-mix(in srgb,var(--spectric-tooltip-accent-color) 90%,var(--spectric-text-on-color,#ffffff) 90%);padding:.2em;color:var(--spectric-tooltip-text-color)}.spectric-popover-portal .tooltip-caret{background:color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%)}.spectric-tooltip-portal.top .tooltip-caret,.spectric-tooltip-portal.bottom .tooltip-caret{inline-size:.75rem;block-size:.374rem}.spectric-tooltip-portal.left .tooltip-caret,.spectric-tooltip-portal.right .tooltip-caret{inline-size:.375rem;block-size:.75rem}.spectric-popover-portal.top .tooltip-caret{clip-path:polygon(0 0,50% 100%,100% 0)}.spectric-popover-portal.bottom .tooltip-caret{clip-path:polygon(0 100%,50% 0,100% 100%)}.spectric-popover-portal.left .tooltip-caret{clip-path:polygon(0 0,100% 50%,0 100%)}.spectric-popover-portal.right .tooltip-caret{clip-path:polygon(0 50%,100% 0,100% 100%)}spectric-input.hue-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.hue-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.alpha-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range],spectric-input.hue-gradient input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.color-picker-footer{display:flex;justify-content:space-evenly}.color-picker-saturation-lightness-grid{cursor:crosshair}.color-picker-eyedropper{--button-border-radius:50%}.color-picker-eyedropper.hidden{display:none}spectric-calendar{display:flex;justify-content:center;--default-text-on-color:var(--spectric-text-on-color, #ffffff)}spectric-calendar .header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}spectric-calendar .month-year{display:flex;align-items:center;gap:10px}spectric-calendar select{font-size:14px;padding:2px}spectric-calendar .days{display:grid;grid-template-columns:repeat(7,34px);grid-template-rows:repeat(7,34px);text-align:center;background:radial-gradient(circle at var(--x, 200%) var(--y, 200%),var(--spectric-background-inverse,#ffffff) 0%,var(--spectric-background,#f4f4f4) 25%);transition:background .1s ease;--spectric-text-on-color: var(--spectric-primary,#1ea7fd)}spectric-calendar .day{font-weight:700;padding:5px;background-color:var(--spectric-background)}spectric-calendar .date.active{--spectric-text-on-color: var(--default-text-on-color, #ffffff)}spectric-calendar .date{margin:2px}
|
|
1
|
+
spectric-input{--input-color: var(--spectric-input-color, #f4f4f4);--border-radius: var(--spectric-border-radius, .4em);--input-bottom: var(--spectric-input-bottom, var(--spectric-button-primary, #a8a8a8));--input-bottom-focused: var(--primary, #1ea7fd);--text-on-color: var(--spectric-text-on-color, #ffffff);--text-on-color-disabled: var(--spectric-text-on-color-disabled, #8d8d8d);--text-placeholder: rgba(22, 22, 22, .4);--text-primary: var(--spectric-text-primary, #161616);--text-secondary: var(--spectric-text-secondary, #525252)}spectric-input .inputWrapper{color:var(--text-secondary)}spectric-input .inputWrapper input{box-sizing:border-box;margin:0;vertical-align:baseline;font-size:.875rem;font-weight:400;line-height:1.28572;letter-spacing:.16px;outline:transparent solid 2px;outline-offset:-2px;border:none;padding:0 1rem;background-color:var(--input-color);color:var(--text-primary, #161616);font-family:inherit;inline-size:100%;block-size:2.5rem}spectric-input .inputWrapper .inputContainer:active:after,spectric-input .inputContainer:focus-within:after{border-bottom-color:var(--input-bottom-focused);width:calc(100% - 5px);transition:width .4s ease-in-out}spectric-input .inputWrapper input:read-only{background-color:transparent;border-bottom-color:var(--border-disabled)}spectric-input .inputContainer{position:relative;border-radius:var(--border-radius);overflow:hidden}spectric-input .inputContainer:after{content:"";width:0px;transition:background-color .4s cubic-bezier(.2,0,.38,.9),border-bottom-color .4s cubic-bezier(.2,0,.38,.9);border-bottom-color:var(--input-bottom);border-bottom-style:solid;border-bottom-width:1px;position:absolute;left:2.5px;bottom:0}spectric-input #helper-text{height:18px}spectric-input #helper-text.hidden{display:none}spectric-input .input-button-right{position:absolute;right:4px;bottom:3px}spectric-input .checkbox{display:flex;justify-self:center;align-items:center}spectric-input .checkbox spectric-button~span{padding-left:5px}spectric-input spectric-colorpicker{display:block}spectric-input[variant=color] .fieldwrapper{display:inline-block}spectric-query{font-family:monospace}spectric-query .autocomplete{color:var(--spectric-text-primary, #161616);border-radius:0em 0em var(--spectric-border-radius, .4em) var(--spectric-border-radius, .4em);background-color:var(--spectric-background, #ffffff);border:1px solid var(--spectric-background-hover, rgba(141, 141, 141, .12));max-height:300px;border-top:0px;margin:0;position:fixed;top:anchor(bottom);justify-self:anchor-center;text-align:center}spectric-query .autocomplete [popover]{overflow:visible}spectric-query .autocomplete .tooltip-content{width:100%}spectric-query .autocomplete .optiontype{float:left;max-width:10px}spectric-query .autocomplete .label{position:absolute;right:0}spectric-query .autocomplete .option.active,spectric-query .autocomplete .option:hover{background-color:var(--spectric-background-hover, rgba(141, 141, 141, .12));border-bottom:1px solid var(--primary, #1ea7fd)}spectric-query .autocomplete .option{border-bottom:1px solid transparent;padding:8px}.query-bar-date-quick-select{display:flex;justify-content:space-evenly}spectric-query span.field-name{color:#50b8f1}spectric-query span.expression-value{color:#c5937b}spectric-query span.field-numeric{color:#bacdab}spectric-query span.wild-card{color:#a94230}spectric-query span.value-constant{color:#3a7cc5}spectric-query .syntax-highlighter{color:#bc89bd;position:absolute;z-index:100;font-size:.875rem;letter-spacing:.16px;padding:0 1.7rem 0 1rem;font-family:inherit;inline-size:calc(100% - .5rem);block-size:2.5rem;content:no-close-quote;vertical-align:baseline;display:flex;align-items:center;pointer-events:none;white-space:nowrap;box-sizing:border-box}spectric-query .syntax-highlighter>*{overflow:hidden}spectric-query:focus-within .syntax-highlighter{display:none}spectric-query spectric-input .inputWrapper input{color:transparent}spectric-query:focus-within spectric-input .inputWrapper input{color:unset}spectric-pagination .spectric-pagination-container{display:flex;justify-content:space-between;align-items:center}spectric-pagination .spectric-pagination-text{flex-grow:1;text-align:center}spectric-table{display:flex;flex-direction:column;overflow:hidden;line-height:1}spectric-table .table-wrapper{overflow:auto;flex-grow:1;position:relative}spectric-table tr{text-align:center}spectric-table tr.odd{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 90%)}spectric-table spectric-table-virtual-body tr:hover{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 70%)}spectric-table spectric-table-virtual-body tr.virtual-scroll-spacer:hover{background-color:unset}spectric-table spectric-table-virtual-body tr{height:var(--rowHeight)}spectric-table td{padding:1px;border:1px solid transparent}spectric-table spectric-table-virtual-body td{height:var(--rowHeight)}spectric-table div[role=table]{display:table;min-width:100%}spectric-table-cell{display:contents;vertical-align:middle}spectric-table-cell td{position:relative}spectric-table td:hover:has(.hasActions){border:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-cell .table-cell-actions{position:absolute;display:flex;width:100%;flex-direction:row-reverse;visibility:hidden;z-index:1}spectric-table-cell .table-cell-actions.tiny{top:-10px}spectric-table-cell .table-cell-actions.xxsmall{top:-16px}spectric-table-cell td:hover .table-cell-actions{visibility:unset}spectric-table .table-checkbox-single spectric-button{--button-border-radius: 50%}spectric-input.table-checkbox-single[checked] spectric-button{--text-on-color: transparent;border-radius:50%;position:relative}spectric-input.table-checkbox-single[checked] spectric-button:before{position:absolute;content:" ";height:50%;width:50%;left:25%;top:25%;border-radius:50%;z-index:1;box-shadow:0 0 0 4px var(--input-color)}spectric-table .cell-contents{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:var(--lineClamp, 1);-webkit-box-pack:center;overflow:hidden;text-overflow:ellipsis;font-size:var(--fontSize);line-height:calc(var(--lineClamp) * var(--fontSize));height:var(--rowHeight)}spectric-table-header{display:table-header-group;font-weight:700;position:sticky;top:0;left:0;z-index:1;background:var(--spectric-background, #ffffff)}spectric-table-header th{vertical-align:middle;position:relative;overflow:hidden}spectric-table-header .header-contents{position:relative}spectric-table-header .header-contents .sort-direction{position:absolute;right:2px;top:calc(50% - 8px)}spectric-table-header .header-contents.sortable{cursor:pointer;padding-right:15px}spectric-table-header .header-contents.resizing{-webkit-user-select:none;user-select:none}spectric-table-header .header-contents.sortable:hover .sort-direction.none:before{content:"⮁"}spectric-table-header th .header-resize-handle{width:6px;position:absolute;right:-1px;top:1px;visibility:hidden;height:100%;cursor:ew-resize;z-index:1}spectric-table-header th .header-resize-handle:before{width:2px;position:absolute;top:1px;background-color:var(--spectric-primary, #1ea7fd);height:100%;content:"";z-index:1}spectric-table-header th:hover .header-resize-handle{visibility:visible}spectric-table-header th:has(*.header-resize-handle):hover:after{content:"";bottom:0;width:100%;background-color:var(--spectric-primary, #1ea7fd);height:1px;display:block;position:absolute}spectric-table-body{display:table-row-group}spectric-table-virtual-body{display:contents}spectric-table-virtual-body .virtual-scroll-spacer td{padding:0;border:0px}.spectric-popover-portal{margin:0;border:0px;padding:0;position:fixed;z-index:9999;background:transparent;pointer-events:all;--spectric-tooltip-background-color: var(--spectric-tooltip-background, var(--spectric-background,#ffffff));--spectric-tooltip-text-color: var(--spectric-tooltip-text, var(--spectric-text-primary, rgb(0, 0, 0)));--spectric-tooltip-accent-color: var(--spectric-tooltip-accent, var(--spectric-primary, #1ea7fd))}.spectric-popover-portal.spectric-tooltip-portal{pointer-events:none}.spectric-popover-portal .tooltip-container{display:flex;justify-content:center;align-items:center}.spectric-popover-portal.top .tooltip-container{flex-direction:column-reverse}.spectric-popover-portal.bottom .tooltip-container{flex-direction:column}.spectric-popover-portal.left .tooltip-container{flex-direction:row-reverse}.spectric-popover-portal .tooltip-content{background:var(--spectric-tooltip-background-color);border-radius:var(--spectric-border-radius,.4em);border:1px solid color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%);box-shadow:0 0 .01em .01em color-mix(in srgb,var(--spectric-tooltip-accent-color) 90%,var(--spectric-text-on-color,#ffffff) 90%);padding:.2em;color:var(--spectric-tooltip-text-color)}.spectric-popover-portal .tooltip-caret{background:color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%)}.spectric-tooltip-portal.top .tooltip-caret,.spectric-tooltip-portal.bottom .tooltip-caret{inline-size:.75rem;block-size:.374rem}.spectric-tooltip-portal.left .tooltip-caret,.spectric-tooltip-portal.right .tooltip-caret{inline-size:.375rem;block-size:.75rem}.spectric-popover-portal.top .tooltip-caret{clip-path:polygon(0 0,50% 100%,100% 0)}.spectric-popover-portal.bottom .tooltip-caret{clip-path:polygon(0 100%,50% 0,100% 100%)}.spectric-popover-portal.left .tooltip-caret{clip-path:polygon(0 0,100% 50%,0 100%)}.spectric-popover-portal.right .tooltip-caret{clip-path:polygon(0 50%,100% 0,100% 100%)}spectric-input.hue-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.hue-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.alpha-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range],spectric-input.hue-gradient input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.color-picker-footer{display:flex;justify-content:space-evenly}.color-picker-saturation-lightness-grid{cursor:crosshair}.color-picker-eyedropper{--button-border-radius:50%}.color-picker-eyedropper.hidden{display:none}spectric-calendar{display:flex;justify-content:center;--default-text-on-color:var(--spectric-text-on-color, #ffffff)}spectric-calendar .header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}spectric-calendar .month-year{display:flex;align-items:center;gap:10px}spectric-calendar select{font-size:14px;padding:2px}spectric-calendar .days{display:grid;grid-template-columns:repeat(7,34px);grid-template-rows:repeat(7,34px);text-align:center;background:radial-gradient(circle at var(--x, 200%) var(--y, 200%),var(--spectric-background-inverse,#ffffff) 0%,var(--spectric-background,#f4f4f4) 25%);transition:background .1s ease;--spectric-text-on-color: var(--spectric-primary,#1ea7fd)}spectric-calendar .day{font-weight:700;padding:5px;background-color:var(--spectric-background)}spectric-calendar .date.active{--spectric-text-on-color: var(--default-text-on-color, #ffffff)}spectric-calendar .date{margin:2px}
|
package/package.json
CHANGED
package/src/components/input.ts
CHANGED
|
@@ -81,6 +81,8 @@ export interface InputProps {
|
|
|
81
81
|
* The sets the autocomplete for the input.
|
|
82
82
|
*/
|
|
83
83
|
autocomplete?: HTMLInputElement["autocomplete"];
|
|
84
|
+
|
|
85
|
+
spellcheck?: HTMLInputElement["spellcheck"];
|
|
84
86
|
}
|
|
85
87
|
@customElement("spectric-input")
|
|
86
88
|
export class SpectricInput extends LitElement implements InputProps {
|
|
@@ -169,6 +171,13 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
169
171
|
*/
|
|
170
172
|
@property({ reflect: true })
|
|
171
173
|
autocomplete: HTMLInputElement["autocomplete"] = "off";
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The sets the autocomplete for the input.
|
|
177
|
+
*/
|
|
178
|
+
@property({ reflect: true, type: Boolean })
|
|
179
|
+
spellcheck: HTMLInputElement["spellcheck"] = true;
|
|
180
|
+
|
|
172
181
|
get selectionStart() {
|
|
173
182
|
if (!this._input) {
|
|
174
183
|
return null;
|
|
@@ -306,6 +315,7 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
306
315
|
pattern="${ifNonEmpty(this.pattern)}"
|
|
307
316
|
placeholder="${ifNonEmpty(this.placeholder)}"
|
|
308
317
|
autocomplete="${ifNonEmpty(this.autocomplete)}"
|
|
318
|
+
spellcheck=${this.spellcheck}
|
|
309
319
|
?readonly="${this.readonly}"
|
|
310
320
|
?required="${this.required}"
|
|
311
321
|
type="${ifNonEmpty(
|
|
@@ -1,99 +1,98 @@
|
|
|
1
1
|
spectric-query {
|
|
2
|
-
|
|
2
|
+
font-family: monospace;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
spectric-query .autocomplete {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
color: var(--spectric-text-primary, #161616);
|
|
7
|
+
border-radius: 0em 0em var(--spectric-border-radius, 0.4em)
|
|
8
|
+
var(--spectric-border-radius, 0.4em);
|
|
9
|
+
background-color: var(--spectric-background, #ffffff);
|
|
10
|
+
border: 1px solid var(--spectric-background-hover, rgba(141, 141, 141, 0.12));
|
|
11
|
+
max-height: 300px;
|
|
12
|
+
border-top: 0px;
|
|
13
|
+
margin: 0px;
|
|
14
|
+
/*Input helper text is 18px we can cover that with the popover*/
|
|
15
|
+
position: fixed;
|
|
16
|
+
top: anchor(bottom);
|
|
17
|
+
justify-self: anchor-center;
|
|
18
|
+
text-align: center;
|
|
19
|
+
}
|
|
20
|
+
spectric-query .autocomplete [popover] {
|
|
21
|
+
overflow: visible;
|
|
22
|
+
}
|
|
23
|
+
spectric-query .autocomplete .tooltip-content {
|
|
24
|
+
width: 100%;
|
|
26
25
|
}
|
|
27
26
|
spectric-query .autocomplete .optiontype {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
float: left;
|
|
28
|
+
max-width: 10px;
|
|
29
|
+
/*todo should we display an icon instead of text?*/
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
spectric-query .autocomplete .label {
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
position: absolute;
|
|
34
|
+
right: 0;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
spectric-query .autocomplete .option.active,
|
|
39
38
|
spectric-query .autocomplete .option:hover {
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
background-color: var(--spectric-background-hover, rgba(141, 141, 141, 0.12));
|
|
40
|
+
border-bottom: 1px solid var(--primary, #1ea7fd);
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
spectric-query .autocomplete .option {
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
border-bottom: 1px solid transparent;
|
|
45
|
+
padding: 8px;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
.query-bar-date-quick-select {
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
display: flex;
|
|
50
|
+
justify-content: space-evenly;
|
|
52
51
|
}
|
|
53
52
|
spectric-query span.field-name {
|
|
54
|
-
|
|
53
|
+
color: #50b8f1;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
spectric-query span.expression-value {
|
|
58
|
-
|
|
57
|
+
color: #c5937b;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
spectric-query span.field-numeric {
|
|
62
|
-
|
|
61
|
+
color: #bacdab;
|
|
63
62
|
}
|
|
64
63
|
spectric-query span.wild-card {
|
|
65
|
-
|
|
64
|
+
color: #a94230;
|
|
66
65
|
}
|
|
67
66
|
spectric-query span.value-constant {
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
spectric-query .syntax-highlighter{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
spectric-query .syntax-highlighter
|
|
89
|
-
overflow: hidden;
|
|
90
|
-
}
|
|
91
|
-
spectric-query:focus-within .syntax-highlighter{
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
spectric-query spectric-input .inputWrapper input{
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
spectric-query:focus-within spectric-input .inputWrapper input{
|
|
98
|
-
|
|
99
|
-
}
|
|
67
|
+
color: #3a7cc5;
|
|
68
|
+
}
|
|
69
|
+
spectric-query .syntax-highlighter {
|
|
70
|
+
color: #bc89bd;
|
|
71
|
+
position: absolute;
|
|
72
|
+
z-index: 100;
|
|
73
|
+
font-size: 0.875rem;
|
|
74
|
+
letter-spacing: 0.16px;
|
|
75
|
+
padding: 0 1.7rem 0 1rem;
|
|
76
|
+
font-family: inherit;
|
|
77
|
+
inline-size: calc(100% - 0.5rem);
|
|
78
|
+
block-size: 2.5rem;
|
|
79
|
+
content: no-close-quote;
|
|
80
|
+
vertical-align: baseline;
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
}
|
|
87
|
+
spectric-query .syntax-highlighter > * {
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
}
|
|
90
|
+
spectric-query:focus-within .syntax-highlighter {
|
|
91
|
+
display: none;
|
|
92
|
+
}
|
|
93
|
+
spectric-query spectric-input .inputWrapper input {
|
|
94
|
+
color: transparent;
|
|
95
|
+
}
|
|
96
|
+
spectric-query:focus-within spectric-input .inputWrapper input {
|
|
97
|
+
color: unset;
|
|
98
|
+
}
|
|
@@ -48,7 +48,7 @@ export enum SupportedLanguages {
|
|
|
48
48
|
AST = "AST",
|
|
49
49
|
}
|
|
50
50
|
type SupportedLanguagesTypes = `${SupportedLanguages}`;
|
|
51
|
-
interface QueryEventMap {
|
|
51
|
+
export interface QueryEventMap {
|
|
52
52
|
change: (event: CustomEvent<string | kuery.KueryNode | JsonObject>) => void;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -159,13 +159,13 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
159
159
|
@property({ type: String, reflect: true })
|
|
160
160
|
value = "";
|
|
161
161
|
@property({ type: String, reflect: true })
|
|
162
|
-
outputLanguage
|
|
162
|
+
outputLanguage?: SupportedLanguagesTypes = "AST";
|
|
163
163
|
@state()
|
|
164
164
|
private completions: Completion[] = [];
|
|
165
165
|
@state()
|
|
166
166
|
private completionIndex = 0;
|
|
167
167
|
@property({ type: Array, reflect: true })
|
|
168
|
-
fields
|
|
168
|
+
fields?: FieldTypes[] = [];
|
|
169
169
|
|
|
170
170
|
@query(".autocomplete")
|
|
171
171
|
_autocomplete?: PopoverElement;
|
|
@@ -188,6 +188,7 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
188
188
|
suggestion = this._getSuggestion();
|
|
189
189
|
} catch (error) {
|
|
190
190
|
console.log(error);
|
|
191
|
+
this._autocomplete?.hidePopover();
|
|
191
192
|
}
|
|
192
193
|
if (!suggestion) {
|
|
193
194
|
return;
|
|
@@ -221,9 +222,8 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
221
222
|
if (!suggestion || suggestion.start === suggestion.end) {
|
|
222
223
|
return;
|
|
223
224
|
}
|
|
224
|
-
let
|
|
225
|
-
|
|
226
|
-
);
|
|
225
|
+
let fields = this.fields || [];
|
|
226
|
+
let field = fields.find((field) => field.name === suggestion.fieldName);
|
|
227
227
|
|
|
228
228
|
if (!field) {
|
|
229
229
|
return;
|
|
@@ -306,11 +306,12 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
306
306
|
let suggestions = this._getSuggestion();
|
|
307
307
|
this.autoComplete(suggestions);
|
|
308
308
|
} catch (error: any) {
|
|
309
|
+
this.completions = [];
|
|
310
|
+
this._autocomplete?.hidePopover();
|
|
309
311
|
// this.completions = []
|
|
310
312
|
// this._input.invalid = true;
|
|
311
313
|
// let [expect, _, arrow] = e.message.split("\n")
|
|
312
314
|
// this._input.invalidText = html`  ${arrow} ${expect}`;
|
|
313
|
-
return;
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
try {
|
|
@@ -322,13 +323,13 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
322
323
|
if (this.outputLanguage == "AST") {
|
|
323
324
|
output = ast;
|
|
324
325
|
} else {
|
|
325
|
-
output = kuery[this.outputLanguage](ast, this.fields);
|
|
326
|
+
output = kuery[this.outputLanguage || "toDSL"](ast, this.fields);
|
|
326
327
|
}
|
|
327
328
|
let event = new CustomEvent("change", { detail: output });
|
|
328
329
|
if (this.value.trim().length) {
|
|
329
330
|
this.highlightedSyntax = unsafeHTML(kuery.toHTML(ast, this.fields));
|
|
330
|
-
}else{
|
|
331
|
-
this.highlightedSyntax = ""
|
|
331
|
+
} else {
|
|
332
|
+
this.highlightedSyntax = "";
|
|
332
333
|
}
|
|
333
334
|
this.dispatchEvent(event);
|
|
334
335
|
};
|
|
@@ -359,8 +360,9 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
359
360
|
}))
|
|
360
361
|
);
|
|
361
362
|
}
|
|
363
|
+
let fields = this.fields || [];
|
|
362
364
|
if (type === "field") {
|
|
363
|
-
let fieldCompletions =
|
|
365
|
+
let fieldCompletions = fields
|
|
364
366
|
.filter(
|
|
365
367
|
(field) =>
|
|
366
368
|
field.name.includes(suggestion.fieldName) ||
|
|
@@ -373,7 +375,7 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
373
375
|
completions.push(...fieldCompletions);
|
|
374
376
|
}
|
|
375
377
|
if (type === "operator") {
|
|
376
|
-
let fieldType =
|
|
378
|
+
let fieldType = fields.find(
|
|
377
379
|
(field) => field.name === suggestion.fieldName
|
|
378
380
|
);
|
|
379
381
|
if (fieldType) {
|
|
@@ -456,7 +458,7 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
456
458
|
}
|
|
457
459
|
}
|
|
458
460
|
if (type === "value") {
|
|
459
|
-
let fieldType = this.fields.find(
|
|
461
|
+
let fieldType = (this.fields || []).find(
|
|
460
462
|
(field) => field.name === suggestion.fieldName
|
|
461
463
|
);
|
|
462
464
|
if (
|
|
@@ -505,10 +507,14 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
505
507
|
this._autocomplete?.hidePopover();
|
|
506
508
|
}
|
|
507
509
|
}
|
|
508
|
-
protected
|
|
510
|
+
protected update(changed: PropertyValues): void {
|
|
509
511
|
if (changed.has("outputLanguage")) {
|
|
510
512
|
this._parseQuery();
|
|
511
513
|
}
|
|
514
|
+
if (changed.has("value")) {
|
|
515
|
+
this._parseQuery();
|
|
516
|
+
}
|
|
517
|
+
super.update(changed);
|
|
512
518
|
}
|
|
513
519
|
_selectCompletion = async () => {
|
|
514
520
|
if (!this.suggestion) {
|
|
@@ -595,10 +601,14 @@ export class SpectricQuery extends LitElement implements IQueryProps {
|
|
|
595
601
|
.placeholder=${this.placeholder}
|
|
596
602
|
style=${`anchor-name:--${this.uuid};`}
|
|
597
603
|
autocomplete="off"
|
|
604
|
+
.spellcheck=${false}
|
|
598
605
|
@input=${this._parseQuery}
|
|
599
606
|
@keydown=${this._handleArrows}
|
|
600
607
|
@change=${(e: Event) => e.stopPropagation()}
|
|
601
608
|
@click=${this._checkClickLocation}
|
|
609
|
+
@blur=${() => {
|
|
610
|
+
this._autocomplete?.hidePopover();
|
|
611
|
+
}}
|
|
602
612
|
></spectric-input>
|
|
603
613
|
<spectric-popover
|
|
604
614
|
class="valueHelper"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { test, expect } from "@playwright/test";
|
|
2
|
+
import type {
|
|
3
|
+
SpectricQuery,
|
|
4
|
+
QueryEventMap,
|
|
5
|
+
KueryNode,
|
|
6
|
+
JsonObject,
|
|
7
|
+
} from "../index";
|
|
8
|
+
import type SpectricModule from "../../../index.ts";
|
|
9
|
+
import { SpectricInput } from "../../../index.ts";
|
|
10
|
+
test.beforeEach(async ({ page }) => {
|
|
11
|
+
page.on("console", (msg) => {
|
|
12
|
+
console.log(`Page[${msg.type()}]:` + msg.text());
|
|
13
|
+
});
|
|
14
|
+
await page.addInitScript(() => {
|
|
15
|
+
//@ts-ignore
|
|
16
|
+
window.awaitEvent = function awaitEvent(target, event, trigger) {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
let timeout = setTimeout(reject, 400);
|
|
19
|
+
const handleEvent = (...args) => {
|
|
20
|
+
clearTimeout(timeout);
|
|
21
|
+
//@ts-ignore
|
|
22
|
+
target.removeEventListener(event, handleEvent);
|
|
23
|
+
resolve(args);
|
|
24
|
+
};
|
|
25
|
+
//@ts-ignore
|
|
26
|
+
target.addEventListener(event, handleEvent, { once: true });
|
|
27
|
+
trigger();
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
type HighlightResponse = {
|
|
34
|
+
query: string;
|
|
35
|
+
query_ast: KueryNode;
|
|
36
|
+
highlight_ast: KueryNode;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
test.describe("Spectric Querybar Highlight Tests", () => {
|
|
40
|
+
test("Ensure the highlighted syntax outputs the same AST as the input (except geoqueries those are truncated)", async ({
|
|
41
|
+
page,
|
|
42
|
+
}) => {
|
|
43
|
+
await page.goto(
|
|
44
|
+
"http://localhost:6006/iframe.html?globals=&args=&id=spectric-ui-components-ui-query--basic&viewMode=story"
|
|
45
|
+
);
|
|
46
|
+
let queryBar = page.locator("spectric-query");
|
|
47
|
+
await queryBar.waitFor();
|
|
48
|
+
let responses = await queryBar.evaluate<HighlightResponse[], SpectricQuery>(
|
|
49
|
+
async (queryBar) => {
|
|
50
|
+
queryBar.outputLanguage = "AST";
|
|
51
|
+
const TEST_QUERYS = [
|
|
52
|
+
`test:"test"`,
|
|
53
|
+
`test:("works" or "still works")`,
|
|
54
|
+
`test:("works" and "still works")`,
|
|
55
|
+
`(test:"works" and test_num > 10) or (modulation:("FM" or "AM") and test_num < 5)`,
|
|
56
|
+
`( ("value" OR "value2") AND "value3" )`,
|
|
57
|
+
];
|
|
58
|
+
const output: HighlightResponse[] = [];
|
|
59
|
+
for (let query of TEST_QUERYS) {
|
|
60
|
+
queryBar.value = "";
|
|
61
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
62
|
+
let [event] = (await window.awaitEvent<QueryEventMap>(
|
|
63
|
+
queryBar,
|
|
64
|
+
"change",
|
|
65
|
+
() => (queryBar.value = query)
|
|
66
|
+
)) as Parameters<QueryEventMap["change"]>;
|
|
67
|
+
let highlightedSyntax = queryBar.querySelector<HTMLDivElement>(
|
|
68
|
+
".syntax-highlighter"
|
|
69
|
+
)!.innerText;
|
|
70
|
+
queryBar.value = "";
|
|
71
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
72
|
+
let [highlightedEvent] = (await window.awaitEvent<QueryEventMap>(
|
|
73
|
+
queryBar,
|
|
74
|
+
"change",
|
|
75
|
+
() => (queryBar.value = highlightedSyntax)
|
|
76
|
+
)) as Parameters<QueryEventMap["change"]>;
|
|
77
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
78
|
+
output.push({
|
|
79
|
+
query,
|
|
80
|
+
query_ast: event.detail as KueryNode,
|
|
81
|
+
highlight_ast: highlightedEvent.detail as KueryNode,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return output;
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
for (let { query, query_ast, highlight_ast } of responses) {
|
|
88
|
+
expect(highlight_ast, query).toMatchObject(query_ast);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
declare global {
|
|
94
|
+
interface Window {
|
|
95
|
+
awaitEvent: <EventMap extends Record<string, any>, K = keyof EventMap>(
|
|
96
|
+
target: HTMLElement,
|
|
97
|
+
event: K,
|
|
98
|
+
trigger: () => void
|
|
99
|
+
) => Parameters<EventMap[keyof EventMap]>;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -25,8 +25,14 @@ const and = (node: KueryNode, fields?: FieldTypes[]) => {
|
|
|
25
25
|
if (node.group !== undefined) {
|
|
26
26
|
try {
|
|
27
27
|
let { fieldName, values } = groupVariables(children);
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
let operator = ":";
|
|
29
|
+
if (fieldName === extractFieldName({ type: "literal", value: null })) {
|
|
30
|
+
//This is a multimatch search ("test","test1") are the values searched acrall all fields
|
|
31
|
+
fieldName = "";
|
|
32
|
+
operator = "";
|
|
33
|
+
}
|
|
34
|
+
return `<span class="and-expression">${fieldName}${operator}(${values.join(
|
|
35
|
+
" AND "
|
|
30
36
|
)})</span>`;
|
|
31
37
|
} catch (error) {
|
|
32
38
|
console.log(error);
|
|
@@ -47,7 +53,13 @@ const or = (node: KueryNode, fields?: FieldTypes[]) => {
|
|
|
47
53
|
if (node.group !== undefined) {
|
|
48
54
|
try {
|
|
49
55
|
let { fieldName, values } = groupVariables(children);
|
|
50
|
-
|
|
56
|
+
let operator = ":";
|
|
57
|
+
if (fieldName === extractFieldName({ type: "literal", value: null })) {
|
|
58
|
+
//This is a multimatch search ("test","test1") are the values searched acrall all fields
|
|
59
|
+
fieldName = "";
|
|
60
|
+
operator = "";
|
|
61
|
+
}
|
|
62
|
+
return `<span class="or-expression">${fieldName}${operator}(${values.join(
|
|
51
63
|
" OR "
|
|
52
64
|
)})</span>`;
|
|
53
65
|
} catch (error) {
|
|
@@ -84,6 +96,11 @@ const is = (node: KueryNode, fields?: FieldTypes[]) => {
|
|
|
84
96
|
} = node;
|
|
85
97
|
let operator = ":";
|
|
86
98
|
let fieldName = extractFieldName(fieldNameArg);
|
|
99
|
+
if (fieldName === extractFieldName({ type: "literal", value: null })) {
|
|
100
|
+
//This is a multimatch search ("test","test1") are the values searched acrall all fields
|
|
101
|
+
fieldName = "";
|
|
102
|
+
operator = "";
|
|
103
|
+
}
|
|
87
104
|
let value = extractLiteralValue(fieldName, valueArg, isPhrase, fields);
|
|
88
105
|
return `<span class="is-expression">${fieldName}${operator}${value}</span>`;
|
|
89
106
|
};
|
|
@@ -147,7 +164,11 @@ const range = (node: KueryNode) => {
|
|
|
147
164
|
value = `${value}`;
|
|
148
165
|
}
|
|
149
166
|
//double check that its a number else quote it
|
|
150
|
-
|
|
167
|
+
//parseFloat("2025-Not a float") parses as a float... so we double check with regex
|
|
168
|
+
if (
|
|
169
|
+
Number.isNaN(parseFloat(value)) ||
|
|
170
|
+
!value.match(/^[-+]?([0-9]*\.[0-9]+|[0-9]+(\.[0-9]*)?)$/)
|
|
171
|
+
) {
|
|
151
172
|
value = `<span class="expression-value">"${value}"</span>`;
|
|
152
173
|
}
|
|
153
174
|
return `<span class="range-expression"><span class="field-name">${fieldNameArg.value}</span> ${opsign} <span class="field-numeric">${value}</span></span>`;
|
|
@@ -1,54 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
spectric-table-header {
|
|
2
|
+
display: table-header-group;
|
|
3
|
+
font-weight: bold;
|
|
4
|
+
position: sticky;
|
|
5
|
+
top: 0px;
|
|
6
|
+
left: 0px;
|
|
7
|
+
z-index: 1;
|
|
8
|
+
background: var(--spectric-background, #ffffff);
|
|
9
|
+
}
|
|
10
|
+
spectric-table-header th {
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
position: relative;
|
|
13
|
+
overflow: hidden;
|
|
14
14
|
}
|
|
15
15
|
spectric-table-header .header-contents {
|
|
16
|
-
|
|
16
|
+
position: relative;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
spectric-table-header .header-contents .sort-direction {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
position: absolute;
|
|
21
|
+
right: 2px;
|
|
22
|
+
top: calc(50% - 8px);
|
|
23
23
|
}
|
|
24
24
|
spectric-table-header .header-contents.sortable {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
padding-right: 15px;
|
|
27
27
|
}
|
|
28
28
|
spectric-table-header .header-contents.resizing {
|
|
29
|
-
|
|
29
|
+
user-select: none;
|
|
30
30
|
}
|
|
31
|
-
spectric-table-header
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
spectric-table-header
|
|
32
|
+
.header-contents.sortable:hover
|
|
33
|
+
.sort-direction.none::before {
|
|
34
|
+
content: "\2B81";
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
spectric-table-header th .header-resize-handle {
|
|
38
|
+
width: 6px;
|
|
39
|
+
position: absolute;
|
|
40
|
+
right: -1px;
|
|
41
|
+
top: 1px;
|
|
42
|
+
visibility: hidden;
|
|
43
|
+
height: 100%;
|
|
44
|
+
cursor: ew-resize;
|
|
45
|
+
z-index: 1;
|
|
46
|
+
}
|
|
47
|
+
spectric-table-header th .header-resize-handle::before {
|
|
48
|
+
width: 2px;
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 1px;
|
|
51
|
+
background-color: var(--spectric-primary, #1ea7fd);
|
|
52
|
+
height: 100%;
|
|
53
|
+
content: "";
|
|
54
|
+
z-index: 1;
|
|
55
|
+
}
|
|
56
|
+
spectric-table-header th:hover .header-resize-handle {
|
|
57
|
+
visibility: visible;
|
|
47
58
|
}
|
|
48
59
|
|
|
49
|
-
spectric-table-header
|
|
50
|
-
|
|
60
|
+
spectric-table-header th:has(*.header-resize-handle):hover::after {
|
|
61
|
+
content: "";
|
|
62
|
+
position: absolute;
|
|
63
|
+
bottom: 0px;
|
|
64
|
+
width: 100%;
|
|
65
|
+
background-color: var(--spectric-primary, #1ea7fd);
|
|
66
|
+
height: 1px;
|
|
67
|
+
display: block;
|
|
68
|
+
position: absolute;
|
|
51
69
|
}
|
|
52
|
-
spectric-table-header td:hover:has(*.header-resize-handle) {
|
|
53
|
-
border-bottom: 1px solid var(--spectric-primary, #1ea7fd);
|
|
54
|
-
}
|