ezfw-core 1.0.0

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 (154) hide show
  1. package/components/EzBaseComponent.ts +648 -0
  2. package/components/EzComponent.ts +89 -0
  3. package/components/EzInput.module.scss +183 -0
  4. package/components/EzInput.ts +104 -0
  5. package/components/EzLabel.ts +22 -0
  6. package/components/EzOutlet.ts +181 -0
  7. package/components/HtmlWrapper.ts +305 -0
  8. package/components/avatar/EzAvatar.module.scss +200 -0
  9. package/components/avatar/EzAvatar.ts +130 -0
  10. package/components/badge/EzBadge.module.scss +202 -0
  11. package/components/badge/EzBadge.ts +77 -0
  12. package/components/button/EzButton.module.scss +402 -0
  13. package/components/button/EzButton.ts +175 -0
  14. package/components/button/EzButtonGroup.ts +48 -0
  15. package/components/card/EzCard.module.scss +71 -0
  16. package/components/card/EzCard.ts +120 -0
  17. package/components/chart/EzBarChart.ts +47 -0
  18. package/components/chart/EzChart.module.scss +14 -0
  19. package/components/chart/EzChart.ts +279 -0
  20. package/components/chart/EzDoughnutChart.ts +47 -0
  21. package/components/chart/EzLineChart.ts +53 -0
  22. package/components/checkbox/EzCheckbox.module.scss +145 -0
  23. package/components/checkbox/EzCheckbox.ts +115 -0
  24. package/components/dataview/EzDataView.module.scss +115 -0
  25. package/components/dataview/EzDataView.ts +355 -0
  26. package/components/dataview/modes/EzDataViewCards.ts +322 -0
  27. package/components/dataview/modes/EzDataViewGrid.ts +76 -0
  28. package/components/datepicker/EzDatePicker.module.scss +348 -0
  29. package/components/datepicker/EzDatePicker.ts +519 -0
  30. package/components/dialog/EzDialog.module.scss +180 -0
  31. package/components/dropdown/EzDropdown.module.scss +107 -0
  32. package/components/dropdown/EzDropdown.ts +235 -0
  33. package/components/feed/EzActivityFeed.module.scss +90 -0
  34. package/components/feed/EzActivityFeed.ts +78 -0
  35. package/components/form/EzForm.ts +364 -0
  36. package/components/form/EzValidators.test.js +421 -0
  37. package/components/form/EzValidators.ts +202 -0
  38. package/components/grid/EzGrid.scss +88 -0
  39. package/components/grid/EzGrid.ts +1085 -0
  40. package/components/grid/EzGridContainer.ts +104 -0
  41. package/components/grid/body/EzGridBody.scss +283 -0
  42. package/components/grid/body/EzGridBody.ts +549 -0
  43. package/components/grid/body/EzGridCell.ts +211 -0
  44. package/components/grid/body/EzGridRow.ts +196 -0
  45. package/components/grid/filter/EzGridFilters.scss +78 -0
  46. package/components/grid/filter/EzGridFilters.ts +285 -0
  47. package/components/grid/footer/EzGridFooter.scss +136 -0
  48. package/components/grid/footer/EzGridFooter.ts +448 -0
  49. package/components/grid/header/EzGridHeader.scss +199 -0
  50. package/components/grid/header/EzGridHeader.ts +430 -0
  51. package/components/grid/query/EzGridQuery.ts +81 -0
  52. package/components/grid/state/EzGridColumns.ts +155 -0
  53. package/components/grid/state/EzGridController.ts +470 -0
  54. package/components/grid/state/EzGridLifecycle.ts +136 -0
  55. package/components/grid/state/EzGridNormalizers.test.js +273 -0
  56. package/components/grid/state/EzGridNormalizers.ts +162 -0
  57. package/components/grid/state/EzGridParts.ts +233 -0
  58. package/components/grid/state/EzGridPersistence.ts +140 -0
  59. package/components/grid/state/EzGridRemote.test.js +573 -0
  60. package/components/grid/state/EzGridRemote.ts +335 -0
  61. package/components/grid/state/EzGridSelection.ts +231 -0
  62. package/components/grid/state/EzGridSort.ts +286 -0
  63. package/components/grid/title/EzGridActionBar.ts +98 -0
  64. package/components/grid/title/EzGridTitle.ts +114 -0
  65. package/components/grid/title/EzGridTitleBar.scss +65 -0
  66. package/components/grid/title/EzGridTitleBar.ts +87 -0
  67. package/components/grid/types.ts +607 -0
  68. package/components/panel/EzPanel.module.scss +133 -0
  69. package/components/panel/EzPanel.ts +147 -0
  70. package/components/radio/EzRadio.module.scss +190 -0
  71. package/components/radio/EzRadio.ts +149 -0
  72. package/components/select/EzSelect.module.scss +153 -0
  73. package/components/select/EzSelect.ts +238 -0
  74. package/components/skeleton/EzSkeleton.module.scss +95 -0
  75. package/components/skeleton/EzSkeleton.ts +70 -0
  76. package/components/store/EzStore.ts +344 -0
  77. package/components/switch/EzSwitch.module.scss +164 -0
  78. package/components/switch/EzSwitch.ts +117 -0
  79. package/components/tabs/EzTabPanel.module.scss +181 -0
  80. package/components/tabs/EzTabPanel.ts +402 -0
  81. package/components/textarea/EzTextarea.module.scss +131 -0
  82. package/components/textarea/EzTextarea.ts +161 -0
  83. package/components/timepicker/EzTimePicker.module.scss +282 -0
  84. package/components/timepicker/EzTimePicker.ts +540 -0
  85. package/components/toast/EzToast.module.scss +291 -0
  86. package/components/tooltip/EzTooltip.module.scss +124 -0
  87. package/components/tooltip/EzTooltip.ts +153 -0
  88. package/core/EzComponentTypes.ts +693 -0
  89. package/core/EzError.ts +63 -0
  90. package/core/EzModel.ts +268 -0
  91. package/core/EzTypes.ts +328 -0
  92. package/core/eventBus.ts +284 -0
  93. package/core/ez.ts +617 -0
  94. package/core/loader.ts +725 -0
  95. package/core/renderer.ts +1010 -0
  96. package/core/router.ts +490 -0
  97. package/core/services.ts +124 -0
  98. package/core/state.ts +142 -0
  99. package/core/utils.ts +81 -0
  100. package/package.json +51 -0
  101. package/services/RouteUI.js +17 -0
  102. package/services/crypto.js +64 -0
  103. package/services/dialog.js +222 -0
  104. package/services/fetchApi.js +63 -0
  105. package/services/firebase.js +30 -0
  106. package/services/toast.js +214 -0
  107. package/template/doc/EzDocs.js +15 -0
  108. package/template/doc/EzDocs.module.scss +627 -0
  109. package/template/doc/EzDocsController.js +164 -0
  110. package/template/doc/data/activityfeed/EzActivityFeedDoc.js +42 -0
  111. package/template/doc/data/avatar/EzAvatarDoc.js +71 -0
  112. package/template/doc/data/badge/EzBadgeDoc.js +92 -0
  113. package/template/doc/data/button/EzButtonDoc.js +77 -0
  114. package/template/doc/data/buttongroup/EzButtonGroupDoc.js +102 -0
  115. package/template/doc/data/card/EzCardDoc.js +39 -0
  116. package/template/doc/data/chart/EzChartDoc.js +60 -0
  117. package/template/doc/data/checkbox/EzCheckboxDoc.js +67 -0
  118. package/template/doc/data/component/EzComponentDoc.js +34 -0
  119. package/template/doc/data/cssmodules/CSSModulesDoc.js +70 -0
  120. package/template/doc/data/datepicker/EzDatePickerDoc.js +126 -0
  121. package/template/doc/data/dialog/EzDialogDoc.js +217 -0
  122. package/template/doc/data/dropdown/EzDropdownDoc.js +178 -0
  123. package/template/doc/data/form/EzFormDoc.js +90 -0
  124. package/template/doc/data/grid/EzGridDoc.js +99 -0
  125. package/template/doc/data/input/EzInputDoc.js +92 -0
  126. package/template/doc/data/label/EzLabelDoc.js +40 -0
  127. package/template/doc/data/model/EzModelDoc.js +53 -0
  128. package/template/doc/data/outlet/EzOutletDoc.js +63 -0
  129. package/template/doc/data/panel/EzPanelDoc.js +214 -0
  130. package/template/doc/data/radio/EzRadioDoc.js +174 -0
  131. package/template/doc/data/router/EzRouterDoc.js +75 -0
  132. package/template/doc/data/select/EzSelectDoc.js +37 -0
  133. package/template/doc/data/skeleton/EzSkeletonDoc.js +149 -0
  134. package/template/doc/data/switch/EzSwitchDoc.js +82 -0
  135. package/template/doc/data/tabpanel/EzTabPanelDoc.js +44 -0
  136. package/template/doc/data/textarea/EzTextareaDoc.js +131 -0
  137. package/template/doc/data/timepicker/EzTimePickerDoc.js +107 -0
  138. package/template/doc/data/tooltip/EzTooltipDoc.js +193 -0
  139. package/template/doc/data/validators/EzValidatorsDoc.js +37 -0
  140. package/template/doc/sidebar/EzDocsSidebar.js +32 -0
  141. package/template/doc/sidebar/category/EzDocsCategory.js +33 -0
  142. package/template/doc/sidebar/item/EzDocsComponentItem.js +24 -0
  143. package/template/doc/viewer/EzDocsViewer.js +18 -0
  144. package/template/doc/viewer/codepanel/EzDocsCodePanel.js +51 -0
  145. package/template/doc/viewer/content/EzDocsContent.js +315 -0
  146. package/template/doc/viewer/header/EzDocsViewerHeader.js +46 -0
  147. package/template/doc/viewer/showcase/EzDocsShowcase.js +59 -0
  148. package/template/doc/viewer/showcase/EzDocsShowcaseSection.js +25 -0
  149. package/template/doc/viewer/showcase/EzDocsVariantItem.js +29 -0
  150. package/template/doc/welcome/EzDocsWelcome.js +48 -0
  151. package/themes/ez-theme.scss +179 -0
  152. package/themes/nature-fresh.scss +169 -0
  153. package/types/global.d.ts +21 -0
  154. package/utils/cssModules.js +81 -0
@@ -0,0 +1,214 @@
1
+ import styles from '../components/toast/EzToast.module.scss';
2
+ import { cx } from '../utils/cssModules.js';
3
+
4
+ const cls = cx(styles);
5
+
6
+ const POSITION_MAP = {
7
+ 'top-right': 'topRight',
8
+ 'top-left': 'topLeft',
9
+ 'top-center': 'topCenter',
10
+ 'bottom-right': 'bottomRight',
11
+ 'bottom-left': 'bottomLeft',
12
+ 'bottom-center': 'bottomCenter'
13
+ };
14
+
15
+ export class EzToastService {
16
+ constructor() {
17
+ this._container = null;
18
+ this._toasts = [];
19
+ this._position = 'top-right';
20
+ this._defaultDuration = 4000;
21
+ }
22
+
23
+ _getPositionClass() {
24
+ return POSITION_MAP[this._position] || 'topRight';
25
+ }
26
+
27
+ _ensureContainer() {
28
+ if (this._container) return;
29
+
30
+ this._container = document.createElement('div');
31
+ this._container.className = cls('toastContainer', this._getPositionClass());
32
+ document.body.appendChild(this._container);
33
+ }
34
+
35
+ configure(options = {}) {
36
+ if (options.position) {
37
+ this._position = options.position;
38
+ if (this._container) {
39
+ this._container.className = cls('toastContainer', this._getPositionClass());
40
+ }
41
+ }
42
+ if (options.duration !== undefined) {
43
+ this._defaultDuration = options.duration;
44
+ }
45
+ }
46
+
47
+ show(options) {
48
+ const config = typeof options === 'string'
49
+ ? { message: options }
50
+ : options;
51
+
52
+ const {
53
+ message,
54
+ title,
55
+ variant = 'info',
56
+ duration = this._defaultDuration,
57
+ position = null,
58
+ closable = true,
59
+ icon = null,
60
+ action = null
61
+ } = config;
62
+
63
+ // Use custom position or default
64
+ const activePosition = position || this._position;
65
+ const positionClass = POSITION_MAP[activePosition] || 'topRight';
66
+
67
+ // Ensure container exists and update position if needed
68
+ this._ensureContainer();
69
+ if (position && position !== this._position) {
70
+ this._container.className = cls('toastContainer', positionClass);
71
+ }
72
+
73
+ const toast = document.createElement('div');
74
+ toast.className = cls('toast', variant);
75
+
76
+ // Icon
77
+ const iconEl = document.createElement('div');
78
+ iconEl.className = cls('toastIcon');
79
+ iconEl.innerHTML = this._getIcon(variant, icon);
80
+ toast.appendChild(iconEl);
81
+
82
+ // Content
83
+ const content = document.createElement('div');
84
+ content.className = cls('toastContent');
85
+
86
+ if (title) {
87
+ const titleEl = document.createElement('div');
88
+ titleEl.className = cls('toastTitle');
89
+ titleEl.textContent = title;
90
+ content.appendChild(titleEl);
91
+ }
92
+
93
+ const messageEl = document.createElement('div');
94
+ messageEl.className = cls('toastMessage');
95
+ messageEl.textContent = message;
96
+ content.appendChild(messageEl);
97
+
98
+ toast.appendChild(content);
99
+
100
+ // Action button (optional)
101
+ if (action) {
102
+ const actionBtn = document.createElement('button');
103
+ actionBtn.type = 'button';
104
+ actionBtn.className = cls('toastAction');
105
+ actionBtn.textContent = action.text;
106
+ actionBtn.addEventListener('click', () => {
107
+ action.onClick?.();
108
+ this._dismiss(toast);
109
+ });
110
+ toast.appendChild(actionBtn);
111
+ }
112
+
113
+ // Close button
114
+ if (closable) {
115
+ const closeBtn = document.createElement('button');
116
+ closeBtn.type = 'button';
117
+ closeBtn.className = cls('toastClose');
118
+ closeBtn.innerHTML = '<i class="fa-solid fa-xmark"></i>';
119
+ closeBtn.addEventListener('click', () => this._dismiss(toast));
120
+ toast.appendChild(closeBtn);
121
+ }
122
+
123
+ // Progress bar for auto-dismiss
124
+ if (duration > 0) {
125
+ const progress = document.createElement('div');
126
+ progress.className = cls('toastProgress');
127
+ progress.style.animationDuration = `${duration}ms`;
128
+ toast.appendChild(progress);
129
+ }
130
+
131
+ // Add to container
132
+ this._container.appendChild(toast);
133
+ this._toasts.push(toast);
134
+
135
+ // Trigger enter animation
136
+ requestAnimationFrame(() => {
137
+ toast.classList.add(cls('toastVisible'));
138
+ });
139
+
140
+ // Auto dismiss
141
+ if (duration > 0) {
142
+ toast._timeout = setTimeout(() => {
143
+ this._dismiss(toast);
144
+ }, duration);
145
+ }
146
+
147
+ return {
148
+ dismiss: () => this._dismiss(toast)
149
+ };
150
+ }
151
+
152
+ _dismiss(toast) {
153
+ if (!toast || !toast.parentNode) return;
154
+
155
+ if (toast._timeout) {
156
+ clearTimeout(toast._timeout);
157
+ }
158
+
159
+ toast.classList.remove(cls('toastVisible'));
160
+ toast.classList.add(cls('toastExiting'));
161
+
162
+ setTimeout(() => {
163
+ if (toast.parentNode) {
164
+ toast.parentNode.removeChild(toast);
165
+ }
166
+ this._toasts = this._toasts.filter(t => t !== toast);
167
+ }, 300);
168
+ }
169
+
170
+ _getIcon(variant, customIcon) {
171
+ if (customIcon) return `<i class="${customIcon}"></i>`;
172
+
173
+ const icons = {
174
+ success: '<i class="fa-solid fa-circle-check"></i>',
175
+ error: '<i class="fa-solid fa-circle-xmark"></i>',
176
+ warning: '<i class="fa-solid fa-triangle-exclamation"></i>',
177
+ info: '<i class="fa-solid fa-circle-info"></i>'
178
+ };
179
+
180
+ return icons[variant] || icons.info;
181
+ }
182
+
183
+ success(messageOrConfig, options = {}) {
184
+ const config = typeof messageOrConfig === 'string'
185
+ ? { message: messageOrConfig, ...options }
186
+ : messageOrConfig;
187
+ return this.show({ ...config, variant: 'success' });
188
+ }
189
+
190
+ error(messageOrConfig, options = {}) {
191
+ const config = typeof messageOrConfig === 'string'
192
+ ? { message: messageOrConfig, ...options }
193
+ : messageOrConfig;
194
+ return this.show({ ...config, variant: 'error' });
195
+ }
196
+
197
+ warning(messageOrConfig, options = {}) {
198
+ const config = typeof messageOrConfig === 'string'
199
+ ? { message: messageOrConfig, ...options }
200
+ : messageOrConfig;
201
+ return this.show({ ...config, variant: 'warning' });
202
+ }
203
+
204
+ info(messageOrConfig, options = {}) {
205
+ const config = typeof messageOrConfig === 'string'
206
+ ? { message: messageOrConfig, ...options }
207
+ : messageOrConfig;
208
+ return this.show({ ...config, variant: 'info' });
209
+ }
210
+
211
+ dismissAll() {
212
+ [...this._toasts].forEach(toast => this._dismiss(toast));
213
+ }
214
+ }
@@ -0,0 +1,15 @@
1
+ ez.define('EzDocs', {
2
+ eztype: 'EzComponent',
3
+ controller: 'EzDocsController',
4
+ cls: 'ez-docs',
5
+ items: [
6
+ {
7
+ eztype: 'EzDocsSidebar'
8
+ },
9
+ {
10
+ eztype: 'EzOutlet',
11
+ ref: 'docsOutlet',
12
+ cls: 'ez-docs-content'
13
+ }
14
+ ]
15
+ });