inviton-powerduck 0.0.129 → 0.0.130

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.
@@ -38,7 +38,10 @@ export default class LocalizedValueHelper {
38
38
  }
39
39
 
40
40
  for (const propKey in value) {
41
- return value[propKey];
41
+ const val = value[propKey];
42
+ if (val?.length > 0) {
43
+ return val;
44
+ }
42
45
  }
43
46
 
44
47
  return null as any;
@@ -891,7 +891,7 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
891
891
  }
892
892
  }
893
893
 
894
- markSelection(): void {
894
+ markSelection (): void {
895
895
  const mySelf = this;
896
896
  const escapeRegExp = function (string) {
897
897
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
@@ -909,26 +909,55 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
909
909
  };
910
910
 
911
911
  let regexBuilder = '';
912
- const markArr: string[] = [];
912
+ const markArr = [];
913
913
  if (this.filterArr != null) {
914
914
  this.filterArr.forEach((filterItem) => {
915
915
  if (regexBuilder.length > 0) {
916
916
  regexBuilder += '|';
917
917
  }
918
918
 
919
+ const columnId = filterItem.PropertyName?.toLowerCase();
920
+ const tds = Array.from($(mySelf.$el).find(`td.dt-col-${columnId}`));
921
+ if (tds == null || tds.length == 0) {
922
+ return;
923
+ }
924
+
919
925
  (getValueArr(filterItem) || []).forEach((filterValue) => {
920
- markArr.push(escapeRegExp(filterValue));
926
+ markArr.push({
927
+ value: escapeRegExp(filterValue),
928
+ elements: tds,
929
+ });
921
930
  });
922
931
  });
923
932
  }
924
933
 
925
934
  if (!isNullOrEmpty(this.fullTextQuery)) {
926
- regexBuilder += escapeRegExp(this.fullTextQuery);
935
+ const value = escapeRegExp(this.fullTextQuery);
936
+ const tds = Array.from($(mySelf.$el).find(`td`));
937
+ regexBuilder += value;
938
+
939
+ markArr.push({
940
+ value,
941
+ elements: tds,
942
+ });
927
943
  }
928
944
 
929
945
  if (DataTableConfig.filterMarking) {
930
946
  this.unmarkSelection(() => {
931
- mySelf.markInstance.mark(markArr);
947
+ for (const item of markArr) {
948
+ this.markInstance.mark(item.value, {
949
+ filter: (node) => {
950
+ const parentTd = $(node).closest('td')[0];
951
+ if (!parentTd) {
952
+ return false;
953
+ }
954
+
955
+ const matchesColumn = item.elements?.some(el => parentTd?.isEqualNode(el));
956
+ const matchesText = parentTd?.textContent?.toLowerCase().includes(item.value.toLowerCase());
957
+ return matchesColumn && matchesText;
958
+ }
959
+ });
960
+ }
932
961
  });
933
962
  }
934
963
  }
@@ -40,6 +40,7 @@ class LocalizedStringWysiwigComponent extends TsxComponent<LocalizedStringInputA
40
40
  @Prop() appendClicked: () => void;
41
41
  @Prop() prependClicked: () => void;
42
42
  currentValue: ILocalizedText = null;
43
+ editorHeight: number = null;
43
44
 
44
45
  raiseChangeEvent(newValue: ILocalizedText): void {
45
46
  this.populateValidationDeclaration();
@@ -59,6 +60,10 @@ class LocalizedStringWysiwigComponent extends TsxComponent<LocalizedStringInputA
59
60
  this.raiseChangeEvent(value);
60
61
  }
61
62
 
63
+ onEditorResized (height: number): void {
64
+ this.editorHeight = height;
65
+ }
66
+
62
67
  getActualValue(lang: Language, value: ILocalizedText): string {
63
68
  if (value == null) {
64
69
  return null;
@@ -104,6 +109,8 @@ class LocalizedStringWysiwigComponent extends TsxComponent<LocalizedStringInputA
104
109
  key={lang.id}
105
110
  wrap={false}
106
111
  resizable={this.resizable}
112
+ initialHeight={this.editorHeight}
113
+ onResized={this.onEditorResized}
107
114
  label={null}
108
115
  value={this.getActualValue(lang.id, this.value)}
109
116
  changed={(e) => {
@@ -32,6 +32,8 @@ interface WysiwigEditorArgs extends FormItemWrapperArgs {
32
32
  useCommonUpload?: boolean;
33
33
  uploadPluginArgs?: () => any | any;
34
34
  resizable?: boolean;
35
+ initialHeight?: number;
36
+ onResized?: (height: number) => void;
35
37
  changed: (newValue: string) => void;
36
38
  }
37
39
 
@@ -56,6 +58,8 @@ class WysiwigEditorComponent extends TsxComponent<WysiwigEditorArgs> implements
56
58
  @Prop() appendClicked: () => void;
57
59
  @Prop() prependClicked: () => void;
58
60
  @Prop() changed: (newValue: string) => void;
61
+ @Prop() initialHeight: number = null;
62
+ @Prop() onResized?: (height: number) => void;
59
63
  @Prop({ default: true }) resizable: boolean;
60
64
  skipTrigger: boolean = false;
61
65
 
@@ -160,6 +164,25 @@ class WysiwigEditorComponent extends TsxComponent<WysiwigEditorArgs> implements
160
164
  innerEditor.addClass('vertical-resize');
161
165
  }
162
166
 
167
+ if (this.initialHeight) {
168
+ innerEditor.css('height', `${this.initialHeight}px`);
169
+ }
170
+
171
+ let lastNotifiedHeight = this.initialHeight || null;
172
+ if (this.onResized != null && this.resizable) {
173
+ const resizeObserver = new ResizeObserver((entries) => {
174
+ for (const entry of entries) {
175
+ const height = entry?.contentRect?.height;
176
+ if (height > 0 && (lastNotifiedHeight == null || Math.abs(height - lastNotifiedHeight) > 2)) { // To keep height stable
177
+ lastNotifiedHeight = height;
178
+ this.onResized(height);
179
+ }
180
+ }
181
+ });
182
+
183
+ resizeObserver.observe(innerEditor[0]);
184
+ }
185
+
163
186
  innerEditor.on('click', (e) => {
164
187
  const clickTarget = e.target;
165
188
  if (clickTarget != null && clickTarget.nodeName == 'IMG') {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.129",
4
+ "version": "0.0.130",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",