@fctc/widget-logic 1.1.5 → 1.1.6
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 +70 -19
- package/dist/index.d.ts +70 -19
- package/dist/index.js +158 -119
- package/dist/index.mjs +140 -87
- package/package.json +66 -66
package/dist/index.js
CHANGED
|
@@ -4930,7 +4930,7 @@ var many2oneFieldController = (props) => {
|
|
|
4930
4930
|
const queryKey = [`data_${relation}`, domainObject];
|
|
4931
4931
|
const {
|
|
4932
4932
|
data: dataOfSelection,
|
|
4933
|
-
refetch,
|
|
4933
|
+
// refetch,
|
|
4934
4934
|
isFetching
|
|
4935
4935
|
} = (0, import_interface_logic10.useGetSelection)({
|
|
4936
4936
|
data,
|
|
@@ -4959,9 +4959,6 @@ var many2oneFieldController = (props) => {
|
|
|
4959
4959
|
});
|
|
4960
4960
|
}
|
|
4961
4961
|
}, [propValue]);
|
|
4962
|
-
const fetchMoreOptions = (0, import_react12.useCallback)(() => {
|
|
4963
|
-
refetch();
|
|
4964
|
-
}, [refetch]);
|
|
4965
4962
|
(0, import_react12.useEffect)(() => {
|
|
4966
4963
|
if (actionId) {
|
|
4967
4964
|
localStorage.setItem("aid", actionId);
|
|
@@ -5027,13 +5024,13 @@ var many2oneFieldController = (props) => {
|
|
|
5027
5024
|
isFetching,
|
|
5028
5025
|
isShowModalMany2Many,
|
|
5029
5026
|
options,
|
|
5030
|
-
fetchMoreOptions,
|
|
5027
|
+
// fetchMoreOptions,
|
|
5031
5028
|
domainModal,
|
|
5032
5029
|
tempSelectedOption,
|
|
5033
5030
|
setTempSelectedOption,
|
|
5034
5031
|
setDomainModal,
|
|
5035
5032
|
dataOfSelection,
|
|
5036
|
-
refetch,
|
|
5033
|
+
// refetch,
|
|
5037
5034
|
selectOptions,
|
|
5038
5035
|
optionsObject,
|
|
5039
5036
|
contextObject,
|
|
@@ -5068,15 +5065,22 @@ var many2oneButtonController = (props) => {
|
|
|
5068
5065
|
};
|
|
5069
5066
|
|
|
5070
5067
|
// src/widget/basic/many2many-field/controller.ts
|
|
5071
|
-
var
|
|
5072
|
-
var
|
|
5068
|
+
var import_react16 = require("react");
|
|
5069
|
+
var import_interface_logic16 = require("@fctc/interface-logic");
|
|
5073
5070
|
|
|
5074
|
-
// src/widget/advance/table/table-
|
|
5071
|
+
// src/widget/advance/table/table-body/controller.ts
|
|
5075
5072
|
var import_interface_logic12 = require("@fctc/interface-logic");
|
|
5076
5073
|
var import_react13 = require("react");
|
|
5074
|
+
|
|
5075
|
+
// src/widget/advance/table/table-head/controller.ts
|
|
5076
|
+
var import_interface_logic13 = require("@fctc/interface-logic");
|
|
5077
|
+
|
|
5078
|
+
// src/widget/advance/table/table-view/controller.ts
|
|
5079
|
+
var import_interface_logic14 = require("@fctc/interface-logic");
|
|
5080
|
+
var import_react14 = require("react");
|
|
5077
5081
|
var tableController = ({ data }) => {
|
|
5078
|
-
const [rows, setRows] = (0,
|
|
5079
|
-
const [columns, setColumns] = (0,
|
|
5082
|
+
const [rows, setRows] = (0, import_react14.useState)(data.records || []);
|
|
5083
|
+
const [columns, setColumns] = (0, import_react14.useState)([]);
|
|
5080
5084
|
const dataModelFields = data.fields?.map((field) => {
|
|
5081
5085
|
return {
|
|
5082
5086
|
...data.dataModel?.[field?.name],
|
|
@@ -5104,14 +5108,14 @@ var tableController = ({ data }) => {
|
|
|
5104
5108
|
return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
|
|
5105
5109
|
});
|
|
5106
5110
|
};
|
|
5107
|
-
(0,
|
|
5111
|
+
(0, import_react14.useEffect)(() => {
|
|
5108
5112
|
setRows(transformData(data.records || null));
|
|
5109
5113
|
}, [data.records]);
|
|
5110
5114
|
const handleGetColumns = () => {
|
|
5111
5115
|
let cols = [];
|
|
5112
5116
|
try {
|
|
5113
5117
|
cols = mergeFields?.filter((item) => {
|
|
5114
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
5118
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_interface_logic14.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_interface_logic14.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
5115
5119
|
})?.map((field) => {
|
|
5116
5120
|
return {
|
|
5117
5121
|
name: field?.name,
|
|
@@ -5125,7 +5129,7 @@ var tableController = ({ data }) => {
|
|
|
5125
5129
|
}
|
|
5126
5130
|
return cols;
|
|
5127
5131
|
};
|
|
5128
|
-
(0,
|
|
5132
|
+
(0, import_react14.useEffect)(() => {
|
|
5129
5133
|
const columns2 = handleGetColumns();
|
|
5130
5134
|
setColumns(columns2);
|
|
5131
5135
|
}, [data.records]);
|
|
@@ -5149,6 +5153,32 @@ var tableController = ({ data }) => {
|
|
|
5149
5153
|
};
|
|
5150
5154
|
};
|
|
5151
5155
|
|
|
5156
|
+
// src/widget/advance/table/table-group/controller.ts
|
|
5157
|
+
var import_interface_logic15 = require("@fctc/interface-logic");
|
|
5158
|
+
var import_react15 = require("react");
|
|
5159
|
+
|
|
5160
|
+
// src/utils/i18n.ts
|
|
5161
|
+
var import_react_i18next2 = require("react-i18next");
|
|
5162
|
+
var import_i18next = __toESM(require("i18next"));
|
|
5163
|
+
var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"));
|
|
5164
|
+
import_i18next.default.use(import_i18next_browser_languagedetector.default).use(import_react_i18next2.initReactI18next).init({
|
|
5165
|
+
resources: {
|
|
5166
|
+
vi: { translation: vi },
|
|
5167
|
+
en: { translation: en }
|
|
5168
|
+
},
|
|
5169
|
+
fallbackLng: "vi",
|
|
5170
|
+
lng: "vi_VN",
|
|
5171
|
+
debug: false,
|
|
5172
|
+
nonExplicitSupportedLngs: true,
|
|
5173
|
+
interpolation: {
|
|
5174
|
+
escapeValue: false
|
|
5175
|
+
},
|
|
5176
|
+
detection: {
|
|
5177
|
+
caches: ["cookie"]
|
|
5178
|
+
}
|
|
5179
|
+
});
|
|
5180
|
+
var i18n_default = import_i18next.default;
|
|
5181
|
+
|
|
5152
5182
|
// src/widget/basic/many2many-field/controller.ts
|
|
5153
5183
|
var many2manyFieldController = (props) => {
|
|
5154
5184
|
const {
|
|
@@ -5158,7 +5188,7 @@ var many2manyFieldController = (props) => {
|
|
|
5158
5188
|
tab,
|
|
5159
5189
|
model,
|
|
5160
5190
|
aid,
|
|
5161
|
-
setSelectedRowKeys,
|
|
5191
|
+
setSelectedRowKeys: setSelectedRowKeys4,
|
|
5162
5192
|
fields,
|
|
5163
5193
|
setFields,
|
|
5164
5194
|
groupByDomain,
|
|
@@ -5166,14 +5196,17 @@ var many2manyFieldController = (props) => {
|
|
|
5166
5196
|
options,
|
|
5167
5197
|
sessionStorageUtils
|
|
5168
5198
|
} = props;
|
|
5169
|
-
const appDispatch = (0,
|
|
5199
|
+
const appDispatch = (0, import_interface_logic16.useAppDispatch)();
|
|
5170
5200
|
const actionData = sessionStorageUtils.getActionData();
|
|
5171
5201
|
const [debouncedPage] = useDebounce(page, 500);
|
|
5172
|
-
const [order, setOrder] = (0,
|
|
5173
|
-
const [isLoadedData, setIsLoadedData] = (0,
|
|
5174
|
-
const [domainMany2Many, setDomainMany2Many] = (0,
|
|
5175
|
-
const env = (0,
|
|
5176
|
-
const {
|
|
5202
|
+
const [order, setOrder] = (0, import_react16.useState)();
|
|
5203
|
+
const [isLoadedData, setIsLoadedData] = (0, import_react16.useState)(false);
|
|
5204
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react16.useState)(domain);
|
|
5205
|
+
const env = (0, import_interface_logic16.getEnv)();
|
|
5206
|
+
const {
|
|
5207
|
+
// tableHead,
|
|
5208
|
+
selectedTags
|
|
5209
|
+
} = (0, import_interface_logic16.useAppSelector)(import_interface_logic16.selectSearch);
|
|
5177
5210
|
const viewParams = {
|
|
5178
5211
|
model: relation,
|
|
5179
5212
|
views: [
|
|
@@ -5182,11 +5215,11 @@ var many2manyFieldController = (props) => {
|
|
|
5182
5215
|
],
|
|
5183
5216
|
context
|
|
5184
5217
|
};
|
|
5185
|
-
const { data: viewResponse, isFetched: isViewReponseFetched } = (0,
|
|
5218
|
+
const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic16.useGetView)(
|
|
5186
5219
|
viewParams,
|
|
5187
5220
|
actionData
|
|
5188
5221
|
);
|
|
5189
|
-
const baseModel = (0,
|
|
5222
|
+
const baseModel = (0, import_react16.useMemo)(
|
|
5190
5223
|
() => ({
|
|
5191
5224
|
name: String(relation),
|
|
5192
5225
|
view: viewResponse || {},
|
|
@@ -5198,26 +5231,26 @@ var many2manyFieldController = (props) => {
|
|
|
5198
5231
|
}),
|
|
5199
5232
|
[model, viewResponse]
|
|
5200
5233
|
);
|
|
5201
|
-
const initModel = (0,
|
|
5202
|
-
const modelInstance = (0,
|
|
5234
|
+
const initModel = (0, import_interface_logic16.useModel)();
|
|
5235
|
+
const modelInstance = (0, import_react16.useMemo)(() => {
|
|
5203
5236
|
if (viewResponse) {
|
|
5204
5237
|
return initModel.initModel(baseModel);
|
|
5205
5238
|
}
|
|
5206
5239
|
return null;
|
|
5207
5240
|
}, [baseModel, viewResponse]);
|
|
5208
|
-
const specification = (0,
|
|
5241
|
+
const specification = (0, import_react16.useMemo)(() => {
|
|
5209
5242
|
if (modelInstance) {
|
|
5210
5243
|
return modelInstance.getSpecification();
|
|
5211
5244
|
}
|
|
5212
5245
|
return null;
|
|
5213
5246
|
}, [modelInstance]);
|
|
5214
5247
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5215
|
-
const optionsObject = tab?.options ? (0,
|
|
5248
|
+
const optionsObject = tab?.options ? (0, import_interface_logic16.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic16.evalJSONContext)(options) : {}) || {};
|
|
5216
5249
|
const fetchData = async () => {
|
|
5217
5250
|
try {
|
|
5218
5251
|
setDomainMany2Many(domain);
|
|
5219
|
-
appDispatch((0,
|
|
5220
|
-
appDispatch((0,
|
|
5252
|
+
appDispatch((0, import_interface_logic16.setFirstDomain)(domain));
|
|
5253
|
+
appDispatch((0, import_interface_logic16.setViewDataStore)(viewResponse));
|
|
5221
5254
|
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
5222
5255
|
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
5223
5256
|
...field
|
|
@@ -5228,7 +5261,7 @@ var many2manyFieldController = (props) => {
|
|
|
5228
5261
|
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
5229
5262
|
});
|
|
5230
5263
|
}
|
|
5231
|
-
appDispatch((0,
|
|
5264
|
+
appDispatch((0, import_interface_logic16.setPage)(0));
|
|
5232
5265
|
} catch (err) {
|
|
5233
5266
|
console.log(err);
|
|
5234
5267
|
}
|
|
@@ -5250,7 +5283,7 @@ var many2manyFieldController = (props) => {
|
|
|
5250
5283
|
context,
|
|
5251
5284
|
fields: groupByDomain?.fields,
|
|
5252
5285
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5253
|
-
sort: order ? order : default_order ? (0,
|
|
5286
|
+
sort: order ? order : default_order ? (0, import_interface_logic16.formatSortingString)(default_order) : ""
|
|
5254
5287
|
};
|
|
5255
5288
|
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5256
5289
|
const {
|
|
@@ -5258,19 +5291,19 @@ var many2manyFieldController = (props) => {
|
|
|
5258
5291
|
isLoading: isDataLoading,
|
|
5259
5292
|
isFetched: isDataResponseFetched,
|
|
5260
5293
|
isPlaceholderData
|
|
5261
|
-
} = (0,
|
|
5262
|
-
(0,
|
|
5294
|
+
} = (0, import_interface_logic16.useGetListData)(data, queryKey, enabled);
|
|
5295
|
+
(0, import_react16.useEffect)(() => {
|
|
5263
5296
|
if (viewResponse) {
|
|
5264
5297
|
fetchData();
|
|
5265
5298
|
}
|
|
5266
5299
|
return () => {
|
|
5267
|
-
appDispatch((0,
|
|
5300
|
+
appDispatch((0, import_interface_logic16.setGroupByDomain)(null));
|
|
5268
5301
|
setFields((prevFields) => ({
|
|
5269
5302
|
...prevFields,
|
|
5270
5303
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
5271
5304
|
}));
|
|
5272
|
-
appDispatch((0,
|
|
5273
|
-
|
|
5305
|
+
appDispatch((0, import_interface_logic16.setPage)(0));
|
|
5306
|
+
setSelectedRowKeys4([]);
|
|
5274
5307
|
setDomainMany2Many(null);
|
|
5275
5308
|
setIsLoadedData(false);
|
|
5276
5309
|
};
|
|
@@ -5293,18 +5326,18 @@ var many2manyFieldController = (props) => {
|
|
|
5293
5326
|
refetch,
|
|
5294
5327
|
data: dataFormViewResponse,
|
|
5295
5328
|
isSuccess
|
|
5296
|
-
} = (0,
|
|
5329
|
+
} = (0, import_interface_logic16.useGetFormView)({
|
|
5297
5330
|
data: dataFormView,
|
|
5298
5331
|
queryKey: [`form-view-action-${relation}`],
|
|
5299
5332
|
enabled: false
|
|
5300
5333
|
});
|
|
5301
|
-
(0,
|
|
5334
|
+
(0, import_react16.useEffect)(() => {
|
|
5302
5335
|
if (isSuccess && dataFormViewResponse) {
|
|
5303
5336
|
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
5304
5337
|
window.location.href = `/form/menu?model=${relation}`;
|
|
5305
5338
|
}
|
|
5306
5339
|
}, [isSuccess]);
|
|
5307
|
-
(0,
|
|
5340
|
+
(0, import_react16.useEffect)(() => {
|
|
5308
5341
|
if (domainMany2Many && !isLoadedData) {
|
|
5309
5342
|
setIsLoadedData(true);
|
|
5310
5343
|
}
|
|
@@ -5316,12 +5349,42 @@ var many2manyFieldController = (props) => {
|
|
|
5316
5349
|
console.log(error);
|
|
5317
5350
|
}
|
|
5318
5351
|
};
|
|
5319
|
-
return {
|
|
5352
|
+
return {
|
|
5353
|
+
rows,
|
|
5354
|
+
columns,
|
|
5355
|
+
typeTable,
|
|
5356
|
+
handleCreateNewOnPage,
|
|
5357
|
+
isLoadedData,
|
|
5358
|
+
domainMany2Many,
|
|
5359
|
+
isDataLoading,
|
|
5360
|
+
isDataResponseFetched,
|
|
5361
|
+
isPlaceholderData,
|
|
5362
|
+
queryKey,
|
|
5363
|
+
data,
|
|
5364
|
+
specification,
|
|
5365
|
+
enabled,
|
|
5366
|
+
isViewReponseFetched,
|
|
5367
|
+
actionData,
|
|
5368
|
+
viewResponse,
|
|
5369
|
+
debouncedPage,
|
|
5370
|
+
order,
|
|
5371
|
+
default_order,
|
|
5372
|
+
optionsObject,
|
|
5373
|
+
setDomainMany2Many,
|
|
5374
|
+
// tableHead,
|
|
5375
|
+
selectedTags,
|
|
5376
|
+
initModel,
|
|
5377
|
+
modelInstance,
|
|
5378
|
+
baseModel,
|
|
5379
|
+
dataResponse,
|
|
5380
|
+
isLoading: isDataLoading,
|
|
5381
|
+
setOrder
|
|
5382
|
+
};
|
|
5320
5383
|
};
|
|
5321
5384
|
|
|
5322
5385
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5323
|
-
var
|
|
5324
|
-
var
|
|
5386
|
+
var import_react17 = require("react");
|
|
5387
|
+
var import_interface_logic17 = require("@fctc/interface-logic");
|
|
5325
5388
|
var many2manyTagsController = (props) => {
|
|
5326
5389
|
const {
|
|
5327
5390
|
relation,
|
|
@@ -5332,10 +5395,10 @@ var many2manyTagsController = (props) => {
|
|
|
5332
5395
|
placeholderNoOption
|
|
5333
5396
|
} = props;
|
|
5334
5397
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5335
|
-
const env = (0,
|
|
5336
|
-
const addtionalFields = optionsFields ? (0,
|
|
5337
|
-
const domainObject = (0,
|
|
5338
|
-
() => (0,
|
|
5398
|
+
const env = (0, import_interface_logic17.getEnv)();
|
|
5399
|
+
const addtionalFields = optionsFields ? (0, import_interface_logic17.evalJSONContext)(optionsFields) : null;
|
|
5400
|
+
const domainObject = (0, import_react17.useMemo)(
|
|
5401
|
+
() => (0, import_interface_logic17.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5339
5402
|
[domain, formValues]
|
|
5340
5403
|
);
|
|
5341
5404
|
const data = {
|
|
@@ -5345,13 +5408,13 @@ var many2manyTagsController = (props) => {
|
|
|
5345
5408
|
id: {},
|
|
5346
5409
|
name: {},
|
|
5347
5410
|
display_name: {},
|
|
5348
|
-
...widget &&
|
|
5349
|
-
...widget &&
|
|
5411
|
+
...widget && import_interface_logic17.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
5412
|
+
...widget && import_interface_logic17.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
5350
5413
|
},
|
|
5351
5414
|
enabled: true,
|
|
5352
5415
|
context: env.context
|
|
5353
5416
|
};
|
|
5354
|
-
const { data: dataOfSelection } = (0,
|
|
5417
|
+
const { data: dataOfSelection } = (0, import_interface_logic17.useGetSelection)({
|
|
5355
5418
|
data,
|
|
5356
5419
|
queryKey: [`data_${relation}`, domainObject]
|
|
5357
5420
|
});
|
|
@@ -5377,8 +5440,8 @@ var many2manyTagsController = (props) => {
|
|
|
5377
5440
|
};
|
|
5378
5441
|
|
|
5379
5442
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5380
|
-
var
|
|
5381
|
-
var
|
|
5443
|
+
var import_react18 = require("react");
|
|
5444
|
+
var import_interface_logic18 = require("@fctc/interface-logic");
|
|
5382
5445
|
var durationController = (props) => {
|
|
5383
5446
|
const {
|
|
5384
5447
|
relation,
|
|
@@ -5395,14 +5458,14 @@ var durationController = (props) => {
|
|
|
5395
5458
|
name: "",
|
|
5396
5459
|
fold: ""
|
|
5397
5460
|
};
|
|
5398
|
-
const [disabled, setDisabled] = (0,
|
|
5399
|
-
const [modelStatus, setModalStatus] = (0,
|
|
5400
|
-
const { context } = (0,
|
|
5461
|
+
const [disabled, setDisabled] = (0, import_react18.useState)(false);
|
|
5462
|
+
const [modelStatus, setModalStatus] = (0, import_react18.useState)(false);
|
|
5463
|
+
const { context } = (0, import_interface_logic18.useAppSelector)(import_interface_logic18.selectEnv);
|
|
5401
5464
|
const queryKey = [`data-status-duration`, specification];
|
|
5402
5465
|
const listDataProps = {
|
|
5403
5466
|
model: relation,
|
|
5404
5467
|
specification,
|
|
5405
|
-
domain: (0,
|
|
5468
|
+
domain: (0, import_interface_logic18.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5406
5469
|
limit: 10,
|
|
5407
5470
|
offset: 0,
|
|
5408
5471
|
fields: "",
|
|
@@ -5412,8 +5475,8 @@ var durationController = (props) => {
|
|
|
5412
5475
|
},
|
|
5413
5476
|
sort: ""
|
|
5414
5477
|
};
|
|
5415
|
-
const { data: dataResponse } = (0,
|
|
5416
|
-
const { mutate: fetchChangeStatus } = (0,
|
|
5478
|
+
const { data: dataResponse } = (0, import_interface_logic18.useGetListData)(listDataProps, queryKey);
|
|
5479
|
+
const { mutate: fetchChangeStatus } = (0, import_interface_logic18.useChangeStatus)();
|
|
5417
5480
|
const handleClick = async (stage_id) => {
|
|
5418
5481
|
setDisabled(true);
|
|
5419
5482
|
if (stage_id) {
|
|
@@ -5449,7 +5512,7 @@ var durationController = (props) => {
|
|
|
5449
5512
|
};
|
|
5450
5513
|
|
|
5451
5514
|
// src/widget/basic/priority-field/controller.ts
|
|
5452
|
-
var
|
|
5515
|
+
var import_interface_logic19 = require("@fctc/interface-logic");
|
|
5453
5516
|
var priorityFieldController = (props) => {
|
|
5454
5517
|
const {
|
|
5455
5518
|
value,
|
|
@@ -5464,11 +5527,11 @@ var priorityFieldController = (props) => {
|
|
|
5464
5527
|
viewData,
|
|
5465
5528
|
context
|
|
5466
5529
|
} = props;
|
|
5467
|
-
const _context = { ...(0,
|
|
5530
|
+
const _context = { ...(0, import_interface_logic19.evalJSONContext)(actionData?.context) };
|
|
5468
5531
|
const contextObject = { ...context, ..._context };
|
|
5469
5532
|
const defaultPriority = parseInt(value) + 1;
|
|
5470
5533
|
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
5471
|
-
const { mutateAsync: fetchSave } = (0,
|
|
5534
|
+
const { mutateAsync: fetchSave } = (0, import_interface_logic19.useSave)();
|
|
5472
5535
|
const savePriorities = async ({
|
|
5473
5536
|
value: value2,
|
|
5474
5537
|
resetPriority
|
|
@@ -5503,8 +5566,8 @@ var priorityFieldController = (props) => {
|
|
|
5503
5566
|
};
|
|
5504
5567
|
|
|
5505
5568
|
// src/widget/basic/float-time-field/controller.ts
|
|
5506
|
-
var
|
|
5507
|
-
var
|
|
5569
|
+
var import_react19 = require("react");
|
|
5570
|
+
var import_interface_logic20 = require("@fctc/interface-logic");
|
|
5508
5571
|
var floatTimeFiledController = ({
|
|
5509
5572
|
onChange: fieldOnChange,
|
|
5510
5573
|
onBlur,
|
|
@@ -5513,11 +5576,11 @@ var floatTimeFiledController = ({
|
|
|
5513
5576
|
props
|
|
5514
5577
|
}) => {
|
|
5515
5578
|
const { name, defaultValue = 0, onChange } = props;
|
|
5516
|
-
const [input, setInput] = (0,
|
|
5517
|
-
(0,
|
|
5579
|
+
const [input, setInput] = (0, import_react19.useState)(
|
|
5580
|
+
(0, import_interface_logic20.convertFloatToTime)(value ?? defaultValue)
|
|
5518
5581
|
);
|
|
5519
|
-
const [formattedTime, setFormattedTime] = (0,
|
|
5520
|
-
const [errors, setErrors] = (0,
|
|
5582
|
+
const [formattedTime, setFormattedTime] = (0, import_react19.useState)("");
|
|
5583
|
+
const [errors, setErrors] = (0, import_react19.useState)("");
|
|
5521
5584
|
const handleInputChange = (e) => {
|
|
5522
5585
|
const raw = e.target.value.replace(/[^\d:]/g, "");
|
|
5523
5586
|
setInput(raw);
|
|
@@ -5547,7 +5610,7 @@ var floatTimeFiledController = ({
|
|
|
5547
5610
|
if (!isDirty) return;
|
|
5548
5611
|
if (formattedTime) {
|
|
5549
5612
|
setInput(formattedTime);
|
|
5550
|
-
const floatVal = (0,
|
|
5613
|
+
const floatVal = (0, import_interface_logic20.convertTimeToFloat)(formattedTime);
|
|
5551
5614
|
fieldOnChange(floatVal);
|
|
5552
5615
|
if (onChange) {
|
|
5553
5616
|
onChange(name ?? "", floatVal);
|
|
@@ -5590,31 +5653,7 @@ var floatTimeFiledController = ({
|
|
|
5590
5653
|
};
|
|
5591
5654
|
|
|
5592
5655
|
// src/widget/basic/float-field/controller.ts
|
|
5593
|
-
var
|
|
5594
|
-
|
|
5595
|
-
// src/utils/i18n.ts
|
|
5596
|
-
var import_react_i18next2 = require("react-i18next");
|
|
5597
|
-
var import_i18next = __toESM(require("i18next"));
|
|
5598
|
-
var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"));
|
|
5599
|
-
import_i18next.default.use(import_i18next_browser_languagedetector.default).use(import_react_i18next2.initReactI18next).init({
|
|
5600
|
-
resources: {
|
|
5601
|
-
vi: { translation: vi },
|
|
5602
|
-
en: { translation: en }
|
|
5603
|
-
},
|
|
5604
|
-
fallbackLng: "vi",
|
|
5605
|
-
lng: "vi_VN",
|
|
5606
|
-
debug: false,
|
|
5607
|
-
nonExplicitSupportedLngs: true,
|
|
5608
|
-
interpolation: {
|
|
5609
|
-
escapeValue: false
|
|
5610
|
-
},
|
|
5611
|
-
detection: {
|
|
5612
|
-
caches: ["cookie"]
|
|
5613
|
-
}
|
|
5614
|
-
});
|
|
5615
|
-
var i18n_default = import_i18next.default;
|
|
5616
|
-
|
|
5617
|
-
// src/widget/basic/float-field/controller.ts
|
|
5656
|
+
var import_react20 = require("react");
|
|
5618
5657
|
var floatController = ({
|
|
5619
5658
|
onChange,
|
|
5620
5659
|
value,
|
|
@@ -5622,10 +5661,10 @@ var floatController = ({
|
|
|
5622
5661
|
}) => {
|
|
5623
5662
|
const { name, required, methods, onChange: handleOnchange, string } = props;
|
|
5624
5663
|
const { setError, clearErrors } = methods;
|
|
5625
|
-
const [inputValue, setInputValue] = (0,
|
|
5664
|
+
const [inputValue, setInputValue] = (0, import_react20.useState)(
|
|
5626
5665
|
value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
|
|
5627
5666
|
);
|
|
5628
|
-
(0,
|
|
5667
|
+
(0, import_react20.useEffect)(() => {
|
|
5629
5668
|
if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
|
|
5630
5669
|
setInputValue(useFormatFloatNumber(value));
|
|
5631
5670
|
clearErrors(name);
|
|
@@ -5633,9 +5672,9 @@ var floatController = ({
|
|
|
5633
5672
|
setInputValue("");
|
|
5634
5673
|
}
|
|
5635
5674
|
}, [value, name, clearErrors]);
|
|
5636
|
-
const isDirtyRef = (0,
|
|
5637
|
-
const inputRef = (0,
|
|
5638
|
-
const lastCommittedValueRef = (0,
|
|
5675
|
+
const isDirtyRef = (0, import_react20.useRef)(false);
|
|
5676
|
+
const inputRef = (0, import_react20.useRef)(null);
|
|
5677
|
+
const lastCommittedValueRef = (0, import_react20.useRef)(null);
|
|
5639
5678
|
const handleInputChange = (e) => {
|
|
5640
5679
|
const newValue = e.target.value;
|
|
5641
5680
|
const valueWithoutCommas = newValue.replace(/,/g, "");
|
|
@@ -5736,10 +5775,10 @@ var useFormatFloatNumber = (value) => {
|
|
|
5736
5775
|
};
|
|
5737
5776
|
|
|
5738
5777
|
// src/widget/basic/download-file-field/controller.ts
|
|
5739
|
-
var
|
|
5778
|
+
var import_react21 = require("react");
|
|
5740
5779
|
var downloadFileController = () => {
|
|
5741
|
-
const inputId = (0,
|
|
5742
|
-
const [file, setFile] = (0,
|
|
5780
|
+
const inputId = (0, import_react21.useId)();
|
|
5781
|
+
const [file, setFile] = (0, import_react21.useState)(null);
|
|
5743
5782
|
const handleFileChange = (e) => {
|
|
5744
5783
|
setFile(e.target.files[0]);
|
|
5745
5784
|
};
|
|
@@ -5909,13 +5948,13 @@ var dateFieldController = (props) => {
|
|
|
5909
5948
|
};
|
|
5910
5949
|
|
|
5911
5950
|
// src/widget/basic/copy-link-button/controller.ts
|
|
5912
|
-
var
|
|
5913
|
-
var
|
|
5951
|
+
var import_react22 = require("react");
|
|
5952
|
+
var import_interface_logic21 = require("@fctc/interface-logic");
|
|
5914
5953
|
var copyLinkButtonController = (props) => {
|
|
5915
5954
|
const { value, defaultValue } = props;
|
|
5916
|
-
const [isCopied, setIsCopied] = (0,
|
|
5955
|
+
const [isCopied, setIsCopied] = (0, import_react22.useState)(false);
|
|
5917
5956
|
const handleCopyToClipboard = async (value2) => {
|
|
5918
|
-
await (0,
|
|
5957
|
+
await (0, import_interface_logic21.copyTextToClipboard)(value2);
|
|
5919
5958
|
setIsCopied(true);
|
|
5920
5959
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
5921
5960
|
};
|
|
@@ -5928,14 +5967,14 @@ var copyLinkButtonController = (props) => {
|
|
|
5928
5967
|
};
|
|
5929
5968
|
|
|
5930
5969
|
// src/widget/basic/color-field/color-controller.ts
|
|
5931
|
-
var
|
|
5970
|
+
var import_interface_logic22 = require("@fctc/interface-logic");
|
|
5932
5971
|
var colorFieldController = (props) => {
|
|
5933
5972
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
5934
|
-
const env = (0,
|
|
5935
|
-
const _context = { ...(0,
|
|
5973
|
+
const env = (0, import_interface_logic22.getEnv)();
|
|
5974
|
+
const _context = { ...(0, import_interface_logic22.evalJSONContext)(actionData?.context) || {} };
|
|
5936
5975
|
const contextObject = { ...env.context, ..._context };
|
|
5937
5976
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
5938
|
-
const { mutate: onSave } = (0,
|
|
5977
|
+
const { mutate: onSave } = (0, import_interface_logic22.useSave)();
|
|
5939
5978
|
const savePickColor = async (colorObject) => {
|
|
5940
5979
|
const { id } = colorObject;
|
|
5941
5980
|
if (value === id) return;
|
|
@@ -5960,16 +5999,16 @@ var colorFieldController = (props) => {
|
|
|
5960
5999
|
};
|
|
5961
6000
|
|
|
5962
6001
|
// src/widget/basic/binary-field/controller.ts
|
|
5963
|
-
var
|
|
5964
|
-
var
|
|
6002
|
+
var import_react23 = require("react");
|
|
6003
|
+
var import_interface_logic23 = require("@fctc/interface-logic");
|
|
5965
6004
|
var binaryFieldController = (props) => {
|
|
5966
6005
|
const { name, methods, readonly = false, value } = props;
|
|
5967
|
-
const inputId = (0,
|
|
5968
|
-
const [selectedImage, setSelectedImage] = (0,
|
|
5969
|
-
const [initialImage, setInitialImage] = (0,
|
|
5970
|
-
const [isInsideTable, setIsInsideTable] = (0,
|
|
6006
|
+
const inputId = (0, import_react23.useId)();
|
|
6007
|
+
const [selectedImage, setSelectedImage] = (0, import_react23.useState)(null);
|
|
6008
|
+
const [initialImage, setInitialImage] = (0, import_react23.useState)(value || null);
|
|
6009
|
+
const [isInsideTable, setIsInsideTable] = (0, import_react23.useState)(false);
|
|
5971
6010
|
const { setValue } = methods;
|
|
5972
|
-
const binaryRef = (0,
|
|
6011
|
+
const binaryRef = (0, import_react23.useRef)(null);
|
|
5973
6012
|
const convertUrlToBase64 = async (url) => {
|
|
5974
6013
|
try {
|
|
5975
6014
|
const response = await fetch(url);
|
|
@@ -6018,11 +6057,11 @@ var binaryFieldController = (props) => {
|
|
|
6018
6057
|
};
|
|
6019
6058
|
const checkIsImageLink = (url) => {
|
|
6020
6059
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
6021
|
-
return imageExtensions.test(url) || (0,
|
|
6060
|
+
return imageExtensions.test(url) || (0, import_interface_logic23.isBase64Image)(url) || isBlobUrl(url);
|
|
6022
6061
|
};
|
|
6023
6062
|
const getImageBase64WithMimeType = (base64) => {
|
|
6024
6063
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
6025
|
-
if ((0,
|
|
6064
|
+
if ((0, import_interface_logic23.isBase64Image)(base64)) return base64;
|
|
6026
6065
|
let mimeType = null;
|
|
6027
6066
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
6028
6067
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -6031,14 +6070,14 @@ var binaryFieldController = (props) => {
|
|
|
6031
6070
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
6032
6071
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
6033
6072
|
};
|
|
6034
|
-
(0,
|
|
6073
|
+
(0, import_react23.useEffect)(() => {
|
|
6035
6074
|
return () => {
|
|
6036
6075
|
if (selectedImage) {
|
|
6037
6076
|
URL.revokeObjectURL(selectedImage);
|
|
6038
6077
|
}
|
|
6039
6078
|
};
|
|
6040
6079
|
}, [selectedImage]);
|
|
6041
|
-
(0,
|
|
6080
|
+
(0, import_react23.useEffect)(() => {
|
|
6042
6081
|
if (binaryRef.current) {
|
|
6043
6082
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
6044
6083
|
setIsInsideTable(isInsideTable2);
|