@web-atoms/web-controls 2.3.137 → 2.3.138

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 (131) hide show
  1. package/dist/basic/AtomChips.d.ts.map +1 -1
  2. package/dist/basic/AtomChips.js.map +1 -1
  3. package/dist/basic/AtomRepeater.d.ts.map +1 -1
  4. package/dist/basic/AtomRepeater.js.map +1 -1
  5. package/dist/basic/AtomSuggestions.d.ts.map +1 -1
  6. package/dist/basic/AtomSuggestions.js.map +1 -1
  7. package/dist/basic/Button.d.ts.map +1 -1
  8. package/dist/basic/Button.js +41 -10
  9. package/dist/basic/Button.js.map +1 -1
  10. package/dist/basic/Calendar.d.ts.map +1 -1
  11. package/dist/basic/Calendar.js.map +1 -1
  12. package/dist/basic/CheckBoxList.d.ts.map +1 -1
  13. package/dist/basic/CheckBoxList.js.map +1 -1
  14. package/dist/basic/Checkbox.d.ts.map +1 -1
  15. package/dist/basic/Checkbox.js.map +1 -1
  16. package/dist/basic/Chip.d.ts.map +1 -1
  17. package/dist/basic/Chip.js.map +1 -1
  18. package/dist/basic/DataGrid.d.ts.map +1 -1
  19. package/dist/basic/DataGrid.js.map +1 -1
  20. package/dist/basic/DateField.d.ts.map +1 -1
  21. package/dist/basic/DateField.js.map +1 -1
  22. package/dist/basic/DropDown.d.ts.map +1 -1
  23. package/dist/basic/DropDown.js.map +1 -1
  24. package/dist/basic/Expander.d.ts.map +1 -1
  25. package/dist/basic/Expander.js.map +1 -1
  26. package/dist/basic/FormField.d.ts.map +1 -1
  27. package/dist/basic/FormField.js.map +1 -1
  28. package/dist/basic/InlinePopup.d.ts.map +1 -1
  29. package/dist/basic/InlinePopup.js.map +1 -1
  30. package/dist/basic/InlinePopupControl.d.ts.map +1 -1
  31. package/dist/basic/InlinePopupControl.js.map +1 -1
  32. package/dist/basic/MaskedInput.d.ts.map +1 -1
  33. package/dist/basic/MaskedInput.js.map +1 -1
  34. package/dist/basic/PopupButton.d.ts.map +1 -1
  35. package/dist/basic/PopupButton.js.map +1 -1
  36. package/dist/basic/RadioButtonList.d.ts.map +1 -1
  37. package/dist/basic/RadioButtonList.js.map +1 -1
  38. package/dist/basic/Swipe.d.ts.map +1 -1
  39. package/dist/basic/Swipe.js.map +1 -1
  40. package/dist/basic/Switch.d.ts.map +1 -1
  41. package/dist/basic/Switch.js.map +1 -1
  42. package/dist/basic/TableRepeater.d.ts.map +1 -1
  43. package/dist/basic/TableRepeater.js.map +1 -1
  44. package/dist/basic/TitleEditor.d.ts.map +1 -1
  45. package/dist/basic/TitleEditor.js.map +1 -1
  46. package/dist/basic/ToggleButtonBar.d.ts.map +1 -1
  47. package/dist/basic/ToggleButtonBar.js.map +1 -1
  48. package/dist/basic/Tooltip.d.ts.map +1 -1
  49. package/dist/basic/Tooltip.js.map +1 -1
  50. package/dist/button-bar/AtomButtonBar.d.ts.map +1 -1
  51. package/dist/button-bar/AtomButtonBar.js +29 -12
  52. package/dist/button-bar/AtomButtonBar.js.map +1 -1
  53. package/dist/desktop-app/DesktopApp.d.ts.map +1 -1
  54. package/dist/desktop-app/DesktopApp.js +58 -9
  55. package/dist/desktop-app/DesktopApp.js.map +1 -1
  56. package/dist/html-editor/AtomHtmlEditor.d.ts +1 -2
  57. package/dist/html-editor/AtomHtmlEditor.d.ts.map +1 -1
  58. package/dist/html-editor/AtomHtmlEditor.js +69 -11
  59. package/dist/html-editor/AtomHtmlEditor.js.map +1 -1
  60. package/dist/html-editor/commands/AddLink.d.ts.map +1 -1
  61. package/dist/html-editor/commands/AddLink.js +9 -7
  62. package/dist/html-editor/commands/AddLink.js.map +1 -1
  63. package/dist/html-editor/commands/ChangeColor.d.ts.map +1 -1
  64. package/dist/html-editor/commands/ChangeColor.js +28 -7
  65. package/dist/html-editor/commands/ChangeColor.js.map +1 -1
  66. package/dist/html-editor/commands/ChangeFont.d.ts.map +1 -1
  67. package/dist/html-editor/commands/ChangeFont.js +8 -7
  68. package/dist/html-editor/commands/ChangeFont.js.map +1 -1
  69. package/dist/html-editor/commands/Separator.d.ts.map +1 -1
  70. package/dist/html-editor/commands/Separator.js +14 -10
  71. package/dist/html-editor/commands/Separator.js.map +1 -1
  72. package/dist/html-editor/commands/Source.d.ts.map +1 -1
  73. package/dist/html-editor/commands/Source.js +10 -7
  74. package/dist/html-editor/commands/Source.js.map +1 -1
  75. package/dist/mobile-app/MobileApp.d.ts.map +1 -1
  76. package/dist/mobile-app/MobileApp.js.map +1 -1
  77. package/dist/player/AtomVideoPlayer.d.ts.map +1 -1
  78. package/dist/player/AtomVideoPlayer.js.map +1 -1
  79. package/dist/player/TrackProgress.d.ts.map +1 -1
  80. package/dist/player/TrackProgress.js +12 -7
  81. package/dist/player/TrackProgress.js.map +1 -1
  82. package/dist/toggle-view/AtomToggleView.d.ts.map +1 -1
  83. package/dist/toggle-view/AtomToggleView.js.map +1 -1
  84. package/dist/tsconfig.tsbuildinfo +1 -1
  85. package/package.json +1 -1
  86. package/src/basic/AtomChips.tsx +0 -7
  87. package/src/basic/AtomRepeater.tsx +0 -4
  88. package/src/basic/AtomSuggestions.tsx +0 -2
  89. package/src/basic/Button.tsx +37 -38
  90. package/src/basic/Calendar.tsx +0 -4
  91. package/src/basic/CheckBoxList.tsx +0 -25
  92. package/src/basic/Checkbox.tsx +0 -3
  93. package/src/basic/Chip.tsx +0 -3
  94. package/src/basic/DataGrid.tsx +0 -35
  95. package/src/basic/DateField.tsx +0 -7
  96. package/src/basic/DropDown.tsx +0 -6
  97. package/src/basic/Expander.tsx +0 -5
  98. package/src/basic/FormField.tsx +1 -6
  99. package/src/basic/InlinePopup.tsx +0 -16
  100. package/src/basic/InlinePopupControl.tsx +1 -4
  101. package/src/basic/MaskedInput.tsx +0 -2
  102. package/src/basic/PopupButton.tsx +1 -3
  103. package/src/basic/RadioButtonList.tsx +0 -6
  104. package/src/basic/Swipe.tsx +0 -2
  105. package/src/basic/Switch.tsx +0 -2
  106. package/src/basic/TableRepeater.tsx +1 -4
  107. package/src/basic/TitleEditor.tsx +0 -3
  108. package/src/basic/ToggleButtonBar.tsx +0 -3
  109. package/src/basic/Tooltip.tsx +2 -6
  110. package/src/button-bar/AtomButtonBar.tsx +26 -24
  111. package/src/desktop-app/DesktopApp.tsx +55 -49
  112. package/src/html-editor/AtomHtmlEditor.tsx +67 -50
  113. package/src/html-editor/commands/AddLink.tsx +6 -8
  114. package/src/html-editor/commands/ChangeColor.tsx +25 -23
  115. package/src/html-editor/commands/ChangeFont.tsx +5 -17
  116. package/src/html-editor/commands/Separator.tsx +10 -12
  117. package/src/html-editor/commands/Source.tsx +7 -8
  118. package/src/mobile-app/MobileApp.tsx +4 -27
  119. package/src/player/AtomVideoPlayer.tsx +0 -3
  120. package/src/player/TrackProgress.tsx +9 -10
  121. package/src/toggle-view/AtomToggleView.tsx +0 -4
  122. package/dist/basic/OldForm.d.ts +0 -79
  123. package/dist/basic/OldForm.d.ts.map +0 -1
  124. package/dist/basic/OldForm.js +0 -318
  125. package/dist/basic/OldForm.js.map +0 -1
  126. package/dist/basic/in-built/InBuiltStyles.d.ts +0 -34
  127. package/dist/basic/in-built/InBuiltStyles.d.ts.map +0 -1
  128. package/dist/basic/in-built/InBuiltStyles.js +0 -49
  129. package/dist/basic/in-built/InBuiltStyles.js.map +0 -1
  130. package/src/basic/OldForm.tsx +0 -424
  131. package/src/basic/in-built/InBuiltStyles.ts +0 -41
@@ -1,9 +1,8 @@
1
1
  import Bind from "@web-atoms/core/dist/core/Bind";
2
2
  import XNode from "@web-atoms/core/dist/core/XNode";
3
- import StyleRule from "@web-atoms/core/dist/style/StyleRule";
4
- import CSS from "@web-atoms/core/dist/web/styles/CSS";
5
3
  import PopupButton from "../../basic/PopupButton";
6
4
  import type AtomHtmlEditor from "../AtomHtmlEditor";
5
+ import styled from "@web-atoms/core/dist/style/styled";
7
6
 
8
7
  const gray = [
9
8
  "rgb(0,0,0)",
@@ -90,27 +89,30 @@ const all = [
90
89
  ]
91
90
  ];
92
91
 
93
- const colorSelectorCss = CSS(StyleRule("color-selector")
94
- .width(400)
95
- .display("flex")
96
- .justifyContent("space-evenly" as any)
97
- .child(StyleRule("table")
98
- .display("inline-table")
99
- )
100
- .nested(StyleRule(".color-button")
101
- .display("inline-block")
102
- .width(20)
103
- .height(20)
104
- .borderWidth(1)
105
- .margin(1)
106
- .cursor("pointer")
107
- .borderStyle("solid")
108
- .borderColor("transparent")
109
- .hover(StyleRule()
110
- .borderColor("black")
111
- )
112
- )
113
- );
92
+ const colorSelectorCss = styled.css `
93
+
94
+ width: 400px;
95
+ display: flex;
96
+ justify-content: space-evenly;
97
+
98
+ & > table {
99
+ display: inline-table;
100
+ }
101
+
102
+ & .color-button {
103
+ display: inline-block;
104
+ width: 20px;
105
+ height: 20px;
106
+ border-width: 1px;
107
+ margin: 1px;
108
+ cursor: pointer;
109
+ border-style: solid;
110
+ border-color: transparent;
111
+ &:hover {
112
+ border-color: black;
113
+ }
114
+ }
115
+ `.installLocal();
114
116
 
115
117
  function TextColor(color: string) {
116
118
  return <div
@@ -1,25 +1,13 @@
1
1
  import Bind from "@web-atoms/core/dist/core/Bind";
2
- import Colors from "@web-atoms/core/dist/core/Colors";
3
2
  import XNode from "@web-atoms/core/dist/core/XNode";
4
- import StyleRule from "@web-atoms/core/dist/style/StyleRule";
5
- import CSS from "@web-atoms/core/dist/web/styles/CSS";
6
3
  import PopupButton, { MenuItem } from "../../basic/PopupButton";
7
4
  import type AtomHtmlEditor from "../AtomHtmlEditor";
5
+ import styled from "@web-atoms/core/dist/style/styled";
8
6
 
9
- const fontMenuCSS = CSS(StyleRule()
10
- .padding(5)
11
- .width(170)
12
- // .child(StyleRule(".menu")
13
- // .padding(5)
14
- // .hoverBackgroundColor(Colors.lightGreen)
15
- // .child(StyleRule("i")
16
- // .opacity("0")
17
- // .and(StyleRule(".selected")
18
- // .opacity("1")
19
- // )
20
- // )
21
- // )
22
- );
7
+ const fontMenuCSS = styled.css `
8
+ padding: 5px;
9
+ width: 170px;
10
+ `.installLocal();
23
11
 
24
12
  const fonts: Array<[string, string[]]> = [
25
13
  ["Sans Serif", ["arial", "sans-serif"]],
@@ -1,17 +1,15 @@
1
- import Colors from "@web-atoms/core/dist/core/Colors";
2
1
  import XNode from "@web-atoms/core/dist/core/XNode";
3
- import StyleRule from "@web-atoms/core/dist/style/StyleRule";
4
- import CSS from "@web-atoms/core/dist/web/styles/CSS";
2
+ import styled from "@web-atoms/core/dist/style/styled";
5
3
 
6
- const separatorCss = CSS(StyleRule()
7
- .backgroundColor(Colors.darkGray)
8
- .marginLeft(4)
9
- .marginRight(4)
10
- .display("inline-block")
11
- .marginTop(4)
12
- .height(20)
13
- .width(2)
14
- );
4
+ const separatorCss = styled.css `
5
+ background-color: #a9a9a9;
6
+ margin-left: 4px;
7
+ margin-right: 4px;
8
+ display: inline-block;
9
+ margin-top: 4px;
10
+ height: 20px;
11
+ width: 2px;
12
+ `.installLocal();
15
13
 
16
14
  export default function Separator() {
17
15
  return <div class={separatorCss}></div>;
@@ -1,19 +1,18 @@
1
1
  import Bind from "@web-atoms/core/dist/core/Bind";
2
2
  import { BindableProperty } from "@web-atoms/core/dist/core/BindableProperty";
3
3
  import XNode from "@web-atoms/core/dist/core/XNode";
4
- import StyleRule from "@web-atoms/core/dist/style/StyleRule";
5
4
  import PopupService, { PopupWindow } from "@web-atoms/core/dist/web/services/PopupService";
6
- import CSS from "@web-atoms/core/dist/web/styles/CSS";
7
5
  import type AtomHtmlEditor from "../AtomHtmlEditor";
8
6
  import CommandButton from "./CommandButton";
9
7
  import HtmlCommands from "./HtmlCommands";
8
+ import styled from "@web-atoms/core/dist/style/styled";
10
9
 
11
- const css = CSS(StyleRule()
12
- .child(StyleRule("textarea")
13
- .minHeight(500)
14
- .minWidth(700)
15
- )
16
- );
10
+ const css = styled.css `
11
+ & > textarea {
12
+ min-height: 500px;
13
+ min-width: 700px;
14
+ }
15
+ `.installLocal();
17
16
 
18
17
  async function showDialog(s: AtomHtmlEditor, e: Event): Promise<string> {
19
18
 
@@ -3,17 +3,14 @@ import { AtomLoader } from "@web-atoms/core/dist/core/AtomLoader";
3
3
  import { AtomUri } from "@web-atoms/core/dist/core/AtomUri";
4
4
  import Bind from "@web-atoms/core/dist/core/Bind";
5
5
  import { BindableProperty } from "@web-atoms/core/dist/core/BindableProperty";
6
- import Colors from "@web-atoms/core/dist/core/Colors";
7
6
  import sleep from "@web-atoms/core/dist/core/sleep";
8
- import { CancelToken, IClassOf, IDisposable } from "@web-atoms/core/dist/core/types";
7
+ import { IDisposable } from "@web-atoms/core/dist/core/types";
9
8
  import XNode from "@web-atoms/core/dist/core/XNode";
10
- import { IPageOptions, NavigationService } from "@web-atoms/core/dist/services/NavigationService";
11
- import StyleRule from "@web-atoms/core/dist/style/StyleRule";
9
+ import { NavigationService } from "@web-atoms/core/dist/services/NavigationService";
12
10
  import { AtomWindowViewModel } from "@web-atoms/core/dist/view-model/AtomWindowViewModel";
13
11
  import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
14
- import { AtomUI, ChildEnumerator } from "@web-atoms/core/dist/web/core/AtomUI";
15
- import PopupService, { IDialogOptions, IPopup, PopupControl, PopupWindow } from "@web-atoms/core/dist/web/services/PopupService";
16
- import CSS from "@web-atoms/core/dist/web/styles/CSS";
12
+ import { ChildEnumerator } from "@web-atoms/core/dist/web/core/AtomUI";
13
+ import PopupService, { IDialogOptions, PopupWindow } from "@web-atoms/core/dist/web/services/PopupService";
17
14
  import PageNavigator from "../PageNavigator";
18
15
  import { StringHelper } from "@web-atoms/core/dist/core/StringHelper";
19
16
  import styled from "@web-atoms/core/dist/style/styled";
@@ -60,26 +57,6 @@ import styled from "@web-atoms/core/dist/style/styled";
60
57
  }
61
58
 
62
59
  `.installGlobal("[data-page-app=page-app]");
63
-
64
- // CSS(StyleRule()
65
- // .absolutePosition({ left: "-80%", top: 0 })
66
- // .width("80%")
67
- // .height("100%")
68
- // .overflow("hidden")
69
- // .transition("left 0.3s ease-out")
70
- // , "div[data-drawer-page=drawer-page]");
71
-
72
-
73
- // CSS(StyleRule()
74
- // .paddingBottom(500)
75
- // , "body[data-keyboard=shown] & > [data-page-element=content]");
76
-
77
- // if (/iphone|ios/i.test(window.navigator.userAgent)) {
78
- // CSS(StyleRule()
79
- // .marginBottom(500)
80
- // , "body[data-keyboard=shown] &");
81
- // }
82
-
83
60
  styled.css `
84
61
 
85
62
  position: absolute;
@@ -1,12 +1,9 @@
1
1
  import { AtomBinder } from "@web-atoms/core/dist/core/AtomBinder";
2
2
  import Bind from "@web-atoms/core/dist/core/Bind";
3
3
  import { BindableProperty } from "@web-atoms/core/dist/core/BindableProperty";
4
- import Colors from "@web-atoms/core/dist/core/Colors";
5
4
  import XNode from "@web-atoms/core/dist/core/XNode";
6
- import StyleRule, { PlayState } from "@web-atoms/core/dist/style/StyleRule";
7
5
  import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
8
6
  import { ChildEnumerator } from "@web-atoms/core/dist/web/core/AtomUI";
9
- import CSS from "@web-atoms/core/dist/web/styles/CSS";
10
7
  import { installInputRangeStyle } from "./input-range-style";
11
8
  import styled from "@web-atoms/core/dist/style/styled";
12
9
 
@@ -1,15 +1,14 @@
1
1
  import XNode from "@web-atoms/core/dist/core/XNode";
2
- import StyleRule from "@web-atoms/core/dist/style/StyleRule";
3
- import CSS from "@web-atoms/core/dist/web/styles/CSS";
2
+ import styled from "@web-atoms/core/dist/style/styled";
4
3
 
5
- CSS(StyleRule()
6
- .height(5)
7
- .child(StyleRule("*")
8
- .position("absolute")
9
- .left(0)
10
- .top(0)
11
- )
12
- , "*[data-track-progress=track-progress]");
4
+ styled.css `
5
+ height: 5px;
6
+ & > * {
7
+ position: absolute;
8
+ left: 0;
9
+ top: 0;
10
+ }
11
+ `.installGlobal("*[data-track-progress=track-progress]");
13
12
 
14
13
  export default function TrackProgress(a) {
15
14
  return <div
@@ -1,10 +1,6 @@
1
- import Bind from "@web-atoms/core/dist/core/Bind";
2
1
  import { BindableProperty } from "@web-atoms/core/dist/core/BindableProperty";
3
- import Colors from "@web-atoms/core/dist/core/Colors";
4
2
  import XNode from "@web-atoms/core/dist/core/XNode";
5
- import StyleRule from "@web-atoms/core/dist/style/StyleRule";
6
3
  import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
7
- import CSS from "@web-atoms/core/dist/web/styles/CSS";
8
4
 
9
5
  import "../basic/styles/toggle-view-style";
10
6
  import IElement from "../basic/IElement";
@@ -1,79 +0,0 @@
1
- import Command from "@web-atoms/core/dist/core/Command";
2
- import XNode from "@web-atoms/core/dist/core/XNode";
3
- import IElement from "./IElement";
4
- import ToggleButtonBar from "./ToggleButtonBar";
5
- export declare const FormButtonBar: typeof ToggleButtonBar;
6
- export interface ISubmitButton {
7
- eventClick: any;
8
- class?: string;
9
- [key: string]: any;
10
- }
11
- export interface ISubmitAction extends IElement {
12
- action: "submit";
13
- eventClick?: any;
14
- "event-click"?: any;
15
- }
16
- export interface ICancelAction extends IElement {
17
- action: "cancel";
18
- eventClick?: any;
19
- "event-click"?: any;
20
- }
21
- export type IFormAction = ISubmitAction | ICancelAction;
22
- /**
23
- * This is just a decorator, you must have a child button for this to work
24
- * @param action submit | cancel
25
- * @param node child node where action will be applied
26
- * @returns XNode
27
- */
28
- export declare function FormAction({ action, eventClick, "event-click": eventClick2, ...a }: IFormAction, node: XNode): XNode;
29
- /**
30
- * @deprecated Use Form with eventSubmit and button with data-event="submit"
31
- */
32
- export declare function SubmitAction(a: IElement, node: XNode): XNode;
33
- /**
34
- * @deprecated Use Form with eventSubmit and button with data-event="submit"
35
- */
36
- export declare function CancelAction(a: IElement, node: XNode): XNode;
37
- /**
38
- * @deprecated Use Form with eventSubmit and button with data-event="submit"
39
- */
40
- export declare function SubmitButton({ eventClick, ...others }: ISubmitButton, ...nodes: XNode[]): any;
41
- export interface IForm {
42
- id?: number;
43
- class?: any;
44
- scrollable?: boolean;
45
- /**
46
- * If set, when an enter key is pressed on
47
- * non textarea element, form will be submitted automatically
48
- */
49
- eventSubmit?: any;
50
- /**
51
- * By default it is true, when user presses enter button on an input
52
- * the focus will move on to the next input element
53
- */
54
- focusNextOnEnter?: boolean;
55
- [key: string]: any;
56
- submitCommand?: Command;
57
- }
58
- export interface IFormGroup {
59
- group: string;
60
- }
61
- export declare function FormGroup(fg: IFormGroup, ...nodes: XNode[]): any;
62
- declare function OldForm({ id, focusNextOnEnter, scrollable, eventSubmit, submitCommand, ...a }: IForm, ...nodes: XNode[]): any;
63
- declare namespace OldForm {
64
- var newId: () => number;
65
- var submitId: (id: number) => {
66
- "data-submit-form-id": string;
67
- };
68
- }
69
- export default OldForm;
70
- export interface IFormLayout extends IForm {
71
- header?: XNode;
72
- footer?: XNode;
73
- }
74
- export declare function FormLayout({ id, focusNextOnEnter, scrollable, eventSubmit, header, footer, ...a }: IFormLayout, ...nodes: XNode[]): any;
75
- export declare namespace FormLayout {
76
- var Footer: ({}: {}, child: XNode) => XNode;
77
- var Header: ({}: {}, child: XNode) => XNode;
78
- }
79
- //# sourceMappingURL=OldForm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OldForm.d.ts","sourceRoot":"","sources":["../../src/basic/OldForm.tsx"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,mCAAmC,CAAC;AACxD,OAAO,KAAK,MAAM,iCAAiC,CAAC;AAKpD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,eAAO,MAAM,aAAa,wBAAkB,CAAC;AAe7C,MAAM,WAAW,aAAa;IAC1B,UAAU,EAAE,GAAG,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC3C,MAAM,EAAE,QAAQ,CAAC;IACjB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,GAAG,CAAC;CACvB;AAED,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC3C,MAAM,EAAE,QAAQ,CAAC;IACjB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,GAAG,CAAC;CACvB;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,aAAa,CAAC;AAExD;;;;;GAKG;AACH,wBAAgB,UAAU,CACtB,EACI,MAAiB,EACjB,UAAU,EACV,aAAa,EAAE,WAAW,EAC1B,GAAI,CAAC,EACR,EAAE,WAAW,EACd,IAAI,EAAE,KAAK,SAed;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,SAGpD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,SAGpD;AAED;;GAEG;AACH,wBAAgB,YAAY,CACxB,EAAE,UAAU,EACR,GAAI,MAAM,EAAC,EAAE,aAAa,EAC9B,GAAI,KAAK,EAAE,KAAK,EAAE,OAIrB;AAmHD,MAAM,WAAW,KAAK;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAE;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAMD,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;CAGjB;AAED,wBAAgB,SAAS,CACrB,EAAE,EAAE,UAAU,EACd,GAAI,KAAK,EAAE,KAAK,EAAE,OAOrB;AAED,iBAAwB,OAAO,CAC3B,EACI,EAAa,EACb,gBAAuB,EACvB,UAAU,EACV,WAAW,EACX,aAAa,EACb,GAAI,CAAC,EACR,EAAE,KAAK,EACR,GAAI,KAAK,EAAE,KAAK,EAAE,OAoCrB;kBA7CuB,OAAO;;;;;;eAAP,OAAO;AA+C/B,MAAM,WAAW,WAAY,SAAQ,KAAK;IACtC,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;CAClB;AA0BD,wBAAgB,UAAU,CACtB,EACI,EAAa,EACb,gBAAuB,EACvB,UAAU,EACV,WAAW,EACX,MAAM,EACN,MAAM,EACN,GAAI,CAAC,EACR,EAAE,WAAW,EACd,GAAI,KAAK,EAAE,KAAK,EAAE,OAkErB;yBA5Ee,UAAU"}
@@ -1,318 +0,0 @@
1
- System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/style/StyleRule", "@web-atoms/core/dist/web/styles/CSS", "./ToggleButtonBar"], function (_export, _context) {
2
- "use strict";
3
-
4
- var __rest, XNode, StyleRule, CSS, ToggleButtonBar, FormButtonBar, css, submitFormHandler, checkValidity, moveNext, formId, formGroupSymbol, elementType;
5
- function FormAction(_a, node) {
6
- var _b;
7
- var {
8
- action = "submit",
9
- eventClick,
10
- "event-click": eventClick2
11
- } = _a,
12
- a = __rest(_a, ["action", "eventClick", "event-click"]);
13
- const attributes = (_b = node.attributes) !== null && _b !== void 0 ? _b : node.attributes = {};
14
- attributes["data-wa-form-action"] = action;
15
- const e = attributes["event-click"] || attributes.eventClick;
16
- if (e) {
17
- attributes["event-submit"] = e;
18
- delete attributes["event-click"];
19
- delete attributes.eventClick;
20
- }
21
- eventClick !== null && eventClick !== void 0 ? eventClick : eventClick = eventClick2;
22
- if (action === "submit" && eventClick) {
23
- attributes.eventSubmit = eventClick;
24
- }
25
- node.attributes = Object.assign(Object.assign({}, a), attributes);
26
- return node;
27
- }
28
- function SubmitAction(a, node) {
29
- a.action = "submit";
30
- return FormAction(a, node);
31
- }
32
- function CancelAction(a, node) {
33
- a.action = "cancel";
34
- return FormAction(a, node);
35
- }
36
- function SubmitButton(_a, ...nodes) {
37
- var {
38
- eventClick
39
- } = _a,
40
- others = __rest(_a, ["eventClick"]);
41
- return XNode.create("button", Object.assign({
42
- "data-wa-form-action": "submit",
43
- eventSubmit: eventClick
44
- }, others), ...nodes);
45
- }
46
- function findSubmitAction(e) {
47
- var _a;
48
- let button = e.target;
49
- if (e.type === "submit") {
50
- e.preventDefault();
51
- button = e.submitter;
52
- }
53
- while (button) {
54
- const action = (_a = button.dataset.waFormAction) !== null && _a !== void 0 ? _a : button.dataset.event;
55
- if (/submit|cancel/i.test(action)) {
56
- return {
57
- button,
58
- action
59
- };
60
- }
61
- button = button.parentElement;
62
- }
63
- return {
64
- button
65
- };
66
- }
67
- function FormGroup(fg, ...nodes) {
68
- fg[formGroupSymbol] = true;
69
- return XNode.create("div", Object.assign({}, fg), ...nodes);
70
- }
71
- function OldForm(_a, ...nodes) {
72
- var _b;
73
- var {
74
- id = formId++,
75
- focusNextOnEnter = true,
76
- scrollable,
77
- eventSubmit,
78
- submitCommand
79
- } = _a,
80
- a = __rest(_a, ["id", "focusNextOnEnter", "scrollable", "eventSubmit", "submitCommand"]);
81
- if (focusNextOnEnter) {
82
- a.eventKeypress = moveNext(eventSubmit);
83
- }
84
- a["data-form-id"] = id;
85
- a["data-scrollable"] = !!scrollable;
86
- if (!eventSubmit) {
87
- a["data-wa-show-errors"] = "yes";
88
- }
89
- if (submitCommand) {
90
- a["event-" + submitCommand.name] = checkValidity(eventSubmit);
91
- }
92
- const fields = [];
93
- for (const iterator of nodes) {
94
- if (!iterator) {
95
- continue;
96
- }
97
- const ca = iterator.attributes;
98
- if (ca === null || ca === void 0 ? void 0 : ca[formGroupSymbol]) {
99
- for (const child of iterator.children) {
100
- const cha = (_b = child.attributes) !== null && _b !== void 0 ? _b : child.attributes = {};
101
- cha["data-group"] = ca.group;
102
- fields.push(child);
103
- }
104
- continue;
105
- }
106
- fields.push(iterator);
107
- }
108
- return XNode.create("div", Object.assign({
109
- "data-wa-form": "wa-form"
110
- }, a, {
111
- eventSubmitForm: eventSubmit,
112
- eventClick: checkValidity(eventSubmit)
113
- }), ...fields);
114
- }
115
- function FormLayout(_a, ...nodes) {
116
- var _b, _c, _d;
117
- var {
118
- id = formId++,
119
- focusNextOnEnter = true,
120
- scrollable,
121
- eventSubmit,
122
- header,
123
- footer
124
- } = _a,
125
- a = __rest(_a, ["id", "focusNextOnEnter", "scrollable", "eventSubmit", "header", "footer"]);
126
- if (focusNextOnEnter) {
127
- a.eventKeypress = moveNext(eventSubmit);
128
- }
129
- a["data-form-id"] = id;
130
- a["data-scrollable"] = !!scrollable;
131
- if (!eventSubmit) {
132
- a["data-wa-show-errors"] = "yes";
133
- }
134
- const fields = [];
135
- for (const iterator of nodes) {
136
- if (!iterator) {
137
- continue;
138
- }
139
- const et = iterator[elementType];
140
- if (et !== void 0) {
141
- if (et === "header") {
142
- header = iterator;
143
- delete iterator[elementType];
144
- continue;
145
- }
146
- if (et === "footer") {
147
- footer = iterator;
148
- delete iterator[elementType];
149
- continue;
150
- }
151
- }
152
- const ca = iterator.attributes;
153
- if (ca === null || ca === void 0 ? void 0 : ca[formGroupSymbol]) {
154
- for (const child of iterator.children) {
155
- const cha = (_b = child.attributes) !== null && _b !== void 0 ? _b : child.attributes = {};
156
- cha["data-group"] = ca.group;
157
- fields.push(child);
158
- }
159
- continue;
160
- }
161
- fields.push(iterator);
162
- }
163
- if (header) {
164
- const ha = (_c = header.attributes) !== null && _c !== void 0 ? _c : header.attributes = {};
165
- ha["data-element"] = "header";
166
- }
167
- if (footer) {
168
- const ha = (_d = footer.attributes) !== null && _d !== void 0 ? _d : footer.attributes = {};
169
- ha["data-element"] = "footer";
170
- }
171
- return XNode.create("div", Object.assign({
172
- "data-wa-form": "wa-form",
173
- "data-form-layout": "form-layout"
174
- }, a, {
175
- eventSubmitForm: eventSubmit,
176
- eventClick: checkValidity(eventSubmit)
177
- }), header, XNode.create("div", {
178
- "data-element": "content"
179
- }, XNode.create("div", null, ...fields)), footer);
180
- }
181
- _export({
182
- FormAction: FormAction,
183
- SubmitAction: SubmitAction,
184
- CancelAction: CancelAction,
185
- SubmitButton: SubmitButton,
186
- FormGroup: FormGroup,
187
- default: OldForm,
188
- FormLayout: FormLayout
189
- });
190
- return {
191
- setters: [function (_tslib) {
192
- __rest = _tslib.__rest;
193
- }, function (_webAtomsCoreDistCoreXNode) {
194
- XNode = _webAtomsCoreDistCoreXNode.default;
195
- }, function (_webAtomsCoreDistStyleStyleRule) {
196
- StyleRule = _webAtomsCoreDistStyleStyleRule.default;
197
- }, function (_webAtomsCoreDistWebStylesCSS) {
198
- CSS = _webAtomsCoreDistWebStylesCSS.default;
199
- }, function (_ToggleButtonBar) {
200
- ToggleButtonBar = _ToggleButtonBar.default;
201
- }],
202
- execute: function () {
203
- _export("FormButtonBar", FormButtonBar = ToggleButtonBar);
204
- css = CSS(StyleRule().verticalFlexLayout({
205
- alignItems: "stretch"
206
- }).displayNone(" .field-error:empty").displayNone(":not([data-wa-show-errors=yes]) .field-error:not(:empty)").child(StyleRule("button").alignSelf("flex-start")).and(StyleRule("[data-scrollable=true]").justifyContent("flex-start").overflow("auto")), "*[data-wa-form=wa-form]");
207
- submitFormHandler = form => {
208
- if (!form.dataset.waShowErrors) {
209
- form.dataset.waShowErrors = "yes";
210
- }
211
- setTimeout(() => {
212
- var _a, _b;
213
- const all = Array.from(form.getElementsByClassName("field-error"));
214
- for (const iterator of all) {
215
- if (iterator.textContent) {
216
- alert((_b = (_a = form.dataset) === null || _a === void 0 ? void 0 : _a.errorMessage) !== null && _b !== void 0 ? _b : "Please fix all validations");
217
- return;
218
- }
219
- }
220
- form.dispatchEvent(new CustomEvent("submitForm"));
221
- }, 100);
222
- };
223
- checkValidity = handler => e => {
224
- const form = e.currentTarget;
225
- const {
226
- button,
227
- action
228
- } = findSubmitAction(e);
229
- if (!button) {
230
- return;
231
- }
232
- if (handler) {
233
- submitFormHandler(form);
234
- return;
235
- }
236
- if (action === "cancel") {
237
- form.dataset.waShowErrors = "";
238
- return;
239
- }
240
- if (!form.dataset.waShowErrors) {
241
- form.dataset.waShowErrors = "yes";
242
- }
243
- setTimeout(() => {
244
- var _a, _b;
245
- const all = Array.from(form.getElementsByClassName("field-error"));
246
- for (const iterator of all) {
247
- if (iterator.textContent) {
248
- alert((_b = (_a = form.dataset) === null || _a === void 0 ? void 0 : _a.errorMessage) !== null && _b !== void 0 ? _b : "Please fix all validations");
249
- return;
250
- }
251
- }
252
- button.dispatchEvent(new CustomEvent("submit"));
253
- }, 100);
254
- };
255
- moveNext = handler => e => {
256
- if (!/enter|submit|return/i.test(e.key)) {
257
- return;
258
- }
259
- const element = e.target;
260
- if (!element.tagName) {
261
- return;
262
- }
263
- if (handler) {
264
- if (/^INPUT$/.test(element.tagName)) {
265
- submitFormHandler(e.currentTarget);
266
- }
267
- return;
268
- }
269
- if (element.dataset.waFormAction === "submit") {
270
- element.dispatchEvent(new MouseEvent("click"));
271
- return;
272
- }
273
- if (/input/i.test(element.tagName)) {
274
- e.preventDefault();
275
- element.dispatchEvent(new KeyboardEvent("keypress", {
276
- key: "tab"
277
- }));
278
- }
279
- };
280
- document.body.addEventListener("click", e => {
281
- let start = e.target;
282
- let id;
283
- while (start) {
284
- id = start.dataset.submitFormId;
285
- if (id) {
286
- break;
287
- }
288
- start = start.parentElement;
289
- }
290
- if (!start) {
291
- return;
292
- }
293
- const form = document.body.querySelector(`[data-form-id="${id}"]`);
294
- submitFormHandler(form);
295
- });
296
- formId = 0;
297
- formGroupSymbol = Symbol("formGroup");
298
- CSS(StyleRule().display("grid").alignSelf("stretch").justifyContent("stretch").flex("1 1 100%").gridTemplateRows("auto 1fr auto").gridTemplateColumns("1fr").child(StyleRule("[data-element=header]").gridRowStart("1")).child(StyleRule("[data-element=content]").gridRowStart("2").overflow("auto").child(StyleRule("div").verticalFlexLayout({
299
- alignItems: "stretch",
300
- gap: 10
301
- }))).child(StyleRule("[data-element=footer]").gridRowStart("3")), "*[data-form-layout=form-layout]");
302
- elementType = Symbol.for("elementType");
303
- FormLayout.Footer = ({}, child) => {
304
- child[elementType] = "footer";
305
- return child;
306
- };
307
- FormLayout.Header = ({}, child) => {
308
- child[elementType] = "header";
309
- return child;
310
- };
311
- OldForm.newId = () => formId++;
312
- OldForm.submitId = id => ({
313
- "data-submit-form-id": id.toString()
314
- });
315
- }
316
- };
317
- });
318
- //# sourceMappingURL=OldForm.js.map