@spectric/ui 0.0.20 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/components/Banner.d.ts +1 -1
  2. package/dist/components/dialog/dialog.d.ts +2 -1
  3. package/dist/components/pagination/pagination.d.ts +1 -1
  4. package/dist/components/query_bar/QueryBar.d.ts +31 -11
  5. package/dist/components/query_bar/dateTimePopup.d.ts +2 -0
  6. package/dist/components/query_bar/geojsonPopup.d.ts +2 -0
  7. package/dist/components/query_bar/querylanguage/kuery/functions/geospatial.d.ts +19 -0
  8. package/dist/components/query_bar/querylanguage/outputTypes/toCQL.d.ts +2 -1
  9. package/dist/components/query_bar/querylanguage/outputTypes/toMongo.d.ts +6 -1
  10. package/dist/components/symbols.d.ts +6 -0
  11. package/dist/components/table/cell.d.ts +2 -2
  12. package/dist/components/table/header.d.ts +2 -1
  13. package/dist/components/table/table.d.ts +14 -7
  14. package/dist/custom-elements.json +8 -8
  15. package/dist/index.d.ts +4 -0
  16. package/dist/index.es.js +4556 -2834
  17. package/dist/index.es.js.map +1 -1
  18. package/dist/index.umd.js +424 -248
  19. package/dist/index.umd.js.map +1 -1
  20. package/dist/style.css +1 -1
  21. package/package.json +6 -1
  22. package/src/components/Banner.ts +46 -31
  23. package/src/components/dialog/dialog.css.ts +29 -29
  24. package/src/components/dialog/dialog.ts +165 -135
  25. package/src/components/input.ts +49 -39
  26. package/src/components/pagination/pagination.ts +167 -113
  27. package/src/components/query_bar/QueryBar.ts +441 -185
  28. package/src/components/query_bar/dateTimePopup.ts +54 -0
  29. package/src/components/query_bar/geojsonPopup.ts +44 -0
  30. package/src/components/query_bar/querylanguage/kuery/ast/_generated_/kuery.js +1836 -2745
  31. package/src/components/query_bar/querylanguage/kuery/ast/ast.ts +15 -13
  32. package/src/components/query_bar/querylanguage/kuery/ast/kuery.peg +92 -126
  33. package/src/components/query_bar/querylanguage/kuery/functions/geospatial.ts +25 -0
  34. package/src/components/query_bar/querylanguage/kuery/functions/index.ts +9 -7
  35. package/src/components/query_bar/querylanguage/outputTypes/toCQL.ts +56 -34
  36. package/src/components/query_bar/querylanguage/outputTypes/toMongo.ts +46 -34
  37. package/src/components/symbols.ts +6 -0
  38. package/src/components/table/__tests__/table.spec.ts +143 -55
  39. package/src/components/table/cell.ts +188 -145
  40. package/src/components/table/header.ts +163 -152
  41. package/src/components/table/table.css +4 -2
  42. package/src/components/table/table.ts +415 -262
  43. package/src/components/table/virtualBody.ts +170 -115
  44. package/src/components/tooltip/popover.ts +263 -225
  45. package/src/stories/Dialog.stories.ts +59 -0
  46. package/src/stories/QueryBar.stories.ts +46 -37
  47. package/src/stories/fixtures/data.ts +195 -36
  48. package/src/stories/table.stories.ts +70 -22
@@ -0,0 +1,54 @@
1
+ import { html } from "lit";
2
+ import { DialogElement } from "../dialog/dialog";
3
+ import { createRef, ref } from "lit/directives/ref.js";
4
+ import { SpectricButton } from "../Button";
5
+ import { LabelValuesOrStrings, toLabelValue } from "./QueryBar";
6
+
7
+ export const DateTimePopup = async (values: LabelValuesOrStrings) => {
8
+ let value: string | undefined;
9
+ let buttonRef = createRef<SpectricButton>();
10
+
11
+ await new Promise((resolve) => {
12
+ let dialog = DialogElement.display(
13
+ {},
14
+ html`
15
+ <div class="query-bar-date-quick-select">
16
+ ${values.map((v) => {
17
+ let labelValue = toLabelValue(v);
18
+ return html`<a
19
+ href="#"
20
+ @click=${(e: MouseEvent) => {
21
+ e.preventDefault();
22
+ value = `"${labelValue.label}"`;
23
+ resolve(value);
24
+ dialog.open = false;
25
+ }}
26
+ >${labelValue.value}</a
27
+ >`;
28
+ })}
29
+ </div>
30
+ <spectric-input
31
+ variant="datetime-local"
32
+ @change=${(e: any) => {
33
+ if (!e.target) {
34
+ return;
35
+ }
36
+ let date = new Date(e.target.value + ":00.000Z").toISOString();
37
+ value = `"${date}"`;
38
+ buttonRef.value!.disabled = value === undefined;
39
+ }}
40
+ ></spectric-input>
41
+ <spectric-button
42
+ ${ref(buttonRef)}
43
+ .disabled=${true}
44
+ @click=${() => {
45
+ resolve(value);
46
+ dialog.open = false;
47
+ }}
48
+ >Submit</spectric-button
49
+ >
50
+ `
51
+ );
52
+ });
53
+ return value;
54
+ };
@@ -0,0 +1,44 @@
1
+ import { html } from "lit";
2
+ import { DialogElement } from "../dialog/dialog";
3
+ import { createRef, ref } from "lit/directives/ref.js";
4
+ import { SpectricButton } from "../Button";
5
+ import { LabelValuesOrStrings, toLabelValue } from "./QueryBar";
6
+
7
+ export const GeoJSONPopup = async (values: LabelValuesOrStrings) => {
8
+ let value: string | undefined;
9
+ let buttonRef = createRef<SpectricButton>();
10
+
11
+ await new Promise((resolve) => {
12
+ let dialog = DialogElement.display(
13
+ {},
14
+ html`
15
+ <div class="query-bar-date-quick-select">
16
+ ${values.map((v) => {
17
+ let labelValue = toLabelValue(v);
18
+ return html`<a
19
+ href="#"
20
+ @click=${(e: MouseEvent) => {
21
+ e.preventDefault();
22
+ value = `"${labelValue.value}"`;
23
+ resolve(value);
24
+ dialog.open = false;
25
+ }}
26
+ >${labelValue.label}</a
27
+ >`;
28
+ })}
29
+ </div>
30
+ <div>TODO DISPLAY MAP with drawing tools HERE!!</div>
31
+ <spectric-button
32
+ ${ref(buttonRef)}
33
+ .disabled=${true}
34
+ @click=${() => {
35
+ resolve(value);
36
+ dialog.open = false;
37
+ }}
38
+ >Submit</spectric-button
39
+ >
40
+ `
41
+ );
42
+ });
43
+ return value;
44
+ };