@spectric/ui 0.0.24 → 0.0.25
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/index.es.js +1192 -1125
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +141 -140
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/input.ts +2 -1
- package/src/components/query_bar/QueryBar.css +7 -3
- package/src/components/query_bar/querylanguage/kuery/ast/_generated_/kuery.js +7 -3
- package/src/components/query_bar/querylanguage/kuery/ast/kuery.peg +7 -3
- package/src/components/query_bar/querylanguage/outputTypes/toHTML.ts +96 -21
- package/src/components/table/table.ts +31 -10
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;box-sizing:border-box;font-size:.875rem;letter-spacing:.16px;padding:0 1rem;font-family:inherit;inline-size:100%;block-size:2.5rem;content:no-close-quote;vertical-align:baseline;display:flex;align-items:center;pointer-events:none}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 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}
|
package/package.json
CHANGED
package/src/components/input.ts
CHANGED
|
@@ -250,7 +250,7 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
250
250
|
changedProperties.has("checked") &&
|
|
251
251
|
changedProperties.get("checked") !== undefined
|
|
252
252
|
) {
|
|
253
|
-
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
253
|
+
//this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
@eventOptions({ capture: true })
|
|
@@ -404,6 +404,7 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
404
404
|
@click=${() => {
|
|
405
405
|
this.checked = !this.checked;
|
|
406
406
|
this.value = Boolean(this.checked);
|
|
407
|
+
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
407
408
|
}} icon size=${this.size || "xxsmall"} variant=${
|
|
408
409
|
this.checked ? "primary" : "secondary"
|
|
409
410
|
}>${this.checked ? "✓" : "\u00A0"}</spectric-button>
|
|
@@ -68,21 +68,25 @@ spectric-query span.value-constant {
|
|
|
68
68
|
color: #3a7cc5;
|
|
69
69
|
}
|
|
70
70
|
spectric-query .syntax-highlighter{
|
|
71
|
-
|
|
71
|
+
color: #bc89bd;
|
|
72
72
|
position: absolute;
|
|
73
73
|
z-index: 100;
|
|
74
|
-
box-sizing: border-box;
|
|
75
74
|
font-size: .875rem;
|
|
76
75
|
letter-spacing: .16px;
|
|
77
76
|
padding: 0 1rem;
|
|
78
77
|
font-family: inherit;
|
|
79
|
-
inline-size: 100
|
|
78
|
+
inline-size: calc(100% - .5rem);
|
|
80
79
|
block-size: 2.5rem;
|
|
81
80
|
content: no-close-quote;
|
|
82
81
|
vertical-align: baseline;
|
|
83
82
|
display: flex;
|
|
84
83
|
align-items: center;
|
|
85
84
|
pointer-events: none;
|
|
85
|
+
white-space: nowrap;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
}
|
|
88
|
+
spectric-query .syntax-highlighter >*{
|
|
89
|
+
overflow: hidden;
|
|
86
90
|
}
|
|
87
91
|
spectric-query:focus-within .syntax-highlighter{
|
|
88
92
|
display: none;
|
|
@@ -266,7 +266,8 @@ function peg$parse(input, options) {
|
|
|
266
266
|
rule:"SubQuery"
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
|
-
|
|
269
|
+
group++
|
|
270
|
+
return {...query,group};
|
|
270
271
|
}
|
|
271
272
|
function peg$f5(field, query, trailing) {
|
|
272
273
|
if (query.type === 'cursor') {
|
|
@@ -384,7 +385,8 @@ function peg$parse(input, options) {
|
|
|
384
385
|
rule:"OrListOfValues"
|
|
385
386
|
};
|
|
386
387
|
}
|
|
387
|
-
|
|
388
|
+
group++
|
|
389
|
+
return (field) => ({...buildFunctionNode('or', [partialLeft(field), partialRight(field)]),group});
|
|
388
390
|
}
|
|
389
391
|
function peg$f13(partialLeft, partialRight) {
|
|
390
392
|
const cursor = [partialLeft, partialRight].find(node => node.type === 'cursor');
|
|
@@ -395,7 +397,8 @@ function peg$parse(input, options) {
|
|
|
395
397
|
rule:"AndListOfValues"
|
|
396
398
|
};
|
|
397
399
|
}
|
|
398
|
-
|
|
400
|
+
group++
|
|
401
|
+
return (field) => ({...buildFunctionNode('and', [partialLeft(field), partialRight(field)]),group});
|
|
399
402
|
}
|
|
400
403
|
function peg$f14(partial) {
|
|
401
404
|
if (partial.type === 'cursor') {
|
|
@@ -2234,6 +2237,7 @@ function peg$parse(input, options) {
|
|
|
2234
2237
|
const buildWildcardNode = nodeTypes.wildcard.buildNode;
|
|
2235
2238
|
const buildNamedArgNode = nodeTypes.namedArg.buildNode;
|
|
2236
2239
|
const { wildcardSymbol } = nodeTypes.wildcard;
|
|
2240
|
+
var group = 0
|
|
2237
2241
|
|
|
2238
2242
|
peg$result = peg$startRuleFunction();
|
|
2239
2243
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
const buildWildcardNode = nodeTypes.wildcard.buildNode;
|
|
12
12
|
const buildNamedArgNode = nodeTypes.namedArg.buildNode;
|
|
13
13
|
const { wildcardSymbol } = nodeTypes.wildcard;
|
|
14
|
+
var group = 0
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
start
|
|
@@ -58,7 +59,8 @@ SubQuery
|
|
|
58
59
|
rule:"SubQuery"
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
group++
|
|
63
|
+
return {...query,group};
|
|
62
64
|
}
|
|
63
65
|
/ NestedQuery
|
|
64
66
|
|
|
@@ -203,7 +205,8 @@ OrListOfValues
|
|
|
203
205
|
rule:"OrListOfValues"
|
|
204
206
|
};
|
|
205
207
|
}
|
|
206
|
-
|
|
208
|
+
group++
|
|
209
|
+
return (field) => ({...buildFunctionNode('or', [partialLeft(field), partialRight(field)]),group});
|
|
207
210
|
}
|
|
208
211
|
/ AndListOfValues
|
|
209
212
|
|
|
@@ -217,7 +220,8 @@ AndListOfValues
|
|
|
217
220
|
rule:"AndListOfValues"
|
|
218
221
|
};
|
|
219
222
|
}
|
|
220
|
-
|
|
223
|
+
group++
|
|
224
|
+
return (field) => ({...buildFunctionNode('and', [partialLeft(field), partialRight(field)]),group});
|
|
221
225
|
}
|
|
222
226
|
/ NotListOfValues
|
|
223
227
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FieldTypes, GeospatialOperators, KueryNode } from "../..";
|
|
2
|
+
import { LiteralTypeBuildNode } from "../kuery";
|
|
2
3
|
import { wildcardSymbol } from "../kuery/node_types/wildcard";
|
|
3
4
|
|
|
4
5
|
export const KQL_WILDCARD_SYMBOL = wildcardSymbol;
|
|
@@ -13,31 +14,26 @@ export type FunctionName =
|
|
|
13
14
|
| "nested";
|
|
14
15
|
const and = (node: KueryNode, fields?: FieldTypes[]) => {
|
|
15
16
|
const children = node.arguments || [];
|
|
16
|
-
|
|
17
|
+
let html =
|
|
17
18
|
"<span class='and-expression'>" +
|
|
18
19
|
children
|
|
19
20
|
.map((child: KueryNode) => {
|
|
20
21
|
return toHTML(child, fields);
|
|
21
22
|
})
|
|
22
23
|
.join(" AND ") +
|
|
23
|
-
"</span>"
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
let fieldName = toHTML(fieldNameArg);
|
|
36
|
-
if (fields && fields.find((f) => f.name === fieldName)?.type === "boolean") {
|
|
37
|
-
value = `<span class="value-constant">${valueArg.value}</span>`;
|
|
24
|
+
"</span>";
|
|
25
|
+
if (node.group !== undefined) {
|
|
26
|
+
try {
|
|
27
|
+
let { fieldName, values } = groupVariables(children);
|
|
28
|
+
return `<span class="or-expression">${fieldName}:(${values.join(
|
|
29
|
+
" OR "
|
|
30
|
+
)})</span>`;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.log(error);
|
|
33
|
+
}
|
|
34
|
+
return `( ${html} )`;
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
return `<span class="is-expression"><span class="field-name">${fieldName}</span>${operator}<span class="expression-value">${value}</span></span>`;
|
|
36
|
+
return html;
|
|
41
37
|
};
|
|
42
38
|
|
|
43
39
|
const or = (node: KueryNode, fields?: FieldTypes[]) => {
|
|
@@ -47,13 +43,94 @@ const or = (node: KueryNode, fields?: FieldTypes[]) => {
|
|
|
47
43
|
return toHTML(child, fields);
|
|
48
44
|
})
|
|
49
45
|
.join(" OR ");
|
|
50
|
-
|
|
46
|
+
let html = `<span class="or-expression">${args}</span>`;
|
|
47
|
+
if (node.group !== undefined) {
|
|
48
|
+
try {
|
|
49
|
+
let { fieldName, values } = groupVariables(children);
|
|
50
|
+
return `<span class="or-expression">${fieldName}:(${values.join(
|
|
51
|
+
" OR "
|
|
52
|
+
)})</span>`;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.log(error);
|
|
55
|
+
}
|
|
56
|
+
return `( ${html} )`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return html;
|
|
51
60
|
};
|
|
61
|
+
|
|
62
|
+
const extractLiteralValue = (
|
|
63
|
+
fieldName: string,
|
|
64
|
+
valueArg: LiteralTypeBuildNode,
|
|
65
|
+
isPhrase: LiteralTypeBuildNode,
|
|
66
|
+
fields?: FieldTypes[]
|
|
67
|
+
) => {
|
|
68
|
+
let value = toHTML(valueArg);
|
|
69
|
+
if (isPhrase.value) {
|
|
70
|
+
value = `"${value}"`;
|
|
71
|
+
}
|
|
72
|
+
if (fields && fields.find((f) => f.name === fieldName)?.type === "boolean") {
|
|
73
|
+
value = `<span class="value-constant">${valueArg.value}</span>`;
|
|
74
|
+
}
|
|
75
|
+
return `<span class="expression-value">${value}</span>`;
|
|
76
|
+
};
|
|
77
|
+
const extractFieldName = (fieldNameArg: any) => {
|
|
78
|
+
let fieldName = toHTML(fieldNameArg);
|
|
79
|
+
return `<span class="field-name">${fieldName}</span>`;
|
|
80
|
+
};
|
|
81
|
+
const is = (node: KueryNode, fields?: FieldTypes[]) => {
|
|
82
|
+
var {
|
|
83
|
+
arguments: [fieldNameArg, valueArg, isPhrase],
|
|
84
|
+
} = node;
|
|
85
|
+
let operator = ":";
|
|
86
|
+
let fieldName = extractFieldName(fieldNameArg);
|
|
87
|
+
let value = extractLiteralValue(fieldName, valueArg, isPhrase, fields);
|
|
88
|
+
return `<span class="is-expression">${fieldName}${operator}${value}</span>`;
|
|
89
|
+
};
|
|
90
|
+
|
|
52
91
|
const not = (node: KueryNode, fields?: FieldTypes[]) => {
|
|
53
92
|
const [argument] = node.arguments;
|
|
54
93
|
return `<span class="not-expression">not ${toHTML(argument, fields)}</span>`;
|
|
55
94
|
};
|
|
56
95
|
|
|
96
|
+
const groupVariables = (
|
|
97
|
+
nodes: KueryNode[],
|
|
98
|
+
fieldName: string | undefined = undefined,
|
|
99
|
+
fields?: FieldTypes[]
|
|
100
|
+
) => {
|
|
101
|
+
let values: string[] = [];
|
|
102
|
+
if (!fieldName && nodes[0].function == "is") {
|
|
103
|
+
fieldName = extractFieldName(nodes[0].arguments[0]);
|
|
104
|
+
}
|
|
105
|
+
if (!fieldName) {
|
|
106
|
+
throw Error(
|
|
107
|
+
"Cannot group variables because they don't have a groupable field"
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
for (let node of nodes) {
|
|
111
|
+
var {
|
|
112
|
+
arguments: [fieldNameArg, valueArg, isPhrase],
|
|
113
|
+
} = node;
|
|
114
|
+
if (node.function == "is") {
|
|
115
|
+
if (extractFieldName(fieldNameArg) !== fieldName) {
|
|
116
|
+
throw Error(
|
|
117
|
+
"Cannot group variables because they aren't for the same field"
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
let value = extractLiteralValue(fieldName, valueArg, isPhrase, fields);
|
|
121
|
+
values.push(value);
|
|
122
|
+
} else if (node.function === "or" || node.function === "and") {
|
|
123
|
+
let grouped = groupVariables(node.arguments, fieldName, fields);
|
|
124
|
+
values.push(...grouped.values);
|
|
125
|
+
} else {
|
|
126
|
+
throw Error(
|
|
127
|
+
"Cannot group variables because they aren't for the same field"
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return { fieldName, values };
|
|
132
|
+
};
|
|
133
|
+
|
|
57
134
|
const AST_TO_CQL = {
|
|
58
135
|
gt: ">",
|
|
59
136
|
lt: "<",
|
|
@@ -90,8 +167,6 @@ const geospatial = (node: KueryNode) => {
|
|
|
90
167
|
console.log(fieldName, operator, value);
|
|
91
168
|
let opsine = GeospatialOperators[operator].value;
|
|
92
169
|
return `<span><span class="field-name">${fieldName.value}</span> ${opsine}<span title="${value.value}">--GEOMETRY--</span></span>`;
|
|
93
|
-
if (operator === "within") return `WITHIN(${fieldName.value},${value.value})`;
|
|
94
|
-
throw Error(`Unsupported GEO Operator:${operator}`);
|
|
95
170
|
};
|
|
96
171
|
export const functions = {
|
|
97
172
|
is,
|
|
@@ -258,6 +258,7 @@ export class SpectricTableElement<T = any>
|
|
|
258
258
|
);
|
|
259
259
|
if (index !== -1) {
|
|
260
260
|
this.columns[index] = { ...this.selectColumnConfig };
|
|
261
|
+
this.columns = [...this.columns];
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
setSelected(selected: T[]) {
|
|
@@ -268,13 +269,11 @@ export class SpectricTableElement<T = any>
|
|
|
268
269
|
return this.selected;
|
|
269
270
|
}
|
|
270
271
|
deselectAll() {
|
|
271
|
-
this.
|
|
272
|
-
this.forceRefreshofSelectionColumn();
|
|
272
|
+
this.setSelected([]);
|
|
273
273
|
this.dispatchEvent(new CustomEvent("selected", { detail: this.selected }));
|
|
274
274
|
}
|
|
275
275
|
selectAll() {
|
|
276
|
-
this.
|
|
277
|
-
this.forceRefreshofSelectionColumn();
|
|
276
|
+
this.setSelected([...this.data]);
|
|
278
277
|
this.dispatchEvent(new CustomEvent("selected", { detail: this.selected }));
|
|
279
278
|
}
|
|
280
279
|
async scrollToRow(row: T | number) {
|
|
@@ -337,11 +336,14 @@ export class SpectricTableElement<T = any>
|
|
|
337
336
|
allowResize: false,
|
|
338
337
|
filterable: false,
|
|
339
338
|
width: 39,
|
|
340
|
-
title: (table) => {
|
|
341
|
-
return table.select ===
|
|
339
|
+
title: (table: SpectricTableElement<T>) => {
|
|
340
|
+
return table.select === TableSelectOptions.multi
|
|
342
341
|
? html`<spectric-input
|
|
343
342
|
variant="checkbox"
|
|
344
343
|
@change=${table._handleSelectAllChange}
|
|
344
|
+
${spreadProps({
|
|
345
|
+
checked: table.selected.length === table.data.length,
|
|
346
|
+
})}
|
|
345
347
|
.helperText=${"Select All"}
|
|
346
348
|
></spectric-input>`
|
|
347
349
|
: null;
|
|
@@ -366,10 +368,10 @@ export class SpectricTableElement<T = any>
|
|
|
366
368
|
if (e.target.checked) {
|
|
367
369
|
if (table.select === "single") {
|
|
368
370
|
table.selected = [];
|
|
369
|
-
table.forceRefreshofSelectionColumn();
|
|
370
371
|
}
|
|
371
372
|
table.selected.push(row);
|
|
372
373
|
}
|
|
374
|
+
table.setSelected([...table.selected]);
|
|
373
375
|
table.dispatchEvent(
|
|
374
376
|
new CustomEvent("selected", { detail: [...table.selected] })
|
|
375
377
|
);
|
|
@@ -395,10 +397,29 @@ export class SpectricTableElement<T = any>
|
|
|
395
397
|
}
|
|
396
398
|
}
|
|
397
399
|
if (changedProperties.has("select")) {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
+
let selectIndex = this.columns.findIndex(
|
|
401
|
+
(col) => col[TABLE_CREATED_SELECTION_COLUMN]
|
|
402
|
+
);
|
|
403
|
+
if (this.select !== TableSelectOptions.none) {
|
|
404
|
+
this.forceRefreshofSelectionColumn();
|
|
405
|
+
if (!this.columns.find((col) => col[TABLE_CREATED_SELECTION_COLUMN])) {
|
|
406
|
+
this.columns.unshift(this.selectColumnConfig);
|
|
407
|
+
this.columns = [...this.columns];
|
|
408
|
+
}
|
|
409
|
+
} else {
|
|
410
|
+
if (selectIndex !== -1) {
|
|
411
|
+
this.columns.splice(selectIndex, 1);
|
|
412
|
+
this.columns = [...this.columns];
|
|
413
|
+
this.setSelected([]);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (
|
|
417
|
+
this.select === TableSelectOptions.single &&
|
|
418
|
+
this.selected.length > 1
|
|
419
|
+
) {
|
|
420
|
+
this.setSelected([this.selected[0]]);
|
|
400
421
|
this.dispatchEvent(
|
|
401
|
-
new CustomEvent("selected", { detail: [
|
|
422
|
+
new CustomEvent("selected", { detail: [this.selected[0]] })
|
|
402
423
|
);
|
|
403
424
|
}
|
|
404
425
|
}
|