@fctc/widget-logic 1.1.8 → 1.1.10
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/dist/index.d.mts +88 -7
- package/dist/index.d.ts +88 -7
- package/dist/index.js +324 -56
- package/dist/index.mjs +334 -56
- package/package.json +1 -2
package/dist/index.d.mts
CHANGED
|
@@ -3,9 +3,6 @@ export { CloseIcon, EyeIcon, LoadingIcon } from './icons.mjs';
|
|
|
3
3
|
import { IInputFieldProps, ValuePropsType } from './types.mjs';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ChangeEvent } from 'react';
|
|
6
|
-
import day from 'react-datepicker/dist/day';
|
|
7
|
-
import month from 'react-datepicker/dist/month';
|
|
8
|
-
import year from 'react-datepicker/dist/year';
|
|
9
6
|
import moment from 'moment';
|
|
10
7
|
export { API_APP_URL, API_PRESCHOOL_URL, STORAGES, combineContexts, convertFieldsToArray, countSum, getDateRange, languages, mergeButtons, setStorageItemAsync, useGetRowIds, useStorageState } from './utils.mjs';
|
|
11
8
|
import '@tanstack/react-query';
|
|
@@ -187,9 +184,6 @@ declare const dateFieldController: (props: IDateFieldProps) => {
|
|
|
187
184
|
customValidateMinMax: (date: any) => string | false;
|
|
188
185
|
minNowValue: boolean | moment.Moment | null;
|
|
189
186
|
maxNowValue: boolean | moment.Moment | null;
|
|
190
|
-
year: typeof year;
|
|
191
|
-
month: typeof month;
|
|
192
|
-
day: typeof day;
|
|
193
187
|
};
|
|
194
188
|
|
|
195
189
|
declare const copyLinkButtonController: (props: IInputFieldProps) => {
|
|
@@ -219,4 +213,91 @@ declare const binaryFieldController: (props: IInputFieldProps) => {
|
|
|
219
213
|
getImageBase64WithMimeType: (base64: any) => string | null;
|
|
220
214
|
};
|
|
221
215
|
|
|
222
|
-
|
|
216
|
+
interface ITableBodyProps {
|
|
217
|
+
checkedAll: any;
|
|
218
|
+
checkboxRef: any;
|
|
219
|
+
setIsAutoSelect: any;
|
|
220
|
+
selectedRowKeys: any;
|
|
221
|
+
row: any;
|
|
222
|
+
isAutoSelect: any;
|
|
223
|
+
selectedRowKeysRef: any;
|
|
224
|
+
onClickRow: any;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare const tableBodyController: (props: ITableBodyProps) => {
|
|
228
|
+
handleCheckBoxSingle: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
229
|
+
checked: any;
|
|
230
|
+
handleClickRow: (col: any, row: any) => void;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
interface ITableHeadProps {
|
|
234
|
+
typeTable: string;
|
|
235
|
+
rows: any[];
|
|
236
|
+
selectedRowKeysRef: any;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
declare const tableHeadController: (props: ITableHeadProps) => {
|
|
240
|
+
handleCheckBoxAll: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
interface ITableProps {
|
|
244
|
+
data: {
|
|
245
|
+
fields: any[];
|
|
246
|
+
records: any[];
|
|
247
|
+
dataModel: {
|
|
248
|
+
[fieldName: string]: {
|
|
249
|
+
string?: string;
|
|
250
|
+
[key: string]: any;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
context: any;
|
|
254
|
+
typeTable?: 'list' | 'group' | 'calendar';
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
interface ISelctionStateProps {
|
|
258
|
+
typeTable?: string;
|
|
259
|
+
tableRef: any;
|
|
260
|
+
rows?: any[];
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
declare const tableController: ({ data }: ITableProps) => {
|
|
264
|
+
rows: any[];
|
|
265
|
+
columns: any;
|
|
266
|
+
onToggleColumnOptional: (item: any) => void;
|
|
267
|
+
typeTable: "list" | "calendar" | "group" | undefined;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
declare const tableGroupController: (props: any) => {
|
|
271
|
+
handleExpandChildGroup: () => void;
|
|
272
|
+
colEmptyGroup: {
|
|
273
|
+
fromStart: number;
|
|
274
|
+
fromEnd: number;
|
|
275
|
+
};
|
|
276
|
+
leftPadding: string;
|
|
277
|
+
isShowGroup: boolean;
|
|
278
|
+
isQueryFetched: boolean;
|
|
279
|
+
nameGroupWithCount: string;
|
|
280
|
+
columns: any;
|
|
281
|
+
row: any;
|
|
282
|
+
isPlaceholderData: boolean;
|
|
283
|
+
columnsGroup: any;
|
|
284
|
+
indexRow: any;
|
|
285
|
+
rowsGroup: any[];
|
|
286
|
+
model: any;
|
|
287
|
+
viewData: any;
|
|
288
|
+
renderField: any;
|
|
289
|
+
level: any;
|
|
290
|
+
specification: any;
|
|
291
|
+
context: any;
|
|
292
|
+
checkedAll: any;
|
|
293
|
+
isDisplayCheckbox: any;
|
|
294
|
+
isAutoSelect: any;
|
|
295
|
+
setIsAutoSelect: any;
|
|
296
|
+
selectedRowKeysRef: any;
|
|
297
|
+
initVal: Record<string, any>;
|
|
298
|
+
dataResponse: any;
|
|
299
|
+
pageGroup: any;
|
|
300
|
+
setPageGroup: react.Dispatch<any>;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export { IInputFieldProps, type ISelctionStateProps, type ITableBodyProps, type ITableHeadProps, type ITableProps, ValuePropsType, binaryFieldController, colorFieldController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, floatController, floatTimeFiledController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, statusDropdownController, tableBodyController, tableController, tableGroupController, tableHeadController };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,6 @@ export { CloseIcon, EyeIcon, LoadingIcon } from './icons.js';
|
|
|
3
3
|
import { IInputFieldProps, ValuePropsType } from './types.js';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ChangeEvent } from 'react';
|
|
6
|
-
import day from 'react-datepicker/dist/day';
|
|
7
|
-
import month from 'react-datepicker/dist/month';
|
|
8
|
-
import year from 'react-datepicker/dist/year';
|
|
9
6
|
import moment from 'moment';
|
|
10
7
|
export { API_APP_URL, API_PRESCHOOL_URL, STORAGES, combineContexts, convertFieldsToArray, countSum, getDateRange, languages, mergeButtons, setStorageItemAsync, useGetRowIds, useStorageState } from './utils.js';
|
|
11
8
|
import '@tanstack/react-query';
|
|
@@ -187,9 +184,6 @@ declare const dateFieldController: (props: IDateFieldProps) => {
|
|
|
187
184
|
customValidateMinMax: (date: any) => string | false;
|
|
188
185
|
minNowValue: boolean | moment.Moment | null;
|
|
189
186
|
maxNowValue: boolean | moment.Moment | null;
|
|
190
|
-
year: typeof year;
|
|
191
|
-
month: typeof month;
|
|
192
|
-
day: typeof day;
|
|
193
187
|
};
|
|
194
188
|
|
|
195
189
|
declare const copyLinkButtonController: (props: IInputFieldProps) => {
|
|
@@ -219,4 +213,91 @@ declare const binaryFieldController: (props: IInputFieldProps) => {
|
|
|
219
213
|
getImageBase64WithMimeType: (base64: any) => string | null;
|
|
220
214
|
};
|
|
221
215
|
|
|
222
|
-
|
|
216
|
+
interface ITableBodyProps {
|
|
217
|
+
checkedAll: any;
|
|
218
|
+
checkboxRef: any;
|
|
219
|
+
setIsAutoSelect: any;
|
|
220
|
+
selectedRowKeys: any;
|
|
221
|
+
row: any;
|
|
222
|
+
isAutoSelect: any;
|
|
223
|
+
selectedRowKeysRef: any;
|
|
224
|
+
onClickRow: any;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare const tableBodyController: (props: ITableBodyProps) => {
|
|
228
|
+
handleCheckBoxSingle: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
229
|
+
checked: any;
|
|
230
|
+
handleClickRow: (col: any, row: any) => void;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
interface ITableHeadProps {
|
|
234
|
+
typeTable: string;
|
|
235
|
+
rows: any[];
|
|
236
|
+
selectedRowKeysRef: any;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
declare const tableHeadController: (props: ITableHeadProps) => {
|
|
240
|
+
handleCheckBoxAll: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
interface ITableProps {
|
|
244
|
+
data: {
|
|
245
|
+
fields: any[];
|
|
246
|
+
records: any[];
|
|
247
|
+
dataModel: {
|
|
248
|
+
[fieldName: string]: {
|
|
249
|
+
string?: string;
|
|
250
|
+
[key: string]: any;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
context: any;
|
|
254
|
+
typeTable?: 'list' | 'group' | 'calendar';
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
interface ISelctionStateProps {
|
|
258
|
+
typeTable?: string;
|
|
259
|
+
tableRef: any;
|
|
260
|
+
rows?: any[];
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
declare const tableController: ({ data }: ITableProps) => {
|
|
264
|
+
rows: any[];
|
|
265
|
+
columns: any;
|
|
266
|
+
onToggleColumnOptional: (item: any) => void;
|
|
267
|
+
typeTable: "list" | "calendar" | "group" | undefined;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
declare const tableGroupController: (props: any) => {
|
|
271
|
+
handleExpandChildGroup: () => void;
|
|
272
|
+
colEmptyGroup: {
|
|
273
|
+
fromStart: number;
|
|
274
|
+
fromEnd: number;
|
|
275
|
+
};
|
|
276
|
+
leftPadding: string;
|
|
277
|
+
isShowGroup: boolean;
|
|
278
|
+
isQueryFetched: boolean;
|
|
279
|
+
nameGroupWithCount: string;
|
|
280
|
+
columns: any;
|
|
281
|
+
row: any;
|
|
282
|
+
isPlaceholderData: boolean;
|
|
283
|
+
columnsGroup: any;
|
|
284
|
+
indexRow: any;
|
|
285
|
+
rowsGroup: any[];
|
|
286
|
+
model: any;
|
|
287
|
+
viewData: any;
|
|
288
|
+
renderField: any;
|
|
289
|
+
level: any;
|
|
290
|
+
specification: any;
|
|
291
|
+
context: any;
|
|
292
|
+
checkedAll: any;
|
|
293
|
+
isDisplayCheckbox: any;
|
|
294
|
+
isAutoSelect: any;
|
|
295
|
+
setIsAutoSelect: any;
|
|
296
|
+
selectedRowKeysRef: any;
|
|
297
|
+
initVal: Record<string, any>;
|
|
298
|
+
dataResponse: any;
|
|
299
|
+
pageGroup: any;
|
|
300
|
+
setPageGroup: react.Dispatch<any>;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export { IInputFieldProps, type ISelctionStateProps, type ITableBodyProps, type ITableHeadProps, type ITableProps, ValuePropsType, binaryFieldController, colorFieldController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, floatController, floatTimeFiledController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, statusDropdownController, tableBodyController, tableController, tableGroupController, tableHeadController };
|
package/dist/index.js
CHANGED
|
@@ -641,8 +641,8 @@ var require_moment = __commonJS({
|
|
|
641
641
|
tokens[token2](input, config._a, config, token2);
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
|
-
function isLeapYear(
|
|
645
|
-
return
|
|
644
|
+
function isLeapYear(year) {
|
|
645
|
+
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
646
646
|
}
|
|
647
647
|
var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8;
|
|
648
648
|
addFormatToken("Y", 0, 0, function() {
|
|
@@ -670,8 +670,8 @@ var require_moment = __commonJS({
|
|
|
670
670
|
addParseToken("Y", function(input, array) {
|
|
671
671
|
array[YEAR] = parseInt(input, 10);
|
|
672
672
|
});
|
|
673
|
-
function daysInYear(
|
|
674
|
-
return isLeapYear(
|
|
673
|
+
function daysInYear(year) {
|
|
674
|
+
return isLeapYear(year) ? 366 : 365;
|
|
675
675
|
}
|
|
676
676
|
hooks.parseTwoDigitYear = function(input) {
|
|
677
677
|
return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3);
|
|
@@ -718,7 +718,7 @@ var require_moment = __commonJS({
|
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
720
|
function set$1(mom, unit, value) {
|
|
721
|
-
var d, isUTC,
|
|
721
|
+
var d, isUTC, year, month, date;
|
|
722
722
|
if (!mom.isValid() || isNaN(value)) {
|
|
723
723
|
return;
|
|
724
724
|
}
|
|
@@ -745,11 +745,11 @@ var require_moment = __commonJS({
|
|
|
745
745
|
default:
|
|
746
746
|
return;
|
|
747
747
|
}
|
|
748
|
-
|
|
749
|
-
|
|
748
|
+
year = value;
|
|
749
|
+
month = mom.month();
|
|
750
750
|
date = mom.date();
|
|
751
|
-
date = date === 29 &&
|
|
752
|
-
void (isUTC ? d.setUTCFullYear(
|
|
751
|
+
date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
|
|
752
|
+
void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date));
|
|
753
753
|
}
|
|
754
754
|
function stringGet(units) {
|
|
755
755
|
units = normalizeUnits(units);
|
|
@@ -790,13 +790,13 @@ var require_moment = __commonJS({
|
|
|
790
790
|
return -1;
|
|
791
791
|
};
|
|
792
792
|
}
|
|
793
|
-
function daysInMonth(
|
|
794
|
-
if (isNaN(
|
|
793
|
+
function daysInMonth(year, month) {
|
|
794
|
+
if (isNaN(year) || isNaN(month)) {
|
|
795
795
|
return NaN;
|
|
796
796
|
}
|
|
797
|
-
var modMonth = mod(
|
|
798
|
-
|
|
799
|
-
return modMonth === 1 ? isLeapYear(
|
|
797
|
+
var modMonth = mod(month, 12);
|
|
798
|
+
year += (month - modMonth) / 12;
|
|
799
|
+
return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
|
|
800
800
|
}
|
|
801
801
|
addFormatToken("M", ["MM", 2], "Mo", function() {
|
|
802
802
|
return this.month() + 1;
|
|
@@ -819,9 +819,9 @@ var require_moment = __commonJS({
|
|
|
819
819
|
array[MONTH] = toInt(input) - 1;
|
|
820
820
|
});
|
|
821
821
|
addParseToken(["MMM", "MMMM"], function(input, array, config, token2) {
|
|
822
|
-
var
|
|
823
|
-
if (
|
|
824
|
-
array[MONTH] =
|
|
822
|
+
var month = config._locale.monthsParse(input, token2, config._strict);
|
|
823
|
+
if (month != null) {
|
|
824
|
+
array[MONTH] = month;
|
|
825
825
|
} else {
|
|
826
826
|
getParsingFlags(config).invalidMonth = input;
|
|
827
827
|
}
|
|
@@ -931,9 +931,9 @@ var require_moment = __commonJS({
|
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
}
|
|
934
|
-
var
|
|
935
|
-
date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(),
|
|
936
|
-
void (mom._isUTC ? mom._d.setUTCMonth(
|
|
934
|
+
var month = value, date = mom.date();
|
|
935
|
+
date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
|
|
936
|
+
void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date));
|
|
937
937
|
return mom;
|
|
938
938
|
}
|
|
939
939
|
function getSetMonth(value) {
|
|
@@ -1036,20 +1036,20 @@ var require_moment = __commonJS({
|
|
|
1036
1036
|
}
|
|
1037
1037
|
return date;
|
|
1038
1038
|
}
|
|
1039
|
-
function firstWeekOffset(
|
|
1040
|
-
var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(
|
|
1039
|
+
function firstWeekOffset(year, dow, doy) {
|
|
1040
|
+
var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
|
|
1041
1041
|
return -fwdlw + fwd - 1;
|
|
1042
1042
|
}
|
|
1043
|
-
function dayOfYearFromWeeks(
|
|
1044
|
-
var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(
|
|
1043
|
+
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
|
|
1044
|
+
var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
|
|
1045
1045
|
if (dayOfYear <= 0) {
|
|
1046
|
-
resYear =
|
|
1046
|
+
resYear = year - 1;
|
|
1047
1047
|
resDayOfYear = daysInYear(resYear) + dayOfYear;
|
|
1048
|
-
} else if (dayOfYear > daysInYear(
|
|
1049
|
-
resYear =
|
|
1050
|
-
resDayOfYear = dayOfYear - daysInYear(
|
|
1048
|
+
} else if (dayOfYear > daysInYear(year)) {
|
|
1049
|
+
resYear = year + 1;
|
|
1050
|
+
resDayOfYear = dayOfYear - daysInYear(year);
|
|
1051
1051
|
} else {
|
|
1052
|
-
resYear =
|
|
1052
|
+
resYear = year;
|
|
1053
1053
|
resDayOfYear = dayOfYear;
|
|
1054
1054
|
}
|
|
1055
1055
|
return {
|
|
@@ -1074,9 +1074,9 @@ var require_moment = __commonJS({
|
|
|
1074
1074
|
year: resYear
|
|
1075
1075
|
};
|
|
1076
1076
|
}
|
|
1077
|
-
function weeksInYear(
|
|
1078
|
-
var weekOffset = firstWeekOffset(
|
|
1079
|
-
return (daysInYear(
|
|
1077
|
+
function weeksInYear(year, dow, doy) {
|
|
1078
|
+
var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
|
|
1079
|
+
return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
|
|
1080
1080
|
}
|
|
1081
1081
|
addFormatToken("w", ["ww", 2], "wo", "week");
|
|
1082
1082
|
addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
|
|
@@ -1294,12 +1294,12 @@ var require_moment = __commonJS({
|
|
|
1294
1294
|
if (!this.isValid()) {
|
|
1295
1295
|
return input != null ? this : NaN;
|
|
1296
1296
|
}
|
|
1297
|
-
var
|
|
1297
|
+
var day = get(this, "Day");
|
|
1298
1298
|
if (input != null) {
|
|
1299
1299
|
input = parseWeekday(input, this.localeData());
|
|
1300
|
-
return this.add(input -
|
|
1300
|
+
return this.add(input - day, "d");
|
|
1301
1301
|
} else {
|
|
1302
|
-
return
|
|
1302
|
+
return day;
|
|
1303
1303
|
}
|
|
1304
1304
|
}
|
|
1305
1305
|
function getSetLocaleDayOfWeek(input) {
|
|
@@ -1796,13 +1796,13 @@ var require_moment = __commonJS({
|
|
|
1796
1796
|
return result;
|
|
1797
1797
|
}
|
|
1798
1798
|
function untruncateYear(yearStr) {
|
|
1799
|
-
var
|
|
1800
|
-
if (
|
|
1801
|
-
return 2e3 +
|
|
1802
|
-
} else if (
|
|
1803
|
-
return 1900 +
|
|
1799
|
+
var year = parseInt(yearStr, 10);
|
|
1800
|
+
if (year <= 49) {
|
|
1801
|
+
return 2e3 + year;
|
|
1802
|
+
} else if (year <= 999) {
|
|
1803
|
+
return 1900 + year;
|
|
1804
1804
|
}
|
|
1805
|
-
return
|
|
1805
|
+
return year;
|
|
1806
1806
|
}
|
|
1807
1807
|
function preprocessRFC2822(s) {
|
|
1808
1808
|
return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
|
|
@@ -2836,16 +2836,16 @@ var require_moment = __commonJS({
|
|
|
2836
2836
|
if (!this.isValid()) {
|
|
2837
2837
|
return "moment.invalid(/* " + this._i + " */)";
|
|
2838
2838
|
}
|
|
2839
|
-
var func = "moment", zone = "", prefix,
|
|
2839
|
+
var func = "moment", zone = "", prefix, year, datetime, suffix;
|
|
2840
2840
|
if (!this.isLocal()) {
|
|
2841
2841
|
func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
|
|
2842
2842
|
zone = "Z";
|
|
2843
2843
|
}
|
|
2844
2844
|
prefix = "[" + func + '("]';
|
|
2845
|
-
|
|
2845
|
+
year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
|
|
2846
2846
|
datetime = "-MM-DD[T]HH:mm:ss.SSS";
|
|
2847
2847
|
suffix = zone + '[")]';
|
|
2848
|
-
return this.format(prefix +
|
|
2848
|
+
return this.format(prefix + year + datetime + suffix);
|
|
2849
2849
|
}
|
|
2850
2850
|
function format(inputString) {
|
|
2851
2851
|
if (!inputString) {
|
|
@@ -3184,12 +3184,12 @@ var require_moment = __commonJS({
|
|
|
3184
3184
|
}
|
|
3185
3185
|
}
|
|
3186
3186
|
}
|
|
3187
|
-
function localeErasConvertYear(era,
|
|
3187
|
+
function localeErasConvertYear(era, year) {
|
|
3188
3188
|
var dir = era.since <= era.until ? 1 : -1;
|
|
3189
|
-
if (
|
|
3189
|
+
if (year === void 0) {
|
|
3190
3190
|
return hooks(era.since).year();
|
|
3191
3191
|
} else {
|
|
3192
|
-
return hooks(era.since).year() + (
|
|
3192
|
+
return hooks(era.since).year() + (year - era.offset) * dir;
|
|
3193
3193
|
}
|
|
3194
3194
|
}
|
|
3195
3195
|
function getEraName() {
|
|
@@ -4063,6 +4063,10 @@ __export(index_exports, {
|
|
|
4063
4063
|
priorityFieldController: () => priorityFieldController,
|
|
4064
4064
|
setStorageItemAsync: () => setStorageItemAsync,
|
|
4065
4065
|
statusDropdownController: () => statusDropdownController,
|
|
4066
|
+
tableBodyController: () => tableBodyController,
|
|
4067
|
+
tableController: () => tableController,
|
|
4068
|
+
tableGroupController: () => tableGroupController,
|
|
4069
|
+
tableHeadController: () => tableHeadController,
|
|
4066
4070
|
useAppProvider: () => useAppProvider,
|
|
4067
4071
|
useAuth: () => useAuth,
|
|
4068
4072
|
useCallAction: () => useCallAction,
|
|
@@ -5404,7 +5408,7 @@ var many2manyFieldController = (props) => {
|
|
|
5404
5408
|
tab,
|
|
5405
5409
|
model,
|
|
5406
5410
|
aid,
|
|
5407
|
-
setSelectedRowKeys,
|
|
5411
|
+
setSelectedRowKeys: setSelectedRowKeys4,
|
|
5408
5412
|
fields,
|
|
5409
5413
|
setFields,
|
|
5410
5414
|
groupByDomain,
|
|
@@ -5516,7 +5520,7 @@ var many2manyFieldController = (props) => {
|
|
|
5516
5520
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
5517
5521
|
}));
|
|
5518
5522
|
appDispatch((0, import_interface_logic19.setPage)(0));
|
|
5519
|
-
|
|
5523
|
+
setSelectedRowKeys4([]);
|
|
5520
5524
|
setDomainMany2Many(null);
|
|
5521
5525
|
setIsLoadedData(false);
|
|
5522
5526
|
};
|
|
@@ -6037,9 +6041,6 @@ var downLoadBinaryController = (props) => {
|
|
|
6037
6041
|
};
|
|
6038
6042
|
|
|
6039
6043
|
// src/widget/basic/date-field/controller.ts
|
|
6040
|
-
var import_day = __toESM(require("react-datepicker/dist/day"));
|
|
6041
|
-
var import_month = __toESM(require("react-datepicker/dist/month"));
|
|
6042
|
-
var import_year = __toESM(require("react-datepicker/dist/year"));
|
|
6043
6044
|
var import_moment = __toESM(require_moment());
|
|
6044
6045
|
var DURATIONS = {
|
|
6045
6046
|
PAST: "past",
|
|
@@ -6147,10 +6148,7 @@ var dateFieldController = (props) => {
|
|
|
6147
6148
|
months_en,
|
|
6148
6149
|
customValidateMinMax,
|
|
6149
6150
|
minNowValue,
|
|
6150
|
-
maxNowValue
|
|
6151
|
-
year: import_year.default,
|
|
6152
|
-
month: import_month.default,
|
|
6153
|
-
day: import_day.default
|
|
6151
|
+
maxNowValue
|
|
6154
6152
|
};
|
|
6155
6153
|
};
|
|
6156
6154
|
|
|
@@ -6302,6 +6300,272 @@ var binaryFieldController = (props) => {
|
|
|
6302
6300
|
getImageBase64WithMimeType
|
|
6303
6301
|
};
|
|
6304
6302
|
};
|
|
6303
|
+
|
|
6304
|
+
// src/widget/advance/table/table-body/controller.ts
|
|
6305
|
+
var import_interface_logic27 = require("@fctc/interface-logic");
|
|
6306
|
+
var import_react28 = require("react");
|
|
6307
|
+
var tableBodyController = (props) => {
|
|
6308
|
+
const {
|
|
6309
|
+
checkedAll,
|
|
6310
|
+
checkboxRef,
|
|
6311
|
+
setIsAutoSelect,
|
|
6312
|
+
selectedRowKeys,
|
|
6313
|
+
row,
|
|
6314
|
+
isAutoSelect,
|
|
6315
|
+
selectedRowKeysRef,
|
|
6316
|
+
onClickRow
|
|
6317
|
+
} = props;
|
|
6318
|
+
const appDispatch = (0, import_interface_logic27.useAppDispatch)();
|
|
6319
|
+
const checked = (0, import_react28.useMemo)(() => {
|
|
6320
|
+
if (!row?.id) return false;
|
|
6321
|
+
if (selectedRowKeys?.includes(row.id)) {
|
|
6322
|
+
return true;
|
|
6323
|
+
}
|
|
6324
|
+
return checkedAll;
|
|
6325
|
+
}, [row?.id, selectedRowKeys, checkedAll]);
|
|
6326
|
+
const handleCheckBoxSingle = (event) => {
|
|
6327
|
+
event.stopPropagation();
|
|
6328
|
+
if (checkedAll) {
|
|
6329
|
+
checkboxRef.current = "uncheck";
|
|
6330
|
+
setIsAutoSelect(true);
|
|
6331
|
+
return;
|
|
6332
|
+
}
|
|
6333
|
+
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6334
|
+
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
6335
|
+
appDispatch((0, import_interface_logic27.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6336
|
+
};
|
|
6337
|
+
const handleClickRow = (col, row2) => {
|
|
6338
|
+
onClickRow(col, row2);
|
|
6339
|
+
};
|
|
6340
|
+
(0, import_react28.useEffect)(() => {
|
|
6341
|
+
if (!row?.id) return;
|
|
6342
|
+
if (isAutoSelect) {
|
|
6343
|
+
if (checkboxRef?.current === "uncheck") {
|
|
6344
|
+
const filtered = selectedRowKeysRef.current.filter(
|
|
6345
|
+
(id) => id !== row.id
|
|
6346
|
+
);
|
|
6347
|
+
selectedRowKeysRef.current = filtered;
|
|
6348
|
+
appDispatch((0, import_interface_logic27.setSelectedRowKeys)(filtered));
|
|
6349
|
+
} else {
|
|
6350
|
+
const unique = Array.from(
|
|
6351
|
+
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6352
|
+
);
|
|
6353
|
+
selectedRowKeysRef.current = unique;
|
|
6354
|
+
appDispatch((0, import_interface_logic27.setSelectedRowKeys)(unique));
|
|
6355
|
+
}
|
|
6356
|
+
}
|
|
6357
|
+
}, [isAutoSelect]);
|
|
6358
|
+
(0, import_react28.useEffect)(() => {
|
|
6359
|
+
if (!checkedAll) {
|
|
6360
|
+
checkboxRef.current = "enabled";
|
|
6361
|
+
false;
|
|
6362
|
+
}
|
|
6363
|
+
}, [checkedAll]);
|
|
6364
|
+
return {
|
|
6365
|
+
handleCheckBoxSingle,
|
|
6366
|
+
checked,
|
|
6367
|
+
handleClickRow
|
|
6368
|
+
};
|
|
6369
|
+
};
|
|
6370
|
+
|
|
6371
|
+
// src/widget/advance/table/table-head/controller.ts
|
|
6372
|
+
var import_interface_logic28 = require("@fctc/interface-logic");
|
|
6373
|
+
var tableHeadController = (props) => {
|
|
6374
|
+
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6375
|
+
const appDispatch = (0, import_interface_logic28.useAppDispatch)();
|
|
6376
|
+
const { groupByDomain } = (0, import_interface_logic28.useAppSelector)(import_interface_logic28.selectSearch);
|
|
6377
|
+
const handleCheckBoxAll = (event) => {
|
|
6378
|
+
if (event?.target?.checked && typeTable === "list") {
|
|
6379
|
+
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6380
|
+
appDispatch((0, import_interface_logic28.setSelectedRowKeys)(allRowKeys));
|
|
6381
|
+
} else if (event?.target?.checked && typeTable === "group") {
|
|
6382
|
+
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6383
|
+
const ids = Array.from(rowsIDs)?.map(
|
|
6384
|
+
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6385
|
+
);
|
|
6386
|
+
if (ids?.length > 0) {
|
|
6387
|
+
appDispatch((0, import_interface_logic28.setSelectedRowKeys)(ids));
|
|
6388
|
+
} else {
|
|
6389
|
+
const sum = countSum(
|
|
6390
|
+
rows,
|
|
6391
|
+
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6392
|
+
);
|
|
6393
|
+
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6394
|
+
appDispatch((0, import_interface_logic28.setSelectedRowKeys)(keys));
|
|
6395
|
+
}
|
|
6396
|
+
if (selectedRowKeysRef) {
|
|
6397
|
+
selectedRowKeysRef.current = [];
|
|
6398
|
+
}
|
|
6399
|
+
} else {
|
|
6400
|
+
appDispatch((0, import_interface_logic28.setSelectedRowKeys)([]));
|
|
6401
|
+
}
|
|
6402
|
+
};
|
|
6403
|
+
return {
|
|
6404
|
+
handleCheckBoxAll
|
|
6405
|
+
};
|
|
6406
|
+
};
|
|
6407
|
+
|
|
6408
|
+
// src/widget/advance/table/table-group/controller.ts
|
|
6409
|
+
var import_interface_logic29 = require("@fctc/interface-logic");
|
|
6410
|
+
var import_react29 = require("react");
|
|
6411
|
+
var tableGroupController = (props) => {
|
|
6412
|
+
const env = (0, import_interface_logic29.getEnv)();
|
|
6413
|
+
const {
|
|
6414
|
+
rows,
|
|
6415
|
+
columns,
|
|
6416
|
+
indexRow,
|
|
6417
|
+
row,
|
|
6418
|
+
model,
|
|
6419
|
+
viewData,
|
|
6420
|
+
renderField,
|
|
6421
|
+
level,
|
|
6422
|
+
specification,
|
|
6423
|
+
domain,
|
|
6424
|
+
context,
|
|
6425
|
+
checkedAll,
|
|
6426
|
+
isDisplayCheckbox,
|
|
6427
|
+
isAutoSelect,
|
|
6428
|
+
setIsAutoSelect,
|
|
6429
|
+
selectedRowKeysRef
|
|
6430
|
+
} = props;
|
|
6431
|
+
const [pageGroup, setPageGroup] = (0, import_react29.useState)(0);
|
|
6432
|
+
const { groupByDomain, selectedTags } = (0, import_interface_logic29.useAppSelector)(import_interface_logic29.selectSearch);
|
|
6433
|
+
const { selectedRowKeys } = (0, import_interface_logic29.useAppSelector)(import_interface_logic29.selectList);
|
|
6434
|
+
const appDispatch = (0, import_interface_logic29.useAppDispatch)();
|
|
6435
|
+
const { toDataJS } = (0, import_interface_logic29.useOdooDataTransform)();
|
|
6436
|
+
const initVal = toDataJS(row, viewData, model);
|
|
6437
|
+
const [isShowGroup, setIsShowGroup] = (0, import_react29.useState)(false);
|
|
6438
|
+
const [colEmptyGroup, setColEmptyGroup] = (0, import_react29.useState)({
|
|
6439
|
+
fromStart: 1,
|
|
6440
|
+
fromEnd: 1
|
|
6441
|
+
});
|
|
6442
|
+
const processedData = (0, import_react29.useMemo)(() => {
|
|
6443
|
+
const calculateColSpanEmpty = () => {
|
|
6444
|
+
const startIndex = columns.findIndex(
|
|
6445
|
+
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
|
|
6446
|
+
);
|
|
6447
|
+
const endIndex = columns.findLastIndex(
|
|
6448
|
+
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator !== "sum"
|
|
6449
|
+
);
|
|
6450
|
+
const fromStart = startIndex === -1 ? columns.length : startIndex;
|
|
6451
|
+
const fromEnd = endIndex === -1 ? columns.length : columns.length - 1 - endIndex;
|
|
6452
|
+
setColEmptyGroup({ fromStart: fromStart + 1, fromEnd: fromEnd + 1 });
|
|
6453
|
+
return { fromStart: fromStart + 1, fromEnd: fromEnd + 1 };
|
|
6454
|
+
};
|
|
6455
|
+
return calculateColSpanEmpty();
|
|
6456
|
+
}, [columns, row]);
|
|
6457
|
+
const shouldFetchData = (0, import_react29.useMemo)(() => {
|
|
6458
|
+
return !!isShowGroup;
|
|
6459
|
+
}, [isShowGroup]);
|
|
6460
|
+
const enabled = shouldFetchData && !!processedData;
|
|
6461
|
+
const listDataProps = {
|
|
6462
|
+
model,
|
|
6463
|
+
specification,
|
|
6464
|
+
domain,
|
|
6465
|
+
context,
|
|
6466
|
+
offset: pageGroup * 10,
|
|
6467
|
+
fields: groupByDomain?.fields,
|
|
6468
|
+
groupby: [groupByDomain?.contexts[level]?.group_by]
|
|
6469
|
+
};
|
|
6470
|
+
const queryKey = [
|
|
6471
|
+
`data-${model}--${level}-row${indexRow}`,
|
|
6472
|
+
specification,
|
|
6473
|
+
domain,
|
|
6474
|
+
pageGroup
|
|
6475
|
+
];
|
|
6476
|
+
const {
|
|
6477
|
+
data: dataResponse,
|
|
6478
|
+
isFetched: isQueryFetched,
|
|
6479
|
+
isPlaceholderData,
|
|
6480
|
+
isLoading,
|
|
6481
|
+
isFetching
|
|
6482
|
+
} = (0, import_interface_logic29.useGetListData)(listDataProps, queryKey, enabled);
|
|
6483
|
+
const {
|
|
6484
|
+
columns: columnsGroup,
|
|
6485
|
+
rows: rowsGroup,
|
|
6486
|
+
typeTable: typeTableGroup
|
|
6487
|
+
} = tableController({
|
|
6488
|
+
data: {
|
|
6489
|
+
fields: viewData?.views?.list?.fields,
|
|
6490
|
+
records: dataResponse?.records ?? dataResponse?.groups,
|
|
6491
|
+
dataModel: viewData?.models?.[model],
|
|
6492
|
+
context: env.context,
|
|
6493
|
+
typeTable: dataResponse?.groups ? "group" : "list"
|
|
6494
|
+
}
|
|
6495
|
+
});
|
|
6496
|
+
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
6497
|
+
(0, import_react29.useEffect)(() => {
|
|
6498
|
+
if (isShowGroup && selectedTags?.length > 0) {
|
|
6499
|
+
setIsShowGroup(false);
|
|
6500
|
+
}
|
|
6501
|
+
}, [selectedTags]);
|
|
6502
|
+
const group_by_field_name = groupByDomain?.contexts[level - 1]?.group_by;
|
|
6503
|
+
const nameGroup = Array.isArray(row[group_by_field_name]) ? row?.string ?? row[`${group_by_field_name}`][1] : viewData?.models?.[model]?.[group_by_field_name]?.selection ? viewData.models[model][group_by_field_name].selection.find(
|
|
6504
|
+
(selectItem) => selectItem?.[0] === row[group_by_field_name]
|
|
6505
|
+
)?.[1] : row[group_by_field_name];
|
|
6506
|
+
const nameGroupWithCount = `${typeof nameGroup === "string" ? nameGroup : typeof nameGroup === "boolean" && nameGroup ? i18n_default.t("yes") : i18n_default.t("no")} (${row[`${group_by_field_name?.split(":")?.[0]}_count`]})`;
|
|
6507
|
+
const allIdsNull = selectedRowKeys?.every((item) => item === void 0);
|
|
6508
|
+
const handleExpandChildGroup = () => {
|
|
6509
|
+
if (isLoading || isFetching) return;
|
|
6510
|
+
const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
|
|
6511
|
+
if (allIdsNull || typeTableGroup === "group") {
|
|
6512
|
+
toggleShowGroup();
|
|
6513
|
+
return;
|
|
6514
|
+
}
|
|
6515
|
+
if (isShowGroup && checkedAll) {
|
|
6516
|
+
const ids = rowsGroup?.map((item) => item?.id) || [];
|
|
6517
|
+
const filteredIds = selectedRowKeys.filter(
|
|
6518
|
+
(id) => !ids.includes(id)
|
|
6519
|
+
);
|
|
6520
|
+
appDispatch((0, import_interface_logic29.setSelectedRowKeys)(filteredIds));
|
|
6521
|
+
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6522
|
+
const clonedKeys = [...selectedRowKeys];
|
|
6523
|
+
appDispatch((0, import_interface_logic29.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
6524
|
+
setTimeout(() => appDispatch((0, import_interface_logic29.setSelectedRowKeys)(clonedKeys)), 500);
|
|
6525
|
+
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
6526
|
+
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
6527
|
+
appDispatch((0, import_interface_logic29.setSelectedRowKeys)(filteredKeys));
|
|
6528
|
+
}
|
|
6529
|
+
toggleShowGroup();
|
|
6530
|
+
};
|
|
6531
|
+
(0, import_react29.useEffect)(() => {
|
|
6532
|
+
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
6533
|
+
return;
|
|
6534
|
+
}
|
|
6535
|
+
const clonedKeys = [...selectedRowKeys];
|
|
6536
|
+
(0, import_interface_logic29.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
6537
|
+
setTimeout(() => (0, import_interface_logic29.setSelectedRowKeys)(clonedKeys), 500);
|
|
6538
|
+
}, [isQueryFetched]);
|
|
6539
|
+
return {
|
|
6540
|
+
handleExpandChildGroup,
|
|
6541
|
+
colEmptyGroup,
|
|
6542
|
+
leftPadding,
|
|
6543
|
+
isShowGroup,
|
|
6544
|
+
isQueryFetched,
|
|
6545
|
+
nameGroupWithCount,
|
|
6546
|
+
columns,
|
|
6547
|
+
row,
|
|
6548
|
+
isPlaceholderData,
|
|
6549
|
+
columnsGroup,
|
|
6550
|
+
indexRow,
|
|
6551
|
+
rowsGroup,
|
|
6552
|
+
model,
|
|
6553
|
+
viewData,
|
|
6554
|
+
renderField,
|
|
6555
|
+
level,
|
|
6556
|
+
specification,
|
|
6557
|
+
context,
|
|
6558
|
+
checkedAll,
|
|
6559
|
+
isDisplayCheckbox,
|
|
6560
|
+
isAutoSelect,
|
|
6561
|
+
setIsAutoSelect,
|
|
6562
|
+
selectedRowKeysRef,
|
|
6563
|
+
initVal,
|
|
6564
|
+
dataResponse,
|
|
6565
|
+
pageGroup,
|
|
6566
|
+
setPageGroup
|
|
6567
|
+
};
|
|
6568
|
+
};
|
|
6305
6569
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6306
6570
|
0 && (module.exports = {
|
|
6307
6571
|
API_APP_URL,
|
|
@@ -6333,6 +6597,10 @@ var binaryFieldController = (props) => {
|
|
|
6333
6597
|
priorityFieldController,
|
|
6334
6598
|
setStorageItemAsync,
|
|
6335
6599
|
statusDropdownController,
|
|
6600
|
+
tableBodyController,
|
|
6601
|
+
tableController,
|
|
6602
|
+
tableGroupController,
|
|
6603
|
+
tableHeadController,
|
|
6336
6604
|
useAppProvider,
|
|
6337
6605
|
useAuth,
|
|
6338
6606
|
useCallAction,
|
package/dist/index.mjs
CHANGED
|
@@ -641,8 +641,8 @@ var require_moment = __commonJS({
|
|
|
641
641
|
tokens[token2](input, config._a, config, token2);
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
|
-
function isLeapYear(
|
|
645
|
-
return
|
|
644
|
+
function isLeapYear(year) {
|
|
645
|
+
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
646
646
|
}
|
|
647
647
|
var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8;
|
|
648
648
|
addFormatToken("Y", 0, 0, function() {
|
|
@@ -670,8 +670,8 @@ var require_moment = __commonJS({
|
|
|
670
670
|
addParseToken("Y", function(input, array) {
|
|
671
671
|
array[YEAR] = parseInt(input, 10);
|
|
672
672
|
});
|
|
673
|
-
function daysInYear(
|
|
674
|
-
return isLeapYear(
|
|
673
|
+
function daysInYear(year) {
|
|
674
|
+
return isLeapYear(year) ? 366 : 365;
|
|
675
675
|
}
|
|
676
676
|
hooks.parseTwoDigitYear = function(input) {
|
|
677
677
|
return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3);
|
|
@@ -718,7 +718,7 @@ var require_moment = __commonJS({
|
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
720
|
function set$1(mom, unit, value) {
|
|
721
|
-
var d, isUTC,
|
|
721
|
+
var d, isUTC, year, month, date;
|
|
722
722
|
if (!mom.isValid() || isNaN(value)) {
|
|
723
723
|
return;
|
|
724
724
|
}
|
|
@@ -745,11 +745,11 @@ var require_moment = __commonJS({
|
|
|
745
745
|
default:
|
|
746
746
|
return;
|
|
747
747
|
}
|
|
748
|
-
|
|
749
|
-
|
|
748
|
+
year = value;
|
|
749
|
+
month = mom.month();
|
|
750
750
|
date = mom.date();
|
|
751
|
-
date = date === 29 &&
|
|
752
|
-
void (isUTC ? d.setUTCFullYear(
|
|
751
|
+
date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
|
|
752
|
+
void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date));
|
|
753
753
|
}
|
|
754
754
|
function stringGet(units) {
|
|
755
755
|
units = normalizeUnits(units);
|
|
@@ -790,13 +790,13 @@ var require_moment = __commonJS({
|
|
|
790
790
|
return -1;
|
|
791
791
|
};
|
|
792
792
|
}
|
|
793
|
-
function daysInMonth(
|
|
794
|
-
if (isNaN(
|
|
793
|
+
function daysInMonth(year, month) {
|
|
794
|
+
if (isNaN(year) || isNaN(month)) {
|
|
795
795
|
return NaN;
|
|
796
796
|
}
|
|
797
|
-
var modMonth = mod(
|
|
798
|
-
|
|
799
|
-
return modMonth === 1 ? isLeapYear(
|
|
797
|
+
var modMonth = mod(month, 12);
|
|
798
|
+
year += (month - modMonth) / 12;
|
|
799
|
+
return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
|
|
800
800
|
}
|
|
801
801
|
addFormatToken("M", ["MM", 2], "Mo", function() {
|
|
802
802
|
return this.month() + 1;
|
|
@@ -819,9 +819,9 @@ var require_moment = __commonJS({
|
|
|
819
819
|
array[MONTH] = toInt(input) - 1;
|
|
820
820
|
});
|
|
821
821
|
addParseToken(["MMM", "MMMM"], function(input, array, config, token2) {
|
|
822
|
-
var
|
|
823
|
-
if (
|
|
824
|
-
array[MONTH] =
|
|
822
|
+
var month = config._locale.monthsParse(input, token2, config._strict);
|
|
823
|
+
if (month != null) {
|
|
824
|
+
array[MONTH] = month;
|
|
825
825
|
} else {
|
|
826
826
|
getParsingFlags(config).invalidMonth = input;
|
|
827
827
|
}
|
|
@@ -931,9 +931,9 @@ var require_moment = __commonJS({
|
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
}
|
|
934
|
-
var
|
|
935
|
-
date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(),
|
|
936
|
-
void (mom._isUTC ? mom._d.setUTCMonth(
|
|
934
|
+
var month = value, date = mom.date();
|
|
935
|
+
date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
|
|
936
|
+
void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date));
|
|
937
937
|
return mom;
|
|
938
938
|
}
|
|
939
939
|
function getSetMonth(value) {
|
|
@@ -1036,20 +1036,20 @@ var require_moment = __commonJS({
|
|
|
1036
1036
|
}
|
|
1037
1037
|
return date;
|
|
1038
1038
|
}
|
|
1039
|
-
function firstWeekOffset(
|
|
1040
|
-
var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(
|
|
1039
|
+
function firstWeekOffset(year, dow, doy) {
|
|
1040
|
+
var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
|
|
1041
1041
|
return -fwdlw + fwd - 1;
|
|
1042
1042
|
}
|
|
1043
|
-
function dayOfYearFromWeeks(
|
|
1044
|
-
var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(
|
|
1043
|
+
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
|
|
1044
|
+
var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
|
|
1045
1045
|
if (dayOfYear <= 0) {
|
|
1046
|
-
resYear =
|
|
1046
|
+
resYear = year - 1;
|
|
1047
1047
|
resDayOfYear = daysInYear(resYear) + dayOfYear;
|
|
1048
|
-
} else if (dayOfYear > daysInYear(
|
|
1049
|
-
resYear =
|
|
1050
|
-
resDayOfYear = dayOfYear - daysInYear(
|
|
1048
|
+
} else if (dayOfYear > daysInYear(year)) {
|
|
1049
|
+
resYear = year + 1;
|
|
1050
|
+
resDayOfYear = dayOfYear - daysInYear(year);
|
|
1051
1051
|
} else {
|
|
1052
|
-
resYear =
|
|
1052
|
+
resYear = year;
|
|
1053
1053
|
resDayOfYear = dayOfYear;
|
|
1054
1054
|
}
|
|
1055
1055
|
return {
|
|
@@ -1074,9 +1074,9 @@ var require_moment = __commonJS({
|
|
|
1074
1074
|
year: resYear
|
|
1075
1075
|
};
|
|
1076
1076
|
}
|
|
1077
|
-
function weeksInYear(
|
|
1078
|
-
var weekOffset = firstWeekOffset(
|
|
1079
|
-
return (daysInYear(
|
|
1077
|
+
function weeksInYear(year, dow, doy) {
|
|
1078
|
+
var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
|
|
1079
|
+
return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
|
|
1080
1080
|
}
|
|
1081
1081
|
addFormatToken("w", ["ww", 2], "wo", "week");
|
|
1082
1082
|
addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
|
|
@@ -1294,12 +1294,12 @@ var require_moment = __commonJS({
|
|
|
1294
1294
|
if (!this.isValid()) {
|
|
1295
1295
|
return input != null ? this : NaN;
|
|
1296
1296
|
}
|
|
1297
|
-
var
|
|
1297
|
+
var day = get(this, "Day");
|
|
1298
1298
|
if (input != null) {
|
|
1299
1299
|
input = parseWeekday(input, this.localeData());
|
|
1300
|
-
return this.add(input -
|
|
1300
|
+
return this.add(input - day, "d");
|
|
1301
1301
|
} else {
|
|
1302
|
-
return
|
|
1302
|
+
return day;
|
|
1303
1303
|
}
|
|
1304
1304
|
}
|
|
1305
1305
|
function getSetLocaleDayOfWeek(input) {
|
|
@@ -1796,13 +1796,13 @@ var require_moment = __commonJS({
|
|
|
1796
1796
|
return result;
|
|
1797
1797
|
}
|
|
1798
1798
|
function untruncateYear(yearStr) {
|
|
1799
|
-
var
|
|
1800
|
-
if (
|
|
1801
|
-
return 2e3 +
|
|
1802
|
-
} else if (
|
|
1803
|
-
return 1900 +
|
|
1799
|
+
var year = parseInt(yearStr, 10);
|
|
1800
|
+
if (year <= 49) {
|
|
1801
|
+
return 2e3 + year;
|
|
1802
|
+
} else if (year <= 999) {
|
|
1803
|
+
return 1900 + year;
|
|
1804
1804
|
}
|
|
1805
|
-
return
|
|
1805
|
+
return year;
|
|
1806
1806
|
}
|
|
1807
1807
|
function preprocessRFC2822(s) {
|
|
1808
1808
|
return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
|
|
@@ -2836,16 +2836,16 @@ var require_moment = __commonJS({
|
|
|
2836
2836
|
if (!this.isValid()) {
|
|
2837
2837
|
return "moment.invalid(/* " + this._i + " */)";
|
|
2838
2838
|
}
|
|
2839
|
-
var func = "moment", zone = "", prefix,
|
|
2839
|
+
var func = "moment", zone = "", prefix, year, datetime, suffix;
|
|
2840
2840
|
if (!this.isLocal()) {
|
|
2841
2841
|
func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
|
|
2842
2842
|
zone = "Z";
|
|
2843
2843
|
}
|
|
2844
2844
|
prefix = "[" + func + '("]';
|
|
2845
|
-
|
|
2845
|
+
year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
|
|
2846
2846
|
datetime = "-MM-DD[T]HH:mm:ss.SSS";
|
|
2847
2847
|
suffix = zone + '[")]';
|
|
2848
|
-
return this.format(prefix +
|
|
2848
|
+
return this.format(prefix + year + datetime + suffix);
|
|
2849
2849
|
}
|
|
2850
2850
|
function format(inputString) {
|
|
2851
2851
|
if (!inputString) {
|
|
@@ -3184,12 +3184,12 @@ var require_moment = __commonJS({
|
|
|
3184
3184
|
}
|
|
3185
3185
|
}
|
|
3186
3186
|
}
|
|
3187
|
-
function localeErasConvertYear(era,
|
|
3187
|
+
function localeErasConvertYear(era, year) {
|
|
3188
3188
|
var dir = era.since <= era.until ? 1 : -1;
|
|
3189
|
-
if (
|
|
3189
|
+
if (year === void 0) {
|
|
3190
3190
|
return hooks(era.since).year();
|
|
3191
3191
|
} else {
|
|
3192
|
-
return hooks(era.since).year() + (
|
|
3192
|
+
return hooks(era.since).year() + (year - era.offset) * dir;
|
|
3193
3193
|
}
|
|
3194
3194
|
}
|
|
3195
3195
|
function getEraName() {
|
|
@@ -5416,7 +5416,7 @@ var many2manyFieldController = (props) => {
|
|
|
5416
5416
|
tab,
|
|
5417
5417
|
model,
|
|
5418
5418
|
aid,
|
|
5419
|
-
setSelectedRowKeys,
|
|
5419
|
+
setSelectedRowKeys: setSelectedRowKeys4,
|
|
5420
5420
|
fields,
|
|
5421
5421
|
setFields,
|
|
5422
5422
|
groupByDomain,
|
|
@@ -5528,7 +5528,7 @@ var many2manyFieldController = (props) => {
|
|
|
5528
5528
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
5529
5529
|
}));
|
|
5530
5530
|
appDispatch(setPage(0));
|
|
5531
|
-
|
|
5531
|
+
setSelectedRowKeys4([]);
|
|
5532
5532
|
setDomainMany2Many(null);
|
|
5533
5533
|
setIsLoadedData(false);
|
|
5534
5534
|
};
|
|
@@ -6063,9 +6063,6 @@ var downLoadBinaryController = (props) => {
|
|
|
6063
6063
|
|
|
6064
6064
|
// src/widget/basic/date-field/controller.ts
|
|
6065
6065
|
var import_moment = __toESM(require_moment());
|
|
6066
|
-
import day from "react-datepicker/dist/day";
|
|
6067
|
-
import month from "react-datepicker/dist/month";
|
|
6068
|
-
import year from "react-datepicker/dist/year";
|
|
6069
6066
|
var DURATIONS = {
|
|
6070
6067
|
PAST: "past",
|
|
6071
6068
|
NOW: "now",
|
|
@@ -6172,10 +6169,7 @@ var dateFieldController = (props) => {
|
|
|
6172
6169
|
months_en,
|
|
6173
6170
|
customValidateMinMax,
|
|
6174
6171
|
minNowValue,
|
|
6175
|
-
maxNowValue
|
|
6176
|
-
year,
|
|
6177
|
-
month,
|
|
6178
|
-
day
|
|
6172
|
+
maxNowValue
|
|
6179
6173
|
};
|
|
6180
6174
|
};
|
|
6181
6175
|
|
|
@@ -6327,6 +6321,286 @@ var binaryFieldController = (props) => {
|
|
|
6327
6321
|
getImageBase64WithMimeType
|
|
6328
6322
|
};
|
|
6329
6323
|
};
|
|
6324
|
+
|
|
6325
|
+
// src/widget/advance/table/table-body/controller.ts
|
|
6326
|
+
import { setSelectedRowKeys, useAppDispatch as useAppDispatch6 } from "@fctc/interface-logic";
|
|
6327
|
+
import { useEffect as useEffect15, useMemo as useMemo12 } from "react";
|
|
6328
|
+
var tableBodyController = (props) => {
|
|
6329
|
+
const {
|
|
6330
|
+
checkedAll,
|
|
6331
|
+
checkboxRef,
|
|
6332
|
+
setIsAutoSelect,
|
|
6333
|
+
selectedRowKeys,
|
|
6334
|
+
row,
|
|
6335
|
+
isAutoSelect,
|
|
6336
|
+
selectedRowKeysRef,
|
|
6337
|
+
onClickRow
|
|
6338
|
+
} = props;
|
|
6339
|
+
const appDispatch = useAppDispatch6();
|
|
6340
|
+
const checked = useMemo12(() => {
|
|
6341
|
+
if (!row?.id) return false;
|
|
6342
|
+
if (selectedRowKeys?.includes(row.id)) {
|
|
6343
|
+
return true;
|
|
6344
|
+
}
|
|
6345
|
+
return checkedAll;
|
|
6346
|
+
}, [row?.id, selectedRowKeys, checkedAll]);
|
|
6347
|
+
const handleCheckBoxSingle = (event) => {
|
|
6348
|
+
event.stopPropagation();
|
|
6349
|
+
if (checkedAll) {
|
|
6350
|
+
checkboxRef.current = "uncheck";
|
|
6351
|
+
setIsAutoSelect(true);
|
|
6352
|
+
return;
|
|
6353
|
+
}
|
|
6354
|
+
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6355
|
+
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
6356
|
+
appDispatch(setSelectedRowKeys(newSelectedRowKeys));
|
|
6357
|
+
};
|
|
6358
|
+
const handleClickRow = (col, row2) => {
|
|
6359
|
+
onClickRow(col, row2);
|
|
6360
|
+
};
|
|
6361
|
+
useEffect15(() => {
|
|
6362
|
+
if (!row?.id) return;
|
|
6363
|
+
if (isAutoSelect) {
|
|
6364
|
+
if (checkboxRef?.current === "uncheck") {
|
|
6365
|
+
const filtered = selectedRowKeysRef.current.filter(
|
|
6366
|
+
(id) => id !== row.id
|
|
6367
|
+
);
|
|
6368
|
+
selectedRowKeysRef.current = filtered;
|
|
6369
|
+
appDispatch(setSelectedRowKeys(filtered));
|
|
6370
|
+
} else {
|
|
6371
|
+
const unique = Array.from(
|
|
6372
|
+
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6373
|
+
);
|
|
6374
|
+
selectedRowKeysRef.current = unique;
|
|
6375
|
+
appDispatch(setSelectedRowKeys(unique));
|
|
6376
|
+
}
|
|
6377
|
+
}
|
|
6378
|
+
}, [isAutoSelect]);
|
|
6379
|
+
useEffect15(() => {
|
|
6380
|
+
if (!checkedAll) {
|
|
6381
|
+
checkboxRef.current = "enabled";
|
|
6382
|
+
false;
|
|
6383
|
+
}
|
|
6384
|
+
}, [checkedAll]);
|
|
6385
|
+
return {
|
|
6386
|
+
handleCheckBoxSingle,
|
|
6387
|
+
checked,
|
|
6388
|
+
handleClickRow
|
|
6389
|
+
};
|
|
6390
|
+
};
|
|
6391
|
+
|
|
6392
|
+
// src/widget/advance/table/table-head/controller.ts
|
|
6393
|
+
import {
|
|
6394
|
+
selectSearch as selectSearch4,
|
|
6395
|
+
setSelectedRowKeys as setSelectedRowKeys2,
|
|
6396
|
+
useAppDispatch as useAppDispatch7,
|
|
6397
|
+
useAppSelector as useAppSelector7
|
|
6398
|
+
} from "@fctc/interface-logic";
|
|
6399
|
+
var tableHeadController = (props) => {
|
|
6400
|
+
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6401
|
+
const appDispatch = useAppDispatch7();
|
|
6402
|
+
const { groupByDomain } = useAppSelector7(selectSearch4);
|
|
6403
|
+
const handleCheckBoxAll = (event) => {
|
|
6404
|
+
if (event?.target?.checked && typeTable === "list") {
|
|
6405
|
+
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6406
|
+
appDispatch(setSelectedRowKeys2(allRowKeys));
|
|
6407
|
+
} else if (event?.target?.checked && typeTable === "group") {
|
|
6408
|
+
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6409
|
+
const ids = Array.from(rowsIDs)?.map(
|
|
6410
|
+
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6411
|
+
);
|
|
6412
|
+
if (ids?.length > 0) {
|
|
6413
|
+
appDispatch(setSelectedRowKeys2(ids));
|
|
6414
|
+
} else {
|
|
6415
|
+
const sum = countSum(
|
|
6416
|
+
rows,
|
|
6417
|
+
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6418
|
+
);
|
|
6419
|
+
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6420
|
+
appDispatch(setSelectedRowKeys2(keys));
|
|
6421
|
+
}
|
|
6422
|
+
if (selectedRowKeysRef) {
|
|
6423
|
+
selectedRowKeysRef.current = [];
|
|
6424
|
+
}
|
|
6425
|
+
} else {
|
|
6426
|
+
appDispatch(setSelectedRowKeys2([]));
|
|
6427
|
+
}
|
|
6428
|
+
};
|
|
6429
|
+
return {
|
|
6430
|
+
handleCheckBoxAll
|
|
6431
|
+
};
|
|
6432
|
+
};
|
|
6433
|
+
|
|
6434
|
+
// src/widget/advance/table/table-group/controller.ts
|
|
6435
|
+
import {
|
|
6436
|
+
getEnv as getEnv11,
|
|
6437
|
+
selectList as selectList3,
|
|
6438
|
+
selectSearch as selectSearch5,
|
|
6439
|
+
setSelectedRowKeys as setSelectedRowKeys3,
|
|
6440
|
+
useAppDispatch as useAppDispatch8,
|
|
6441
|
+
useAppSelector as useAppSelector8,
|
|
6442
|
+
useGetListData as useGetListData4,
|
|
6443
|
+
useOdooDataTransform
|
|
6444
|
+
} from "@fctc/interface-logic";
|
|
6445
|
+
import { useEffect as useEffect16, useMemo as useMemo13, useState as useState16 } from "react";
|
|
6446
|
+
var tableGroupController = (props) => {
|
|
6447
|
+
const env = getEnv11();
|
|
6448
|
+
const {
|
|
6449
|
+
rows,
|
|
6450
|
+
columns,
|
|
6451
|
+
indexRow,
|
|
6452
|
+
row,
|
|
6453
|
+
model,
|
|
6454
|
+
viewData,
|
|
6455
|
+
renderField,
|
|
6456
|
+
level,
|
|
6457
|
+
specification,
|
|
6458
|
+
domain,
|
|
6459
|
+
context,
|
|
6460
|
+
checkedAll,
|
|
6461
|
+
isDisplayCheckbox,
|
|
6462
|
+
isAutoSelect,
|
|
6463
|
+
setIsAutoSelect,
|
|
6464
|
+
selectedRowKeysRef
|
|
6465
|
+
} = props;
|
|
6466
|
+
const [pageGroup, setPageGroup] = useState16(0);
|
|
6467
|
+
const { groupByDomain, selectedTags } = useAppSelector8(selectSearch5);
|
|
6468
|
+
const { selectedRowKeys } = useAppSelector8(selectList3);
|
|
6469
|
+
const appDispatch = useAppDispatch8();
|
|
6470
|
+
const { toDataJS } = useOdooDataTransform();
|
|
6471
|
+
const initVal = toDataJS(row, viewData, model);
|
|
6472
|
+
const [isShowGroup, setIsShowGroup] = useState16(false);
|
|
6473
|
+
const [colEmptyGroup, setColEmptyGroup] = useState16({
|
|
6474
|
+
fromStart: 1,
|
|
6475
|
+
fromEnd: 1
|
|
6476
|
+
});
|
|
6477
|
+
const processedData = useMemo13(() => {
|
|
6478
|
+
const calculateColSpanEmpty = () => {
|
|
6479
|
+
const startIndex = columns.findIndex(
|
|
6480
|
+
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
|
|
6481
|
+
);
|
|
6482
|
+
const endIndex = columns.findLastIndex(
|
|
6483
|
+
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator !== "sum"
|
|
6484
|
+
);
|
|
6485
|
+
const fromStart = startIndex === -1 ? columns.length : startIndex;
|
|
6486
|
+
const fromEnd = endIndex === -1 ? columns.length : columns.length - 1 - endIndex;
|
|
6487
|
+
setColEmptyGroup({ fromStart: fromStart + 1, fromEnd: fromEnd + 1 });
|
|
6488
|
+
return { fromStart: fromStart + 1, fromEnd: fromEnd + 1 };
|
|
6489
|
+
};
|
|
6490
|
+
return calculateColSpanEmpty();
|
|
6491
|
+
}, [columns, row]);
|
|
6492
|
+
const shouldFetchData = useMemo13(() => {
|
|
6493
|
+
return !!isShowGroup;
|
|
6494
|
+
}, [isShowGroup]);
|
|
6495
|
+
const enabled = shouldFetchData && !!processedData;
|
|
6496
|
+
const listDataProps = {
|
|
6497
|
+
model,
|
|
6498
|
+
specification,
|
|
6499
|
+
domain,
|
|
6500
|
+
context,
|
|
6501
|
+
offset: pageGroup * 10,
|
|
6502
|
+
fields: groupByDomain?.fields,
|
|
6503
|
+
groupby: [groupByDomain?.contexts[level]?.group_by]
|
|
6504
|
+
};
|
|
6505
|
+
const queryKey = [
|
|
6506
|
+
`data-${model}--${level}-row${indexRow}`,
|
|
6507
|
+
specification,
|
|
6508
|
+
domain,
|
|
6509
|
+
pageGroup
|
|
6510
|
+
];
|
|
6511
|
+
const {
|
|
6512
|
+
data: dataResponse,
|
|
6513
|
+
isFetched: isQueryFetched,
|
|
6514
|
+
isPlaceholderData,
|
|
6515
|
+
isLoading,
|
|
6516
|
+
isFetching
|
|
6517
|
+
} = useGetListData4(listDataProps, queryKey, enabled);
|
|
6518
|
+
const {
|
|
6519
|
+
columns: columnsGroup,
|
|
6520
|
+
rows: rowsGroup,
|
|
6521
|
+
typeTable: typeTableGroup
|
|
6522
|
+
} = tableController({
|
|
6523
|
+
data: {
|
|
6524
|
+
fields: viewData?.views?.list?.fields,
|
|
6525
|
+
records: dataResponse?.records ?? dataResponse?.groups,
|
|
6526
|
+
dataModel: viewData?.models?.[model],
|
|
6527
|
+
context: env.context,
|
|
6528
|
+
typeTable: dataResponse?.groups ? "group" : "list"
|
|
6529
|
+
}
|
|
6530
|
+
});
|
|
6531
|
+
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
6532
|
+
useEffect16(() => {
|
|
6533
|
+
if (isShowGroup && selectedTags?.length > 0) {
|
|
6534
|
+
setIsShowGroup(false);
|
|
6535
|
+
}
|
|
6536
|
+
}, [selectedTags]);
|
|
6537
|
+
const group_by_field_name = groupByDomain?.contexts[level - 1]?.group_by;
|
|
6538
|
+
const nameGroup = Array.isArray(row[group_by_field_name]) ? row?.string ?? row[`${group_by_field_name}`][1] : viewData?.models?.[model]?.[group_by_field_name]?.selection ? viewData.models[model][group_by_field_name].selection.find(
|
|
6539
|
+
(selectItem) => selectItem?.[0] === row[group_by_field_name]
|
|
6540
|
+
)?.[1] : row[group_by_field_name];
|
|
6541
|
+
const nameGroupWithCount = `${typeof nameGroup === "string" ? nameGroup : typeof nameGroup === "boolean" && nameGroup ? i18n_default.t("yes") : i18n_default.t("no")} (${row[`${group_by_field_name?.split(":")?.[0]}_count`]})`;
|
|
6542
|
+
const allIdsNull = selectedRowKeys?.every((item) => item === void 0);
|
|
6543
|
+
const handleExpandChildGroup = () => {
|
|
6544
|
+
if (isLoading || isFetching) return;
|
|
6545
|
+
const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
|
|
6546
|
+
if (allIdsNull || typeTableGroup === "group") {
|
|
6547
|
+
toggleShowGroup();
|
|
6548
|
+
return;
|
|
6549
|
+
}
|
|
6550
|
+
if (isShowGroup && checkedAll) {
|
|
6551
|
+
const ids = rowsGroup?.map((item) => item?.id) || [];
|
|
6552
|
+
const filteredIds = selectedRowKeys.filter(
|
|
6553
|
+
(id) => !ids.includes(id)
|
|
6554
|
+
);
|
|
6555
|
+
appDispatch(setSelectedRowKeys3(filteredIds));
|
|
6556
|
+
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6557
|
+
const clonedKeys = [...selectedRowKeys];
|
|
6558
|
+
appDispatch(setSelectedRowKeys3([...clonedKeys, -1]));
|
|
6559
|
+
setTimeout(() => appDispatch(setSelectedRowKeys3(clonedKeys)), 500);
|
|
6560
|
+
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
6561
|
+
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
6562
|
+
appDispatch(setSelectedRowKeys3(filteredKeys));
|
|
6563
|
+
}
|
|
6564
|
+
toggleShowGroup();
|
|
6565
|
+
};
|
|
6566
|
+
useEffect16(() => {
|
|
6567
|
+
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
6568
|
+
return;
|
|
6569
|
+
}
|
|
6570
|
+
const clonedKeys = [...selectedRowKeys];
|
|
6571
|
+
setSelectedRowKeys3([...clonedKeys, -1]);
|
|
6572
|
+
setTimeout(() => setSelectedRowKeys3(clonedKeys), 500);
|
|
6573
|
+
}, [isQueryFetched]);
|
|
6574
|
+
return {
|
|
6575
|
+
handleExpandChildGroup,
|
|
6576
|
+
colEmptyGroup,
|
|
6577
|
+
leftPadding,
|
|
6578
|
+
isShowGroup,
|
|
6579
|
+
isQueryFetched,
|
|
6580
|
+
nameGroupWithCount,
|
|
6581
|
+
columns,
|
|
6582
|
+
row,
|
|
6583
|
+
isPlaceholderData,
|
|
6584
|
+
columnsGroup,
|
|
6585
|
+
indexRow,
|
|
6586
|
+
rowsGroup,
|
|
6587
|
+
model,
|
|
6588
|
+
viewData,
|
|
6589
|
+
renderField,
|
|
6590
|
+
level,
|
|
6591
|
+
specification,
|
|
6592
|
+
context,
|
|
6593
|
+
checkedAll,
|
|
6594
|
+
isDisplayCheckbox,
|
|
6595
|
+
isAutoSelect,
|
|
6596
|
+
setIsAutoSelect,
|
|
6597
|
+
selectedRowKeysRef,
|
|
6598
|
+
initVal,
|
|
6599
|
+
dataResponse,
|
|
6600
|
+
pageGroup,
|
|
6601
|
+
setPageGroup
|
|
6602
|
+
};
|
|
6603
|
+
};
|
|
6330
6604
|
export {
|
|
6331
6605
|
API_APP_URL,
|
|
6332
6606
|
API_PRESCHOOL_URL,
|
|
@@ -6357,6 +6631,10 @@ export {
|
|
|
6357
6631
|
priorityFieldController,
|
|
6358
6632
|
setStorageItemAsync,
|
|
6359
6633
|
statusDropdownController,
|
|
6634
|
+
tableBodyController,
|
|
6635
|
+
tableController,
|
|
6636
|
+
tableGroupController,
|
|
6637
|
+
tableHeadController,
|
|
6360
6638
|
useAppProvider,
|
|
6361
6639
|
useAuth,
|
|
6362
6640
|
useCallAction,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fctc/widget-logic",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"@types/react-dom": "^19.1.7",
|
|
51
51
|
"i18next": "^25.3.2",
|
|
52
52
|
"i18next-browser-languagedetector": "^8.2.0",
|
|
53
|
-
"react-datepicker": "^8.4.0",
|
|
54
53
|
"react-dom": "^19.1.1",
|
|
55
54
|
"react-i18next": "^15.6.1",
|
|
56
55
|
"react-tooltip": "^5.29.1"
|