@fto-consult/expo-ui 6.85.3 → 6.85.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.85.3",
3
+ "version": "6.85.5",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -97,7 +97,7 @@ export const renderRowCell = (arg)=>{
97
97
  }
98
98
  hasC = true;
99
99
  renderedItems++;
100
- const suffix = renderedItems === maxItemsToRender && idSplit.length > maxItemsToRender ? <Label>...</Label> : null;
100
+ const suffix = renderedItems === maxItemsToRender && idSplit.length > maxItemsToRender ? <Label>...et {" "+idSplit.length.formatNumber()+" de plus"}</Label> : null;
101
101
  return suffix ? <>
102
102
  <TableLink
103
103
  key = {index}
@@ -191,6 +191,9 @@ export default class Filter extends AppComponent {
191
191
  }
192
192
  return value;
193
193
  }
194
+ isFilterSelect(){
195
+ return defaultStr(this.type,this.props.type).toLowerCase().includes("select");
196
+ }
194
197
  fireValueChanged (forceRun){
195
198
  if(this.willRunManually() && !forceRun) return;
196
199
  let {defaultValue:value,action,ignoreCase,operator} = this.state;
@@ -19,7 +19,7 @@ import DateLib from "$lib/date";
19
19
  * foreignKeyTable : la tableData dans laquelle effectuer les donées de la requêtes
20
20
  * foreignKeyLabel : Le libélé dans la table étrangère
21
21
  */
22
- const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyLabelRenderers,isStructData,getForeignKeyTable:cGetForeignKeyTable,prepareFilters:cPrepareFilters,bindUpsert2RemoveEvents,onAdd,showAdd:customShowAdd,canShowAdd,foreignKeyTable,fetchItemsPath,foreignKeyLabel,foreignKeyLabelIndex,dropdownActions,fields,fetchItems:customFetchItem,parseMangoQueries,mutateFetchedItems,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchOptions,...props},ref)=>{
22
+ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyLabelRenderers,onChange,isStructData,getForeignKeyTable:cGetForeignKeyTable,prepareFilters:cPrepareFilters,bindUpsert2RemoveEvents,onAdd,showAdd:customShowAdd,canShowAdd,foreignKeyTable,fetchItemsPath,foreignKeyLabel,foreignKeyLabelIndex,dropdownActions,fields,fetchItems:customFetchItem,parseMangoQueries,mutateFetchedItems,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchOptions,...props},ref)=>{
23
23
  props.data = defaultObj(props.data);
24
24
  const type = defaultStr(props.type)?.toLowerCase();
25
25
  isStructData = isStructData || type?.replaceAll("-","").replaceAll("_","").trim().contains("structdata");
@@ -90,6 +90,7 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyLabel
90
90
  delete fetchOptions.fields;
91
91
  }
92
92
  const foreignKeyColumnValue = props.defaultValue;
93
+ const defaultValueRef = React.useRef(props.multiple ? Object.toArray(foreignKeyColumnValue) : foreignKeyColumnValue);
93
94
  let isDisabled = defaultBool(props.disabled,props.readOnly,false);
94
95
  if(!isDisabled && props.readOnly === true){
95
96
  isDisabled = true;
@@ -111,6 +112,7 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyLabel
111
112
  fetchOptions.selector.$and.push({[foreignKeyColumn] : foreignKeyColumnValue})
112
113
  }
113
114
  }
115
+ const hasRefreshedRef = React.useRef(false);
114
116
  React.useEffect(()=>{
115
117
  context.refresh();
116
118
  if(bindUpsert2RemoveEvents !== false){
@@ -190,6 +192,7 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyLabel
190
192
  if(onFetchItems){
191
193
  onFetchItems({data:items,items,context,props});
192
194
  }
195
+ hasRefreshedRef.current = true;
193
196
  }).catch((e)=>{
194
197
  console.log(e," fetching list of data select table data ",foreignKeyColumn,foreignKeyTable)
195
198
  }).finally((e)=>{
@@ -281,6 +284,14 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyLabel
281
284
  showAdd = {showAdd}
282
285
  isLoading = {isLoading}
283
286
  dialogProps = {dialogProps}
287
+ onChange = {(...args)=>{
288
+ if(isFilter){
289
+ if(!hasRefreshedRef.current) return;
290
+ if(JSON.stringify(defaultValueRef.current) === JSON.stringify(args[0]?.value)) return;
291
+ defaultValueRef.current = args[0]?.value;
292
+ }
293
+ if(onChange) return onChange(...args);
294
+ }}
284
295
  ref = {ref}
285
296
  defaultValue = {foreignKeyColumnValue}
286
297
  dropdownActions = {dropdownActions}