@fctc/widget-logic 5.3.6 → 5.3.7-beta.3
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 +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +3 -79
- package/dist/index.mjs +3 -79
- package/dist/widget.d.mts +1 -20
- package/dist/widget.d.ts +1 -20
- package/dist/widget.js +3 -79
- package/dist/widget.mjs +3 -78
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { useAddEntity, useButton, useChangeOrderPreparationState, useChangeStatus, useCheckPayment, useCreateEntity, useCreatePosConfig, useCreateSession, useDelete, useDeleteComment, useDeleteEntity, useDuplicateRecord, useExecuteImport, useExportExcel, useForgotPassword, useForgotPasswordSSO, useGenSerialNumber, useGeneratePaymentQrInfo, useGet2FAMethods, useGetASession, useGetAccessByCode, useGetActionDetail, useGetAll, useGetCalendar, useGetComment, useGetCompanyInfo, useGetConversionRate, useGetCurrency, useGetCurrentCompany, useGetDetail, useGetExternalTabs, useGetFieldExport, useGetFieldOnChange, useGetFileExcel, useGetFormView, useGetGroups, useGetList, useGetListCompany, useGetListData, useGetListMyBankAccount, useGetMenu, useGetOrderLine, useGetPinCode, useGetPrintReport, useGetProGressBar, useGetProfile, useGetProvider, useGetResequence, useGetSelection, useGetUser, useGetView, useGrantAccess, useIsValidToken, useLoadAction, useLoadMessage, useLoginCredential, useLoginSocial, useLogout, useModel, useOdooDataTransform, useOnChangeForm, useParsePreview, usePrint, useReadGroup, useRemoveRow, useRemoveTotpSetup, useRequestSetupTotp, useResetPassword, useResetPasswordSSO, useRunAction, useSave, useSendComment, useSettingsWebRead2fa, useSignInSSO, useSwitchLocale, useUpdatePassword, useUploadFile, useUploadFileExcel, useUploadIdFile, useUploadImage, useValidateActionToken, useVerify2FA, useVerifyTotp } from '@fctc/interface-logic/hooks';
|
|
2
2
|
export { ActionResultType, AppProvider, CompanyTuple, ContextProfile, CurrentCompany, RecordMenu, UseMenuReturn, ViewResponse, useAppProvider, useCallAction, useCallActionType, useCompany, useCompanyType, useConfig, useConfigType, useDebounce, useDetail, useGetAction, useGetRowIds, useGetSpecification, useListData, useListDataType, useMenu, useMenuType, useProfile, useUser, useUserType, useViewV2, useViewV2Type } from './hooks.mjs';
|
|
3
3
|
export * from '@fctc/interface-logic/configs';
|
|
4
|
-
export { ISelctionStateProps, ITableHeadProps, ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController,
|
|
4
|
+
export { ISelctionStateProps, ITableHeadProps, ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController, downLoadBinaryController, downloadFileController, durationController, many2manyBinaryController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, providerEinvoiceFieldController, searchController, statusDropdownController, tableController, tableGroupController, tableHeadController } from './widget.mjs';
|
|
5
5
|
export * from '@fctc/interface-logic/types';
|
|
6
6
|
export { IInputFieldProps, ValuePropsType } from './types.mjs';
|
|
7
7
|
export { STORAGES, countSum, guessTypeFromUrl, isObjectEmpty, languages, mergeButtons, setStorageItemAsync, useStorageState, validateAndParseDate } from './utils.mjs';
|
|
@@ -13,4 +13,3 @@ export * from '@fctc/interface-logic/services';
|
|
|
13
13
|
import 'react/jsx-runtime';
|
|
14
14
|
import '@tanstack/query-core';
|
|
15
15
|
import 'react';
|
|
16
|
-
import 'moment';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { useAddEntity, useButton, useChangeOrderPreparationState, useChangeStatus, useCheckPayment, useCreateEntity, useCreatePosConfig, useCreateSession, useDelete, useDeleteComment, useDeleteEntity, useDuplicateRecord, useExecuteImport, useExportExcel, useForgotPassword, useForgotPasswordSSO, useGenSerialNumber, useGeneratePaymentQrInfo, useGet2FAMethods, useGetASession, useGetAccessByCode, useGetActionDetail, useGetAll, useGetCalendar, useGetComment, useGetCompanyInfo, useGetConversionRate, useGetCurrency, useGetCurrentCompany, useGetDetail, useGetExternalTabs, useGetFieldExport, useGetFieldOnChange, useGetFileExcel, useGetFormView, useGetGroups, useGetList, useGetListCompany, useGetListData, useGetListMyBankAccount, useGetMenu, useGetOrderLine, useGetPinCode, useGetPrintReport, useGetProGressBar, useGetProfile, useGetProvider, useGetResequence, useGetSelection, useGetUser, useGetView, useGrantAccess, useIsValidToken, useLoadAction, useLoadMessage, useLoginCredential, useLoginSocial, useLogout, useModel, useOdooDataTransform, useOnChangeForm, useParsePreview, usePrint, useReadGroup, useRemoveRow, useRemoveTotpSetup, useRequestSetupTotp, useResetPassword, useResetPasswordSSO, useRunAction, useSave, useSendComment, useSettingsWebRead2fa, useSignInSSO, useSwitchLocale, useUpdatePassword, useUploadFile, useUploadFileExcel, useUploadIdFile, useUploadImage, useValidateActionToken, useVerify2FA, useVerifyTotp } from '@fctc/interface-logic/hooks';
|
|
2
2
|
export { ActionResultType, AppProvider, CompanyTuple, ContextProfile, CurrentCompany, RecordMenu, UseMenuReturn, ViewResponse, useAppProvider, useCallAction, useCallActionType, useCompany, useCompanyType, useConfig, useConfigType, useDebounce, useDetail, useGetAction, useGetRowIds, useGetSpecification, useListData, useListDataType, useMenu, useMenuType, useProfile, useUser, useUserType, useViewV2, useViewV2Type } from './hooks.js';
|
|
3
3
|
export * from '@fctc/interface-logic/configs';
|
|
4
|
-
export { ISelctionStateProps, ITableHeadProps, ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController,
|
|
4
|
+
export { ISelctionStateProps, ITableHeadProps, ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController, downLoadBinaryController, downloadFileController, durationController, many2manyBinaryController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, providerEinvoiceFieldController, searchController, statusDropdownController, tableController, tableGroupController, tableHeadController } from './widget.js';
|
|
5
5
|
export * from '@fctc/interface-logic/types';
|
|
6
6
|
export { IInputFieldProps, ValuePropsType } from './types.js';
|
|
7
7
|
export { STORAGES, countSum, guessTypeFromUrl, isObjectEmpty, languages, mergeButtons, setStorageItemAsync, useStorageState, validateAndParseDate } from './utils.js';
|
|
@@ -13,4 +13,3 @@ export * from '@fctc/interface-logic/services';
|
|
|
13
13
|
import 'react/jsx-runtime';
|
|
14
14
|
import '@tanstack/query-core';
|
|
15
15
|
import 'react';
|
|
16
|
-
import 'moment';
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,6 @@ __export(index_exports, {
|
|
|
37
37
|
colorFieldController: () => colorFieldController,
|
|
38
38
|
copyLinkButtonController: () => copyLinkButtonController,
|
|
39
39
|
countSum: () => countSum,
|
|
40
|
-
dateFieldController: () => dateFieldController,
|
|
41
40
|
downLoadBinaryController: () => downLoadBinaryController,
|
|
42
41
|
downloadFileController: () => downloadFileController,
|
|
43
42
|
durationController: () => durationController,
|
|
@@ -1990,80 +1989,6 @@ var downLoadBinaryController = (props) => {
|
|
|
1990
1989
|
};
|
|
1991
1990
|
};
|
|
1992
1991
|
|
|
1993
|
-
// src/widget/basic/date-field/controller.ts
|
|
1994
|
-
var import_moment2 = __toESM(require("moment"));
|
|
1995
|
-
var DURATIONS = {
|
|
1996
|
-
PAST: "past",
|
|
1997
|
-
NOW: "now",
|
|
1998
|
-
FUTURE: "future"
|
|
1999
|
-
};
|
|
2000
|
-
var dateFieldController = (props) => {
|
|
2001
|
-
const {
|
|
2002
|
-
string,
|
|
2003
|
-
showTime = false,
|
|
2004
|
-
widget,
|
|
2005
|
-
min,
|
|
2006
|
-
max,
|
|
2007
|
-
viewData,
|
|
2008
|
-
formValues,
|
|
2009
|
-
model
|
|
2010
|
-
} = props;
|
|
2011
|
-
const range = (start, end, step = 1) => {
|
|
2012
|
-
const arr = [];
|
|
2013
|
-
for (let i = start; i < end; i += step) {
|
|
2014
|
-
arr.push(i);
|
|
2015
|
-
}
|
|
2016
|
-
return arr;
|
|
2017
|
-
};
|
|
2018
|
-
const formatDateParse = showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
2019
|
-
const fieldForCustom = widget === "datetime_custom" || widget === "date_custom";
|
|
2020
|
-
const minNowValue = fieldForCustom && (min === DURATIONS.NOW ? true : typeof min === "string" && Object.keys(formValues)?.includes(min) && formValues?.[min] ? (0, import_moment2.default)(formValues?.[min], formatDateParse).add(7, "hours") : null);
|
|
2021
|
-
const maxNowValue = fieldForCustom && (max === DURATIONS.NOW ? true : typeof max === "string" && Object.keys(formValues)?.includes(max) && formValues?.[max] ? (0, import_moment2.default)(formValues?.[max], formatDateParse).add(7, "hours") : null);
|
|
2022
|
-
const years = range(
|
|
2023
|
-
minNowValue ? (/* @__PURE__ */ new Date()).getFullYear() : 1960,
|
|
2024
|
-
(/* @__PURE__ */ new Date()).getFullYear() + 4,
|
|
2025
|
-
1
|
|
2026
|
-
);
|
|
2027
|
-
const months_vi = [
|
|
2028
|
-
"Th\xE1ng 1",
|
|
2029
|
-
"Th\xE1ng 2",
|
|
2030
|
-
"Th\xE1ng 3",
|
|
2031
|
-
"Th\xE1ng 4",
|
|
2032
|
-
"Th\xE1ng 5",
|
|
2033
|
-
"Th\xE1ng 6",
|
|
2034
|
-
"Th\xE1ng 7",
|
|
2035
|
-
"Th\xE1ng 8",
|
|
2036
|
-
"Th\xE1ng 9",
|
|
2037
|
-
"Th\xE1ng 10",
|
|
2038
|
-
"Th\xE1ng 11",
|
|
2039
|
-
"Th\xE1ng 12"
|
|
2040
|
-
];
|
|
2041
|
-
const months_en = [
|
|
2042
|
-
"January",
|
|
2043
|
-
"February",
|
|
2044
|
-
"March",
|
|
2045
|
-
"April",
|
|
2046
|
-
"May",
|
|
2047
|
-
"June",
|
|
2048
|
-
"July",
|
|
2049
|
-
"August",
|
|
2050
|
-
"September",
|
|
2051
|
-
"October",
|
|
2052
|
-
"November",
|
|
2053
|
-
"December"
|
|
2054
|
-
];
|
|
2055
|
-
return {
|
|
2056
|
-
formatDateParse,
|
|
2057
|
-
range,
|
|
2058
|
-
years,
|
|
2059
|
-
months_vi,
|
|
2060
|
-
months_en,
|
|
2061
|
-
// customValidateMinMax,
|
|
2062
|
-
minNowValue,
|
|
2063
|
-
maxNowValue
|
|
2064
|
-
};
|
|
2065
|
-
};
|
|
2066
|
-
|
|
2067
1992
|
// src/widget/basic/copy-link-button/controller.ts
|
|
2068
1993
|
var import_react20 = require("react");
|
|
2069
1994
|
var copyTextToClipboard = async (text) => {
|
|
@@ -2603,7 +2528,7 @@ var tableGroupController = (props) => {
|
|
|
2603
2528
|
};
|
|
2604
2529
|
|
|
2605
2530
|
// src/widget/advance/search/controller.ts
|
|
2606
|
-
var
|
|
2531
|
+
var import_moment2 = __toESM(require("moment"));
|
|
2607
2532
|
var import_react26 = require("react");
|
|
2608
2533
|
|
|
2609
2534
|
// src/constants.ts
|
|
@@ -2741,8 +2666,8 @@ var searchController = ({
|
|
|
2741
2666
|
} else if (value?.modelType === "datetime") {
|
|
2742
2667
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
2743
2668
|
const parsedDate = validateAndParseDate(value?.value, true);
|
|
2744
|
-
const hasTime = (0,
|
|
2745
|
-
valueDomainItem = hasTime ? (0,
|
|
2669
|
+
const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
2670
|
+
valueDomainItem = hasTime ? (0, import_moment2.default)(parsedDate).format("YYYY-MM-DD HH:mm:ss") : (0, import_moment2.default)(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
|
|
2746
2671
|
} else {
|
|
2747
2672
|
valueDomainItem = validateAndParseDate(value?.value, true);
|
|
2748
2673
|
}
|
|
@@ -2962,7 +2887,6 @@ __reExport(index_exports, types_exports, module.exports);
|
|
|
2962
2887
|
colorFieldController,
|
|
2963
2888
|
copyLinkButtonController,
|
|
2964
2889
|
countSum,
|
|
2965
|
-
dateFieldController,
|
|
2966
2890
|
downLoadBinaryController,
|
|
2967
2891
|
downloadFileController,
|
|
2968
2892
|
durationController,
|
package/dist/index.mjs
CHANGED
|
@@ -25,7 +25,6 @@ __export(index_exports, {
|
|
|
25
25
|
colorFieldController: () => colorFieldController,
|
|
26
26
|
copyLinkButtonController: () => copyLinkButtonController,
|
|
27
27
|
countSum: () => countSum,
|
|
28
|
-
dateFieldController: () => dateFieldController,
|
|
29
28
|
downLoadBinaryController: () => downLoadBinaryController,
|
|
30
29
|
downloadFileController: () => downloadFileController,
|
|
31
30
|
durationController: () => durationController,
|
|
@@ -2067,80 +2066,6 @@ var downLoadBinaryController = (props) => {
|
|
|
2067
2066
|
};
|
|
2068
2067
|
};
|
|
2069
2068
|
|
|
2070
|
-
// src/widget/basic/date-field/controller.ts
|
|
2071
|
-
import moment2 from "moment";
|
|
2072
|
-
var DURATIONS = {
|
|
2073
|
-
PAST: "past",
|
|
2074
|
-
NOW: "now",
|
|
2075
|
-
FUTURE: "future"
|
|
2076
|
-
};
|
|
2077
|
-
var dateFieldController = (props) => {
|
|
2078
|
-
const {
|
|
2079
|
-
string,
|
|
2080
|
-
showTime = false,
|
|
2081
|
-
widget,
|
|
2082
|
-
min,
|
|
2083
|
-
max,
|
|
2084
|
-
viewData,
|
|
2085
|
-
formValues,
|
|
2086
|
-
model
|
|
2087
|
-
} = props;
|
|
2088
|
-
const range = (start, end, step = 1) => {
|
|
2089
|
-
const arr = [];
|
|
2090
|
-
for (let i = start; i < end; i += step) {
|
|
2091
|
-
arr.push(i);
|
|
2092
|
-
}
|
|
2093
|
-
return arr;
|
|
2094
|
-
};
|
|
2095
|
-
const formatDateParse = showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
2096
|
-
const fieldForCustom = widget === "datetime_custom" || widget === "date_custom";
|
|
2097
|
-
const minNowValue = fieldForCustom && (min === DURATIONS.NOW ? true : typeof min === "string" && Object.keys(formValues)?.includes(min) && formValues?.[min] ? moment2(formValues?.[min], formatDateParse).add(7, "hours") : null);
|
|
2098
|
-
const maxNowValue = fieldForCustom && (max === DURATIONS.NOW ? true : typeof max === "string" && Object.keys(formValues)?.includes(max) && formValues?.[max] ? moment2(formValues?.[max], formatDateParse).add(7, "hours") : null);
|
|
2099
|
-
const years = range(
|
|
2100
|
-
minNowValue ? (/* @__PURE__ */ new Date()).getFullYear() : 1960,
|
|
2101
|
-
(/* @__PURE__ */ new Date()).getFullYear() + 4,
|
|
2102
|
-
1
|
|
2103
|
-
);
|
|
2104
|
-
const months_vi = [
|
|
2105
|
-
"Th\xE1ng 1",
|
|
2106
|
-
"Th\xE1ng 2",
|
|
2107
|
-
"Th\xE1ng 3",
|
|
2108
|
-
"Th\xE1ng 4",
|
|
2109
|
-
"Th\xE1ng 5",
|
|
2110
|
-
"Th\xE1ng 6",
|
|
2111
|
-
"Th\xE1ng 7",
|
|
2112
|
-
"Th\xE1ng 8",
|
|
2113
|
-
"Th\xE1ng 9",
|
|
2114
|
-
"Th\xE1ng 10",
|
|
2115
|
-
"Th\xE1ng 11",
|
|
2116
|
-
"Th\xE1ng 12"
|
|
2117
|
-
];
|
|
2118
|
-
const months_en = [
|
|
2119
|
-
"January",
|
|
2120
|
-
"February",
|
|
2121
|
-
"March",
|
|
2122
|
-
"April",
|
|
2123
|
-
"May",
|
|
2124
|
-
"June",
|
|
2125
|
-
"July",
|
|
2126
|
-
"August",
|
|
2127
|
-
"September",
|
|
2128
|
-
"October",
|
|
2129
|
-
"November",
|
|
2130
|
-
"December"
|
|
2131
|
-
];
|
|
2132
|
-
return {
|
|
2133
|
-
formatDateParse,
|
|
2134
|
-
range,
|
|
2135
|
-
years,
|
|
2136
|
-
months_vi,
|
|
2137
|
-
months_en,
|
|
2138
|
-
// customValidateMinMax,
|
|
2139
|
-
minNowValue,
|
|
2140
|
-
maxNowValue
|
|
2141
|
-
};
|
|
2142
|
-
};
|
|
2143
|
-
|
|
2144
2069
|
// src/widget/basic/copy-link-button/controller.ts
|
|
2145
2070
|
import { useState as useState11 } from "react";
|
|
2146
2071
|
var copyTextToClipboard = async (text) => {
|
|
@@ -2680,7 +2605,7 @@ var tableGroupController = (props) => {
|
|
|
2680
2605
|
};
|
|
2681
2606
|
|
|
2682
2607
|
// src/widget/advance/search/controller.ts
|
|
2683
|
-
import
|
|
2608
|
+
import moment2 from "moment";
|
|
2684
2609
|
import { useCallback as useCallback7, useEffect as useEffect14, useState as useState16 } from "react";
|
|
2685
2610
|
|
|
2686
2611
|
// src/constants.ts
|
|
@@ -2819,8 +2744,8 @@ var searchController = ({
|
|
|
2819
2744
|
} else if (value?.modelType === "datetime") {
|
|
2820
2745
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
2821
2746
|
const parsedDate = validateAndParseDate(value?.value, true);
|
|
2822
|
-
const hasTime =
|
|
2823
|
-
valueDomainItem = hasTime ?
|
|
2747
|
+
const hasTime = moment2(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
2748
|
+
valueDomainItem = hasTime ? moment2(parsedDate).format("YYYY-MM-DD HH:mm:ss") : moment2(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
|
|
2824
2749
|
} else {
|
|
2825
2750
|
valueDomainItem = validateAndParseDate(value?.value, true);
|
|
2826
2751
|
}
|
|
@@ -3042,7 +2967,6 @@ export {
|
|
|
3042
2967
|
colorFieldController,
|
|
3043
2968
|
copyLinkButtonController,
|
|
3044
2969
|
countSum,
|
|
3045
|
-
dateFieldController,
|
|
3046
2970
|
downLoadBinaryController,
|
|
3047
2971
|
downloadFileController,
|
|
3048
2972
|
durationController,
|
package/dist/widget.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ChangeEvent } from 'react';
|
|
3
3
|
import { IInputFieldProps } from './types.mjs';
|
|
4
|
-
import moment from 'moment';
|
|
5
4
|
import '@fctc/interface-logic/types';
|
|
6
5
|
|
|
7
6
|
type TStatus = 'normal' | 'done' | 'blocked';
|
|
@@ -178,24 +177,6 @@ declare const downLoadBinaryController: (props: IInputFieldProps) => {
|
|
|
178
177
|
handleFileDownload: (e: any) => Promise<void>;
|
|
179
178
|
};
|
|
180
179
|
|
|
181
|
-
interface IDateFieldProps extends IInputFieldProps {
|
|
182
|
-
showTime: boolean;
|
|
183
|
-
widget: string;
|
|
184
|
-
min: number | string;
|
|
185
|
-
max: number | string;
|
|
186
|
-
viewData: any;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
declare const dateFieldController: (props: IDateFieldProps) => {
|
|
190
|
-
formatDateParse: string;
|
|
191
|
-
range: (start: number, end: number, step?: number) => number[];
|
|
192
|
-
years: number[];
|
|
193
|
-
months_vi: string[];
|
|
194
|
-
months_en: string[];
|
|
195
|
-
minNowValue: boolean | moment.Moment | null;
|
|
196
|
-
maxNowValue: boolean | moment.Moment | null;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
180
|
declare const copyLinkButtonController: (props: IInputFieldProps) => {
|
|
200
181
|
isCopied: boolean;
|
|
201
182
|
handleCopyToClipboard: (value: string) => Promise<void>;
|
|
@@ -344,4 +325,4 @@ declare const searchController: ({ viewData, model, domain, context, fieldsList,
|
|
|
344
325
|
hoveredIndexSearchList: number | null;
|
|
345
326
|
};
|
|
346
327
|
|
|
347
|
-
export { type ISelctionStateProps, type ITableHeadProps, type ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController,
|
|
328
|
+
export { type ISelctionStateProps, type ITableHeadProps, type ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController, downLoadBinaryController, downloadFileController, durationController, many2manyBinaryController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, providerEinvoiceFieldController, searchController, statusDropdownController, tableController, tableGroupController, tableHeadController };
|
package/dist/widget.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ChangeEvent } from 'react';
|
|
3
3
|
import { IInputFieldProps } from './types.js';
|
|
4
|
-
import moment from 'moment';
|
|
5
4
|
import '@fctc/interface-logic/types';
|
|
6
5
|
|
|
7
6
|
type TStatus = 'normal' | 'done' | 'blocked';
|
|
@@ -178,24 +177,6 @@ declare const downLoadBinaryController: (props: IInputFieldProps) => {
|
|
|
178
177
|
handleFileDownload: (e: any) => Promise<void>;
|
|
179
178
|
};
|
|
180
179
|
|
|
181
|
-
interface IDateFieldProps extends IInputFieldProps {
|
|
182
|
-
showTime: boolean;
|
|
183
|
-
widget: string;
|
|
184
|
-
min: number | string;
|
|
185
|
-
max: number | string;
|
|
186
|
-
viewData: any;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
declare const dateFieldController: (props: IDateFieldProps) => {
|
|
190
|
-
formatDateParse: string;
|
|
191
|
-
range: (start: number, end: number, step?: number) => number[];
|
|
192
|
-
years: number[];
|
|
193
|
-
months_vi: string[];
|
|
194
|
-
months_en: string[];
|
|
195
|
-
minNowValue: boolean | moment.Moment | null;
|
|
196
|
-
maxNowValue: boolean | moment.Moment | null;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
180
|
declare const copyLinkButtonController: (props: IInputFieldProps) => {
|
|
200
181
|
isCopied: boolean;
|
|
201
182
|
handleCopyToClipboard: (value: string) => Promise<void>;
|
|
@@ -344,4 +325,4 @@ declare const searchController: ({ viewData, model, domain, context, fieldsList,
|
|
|
344
325
|
hoveredIndexSearchList: number | null;
|
|
345
326
|
};
|
|
346
327
|
|
|
347
|
-
export { type ISelctionStateProps, type ITableHeadProps, type ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController,
|
|
328
|
+
export { type ISelctionStateProps, type ITableHeadProps, type ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController, downLoadBinaryController, downloadFileController, durationController, many2manyBinaryController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, providerEinvoiceFieldController, searchController, statusDropdownController, tableController, tableGroupController, tableHeadController };
|
package/dist/widget.js
CHANGED
|
@@ -34,7 +34,6 @@ __export(widget_exports, {
|
|
|
34
34
|
binaryFieldController: () => binaryFieldController,
|
|
35
35
|
colorFieldController: () => colorFieldController,
|
|
36
36
|
copyLinkButtonController: () => copyLinkButtonController,
|
|
37
|
-
dateFieldController: () => dateFieldController,
|
|
38
37
|
downLoadBinaryController: () => downLoadBinaryController,
|
|
39
38
|
downloadFileController: () => downloadFileController,
|
|
40
39
|
durationController: () => durationController,
|
|
@@ -1493,80 +1492,6 @@ var downLoadBinaryController = (props) => {
|
|
|
1493
1492
|
};
|
|
1494
1493
|
};
|
|
1495
1494
|
|
|
1496
|
-
// src/widget/basic/date-field/controller.ts
|
|
1497
|
-
var import_moment2 = __toESM(require("moment"));
|
|
1498
|
-
var DURATIONS = {
|
|
1499
|
-
PAST: "past",
|
|
1500
|
-
NOW: "now",
|
|
1501
|
-
FUTURE: "future"
|
|
1502
|
-
};
|
|
1503
|
-
var dateFieldController = (props) => {
|
|
1504
|
-
const {
|
|
1505
|
-
string,
|
|
1506
|
-
showTime = false,
|
|
1507
|
-
widget,
|
|
1508
|
-
min,
|
|
1509
|
-
max,
|
|
1510
|
-
viewData,
|
|
1511
|
-
formValues,
|
|
1512
|
-
model
|
|
1513
|
-
} = props;
|
|
1514
|
-
const range = (start, end, step = 1) => {
|
|
1515
|
-
const arr = [];
|
|
1516
|
-
for (let i = start; i < end; i += step) {
|
|
1517
|
-
arr.push(i);
|
|
1518
|
-
}
|
|
1519
|
-
return arr;
|
|
1520
|
-
};
|
|
1521
|
-
const formatDateParse = showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
1522
|
-
const fieldForCustom = widget === "datetime_custom" || widget === "date_custom";
|
|
1523
|
-
const minNowValue = fieldForCustom && (min === DURATIONS.NOW ? true : typeof min === "string" && Object.keys(formValues)?.includes(min) && formValues?.[min] ? (0, import_moment2.default)(formValues?.[min], formatDateParse).add(7, "hours") : null);
|
|
1524
|
-
const maxNowValue = fieldForCustom && (max === DURATIONS.NOW ? true : typeof max === "string" && Object.keys(formValues)?.includes(max) && formValues?.[max] ? (0, import_moment2.default)(formValues?.[max], formatDateParse).add(7, "hours") : null);
|
|
1525
|
-
const years = range(
|
|
1526
|
-
minNowValue ? (/* @__PURE__ */ new Date()).getFullYear() : 1960,
|
|
1527
|
-
(/* @__PURE__ */ new Date()).getFullYear() + 4,
|
|
1528
|
-
1
|
|
1529
|
-
);
|
|
1530
|
-
const months_vi = [
|
|
1531
|
-
"Th\xE1ng 1",
|
|
1532
|
-
"Th\xE1ng 2",
|
|
1533
|
-
"Th\xE1ng 3",
|
|
1534
|
-
"Th\xE1ng 4",
|
|
1535
|
-
"Th\xE1ng 5",
|
|
1536
|
-
"Th\xE1ng 6",
|
|
1537
|
-
"Th\xE1ng 7",
|
|
1538
|
-
"Th\xE1ng 8",
|
|
1539
|
-
"Th\xE1ng 9",
|
|
1540
|
-
"Th\xE1ng 10",
|
|
1541
|
-
"Th\xE1ng 11",
|
|
1542
|
-
"Th\xE1ng 12"
|
|
1543
|
-
];
|
|
1544
|
-
const months_en = [
|
|
1545
|
-
"January",
|
|
1546
|
-
"February",
|
|
1547
|
-
"March",
|
|
1548
|
-
"April",
|
|
1549
|
-
"May",
|
|
1550
|
-
"June",
|
|
1551
|
-
"July",
|
|
1552
|
-
"August",
|
|
1553
|
-
"September",
|
|
1554
|
-
"October",
|
|
1555
|
-
"November",
|
|
1556
|
-
"December"
|
|
1557
|
-
];
|
|
1558
|
-
return {
|
|
1559
|
-
formatDateParse,
|
|
1560
|
-
range,
|
|
1561
|
-
years,
|
|
1562
|
-
months_vi,
|
|
1563
|
-
months_en,
|
|
1564
|
-
// customValidateMinMax,
|
|
1565
|
-
minNowValue,
|
|
1566
|
-
maxNowValue
|
|
1567
|
-
};
|
|
1568
|
-
};
|
|
1569
|
-
|
|
1570
1495
|
// src/widget/basic/copy-link-button/controller.ts
|
|
1571
1496
|
var import_react20 = require("react");
|
|
1572
1497
|
var copyTextToClipboard = async (text) => {
|
|
@@ -2106,7 +2031,7 @@ var tableGroupController = (props) => {
|
|
|
2106
2031
|
};
|
|
2107
2032
|
|
|
2108
2033
|
// src/widget/advance/search/controller.ts
|
|
2109
|
-
var
|
|
2034
|
+
var import_moment2 = __toESM(require("moment"));
|
|
2110
2035
|
var import_react26 = require("react");
|
|
2111
2036
|
|
|
2112
2037
|
// src/constants.ts
|
|
@@ -2244,8 +2169,8 @@ var searchController = ({
|
|
|
2244
2169
|
} else if (value?.modelType === "datetime") {
|
|
2245
2170
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
2246
2171
|
const parsedDate = validateAndParseDate(value?.value, true);
|
|
2247
|
-
const hasTime = (0,
|
|
2248
|
-
valueDomainItem = hasTime ? (0,
|
|
2172
|
+
const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
2173
|
+
valueDomainItem = hasTime ? (0, import_moment2.default)(parsedDate).format("YYYY-MM-DD HH:mm:ss") : (0, import_moment2.default)(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
|
|
2249
2174
|
} else {
|
|
2250
2175
|
valueDomainItem = validateAndParseDate(value?.value, true);
|
|
2251
2176
|
}
|
|
@@ -2436,7 +2361,6 @@ var searchController = ({
|
|
|
2436
2361
|
binaryFieldController,
|
|
2437
2362
|
colorFieldController,
|
|
2438
2363
|
copyLinkButtonController,
|
|
2439
|
-
dateFieldController,
|
|
2440
2364
|
downLoadBinaryController,
|
|
2441
2365
|
downloadFileController,
|
|
2442
2366
|
durationController,
|
package/dist/widget.mjs
CHANGED
|
@@ -1545,80 +1545,6 @@ var downLoadBinaryController = (props) => {
|
|
|
1545
1545
|
};
|
|
1546
1546
|
};
|
|
1547
1547
|
|
|
1548
|
-
// src/widget/basic/date-field/controller.ts
|
|
1549
|
-
import moment2 from "moment";
|
|
1550
|
-
var DURATIONS = {
|
|
1551
|
-
PAST: "past",
|
|
1552
|
-
NOW: "now",
|
|
1553
|
-
FUTURE: "future"
|
|
1554
|
-
};
|
|
1555
|
-
var dateFieldController = (props) => {
|
|
1556
|
-
const {
|
|
1557
|
-
string,
|
|
1558
|
-
showTime = false,
|
|
1559
|
-
widget,
|
|
1560
|
-
min,
|
|
1561
|
-
max,
|
|
1562
|
-
viewData,
|
|
1563
|
-
formValues,
|
|
1564
|
-
model
|
|
1565
|
-
} = props;
|
|
1566
|
-
const range = (start, end, step = 1) => {
|
|
1567
|
-
const arr = [];
|
|
1568
|
-
for (let i = start; i < end; i += step) {
|
|
1569
|
-
arr.push(i);
|
|
1570
|
-
}
|
|
1571
|
-
return arr;
|
|
1572
|
-
};
|
|
1573
|
-
const formatDateParse = showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
1574
|
-
const fieldForCustom = widget === "datetime_custom" || widget === "date_custom";
|
|
1575
|
-
const minNowValue = fieldForCustom && (min === DURATIONS.NOW ? true : typeof min === "string" && Object.keys(formValues)?.includes(min) && formValues?.[min] ? moment2(formValues?.[min], formatDateParse).add(7, "hours") : null);
|
|
1576
|
-
const maxNowValue = fieldForCustom && (max === DURATIONS.NOW ? true : typeof max === "string" && Object.keys(formValues)?.includes(max) && formValues?.[max] ? moment2(formValues?.[max], formatDateParse).add(7, "hours") : null);
|
|
1577
|
-
const years = range(
|
|
1578
|
-
minNowValue ? (/* @__PURE__ */ new Date()).getFullYear() : 1960,
|
|
1579
|
-
(/* @__PURE__ */ new Date()).getFullYear() + 4,
|
|
1580
|
-
1
|
|
1581
|
-
);
|
|
1582
|
-
const months_vi = [
|
|
1583
|
-
"Th\xE1ng 1",
|
|
1584
|
-
"Th\xE1ng 2",
|
|
1585
|
-
"Th\xE1ng 3",
|
|
1586
|
-
"Th\xE1ng 4",
|
|
1587
|
-
"Th\xE1ng 5",
|
|
1588
|
-
"Th\xE1ng 6",
|
|
1589
|
-
"Th\xE1ng 7",
|
|
1590
|
-
"Th\xE1ng 8",
|
|
1591
|
-
"Th\xE1ng 9",
|
|
1592
|
-
"Th\xE1ng 10",
|
|
1593
|
-
"Th\xE1ng 11",
|
|
1594
|
-
"Th\xE1ng 12"
|
|
1595
|
-
];
|
|
1596
|
-
const months_en = [
|
|
1597
|
-
"January",
|
|
1598
|
-
"February",
|
|
1599
|
-
"March",
|
|
1600
|
-
"April",
|
|
1601
|
-
"May",
|
|
1602
|
-
"June",
|
|
1603
|
-
"July",
|
|
1604
|
-
"August",
|
|
1605
|
-
"September",
|
|
1606
|
-
"October",
|
|
1607
|
-
"November",
|
|
1608
|
-
"December"
|
|
1609
|
-
];
|
|
1610
|
-
return {
|
|
1611
|
-
formatDateParse,
|
|
1612
|
-
range,
|
|
1613
|
-
years,
|
|
1614
|
-
months_vi,
|
|
1615
|
-
months_en,
|
|
1616
|
-
// customValidateMinMax,
|
|
1617
|
-
minNowValue,
|
|
1618
|
-
maxNowValue
|
|
1619
|
-
};
|
|
1620
|
-
};
|
|
1621
|
-
|
|
1622
1548
|
// src/widget/basic/copy-link-button/controller.ts
|
|
1623
1549
|
import { useState as useState11 } from "react";
|
|
1624
1550
|
var copyTextToClipboard = async (text) => {
|
|
@@ -2158,7 +2084,7 @@ var tableGroupController = (props) => {
|
|
|
2158
2084
|
};
|
|
2159
2085
|
|
|
2160
2086
|
// src/widget/advance/search/controller.ts
|
|
2161
|
-
import
|
|
2087
|
+
import moment2 from "moment";
|
|
2162
2088
|
import { useCallback as useCallback7, useEffect as useEffect14, useState as useState16 } from "react";
|
|
2163
2089
|
|
|
2164
2090
|
// src/constants.ts
|
|
@@ -2297,8 +2223,8 @@ var searchController = ({
|
|
|
2297
2223
|
} else if (value?.modelType === "datetime") {
|
|
2298
2224
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
2299
2225
|
const parsedDate = validateAndParseDate(value?.value, true);
|
|
2300
|
-
const hasTime =
|
|
2301
|
-
valueDomainItem = hasTime ?
|
|
2226
|
+
const hasTime = moment2(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
2227
|
+
valueDomainItem = hasTime ? moment2(parsedDate).format("YYYY-MM-DD HH:mm:ss") : moment2(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
|
|
2302
2228
|
} else {
|
|
2303
2229
|
valueDomainItem = validateAndParseDate(value?.value, true);
|
|
2304
2230
|
}
|
|
@@ -2488,7 +2414,6 @@ export {
|
|
|
2488
2414
|
binaryFieldController,
|
|
2489
2415
|
colorFieldController,
|
|
2490
2416
|
copyLinkButtonController,
|
|
2491
|
-
dateFieldController,
|
|
2492
2417
|
downLoadBinaryController,
|
|
2493
2418
|
downloadFileController,
|
|
2494
2419
|
durationController,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fctc/widget-logic",
|
|
3
|
-
"version": "5.3.
|
|
4
|
-
"types": "dist/index.d.ts",
|
|
3
|
+
"version": "5.3.7-beta.3",
|
|
5
4
|
"main": "dist/index.mjs",
|
|
6
5
|
"module": "dist/index.mjs",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"test": "jest"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@fctc/interface-logic": "
|
|
57
|
+
"@fctc/interface-logic": "4.5.11-beta.0",
|
|
58
58
|
"@tanstack/react-query": "^5.84.0",
|
|
59
59
|
"moment": "^2.30.1"
|
|
60
60
|
},
|