@olenbetong/appframe-core 2.12.0 → 2.13.1

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.
@@ -100,13 +100,19 @@ const OPERATORS_BY_TYPE = {
100
100
  string: [...EQUALITY, ...STRING_CHECKS, ...LIST_CHECKS, ...RANGE, ...COMPARISONS],
101
101
  uniqueidentifier: [...EQUALITY, ...STRING_CHECKS, ...LIST_CHECKS, ...RANGE, ...COMPARISONS],
102
102
  };
103
- /** Default operator per field type. */
103
+ /**
104
+ * Default operator per field type.
105
+ *
106
+ * Text defaults to `contains` because a substring search is what people
107
+ * reach for when they type into a filter box without picking an operator —
108
+ * `beginswith` silently misses matches in the middle of the value.
109
+ */
104
110
  const DEFAULT_OPERATOR_BY_TYPE = {
105
111
  date: "equals",
106
112
  datetime: "equals",
107
113
  number: "equals",
108
114
  boolean: "istrue",
109
- string: "beginswith",
115
+ string: "contains",
110
116
  uniqueidentifier: "beginswith",
111
117
  };
112
118
  /**
@@ -29,7 +29,8 @@ describe("getOperatorsForField", () => {
29
29
  });
30
30
  describe("getDefaultOperator", () => {
31
31
  test.each([
32
- ["string", "beginswith"],
32
+ ["string", "contains"],
33
+ ["uniqueidentifier", "beginswith"],
33
34
  ["number", "equals"],
34
35
  ["date", "equals"],
35
36
  ["datetime", "equals"],
@@ -88,7 +88,7 @@ describe("createExpression", () => {
88
88
  expect(createExpression({ name: "Name", type: "string" })).toEqual({
89
89
  type: "expression",
90
90
  column: "Name",
91
- operator: "beginswith",
91
+ operator: "contains",
92
92
  value: "",
93
93
  valueType: "string",
94
94
  });
package/es/index.js CHANGED
@@ -19,4 +19,4 @@ export { UserSession };
19
19
  export { alert, ConfirmButtons, confirm, openAlertDialog, waitForDialog } from "./alert.js";
20
20
  export { getSettings, saveSettings } from "./settings.js";
21
21
  // oxlint-disable-next-line no-use-before-define -- this is injected build time
22
- export const version = "2.11.10";
22
+ export const version = "2.13.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-core",
3
- "version": "2.12.0",
3
+ "version": "2.13.1",
4
4
  "description": "Javascript libraries to utilize the Appframe framework",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -49,7 +49,8 @@ describe("getOperatorsForField", () => {
49
49
 
50
50
  describe("getDefaultOperator", () => {
51
51
  test.each([
52
- ["string", "beginswith"],
52
+ ["string", "contains"],
53
+ ["uniqueidentifier", "beginswith"],
53
54
  ["number", "equals"],
54
55
  ["date", "equals"],
55
56
  ["datetime", "equals"],
@@ -112,13 +112,19 @@ const OPERATORS_BY_TYPE: Record<FilterFieldType, FilterOperator[]> = {
112
112
  uniqueidentifier: [...EQUALITY, ...STRING_CHECKS, ...LIST_CHECKS, ...RANGE, ...COMPARISONS],
113
113
  };
114
114
 
115
- /** Default operator per field type. */
115
+ /**
116
+ * Default operator per field type.
117
+ *
118
+ * Text defaults to `contains` because a substring search is what people
119
+ * reach for when they type into a filter box without picking an operator —
120
+ * `beginswith` silently misses matches in the middle of the value.
121
+ */
116
122
  const DEFAULT_OPERATOR_BY_TYPE: Record<FilterFieldType, FilterOperator> = {
117
123
  date: "equals",
118
124
  datetime: "equals",
119
125
  number: "equals",
120
126
  boolean: "istrue",
121
- string: "beginswith",
127
+ string: "contains",
122
128
  uniqueidentifier: "beginswith",
123
129
  };
124
130
 
@@ -135,7 +135,7 @@ describe("createExpression", () => {
135
135
  expect(createExpression({ name: "Name", type: "string" })).toEqual({
136
136
  type: "expression",
137
137
  column: "Name",
138
- operator: "beginswith",
138
+ operator: "contains",
139
139
  value: "",
140
140
  valueType: "string",
141
141
  });