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,161 @@
1
+ import styles from './EzTextarea.module.scss';
2
+ import { cx } from '../../utils/cssModules.js';
3
+ import { EzBaseComponent, EzBaseComponentConfig } from '../EzBaseComponent.js';
4
+
5
+ const cls = cx(styles);
6
+
7
+ export interface EzTextareaConfig extends EzBaseComponentConfig {
8
+ size?: 'sm' | 'lg';
9
+ disabled?: boolean;
10
+ readonly?: boolean;
11
+ value?: string;
12
+ name?: string;
13
+ formData?: string;
14
+ placeholder?: string;
15
+ rows?: number;
16
+ minRows?: number;
17
+ maxRows?: number;
18
+ maxLength?: number;
19
+ resize?: boolean;
20
+ autoResize?: boolean;
21
+ showCount?: boolean;
22
+ }
23
+
24
+ export class EzTextarea extends EzBaseComponent {
25
+ declare config: EzTextareaConfig;
26
+
27
+ private _wrapper: HTMLDivElement | null = null;
28
+ private _textarea: HTMLTextAreaElement | null = null;
29
+ private _error: HTMLDivElement | null = null;
30
+ private _counter: HTMLDivElement | null = null;
31
+
32
+ render(): HTMLDivElement {
33
+ const cfg = this.config;
34
+
35
+ const wrapper = document.createElement('div');
36
+ wrapper.className = cls(
37
+ 'textareaGroup',
38
+ cfg.size,
39
+ cfg.disabled && 'disabled',
40
+ cfg.resize === false && 'noResize',
41
+ cfg.rows && 'hasRows'
42
+ );
43
+
44
+ const textarea = document.createElement('textarea');
45
+ textarea.className = cls('textarea');
46
+ textarea.placeholder = cfg.placeholder || '';
47
+ if (cfg.value !== undefined) textarea.value = cfg.value;
48
+
49
+ if (cfg.rows) textarea.rows = cfg.rows;
50
+ const paddingY = cfg.size === 'sm' ? 16 : cfg.size === 'lg' ? 24 : 20;
51
+ if (cfg.minRows) textarea.style.minHeight = `calc(${cfg.minRows * 1.5}em + ${paddingY}px)`;
52
+ if (cfg.maxRows) textarea.style.maxHeight = `calc(${cfg.maxRows * 1.5}em + ${paddingY}px)`;
53
+ if (cfg.maxLength) textarea.maxLength = cfg.maxLength;
54
+ if (cfg.disabled) textarea.disabled = true;
55
+ if (cfg.readonly) textarea.readOnly = true;
56
+
57
+ if (cfg.name && cfg.formData) {
58
+ this.config.bind = `${cfg.formData}.${cfg.name}`;
59
+ }
60
+
61
+ if (cfg.name) {
62
+ textarea.setAttribute('data-ez-field', cfg.name);
63
+ }
64
+
65
+ this.applyCommonBindings(textarea);
66
+
67
+ const onChange = this._createOnChangeHandler();
68
+
69
+ textarea.addEventListener('input', e => {
70
+ if (onChange) {
71
+ onChange((e.target as HTMLTextAreaElement).value);
72
+ }
73
+
74
+ if (cfg.autoResize) {
75
+ this._autoResize(textarea);
76
+ }
77
+
78
+ if (cfg.showCount && this._counter) {
79
+ this._updateCounter((e.target as HTMLTextAreaElement).value.length);
80
+ }
81
+ });
82
+
83
+ wrapper.appendChild(textarea);
84
+
85
+ if (cfg.showCount) {
86
+ const counter = document.createElement('div');
87
+ counter.className = cls('counter');
88
+ this._counter = counter;
89
+ this._updateCounter(0);
90
+ wrapper.appendChild(counter);
91
+ }
92
+
93
+ const error = document.createElement('div');
94
+ error.className = cls('fieldError');
95
+ wrapper.appendChild(error);
96
+
97
+ this._wrapper = wrapper;
98
+ this._textarea = textarea;
99
+ this._error = error;
100
+
101
+ if (cfg.autoResize) {
102
+ requestAnimationFrame(() => this._autoResize(textarea));
103
+ }
104
+
105
+ return wrapper;
106
+ }
107
+
108
+ private _autoResize(textarea: HTMLTextAreaElement): void {
109
+ textarea.style.height = 'auto';
110
+ textarea.style.height = textarea.scrollHeight + 'px';
111
+ }
112
+
113
+ private _updateCounter(length: number): void {
114
+ const cfg = this.config;
115
+ if (!this._counter) return;
116
+
117
+ if (cfg.maxLength) {
118
+ this._counter.textContent = `${length} / ${cfg.maxLength}`;
119
+ this._counter.classList.toggle(cls('counterWarning'), length > cfg.maxLength * 0.9);
120
+ this._counter.classList.toggle(cls('counterError'), length >= cfg.maxLength);
121
+ } else {
122
+ this._counter.textContent = String(length);
123
+ }
124
+ }
125
+
126
+ getValue(): string {
127
+ return this._textarea?.value ?? '';
128
+ }
129
+
130
+ setValue(value: string): void {
131
+ if (this._textarea) {
132
+ this._textarea.value = value || '';
133
+ if (this.config.autoResize) {
134
+ this._autoResize(this._textarea);
135
+ }
136
+ if (this.config.showCount && this._counter) {
137
+ this._updateCounter(this._textarea.value.length);
138
+ }
139
+ }
140
+ }
141
+
142
+ focus(): void {
143
+ this._textarea?.focus();
144
+ }
145
+
146
+ showError(message: string): void {
147
+ if (this._wrapper && this._error) {
148
+ this._wrapper.classList.add(cls('hasError'));
149
+ this._error.classList.add(cls('fieldErrorVisible'));
150
+ this._error.textContent = message;
151
+ }
152
+ }
153
+
154
+ clearError(): void {
155
+ if (this._wrapper && this._error) {
156
+ this._wrapper.classList.remove(cls('hasError'));
157
+ this._error.classList.remove(cls('fieldErrorVisible'));
158
+ this._error.textContent = '';
159
+ }
160
+ }
161
+ }
@@ -0,0 +1,282 @@
1
+ .timepicker {
2
+ position: relative;
3
+ display: inline-flex;
4
+ flex-direction: column;
5
+ gap: 4px;
6
+ }
7
+
8
+ .isOpen {
9
+ .trigger {
10
+ border-color: var(--ez-primary, #2563eb);
11
+ box-shadow: 0 0 0 2px var(--ez-primary-light, rgba(37, 99, 235, 0.15));
12
+ }
13
+ }
14
+
15
+ .trigger {
16
+ display: flex;
17
+ align-items: center;
18
+ gap: 8px;
19
+
20
+ background: var(--ez-input-bg, #ffffff);
21
+ border: 1px solid var(--ez-input-border, #e2e8f0);
22
+ border-radius: var(--ez-radius-md, 6px);
23
+
24
+ padding: 0 12px;
25
+ height: 36px;
26
+ cursor: pointer;
27
+
28
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
29
+
30
+ &:hover {
31
+ border-color: var(--ez-text-tertiary, #94a3b8);
32
+ }
33
+ }
34
+
35
+ .input {
36
+ flex: 1;
37
+ min-width: 0;
38
+ height: 100%;
39
+ padding: 0;
40
+
41
+ font-family: inherit;
42
+ font-size: 13px;
43
+ color: var(--ez-input-text, #1e293b);
44
+
45
+ background: transparent;
46
+ border: none;
47
+ outline: none;
48
+ cursor: pointer;
49
+
50
+ &::placeholder {
51
+ color: var(--ez-input-placeholder, #94a3b8);
52
+ }
53
+ }
54
+
55
+ .icon {
56
+ color: var(--ez-text-tertiary, #94a3b8);
57
+ font-size: 14px;
58
+ flex-shrink: 0;
59
+ }
60
+
61
+ .dropdown {
62
+ position: fixed;
63
+ z-index: 1000;
64
+
65
+ background: var(--ez-surface-secondary, #ffffff);
66
+ border: 1px solid var(--ez-border, #e2e8f0);
67
+ border-radius: var(--ez-radius-md, 8px);
68
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
69
+
70
+ padding: 12px;
71
+
72
+ opacity: 0;
73
+ visibility: hidden;
74
+ transition: opacity 0.15s ease, visibility 0.15s ease;
75
+ }
76
+
77
+ .pickerContainer {
78
+ display: flex;
79
+ align-items: stretch;
80
+ gap: 4px;
81
+ }
82
+
83
+ .column {
84
+ display: flex;
85
+ flex-direction: column;
86
+ min-width: 50px;
87
+ }
88
+
89
+ .columnList {
90
+ height: 180px;
91
+ overflow-y: auto;
92
+ scroll-behavior: smooth;
93
+
94
+ border: 1px solid var(--ez-border, #e2e8f0);
95
+ border-radius: var(--ez-radius-sm, 4px);
96
+ background: var(--ez-surface-primary, #f8fafc);
97
+
98
+ &::-webkit-scrollbar {
99
+ width: 4px;
100
+ }
101
+
102
+ &::-webkit-scrollbar-track {
103
+ background: transparent;
104
+ }
105
+
106
+ &::-webkit-scrollbar-thumb {
107
+ background: var(--ez-border, #e2e8f0);
108
+ border-radius: 2px;
109
+ }
110
+ }
111
+
112
+ .columnItem {
113
+ display: flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+
117
+ height: 36px;
118
+ padding: 0 8px;
119
+
120
+ font-size: 14px;
121
+ font-weight: 500;
122
+ color: var(--ez-text-primary, #1e293b);
123
+
124
+ cursor: pointer;
125
+ transition: all 0.15s ease;
126
+
127
+ &:hover:not(.disabled):not(.selected) {
128
+ background: var(--ez-surface-secondary, #ffffff);
129
+ }
130
+
131
+ &.selected {
132
+ background: var(--ez-primary, #2563eb);
133
+ color: #ffffff;
134
+ }
135
+
136
+ &.disabled {
137
+ color: var(--ez-text-disabled, #cbd5e1);
138
+ cursor: not-allowed;
139
+ }
140
+ }
141
+
142
+ .separator {
143
+ display: flex;
144
+ align-items: center;
145
+ justify-content: center;
146
+
147
+ font-size: 20px;
148
+ font-weight: 600;
149
+ color: var(--ez-text-tertiary, #94a3b8);
150
+ padding: 0 4px;
151
+ }
152
+
153
+ .periodColumn {
154
+ min-width: 45px;
155
+ margin-left: 8px;
156
+
157
+ .columnList {
158
+ height: auto;
159
+ }
160
+
161
+ .periodItem {
162
+ height: 40px;
163
+ font-size: 13px;
164
+ }
165
+ }
166
+
167
+ .footer {
168
+ display: flex;
169
+ justify-content: flex-end;
170
+ gap: 8px;
171
+ margin-top: 12px;
172
+ padding-top: 12px;
173
+ border-top: 1px solid var(--ez-border, #e2e8f0);
174
+ }
175
+
176
+ .nowBtn,
177
+ .clearBtn,
178
+ .okBtn {
179
+ padding: 6px 12px;
180
+
181
+ font-size: 12px;
182
+ font-weight: 500;
183
+
184
+ background: transparent;
185
+ border: 1px solid var(--ez-border, #e2e8f0);
186
+ border-radius: var(--ez-radius-sm, 4px);
187
+
188
+ color: var(--ez-text-secondary, #64748b);
189
+ cursor: pointer;
190
+ transition: all 0.15s ease;
191
+
192
+ &:hover {
193
+ background: var(--ez-surface-primary, #f1f5f9);
194
+ border-color: var(--ez-text-tertiary, #94a3b8);
195
+ }
196
+ }
197
+
198
+ .okBtn {
199
+ background: var(--ez-primary, #2563eb);
200
+ border-color: var(--ez-primary, #2563eb);
201
+ color: #ffffff;
202
+
203
+ &:hover {
204
+ background: var(--ez-primary-dark, #1d4ed8);
205
+ border-color: var(--ez-primary-dark, #1d4ed8);
206
+ }
207
+ }
208
+
209
+ // Disabled state
210
+ .disabled {
211
+ .trigger {
212
+ background: var(--ez-surface-primary, #f8fafc);
213
+ cursor: not-allowed;
214
+
215
+ &:hover {
216
+ border-color: var(--ez-input-border, #e2e8f0);
217
+ }
218
+ }
219
+
220
+ .input {
221
+ color: var(--ez-text-tertiary, #94a3b8);
222
+ cursor: not-allowed;
223
+ }
224
+
225
+ .icon {
226
+ opacity: 0.5;
227
+ }
228
+ }
229
+
230
+ // Error state
231
+ .hasError {
232
+ .trigger {
233
+ border-color: var(--ez-danger, #dc2626);
234
+
235
+ &:focus-within {
236
+ border-color: var(--ez-danger, #dc2626);
237
+ box-shadow: 0 0 0 2px var(--ez-danger-light, rgba(220, 38, 38, 0.15));
238
+ }
239
+ }
240
+ }
241
+
242
+ .fieldError {
243
+ display: none;
244
+ font-size: 12px;
245
+ color: var(--ez-danger, #dc2626);
246
+ padding-left: 2px;
247
+ }
248
+
249
+ .fieldErrorVisible {
250
+ display: block;
251
+ }
252
+
253
+ // Sizes
254
+ .sm {
255
+ .trigger {
256
+ height: 30px;
257
+ padding: 0 10px;
258
+ }
259
+
260
+ .input {
261
+ font-size: 12px;
262
+ }
263
+
264
+ .icon {
265
+ font-size: 12px;
266
+ }
267
+ }
268
+
269
+ .lg {
270
+ .trigger {
271
+ height: 44px;
272
+ padding: 0 14px;
273
+ }
274
+
275
+ .input {
276
+ font-size: 14px;
277
+ }
278
+
279
+ .icon {
280
+ font-size: 16px;
281
+ }
282
+ }