@dooboostore/dom-render 1.0.98

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 (230) hide show
  1. package/DomRender.d.ts +24 -0
  2. package/DomRender.js +115 -0
  3. package/DomRenderProxy.d.ts +38 -0
  4. package/DomRenderProxy.js +586 -0
  5. package/README.MD +938 -0
  6. package/components/ComponentBase.d.ts +41 -0
  7. package/components/ComponentBase.js +210 -0
  8. package/components/ComponentSet.d.ts +22 -0
  9. package/components/ComponentSet.js +23 -0
  10. package/components/appender/Appender.d.ts +23 -0
  11. package/components/appender/Appender.js +59 -0
  12. package/components/checkbox/CheckBox.d.ts +47 -0
  13. package/components/checkbox/CheckBox.js +118 -0
  14. package/components/choose/Choose.d.ts +39 -0
  15. package/components/choose/Choose.js +110 -0
  16. package/components/details/Details.d.ts +57 -0
  17. package/components/details/Details.js +199 -0
  18. package/components/dialog/Dialog.d.ts +1 -0
  19. package/components/dialog/Dialog.js +85 -0
  20. package/components/dialog/example/ImageEditorDialog.d.ts +1 -0
  21. package/components/dialog/example/ImageEditorDialog.js +116 -0
  22. package/components/forOf/ForOf.d.ts +18 -0
  23. package/components/forOf/ForOf.js +32 -0
  24. package/components/if/If.d.ts +21 -0
  25. package/components/if/If.js +40 -0
  26. package/components/index.d.ts +27 -0
  27. package/components/index.js +13 -0
  28. package/components/input/Input.d.ts +34 -0
  29. package/components/input/Input.js +86 -0
  30. package/components/promise/PromiseSwitch.d.ts +55 -0
  31. package/components/promise/PromiseSwitch.js +181 -0
  32. package/components/radio/Radio.d.ts +45 -0
  33. package/components/radio/Radio.js +123 -0
  34. package/components/select/Select.d.ts +23 -0
  35. package/components/select/Select.js +52 -0
  36. package/components/this/This.d.ts +24 -0
  37. package/components/this/This.js +62 -0
  38. package/components/timer/Timer.d.ts +26 -0
  39. package/components/timer/Timer.js +102 -0
  40. package/configs/Config.d.ts +34 -0
  41. package/configs/Config.js +2 -0
  42. package/configs/TargetAttr.d.ts +7 -0
  43. package/configs/TargetAttr.js +2 -0
  44. package/configs/TargetElement.d.ts +16 -0
  45. package/configs/TargetElement.js +2 -0
  46. package/css/parse/index.d.ts +49 -0
  47. package/css/parse/index.js +498 -0
  48. package/css/stringify/compiler.d.ts +34 -0
  49. package/css/stringify/compiler.js +36 -0
  50. package/css/stringify/compress.d.ts +104 -0
  51. package/css/stringify/compress.js +147 -0
  52. package/css/stringify/identity.d.ts +109 -0
  53. package/css/stringify/identity.js +183 -0
  54. package/css/stringify/index.d.ts +24 -0
  55. package/css/stringify/index.js +27 -0
  56. package/css/stringify/types.d.ts +15 -0
  57. package/css/stringify/types.js +2 -0
  58. package/css/types.d.ts +10 -0
  59. package/css/types.js +2 -0
  60. package/decorators/DomRenderNoProxy.d.ts +4 -0
  61. package/decorators/DomRenderNoProxy.js +15 -0
  62. package/events/EventManager.d.ts +68 -0
  63. package/events/EventManager.js +477 -0
  64. package/index.d.ts +2 -0
  65. package/index.js +2 -0
  66. package/iterators/Range.d.ts +24 -0
  67. package/iterators/Range.js +70 -0
  68. package/lifecycle/OnBeforeReturnGet.d.ts +4 -0
  69. package/lifecycle/OnBeforeReturnGet.js +2 -0
  70. package/lifecycle/OnBeforeReturnSet.d.ts +5 -0
  71. package/lifecycle/OnBeforeReturnSet.js +4 -0
  72. package/lifecycle/OnChangeAttrRender.d.ts +9 -0
  73. package/lifecycle/OnChangeAttrRender.js +4 -0
  74. package/lifecycle/OnChildRenderedByProperty.d.ts +5 -0
  75. package/lifecycle/OnChildRenderedByProperty.js +4 -0
  76. package/lifecycle/OnCreateRender.d.ts +5 -0
  77. package/lifecycle/OnCreateRender.js +4 -0
  78. package/lifecycle/OnCreateRenderData.d.ts +10 -0
  79. package/lifecycle/OnCreateRenderData.js +4 -0
  80. package/lifecycle/OnCreateRendered.d.ts +8 -0
  81. package/lifecycle/OnCreateRendered.js +4 -0
  82. package/lifecycle/OnCreatedThisChild.d.ts +6 -0
  83. package/lifecycle/OnCreatedThisChild.js +4 -0
  84. package/lifecycle/OnDestroyRender.d.ts +9 -0
  85. package/lifecycle/OnDestroyRender.js +4 -0
  86. package/lifecycle/OnInitRender.d.ts +6 -0
  87. package/lifecycle/OnInitRender.js +4 -0
  88. package/lifecycle/OnProxyDomRender.d.ts +5 -0
  89. package/lifecycle/OnProxyDomRender.js +2 -0
  90. package/lifecycle/dr-this/OnDrThisBind.d.ts +5 -0
  91. package/lifecycle/dr-this/OnDrThisBind.js +4 -0
  92. package/lifecycle/dr-this/OnDrThisUnBind.d.ts +5 -0
  93. package/lifecycle/dr-this/OnDrThisUnBind.js +4 -0
  94. package/managers/RenderManager.d.ts +2 -0
  95. package/managers/RenderManager.js +12 -0
  96. package/messenger/DefaultMessenger.d.ts +4 -0
  97. package/messenger/DefaultMessenger.js +4 -0
  98. package/messenger/Messenger.d.ts +79 -0
  99. package/messenger/Messenger.js +185 -0
  100. package/operators/Appender.d.ts +15 -0
  101. package/operators/Appender.js +90 -0
  102. package/operators/Dr.d.ts +9 -0
  103. package/operators/Dr.js +53 -0
  104. package/operators/DrAppender.d.ts +9 -0
  105. package/operators/DrAppender.js +69 -0
  106. package/operators/DrFor.d.ts +9 -0
  107. package/operators/DrFor.js +58 -0
  108. package/operators/DrForOf.d.ts +9 -0
  109. package/operators/DrForOf.js +120 -0
  110. package/operators/DrForm.d.ts +9 -0
  111. package/operators/DrForm.js +79 -0
  112. package/operators/DrIf.d.ts +9 -0
  113. package/operators/DrIf.js +70 -0
  114. package/operators/DrInnerHTML.d.ts +9 -0
  115. package/operators/DrInnerHTML.js +48 -0
  116. package/operators/DrInnerText.d.ts +9 -0
  117. package/operators/DrInnerText.js +46 -0
  118. package/operators/DrPre.d.ts +8 -0
  119. package/operators/DrPre.js +22 -0
  120. package/operators/DrRepeat.d.ts +9 -0
  121. package/operators/DrRepeat.js +70 -0
  122. package/operators/DrStripElement.d.ts +9 -0
  123. package/operators/DrStripElement.js +50 -0
  124. package/operators/DrTargetAttr.d.ts +8 -0
  125. package/operators/DrTargetAttr.js +45 -0
  126. package/operators/DrTargetElement.d.ts +13 -0
  127. package/operators/DrTargetElement.js +91 -0
  128. package/operators/DrTargetElementIsElement.d.ts +13 -0
  129. package/operators/DrTargetElementIsElement.js +79 -0
  130. package/operators/DrThis.d.ts +7 -0
  131. package/operators/DrThis.js +72 -0
  132. package/operators/DrThisProperty.d.ts +11 -0
  133. package/operators/DrThisProperty.js +93 -0
  134. package/operators/OperatorExecuter.d.ts +50 -0
  135. package/operators/OperatorExecuter.js +50 -0
  136. package/operators/OperatorExecuterAttrRequire.d.ts +9 -0
  137. package/operators/OperatorExecuterAttrRequire.js +25 -0
  138. package/package.json +70 -0
  139. package/rawsets/AttrInitCallBack.d.ts +6 -0
  140. package/rawsets/AttrInitCallBack.js +2 -0
  141. package/rawsets/Attrs.d.ts +27 -0
  142. package/rawsets/Attrs.js +2 -0
  143. package/rawsets/CreatorMetaData.d.ts +20 -0
  144. package/rawsets/CreatorMetaData.js +2 -0
  145. package/rawsets/DestroyOptionType.d.ts +5 -0
  146. package/rawsets/DestroyOptionType.js +6 -0
  147. package/rawsets/ElementInitCallBack.d.ts +9 -0
  148. package/rawsets/ElementInitCallBack.js +2 -0
  149. package/rawsets/RawSet.d.ts +180 -0
  150. package/rawsets/RawSet.js +1450 -0
  151. package/rawsets/RawSetOperatorType.d.ts +4 -0
  152. package/rawsets/RawSetOperatorType.js +5 -0
  153. package/rawsets/RawSetType.d.ts +8 -0
  154. package/rawsets/RawSetType.js +9 -0
  155. package/rawsets/Render.d.ts +27 -0
  156. package/rawsets/Render.js +2 -0
  157. package/routers/HashRouter.d.ts +24 -0
  158. package/routers/HashRouter.js +86 -0
  159. package/routers/PathRouter.d.ts +23 -0
  160. package/routers/PathRouter.js +73 -0
  161. package/routers/Router.d.ts +68 -0
  162. package/routers/Router.js +132 -0
  163. package/types/Types.d.ts +12 -0
  164. package/types/Types.js +26 -0
  165. package/validators/AllCheckedValidatorArray.d.ts +7 -0
  166. package/validators/AllCheckedValidatorArray.js +11 -0
  167. package/validators/AllUnCheckedValidatorArray.d.ts +7 -0
  168. package/validators/AllUnCheckedValidatorArray.js +11 -0
  169. package/validators/CheckedValidator.d.ts +6 -0
  170. package/validators/CheckedValidator.js +11 -0
  171. package/validators/CountEqualsCheckedValidatorArray.d.ts +8 -0
  172. package/validators/CountEqualsCheckedValidatorArray.js +12 -0
  173. package/validators/CountEqualsUnCheckedValidatorArray.d.ts +8 -0
  174. package/validators/CountEqualsUnCheckedValidatorArray.js +12 -0
  175. package/validators/CountGreaterThanCheckedValidatorArray.d.ts +8 -0
  176. package/validators/CountGreaterThanCheckedValidatorArray.js +12 -0
  177. package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +8 -0
  178. package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +12 -0
  179. package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +8 -0
  180. package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +12 -0
  181. package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +8 -0
  182. package/validators/CountGreaterThanUnCheckedValidatorArray.js +12 -0
  183. package/validators/CountLessThanCheckedValidatorArray.d.ts +8 -0
  184. package/validators/CountLessThanCheckedValidatorArray.js +12 -0
  185. package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +8 -0
  186. package/validators/CountLessThanEqualsCheckedValidatorArray.js +12 -0
  187. package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +8 -0
  188. package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +12 -0
  189. package/validators/CountLessThanUnCheckedValidatorArray.d.ts +8 -0
  190. package/validators/CountLessThanUnCheckedValidatorArray.js +12 -0
  191. package/validators/CountUnCheckedValidatorArray.d.ts +8 -0
  192. package/validators/CountUnCheckedValidatorArray.js +12 -0
  193. package/validators/EmptyValidator.d.ts +6 -0
  194. package/validators/EmptyValidator.js +12 -0
  195. package/validators/ExcludeCheckedValidatorArray.d.ts +9 -0
  196. package/validators/ExcludeCheckedValidatorArray.js +17 -0
  197. package/validators/FormValidator.d.ts +8 -0
  198. package/validators/FormValidator.js +16 -0
  199. package/validators/IncludeCheckedValidatorArray.d.ts +9 -0
  200. package/validators/IncludeCheckedValidatorArray.js +17 -0
  201. package/validators/MultipleValidator.d.ts +9 -0
  202. package/validators/MultipleValidator.js +25 -0
  203. package/validators/NonPassValidator.d.ts +6 -0
  204. package/validators/NonPassValidator.js +10 -0
  205. package/validators/NotEmptyValidator.d.ts +6 -0
  206. package/validators/NotEmptyValidator.js +13 -0
  207. package/validators/NotRegExpTestValidator.d.ts +7 -0
  208. package/validators/NotRegExpTestValidator.js +20 -0
  209. package/validators/PassValidator.d.ts +6 -0
  210. package/validators/PassValidator.js +10 -0
  211. package/validators/RegExpTestValidator.d.ts +7 -0
  212. package/validators/RegExpTestValidator.js +21 -0
  213. package/validators/RequiredValidator.d.ts +6 -0
  214. package/validators/RequiredValidator.js +12 -0
  215. package/validators/UnCheckedValidator.d.ts +6 -0
  216. package/validators/UnCheckedValidator.js +11 -0
  217. package/validators/ValidMultipleValidator.d.ts +10 -0
  218. package/validators/ValidMultipleValidator.js +12 -0
  219. package/validators/ValidValidator.d.ts +7 -0
  220. package/validators/ValidValidator.js +11 -0
  221. package/validators/ValidValidatorArray.d.ts +8 -0
  222. package/validators/ValidValidatorArray.js +11 -0
  223. package/validators/Validator.d.ts +58 -0
  224. package/validators/Validator.js +203 -0
  225. package/validators/ValidatorArray.d.ts +18 -0
  226. package/validators/ValidatorArray.js +77 -0
  227. package/validators/ValueEqualsValidator.d.ts +7 -0
  228. package/validators/ValueEqualsValidator.js +11 -0
  229. package/validators/ValueNotEqualsValidator.d.ts +7 -0
  230. package/validators/ValueNotEqualsValidator.js +11 -0
@@ -0,0 +1,40 @@
1
+ import { ComponentBase } from '../ComponentBase';
2
+ import { DomRender } from '../../DomRender';
3
+ import { RawSet } from '../../rawsets/RawSet';
4
+ export var If;
5
+ (function (If_1) {
6
+ If_1.selector = 'dr-if';
7
+ class If extends ComponentBase {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.sw = false;
11
+ }
12
+ onInitRender(param, rawSet) {
13
+ super.onInitRender(param, rawSet);
14
+ }
15
+ onChangeAttrRender(name, value, other) {
16
+ super.onChangeAttrRender(name, value, other);
17
+ if (this.equalsAttributeName(name, 'value')) {
18
+ // console.log('------',this,name, value)
19
+ this.sw = value;
20
+ }
21
+ }
22
+ }
23
+ If_1.If = If;
24
+ })(If || (If = {}));
25
+ // const iif = DomRender.createComponent({
26
+ // type: If.If,
27
+ // tagName: If.selector,
28
+ // template: '<div dr-if="@this@.sw" dr-option-strip="true">#innerHTML#</div>' });
29
+ export default {
30
+ if: (config) => {
31
+ return RawSet.createComponentTargetElement({
32
+ name: If.selector,
33
+ template: '<div dr-if="@this@.sw" dr-option-strip="true">#innerHTML#</div>',
34
+ objFactory: (e, o, r2, counstructorParam) => {
35
+ return DomRender.run({ rootObject: new If.If(...counstructorParam), config: config });
36
+ }
37
+ });
38
+ },
39
+ };
40
+ //# sourceMappingURL=If.js.map
@@ -0,0 +1,27 @@
1
+ export declare const drComponent: {
2
+ input: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
3
+ detailsSummary: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
4
+ detailsBody: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
5
+ detailsForm: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
6
+ details: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
7
+ choose: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
8
+ selectOption: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
9
+ select: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
10
+ radioChecked: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
11
+ radioUnChecked: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
12
+ radio: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
13
+ checkBoxChecked: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
14
+ checkBoxUnchecked: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
15
+ checkBox: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
16
+ chooseWhen: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
17
+ chooseOtherWise: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
18
+ promiseDefault: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
19
+ promisePending: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
20
+ promiseFulfilled: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
21
+ promiseRejected: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
22
+ promiseSwitch: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
23
+ appender: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
24
+ this: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
25
+ if: (config?: import("../DomRender").RunConfig) => import("../configs/TargetElement").TargetElement;
26
+ };
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ import If from './if/If';
2
+ import This from './this/This';
3
+ import Appender from './appender/Appender';
4
+ import PromiseSwitch from './promise/PromiseSwitch';
5
+ import Choose from './choose/Choose';
6
+ import CheckBox from './checkbox/CheckBox';
7
+ import Radio from './radio/Radio';
8
+ import Select from './select/Select';
9
+ import Timer from './timer/Timer';
10
+ import Details from './details/Details';
11
+ import Input from './input/Input';
12
+ export const drComponent = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, If), This), Appender), PromiseSwitch), Choose), CheckBox), Radio), Select), Timer), Details), Input);
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,34 @@
1
+ import { ComponentBase } from '../ComponentBase';
2
+ import { RunConfig } from '../../DomRender';
3
+ import { RawSet } from '../../rawsets/RawSet';
4
+ import { OtherData } from '../../lifecycle/OnChangeAttrRender';
5
+ import { OnCreateRender } from 'lifecycle/OnCreateRender';
6
+ import { OnDestroyRender, OnDestroyRenderParams } from 'lifecycle/OnDestroyRender';
7
+ export declare namespace Input {
8
+ const selector = "dr-input";
9
+ type Attribute = {
10
+ name?: string;
11
+ type?: string;
12
+ id?: string;
13
+ class?: string;
14
+ debounceTime?: number;
15
+ distinct?: boolean;
16
+ input?: (value: string, element: Element) => void;
17
+ };
18
+ class Base extends ComponentBase<any> {
19
+ }
20
+ class Input extends Base implements OnCreateRender, OnDestroyRender {
21
+ private element?;
22
+ private inputSubscription?;
23
+ private resetSubscripton?;
24
+ onCreateRender(...param: any[]): void;
25
+ onInitRender(param: any, rawSet: RawSet): void;
26
+ onChangeAttrRender(name: string, value: any, other: OtherData): void;
27
+ onDestroyRender(metaData?: OnDestroyRenderParams): void;
28
+ }
29
+ }
30
+ declare const _default: {
31
+ input: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
32
+ };
33
+ export default _default;
34
+ //# sourceMappingURL=Input.d.ts.map
@@ -0,0 +1,86 @@
1
+ import { ComponentBase } from '../ComponentBase';
2
+ import { DomRender } from '../../DomRender';
3
+ import { RawSet } from '../../rawsets/RawSet';
4
+ import { ValidUtils } from '@dooboostore/core/valid/ValidUtils';
5
+ import { map } from '@dooboostore/core/message/operators/map';
6
+ import { EventUtils } from '@dooboostore/core-web/event/EventUtils';
7
+ import { debounceTime } from '@dooboostore/core/message/operators/debounceTime';
8
+ import { distinctUntilChanged } from '@dooboostore/core/message/operators/distinctUntilChanged';
9
+ export var Input;
10
+ (function (Input_1) {
11
+ Input_1.selector = `dr-input`;
12
+ class Base extends ComponentBase {
13
+ }
14
+ Input_1.Base = Base;
15
+ // @Component({
16
+ // selector: `${selector}`,
17
+ // template,
18
+ // styles,
19
+ // })
20
+ class Input extends Base {
21
+ onCreateRender(...param) {
22
+ }
23
+ onInitRender(param, rawSet) {
24
+ super.onInitRender(param, rawSet);
25
+ const inputElement = this.element;
26
+ const debounceTimeAttribute = this.getAttribute('debounceTime');
27
+ const debounceTimeValue = ValidUtils.isNotNullUndefined(debounceTimeAttribute) ? Number(debounceTimeAttribute) : 0;
28
+ const distinct = ValidUtils.isNotNullUndefined(this.getAttribute('distinct'));
29
+ const makeDeboundceDistinctUtilChanged = () => {
30
+ // let result$ = EventUtils.htmlElementEventObservable(inputElement,'input');
31
+ let result$ = EventUtils.htmlElementEventObservable(inputElement, 'input').pipe(map(event => event.target.value.trim()));
32
+ if (ValidUtils.isNotNullUndefined(debounceTimeValue) && debounceTimeValue > 0) {
33
+ result$ = result$.pipe(debounceTime(debounceTimeValue));
34
+ }
35
+ if (ValidUtils.isNotNullUndefined(distinct) && distinct === true) {
36
+ result$ = result$.pipe(distinctUntilChanged());
37
+ }
38
+ return result$;
39
+ };
40
+ this.inputSubscription = makeDeboundceDistinctUtilChanged().subscribe(it => {
41
+ var _a;
42
+ // console.log('change?????????????', it);
43
+ (_a = this.getAttribute('input')) === null || _a === void 0 ? void 0 : _a(it, inputElement);
44
+ });
45
+ if (inputElement && inputElement.form) {
46
+ this.resetSubscripton = EventUtils.htmlElementEventObservable(inputElement.form, 'reset').subscribe(it => {
47
+ var _a;
48
+ // console.log('rrrraaa?,', this.inputSubscription, it)
49
+ (_a = this.inputSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
50
+ this.inputSubscription = makeDeboundceDistinctUtilChanged().subscribe(it => {
51
+ var _a;
52
+ // console.log('rrrr?')
53
+ (_a = this.getAttribute('input')) === null || _a === void 0 ? void 0 : _a(it, inputElement);
54
+ });
55
+ });
56
+ }
57
+ }
58
+ onChangeAttrRender(name, value, other) {
59
+ super.onChangeAttrRender(name, value, other);
60
+ // console.log('-------->',name, value)
61
+ if (name === 'value') {
62
+ // console.log('changeAttribu', name, value)
63
+ // this.wow = {value: value};
64
+ // this.name = value;
65
+ }
66
+ }
67
+ onDestroyRender(metaData) {
68
+ var _a, _b;
69
+ (_a = this.resetSubscripton) === null || _a === void 0 ? void 0 : _a.unsubscribe();
70
+ (_b = this.inputSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
71
+ }
72
+ }
73
+ Input_1.Input = Input;
74
+ })(Input || (Input = {}));
75
+ export default {
76
+ input: (config) => {
77
+ return RawSet.createComponentTargetElement({
78
+ name: `${Input.selector}`,
79
+ template: '<Input type="${@this@.getAttribute(\'type\')}$" class="${@this@.getAttribute(\'class\')}$" id="${@this@.getAttribute(\'id\')}$" name="${@this@.getAttribute(\'name\')}$" dr-on-init="@this@.element=$element" >#innerHTML#',
80
+ objFactory: (e, o, r2, counstructorParam) => {
81
+ return DomRender.run({ rootObject: new Input.Input(...counstructorParam), config: config });
82
+ }
83
+ });
84
+ },
85
+ };
86
+ //# sourceMappingURL=Input.js.map
@@ -0,0 +1,55 @@
1
+ import { ComponentBase } from '../ComponentBase';
2
+ import { RunConfig } from '../../DomRender';
3
+ import { OtherData } from '../../lifecycle/OnChangeAttrRender';
4
+ import { OnCreateRenderDataParams } from '../../lifecycle/OnCreateRenderData';
5
+ export declare namespace PromiseSwitch {
6
+ export const selector = "dr-promise-switch";
7
+ export type ChangeParams<T> = {
8
+ status: 'pending';
9
+ } | {
10
+ status: 'finally';
11
+ } | {
12
+ status: 'fulfilled';
13
+ data: T;
14
+ } | {
15
+ status: 'rejected';
16
+ data: any;
17
+ };
18
+ export type Attribute = {
19
+ data: Promise<any> | (() => Promise<any>);
20
+ change?: <T>(data: ChangeParams<T>) => void;
21
+ };
22
+ class ChildBase<T = any> extends ComponentBase<T> {
23
+ hidden: boolean;
24
+ }
25
+ export class Default extends ChildBase {
26
+ }
27
+ export class Pending extends ChildBase<{
28
+ defaultView?: null;
29
+ }> {
30
+ }
31
+ export class Fulfilled<T = any> extends ChildBase {
32
+ private data?;
33
+ setData(data: T): void;
34
+ }
35
+ export class Rejected<T = any> extends ChildBase {
36
+ private data?;
37
+ setData(data: T): void;
38
+ }
39
+ export class PromiseSwitch extends ComponentBase<Attribute> {
40
+ private promiseState?;
41
+ onCreatedThisChild(child: any, data: OnCreateRenderDataParams): void;
42
+ childStateChange(): void;
43
+ onChangeAttrRender(name: string, value: any, other: OtherData): void;
44
+ }
45
+ export {};
46
+ }
47
+ declare const _default: {
48
+ promiseDefault: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
49
+ promisePending: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
50
+ promiseFulfilled: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
51
+ promiseRejected: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
52
+ promiseSwitch: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
53
+ };
54
+ export default _default;
55
+ //# sourceMappingURL=PromiseSwitch.d.ts.map
@@ -0,0 +1,181 @@
1
+ import { ComponentBase } from '../ComponentBase';
2
+ import { DomRender } from '../../DomRender';
3
+ import { RawSet } from '../../rawsets/RawSet';
4
+ import { ValidUtils } from '@dooboostore/core/valid/ValidUtils';
5
+ import { Promises } from '@dooboostore/core/promise';
6
+ export var PromiseSwitch;
7
+ (function (PromiseSwitch_1) {
8
+ PromiseSwitch_1.selector = 'dr-promise-switch';
9
+ class ChildBase extends ComponentBase {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.hidden = true;
13
+ }
14
+ }
15
+ // @Component({
16
+ // template: '<div dr-if="!@this@.hidden" dr-strip="true">#innerHTML#</div>',
17
+ // selector: `${selector}.Default`
18
+ // })
19
+ class Default extends ChildBase {
20
+ }
21
+ PromiseSwitch_1.Default = Default;
22
+ // @Component({
23
+ // template: '<div dr-if="!@this@.hidden" dr-strip="true">#innerHTML#</div>',
24
+ // selector: `${selector}.Pending`
25
+ // // selector: `System-PromiseSwitch.Pending`
26
+ // })
27
+ class Pending extends ChildBase {
28
+ }
29
+ PromiseSwitch_1.Pending = Pending;
30
+ // @Component({
31
+ // template: '<div dr-if="!@this@.hidden" dr-strip="true">#innerHTML#</div>',
32
+ // selector: `${selector}.Fulfilled`
33
+ // })
34
+ class Fulfilled extends ChildBase {
35
+ setData(data) {
36
+ this.data = data;
37
+ }
38
+ }
39
+ PromiseSwitch_1.Fulfilled = Fulfilled;
40
+ // @Component({
41
+ // template: '<div dr-if="!@this@.hidden" dr-strip="true">#innerHTML#</div>',
42
+ // selector: `${selector}.Rejected`
43
+ // })
44
+ class Rejected extends ChildBase {
45
+ setData(data) {
46
+ this.data = data;
47
+ }
48
+ }
49
+ PromiseSwitch_1.Rejected = Rejected;
50
+ // @Component({
51
+ // template: '#innerHTML#',
52
+ // selector: `${selector}`
53
+ // })
54
+ class PromiseSwitch extends ComponentBase {
55
+ onCreatedThisChild(child, data) {
56
+ super.onCreatedThisChild(child, data);
57
+ this.childStateChange();
58
+ }
59
+ childStateChange() {
60
+ const defaults = this.getChildren(Default);
61
+ const pendings = this.getChildren(Pending);
62
+ const fulfilleds = this.getChildren(Fulfilled);
63
+ const rejecteds = this.getChildren(Rejected);
64
+ const full = [...fulfilleds, ...rejecteds, ...pendings, ...defaults];
65
+ // console.log('----!!!!!!-------', this.promiseState, full)
66
+ if (this.promiseState === undefined) {
67
+ full.filter(it => !it.hidden).forEach(it => it.hidden = true);
68
+ defaults.filter(it => it.hidden).forEach(it => it.hidden = false);
69
+ pendings.filter(it => it.getAttribute('defaultView') && it.hidden).forEach(it => it.hidden = false);
70
+ }
71
+ else if (this.promiseState.status === 'pending') {
72
+ full.filter(it => !it.hidden).forEach(it => it.hidden = true);
73
+ pendings.filter(it => it.hidden).forEach(it => it.hidden = false);
74
+ }
75
+ else if (this.promiseState.status === 'fulfilled') {
76
+ const value = this.promiseState.value;
77
+ // console.log('-----------fulfilled promises', value);
78
+ full.filter(it => !it.hidden).forEach(it => it.hidden = true);
79
+ fulfilleds.forEach(it => {
80
+ it.setData(value);
81
+ });
82
+ fulfilleds.filter(it => it.hidden).forEach(it => it.hidden = false);
83
+ }
84
+ else if (this.promiseState.status === 'rejected') {
85
+ const value = this.promiseState.reason;
86
+ full.filter(it => !it.hidden).forEach(it => it.hidden = true);
87
+ rejecteds.forEach(it => {
88
+ it.setData(value);
89
+ });
90
+ rejecteds.filter(it => it.hidden).forEach(it => it.hidden = false);
91
+ }
92
+ // console.log('----!!!!!!-end------', this.promiseState, full.map(it=>it.hidden))
93
+ }
94
+ onChangeAttrRender(name, value, other) {
95
+ var _a;
96
+ super.onChangeAttrRender(name, value, other);
97
+ // console.log('-----------changer promises', name, value, this.getChildren(Default));
98
+ if (this.equalsAttributeName(name, 'data') && value) {
99
+ // this.childStateChange();
100
+ this.promiseState = undefined;
101
+ this.promiseState = Promises.Result.wrap(typeof value === 'function' ? value() : value);
102
+ (_a = this.getAttribute('change')) === null || _a === void 0 ? void 0 : _a({ status: 'pending' });
103
+ this.childStateChange();
104
+ // console.log('----?', this.promiseState)
105
+ this.promiseState.then(data => {
106
+ var _a;
107
+ // console.log('------------then', data);
108
+ this.childStateChange();
109
+ (_a = this.getAttribute('change')) === null || _a === void 0 ? void 0 : _a({ status: 'fulfilled', data: data });
110
+ return data;
111
+ }).catch((e) => {
112
+ var _a;
113
+ // console.log('catch', e)
114
+ this.childStateChange();
115
+ (_a = this.getAttribute('change')) === null || _a === void 0 ? void 0 : _a({ status: 'rejected', data: e });
116
+ throw e;
117
+ }).finally(() => {
118
+ var _a;
119
+ // console.log('-------------finally--------rrrrrrrrrrr', this.promiseState)
120
+ // this.childStateChange();
121
+ (_a = this.getAttribute('change')) === null || _a === void 0 ? void 0 : _a({ status: 'finally' });
122
+ });
123
+ // await this.promiseState;
124
+ // console.log('---------------------rrrrrrrrrrr', this.promiseState)
125
+ }
126
+ else if (this.equalsAttributeName(name, 'data') && ValidUtils.isNullOrUndefined(value)) {
127
+ this.promiseState = undefined;
128
+ this.childStateChange();
129
+ }
130
+ }
131
+ }
132
+ PromiseSwitch_1.PromiseSwitch = PromiseSwitch;
133
+ })(PromiseSwitch || (PromiseSwitch = {}));
134
+ export default {
135
+ promiseDefault: (config) => {
136
+ return RawSet.createComponentTargetElement({
137
+ name: `${PromiseSwitch.selector}-default`,
138
+ template: '<div dr-if="!@this@.hidden" dr-option-strip="true">#innerHTML#</div>',
139
+ objFactory: (e, o, r2, counstructorParam) => {
140
+ return DomRender.run({ rootObject: new PromiseSwitch.Default(...counstructorParam), config: config });
141
+ }
142
+ });
143
+ },
144
+ promisePending: (config) => {
145
+ return RawSet.createComponentTargetElement({
146
+ name: `${PromiseSwitch.selector}-pending`,
147
+ template: '<div dr-if="!@this@.hidden" dr-option-strip="true">#innerHTML#</div>',
148
+ objFactory: (e, o, r2, counstructorParam) => {
149
+ return DomRender.run({ rootObject: new PromiseSwitch.Pending(...counstructorParam), config: config });
150
+ }
151
+ });
152
+ },
153
+ promiseFulfilled: (config) => {
154
+ return RawSet.createComponentTargetElement({
155
+ name: `${PromiseSwitch.selector}-fulfilled`,
156
+ template: '<div dr-if="!@this@.hidden" dr-option-strip="true">#innerHTML#</div>',
157
+ objFactory: (e, o, r2, counstructorParam) => {
158
+ return DomRender.run({ rootObject: new PromiseSwitch.Fulfilled(...counstructorParam), config: config });
159
+ }
160
+ });
161
+ },
162
+ promiseRejected: (config) => {
163
+ return RawSet.createComponentTargetElement({
164
+ name: `${PromiseSwitch.selector}-rejected`,
165
+ template: '<div dr-if="!@this@.hidden" dr-option-strip="true">#innerHTML#</div>',
166
+ objFactory: (e, o, r2, counstructorParam) => {
167
+ return DomRender.run({ rootObject: new PromiseSwitch.Rejected(...counstructorParam), config: config });
168
+ }
169
+ });
170
+ },
171
+ promiseSwitch: (config) => {
172
+ return RawSet.createComponentTargetElement({
173
+ name: `${PromiseSwitch.selector}`,
174
+ template: '#innerHTML#',
175
+ objFactory: (e, o, r2, counstructorParam) => {
176
+ return DomRender.run({ rootObject: new PromiseSwitch.PromiseSwitch(...counstructorParam), config: config });
177
+ }
178
+ });
179
+ },
180
+ };
181
+ //# sourceMappingURL=PromiseSwitch.js.map
@@ -0,0 +1,45 @@
1
+ import { ComponentBase } from '../ComponentBase';
2
+ import { RunConfig } from '../../DomRender';
3
+ import { OtherData } from '../../lifecycle/OnChangeAttrRender';
4
+ import { OnCreateRenderDataParams } from '../../lifecycle/OnCreateRenderData';
5
+ export declare namespace Radio {
6
+ export const selector = "System:Radio";
7
+ export type Attribute = {
8
+ class?: string;
9
+ };
10
+ export type LabelAttribute = {
11
+ class?: string;
12
+ name?: string;
13
+ value?: string;
14
+ checked?: boolean;
15
+ on_change_checked?: (checked: boolean, element: HTMLInputElement) => void;
16
+ };
17
+ class RadioBase extends ComponentBase<Attribute> {
18
+ hidden: boolean;
19
+ }
20
+ export class Checked extends RadioBase {
21
+ name: string;
22
+ constructor();
23
+ }
24
+ export class UnChecked extends RadioBase {
25
+ name: string;
26
+ constructor();
27
+ }
28
+ export class Radio extends ComponentBase<LabelAttribute> {
29
+ private checked;
30
+ private inputElement?;
31
+ change(checked?: boolean): void;
32
+ private setChildrenHidden;
33
+ onCreatedThisChild(child: RadioBase, childData: OnCreateRenderDataParams): void;
34
+ onInitInputElement(element: HTMLInputElement): void;
35
+ onChangeAttrRender(name: string, val: any, other: OtherData): void;
36
+ }
37
+ export {};
38
+ }
39
+ declare const _default: {
40
+ radioChecked: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
41
+ radioUnChecked: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
42
+ radio: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
43
+ };
44
+ export default _default;
45
+ //# sourceMappingURL=Radio.d.ts.map
@@ -0,0 +1,123 @@
1
+ import { ComponentBase } from '../ComponentBase';
2
+ import { DomRender } from '../../DomRender';
3
+ import { RawSet } from '../../rawsets/RawSet';
4
+ export var Radio;
5
+ (function (Radio_1) {
6
+ Radio_1.selector = 'System:Radio';
7
+ class RadioBase extends ComponentBase {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.hidden = true;
11
+ }
12
+ }
13
+ // @Component({
14
+ // template: '<div dr-if="!@this@.hidden" dr-option-strip="true">#innerHTML#</div>',
15
+ // styles: '',
16
+ // selector: `${selector}.Checked`
17
+ // })
18
+ class Checked extends RadioBase {
19
+ constructor() {
20
+ super({ onlyParentType: Radio });
21
+ this.name = 'Checked';
22
+ }
23
+ }
24
+ Radio_1.Checked = Checked;
25
+ // @Component({
26
+ // template: '<div dr-if="!@this@.hidden" dr-option-strip="true">#innerHTML#</div>',
27
+ // styles: '',
28
+ // selector: `${selector}.UnChecked`
29
+ // })
30
+ class UnChecked extends RadioBase {
31
+ constructor() {
32
+ super({ onlyParentType: Radio });
33
+ this.name = 'unChecked';
34
+ }
35
+ }
36
+ Radio_1.UnChecked = UnChecked;
37
+ // @Component({
38
+ // template: template,
39
+ // styles: style,
40
+ // selector: `${selector}`
41
+ // })
42
+ class Radio extends ComponentBase {
43
+ constructor() {
44
+ super(...arguments);
45
+ this.checked = false;
46
+ }
47
+ change(checked = this.checked) {
48
+ var _a, _b;
49
+ this.checked = checked;
50
+ this.setChildrenHidden(checked);
51
+ console.log('radio checked!!!!!!!', checked, this.checked, (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.checked);
52
+ if (this.getAttribute('on_change_checked')) {
53
+ (_b = this.getAttribute('on_change_checked')) === null || _b === void 0 ? void 0 : _b(checked, this.inputElement);
54
+ }
55
+ }
56
+ setChildrenHidden(checked) {
57
+ this.getChildren(Checked).forEach(it => {
58
+ it.hidden = !checked;
59
+ });
60
+ this.getChildren(UnChecked).forEach(it => {
61
+ it.hidden = checked;
62
+ });
63
+ }
64
+ onCreatedThisChild(child, childData) {
65
+ super.onCreatedThisChild(child, childData);
66
+ this.setChildrenHidden(this.checked);
67
+ }
68
+ onInitInputElement(element) {
69
+ this.inputElement = element;
70
+ }
71
+ onChangeAttrRender(name, val, other) {
72
+ super.onChangeAttrRender(name, val, other);
73
+ if (this.inputElement && this.getAttribute('checked') !== this.checked) {
74
+ this.inputElement.checked = !!this.getAttribute('checked');
75
+ console.log('----changeAttribute', this.getAttribute('checked'));
76
+ this.change(!!this.getAttribute('checked'));
77
+ }
78
+ }
79
+ }
80
+ Radio_1.Radio = Radio;
81
+ })(Radio || (Radio = {}));
82
+ export default {
83
+ radioChecked: (config) => {
84
+ return RawSet.createComponentTargetElement({
85
+ name: `${Radio.selector}-checked`,
86
+ template: '<div dr-if="!@this@.hidden" dr-option-strip="true" >#innerHTML#</div>',
87
+ objFactory: (e, o, r2, counstructorParam) => {
88
+ return DomRender.run({ rootObject: new Radio.Checked(), config: config });
89
+ }
90
+ });
91
+ },
92
+ radioUnChecked: (config) => {
93
+ return RawSet.createComponentTargetElement({
94
+ name: `${Radio.selector}-unchecked`,
95
+ template: '<div dr-if="!@this@.hidden" dr-option-strip="true" >#innerHTML#</div>',
96
+ objFactory: (e, o, r2, counstructorParam) => {
97
+ return DomRender.run({ rootObject: new Radio.UnChecked(), config: config });
98
+ }
99
+ });
100
+ },
101
+ radio: (config) => {
102
+ return RawSet.createComponentTargetElement({
103
+ name: `${Radio.selector}`,
104
+ template: '<label class="${@this@.getAttribute(\'class\')}$">\n' +
105
+ ' <input\n' +
106
+ ' name="${@this@.getAttribute(\'name\')}$"\n' +
107
+ ' checked="${@this@.getAttribute(\'checked\')}$"\n' +
108
+ ' value="${@this@.getAttribute(\'value\')}$"\n' +
109
+ ' dr-on-init="@this@.onInitInputElement($element)"\n' +
110
+ ' dr-event-change="@this@.change($element.checked);"\n' +
111
+ ' type="radio"\n' +
112
+ '\n' +
113
+ ' />\n' +
114
+ ' ${@this@.getAttribute(\'checked\')}$\n' +
115
+ ' #innerHTML#\n' +
116
+ '</label>',
117
+ objFactory: (e, o, r2, counstructorParam) => {
118
+ return DomRender.run({ rootObject: new Radio.Radio(...counstructorParam), config: config });
119
+ }
120
+ });
121
+ },
122
+ };
123
+ //# sourceMappingURL=Radio.js.map
@@ -0,0 +1,23 @@
1
+ import { ComponentBase } from '../ComponentBase';
2
+ import { RunConfig } from '../../DomRender';
3
+ import { OnCreateRender } from '../../lifecycle/OnCreateRender';
4
+ export declare namespace Select {
5
+ const selector = "dr-select";
6
+ type Attribute = {
7
+ class?: string;
8
+ };
9
+ class Option extends ComponentBase<Attribute> {
10
+ constructor();
11
+ }
12
+ class Select extends ComponentBase<Attribute> implements OnCreateRender {
13
+ private element?;
14
+ onCreateRender(...param: any[]): void;
15
+ onDestroyRender(...metaData: any[]): void;
16
+ }
17
+ }
18
+ declare const _default: {
19
+ selectOption: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
20
+ select: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
21
+ };
22
+ export default _default;
23
+ //# sourceMappingURL=Select.d.ts.map